2003-05-18 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2003-05-18  Martin Baulig  <martin@ximian.com>
2
3         Reworked the way how local variables and parameters are handled by
4         the flow analysis code.
5
6         * statement.cs (TypeInfo, VariableMap): New public classes.
7         (VariableInfo): New public class.  This is now responsible for
8         checking whether a variable has been assigned.  It is used for
9         parameters and local variables.
10         (Block.EmitMeta): Take the InternalParameters as argument; compute
11         the layout of the flow vectors here.
12         (Block.LocalMap, Block.ParameterMap): New public properties.
13         (FlowBranching): The .ctor doesn't get the InternalParameters
14         anymore since Block.EmitMeta() now computes the layout of the flow
15         vector.
16         (MyStructInfo): This class is now known as `StructInfo' and nested
17         in `TypeInfo'; we don't access this directly anymore.
18
19         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
20         property and removed IsAssigned(), IsFieldAssigned(),
21         SetAssigned() and SetFieldAssigned(); we now call them on the
22         VariableInfo so we don't need to duplicate this code everywhere.
23
24         * expression.cs (ParameterReference): Added `Block block' argument
25         to the .ctor.
26         (LocalVariableReference, ParameterReference, This): The new
27         VariableInfo class is now responsible for all the definite
28         assignment stuff.
29
30         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
31         IsParameterAssigned, SetParameterAssigned): Removed.
32
33 2003-05-18  Martin Baulig  <martin@ximian.com>
34
35         * typemanager.cs (InitCoreTypes): Try calling
36         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
37         the 3-args-version.  Corlib now also needs our `void_type'.
38         (GetMethod): Added overloaded version which takes an optional
39         `bool report_errors' to allow lookups of optional methods.
40
41 2003-05-12  Martin Baulig  <martin@ximian.com>
42
43         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
44         only used for locals and not for parameters.
45
46 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
47
48         * support.cs (InternalParameters.ParameterType): Return the
49         ExternalType of the parameter.
50
51         * parameter.cs (Parameter.ExternalType): drop the two arguments,
52         they were unused.
53
54 s2003-05-11  Miguel de Icaza  <miguel@ximian.com>
55
56         * class.cs (MethodData.Define): Do not set the `newslot' on
57         interface members, if they are also flagged as "override".
58
59         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
60         better code for ++i and i++.  This only works for static fields
61         and local variables.
62
63         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
64         want to pull the DeclSpace out of the builder_to_declspace instead
65         of the TypeBuilder (like in TypeContainer.FindMembers).
66
67         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
68         instead of LookupTypeContainer.  Fixes the crash on .NET for
69         looking up interface members.
70
71         * const.cs: Create our own emit context during the Definition
72         stage, so that constants are evaluated in the proper context, when
73         a recursive definition happens.
74
75 2003-05-11  Martin Baulig  <martin@ximian.com>
76
77         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
78         new block for a switch section.
79         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
80         the adding/lookup in the switch block.  Fixes #39828.
81
82 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
83
84         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
85         functionality: I needed to convert the data after I had performed
86         the add/sub operation into the operands type size.
87
88         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
89         pass the type for the box operation, otherwise the resulting
90         object would have been of type object.
91
92         (BoxedCast): Add constructor to specify the type to box as.
93
94 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
95
96         * iterators.cs: I was reusing the `count' variable inadvertently,
97         take steps to not allow this to happen.
98
99 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
100
101         * attribute.cs (Attribute.Resolve): Params attributes are encoded
102         by creating an array at the point where the params starts and
103         putting all those arguments there, then adjusting the size of the
104         array.
105
106 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
107
108         * expression.cs (New.AddressOf): Implement interface
109         IMemoryLocation.  This is used when the `new' operator is used in
110         the context of an invocation to a method on a value type.
111
112         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
113         example. 
114
115         * namespace.cs: Also check the using aliases here.
116
117         * driver.cs: Move the test for using validity after the types have
118         been entered, so we do a single pass that also includes the using
119         aliases. 
120
121         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
122         in the regular case.   CreateSiblingForFinally is doing extra
123         error checking.
124
125         * attribute.cs (GetAttributeArgumentExpression): Store the result
126         on an out value, and use the return value to indicate failure
127         instead of using null (which is a valid return for Constant.GetValue).
128
129         * statement.cs: Perform the analysis flow for the increment
130         portion after the statement, because this will be the real flow of
131         execution.  Fixes #42385
132
133         * codegen.cs (EmitContext.EmitArgument,
134         EmitContext.EmitStoreArgument): New helper functions when the
135         RemapToProxy flag is set.
136
137         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
138         function.
139
140         Add support for remapping parameters. 
141
142         * iterators.cs: Propagate parameter values;  Store parameter
143         values in the proxy classes.
144         
145 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
146
147         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
148         need a proxy reference;  I do not know what I was thinking
149
150         * cs-parser.jay (constructor_initializer): catch another error,
151         and display nice message.
152         
153         (field_declaration): catch void field declaration
154         to flag a better error. 
155
156         * class.cs (MemberBase.CheckBase): Report an error instead of a
157         warning if a new protected member is declared in a struct. 
158         (Field.Define): catch the error of readonly/volatile.
159
160         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
161
162         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
163         volatile variable is taken
164
165 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
166
167         * statement.cs (Fixed.Resolve): Report an error if we are not in
168         an unsafe context.
169
170 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
171
172         * typemanager.cs: reuse the code that handles type clashes for
173         delegates and enumerations.
174
175         * class.cs (Report28): Always report.
176
177         * expression.cs (EncodeAsAttribute): Allow nulls here.
178
179 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
180
181         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
182         the functionality for testing whether an expression is valid for
183         an attribute here.  Also handle the case of arrays of elements
184         being stored. 
185
186         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
187         encoding a linear array into an array of objects that are suitable
188         to be passed to an CustomAttributeBuilder.
189
190         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
191
192         * ecore.cs: (FieldExpr): Handle field remapping here.
193
194         * iteratators.cs: Pass the instance variable (if the method is an
195         instance method) to the constructors, so we can access the field
196         variables on the class.
197
198         TODO: Test this with structs.  I think the THIS variable on
199         structs might have to be a pointer, and not a refenrece
200
201 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
202
203         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
204         local variables to fields in a proxy class.
205
206         * iterators.cs (PopulateProxy): Rename our internal fields to
207         <XXX>.  
208         Create a <THIS> field if we are an instance method, so we can
209         reference our parent container variables.
210         (MapVariable): Called back from the EmitContext code to enter a
211         new variable to field mapping into the proxy class (we just create
212         a FieldBuilder).
213
214         * expression.cs
215         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
216         for using the remapped locals to fields.
217
218         I placed the code here, because that gives the same semantics to
219         local variables, and only changes the Emit code.
220
221         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
222         statements inside iterators.
223         (VariableInfo): Add a FieldBuilder for the cases when we are
224         remapping local variables to fields in a proxy class
225
226         * ecore.cs (SimpleNameResolve): Avoid testing two times for
227         current_block != null.
228
229         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
230         not cope with strings, as it has been moved to the
231         TableSwitchEmit.  Fixed bug in switch generation.
232
233         * expression.cs (New.DoResolve): Provide more context for the user
234         when reporting an error.
235
236         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
237         pointers. 
238
239         * expression.cs (MemberAccess.DoResolve): When we get a type back,
240         check the permissions for it.  Note than in a type-resolution
241         context the check was already present in DeclSpace.ResolveType,
242         but was missing from the MemberAccess.
243
244         (ArrayCreation.CheckIndices): warn if the user has
245         more nested levels of expressions, but there are no more
246         dimensions specified.  Avoids crash on bug 41906.
247
248 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
249
250         * statement.cs (Block): replace Implicit bool, for a generic
251         flags.   
252         New flag: `Unchecked'.  This is used during the EmitMeta phase
253         (which is out-of-line with the regular Resolve/Emit process for a
254         statement, as this is done ahead of time, but still gets a chance
255         to call constant resolve).
256         
257         (Block.Flags): new enum for adding a new flag.
258
259         (Block.EmitMeta): track the state of unchecked.
260         
261         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
262         to enable constant resolution to work there as well.
263
264 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
265
266         * typemanager.cs (ienumerable_type): Also look up
267         System.Collections.IEnumerable. 
268
269 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
270
271         TODO: Test more than one conditional per method.
272         
273         * class.cs (Indexer.Define): Report the location where the user is
274         referencing the unsupported feature.
275
276         (MethodData): Overload the use of `conditionals' to
277         minimize the creation of needless ArrayLists.   This saves roughly
278         212kb on my machine.
279
280         (Method): Implement the new IIteratorContainer interface.
281         (Method.SetYields): Implement the method by setting the ModFlags
282         to contain METHOD_YIELDS.
283         
284         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
285         which just got set to null.
286
287         * iterators.cs: New file.
288
289         (Yield, YieldBreak): New statements.
290
291         * statement.cs (Return.Resolve): Flag an error if we are used in
292         an iterator method.
293
294         * codegen.cs (InIterator): New flag set if the code is being
295         compiled in an iterator method.
296
297         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
298         internal modifier, and we just use it to avoid adding extra
299         fields, as this is seldom used.  
300
301         * cs-parser.jay: Add yield_statement (yield and yield break).
302
303         * driver.cs: New flag -v2 to turn on version 2 features. 
304
305         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
306         hashtable when v2 is enabled.
307
308 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
309
310         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
311         there is already a namespace defined with this name.
312
313         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
314         people upgraded their corlibs.
315
316         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
317         always use fully qualified types, no need to use the compiler
318         front end.
319
320         (TypeManager.IsNamespace): Use binarysearch.
321         
322         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
323         AddDelegate): I did not quite use the new IsValid API properly: I
324         have to pass the short-name and the fullname.  I was passing only
325         the basename instead of the fullname sometimes. 
326
327         (TypeContainer.DefineType): call NamespaceClash.
328
329         * interface.cs (Interface.DefineType): use NamespaceClash before
330         defining the type.
331
332         * delegate.cs (Delegate.DefineType): use NamespaceClash before
333         defining the type.
334
335         * enum.cs: (Enum.DefineType): use NamespaceClash before
336         defining the type.
337
338         * typemanager.cs (: 3-line patch that gives us some tasty 11%
339         speed increase.  First, use the negative_hits cache when we get a
340         negative.  Second, add the type with its full original name
341         instead of the new . and + encoded name (reflection uses + to
342         separate type from a nested type).  Use LookupTypeReflection
343         directly which bypasses the type->name hashtable (that we already
344         know does not contain the type.
345         
346         * decl.cs (DeclSpace.ResolveTypeExpr): track the
347         location/container type. 
348
349         * driver.cs: When passing utf8, use directly the UTF8Encoding.
350
351 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
352
353         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
354
355         * delegate.cs (NewDelegate.Resolve): Test whether an instance
356         method is being referenced in the method group from a static
357         context, and report error 120 if so.
358
359         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
360         Error118. 
361
362         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
363         is created, we create the A namespace).
364
365         * cs-parser.jay: A namespace also introduces a DeclarationFound.
366         Fixes #41591
367
368 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
369
370         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
371         invocation to ModuleBuilder.GetType with the same values will
372         return a new type instance, so we need to cache its return
373         values. 
374
375         * expression.cs (Binary.ResolveOperator): Only allow the compare
376         operators on enums if they are of the same type.
377
378         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
379         types of ValueType on their own case.  Before we were giving them
380         the same treatment as objects.
381
382         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
383         fullname.  Short name is used to compare against container name.
384         Fullname is used to check against defined namespace names.
385         
386         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
387         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
388
389         (Method.CheckBase): Call parent.
390         (MemberBase.CheckBase): Check for protected members on sealed
391         classes.
392         (PropertyBase.CheckBase): Call parent.
393         (Field.Define): Call parent.
394
395         * report.cs: Negative error codes are now mapped to 8000 - code,
396         so that the display is render more nicely.
397
398         * typemanager.cs: Do not use try/catch, instead report a regular
399         error. 
400
401         (GetPointerType, GetReferenceType): These methods provide
402         mechanisms to obtain the T* and T& from a T.  We had the code
403         previously scattered around the code base, and it also used
404         TypeManager.LookupType that would go through plenty of caches.
405         This one goes directly to the type source.
406
407         In some places we did the Type.GetType followed by
408         ModuleBuilder.GetType, but not in others, so this unifies the
409         processing as well.
410
411         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
412         statements now that we have namespace information.
413
414         * typemanager.cs (IsNamespace): New method, returns whether the
415         string presented is a namespace or not.
416
417         (ComputeNamespaces): New public entry point, computes the list of
418         available namespaces, using the GetNamespaces API call in Mono, or
419         the slower version in MS.NET.   
420
421         Now before we start the semantic analysis phase, we have a
422         complete list of namespaces including everything that the user has
423         provided.
424
425         Deleted old code to cache namespaces in .nsc files.
426
427 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
428
429         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
430         class/struct location definition Location for the implicit
431         constructor location.
432
433         (Operator.Define): Use the location of the operator for the
434         implicit Method definition.
435
436         (Constructor.Emit): use the constructor location for the implicit
437         base initializer constructor.
438
439         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
440         and the Expression class now contains two new methods:
441
442         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
443         isolate type lookup from the rest of the resolution process.
444
445         Since we use Expressions to hold type definitions due to the way
446         we parse the input we have historically overloaded Resolve to
447         perform the Type lookups if a special flag is passed.  Now this is
448         eliminated and two methods take their place. 
449         
450         The differences in the two methods between xStep and xTerminal is
451         that xStep is involved in our current lookup system that uses
452         SimpleNames to compose a name, while xTerminal is used just to
453         catch the case where the simplename lookup failed.
454         
455 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
456
457         * expression.cs (ResolveMemberAccess): Remove redundant code.
458         TypeExpr expressions are always born fully resolved.
459
460         * interface.cs (PopulateMethod): Do not lookup the types twice.
461         We were doing it once during SemanticAnalysis and once during
462         PopulateMethod.
463
464         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
465         in local variable type definitions, were being returned as a
466         SimpleName (we decomposed everything into a string), that is
467         because primary_expression was being used instead of a type in the
468         grammar (reduce/reduce conflicts).
469
470         The part that was wrong is that we converted the expression into a
471         string (an oversimplification in one hand, compounded with primary
472         expressions doing string concatenation).
473
474         So things like:
475
476         A.B.C [] x;
477
478         Would return "A.B.C[]" as a SimpleName.  This stopped things like
479         using clauses from working on this particular context.  And a type
480         was being matched directly against "A.B.C[]".
481
482         We now use the correct approach, and allow for ComposedCast to be
483         part of the unary expression.  So the "A.B.C []" become a composed
484         cast of "A.B.C" (as a nested group of MemberAccess with a
485         SimpleName at the end) plus the rank composition "[]". 
486
487         Also fixes 35567
488         
489 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
490
491         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
492         for the access level checking.
493
494         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
495         `TypeContainer container', because I kept getting confused when I
496         was debugging this code.
497
498         * expression.cs (Indexers): Instead of tracking getters/setters,
499         we now track them in parallel.  We create one arraylist less, but
500         most importantly it is possible now for the LValue code to find a
501         matching get for a set.
502
503         (IndexerAccess.DoResolveLValue): Update the code.
504         GetIndexersForType has been modified already to extract all the
505         indexers from a type.  The code assumed it did not.
506
507         Also make the code set the correct return type for the indexer.
508         This was fixed a long time ago for properties, but was missing for
509         indexers.  It used to be void_type.
510
511         (Binary.Emit): Test first for doubles instead of
512         floats, as they are more common.
513
514         (Binary.EmitBranchable): Use the .un version of the branch opcodes
515         when dealing with floats and the <=, >= operators.  This fixes bug
516         #39314 
517
518         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
519         to load the array value by emitting a load on the foreach variable
520         type.  This was incorrect.  
521
522         We now emit the code to load an element using the the array
523         variable type, and then we emit the conversion operator.
524
525         Fixed #40176
526
527 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
528
529         * attribute.cs: Avoid allocation of ArrayLists in the common case.
530
531 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
532
533         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
534         test for protection before we test for signatures. 
535
536         (MethodSignature.ToString): implement.
537
538         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
539         to the case where we reduced into a LongConstant.
540
541         * decl.cs (CheckAccessLevel): If the type is an array, we can not
542         depend on whether the information is acurrate, because the
543         Microsoft runtime will always claim that the array type is public,
544         regardless of the real state.
545
546         If the type is a pointer, another problem happens: the type is
547         reported as non-public in Microsoft.  
548
549         In both cases we have to call CheckAccessLevel recursively with
550         the underlying type as the argument to be tested.
551
552 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
553
554         * assign.cs (Assign.Emit): If we are dealing with a compound
555         assignment expression, we should use the code path that stores the
556         intermediate result in a temporary value.  This fixes #40903.
557
558         *expression.cs (Indirection.ToString): Provide ToString method for
559         debugging. 
560         
561 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
562
563         * class.cs: Null out fields holding references to Block objects so
564         they can be garbage collected.
565
566         * expression.cs (OverloadResolve): Remove unused local.
567
568 2003-04-07  Martin Baulig  <martin@ximian.com>
569
570         * codegen.cs (EmitContext.CurrentFile): New public field.
571         (EmitContext.Mark): Use the CurrentFile to check whether the
572         location is in the correct file.
573         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
574
575 2003-04-07  Martin Baulig  <martin@ximian.com>
576
577         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
578
579         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
580         location.  [FIXME: The location argument which gets passed to this
581         method is sometimes wrong!]
582
583 2003-04-07  Nick Drochak <ndrochak@gol.com>
584
585         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
586
587 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
588
589         * expression.cs (Indirection.EmitAssign): We were using the
590         temporary, but returning immediately instead of continuing the
591         EmitAssing flow.
592
593 2003-04-06  Martin Baulig  <martin@ximian.com>
594
595         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
596         if it's a nested child, but also deriving from the outer class.
597         See test 190.cs.
598
599         * typemanager.cs (IsNestedChildOf): Make this work if it's a
600         nested child, but also deriving from the outer class.  See
601         test-190.cs.
602         (FilterWithClosure): We may access private members of the outer
603         class if we're a nested child and deriving from the outer class.
604         (RealMemberLookup): Only set `closure_private_ok' if the
605         `original_bf' contained BindingFlags.NonPublic.
606
607 2003-04-05  Martin Baulig  <martin@ximian.com>
608
609         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
610
611 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
612
613         * class.cs (Event.Define): Do not allow abstract events to have
614         initializers. 
615
616 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
617
618         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
619         block in event declarations.
620
621         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
622         value type, get its address.
623
624         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
625         leaving a class on the stack instead of a boolean value (int
626         0/1).  Change the code so we compare against null, and then the
627         result against zero.
628
629         * class.cs (TypeContainer.GetClassBases): We were checking for the
630         parent class being sealed too late.
631
632         * expression.cs (Binary.Emit): For <= and >= when dealing with
633         floating point values, use cgt.un and clt.un instead of cgt and
634         clt alone.
635
636 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
637
638         * statement.cs: Apply the same optimization as MS: skip the 
639         GetEnumerator returning an IEnumerator, and use the one returning a 
640         CharEnumerator instead. This allows us to avoid the try-finally block 
641         and the boxing.
642
643 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
644
645         * cs-parser.jay: Attributes cannot be applied to
646                          namespaces. Fixes #40473
647
648 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
649
650         * class.cs:
651         (Add*): check if the name is valid using the full name for constants,
652         fields, properties and events.
653
654 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
655
656         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
657         char constants to be part of the enumeration.
658
659         * expression.cs (Conditional.DoResolve): Add support for operator
660         true. Implements the missing functionality from 14.12
661
662         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
663         operator true/false as required by the spec.
664
665         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
666         implicit conversion to boolean.
667
668         * statement.cs (Statement.ResolveBoolean): A boolean expression is
669         also one where the type implements `operator true'. 
670
671         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
672         get an expression that will invoke operator true based on an
673         expression.  
674
675         (GetConversionOperators): Removed the hack that called op_True
676         here.  
677
678         (Expression.ResolveBoolean): Move this from Statement.
679
680 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
681
682         * ecore.cs (FieldExpr): do not allow initialization of initonly
683         fields on derived classes
684
685 2003-03-13  Martin Baulig  <martin@ximian.com>
686
687         * statement.cs (Block.Emit): Call ig.BeginScope() and
688         ig.EndScope() when compiling with debugging info; call
689         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
690
691 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
692
693         * expression.cs (Indexers): Do not construct immediately, allow
694         for new members to be appended as we go.  Fixes 38143
695
696 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
697
698         * expression.cs: save/restore context when resolving an unchecked
699         expression.
700
701 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
702
703         * cfold.cs: Catch division by zero in modulus operator during
704         constant folding.
705
706 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
707
708         * interface.cs (Interface.DefineMembers): Avoid defining members
709         twice. 
710
711 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
712
713         * driver.cs: handle the +/- options for -noconfig
714
715         * statement.cs (Unckeched.Resolve): Also track the state of
716         unchecked in the Resolve phase.
717
718 2003-02-27  Martin Baulig  <martin@ximian.com>
719
720         * ecore.cs (Expression.MemberLookup): Don't create a
721         MethodGroupExpr for something which is not a method.  Fixes #38291.
722
723 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
724
725         * class.cs (MemberBase.CheckParameters): Also check that the type
726         is unmanaged if it is a pointer.
727
728         * expression.cs (SizeOf.Resolve): Add location information.
729
730         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
731         a managed type is declared.
732
733         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
734         parameter modifiers as well.  Fixes bug 38606
735
736         * class.cs: Very sad.  Am backing out the speed up changes
737         introduced by the ArrayList -> Array in the TypeContainer, as they
738         were not actually that much faster, and introduced a bug (no error
739         reports on duplicated methods).
740
741         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
742         source first, this will guarantee that we have a valid expression
743         before calling in lower levels functions that will require a
744         resolved object.  Then use this original_source in the
745         target.ResolveLValue instead of the original source that was
746         passed to us.
747
748         Another change.  Use target.Resolve instead of LValueResolve.
749         Although we are resolving for LValues, we will let the Assign code
750         take care of that (it will be called again from Resolve).  This
751         basically allows code like this:
752
753         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
754         class Y { void A (X x) { x [0] += o; }
755
756         The problem was that the indexer was trying to resolve for
757         set_Item (idx, object o) and never finding one.  The real set_Item
758         was set_Item (idx, X).  By delaying the process we get the right
759         semantics. 
760
761         Fixes bug 36505
762         
763 2003-02-23  Martin Baulig  <martin@ximian.com>
764
765         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
766         while calling DoEmit ().
767
768         * codegen.cs (EmitContext.Mark): Don't mark locations in other
769         source files; if you use the #line directive inside a method, the
770         compiler stops emitting line numbers for the debugger until it
771         reaches the end of the method or another #line directive which
772         restores the original file.
773
774 2003-02-23  Martin Baulig  <martin@ximian.com>
775
776         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
777
778 2003-02-23  Martin Baulig  <martin@ximian.com>
779
780         * statement.cs (Block.AddChildVariableNames): We need to call this
781         recursively, not just for our immediate children.
782
783 2003-02-23  Martin Baulig  <martin@ximian.com>
784
785         * class.cs (Event.Define): Always make the field private, like csc does.
786
787         * typemanager.cs (TypeManager.RealMemberLookup): Make events
788         actually work, fixes bug #37521.
789
790 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
791
792         * delegate.cs: When creating the various temporary "Parameters"
793         classes, make sure that we call the ComputeAndDefineParameterTypes
794         on those new parameters (just like we do with the formal ones), to
795         allow them to be resolved in the context of the DeclSpace.
796
797         This fixes the bug that Dick observed in Bugzilla #38530.
798
799 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
800
801         * expression.cs (ResolveMemberAccess): When resolving a constant,
802         do not attempt to pull a constant if the value was not able to
803         generate a valid constant.
804
805         * const.cs (LookupConstantValue): Do not report more errors than required.
806
807 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
808
809         * expression.cs: fixes bug #38328.
810
811 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
812
813         * class.cs: Changed all the various members that can be part of a
814         class from being an ArrayList to be an Array of the right type.
815         During the DefineType type_list, interface_list, delegate_list and
816         enum_list are turned into types, interfaces, delegates and enums
817         arrays.  
818
819         And during the member population, indexer_list, event_list,
820         constant_list, field_list, instance_constructor_list, method_list,
821         operator_list and property_list are turned into their real arrays.
822
823         Although we could probably perform this operation earlier, for
824         good error reporting we need to keep the lists and remove the
825         lists for longer than required.
826
827         This optimization was triggered by Paolo profiling the compiler
828         speed on the output of `gen-sample-program.pl' perl script. 
829
830         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
831         not crash in methods like MemberLookupFailed that use this field.  
832
833         This problem arises when the compiler fails to resolve a type
834         during interface type definition for example.
835
836 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
837
838         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
839         inherit from System.Object, so we have to stop at null, not only
840         when reaching System.Object.
841
842 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
843
844         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
845         DeclaredOnly because the parent indexer might have had a different
846         name, but did not loop until the top of the hierarchy was reached.
847
848         The problem this one fixes is 35492: when a class implemented an
849         indexer from an interface, we were getting the interface method
850         (which was abstract) and we were flagging an error (can not invoke
851         abstract method).
852
853         This also keeps bug 33089 functioning, and test-148 functioning.
854
855         * typemanager.cs (IsSpecialMethod): The correct way of figuring
856         out if a method is special is to see if it is declared in a
857         property or event, or whether it is one of the predefined operator
858         names.   This should fix correctly #36804.
859
860 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
861
862         The goal here is to remove the dependency on EmptyCast.Peel ().
863         Killing it completely.
864         
865         The problem is that currently in a number of places where
866         constants are expected, we have to "probe" for an EmptyCast, and
867         Peel, which is not the correct thing to do, as this will be
868         repetitive and will likely lead to errors. 
869
870         The idea is to remove any EmptyCasts that are used in casts that
871         can be reduced to constants, so we only have to cope with
872         constants. 
873
874         This bug hunt was triggered by Bug 37363 and the desire to remove
875         the duplicate pattern where we were "peeling" emptycasts to check
876         whether they were constants.  Now constants will always be
877         constants.
878         
879         * ecore.cs: Use an enumconstant here instead of wrapping with
880         EmptyCast.  
881
882         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
883         throwing me off.  By handling this we can get rid of a few hacks.
884         
885         * statement.cs (Switch): Removed Peel() code.
886
887 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
888
889         * class.cs: Location information for error 508
890
891         * expression.cs (New.DoResolve): Add a guard against double
892         resolution of an expression.  
893
894         The New DoResolve might be called twice when initializing field
895         expressions (see EmitFieldInitializers, the call to
896         GetInitializerExpression will perform a resolve on the expression,
897         and later the assign will trigger another resolution
898
899         This leads to bugs (#37014)
900
901         * delegate.cs: The signature for EndInvoke should contain any ref
902         or out parameters as well.  We were not doing this in the past. 
903
904         * class.cs (Field.Define): Do not overwrite the type definition
905         inside the `volatile' group.  Turns out that volatile enumerations
906         were changing the type here to perform a validity test, which
907         broke conversions. 
908
909 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
910
911         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
912         and structs, we do not want to load the instance variable
913
914         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
915         enum_type has to be handled like an object reference (implicit
916         conversions exists from this to object), but the regular IsClass
917         and IsValueType tests will never return true for this one.
918
919         Also we use TypeManager.IsValueType instead of type.IsValueType,
920         just for consistency with the rest of the code (this is only
921         needed if we ever use the construct exposed by test-180.cs inside
922         corlib, which we dont today).
923
924 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
925
926         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
927         just InternalCall.
928
929 2003-02-09  Martin Baulig  <martin@ximian.com>
930
931         * namespace.cs (Namespace..ctor): Added SourceFile argument.
932         (Namespace.DefineNamespaces): New static public method; this is
933         called when we're compiling with debugging to add all namespaces
934         to the symbol file.
935
936         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
937         pass it to the Namespace's .ctor.
938
939         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
940         and MethodBase arguments; pass the namespace ID to the symwriter;
941         pass the MethodBase instead of the token to the symwriter.
942         (SymbolWriter.DefineNamespace): New method to add a namespace to
943         the symbol file.
944
945 2003-02-09  Martin Baulig  <martin@ximian.com>
946
947         * symbolwriter.cs: New file.  This is a wrapper around
948         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
949         methods here in near future.
950
951 2003-02-09  Martin Baulig  <martin@ximian.com>
952
953         * codegen.cs (EmitContext.Mark): Just pass the arguments to
954         ILGenerator.MarkSequencePoint() which are actually used by the
955         symbol writer.
956
957 2003-02-09  Martin Baulig  <martin@ximian.com>
958
959         * location.cs (SourceFile): New public sealed class.  This
960         contains the name and an index which is used in the location's token.
961         (Location): Reserve an appropriate number of bits in the token for
962         the source file instead of walking over that list, this gives us a
963         really huge performance improvement when compiling with debugging.
964
965         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
966         `SourceFile' argument instead of a string.
967         (Driver.ProcessFile): Add all the files via Location.AddFile(),
968         but don't parse/tokenize here, we need to generate the list of all
969         source files before we do that.
970         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
971         the files.
972
973         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
974         instead of a string.
975
976         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
977         of a string.
978
979 2003-02-09  Martin Baulig  <martin@ximian.com>
980
981         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
982         filename on `#line default'.
983
984 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
985
986         * statement.cs: don't clear the pinned var when the fixed statement
987         returns from the method (fixes bug#37752).
988
989 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
990
991         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
992         to IsValueType.
993
994 2003-02-07  Martin Baulig  <martin@ximian.com>
995
996         * driver.cs: Removed the `--debug-args' command line argument.
997
998         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
999         automatically by the AsssemblyBuilder.
1000         (CodeGen.InitializeSymbolWriter): We don't need to call any
1001         initialization function on the symbol writer anymore.  This method
1002         doesn't take any arguments.
1003
1004 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
1005
1006         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
1007         from referenced assemblies as well.
1008
1009 2003-02-02  Martin Baulig  <martin@ximian.com>
1010
1011         * class.cs (MethodData.Emit): Generate debugging info for external methods.
1012
1013 2003-02-02  Martin Baulig  <martin@ximian.com>
1014
1015         * class.cs (Constructor.Emit): Open the symbol writer before
1016         emitting the constructor initializer.
1017         (ConstructorInitializer.Emit): Call ec.Mark() to allow
1018         single-stepping through constructor initializers.
1019
1020 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
1021
1022         * class.cs: Handle error 549: do not allow virtual methods in
1023         sealed classes. 
1024
1025 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
1026
1027         * decl.cs: Check access levels when resolving types
1028         
1029 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
1030
1031         * statement.cs: Add parameters and locals set in catch blocks that might 
1032         return to set vector
1033
1034 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
1035
1036         * class.cs (Operator): Set the SpecialName flags for operators.
1037         
1038         * expression.cs (Invocation.DoResolve): Only block calls to
1039         accessors and operators on SpecialName methods.
1040
1041         (Cast.TryReduce): Handle conversions from char constants.
1042
1043
1044 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
1045
1046         * statement.cs: small memory and time optimization in FlowBranching.
1047         
1048 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
1049
1050         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
1051         problem that the last fix but in the other sid (Set).
1052
1053         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
1054         access when there is no indexer in the hierarchy.
1055         
1056 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
1057
1058         * class.cs: Combine some if statements.
1059
1060 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1061
1062         * driver.cs: fixed bug #37187.
1063
1064 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
1065
1066         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
1067         any indexer, it's needed to build a list with all the indexers in the
1068         hierarchy (AllGetters), else we have problems. Fixes #35653.
1069
1070 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
1071
1072         * class.cs (MethodData.Define): It is wrong for an interface
1073         implementation to be static in both cases: explicit and implicit.
1074         We were only handling this in one case.
1075
1076         Improve the if situation there to not have negations.
1077         
1078         * class.cs (Field.Define): Turns out that we do not need to check
1079         the unsafe bit on field definition, only on usage.  Remove the test.
1080
1081 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1082
1083         * driver.cs: use assembly.Location instead of Codebase (the latest
1084         patch made mcs fail when using MS assemblies).
1085
1086 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
1087
1088         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
1089         get the path to *corlib.dll.
1090
1091 2003-01-21  Nick Drochak <ndrochak@gol.com>
1092
1093         * cs-tokenizer.cs:
1094         * pending.cs:
1095         * typemanager.cs: Remove compiler warnings
1096
1097 2003-01-20  Duncan Mak  <duncan@ximian.com>
1098
1099         * AssemblyInfo.cs: Bump the version number to 0.19.
1100         
1101 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1102
1103         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
1104
1105 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
1106
1107         * class.cs (Constructor::Emit): Emit debugging info for constructors.
1108
1109 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
1110
1111         * cs-parser.jay: Small fix: we were not comparing the constructor
1112         name correctly.   Thanks to Zoltan for the initial pointer.
1113
1114 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
1115
1116         * cs-tokenizer.cs: Set file name when specified with #line
1117
1118 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
1119
1120         * cs-parser.jay: Only perform the constructor checks here if we
1121         are named like the class;  This will help provider a better
1122         error.  The constructor path is taken when a type definition is
1123         not found, but most likely the user forgot to add the type, so
1124         report that rather than the constructor error.
1125
1126 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
1127
1128         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
1129         allocations.
1130
1131 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
1132
1133         * cs-parser.jay: Add cleanup call.
1134
1135 2003-01-13  Duncan Mak  <duncan@ximian.com>
1136
1137         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
1138         consistent with other methods.
1139
1140 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
1141
1142         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
1143         
1144 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
1145
1146         * attribute.cs: only set GuidAttr to true when we have a
1147         GuidAttribute.
1148
1149 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1150
1151         * ecore.cs:
1152         * expression.cs:
1153         * typemanager.cs: fixes to allow mcs compile corlib with the new
1154         Type.IsSubclassOf fix.
1155
1156 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
1157
1158         * expression.cs (LocalVariableReference.DoResolve): Classify a
1159         constant as a value, not as a variable.   Also, set the type for
1160         the variable.
1161
1162         * cs-parser.jay (fixed_statement): take a type instead of a
1163         pointer_type, so we can produce a better error message later.
1164         
1165         * statement.cs (Fixed.Resolve): Flag types that are not pointers
1166         as an error.  
1167         
1168         (For.DoEmit): Make inifinite loops have a
1169         non-conditional branch back.
1170
1171         (Fixed.DoEmit): First populate the pinned variables, then emit the
1172         statement, then clear the variables.  Before I was emitting the
1173         code once for each fixed piece.
1174
1175
1176 2003-01-08  Martin Baulig  <martin@ximian.com>
1177
1178         * statement.cs (FlowBranching.MergeChild): A break in a
1179         SWITCH_SECTION does not leave a loop.  Fixes #36155.
1180
1181 2003-01-08  Martin Baulig  <martin@ximian.com>
1182
1183         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
1184         lives in the same number space than `param_map'.  Fixes #36154.
1185
1186 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
1187
1188         * cs-parser.jay (constructor_declaration): Set the
1189         Constructor.ModFlags before probing for it.  This makes the
1190         compiler report 514, 515 and 132 (the code was there, but got
1191         broken). 
1192
1193         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
1194         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
1195         (GotoCase.Resolve): Set `Returns' to ALWAYS.
1196
1197 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
1198
1199         * enum.cs: create the enum static fields using the enum type.
1200
1201 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
1202
1203         * class.cs: don't try to create the ParamBuilder for the return
1204         type if it's not needed (and handle it breaking for the ms runtime
1205         anyway).
1206
1207 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
1208
1209         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
1210
1211 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
1212
1213         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
1214         the command.   This showed up while compiling the JANET source
1215         code, which used \r as its only newline separator.
1216
1217 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
1218
1219         * class.cs (Method.Define): If we are an operator (because it
1220         reuses our code), then set the SpecialName and HideBySig.  #36128
1221
1222 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
1223
1224         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
1225         exception, report error 120 `object reference required'.
1226
1227         * driver.cs: Add --pause option, used during to measure the size
1228         of the process as it goes with --timestamp.
1229
1230         * expression.cs (Invocation.DoResolve): Do not allow methods with
1231         SpecialName to be invoked.
1232
1233 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
1234
1235         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
1236         number before adding it.
1237
1238 2002-12-21  Ravi Pratap  <ravi@ximian.com>
1239
1240         * ecore.cs (StandardImplicitConversion): When in an unsafe
1241         context, we allow conversion between void * to any other pointer
1242         type. This fixes bug #35973.
1243
1244 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
1245
1246         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
1247         is not thrown when extensionless outputs are used 
1248
1249 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1250
1251         * rootcontext.cs: fixed compilation of corlib.
1252
1253 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
1254
1255         * attribute.cs (Attributes.Contains): Add new method.
1256
1257         * class.cs (MethodCore.LabelParameters): if the parameter is an
1258         `out' parameter, check that no attribute `[In]' has been passed.
1259
1260         * enum.cs: Handle the `value__' name in an enumeration.
1261
1262 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
1263
1264         * decl.cs: Added special case to allow overrides on "protected
1265         internal" methods
1266         
1267 2002-12-18  Ravi Pratap  <ravi@ximian.com>
1268
1269         * attribute.cs (Attributes.AddAttributeSection): Rename to this
1270         since it makes much more sense.
1271
1272         (Attributes.ctor): Don't require a Location parameter.
1273         
1274         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
1275
1276         * attribute.cs (ApplyAttributes): Remove extra Location parameters
1277         since we already have that information per attribute.
1278
1279         * everywhere : make appropriate changes.
1280
1281         * class.cs (LabelParameters): Write the code which actually
1282         applies attributes to the return type. We can't do this on the MS
1283         .NET runtime so we flag a warning in the case an exception is
1284         thrown.
1285
1286 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
1287
1288         * const.cs: Handle implicit null conversions here too.
1289
1290 2002-12-17  Ravi Pratap  <ravi@ximian.com>
1291
1292         * class.cs (MethodCore.LabelParameters): Remove the extra
1293         Type [] parameter since it is completely unnecessary. Instead
1294         pass in the method's attributes so that we can extract
1295         the "return" attribute.
1296
1297 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
1298
1299         * cs-parser.jay (parse): Use Report.Error to flag errors instead
1300         of ignoring it and letting the compile continue.
1301
1302         * typemanager.cs (ChangeType): use an extra argument to return an
1303         error condition instead of throwing an exception.
1304
1305 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
1306
1307         * expression.cs (Unary.TryReduce): mimic the code for the regular
1308         code path.  Perform an implicit cast in the cases where we can
1309         implicitly convert to one of the integral types, and then reduce
1310         based on that constant.   This fixes bug #35483.
1311
1312 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1313
1314         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
1315
1316 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1317
1318         * namespace.cs: fixed bug #35489.
1319
1320 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
1321
1322         * class.cs: Remove some dead code.
1323
1324         * cs-parser.jay: Estimate the number of methods needed
1325         (RootContext.MethodCount);
1326
1327         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
1328         numbers instead of StringBuilders.
1329
1330         * support.cs (PtrHashtable): Add constructor with initial size;
1331         We can now reduce reallocations of the method table.
1332
1333 2002-12-10  Ravi Pratap  <ravi@ximian.com>
1334
1335         * attribute.cs (ApplyAttributes): Keep track of the emitted
1336         attributes on a per-target basis. This fixes bug #35413.
1337
1338 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
1339
1340         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
1341         default to the Windows 1252 encoding.
1342
1343         (UnixParseOption): Support version, thanks to Alp for the missing
1344         pointer. 
1345
1346         * AssemblyInfo.cs: Add nice assembly information.
1347
1348         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
1349         (bug 35169).
1350
1351         * cs-parser.jay: Allow a trailing comma before the close bracked
1352         in the attribute_section production.
1353
1354         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
1355         address of the instance was being taken, I will take this out,
1356         because we take the address of the object immediately here.
1357
1358 2002-12-09  Ravi Pratap  <ravi@ximian.com>
1359
1360         * typemanager.cs (AreMultipleAllowed): Take care of the most
1361         obvious case where attribute type is not in the current assembly -
1362         stupid me ;-)
1363
1364 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
1365
1366         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
1367         definitions, instead of doing that afterwards.  
1368
1369         Also we use a nice little hack, depending on the constructor, we
1370         know if we are a "composed" name or a simple name.  Hence, we
1371         avoid the IndexOf test, and we avoid 
1372
1373         * codegen.cs: Add code to assist in a bug reporter to track down
1374         the source of a compiler crash. 
1375
1376 2002-12-07  Ravi Pratap  <ravi@ximian.com>
1377
1378         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
1379         types have been emitted for a given element and flag an error
1380         if something which does not have AllowMultiple set is used more
1381         than once.
1382
1383         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
1384         attribute types and their corresponding AllowMultiple properties
1385
1386         (AreMultipleAllowed): Check the property for a given type.
1387
1388         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
1389         property in the case we have a TypeContainer.
1390
1391         (Attributes.AddAttribute): Detect duplicates and just skip on
1392         adding them. This trivial fix catches a pretty gross error in our
1393         attribute emission - global attributes were being emitted twice!
1394
1395         Bugzilla bug #33187 is now fixed.
1396
1397 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
1398
1399         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
1400         instead of pp_and).
1401
1402         * expression.cs (Binary.ResolveOperator): I can only use the
1403         Concat (string, string, string) and Concat (string, string,
1404         string, string) if the child is actually a concatenation of
1405         strings. 
1406
1407 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
1408
1409         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
1410         context where we need a 2-character lookahead.
1411
1412         * pending.cs (PendingImplementation): Rework so we can keep track
1413         of interface types all the time, and flag those which were
1414         implemented by parents as optional.
1415
1416 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
1417
1418         * expression.cs (Binary.ResolveOperator): Use
1419         String.Concat(string,string,string) or
1420         String.Concat(string,string,string,string) when possible. 
1421
1422         * typemanager: More helper methods.
1423
1424
1425 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
1426
1427         * pending.cs: remove the bogus return from GetMissingInterfaces()
1428         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
1429
1430 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1431
1432         * namespace.cs: avoid duplicated 'using xxx' being added to
1433         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
1434         when we get more than one 'using' statement for the same namespace.
1435         Report a CS0105 warning for it.
1436
1437 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
1438
1439         * cs-tokenizer.cs (consume_identifier): use read directly, instead
1440         of calling getChar/putback, uses internal knowledge of it.    
1441
1442         (xtoken): Reorder tokenizer so most common patterns are checked
1443         first.  This reduces the compilation time in another 5% (from 8.11s
1444         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
1445
1446         The parsing time is 22% of the compilation in mcs, and from that
1447         64% is spent on the tokenization process.  
1448
1449         I tried using a binary search for keywords, but this is slower
1450         than the hashtable.  Another option would be to do a couple of
1451         things:
1452
1453                 * Not use a StringBuilder, instead use an array of chars,
1454                   with a set value.  Notice that this way we could catch
1455                   the 645 error without having to do it *afterwards*.
1456
1457                 * We could write a hand-parser to avoid the hashtable
1458                   compares altogether.
1459
1460         The identifier consumption process takes 37% of the tokenization
1461         time.  Another 15% is spent on is_number.  56% of the time spent
1462         on is_number is spent on Int64.Parse:
1463
1464                 * We could probably choose based on the string length to
1465                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
1466                   computations. 
1467
1468         Another 3% is spend on wrapping `xtoken' in the `token' function.
1469
1470         Handle 0xa0 as whitespace (#34752)
1471         
1472 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
1473
1474         * typemanager.cs (IsCLRType): New routine to tell whether a type
1475         is one of the builtin types.  
1476
1477         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
1478         typecode in more places instead of doing pointer comparissions.
1479         We could leverage some knowledge about the way the typecodes are
1480         laid out.
1481
1482         New code to cache namespaces in assemblies, it is currently not
1483         invoked, to be used soon.
1484
1485         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
1486
1487         * expression.cs (Binary.ResolveOperator): specially handle
1488         strings, and do not perform user-defined operator overloading for
1489         built-in types.
1490
1491 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
1492
1493         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
1494         internalcall as it is a pretty simple operation;  Avoid whenever
1495         possible to call Char.IsLetter.
1496
1497         (consume_identifier): Cut by half the number of
1498         hashtable calls by merging the is_keyword and GetKeyword behavior.
1499
1500         Do not short-circuit, because if we do, we
1501         report errors (ie, #if false && true would produce an invalid
1502         directive error);
1503         
1504
1505 2002-11-24  Martin Baulig  <martin@ximian.com>
1506
1507         * expression.cs (Cast.TryReduce): If we're in checked syntax,
1508         check constant ranges and report a CS0221.  Fixes #33186.
1509
1510 2002-11-24  Martin Baulig  <martin@ximian.com>
1511
1512         * cs-parser.jay: Make this work for uninitialized variable
1513         declarations in the `for' initializer.  Fixes #32416.
1514
1515 2002-11-24  Martin Baulig  <martin@ximian.com>
1516
1517         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
1518         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
1519
1520 2002-11-24  Martin Baulig  <martin@ximian.com>
1521
1522         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
1523         argument; if true, we also check for user-defined conversions.
1524         This is only needed if both arguments are of a user-defined type.
1525         Fixes #30443, added test-175.cs.
1526         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
1527
1528         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
1529
1530 2002-11-24  Martin Baulig  <martin@ximian.com>
1531
1532         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
1533         function to get the store opcode.
1534         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
1535         only emit the Ldelema if the store opcode is Stobj.  You must run
1536         both test-34 and test-167 to test this.  Fixes #34529.
1537
1538 2002-11-23  Martin Baulig  <martin@ximian.com>
1539
1540         * ecore.cs (Expression.MemberLookup): Added additional
1541         `qualifier_type' argument which is used when we're being called
1542         from MemberAccess.DoResolve() and null if we're called from a
1543         SimpleName lookup.
1544         (Expression.MemberLookupFailed): New method to report errors; this
1545         does the CS1540 check and reports the correct error message.
1546
1547         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
1548         argument for the CS1540 check and redone the way how we're dealing
1549         with private members.  See the comment in the source code for details.
1550         (FilterWithClosure): Reverted this back to revision 1.197; renamed
1551         `closure_start_type' to `closure_qualifier_type' and check whether
1552         it's not null.  It was not this filter being broken, it was just
1553         being called with the wrong arguments.
1554
1555         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
1556         and pass it the correct `qualifier_type'; this also does the error
1557         handling for us.
1558
1559 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
1560
1561         * expression.cs (Invocation.EmitParams): If the we are dealing
1562         with a non-built-in value type, load its address as well.
1563
1564         (ArrayCreation): Use a a pretty constant instead
1565         of the hardcoded value 2.   Use 6 instead of 2 for the number of
1566         static initializers.  
1567
1568         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
1569         because they are not really value types, just glorified integers. 
1570
1571         * driver.cs: Do not append .exe, the CSC compiler does not do it.
1572
1573         * ecore.cs: Remove redundant code for enumerations, make them use
1574         the same code path as everything else, fixes the casting issue
1575         with enumerations in Windows.Forms.
1576
1577         * attribute.cs: Do only cast to string if it is a string, the
1578         validation happens later.
1579
1580         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
1581         people upgrade their corlibs.
1582
1583         * ecore.cs: Oops, enumerations were not following the entire code path
1584
1585 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
1586
1587         * typemanager.cs (FilterWithClosure): Commented out the test for
1588         1540 in typemanager.cs, as it has problems when accessing
1589         protected methods from a parent class (see test-174.cs). 
1590
1591         * attribute.cs (Attribute.ValidateGuid): new method.
1592         (Attribute.Resolve): Use above.
1593
1594 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
1595
1596         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
1597
1598         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
1599         handling for enumerations, as we only needed the TypeContainer
1600         functionality to begin with (this is required for the fix below to
1601         work for enums that reference constants in a container class for
1602         example). 
1603
1604         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
1605
1606         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
1607         a valid TypeBuilder to perform lookups on.o
1608
1609         * class.cs (InheritableMemberSignatureCompare): Use true in the
1610         call to GetGetMethod and GetSetMethod, because we are comparing
1611         the signature, and we need to get the methods *even* if they are
1612         private. 
1613
1614         (PropertyBase.CheckBase): ditto.
1615
1616         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
1617         GotoCase.Resolve): Use Peel on EmpytCasts.
1618
1619         * ecore.cs (EmptyCast): drop child, add Peel method.
1620
1621 2002-11-17  Martin Baulig  <martin@ximian.com>
1622
1623         * ecore.cs (EmptyCast.Child): New public property.
1624
1625         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
1626         label resolved to an EmptyCast.  Fixes #34162.
1627         (GotoCase.Resolve): Likewise.
1628         (Block.EmitMeta): Likewise.
1629
1630 2002-11-17  Martin Baulig  <martin@ximian.com>
1631
1632         * expression.cs (Invocation.BetterConversion): Prefer int over
1633         uint; short over ushort; long over ulong for integer literals.
1634         Use ImplicitConversionExists instead of StandardConversionExists
1635         since we also need to check for user-defined implicit conversions.
1636         Fixes #34165.  Added test-173.cs.
1637
1638 2002-11-16  Martin Baulig  <martin@ximian.com>
1639
1640         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
1641         with the `true' and `false' literals.  Fixes #33151.
1642
1643 2002-11-16  Martin Baulig  <martin@ximian.com>
1644
1645         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
1646         October 22nd; don't do the cs1540 check for static members.
1647
1648         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
1649         now using our own filter here and doing the cs1540 check again.
1650
1651 2002-11-16  Martin Baulig  <martin@ximian.com>
1652
1653         * support.cs (InternalParameters): Don't crash if we don't have
1654         any fixed parameters.  Fixes #33532.
1655
1656 2002-11-16  Martin Baulig  <martin@ximian.com>
1657
1658         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
1659         when looking up static methods to make this work on Windows.
1660         Fixes #33773.
1661
1662 2002-11-16  Martin Baulig  <martin@ximian.com>
1663
1664         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
1665         a setter rather than using PropertyInfo.CanWrite.
1666
1667 2002-11-15  Nick Drochak  <ndrochak@gol.com>
1668
1669         * class.cs: Allow acces to block member by subclasses. Fixes build
1670         breaker.
1671
1672 2002-11-14  Martin Baulig  <martin@ximian.com>
1673
1674         * class.cs (Constructor.Emit): Added the extern/block check.
1675         Fixes bug #33678.
1676
1677 2002-11-14  Martin Baulig  <martin@ximian.com>
1678
1679         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
1680         iteration while looking for indexers, this is needed because the
1681         indexer may have a different name in our base classes.  Fixed the
1682         error reporting (no indexers at all, not get accessor, no
1683         overloaded match).  Fixes bug #33089.
1684         (IndexerAccess.DoResolveLValue): Likewise.
1685
1686 2002-11-14  Martin Baulig  <martin@ximian.com>
1687
1688         * class.cs (PropertyBase.CheckBase): Make this work for multiple
1689         indexers.  Fixes the first part of bug #33089.
1690         (MethodSignature.InheritableMemberSignatureCompare): Added support
1691         for properties.
1692
1693 2002-11-13  Ravi Pratap  <ravi@ximian.com>
1694
1695         * attribute.cs (Attribute.Resolve): Catch the
1696         NullReferenceException and report it since it isn't supposed to
1697         happen. 
1698         
1699 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
1700
1701         * expression.cs (Binary.EmitBranchable): Also handle the cases for
1702         LogicalOr and LogicalAnd that can benefit from recursively
1703         handling EmitBranchable.  The code now should be nice for Paolo.
1704
1705 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
1706
1707         * typemanager.cs (LookupType): Added a negative-hit hashtable for
1708         the Type lookups, as we perform quite a number of lookups on
1709         non-Types.  This can be removed once we can deterministically tell
1710         whether we have a type or a namespace in advance.
1711
1712         But this might require special hacks from our corlib.
1713
1714         * TODO: updated.
1715
1716         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
1717         and double which avoids a conversion from an integer to a double.
1718
1719         * expression.cs: tiny optimization, avoid calling IsConstant,
1720         because it effectively performs the lookup twice.
1721
1722 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
1723
1724         But a bogus return here to keep the semantics of the old code
1725         until the Mono runtime is fixed.
1726         
1727         * pending.cs (GetMissingInterfaces): New method used to remove all
1728         the interfaces that are already implemented by our parent
1729         classes from the list of pending methods. 
1730
1731         * interface.cs: Add checks for calls after ResolveTypeExpr.
1732
1733 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
1734
1735         * class.cs (Class.Emit): Report warning 67: event not used if the
1736         warning level is beyond 3.
1737
1738         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
1739         being a NullLiteral.
1740
1741         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
1742         specifiers. 
1743
1744         * class.cs (TypeContainer.GetClassBases): Cover a missing code
1745         path that might fail if a type can not be resolved.
1746
1747         * expression.cs (Binary.Emit): Emit unsigned versions of the
1748         operators. 
1749
1750         * driver.cs: use error 5.
1751         
1752 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
1753
1754         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
1755
1756 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
1757
1758         * cs-parser.jay (switch_section): A beautiful patch from Martin
1759         Baulig that fixed 33094.
1760
1761 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
1762
1763         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
1764         Check whether the base is abstract and report an error if so.
1765
1766         * expression.cs (IndexerAccess.DoResolveLValue,
1767         IndexerAccess.DoResolve): ditto. 
1768
1769         (Invocation.DoResolve): ditto.
1770         
1771         (Invocation.FullMethodDesc): Improve the report string.
1772
1773         * statement.cs (Block): Eliminate IsVariableDefined as it is
1774         basically just a wrapper for GetVariableInfo.
1775
1776         * ecore.cs (SimpleName): Use new 
1777
1778         * support.cs (ReflectionParamter.ParameterType): We unwrap the
1779         type, as we return the actual parameter ref/unref state on a
1780         different call.
1781
1782 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
1783
1784         * support.cs: Return proper flags REF/OUT fixing the previous
1785         commit.  
1786
1787         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
1788         not used to mean `ref' but `ref or out' in ParameterReference
1789         
1790         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
1791         full type signature instead of calling TypeManger.CSharpName
1792         ourselves. 
1793
1794         * support.cs (InternalParameters.ParameterDesc): Do not compare
1795         directly to the modflags, because REF/OUT will actually be bitsets
1796         if set. 
1797
1798         * delegate.cs (VerifyMethod): Check also the modifiers.
1799
1800         * cs-tokenizer.cs: Fix bug where floating point values with an
1801         exponent where a sign was missing was ignored.
1802
1803         * driver.cs: Allow multiple assemblies to be specified in a single
1804         /r: argument
1805
1806 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
1807
1808         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
1809         because identifiers after a parenthesis would end up in this kind
1810         of production, and we needed to desamiguate it for having casts
1811         like:
1812
1813                 (UserDefinedType *) xxx
1814
1815 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
1816
1817         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
1818         we should set on the Bindingflags.NonPublic, but not turn on
1819         private_ok.  private_ok controls whether a Private member is
1820         returned (this is chekced on the filter routine), while the
1821         BindingFlags.NonPublic just controls whether private/protected
1822         will be allowed.   This fixes the problem part of the problem of
1823         private properties being allowed to be used in derived classes.
1824
1825         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
1826         so we can call the children DoResolveLValue method (this will
1827         properly signal errors on lvalue assignments to base properties)
1828         
1829         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
1830         getter are null, and we have a property info, we know that this
1831         happened because the lookup failed, so we report an error 122 for
1832         protection level violation.
1833
1834         We also silently return if setter and getter are null in the
1835         resolve functions, this condition only happens if we have flagged
1836         the error before.  This is the other half of the problem. 
1837
1838         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
1839         not have accessibility information, that is why we were returning
1840         true in the filter function in typemanager.cs.
1841
1842         To properly report 122 (property is inaccessible because of its
1843         protection level) correctly, we report this error in ResolveAccess
1844         by failing if both the setter and the getter are lacking (ie, the
1845         lookup failed). 
1846
1847         DoResolve and DoLResolve have been modified to check for both
1848         setter/getter being null and returning silently, the reason being
1849         that I did not want to put the knowledge about this error in upper
1850         layers, like:
1851
1852         int old = Report.Errors;
1853         x = new PropertyExpr (...);
1854         if (old != Report.Errors)
1855                 return null;
1856         else
1857                 return x;
1858
1859         So the property expr is returned, but it is invalid, so the error
1860         will be flagged during the resolve process. 
1861
1862         * class.cs: Remove InheritablePropertySignatureCompare from the
1863         class, as we no longer depend on the property signature to compute
1864         whether it is possible to implement a method or not.
1865
1866         The reason is that calling PropertyInfo.GetGetMethod will return
1867         null (in .NET, in Mono it works, and we should change this), in
1868         cases where the Get Method does not exist in that particular
1869         class.
1870
1871         So this code:
1872
1873         class X { public virtual int A { get { return 1; } } }
1874         class Y : X { }
1875         class Z : Y { public override int A { get { return 2; } } }
1876
1877         Would fail in Z because the parent (Y) would not have the property
1878         defined.  So we avoid this completely now (because the alternative
1879         fix was ugly and slow), and we now depend exclusively on the
1880         method names.
1881
1882         (PropertyBase.CheckBase): Use a method-base mechanism to find our
1883         reference method, instead of using the property.
1884
1885         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
1886         routines are gone now.
1887
1888         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
1889         names, they were incorrectly named.
1890
1891         * cs-tokenizer.cs: Return are more gentle token on failure. 
1892
1893         * pending.cs (PendingImplementation.InterfaceMethod): This routine
1894         had an out-of-sync index variable, which caused it to remove from
1895         the list of pending methods the wrong method sometimes.
1896
1897 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
1898
1899         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
1900         CanWrite, because those refer to this particular instance of the
1901         property, and do not take into account the fact that we can
1902         override single members of a property.
1903
1904         Constructor requires an EmitContext.  The resolution process does
1905         not happen here, but we need to compute the accessors before,
1906         because the resolution does not always happen for properties.
1907         
1908         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
1909         subclass, before we did not update this flag, but we did update
1910         bindingflags. 
1911
1912         (GetAccessors): Drop this routine, as it did not work in the
1913         presence of partially overwritten set/get methods. 
1914
1915         Notice that this broke the cs1540 detection, but that will require
1916         more thinking. 
1917         
1918 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1919
1920         * class.cs:
1921         * codegen.cs:
1922         * driver.cs: issue a warning instead of an error if we don't support
1923         debugging for the platform. Also ignore a couple of errors that may
1924         arise when trying to write the symbols. Undo my previous patch.
1925
1926 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1927
1928         * driver.cs: ignore /debug switch except for Unix platforms.
1929
1930 2002-10-23  Nick Drochak  <ndrochak@gol.com>
1931
1932         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
1933
1934 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
1935
1936         * driver.cs: Do not make mcs-debug conditional, so we do not break
1937         builds that use it.
1938
1939         * statement.cs (UsageVector.MergeChildren): I would like Martin to
1940         review this patch.  But basically after all the children variables
1941         have been merged, the value of "Breaks" was not being set to
1942         new_breaks for Switch blocks.  I think that it should be set after
1943         it has executed.  Currently I set this to the value of new_breaks,
1944         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
1945         conservative, but I do not understand this code very well.
1946
1947         I did not break anything in the build, so that is good ;-)
1948
1949         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
1950
1951 2002-10-20  Mark Crichton  <crichton@gimp.org>
1952
1953         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
1954
1955 2002-10-20  Nick Drochak  <ndrochak@gol.com>
1956
1957         * cfold.cs: Fixed compile blocker.
1958
1959 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
1960
1961         * driver.cs: I was chekcing the key, not the file.
1962
1963 2002-10-19  Ravi Pratap  <ravi@ximian.com>
1964
1965         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
1966         message that we were generating - we just need to silently return
1967         a null.
1968
1969 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
1970
1971         * class.cs (Event.Define): Change my previous commit, as this
1972         breaks the debugger.  This is a temporary hack, as it seems like
1973         the compiler is generating events incorrectly to begin with.
1974
1975         * expression.cs (Binary.ResolveOperator): Added support for 
1976         "U operator - (E x, E y)"
1977
1978         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
1979         y)".
1980
1981         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
1982         init-only variables, but this path did not take into account that
1983         there might be also instance readonly variables.  Correct this
1984         problem. 
1985
1986         This fixes bug 32253
1987
1988         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
1989         delegates as well.
1990
1991         * driver.cs: Change the extension for modules to `netmodule'
1992
1993         * cs-parser.jay: Improved slightly the location tracking for
1994         the debugger symbols.
1995
1996         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
1997         modifiers that were specified instead of the hardcoded value
1998         (FamAndAssem).  This was basically ignoring the static modifier,
1999         and others.  Fixes 32429.
2000
2001         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
2002         fixed a bug in the process (32476)
2003
2004         * expression.cs (ArrayAccess.EmitAssign): Patch from
2005         hwang_rob@yahoo.ca that fixes bug 31834.3
2006
2007 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
2008
2009         * driver.cs: Make the module extension .netmodule.
2010
2011 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
2012
2013         * driver.cs: Report an error if the resource file is not found
2014         instead of crashing.
2015
2016         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
2017         false, like Emit does.
2018
2019 2002-10-16  Nick Drochak  <ndrochak@gol.com>
2020
2021         * typemanager.cs: Remove unused private member.  Also reported mcs
2022         bug to report this as a warning like csc.
2023
2024 2002-10-15  Martin Baulig  <martin@gnome.org>
2025
2026         * statement.cs (Statement.Emit): Made this a virtual method; emits
2027         the line number info and calls DoEmit().
2028         (Statement.DoEmit): New protected abstract method, formerly knows
2029         as Statement.Emit().
2030
2031         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
2032
2033 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
2034
2035         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
2036         have fixed a remaining problem: not every AddXXXX was adding a
2037         fully qualified name.  
2038
2039         Now everyone registers a fully qualified name in the DeclSpace as
2040         being defined instead of the partial name.  
2041
2042         Downsides: we are slower than we need to be due to the excess
2043         copies and the names being registered this way.  
2044
2045         The reason for this is that we currently depend (on the corlib
2046         bootstrap for instance) that types are fully qualified, because
2047         we dump all the types in the namespace, and we should really have
2048         types inserted into the proper namespace, so we can only store the
2049         basenames in the defined_names array.
2050
2051 2002-10-10  Martin Baulig  <martin@gnome.org>
2052
2053         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
2054         from bug #31834, see the bug report for a testcase which is
2055         miscompiled.
2056
2057 2002-10-10  Martin Baulig  <martin@gnome.org>
2058
2059         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
2060         flow analysis code for this.
2061
2062         * statement.cs (Do, While, For): Tell the flow analysis code about
2063         infinite loops.
2064         (FlowBranching.UsageVector): Added support for infinite loops.
2065         (Block.Resolve): Moved the dead code elimination here and use flow
2066         analysis to do it.
2067
2068 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
2069
2070         * class.cs (Field.Define): Catch cycles on struct type
2071         definitions. 
2072
2073         * typemanager.cs (IsUnmanagedtype): Do not recursively check
2074         fields if the fields are static.  We only need to check instance
2075         fields. 
2076
2077         * expression.cs (As.DoResolve): Test for reference type.
2078
2079         * statement.cs (Using.ResolveExpression): Use
2080         ConvertImplicitRequired, not ConvertImplicit which reports an
2081         error on failture
2082         (Using.ResolveLocalVariableDecls): ditto.
2083
2084         * expression.cs (Binary.ResolveOperator): Report errors in a few
2085         places where we had to.
2086
2087         * typemanager.cs (IsUnmanagedtype): Finish implementation.
2088
2089 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
2090
2091         * expression.cs: Use StoreFromPtr instead of extracting the type
2092         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
2093
2094         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
2095         an enumeration value to a System.Enum, but System.Enum is not a
2096         value type, but an class type, so we need to box.
2097
2098         (Expression.ConvertExplicit): One codepath could return
2099         errors but not flag them.  Fix this.  Fixes #31853
2100
2101         * parameter.cs (Resolve): Do not allow void as a parameter type.
2102
2103 2002-10-06  Martin Baulig  <martin@gnome.org>
2104
2105         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
2106         if it's a class type and not a struct.  Fixes #31815.
2107
2108 2002-10-06  Martin Baulig  <martin@gnome.org>
2109
2110         * statement.cs: Reworked the flow analysis code a bit to make it
2111         usable for dead code elimination.
2112
2113 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2114
2115         * cs-parser.jay: allow empty source files. Fixes bug #31781.
2116
2117 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
2118
2119         * expression.cs (ComposedCast.DoResolveType): A quick workaround
2120         to fix the test 165, will investigate deeper.
2121
2122 2002-10-04  Martin Baulig  <martin@gnome.org>
2123
2124         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
2125         finally blocks actually work.
2126         (Try.Resolve): We don't need to create a sibling for `finally' if
2127         there is no finally block.
2128
2129 2002-10-04  Martin Baulig  <martin@gnome.org>
2130
2131         * class.cs (Constructor.Define): The default accessibility for a
2132         non-default constructor is private, not public.
2133
2134 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
2135
2136         * class.cs (Constructor): Make AllowedModifiers public, add
2137         EXTERN.
2138
2139         * cs-parser.jay: Perform the modifiers test here, as the
2140         constructor for the Constructor class usually receives a zero
2141         because of the way we create it (first we create, later we
2142         customize, and we were never checking the modifiers).
2143
2144         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
2145         is a version of LookupTypeReflection that includes the type-name
2146         cache.  This can be used as a fast path for functions that know
2147         the fully qualified name and are only calling into *.GetType() to
2148         obtain a composed type.
2149
2150         This is also used by TypeManager.LookupType during its type
2151         composition.
2152
2153         (LookupType): We now also track the real type name, as sometimes
2154         we can get a quey for the real type name from things like
2155         ComposedCast.  This fixes bug 31422.
2156         
2157         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
2158         complete type fullname, it does not have to go through the type
2159         resolution system to obtain the composed version of the type (for
2160         obtaining arrays or pointers).
2161         
2162         (Conditional.Emit): Use the EmitBoolExpression to
2163         generate nicer code, as requested by Paolo.
2164
2165         (ArrayCreation.CheckIndices): Use the patch from
2166         hwang_rob@yahoo.ca to validate the array initializers. 
2167
2168 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
2169
2170         * class.cs (ConstructorInitializer.Emit): simplify code by using
2171         Invocation.EmitCall, and at the same time, fix the bugs in calling
2172         parent constructors that took variable arguments. 
2173
2174         * ecore.cs (Expression.ConvertNumericExplicit,
2175         Expression.ImplicitNumericConversion): Remove the code that
2176         manually wrapped decimal (InternalTypeConstructor call is now gone
2177         as well).
2178
2179         * expression.cs (Cast.TryReduce): Also handle decimal types when
2180         trying to perform a constant fold on the type.
2181
2182         * typemanager.cs (IsUnmanagedtype): Partially implemented.
2183
2184         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
2185         that only turned off an error report, and did nothing else. 
2186
2187 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
2188
2189         * driver.cs: Handle and ignore /fullpaths
2190
2191 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
2192
2193         * expression.cs (Binary.ResolveOperator): Catch the case where
2194         DoNumericPromotions returns true, 
2195
2196         (Binary.DoNumericPromotions): Simplify the code, and the tests.
2197
2198 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
2199
2200         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
2201         report error 70.
2202
2203 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
2204
2205         * ecore.cs (ConvertNumericExplicit): It is not enough that the
2206         conversion exists, but it is also required that the conversion be
2207         performed.  This manifested in "(Type64Enum) 2".  
2208
2209         * class.cs (TypeManager.AddMethod): The fix is not to change
2210         AddEnum, because that one was using a fully qualified name (every
2211         DeclSpace derivative does), but to change the AddMethod routine
2212         that was using an un-namespaced name.  This now correctly reports
2213         the duplicated name.
2214
2215         Revert patch until I can properly fix it.  The issue
2216         is that we have a shared Type space across all namespaces
2217         currently, which is wrong.
2218
2219         Options include making the Namespace a DeclSpace, and merge
2220         current_namespace/current_container in the parser.
2221
2222 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
2223
2224         * cs-parser.jay: Improve error reporting when we get a different
2225         kind of expression in local_variable_type and
2226         local_variable_pointer_type. 
2227
2228         Propagate this to avoid missleading errors being reported.
2229
2230         * ecore.cs (ImplicitReferenceConversion): treat
2231         TypeManager.value_type as a target just like object_type.   As
2232         code like this:
2233
2234         ValueType v = 1;
2235
2236         Is valid, and needs to result in the int 1 being boxed before it
2237         is assigned to the value type v.
2238
2239         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
2240         to validate the enumeration name.
2241
2242         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
2243         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
2244         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
2245
2246         * ecore.cs (TryImplicitIntConversion): When doing an
2247         implicit-enumeration-conversion, check if the type is 64-bits and
2248         perform a conversion before passing to EnumConstant.
2249
2250 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
2251
2252         * decl.cs (Error_AmbiguousTypeReference); New routine used to
2253         report ambiguous type references.  Unlike the MS version, we
2254         report what the ambiguity is.   Innovation at work ;-)
2255
2256         (DeclSpace.FindType): Require a location argument to
2257         display when we display an ambiguous error.
2258
2259         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
2260
2261         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
2262
2263         * expression.cs (EmitDynamicInitializers): Apply patch from
2264         hwang_rob@yahoo.ca that fixes the order in which we emit our
2265         initializers. 
2266
2267 2002-09-21  Martin Baulig  <martin@gnome.org>
2268
2269         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
2270         delegate takes no arguments.
2271
2272 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
2273
2274         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
2275         from integers.
2276
2277         * expression.cs: Extract the underlying type.
2278
2279         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
2280
2281         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
2282
2283 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
2284
2285         * class.cs (TypeContainer.DefineType): We can not use the nice
2286         PackingSize with the size set to 1 DefineType method, because it
2287         will not allow us to define the interfaces that the struct
2288         implements.
2289
2290         This completes the fixing of bug 27287
2291
2292         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
2293         means also structs.  This fixes part of the problem. 
2294         (Expresion.ImplicitReferenceConversionExists): ditto.
2295
2296         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
2297         error if there were no errors reported during the type lookup
2298         process, to avoid duplicates or redundant errors.  Without this
2299         you would get an ambiguous errors plus a type not found.  We have
2300         beaten the user enough with the first error.  
2301
2302         (DeclSparce.FindType): Emit a warning if we have an ambiguous
2303         reference. 
2304
2305         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
2306         during the resolution process, stop the lookup, this avoids
2307         repeated error reports (same error twice).
2308
2309         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
2310
2311         * typemanager.cs (LookupType): Redo the type lookup code to match
2312         the needs of System.Reflection.  
2313
2314         The issue is that System.Reflection requires references to nested
2315         types to begin with a "+" sign instead of a dot.  So toplevel
2316         types look like: "NameSpace.TopLevelClass", and nested ones look
2317         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
2318         levels. 
2319
2320 2002-09-19  Martin Baulig  <martin@gnome.org>
2321
2322         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
2323         says that a method always returns or always throws an exception,
2324         don't report the CS0161.
2325
2326         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
2327         set `Returns = new_returns'.
2328
2329 2002-09-19  Martin Baulig  <martin@gnome.org>
2330
2331         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
2332         to an enum constant, check for a CS0176.
2333
2334 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
2335
2336         * class.cs (TypeContainer.CheckPairedOperators): Now we check
2337         for operators that must be in pairs and report errors.
2338
2339         * ecore.cs (SimpleName.DoResolveType): During the initial type
2340         resolution process, when we define types recursively, we must
2341         check first for types in our current scope before we perform
2342         lookups in the enclosing scopes.
2343
2344         * expression.cs (MakeByteBlob): Handle Decimal blobs.
2345
2346         (Invocation.VerifyArgumentsCompat): Call
2347         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
2348         I thought we were supposed to always call this, but there are a
2349         few places in the code where we dont do it.
2350
2351 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
2352
2353         * driver.cs: Add support in -linkres and -resource to specify the
2354         name of the identifier.
2355
2356 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
2357
2358         * ecore.cs (StandardConversionExists): Sync with the conversion
2359         code: allow anything-* to void* conversions.
2360
2361         (FindMostSpecificSource): Use an Expression argument
2362         instead of a Type, because we might be handed over a Literal which
2363         gets a few more implicit conversions that plain types do not.  So
2364         this information was being lost.
2365
2366         Also, we drop the temporary type-holder expression when not
2367         required.
2368
2369 2002-09-17  Martin Baulig  <martin@gnome.org>
2370
2371         * class.cs (PropertyBase.CheckBase): Don't check the base class if
2372         this is an explicit interface implementation.
2373
2374 2002-09-17  Martin Baulig  <martin@gnome.org>
2375
2376         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
2377         different `IndexerName' attributes.
2378
2379         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
2380         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
2381         virtual CommonResolve().
2382
2383 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
2384
2385         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
2386         and convert that to the UnderlyingType.
2387
2388         * statement.cs (Foreach.Resolve): Indexers are just like variables
2389         or PropertyAccesses.
2390
2391         * cs-tokenizer.cs (consume_string): Track line numbers and columns
2392         inside quoted strings, we were not doing this before.
2393
2394 2002-09-16  Martin Baulig  <martin@gnome.org>
2395
2396         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
2397         resolve it.  This is needed for the definite assignment check of the
2398         instance expression, fixes bug #29846.
2399         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
2400
2401 2002-09-16  Nick Drochak  <ndrochak@gol.com>
2402
2403         * parameter.cs: Fix compile error.  Cannot reference static member
2404         from an instance object.  Is this an mcs bug?
2405
2406 2002-09-14  Martin Baulig  <martin@gnome.org>
2407
2408         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
2409         multiple times.  Fixes bug #30295, added test-166.cs.
2410
2411 2002-09-14  Martin Baulig  <martin@gnome.org>
2412
2413         * statement.cs (Block.Emit): Don't emit unreachable code.
2414         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
2415         `break' statements.
2416         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
2417
2418 2002-09-14  Martin Baulig  <martin@gnome.org>
2419
2420         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
2421         is set.
2422
2423 2002-09-14  Martin Baulig  <martin@gnome.org>
2424
2425         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
2426         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
2427         be false on the ms runtime.
2428
2429 2002-09-13  Martin Baulig  <martin@gnome.org>
2430
2431         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
2432         the CS0038 error message.
2433
2434 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
2435
2436         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
2437         constant inside, return it.
2438
2439 2002-09-12  Martin Baulig  <martin@gnome.org>
2440
2441         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
2442         implicit conversion can be done between enum types.
2443
2444         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
2445         check whether an implicit conversion to the current enum's UnderlyingType
2446         exists and report an error if not.
2447
2448         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
2449         without debugging support.
2450
2451         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
2452         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
2453
2454 2002-09-12  Martin Baulig  <martin@gnome.org>
2455
2456         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
2457
2458         * ecore.cs (IMemberExpr.DeclaringType): New property.
2459         (SimpleName.SimpleNameResolve): Check whether we're accessing a
2460         nonstatic member of an outer type (CS0038).
2461
2462 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
2463
2464         * driver.cs: Activate the using-error detector at warning level
2465         4 (at least for MS-compatible APIs).
2466
2467         * namespace.cs (VerifyUsing): Small buglett fix.
2468
2469         * pending.cs (PendingImplementation): pass the container pointer. 
2470
2471         * interface.cs (GetMethods): Allow for recursive definition.  Long
2472         term, I would like to move every type to support recursive
2473         definitions, not the current ordering mechanism that we have right
2474         now.
2475
2476         The situation is this: Attributes are handled before interfaces,
2477         so we can apply attributes to interfaces.  But some attributes
2478         implement interfaces, we will now handle the simple cases
2479         (recursive definitions will just get an error).  
2480
2481         * parameter.cs: Only invalidate types at the end if we fail to
2482         lookup all types.  
2483
2484 2002-09-09  Martin Baulig  <martin@gnome.org>
2485
2486         * ecore.cs (PropertyExpr.Emit): Also check for
2487         TypeManager.system_int_array_get_length so this'll also work when
2488         compiling corlib.  Fixes #30003.
2489
2490 2002-09-09  Martin Baulig  <martin@gnome.org>
2491
2492         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
2493         and throw an exception if we can't get the type's size.  Fixed #30040,
2494         added test-165.cs.
2495
2496 2002-09-09  Martin Baulig  <martin@gnome.org>
2497
2498         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
2499
2500         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
2501         context.  Fixes bug #30027.
2502
2503         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
2504         virtual functions.  Fixes bug #30043, added test-164.cs.
2505
2506 2002-09-08  Ravi Pratap  <ravi@ximian.com>
2507
2508         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
2509
2510 2002-09-08  Nick Drochak  <ndrochak@gol.com>
2511
2512         * driver.cs: Use an object to get the windows codepage since it's not a
2513         static property.
2514
2515 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
2516
2517         * statement.cs (For.Emit): for infinite loops (test == null)
2518         return whether there is a break inside, not always "true".
2519
2520         * namespace.cs (UsingEntry): New struct to hold the name of the
2521         using definition, the location where it is defined, and whether it
2522         has been used in a successful type lookup.
2523         
2524         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
2525         strings.
2526
2527         * decl.cs: ditto.
2528
2529 2002-09-06  Ravi Pratap  <ravi@ximian.com>
2530
2531         * attribute.cs : Fix incorrect code which relied on catching
2532         a NullReferenceException to detect a null being passed in
2533         where an object was expected.
2534
2535 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
2536
2537         * statement.cs (Try): flag the catch variable as assigned
2538
2539         * expression.cs (Cast): Simplified by using ResolveType instead of
2540         manually resolving.
2541
2542         * statement.cs (Catch): Fix bug by using ResolveType.
2543
2544 2002-09-06  Ravi Pratap  <ravi@ximian.com>
2545
2546         * expression.cs (BetterConversion): Special case for when we have
2547         a NullLiteral as the argument and we have to choose between string
2548         and object types - we choose string the way csc does.
2549
2550         * attribute.cs (Attribute.Resolve): Catch the
2551         NullReferenceException and report error #182 since the Mono
2552         runtime no more has the bug and having this exception raised means
2553         we tried to select a constructor which takes an object and is
2554         passed a null.
2555
2556 2002-09-05  Ravi Pratap  <ravi@ximian.com>
2557
2558         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
2559         message (1502, 1503) when we can't locate a method after overload
2560         resolution. This is much more informative and closes the bug
2561         Miguel reported.
2562
2563         * interface.cs (PopulateMethod): Return if there are no argument
2564         types. Fixes a NullReferenceException bug.
2565
2566         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
2567         expressions too. Previously we were checking only in one place for
2568         positional arguments leaving out named arguments.
2569
2570         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
2571         type to the enum type is not allowed. Remove code corresponding to
2572         that.
2573
2574         (ConvertNumericExplicit): Allow explicit conversions from
2575         the underlying type to enum type. This precisely follows the spec
2576         and closes a bug filed by Gonzalo.
2577         
2578 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2579
2580         * compiler.csproj:
2581         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
2582
2583 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
2584
2585         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
2586         it was important that we stored the right value after the
2587         reduction in `converted'.
2588
2589 2002-09-04  Martin Baulig  <martin@gnome.org>
2590
2591         * location.cs (Location.SymbolDocument): Use full pathnames for the
2592         source files.
2593
2594 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
2595
2596         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
2597         of the expression resolve mechanism, because that will catch the
2598         SimpleName error failures.
2599
2600         (Conditional): If we can not resolve the
2601         expression, return, do not crash.
2602
2603 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2604
2605         * cs-tokenizer.cs:
2606         (location): display token name instead of its number.
2607
2608 2002-08-28  Martin Baulig  <martin@gnome.org>
2609
2610         * expression.cs (Binary.ResolveOperator): Don't silently return
2611         but return an error if an operator cannot be applied between two
2612         enum types.
2613
2614 2002-08-28  Martin Baulig  <martin@gnome.org>
2615
2616         * class.cs (Constructor.Define): Set the permission attributes
2617         correctly instead of making all constructors public.
2618
2619 2002-08-28  Martin Baulig  <martin@gnome.org>
2620
2621         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
2622         for private members before reporting a CS0103; if we find anything,
2623         it's a CS0122.
2624
2625 2002-08-28  Martin Baulig  <martin@gnome.org>
2626
2627         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
2628         to check whether `closure_start_type == closure_invocation_type',
2629         we also need to check whether `m.DeclaringType == closure_invocation_type'
2630         before bypassing the permission checks.  We might be accessing
2631         protected/private members from the base class.
2632         (TypeManager.RealMemberLookup): Only set private_ok if private
2633         members were requested via BindingFlags.NonPublic.
2634
2635         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
2636
2637         * expression.cs (MemberAccess.ResolveMemberAccess): Set
2638         MethodGroupExpr.IsExplicitImpl if appropriate.
2639         (Invocation.DoResolve): Don't report the CS0120 for explicit
2640         interface implementations.
2641
2642 2002-08-27  Martin Baulig  <martin@gnome.org>
2643
2644         * expression.cs (Invocation.DoResolve): If this is a static
2645         method and we don't have an InstanceExpression, we must report
2646         a CS0120.
2647
2648 2002-08-25  Martin Baulig  <martin@gnome.org>
2649
2650         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
2651         `==' between a valuetype and an object.
2652
2653 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
2654
2655         * ecore.cs (TypeExpr): Provide a ToString method.
2656
2657 2002-08-24  Martin Baulig  <martin@gnome.org>
2658
2659         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
2660         now called proggie.dbg and it's a binary file.
2661
2662 2002-08-23  Martin Baulig  <martin@gnome.org>
2663
2664         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
2665
2666 2002-08-23  Martin Baulig  <martin@gnome.org>
2667
2668         * struct.cs (MyStructInfo.ctor): Make this work with empty
2669         structs; it's not allowed to use foreach() on null.
2670
2671 2002-08-23  Martin Baulig  <martin@gnome.org>
2672
2673         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
2674         writer the full pathname of the generated assembly.
2675
2676 2002-08-23  Martin Baulig  <martin@gnome.org>
2677
2678         * statements.cs (FlowBranching.UsageVector.MergeChildren):
2679         A `finally' block never returns or breaks; improved handling of
2680         unreachable code.
2681
2682 2002-08-23  Martin Baulig  <martin@gnome.org>
2683
2684         * statement.cs (Throw.Resolve): Allow `throw null'.
2685
2686 2002-08-23  Martin Baulig  <martin@gnome.org>
2687
2688         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
2689         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
2690         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
2691         MemberLookup would return a wrong event if this is an explicit
2692         interface implementation and the class has an event with the same
2693         name.
2694
2695 2002-08-23  Martin Baulig  <martin@gnome.org>
2696
2697         * statement.cs (Block.AddChildVariableNames): New public method.
2698         (Block.AddChildVariableName): Likewise.
2699         (Block.IsVariableNameUsedInChildBlock): Likewise.
2700         (Block.AddVariable): Check whether a variable name has already
2701         been used in a child block.
2702
2703         * cs-parser.jay (declare_local_variables): Mark all variable names
2704         from the current block as being used in a child block in the
2705         implicit block.
2706
2707 2002-08-23  Martin Baulig  <martin@gnome.org>
2708
2709         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
2710         find the symbol writer.
2711
2712         * driver.cs: csc also allows the arguments to /define being
2713         separated by commas, not only by semicolons.
2714
2715 2002-08-23  Martin Baulig  <martin@gnome.org>
2716
2717         * interface.cs (Interface.GetMembers): Added static check for events.
2718
2719 2002-08-15  Martin Baulig  <martin@gnome.org>
2720
2721         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
2722         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
2723
2724         * ecore.cs (Expression.MemberLookup): Added documentation and explained
2725         why the MethodData.EmitDestructor() change was necessary.
2726
2727 2002-08-20  Martin Baulig  <martin@gnome.org>
2728
2729         * class.cs (TypeContainer.FindMembers): Added static check for events.
2730
2731         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
2732
2733         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
2734         use Type.GetEvents(), not Type.FindMembers().
2735
2736 2002-08-20  Martin Baulig  <martin@gnome.org>
2737
2738         * decl.cs (MemberCache): Added a special method cache which will
2739         be used for method-only searched.  This ensures that a method
2740         search will return a MethodInfo with the correct ReflectedType for
2741         inherited methods.      
2742
2743 2002-08-20  Martin Baulig  <martin@gnome.org>
2744
2745         * decl.cs (DeclSpace.FindMembers): Made this public.
2746
2747 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2748
2749         * delegate.cs: fixed build on windows.
2750         [FIXME:  Filed as bug #29150: MCS must report these errors.]
2751
2752 2002-08-19  Ravi Pratap  <ravi@ximian.com>
2753
2754         * ecore.cs (StandardConversionExists): Return a false
2755         if we are trying to convert the void type to anything else
2756         since that is not allowed.
2757
2758         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
2759         we flag error 70 in the event an event is trying to be accessed
2760         directly from outside the declaring type.
2761
2762 2002-08-20  Martin Baulig  <martin@gnome.org>
2763
2764         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
2765         MemberCache from typemanager.cs to decl.cs.
2766
2767 2002-08-19  Martin Baulig  <martin@gnome.org>
2768
2769         * class.cs (TypeContainer): Implement IMemberContainer.
2770         (TypeContainer.DefineMembers): Create the MemberCache.
2771         (TypeContainer.FindMembers): Do better BindingFlags checking; only
2772         return public members if BindingFlags.Public was given, check
2773         whether members are static.
2774
2775 2002-08-16  Martin Baulig  <martin@gnome.org>
2776
2777         * decl.cs (DeclSpace.Define): Splitted this in Define and
2778         DefineMembers.  DefineMembers is called first and initializes the
2779         MemberCache.
2780
2781         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
2782         DefineMembers() on all our DeclSpaces.
2783
2784         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
2785         but call DefineMembers() on all nested interfaces.  We call their
2786         Define() in our new Define() function.
2787
2788         * interface.cs (Interface): Implement IMemberContainer.
2789         (Interface.Define): Moved all code except the attribute stuf to
2790         DefineMembers().
2791         (Interface.DefineMembers): Initialize the member cache.
2792
2793         * typemanager.cs (IMemberFinder): Removed this interface, we don't
2794         need this anymore since we can use MemberCache.FindMembers directly.
2795
2796 2002-08-19  Martin Baulig  <martin@gnome.org>
2797
2798         * typemanager.cs (MemberCache): When creating the cache for an
2799         interface type, add all inherited members.
2800         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
2801         to `out bool used_cache' and documented it.
2802         (TypeManager.MemberLookup): If we already used the cache in the first
2803         iteration, we don't need to do the interfaces check.
2804
2805 2002-08-19  Martin Baulig  <martin@gnome.org>
2806
2807         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
2808         here from IMemberFinder and don't implement this interface anymore.
2809         (DeclSpace.MemberCache): Moved here from IMemberFinder.
2810
2811         * typemanager.cs (IMemberFinder): This interface is now only used by
2812         classes which actually support the member cache.
2813         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
2814         since we only put DeclSpaces into this Hashtable.
2815         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
2816         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
2817
2818 2002-08-16  Martin Baulig  <martin@gnome.org>
2819
2820         * typemanager.cs (ICachingMemberFinder): Removed.
2821         (IMemberFinder.MemberCache): New property.
2822         (TypeManager.FindMembers): Merged this with RealFindMembers().
2823         This function will never be called from TypeManager.MemberLookup()
2824         so we can't use the cache here, just the IMemberFinder.
2825         (TypeManager.MemberLookup_FindMembers): Check whether the
2826         IMemberFinder has a MemberCache and call the cache's FindMembers
2827         function.
2828         (MemberCache): Rewrote larger parts of this yet another time and
2829         cleaned it up a bit.
2830
2831 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
2832
2833         * driver.cs (LoadArgs): Support quoting.
2834
2835         (Usage): Show the CSC-like command line arguments.
2836
2837         Improved a few error messages.
2838
2839 2002-08-15  Martin Baulig  <martin@gnome.org>
2840
2841         * typemanager.cs (IMemberContainer.Type): New property.
2842         (IMemberContainer.IsInterface): New property.
2843
2844         The following changes are conditional to BROKEN_RUNTIME, which is
2845         defined at the top of the file.
2846
2847         * typemanager.cs (MemberCache.MemberCache): Don't add the base
2848         class'es members, but add all members from TypeHandle.ObjectType
2849         if we're an interface.
2850         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
2851         is the current type.
2852         (MemberCache.CacheEntry.Container): Removed this field.
2853         (TypeHandle.GetMembers): Include inherited members.
2854
2855 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2856
2857         * typemanager.cs: fixed compilation and added a comment on a field that
2858         is never used.
2859
2860 2002-08-15  Martin Baulig  <martin@gnome.org>
2861
2862         * class.cs (ConstructorInitializer.Resolve): In the
2863         Expression.MemberLookup call, use the queried_type as
2864         invocation_type.
2865
2866         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
2867         declared' attribute, it's always true.
2868         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
2869         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
2870         temporary wrapper for FindMembers which tells MemberLookup whether
2871         members from the base classes are included in the return value.
2872         This will go away soon.
2873         (TypeManager.MemberLookup): Use this temporary hack here; once the
2874         new MemberCache is completed, we don't need to do the DeclaredOnly
2875         looping here anymore since the MemberCache will take care of this.
2876         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
2877         (MemberCache): When creating the MemberCache for a class, get
2878         members from the current class and all its base classes.
2879         (MemberCache.CacheEntry.Container): New field.  This is a
2880         temporary hack until the Mono runtime is fixed to distinguish
2881         between ReflectedType and DeclaringType.  It allows us to use MCS
2882         with both the MS runtime and the unfixed Mono runtime without
2883         problems and without accecting performance.
2884         (MemberCache.SearchMembers): The DeclaredOnly looping from
2885         TypeManager.MemberLookup is now done here.      
2886
2887 2002-08-14  Martin Baulig  <martin@gnome.org>
2888
2889         * statement.cs (MyStructInfo.MyStructInfo): Don't call
2890         Type.GetFields on dynamic types but get the fields from the
2891         corresponding TypeContainer.
2892         (MyStructInfo.GetStructInfo): Added check for enum types.
2893
2894         * typemanager.cs (MemberList.IsSynchronized): Implemented.
2895         (MemberList.SyncRoot): Implemented.
2896         (TypeManager.FilterWithClosure): No need to check permissions if
2897         closure_start_type == closure_invocation_type, don't crash if
2898         closure_invocation_type is null.
2899
2900 2002-08-13  Martin Baulig  <martin@gnome.org>
2901
2902         Rewrote TypeContainer.FindMembers to use a member cache.  This
2903         gives us a speed increase of about 35% for the self-hosting MCS
2904         build and of about 15-20% for the class libs (both on GNU/Linux).
2905
2906         * report.cs (Timer): New class to get enhanced profiling.  This
2907         whole class is "TIMER" conditional since it remarkably slows down
2908         compilation speed.
2909
2910         * class.cs (MemberList): New class.  This is an IList wrapper
2911         which we're now using instead of passing MemberInfo[]'s around to
2912         avoid copying this array unnecessarily.
2913         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
2914         (ICachingMemberFinder, IMemberContainer): New interface.
2915         (TypeManager.FilterWithClosure): If `criteria' is null, the name
2916         has already been checked, otherwise use it for the name comparision.
2917         (TypeManager.FindMembers): Renamed to RealMemberFinder and
2918         provided wrapper which tries to use ICachingMemberFinder.FindMembers
2919         if possible.  Returns a MemberList, not a MemberInfo [].
2920         (TypeHandle): New class, implements IMemberContainer.  We create
2921         one instance of this class per type, it contains a MemberCache
2922         which is used to do the member lookups.
2923         (MemberCache): New class.  Each instance of this class contains
2924         all members of a type and a name-based hash table.
2925         (MemberCache.FindMembers): This is our new member lookup
2926         function.  First, it looks up all members of the requested name in
2927         the hash table.  Then, it walks this list and sorts out all
2928         applicable members and returns them.
2929
2930 2002-08-13  Martin Baulig  <martin@gnome.org>
2931
2932         In addition to a nice code cleanup, this gives us a performance
2933         increase of about 1.4% on GNU/Linux - not much, but it's already
2934         half a second for the self-hosting MCS compilation.
2935
2936         * typemanager.cs (IMemberFinder): New interface.  It is used by
2937         TypeManager.FindMembers to call FindMembers on a TypeContainer,
2938         Enum, Delegate or Interface.
2939         (TypeManager.finder_to_member_finder): New PtrHashtable.
2940         (TypeManager.finder_to_container): Removed.
2941         (TypeManager.finder_to_delegate): Removed.
2942         (TypeManager.finder_to_interface): Removed.
2943         (TypeManager.finder_to_enum): Removed.
2944
2945         * interface.cs (Interface): Implement IMemberFinder.
2946
2947         * delegate.cs (Delegate): Implement IMemberFinder.
2948
2949         * enum.cs (Enum): Implement IMemberFinder.
2950
2951         * class.cs (TypeContainer): Implement IMemberFinder.
2952
2953 2002-08-12  Martin Baulig  <martin@gnome.org>
2954
2955         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
2956
2957 2002-08-12  Martin Baulig  <martin@gnome.org>
2958
2959         * ecore.cs (ITypeExpression): New interface for expressions which
2960         resolve to a type.
2961         (TypeExpression): Renamed to TypeLookupExpression.
2962         (Expression.DoResolve): If we're doing a types-only lookup, the
2963         expression must implement the ITypeExpression interface and we
2964         call DoResolveType() on it.
2965         (SimpleName): Implement the new ITypeExpression interface.
2966         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
2967         hack, the situation that we're only looking up types can't happen
2968         anymore when this method is called.  Moved the type lookup code to
2969         DoResolveType() and call it.
2970         (SimpleName.DoResolveType): This ITypeExpression interface method
2971         is now doing the types-only lookup.
2972         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
2973         (ResolveFlags): Added MaskExprClass.
2974
2975         * expression.cs (MemberAccess): Implement the ITypeExpression
2976         interface.
2977         (MemberAccess.DoResolve): Added support for a types-only lookup
2978         when we're called via ITypeExpression.DoResolveType().
2979         (ComposedCast): Implement the ITypeExpression interface.
2980
2981         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
2982         Expression.Resolve() with ResolveFlags.Type instead.
2983
2984 2002-08-12  Martin Baulig  <martin@gnome.org>
2985
2986         * interface.cs (Interface.Define): Apply attributes.
2987
2988         * attribute.cs (Attribute.ApplyAttributes): Added support for
2989         interface attributes.
2990
2991 2002-08-11  Martin Baulig  <martin@gnome.org>
2992
2993         * statement.cs (Block.Emit): Only check the "this" variable if we
2994         do not always throw an exception.
2995
2996         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
2997         whether the property has a set accessor.
2998
2999 2002-08-11  Martin Baulig  <martin@gnome.org>
3000
3001         Added control flow analysis support for structs.
3002
3003         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
3004         with control flow analysis turned off.
3005         (IVariable): New interface.
3006         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
3007         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
3008         (FieldExpr.DoResolve): Resolve the instance expression with flow
3009         analysis turned off and do the definite assignment check after the
3010         resolving when we know what the expression will resolve to.
3011
3012         * expression.cs (LocalVariableReference, ParameterReference):
3013         Implement the new IVariable interface, only call the flow analysis
3014         code if ec.DoFlowAnalysis is true.
3015         (This): Added constructor which takes a Block argument.  Implement
3016         the new IVariable interface.
3017         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
3018         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
3019         This does the definite assignment checks for struct members.
3020
3021         * class.cs (Constructor.Emit): If this is a non-static `struct'
3022         constructor which doesn't have any initializer, call
3023         Block.AddThisVariable() to tell the flow analysis code that all
3024         struct elements must be initialized before control returns from
3025         the constructor.
3026
3027         * statement.cs (MyStructInfo): New public class.
3028         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
3029         argument to this indexer.  If non-zero, check an individual struct
3030         member, not the whole struct.
3031         (FlowBranching.CheckOutParameters): Check struct members.
3032         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
3033         overloaded versions of these methods which take an additional
3034         `int field_idx' argument to check struct members.
3035         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
3036         overloaded versions of these methods which take an additional
3037         `string field_name' argument to check struct member.s
3038         (VariableInfo): Implement the IVariable interface.
3039         (VariableInfo.StructInfo): New public property.  Returns the
3040         MyStructInfo instance of the variable if it's a struct or null.
3041         (Block.AddThisVariable): New public method.  This is called from
3042         Constructor.Emit() for non-static `struct' constructor which do
3043         not have any initializer.  It creates a special variable for the
3044         "this" instance variable which will be checked by the flow
3045         analysis code to ensure that all of the struct's fields are
3046         initialized before control returns from the constructor.
3047         (UsageVector): Added support for struct members.  If a
3048         variable/parameter is a struct with N members, we reserve a slot
3049         in the usage vector for each member.  A struct is considered fully
3050         initialized if either the struct itself (slot 0) or all its
3051         members are initialized.
3052
3053 2002-08-08  Martin Baulig  <martin@gnome.org>
3054
3055         * driver.cs (Driver.MainDriver): Only report an error CS5001
3056         if there were no compilation errors.
3057
3058         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
3059         `UnsafeContext' property to determine whether the parent is in
3060         unsafe context rather than checking the parent's ModFlags:
3061         classes nested in an unsafe class are unsafe as well.
3062
3063 2002-08-08  Martin Baulig  <martin@gnome.org>
3064
3065         * statement.cs (UsageVector.MergeChildren): Distinguish between
3066         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
3067         we return.  Added test17() and test18() to test-154.cs.
3068
3069 2002-08-08  Martin Baulig  <martin@gnome.org>
3070
3071         * typemanager.cs (TypeManager.FilterWithClosure): If we have
3072         Family access, make sure the invoking type isn't a subclass of the
3073         queried type (that'd be a CS1540).
3074
3075         * ecore.cs (Expression.MemberLookup): Added overloaded version of
3076         this method which takes an additional `Type invocation_type'.
3077
3078         * expression.cs (BaseAccess.DoResolve): Use the base type as
3079         invocation and query type.
3080         (MemberAccess.DoResolve): If the lookup failed and we're about to
3081         report a CS0122, try a lookup with the ec.ContainerType - if this
3082         succeeds, we must report a CS1540.
3083
3084 2002-08-08  Martin Baulig  <martin@gnome.org>
3085
3086         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
3087         (MethodGroupExpr): Implement the IMemberExpr interface.
3088
3089         * expression (MemberAccess.ResolveMemberAccess): No need to have
3090         any special code for MethodGroupExprs anymore, they're now
3091         IMemberExprs.   
3092
3093 2002-08-08  Martin Baulig  <martin@gnome.org>
3094
3095         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
3096         Family, FamANDAssem and FamORAssem permissions.
3097         (TypeManager.IsSubclassOrNestedChildOf): New public method.
3098
3099 2002-08-08  Martin Baulig  <martin@gnome.org>
3100
3101         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
3102         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
3103         or loop block.
3104
3105 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
3106
3107         * driver.cs: implemented /resource option to embed managed resources.
3108
3109 2002-08-07  Martin Baulig  <martin@gnome.org>
3110
3111         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
3112         (FieldBase.HasFieldInitializer): New public property.
3113         (FieldBase.GetInitializerExpression): New public method.  Resolves and
3114         returns the field initializer and makes sure it is only resolved once.
3115         (TypeContainer.EmitFieldInitializers): Call
3116         FieldBase.GetInitializerExpression to get the initializer, this ensures
3117         that it isn't resolved multiple times.
3118
3119         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
3120         the resolving process (SimpleName/MemberLookup) that we're currently
3121         emitting a field initializer (which must not access any instance members,
3122         this is an error CS0236).
3123
3124         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
3125         argument, if the `IsFieldInitializer' flag is set, we must report and
3126         error CS0236 and not an error CS0120.   
3127
3128 2002-08-07  Martin Baulig  <martin@gnome.org>
3129
3130         * ecore.cs (IMemberExpr): New public interface.
3131         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
3132         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
3133         if the expression is an IMemberExpr.
3134
3135         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
3136         to be null, implicitly default to `this' if we're non-static in
3137         this case.  Simplified the code a lot by using the new IMemberExpr
3138         interface.  Also fixed bug #28176 here.
3139
3140 2002-08-06  Martin Baulig  <martin@gnome.org>
3141
3142         * cs-parser.jay (SimpleLookup): Removed.  We need to create
3143         ParameterReferences during semantic analysis so that we can do a
3144         type-only search when resolving Cast, TypeOf and SizeOf.
3145         (block): Pass the `current_local_parameters' to the Block's
3146         constructor.
3147
3148         * class.cs (ConstructorInitializer): Added `Parameters parameters'
3149         argument to the constructor.
3150         (ConstructorInitializer.Resolve): Create a temporary implicit
3151         block with the parameters.
3152
3153         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
3154         references here if we aren't doing a type-only search.
3155
3156         * statement.cs (Block): Added constructor which takes a
3157         `Parameters parameters' argument.
3158         (Block.Parameters): New public property.
3159
3160         * support.cs (InternalParameters.Parameters): Renamed `parameters'
3161         to `Parameters' and made it public readonly.
3162
3163 2002-08-06  Martin Baulig  <martin@gnome.org>
3164
3165         * ecore.cs (Expression.Warning): Made this public as well.
3166
3167         * report.cs (Report.Debug): Print the contents of collections.
3168
3169 2002-08-06  Martin Baulig  <martin@gnome.org>
3170
3171         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
3172         used to tell Resolve() which kinds of expressions it may return.
3173         (Expression.Resolve): Added overloaded version of this method which
3174         takes a `ResolveFlags flags' argument.  This can be used to tell
3175         Resolve() which kinds of expressions it may return.  Reports a
3176         CS0118 on error.
3177         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
3178         ResolveFlags.SimpleName.
3179         (Expression.Error118): Added overloaded version of this method which
3180         takes a `ResolveFlags flags' argument.  It uses the flags to determine
3181         which kinds of expressions are allowed.
3182
3183         * expression.cs (Argument.ResolveMethodGroup): New public method.
3184         Resolves an argument, but allows a MethodGroup to be returned.
3185         This is used when invoking a delegate.
3186
3187         * TODO: Updated a bit.
3188
3189 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3190
3191         Fixed compilation with csc.
3192
3193         * ecore.cs: Expression.Error made public. Is this correct? Should
3194         Warning be made public too?
3195
3196         * expression.cs: use ea.Location instead of ea.loc.
3197         [FIXME:  Filed as bug #28607: MCS must report these errors.]
3198
3199 2002-08-06  Martin Baulig  <martin@gnome.org>
3200
3201         * ecore.cs (Expression.loc): Moved the location here instead of
3202         duplicating it in all derived classes.
3203         (Expression.Location): New public property.
3204         (Expression.Error, Expression.Warning): Made them non-static and
3205         removed the location argument.
3206         (Expression.Warning): Added overloaded version which takes an
3207         `int level' argument.
3208         (Expression.Error118): Make this non-static and removed the
3209         expression and location arguments.
3210         (TypeExpr): Added location argument to the constructor.
3211
3212         * expression.cs (StaticCallExpr): Added location argument to
3213         the constructor.
3214         (Indirection, PointerArithmetic): Likewise.
3215         (CheckedExpr, UnCheckedExpr): Likewise.
3216         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
3217         (StringPtr): Likewise.
3218
3219
3220 2002-08-05  Martin Baulig  <martin@gnome.org>
3221
3222         * expression.cs (BaseAccess.DoResolve): Actually report errors.
3223
3224         * assign.cs (Assign.DoResolve): Check whether the source
3225         expression is a value or variable.
3226
3227         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
3228         while resolving the corresponding blocks.
3229
3230         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
3231         an error, don't silently return null.
3232
3233         * statement.cs (Block.AddVariable): Do the error reporting here
3234         and distinguish between CS0128 and CS0136.
3235         (Block.DoResolve): Report all unused labels (warning CS0164).
3236         (LabeledStatement): Pass the location to the constructor.
3237         (LabeledStatement.HasBeenReferenced): New property.
3238         (LabeledStatement.Resolve): Set it to true here.
3239
3240         * statement.cs (Return.Emit): Return success even after reporting
3241         a type mismatch error (CS0126 or CS0127), this is what csc does and
3242         it avoids confusing the users with any consecutive errors.
3243
3244 2002-08-05  Martin Baulig  <martin@gnome.org>
3245
3246         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
3247
3248         * const.cs (Const.LookupConstantValue): Catch circular definitions.
3249
3250         * expression.cs (MemberAccess.DoResolve): Silently return if an
3251         error has already been reported.
3252
3253         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
3254         error has already been reported.
3255
3256 2002-08-05  Martin Baulig  <martin@gnome.org>
3257
3258         * statement.cs (UsageVector): Only initialize the `parameters'
3259         vector if we actually have any "out" parameters.
3260
3261 2002-08-05  Martin Baulig  <martin@gnome.org>
3262
3263         * expression.cs (Binary.ResolveOperator): When combining delegates,
3264         they must have the same type.
3265
3266 2002-08-05  Martin Baulig  <martin@gnome.org>
3267
3268         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
3269         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
3270         work with the ms runtime and we also don't need it: if we're a
3271         PropertyBuilder and not in the `indexer_arguments' hash, then we
3272         are a property and not an indexer.
3273
3274         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
3275         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
3276         since the latter one doesn't work with the ms runtime.
3277
3278 2002-08-03  Martin Baulig  <martin@gnome.org>
3279
3280         Fixed bugs #27998 and #22735.
3281
3282         * class.cs (Method.IsOperator): New public field.
3283         (Method.CheckBase): Report CS0111 if there's already a method
3284         with the same parameters in the current class.  Report CS0508 when
3285         attempting to change the return type of an inherited method.
3286         (MethodData.Emit): Report CS0179 if a method doesn't have a body
3287         and it's not marked abstract or extern.
3288         (PropertyBase): New abstract base class for Property and Indexer.
3289         (PropertyBase.CheckBase): Moved here from Property and made it work
3290         for indexers.
3291         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
3292         the same so we can reuse it there.
3293         (Property, Indexer): Derive from PropertyBase.
3294         (MethodSignature.inheritable_property_signature_filter): New delegate
3295         to find properties and indexers.
3296
3297         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
3298         argument and improved error reporting.
3299
3300         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
3301         EmptyReadOnlyParameters and made it a property.
3302
3303         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
3304         version of this method which takes a `PropertyInfo indexer'.
3305         (TypeManager.RegisterIndexer): New method.
3306
3307         * class.cs: Added myself as author of this file :-)
3308
3309 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3310
3311         * class.cs: fixed compilation on windoze.
3312
3313 2002-08-03  Martin Baulig  <martin@gnome.org>
3314
3315         * interface.cs (Interface.GetInterfaceBases): Check whether all
3316         base interfaces are at least as accessible than the current one.
3317
3318         * class.cs (TypeContainer.GetClassBases): Check whether base types
3319         are at least as accessible than the current type.
3320         (TypeContainer.AsAccessible): Implemented and made non-static.
3321         (MemberBase.CheckParameters): Report errors if the accessibility
3322         checks fail.
3323
3324         * delegate.cs (Delegate.Delegate): The default visibility is
3325         internal for top-level types and private for nested types.
3326         (Delegate.Define): Report errors if the accessibility checks fail.
3327
3328         * enum.cs (Enum.Enum): The default visibility is internal for
3329         top-level types and private for nested types.
3330         (Enum.DefineType): Compute the correct visibility.
3331
3332         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
3333         function which takes a `bool is_toplevel' instead of a TypeContainer.
3334
3335         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
3336         builtin type.
3337
3338 2002-08-02  Martin Baulig  <martin@gnome.org>
3339
3340         * expression.cs (LocalVariableReferenc): Added constructor which
3341         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
3342         (LocalVariableReference.IsReadOnly): New property.
3343         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
3344         variable is readonly, use our own readonly flag to do this; you can
3345         use the new constructor to get a writable reference to a read-only
3346         variable.
3347
3348         * cs-parser.jay (foreach_statement, using_statement): Get a writable
3349         reference to the local variable.
3350
3351 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
3352
3353         * rootcontext.cs (ResolveCore): Also include System.Exception
3354
3355         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
3356         we reach an EmptyStatement.
3357
3358         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
3359         is also fine.
3360
3361         * expression.cs (Binary.ResolveOperator): Check error result in
3362         two places.
3363
3364         use brtrue/brfalse directly and avoid compares to null.
3365
3366 2002-08-02  Martin Baulig  <martin@gnome.org>
3367
3368         * class.cs (TypeContainer.Define): Define all nested interfaces here.
3369         Fixes bug #28407, added test-155.cs.
3370
3371 2002-08-01  Martin Baulig  <martin@gnome.org>
3372
3373         * class.cs (Event.EmitDefaultMethod): Make this work with static
3374         events.  Fixes #28311, added verify-3.cs.
3375
3376 2002-08-01  Martin Baulig  <martin@gnome.org>
3377
3378         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
3379         `is_disposable' fields.
3380         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
3381         `hm.is_disposable' if we're using the collection pattern.
3382         (Foreach.EmitCollectionForeach): Use the correct type for the
3383         enumerator's local variable, only emit the try/finally block if
3384         necessary (fixes #27713).
3385
3386 2002-08-01  Martin Baulig  <martin@gnome.org>
3387
3388         * ecore.cs (Expression.report118): Renamed to Error118 and made
3389         it public static.
3390
3391         * statement.cs (Throw.Resolve): Check whether the expression is of
3392         the correct type (CS0118) and whether the type derives from
3393         System.Exception (CS0155).
3394         (Catch.Resolve): New method.  Do the type lookup here and check
3395         whether it derives from System.Exception (CS0155).
3396         (Catch.CatchType, Catch.IsGeneral): New public properties.
3397
3398         * typemanager.cs (TypeManager.exception_type): Added.
3399
3400 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
3401
3402         * driver.cs: Updated About function.
3403
3404 2002-07-31  Martin Baulig  <martin@gnome.org>
3405
3406         Implemented Control Flow Analysis.
3407
3408         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
3409         (EmitContext.CurrentBranching): Added.
3410         (EmitContext.StartFlowBranching): Added.
3411         (EmitContext.EndFlowBranching): Added.
3412         (EmitContext.KillFlowBranching): Added.
3413         (EmitContext.IsVariableAssigned): Added.
3414         (EmitContext.SetVariableAssigned): Added.
3415         (EmitContext.IsParameterAssigned): Added.
3416         (EmitContext.SetParameterAssigned): Added.
3417         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
3418         Added control flow analysis stuff here.
3419
3420         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
3421         resolve the expression as lvalue.
3422         (LocalVariableReference.DoResolve): Check whether the variable has
3423         already been assigned.
3424         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
3425         the parameter as assigned here.
3426         (ParameterReference.DoResolve): Check whether the parameter has already
3427         been assigned.
3428         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
3429         expression as lvalue.
3430
3431         * statement.cs (FlowBranching): New class for the flow analysis code.
3432         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
3433         (LabeledStatement.IsDefined): New public property.
3434         (LabeledStatement.AddUsageVector): New public method to tell flow
3435         analyis that the label may be reached via a forward jump.
3436         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
3437         flow analysis.
3438         (VariableInfo.Number): New public field.  This is used by flow analysis
3439         to number all locals of a block.
3440         (Block.CountVariables): New public property.  This is the number of
3441         local variables in this block (including the locals from all parent
3442         blocks).
3443         (Block.EmitMeta): Number all the variables.
3444
3445         * statement.cs: Added flow analysis support to all classes.
3446
3447 2002-07-31  Martin Baulig  <martin@gnome.org>
3448
3449         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
3450         To get debugging messages, compile mcs with /define:MCS_DEBUG and
3451         then use this argument.
3452
3453         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
3454
3455         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
3456         use this to specify /define options.
3457
3458 2002-07-29  Martin Baulig  <martin@gnome.org>
3459
3460         * statement.cs (Fixed): Moved all code that does variable lookups
3461         and resolvings from Emit to Resolve.
3462
3463         * statement.cs (For): Moved all code that does variable lookups
3464         and resolvings from Emit to Resolve.
3465
3466         * statement.cs (Using): Moved all code that does variable lookups
3467         and resolvings from Emit to Resolve.
3468
3469 2002-07-29  Martin Baulig  <martin@gnome.org>
3470
3471         * attribute.cs (Attribute.Resolve): Explicitly catch a
3472         System.NullReferenceException when creating the
3473         CustromAttributeBuilder and report a different warning message.
3474
3475 2002-07-29  Martin Baulig  <martin@gnome.org>
3476
3477         * support.cs (ParameterData.ParameterName): Added method to
3478         get the name of a parameter.
3479
3480         * typemanager.cs (TypeManager.IsValueType): New public method.
3481
3482 2002-07-29  Martin Baulig  <martin@gnome.org>
3483
3484         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
3485         is a flag which specifies that it's either ref or out.
3486         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
3487         the out parameter to `out Parameter.Modifier mod', also set the
3488         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
3489
3490         * support.cs (InternalParameters.ParameterModifier): Distinguish
3491         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3492         Parameter.Modifier.ISBYREF flag if it's either ref or out.
3493
3494         * expression.cs (Argument.GetParameterModifier): Distinguish
3495         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3496         Parameter.Modifier.ISBYREF flag if it's either ref or out.
3497
3498 2002-07-29  Martin Baulig  <martin@gnome.org>
3499
3500         * expression.cs (ParameterReference.ParameterReference): Added
3501         `Location loc' argument to the constructor.
3502
3503         * cs-parser.jay: Pass location to ParameterReference.
3504
3505 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
3506
3507         * statement.cs (Try): Initialize the location.
3508
3509         * cs-parser.jay: pass location to Try.
3510
3511         * expression.cs (Unary.Reduce): Change the prototype to return
3512         whether a constant fold could be performed or not.  The result is
3513         returned in an out parameters.  In the case of Indirection and
3514         AddressOf, we want to perform the full tests.
3515
3516 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
3517
3518         * statement.cs (Statement.Emit): Flag dead code.
3519
3520 2002-07-27  Andrew Birkett  <andy@nobugs.org>
3521
3522         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
3523
3524 2002-07-27  Martin Baulig  <martin@gnome.org>
3525
3526         * class.cs (MethodData.Define): Put back call to
3527         TypeManager.AddMethod(), accidentally commented this out.
3528
3529         * report.cs (Debug): New public method to print debugging information,
3530         this is `[Conditional ("DEBUG")]'.
3531
3532 2002-07-26  Martin Baulig  <martin@gnome.org>
3533
3534         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
3535         (switch_statement): Push the current_block to the switch_stack and
3536         pop it again when we're done with the switch.
3537         (switch_section): The new block is a child of the current_block.
3538         Fixes bug #24007, added test-152.cs.
3539
3540 2002-07-27  Martin Baulig  <martin@gnome.org>
3541
3542         * expression.cs (Invocation.EmitArguments): When calling a varargs
3543         function with only its fixed arguments, we need to pass an empty
3544         array.
3545
3546 2002-07-27  Martin Baulig  <martin@gnome.org>
3547
3548         Mono 0.13 has been released.
3549
3550 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
3551
3552         * driver.cs: Rename --resource to --linkres, because that is what
3553         we do currently, we dont support --resource yet.
3554
3555         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
3556
3557 2002-07-25  Martin Baulig  <martin@gnome.org>
3558
3559         * class.cs (MethodData): New public class.  This is a `method builder'
3560         class for a method or one accessor of a Property/Indexer/Event.
3561         (MethodData.GetMethodFlags): Moved here from MemberBase.
3562         (MethodData.ApplyAttributes): Likewise.
3563         (MethodData.ApplyObsoleteAttribute): Likewise.
3564         (MethodData.ApplyConditionalAttribute): Likewise.
3565         (MethodData.ApplyDllImportAttribute): Likewise.
3566         (MethodData.CheckAbstractAndExternal): Likewise.
3567         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
3568         (MethodData.Emit): Formerly known as Method.Emit().
3569         (MemberBase): Moved everything which was specific to a single
3570         accessor/method to MethodData.
3571         (Method): Create a new MethodData and call Define() and Emit() on it.
3572         (Property, Indexer, Event): Create a new MethodData objects for each
3573         accessor and call Define() and Emit() on them.
3574
3575 2002-07-25  Martin Baulig  <martin@gnome.org>
3576
3577         Made MethodCore derive from MemberBase to reuse the code from there.
3578         MemberBase now also checks for attributes.
3579
3580         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
3581         (MemberBase.GetMethodFlags): Moved here from class Method and marked
3582         as virtual.
3583         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
3584         `CallingConventions cc' and `Attributes opt_attrs' arguments.
3585         (MemberBase.ApplyAttributes): New virtual method; applies the
3586         attributes to a method or accessor.
3587         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
3588         (MemberBase.ApplyConditionalAttribute): Likewise.
3589         (MemberBase.ApplyDllImportAttribute): Likewise.
3590         (MemberBase.CheckAbstractAndExternal): Likewise.
3591         (MethodCore.ParameterTypes): This is now a property instead of a
3592         method, it's initialized from DoDefineParameters().
3593         (MethodCore.ParameterInfo): Removed the set accessor.
3594         (MethodCore.DoDefineParameters): New protected virtual method to
3595         initialize ParameterTypes and ParameterInfo.
3596         (Method.GetReturnType): We can now simply return the MemberType.
3597         (Method.GetMethodFlags): Override the MemberBase version and add
3598         the conditional flags.
3599         (Method.CheckBase): Moved some code from Define() here, call
3600         DoDefineParameters() here.
3601         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
3602         here to avoid some larger code duplication.
3603         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
3604         ensure that abstract and external accessors don't declare a body.
3605
3606         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
3607         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
3608         lookup in the attribute's parent classes, so we need to abort as soon
3609         as we found the first match.
3610         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
3611         the attribute has no arguments.
3612
3613         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
3614         of a Method.
3615
3616 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3617
3618         * cs-parser.jay: reverted previous patch.
3619
3620 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3621
3622         * cs-parser.jay: fixed bug #22119.
3623
3624 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3625
3626         * attribute.cs: fixed compilation. The error was:
3627         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
3628         be assigned to before control leaves the current method."
3629         [FIXME:  Filed as bug #28186: MCS must report this error.]
3630
3631 2002-07-25  Martin Baulig  <martin@gnome.org>
3632
3633         * attribute.cs (Attribute.Conditional_GetConditionName): New static
3634         method to pull the condition name ouf of a Conditional attribute.
3635         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
3636         the obsolete message and error flag out of an Obsolete attribute.
3637
3638         * class.cs (Method.GetMethodFlags): New public method to get the
3639         TypeManager.MethodFlags for this method.
3640         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
3641         private methods.
3642         (Method.Define): Get and apply the Obsolete and Conditional attributes;
3643         if we're overriding a virtual function, set the new private variable
3644         `parent_method'; call the new TypeManager.AddMethod().
3645
3646         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
3647         the MethodBuilder and the Method in a PtrHashtable.
3648         (TypeManager.builder_to_method): Added for this purpose.
3649         (TypeManager.MethodFlags): Added IsObsoleteError.
3650         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
3651         Obsolete and Conditional arguments in MethodBuilders.  If we discover
3652         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
3653         the message from the attribute.
3654
3655 2002-07-24  Martin Baulig  <martin@gnome.org>
3656
3657         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
3658         preprocessor directives, ensure that the argument to #define/#undef is
3659         exactly one identifier and that it's actually an identifier.
3660
3661         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
3662         did not work ....
3663
3664 2002-07-24  Martin Baulig  <martin@gnome.org>
3665
3666         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
3667         initialize it to TypeManager.object_type in the constructor.
3668         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
3669         of the `hm.get_current' method if we're using the collection pattern.
3670         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
3671         for the explicit conversion to make it work when we're using the collection
3672         pattern and the `Current' property has a different return type than `object'.
3673         Fixes #27713.
3674
3675 2002-07-24  Martin Baulig  <martin@gnome.org>
3676
3677         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
3678         does not match, but don't report any errors.  This method is called in
3679         order for all methods in a MethodGroupExpr until a matching method is
3680         found, so we don't want to bail out if the first method doesn't match.
3681         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
3682         matches, report the 123.  Fixes #28070.
3683
3684 2002-07-24  Martin Baulig  <martin@gnome.org>
3685
3686         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
3687         TypeManager.TypeToCoreType() to the top of the method so the
3688         following equality checks will work.  Fixes #28107.
3689
3690 2002-07-24  Martin Baulig  <martin@gnome.org>
3691
3692         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
3693         operand is of type uint, and the other operand is of type sbyte,
3694         short or int, the operands are converted to type long." -
3695         Actually do what this comment already told us.  Fixes bug #28106,
3696         added test-150.cs.
3697
3698 2002-07-24  Martin Baulig  <martin@gnome.org>
3699
3700         * class.cs (MethodBase): New abstract class.  This is now a base
3701         class for Property, Indexer and Event to avoid some code duplication
3702         in their Define() and DefineMethods() methods.
3703         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
3704         generic methods for Define() and DefineMethods().
3705         (FieldBase): Derive from MemberBase, not MemberCore.
3706         (Property): Derive from MemberBase, not MemberCore.
3707         (Property.DefineMethod): Moved all the code from this method to the
3708         new MethodBase.DefineAccessor(), just call it with appropriate
3709         argumetnts.
3710         (Property.Define): Call the new Property.DoDefine(), this does some
3711         sanity checks and we don't need to duplicate the code everywhere.
3712         (Event): Derive from MemberBase, not MemberCore.
3713         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
3714         accessors, this will also make them work with interface events.
3715         (Indexer): Derive from MemberBase, not MemberCore.
3716         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
3717         (Indexer.Define): Use the new MethodBase functions.
3718
3719         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
3720         argument to the constructor.
3721         (Interface.FindMembers): Added support for interface events.
3722         (Interface.PopluateEvent): Implemented.
3723
3724         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
3725
3726 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
3727
3728         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
3729         but this is required to check for a method name being the same as
3730         the containing class.  
3731
3732         Handle this now.
3733
3734 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3735
3736         * interface.cs: initialize variable.
3737
3738 2002-07-23  Martin Baulig  <martin@gnome.org>
3739
3740         Implemented the IndexerName attribute in interfaces.
3741
3742         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
3743         name if this is an explicit interface implementation.
3744         (Indexer.InterfaceIndexerName): New public variable.  If we're
3745         implementing an interface indexer, this is the IndexerName in that
3746         interface.  Otherwise, it's the IndexerName.
3747         (Indexer.DefineMethod): If we're implementing interface indexer,
3748         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
3749         and Pending.ImplementIndexer methods.
3750         (Indexer.Define): Also define the PropertyBuilder if we're
3751         implementing an interface indexer and this is neither an explicit
3752         interface implementation nor do the IndexerName match the one in
3753         the interface.
3754
3755         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
3756         If a method is defined here, then we always need to create a proxy
3757         for it.  This is used when implementing interface indexers.
3758         (Pending.IsInterfaceIndexer): New public method.
3759         (Pending.ImplementIndexer): New public method.
3760         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
3761         This is used when implementing interface indexers to define a proxy
3762         if necessary.
3763         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
3764         define a proxy if necessary.
3765
3766         * interface.cs (Interface.IndexerName): New public variable.
3767         (Interface.PopulateIndexer): Set the IndexerName.
3768         (Interface.DefineIndexers): New private method.  Populate all the
3769         indexers and make sure their IndexerNames match.
3770
3771         * typemanager.cs (IndexerPropertyName): Added support for interface
3772         indexers.
3773
3774 2002-07-22  Martin Baulig  <martin@gnome.org>
3775
3776         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
3777         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
3778         ret if HasReturnLabel.
3779         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
3780         variables.
3781
3782         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
3783         and set the ec.LoopBeginTryCatchLevel.
3784         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
3785         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
3786         the current ec.TryCatchLevel, the branch goes out of an exception
3787         block.  In this case, we need to use Leave and not Br.
3788
3789 2002-07-22  Martin Baulig  <martin@gnome.org>
3790
3791         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
3792         block unless the block does not always return or it is contained in
3793         another try { ... } catch { ... } block.  Fixes bug #26506.
3794         Added verify-1.cs to the test suite.
3795
3796 2002-07-22  Martin Baulig  <martin@gnome.org>
3797
3798         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
3799         then we do not always return.  Fixes bug #24985.
3800
3801 2002-07-22  Martin Baulig  <martin@gnome.org>
3802
3803         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
3804         lookup on a per-class level; ie. walk up the class hierarchy until we
3805         found at least one applicable method, then choose the best among them.
3806         Fixes bug #24463 and test-29.cs.
3807
3808 2002-07-22  Martin Baulig  <martin@gnome.org>
3809
3810         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
3811         return types of the methods.  The return type is not part of the
3812         signature and we must not check it to make the `new' modifier work.
3813         Fixes bug #27999, also added test-147.cs.
3814         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
3815
3816         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
3817         on the method's return type.
3818
3819 2002-07-21  Martin Baulig  <martin@gnome.org>
3820
3821         * assign.cs: Make this work if the rightmost source is a constant and
3822         we need to do an implicit type conversion.  Also adding a few more tests
3823         to test-38.cs which should have caught this.
3824
3825         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
3826         target in the makefile for this.  The makefile.gnu is primarily intended
3827         for end-users who don't want to debug the compiler.
3828
3829 2002-07-21  Martin Baulig  <martin@gnome.org>
3830
3831         * assign.cs: Improved the Assign class so it can now handle embedded
3832         assignments (X = Y = Z = something).  As a side-effect this'll now also
3833         consume less local variables.  test-38.cs now passes with MCS, added
3834         a few new test cases to that test.
3835
3836 2002-07-20  Martin Baulig  <martin@gnome.org>
3837
3838         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
3839         instructions.  Fixes bug #27977, also added test-146.cs.
3840
3841 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3842
3843         * cs-tokenizer.cs: fixed getHex ().
3844
3845 2002-07-19  Martin Baulig  <martin@gnome.org>
3846
3847         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
3848         not Type.GetType() to lookup the array type.  This is needed when
3849         we're constructing an array of a user-defined type.
3850         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
3851         single-dimensional arrays, but also for single-dimensial arrays of
3852         type decimal.
3853
3854 2002-07-19  Martin Baulig  <martin@gnome.org>
3855
3856         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
3857         this function is called, it's not allowed to share LocalBuilders
3858         among ILGenerators.
3859
3860 2002-07-19  Martin Baulig  <martin@gnome.org>
3861
3862         * expression.cs (Argument.Resolve): Report an error 118 when trying
3863         to pass a type as argument.
3864
3865 2002-07-18  Martin Baulig  <martin@gnome.org>
3866
3867         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
3868         Conv_R_Un for the signed `long' type.
3869
3870 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
3871
3872         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
3873         `expr' for the temporary result, as that will fail if we do
3874         multiple resolves on the same expression.
3875
3876 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
3877
3878         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
3879         ec.TypeContainer for looking up aliases. 
3880
3881         * class.cs (TypeContainer): Remove LookupAlias from here.
3882
3883         * decl.cs (DeclSpace); Move here.
3884
3885 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
3886
3887         * class.cs (FindMembers): Only call filter if the constructor
3888         bulider is not null.
3889
3890         Also handle delegates in `NestedTypes' now.  Now we will perform
3891         type lookups using the standard resolution process.  This also
3892         fixes a bug.
3893
3894         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
3895         This uses Expressions (the limited kind that can be parsed by the
3896         tree) instead of strings.
3897
3898         * expression.cs (ComposedCast.ToString): Implement, used to flag
3899         errors since now we have to render expressions.
3900
3901         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
3902         FormArrayType. 
3903
3904         * ecore.cs (SimpleName.ToString): ditto.
3905
3906         * cs-parser.jay: Instead of using strings to assemble types, use
3907         Expressions to assemble the type (using SimpleName, ComposedCast,
3908         MemberAccess).  This should fix the type lookups in declarations,
3909         because we were using a different code path for this.
3910
3911         * statement.cs (Block.Resolve): Continue processing statements
3912         even when there is an error.
3913
3914 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
3915
3916         * class.cs (Event.Define): Also remove the `remove' method from
3917         the list of pending items.
3918
3919         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
3920         generate more compact code. 
3921
3922 2002-07-17  Martin Baulig  <martin@gnome.org>
3923
3924         * const.cs (Const.LookupConstantValue): Add support for constant
3925         `unchecked' and `checked' expressions.
3926         Also adding test case test-140.cs for this.
3927
3928 2002-07-17  Martin Baulig  <martin@gnome.org>
3929
3930         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
3931         check whether mi.ReturnType implements the IEnumerator interface; the
3932         `==' and the IsAssignableFrom() will fail in this situation.
3933
3934 2002-07-16  Ravi Pratap  <ravi@ximian.com>
3935
3936         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
3937         here too.
3938
3939 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3940
3941         * expression.cs: fixed bug #27811.
3942
3943 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
3944
3945         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
3946         Molaro: when we are a ref, the value already contains a pointer
3947         value, do not take the address of it.
3948
3949 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
3950         * removed mb-parser.jay and mb-tokenizer.cs
3951
3952 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
3953
3954         * expression.cs: check against the building corlib void type.
3955
3956 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
3957
3958         * ecore.cs: fix for valuetype static readonly fields: when 
3959         initializing them, we need their address, not the address of a copy.
3960
3961 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
3962
3963         * typemanager.cs: register also enum_type in corlib.
3964
3965 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
3966
3967         * class.cs: allow calling this (but not base) initializers in structs.
3968
3969 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
3970
3971         * ecore.cs: make sure we compare against the building base types
3972         in GetTypeSize ().
3973
3974 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
3975
3976         * typemanager.cs: fix TypeToCoreType() to handle void and object
3977         (corlib gets no more typerefs after this change).
3978
3979 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
3980
3981         * expression.cs (ArrayCreation.EmitArrayArguments): use
3982         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
3983
3984         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
3985         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
3986         array indexes, the runtime actually forbids them.
3987
3988         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
3989         for array arguments here.
3990
3991         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
3992         instead of the default for ValueTypes.
3993
3994         (New.DoEmit): Use IsValueType instead of
3995         IsSubclassOf (value_type)
3996         (New.DoResolve): ditto.
3997         (Invocation.EmitCall): ditto.
3998
3999         * assign.cs (Assign): ditto.
4000
4001         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
4002         Statements *are* currently doing part of their resolution during
4003         Emit.  
4004
4005         Expressions do always resolve during resolve, but statements are
4006         only required to propagate resolution to their children.
4007
4008 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
4009
4010         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
4011
4012         (LoadAssembly): Do not add the dll if it is already specified
4013         
4014         (MainDriver): Add the System directory to the link path at the end,
4015         after all the other -L arguments. 
4016
4017         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
4018         wrong opcode for loading bytes and bools (ldelem.i1 instead of
4019         ldelem.u1) and using the opposite for sbytes.
4020
4021         This fixes Digger, and we can finally run it.
4022
4023         * driver.cs (UnixParseOption): Move the option parsing here.  
4024         (CSCParseOption): Implement CSC-like parsing of options.
4025
4026         We now support both modes of operation, the old Unix way, and the
4027         new CSC-like way.  This should help those who wanted to make cross
4028         platform makefiles.
4029
4030         The only thing broken is that /r:, /reference: and /lib: are not
4031         implemented, because I want to make those have the same semantics
4032         as the CSC compiler has, and kill once and for all the confussion
4033         around this.   Will be doing this tomorrow.
4034
4035         * statement.cs (Unsafe.Resolve): The state is checked during
4036         resolve, not emit, so we have to set the flags for IsUnsfe here.
4037
4038 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
4039
4040         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
4041         not catch the Error_ObjectRefRequired in SimpleName (as it is
4042         possible to have a class/instance variable name that later gets
4043         deambiguated), we have to check this here.      
4044
4045 2002-07-10  Ravi Pratap  <ravi@ximian.com>
4046
4047         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
4048         make static and put into Expression.
4049
4050         (Event.Define): Register the private field of the event with the 
4051         TypeManager so that GetFieldFromEvent can get at it.
4052
4053         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
4054         keep track of the private field associated with an event which
4055         has no accessors.
4056
4057         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
4058         private field.
4059
4060         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
4061         
4062 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
4063
4064         * expression.cs (Binary.EmitBranchable): this routine emits the
4065         Binary expression in a branchable context.  This basically means:
4066         we need to branch somewhere, not just get the value on the stack.
4067
4068         This works together with Statement.EmitBoolExpression.
4069
4070         * statement.cs (Statement.EmitBoolExpression): Use
4071         EmitBranchable. 
4072
4073 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
4074
4075         * statement.cs (For): Reduce the number of jumps in loops.
4076
4077         (For): Implement loop inversion for the For statement.
4078
4079         (Break): We can be breaking out of a Try/Catch controlled section
4080         (foreach might have an implicit try/catch clause), so we need to
4081         use Leave instead of Br.
4082
4083         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
4084         now).  If the instace expression supports IMemoryLocation, we use
4085         the AddressOf method from the IMemoryLocation to extract the
4086         address instead of emitting the instance.
4087
4088         This showed up with `This', as we were emitting the instance
4089         always (Emit) instead of the Address of This.  Particularly
4090         interesting when This is a value type, as we dont want the Emit
4091         effect (which was to load the object).
4092         
4093 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
4094
4095         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
4096
4097         * statement.cs (Checked): Set the CheckedState during the resolve
4098         process too, as the ConvCast operations track the checked state on
4099         the resolve process, and not emit.
4100
4101         * cs-parser.jay (namespace_member_declaration): Flag that we have
4102         found a declaration when we do.  This is used to flag error 1529
4103
4104         * driver.cs: Report ok when we display the help only.
4105
4106 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
4107
4108         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
4109
4110 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
4111
4112         * cs-tokenizer.cs (define): We also have to track locally the
4113         defines.  AllDefines is just used for the Conditional Attribute,
4114         but we also need the local defines for the current source code. 
4115
4116 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
4117
4118         * statement.cs (While, For, Do): These loops can exit through a
4119         Break statement, use this information to tell whether the
4120         statement is the last piece of code.
4121
4122         (Break): Flag that we break.
4123
4124         * codegen.cs (EmitContexts): New `Breaks' state variable.
4125
4126 2002-07-03  Martin Baulig  <martin@gnome.org>
4127
4128         * class.cs (TypeContainer.MethodModifiersValid): Allow override
4129         modifiers in method declarations in structs.  Otherwise, you won't
4130         be able to override things like Object.Equals().
4131
4132 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
4133
4134         * class.cs (Method, Property, Indexer): Do not allow the public
4135         modifier to be used in explicit interface implementations.
4136
4137         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
4138         override modifiers in method declarations in structs
4139
4140 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
4141
4142         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
4143         integer or real overflow, report an error
4144
4145 2002-07-02  Martin Baulig  <martin@gnome.org>
4146
4147         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
4148         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
4149         to tell the runtime about our newly created System.Object and
4150         System.ValueType types.
4151
4152 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
4153
4154         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
4155         struct instead of Ldarg/Starg.
4156
4157 2002-07-02  Martin Baulig  <martin@gnome.org>
4158
4159         * expression.cs (Indirection.Indirection): Call
4160         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
4161
4162 2002-07-02  Martin Baulig  <martin@gnome.org>
4163
4164         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
4165         ValueType, call TypeManager.TypeToCoreType() on it.
4166         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
4167         the OpCodes.Newarr argument.
4168
4169 2002-07-02  Martin Baulig  <martin@gnome.org>
4170
4171         * expression.cs (Invocation.EmitCall): When compiling corlib,
4172         replace all calls to the system's System.Array type to calls to
4173         the newly created one.
4174
4175         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
4176         System.Array methods.
4177         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
4178         from the system's System.Array type which must be replaced.
4179
4180 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
4181
4182         * typemanager.cs: load unverifiable_code_ctor so we can build
4183         corlib using the correct type. Avoid using GetTypeCode() with
4184         TypeBuilders.
4185         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
4186         TypeManager.object_type to allow building corlib.
4187
4188 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
4189
4190         * ecore.cs: handle System.Enum separately in LoadFromPtr().
4191
4192 2002-07-01  Martin Baulig  <martin@gnome.org>
4193
4194         * class.cs: Make the last change actually work, we need to check
4195         whether `ifaces != null' to avoid a crash.
4196
4197 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4198
4199         * class.cs: when we build structs without fields that implement
4200         interfaces, we need to add the interfaces separately, since there is
4201         no API to both set the size and add the interfaces at type creation
4202         time.
4203
4204 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4205
4206         * expression.cs: the dimension arguments to the array constructors
4207         need to be converted if they are a long.
4208
4209 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
4210
4211         * class.cs: don't emit ldarg.0 if there is no parent constructor
4212         (fixes showstopper for corlib).
4213
4214 2002-06-29  Martin Baulig  <martin@gnome.org>
4215
4216         MCS now compiles corlib on GNU/Linux :-)
4217
4218         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
4219         ie. check for MethodImplOptions.InternalCall.
4220
4221         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
4222         and TypeManager.attribute_type are null, so we must explicitly check
4223         whether parent is not null to find out whether it's an attribute type.
4224         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
4225         and SetBuilder, not only if the property is neither abstract nor external.
4226         This is necessary to set the MethodImplOptions on the accessor methods.
4227         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
4228         SetBuilder, see Property.Emit().
4229
4230         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
4231         populate "System.Object", "System.ValueType" and "System.Attribute" since
4232         they've already been populated from BootCorlib_PopulateCoreTypes().
4233
4234 2002-06-29  Martin Baulig  <martin@gnome.org>
4235
4236         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
4237         is the NullLiteral, we also need to make sure that target_type is not
4238         an enum type.   
4239
4240 2002-06-29  Martin Baulig  <martin@gnome.org>
4241
4242         * rootcontext.cs (RootContext.ResolveCore): We must initialize
4243         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
4244         before calling BootstrapCorlib_ResolveDelegate ().
4245
4246 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4247
4248         * statement.cs: fixed build-breaker. All tests passed ok.
4249
4250 2002-06-27  Martin Baulig  <martin@gnome.org>
4251
4252         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
4253         for System.Decimal when compiling corlib.
4254
4255 2002-06-27  Martin Baulig  <martin@gnome.org>
4256
4257         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
4258         switch blocks which contain nothing but a default clause.
4259
4260 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
4261
4262        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
4263
4264 2002-06-27  Martin Baulig  <martin@gnome.org>
4265
4266         * ecore.cs (PropertyExpr.PropertyExpr): Call
4267         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
4268
4269         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
4270         is already a TypeBuilder.
4271
4272 2002-06-27  Martin Baulig  <martin@gnome.org>
4273
4274         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
4275         `target_type == TypeManager.array_type', not IsAssignableFrom() in
4276         the "from an array-type to System.Array" case.  This makes it work
4277         when compiling corlib.
4278
4279 2002-06-27  Martin Baulig  <martin@gnome.org>
4280
4281         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
4282         non-static PropertyExpr, set its InstanceExpression.  This makes
4283         the `ICollection.Count' property work in System/Array.cs.
4284
4285 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
4286
4287         * driver.cs: Made error handling more consistent.  Errors now
4288         tracked by Report class, so many methods which used to return int
4289         now return void.  Main() now prints success/failure and 
4290         errors/warnings message.
4291
4292         Renamed '--probe' compiler argument to '--expect-error'.  Removed
4293         the magic number return values (123 and 124).  Now, if the
4294         expected error occurs, the compiler exits with success (exit value
4295         0).  If the compilation completes without seeing that particular
4296         error, the compiler exits with failure (exit value 1).  The
4297         makefile in mcs/errors has been changed to handle the new behaviour.
4298
4299         * report.cs: Made 'expected error' number a property and renamed
4300         it from 'Probe' to 'ExpectedError'.
4301
4302         * genericparser.cs: Removed error handling support, since it is
4303         now all done by Report class.
4304
4305         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
4306         class, so parse() no longer returns an int.
4307
4308         * namespace.cs: Use Report.Error instead of GenericParser.error
4309
4310 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
4311
4312         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
4313         TypeContainer.AddOperator): At the front of the list put the
4314         explicit implementations, so they get resolved/defined first. 
4315
4316 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
4317
4318         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
4319         interface type is implemented by this TypeContainer.  Used during
4320         explicit interface implementation.
4321
4322         (Property.Define, Indexer.Define, Method.Define): Validate that
4323         the given interface in the explicit implementation is one of the
4324         base classes for the containing type.
4325
4326         Also if we are explicitly implementing an interface, but there is
4327         no match in the pending implementation table, report an error.
4328
4329         (Property.Define): Only define the property if we are
4330         not explicitly implementing a property from an interface.  Use the
4331         correct name also for those properties (the same CSC uses,
4332         although that is really not needed).
4333         
4334         (Property.Emit): Do not emit attributes for explicitly implemented
4335         properties, as there is no TypeBuilder.
4336
4337         (Indexer.Emit): ditto.
4338
4339         Hiding then means that we do not really *implement* a pending
4340         implementation, which makes code fail.
4341
4342 2002-06-22  Martin Baulig  <martin@gnome.org>
4343
4344         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
4345         the return value of Object.GetType().  [FIXME: we need to do this whenever
4346         we get a type back from the reflection library].
4347
4348 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
4349
4350         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
4351
4352 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
4353
4354         * attribute.cs: Return null if we can not look up the type.
4355
4356         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
4357         the interface types found.
4358
4359         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
4360         interface types found.
4361
4362         * typemanager.cs (GetInterfaces): Make this routine returns alll
4363         the interfaces and work around the lame differences between
4364         System.Type and System.Reflection.Emit.TypeBuilder in the results
4365         result for GetInterfaces.
4366         
4367         (ExpandInterfaces): Given an array of interface types, expand and
4368         eliminate repeated ocurrences of an interface.  This expands in
4369         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
4370         be IA, IB, IC.
4371         
4372 2002-06-21  Martin Baulig  <martin@gnome.org>
4373
4374         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
4375         on System.Enum.
4376
4377 2002-06-21  Martin Baulig  <martin@gnome.org>
4378
4379         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
4380         and called with one of the core types, return the corresponding typebuilder for
4381         that type.
4382
4383         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
4384         element type.
4385
4386 2002-06-21  Martin Baulig  <martin@gnome.org>
4387
4388         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
4389         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
4390         (Expression.ConvertReferenceExplicit): Likewise.
4391
4392         * expression.cs (ElementAccess.DoResolve): Likewise.
4393         (ElementAccess.DoResolveLValue): Likewise.
4394
4395 2002-06-10  Martin Baulig  <martin@gnome.org>
4396
4397         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
4398         add the "value" parameter to the parameter list.
4399
4400         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
4401         to our caller.
4402
4403 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
4404
4405         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
4406         the argument to an int, uint, long or ulong, per the spec.  Also
4407         catch negative constants in array creation.
4408
4409 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
4410
4411         * class.cs: do not allow the same interface to appear twice in
4412         the definition list.
4413
4414 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
4415
4416         * ecore.cs: don't use ldlen with System.Array.
4417
4418 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
4419
4420         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
4421
4422 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
4423
4424         * modifiers.cs: produce correct field attributes for protected
4425         internal. Easy fix so miguel can work on ther harder stuff:-)
4426
4427 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
4428
4429         * pending.cs: New file.  Move the code from class.cs here.
4430         Support clearning the pending flag for all methods (when not doing
4431         explicit interface implementation).
4432
4433 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
4434
4435         * rootcontext.cs: added a couple more types needed to bootstrap.
4436
4437 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
4438
4439         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
4440         constructor in the type, instead of any constructor in the type
4441         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
4442         a bug in the Mono runtime when applying the params attribute). 
4443
4444 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
4445         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
4446
4447 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
4448
4449         * expression.cs (Unary.ResolveOperator): Use TypeManager
4450         to resolve the type.
4451         
4452 2002-06-13  Ravi Pratap  <ravi@ximian.com>
4453
4454         * cs-parser.jay (enum_member_declaration): Pass in the attributes
4455         attached.
4456
4457         * enum.cs (AddEnumMember): Add support to store the attributes associated 
4458         with each member too.
4459
4460         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
4461         field builders too - this takes care of the enum member case.
4462
4463 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
4464
4465         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
4466         address-of operator on both value types and pointers.
4467         
4468 2002-06-10  Martin Baulig  <martin@gnome.org>
4469
4470         * interface.cs (Interface.PopulateIndexer): Add the indexer's
4471         PropertyBuilder to the `property_builders' list.
4472
4473         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
4474         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
4475         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
4476         find any indexers which are inherited from an interface.
4477
4478 2002-06-09  Martin Baulig  <martin@gnome.org>
4479
4480         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
4481         the same type as the constant if necessary.  There's also a test-130.cs
4482         for this.
4483
4484         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
4485
4486         * typemanager.cs (TypeManager.ChangeType): Previously known as
4487         Enum.ChangeEnumType().
4488
4489 2002-06-09  Martin Baulig  <martin@gnome.org>
4490
4491         * expression.cs (Cast.TryReduce): Added support for consts.
4492
4493 2002-06-08  Ravi Pratap  <ravi@ximian.com>
4494
4495         * class.cs (Accessor): Hold attributes information so we can pass
4496         it along.
4497
4498         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
4499         Modify to pass in attributes attached to the methods.
4500
4501         (add_accessor_declaration, remove_accessor_declaration): Ditto.
4502
4503         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
4504         to handle the Accessor kind :-)
4505
4506         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
4507         
4508 2002-06-08  Martin Baulig  <martin@gnome.org>
4509
4510         * expression.cs (Unary.TryReduceNegative): Added support for
4511         ULongConstants.
4512
4513 2002-06-08  Martin Baulig  <martin@gnome.org>
4514
4515         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
4516         name can't be found in the `defined_names' - the caller will do a
4517         MemberLookup in this case and thus find methods in System.Enum
4518         such as Enum.IsDefined().
4519
4520 2002-06-08  Martin Baulig  <martin@gnome.org>
4521
4522         * enum.cs (Enum.ChangeEnumType): This is a custom version of
4523         Convert.ChangeType() which works with TypeBuilder created types.
4524         (Enum.LookupEnumValue, Enum.Define): Use it here.
4525
4526         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
4527         `TypeBuilder.BaseType != null' check.
4528         (TypeContainer.FindMembers): Only lookup parent members if we
4529         actually have a parent.
4530         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
4531         (ConstructorInitializer.Resolve): Likewise.
4532
4533         * interface.cs (Interface.FindMembers): Added
4534         `TypeBuilder.BaseType != null' check.
4535
4536         * rootcontext.cs (RootContext.ResolveCore): Added
4537         "System.Runtime.CompilerServices.IndexerNameAttribute" to
4538         classes_second_stage.
4539
4540         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
4541         debug_type and trace_type when compiling with --nostdlib.       
4542
4543 2002-06-07  Martin Baulig  <martin@gnome.org>
4544
4545         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
4546         (AddField): Set it to true when adding a non-static field.
4547         (DefineType): Use `have_nonstatic_fields' to find out whether we
4548         have non-static fields, not `Fields != null'.
4549
4550 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
4551
4552         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
4553         dereferencing a null on the static-field code path)
4554
4555 2002-05-30  Martin Baulig  <martin@gnome.org>
4556
4557         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
4558         to take command line arguments.  Use reflection to call the new
4559         custom `Initialize' function on the symbol writer and pass it the
4560         command line arguments.
4561
4562         * driver.cs (--debug-args): New command line argument to pass command
4563         line arguments to the symbol writer.
4564
4565 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
4566
4567         * assign.cs (DoResolve): Forgot to do the implicit conversion to
4568         the target type for indexers and properties.  Thanks to Joe for
4569         catching this.
4570
4571 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
4572
4573         * typemanager.cs (MethodFlags): returns the method flags
4574         (Obsolete/ShouldIgnore) that control warning emission and whether
4575         the invocation should be made, or ignored. 
4576
4577         * expression.cs (Invocation.Emit): Remove previous hack, we should
4578         not do this on matching a base type, we should do this based on an attribute
4579
4580         Only emit calls to System.Diagnostics.Debug and
4581         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
4582         on the command line.
4583
4584         * rootcontext.cs: Global settings for tracing and debugging.
4585
4586         * cs-tokenizer.cs (define): New utility function to track
4587         defines.   Set the global settings for TRACE and DEBUG if found.
4588
4589 2002-05-25  Ravi Pratap  <ravi@ximian.com>
4590
4591         * interface.cs (Populate*): Pass in the TypeContainer as well as
4592         the DeclSpace as parameters so that we can create EmitContexts and
4593         then use that to apply attributes etc.
4594
4595         (PopulateMethod, PopulateEvent, PopulateProperty)
4596         (PopulateIndexer): Apply attributes everywhere.
4597
4598         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
4599         etc.
4600
4601         (ApplyAttributes): Update accordingly.
4602
4603         We now apply interface attributes for all members too.
4604
4605 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
4606
4607         * class.cs (Indexer.Define); Correctly check if we are explicit
4608         implementation (instead of checking the Name for a ".", we
4609         directly look up if the InterfaceType was specified).
4610
4611         Delay the creation of the PropertyBuilder.
4612
4613         Only create the PropertyBuilder if we are not an explicit
4614         interface implementation.   This means that explicit interface
4615         implementation members do not participate in regular function
4616         lookups, and hence fixes another major ambiguity problem in
4617         overload resolution (that was the visible effect).
4618
4619         (DefineMethod): Return whether we are doing an interface
4620         implementation. 
4621         
4622         * typemanager.cs: Temporary hack until we get attributes in
4623         interfaces (Ravi is working on that) and we get IndexerName
4624         support in interfaces.
4625
4626         * interface.cs: Register the indexers as properties.
4627
4628         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
4629         warning, I have verified that this is a bug in the .NET runtime
4630         (JavaScript suffers of the same problem).
4631
4632         * typemanager.cs (MemberLookup): When looking up members for
4633         interfaces, the parent of an interface is the implicit
4634         System.Object (so we succeed in searches of Object methods in an
4635         interface method invocation.  Example:  IEnumerable x;  x.ToString
4636         ()) 
4637
4638 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
4639
4640         * class.cs (Event): Events should also register if they do
4641         implement the methods that an interface requires.
4642
4643         * typemanager.cs (MemberLookup); use the new GetInterfaces
4644         method. 
4645
4646         (GetInterfaces): The code used to lookup interfaces for a type is
4647         used in more than one place, factor it here. 
4648
4649         * driver.cs: Track the errors at the bottom of the file, we kept
4650         on going.
4651
4652         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
4653         instance if the method we are calling is static!
4654
4655 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
4656
4657         * attribute.cs (ApplyAttributes): Make this function filter out
4658         the IndexerName attribute (as that attribute in reality is never
4659         applied) and return the string constant for the IndexerName
4660         attribute. 
4661
4662         * class.cs (TypeContainer.Emit): Validate that all the indexers
4663         have the same IndexerName attribute, and if so, set the
4664         DefaultName attribute on the class. 
4665
4666         * typemanager.cs: The return value might contain other stuff (not
4667         only methods).  For instance, consider a method with an "Item"
4668         property and an Item method.
4669
4670         * class.cs: If there is a problem with the parameter types,
4671         return. 
4672
4673 2002-05-24  Ravi Pratap  <ravi@ximian.com>
4674
4675         * ecore.cs (ImplicitConversionExists): Wrapper function which also
4676         looks at user defined conversion after making a call to 
4677         StandardConversionExists - we need this for overload resolution.
4678
4679         * expression.cs : Update accordingly the various method calls.
4680
4681         This fixes 2 bugs filed against implicit user defined conversions 
4682
4683 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
4684
4685         * statement.cs: Track the result of the assignment.
4686
4687 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
4688
4689         * expression.cs (MemberAccess): Improved error reporting for
4690         inaccessible members.
4691
4692 2002-05-22  Martin Baulig  <martin@gnome.org>
4693
4694         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
4695         itself with debugging support.
4696
4697 2002-05-22  Martin Baulig  <martin@gnome.org>
4698
4699         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
4700         Removed, this isn't needed anymore.
4701
4702 2002-05-20  Martin Baulig  <martin@gnome.org>
4703
4704         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
4705         be underlying type for an enum.
4706
4707 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
4708
4709         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
4710         that splits out the loading of just the core types.
4711
4712         * rootcontext.cs (ResolveCore): Split the struct resolution in
4713         two, so we can load the enumeration underlying types before any
4714         enums are used.
4715
4716         * expression.cs (Is): Bandaid until we fix properly Switch (see
4717         bug #24985 for details).
4718
4719         * typemanager.cs (ImplementsInterface): The hashtable will contain
4720         a null if there are no interfaces implemented.
4721
4722 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
4723
4724         * cs-parser.jay (indexer_declarator): It is fine to have array
4725         parameters
4726
4727 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
4728
4729         * typemanager.cs: (RegisterBuilder): New function used to register
4730         TypeBuilders that implement interfaces.  Since
4731         TypeBuilder.GetInterfaces (as usual) does not work with lame
4732         Reflection.Emit. 
4733         (AddUserType): register interfaces.
4734
4735         (ImplementsInterface): Use the builder_to_ifaces hash if we are
4736         dealing with TypeBuilder.  Also, arrays are showing up as
4737         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
4738         methods can not be invoked on them!
4739
4740         * ecore.cs (ExplicitReferenceConversionExists): Made public.
4741         (ImplicitReferenceConversionExists): Split out from
4742         StandardConversionExists. 
4743
4744         * expression.cs (As): We were only implementing one of the three
4745         cases for the as operator.  We now implement them all.
4746         (Is): Implement the various other cases for Is as well.
4747
4748         * typemanager.cs (CACHE): New define used to control if we want or
4749         not the FindMembers cache.  Seems to have a negative impact on
4750         performance currently
4751
4752         (MemberLookup): Nested types have full acess to
4753         enclosing type members
4754
4755         Remove code that coped with instance/static returns for events, we
4756         now catch this in RealFindMembers.
4757
4758         (RealFindMembers): only perform static lookup if the instance
4759         lookup did not return a type or an event.  
4760
4761 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
4762
4763         * assign.cs (CompoundAssign): We pass more semantic information
4764         now to Compound Assignments than we did before: now we have all
4765         the information at hand, and now we resolve the target *before* we
4766         do the expression expansion, which allows the "CacheValue" method
4767         to have the effect we intended (before, a [x] += 1 would generate
4768         two differen ArrayAccess expressions from the ElementAccess,
4769         during the resolution process).
4770
4771         (CompoundAssign.DoResolve): Resolve target and original_source here.
4772
4773 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
4774
4775         * expression.cs (ArrayAccess): dropped debugging information. 
4776
4777         * typemanager.cs: Small bug fix: I was always returning i_members,
4778         instead of one of i_members or s_members (depending on which had
4779         the content).
4780
4781         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
4782         method is invoked before any code generation takes place, and it
4783         is a mechanism to inform that the expression will be invoked more
4784         than once, and that the method should use temporary values to
4785         avoid having side effects
4786
4787         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
4788         
4789         * ecore.cs (Expression.CacheTemporaries): Provide empty default
4790         implementation.
4791
4792         * expression.cs (Indirection, ArrayAccess): Add support for
4793         CacheTemporaries in these two bad boys. 
4794
4795         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
4796         ldobj or ldind_ref.  
4797         (StoreFromPtr): Handle stobj as well.
4798
4799         * expression.cs (UnaryMutator): Share more code.
4800         
4801         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
4802         down: I was not tracking the Filter function as well, which
4803         was affecting the results of the cache.
4804
4805 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
4806
4807         * attribute.cs: Remove the hack to handle the CharSet property on
4808         StructLayouts. 
4809
4810 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
4811
4812         * attribute.cs (DoResolve): More uglyness, we now only try to
4813         resolve the attribute partially, to extract the CharSet
4814         information (only if we are a StructLayout attribute).  Otherwise 
4815
4816         (GetExtraTypeInfo): Add some code to conditionally kill in the
4817         future this.   I am more and more convinced that the .NET
4818         framework has special code to handle the attribute setting on
4819         certain elements.
4820
4821         * expression.cs (IsParamsMethodApplicable): Revert my previous
4822         foreach change here, it was wrong.
4823
4824 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
4825
4826         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
4827         (pp_expr): do not abort on unknown input, just return.
4828         (eval): abort if there are pending chars.
4829
4830         * attribute.cs (Attribute.Resolve): Positional parameters are
4831         optional.  Deal with that case.
4832
4833         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
4834         the Ansi/Unicode/Auto information for the type.
4835
4836         (TypeContainer.DefineType): instantiate the EmitContext here, as
4837         we will be using it during the type definition (to resolve
4838         attributes) and during the emit phase.
4839
4840         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
4841         to pull type information out of the attributes
4842
4843         (Attribute.Resolve): track the constructor builder, and allow for
4844         multiple invocations (structs and classes will use this).
4845
4846         * ecore.cs (MemberLookupFinal): new version with all the
4847         parameters customizable.
4848
4849         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
4850         constructors.  Return if the result value is null (as the error
4851         would have been flagged already by MemberLookupFinal)
4852
4853         Do not allow instances of abstract classes or interfaces to be
4854         created.
4855         
4856         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
4857         We have to compare the assembly property here when dealing with
4858         FamANDAssem and Assembly access modifiers, because we might be
4859         creating an assembly from *modules* (that means that we are not
4860         getting TypeBuilders for types defined in other modules that are
4861         part of this assembly).
4862
4863         (Method.Emit): If the method is marked abstract and has a body,
4864         emit an error. 
4865
4866         (TypeContainer.DefineMembers): If both the defined member and the
4867         parent name match are methods, then do not emit any warnings: let
4868         the Method.Define routine take care of flagging warnings.  But if
4869         there is a mismatch (method overrides something else, or method is
4870         overriwritten by something, then emit warning).
4871
4872         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
4873         set to null, this means `do not check for the return type on the
4874         signature'. 
4875
4876         (Method.Define): set the return type for the method signature to
4877         null, so that we get methods with the same name and parameters and
4878         different return types.  This is used to flag warning 114 (you are
4879         hiding a method, and you probably want to use the new/override
4880         keywords instead).
4881
4882         * typemanager.cs (MemberLookup): Implemented proper access
4883         control, closing a long standing set of bug reports.  The problem
4884         was that the Framework only has two bits: Public and NonPublic,
4885         and NonPublic includes private and protected methods, but we need
4886         to enforce the FamANDAssem, FamOrAssem and Family. 
4887
4888 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
4889
4890         * statement.cs (GotoCase): Return true: Ammounts to giving up
4891         knowledge on whether we return or not, and letting the other case
4892         be responsible for it.
4893
4894 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
4895
4896         * driver.cs: Do not load directories for each file processed, only
4897         do it if there is a pattern.
4898
4899         * ecore.cs: Report readonly assigns here as well, as we might have
4900         been resolved only by MemberAccess.
4901
4902         (SimpleName.SimpleNameResolve): Also be useful for LValue
4903         resolution.   We need this to propagate assign to local readonly variables
4904
4905         * typemanager.cs: Use a ptrhashtable for the criteria, because we
4906         do not want to reuse potential criteria memory.
4907
4908         * class.cs (MyEventBuilder): Set reflected_type;
4909
4910         * ecore.cs (Constantify): Added support for constifying bools.
4911
4912         (RootContext.LookupType): Added a cache for values looked up in
4913         the declaration space.
4914
4915         * typemanager.cs (FindMembers): Now is a front-end to
4916         RealFindMembers, and provides a two-level hashtable-based cache to
4917         the request.  
4918
4919         15% performance improvement: from 22.5 to 19.2 seconds.
4920
4921         * expression.cs (IsParamsMethodApplicable): use foreach.
4922         (Invocation.DoResolve): ditto.
4923         (New.DoResolve): ditto.
4924         (ArrayCreation.DoResolve): ditto.
4925
4926         * ecore.cs (FindMostEncompassingType): use foreach.
4927
4928         * delegate.cs (NewDelegate.DoResolve): Use foreach
4929
4930         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
4931         (RemoveMethods): use foreach.
4932
4933         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
4934         nested foreach statements instead of for, and also break out of
4935         the inner loop once a match is found.
4936         
4937         (Invocation.OverloadResolve): Use foreach, simplify the code. 
4938
4939 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
4940
4941         * cfold.cs (BinaryFold): During an enumeration evaluation context,
4942         we actually unwrap the expression to allow for extra information
4943         to be extracted. 
4944
4945         * expression.cs: Use Shr_Un on unsigned operations. 
4946
4947 2002-05-08  Ravi Pratap  <ravi@ximian.com>
4948
4949         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
4950         applicable operators was not being considered correctly. This closes
4951         the bug Miguel reported.
4952
4953 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
4954
4955         * attribute.cs: check that the type derives from System.Attribute
4956         and report the correct error in that case (moved the duplicate code to
4957         its own method, too).
4958
4959 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
4960
4961         * attribute.cs: lookup attribute type name as the spec says: first the
4962         bare attribute name and then name + "Attribute" (nant compiles with
4963         mcs after this fix).
4964
4965 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
4966
4967         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
4968         Because of the way we parse things, we should try to see if a
4969         UIntConstant can fit in an integer.
4970
4971 2002-05-07  Ravi Pratap  <ravi@ximian.com>
4972
4973         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
4974         when we are in an explicit context.
4975
4976         (ConvertReferenceExplicit): When converting from Iface type S to Class
4977         T make sure the rules are implemented as an OR.
4978
4979         * parameter.cs (ParameterType): Make it a property for now although the
4980         purpose really isn't anything immediate.
4981         
4982         * expression.cs (Is*Applicable): Do better checking on the parameter type
4983         of a ref/out parameter. The ones from the system assemblies are already 
4984         marked with the correct type so we don't need to do any correction.
4985
4986         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
4987         the object type is standard too so include that.
4988
4989 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
4990
4991         * ecore.cs (StandardConversionExists): Augment with missing code:
4992         deal with IntConstant, LongConstants and Enumerations.
4993
4994         * assign.cs: Report the error, instead of failing silently
4995
4996         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
4997         typecontainer that they are declared, because the
4998         typecontainer/namespace will have the list of using clauses that
4999         need to be applied.
5000
5001         Assembly Attributes were escaping the normal registration
5002         mechanism. 
5003
5004         (EmitCode): Apply attributes within an EmitContext that represents
5005         the container they were declared on.
5006         
5007         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
5008
5009 2002-05-06  Ravi Pratap  <ravi@ximian.com>
5010
5011         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
5012         Revamp completely - make much cleaner as we now operate only
5013         on a set of Types.
5014
5015         (FindMostSpecificSource, FindMostSpecificTarget): New methods
5016         to implement the logic detailed in the spec more correctly.
5017
5018         (UserDefinedConversion): Update accordingly.
5019
5020 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5021
5022         * statement.cs: Return flow analysis information up.
5023
5024         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
5025         and the default.
5026
5027         (token): Do not consume an extra character before calling
5028         decimal_digits.
5029
5030 2002-05-06  Piers Haken <piersh@friskit.com>
5031
5032         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
5033
5034 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5035
5036         * class.cs (Constructor.Emit): Set the IsStatic flag in the
5037         EmitContext during the instance constructor initializer
5038         resolution, to stop access to instance variables.
5039
5040         This is mandated by the spec, last paragraph of the `constructor
5041         initializers' section. 
5042
5043 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
5044
5045         * cs-parser.jay, class.cs (Accessor): new class used to represent
5046         an accessor (get or set).  In the past we used `null' to represent
5047         a missing accessor.  But this is ambiguous because there was no
5048         way to tell in abstract indexers/properties if one of them was
5049         specified.
5050
5051         Now there is a way of addressing that.
5052
5053         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
5054         instead of FindMembers.
5055
5056         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
5057         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
5058
5059         * attribute.cs: Treat indexers and properties as the same in terms
5060         of applying attributes
5061
5062         * ecore.cs (FindMostEncompassedType): Use statically initialized
5063         EmptyExpressions()s like we do elsewhere to avoid creating useless
5064         objects (and we take this out of the tight loop).
5065
5066         (GetConversionOperators): Move the code to extract the actual
5067         operators to a separate routine to clean things up.
5068
5069 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
5070
5071         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
5072         events are always registered FieldBuilders.
5073         
5074         * class.cs (FieldBase): New class shared by Fields 
5075
5076         * delegate.cs: If we are a toplevel delegate, use our full name.
5077         If we are a nested delegate, then only use our tail name.
5078
5079 2002-05-02  Ravi Pratap  <ravi@ximian.com>
5080
5081         * expression.cs (IsApplicable): Ensure that we add the "&" to
5082         ref/out types before comparing it with the type of the argument.
5083
5084         (IsParamsMethodApplicable): Ditto.
5085
5086         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
5087         silly me ;-)
5088
5089         * delegate.cs : Handle the case when we have more than one applicable
5090         method. Flag an error only when we finish checking all.
5091
5092 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
5093
5094         * expression.cs: Add support for boolean static initializers.
5095
5096 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
5097
5098         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
5099
5100         * parameter.cs (ComputeParameterTypes,
5101         ComputeAndDefineParameterTypes): Better error handling: now we
5102         clear the `types' cache if we fail during any of the type lookups.
5103         We also return the status code correctly to our caller
5104
5105         * delegate.cs: If we fail to define a delegate, abort the extra
5106         steps. 
5107
5108         * expression.cs (Binary.ResolveOperator): for
5109         operator==(object,object) and operator !=(object, object) we also
5110         have to verify that there is an implicit conversion from one to
5111         the other.
5112
5113         (ArrayAccess.DoResolve): Array Access can operate on
5114         non-variables. 
5115
5116 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
5117
5118         * assign.cs (CompoundAssign): A new class used as a "flag" that
5119         the assignment actually is happening as part of a compound
5120         assignment operator.
5121
5122         During compound assignment, a few new rules exist to enable things
5123         like:
5124
5125         byte b |= 1 + 2
5126
5127         From the spec:
5128         
5129         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
5130         to the type of x) if y is implicitly convertible to the type of x,
5131         and the operator is a builtin operator and the return type of the
5132         operator is explicitly convertible to the type of x. 
5133
5134         * rootcontext.cs: Reset warning level to 2.  4 catches various
5135         "interesting" features in mcs, we must clean this up at some
5136         point, but currently am trying to kill other bugs ;-)
5137
5138         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
5139         in container classes as well.  
5140
5141         * expression.cs (Binary.ResolveOperator): Handle string case
5142         before anything else (as operator overloading does emit an error
5143         before doing anything else).
5144
5145         This code could go away when we move to a table driven model, but
5146         i could not come up with a good plan last night.
5147         
5148 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
5149
5150         * typemanager.cs (CSharpName): reimplementation using regex.
5151         * class.cs: added null check for fields in Emit
5152         * rootcontext.cs: set warninglevel to 4
5153
5154 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
5155
5156         * typemanager.cs (CSharpName): reimplemented with Lupus
5157         suggestion.
5158
5159 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
5160
5161         * statement.cs (If): correclty implement Resolve, because we were
5162         not catching sem errors in there.  The same process is needed
5163         everywhere else. 
5164         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
5165         
5166
5167         (Statement.Warning_DeadCodeFound): Factorize code.
5168         (While): Report dead code here too.
5169
5170         (Statement): Added Resolve virtual method to allow
5171         for resolution split from the emit code.
5172
5173 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
5174
5175         * statement.cs (EmitBoolExpression): No longer try to resolve the
5176         expression here.    
5177         (MakeBoolean): New utility function that resolve, implicitly
5178         converts to boolean and tags the expression. 
5179         
5180
5181         (If, Do): Implement dead code elimination.
5182         (While): Implement loop inversion
5183
5184         (Do, While, For, If): Resolve the expression prior to calling our
5185         code generation.
5186
5187 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
5188
5189         * class.cs:
5190           - added method Report28 (warning: program has more than one entry point)
5191           - added method IsEntryPoint, implements paragraph 10.1 of the spec
5192           - modified method Method.Define, the part at the end of the method
5193
5194         * rootcontext.cs: added static public Location EntryPointLocation;
5195           
5196         * ../errors/cs0028.cs : Add test case for the above warning.              
5197
5198         * typemanager.cs:
5199           - modified method CSharpName to allow arrays of primitive type to
5200             be printed nicely (e.g. instead of System.Int32[][] it now prints
5201             int[][])
5202           - added method CSharpSignature: returns the signature of a method
5203             in string format to be used in reporting errors, warnings, etc.
5204
5205         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
5206         with String.Empty.
5207         
5208 2002-04-26  Ravi Pratap  <ravi@ximian.com>
5209
5210         * delegate.cs (Define): Fix extremely silly bug where I was
5211         setting the type of the 'object' parameter of the BeginInvoke
5212         method to System.IAsyncResult instead of System.Object ;-)
5213
5214 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
5215
5216         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
5217         here. 
5218
5219         (Constructor.Emit): return if we fail to initialize the
5220         constructor.  Another door closed!  
5221
5222         * expression.cs (New.DoResolve): Improve error message (from -6 to
5223         1501).  Use DeclaredOnly lookup to find the exact constructor.
5224
5225         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
5226         loop.  This is useful.
5227
5228         * cs-parser.jay: Adjust the default parameters so that destructors
5229         have the proper signature.
5230
5231 2002-04-26  Martin Baulig  <martin@gnome.org>
5232
5233         * driver.cs (LoadAssembly): If `assembly' contains any characters
5234         which are only valid in path names and not in assembly names
5235         (currently slash, backslash and point), use Assembly.LoadFrom ()
5236         instead of Assembly.Load () on the `assembly' (before iteration
5237         over the link_paths).
5238
5239 2002-04-26  Martin Baulig  <martin@gnome.org>
5240
5241         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
5242
5243 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
5244
5245         * class.cs (Property): use the new typemanager.MemberLookup
5246
5247         (TypeContainer.MemberLookup): Implement using the
5248         TypeManager.MemberLookup now. 
5249         
5250         * typemanager.cs: Make MemberLookup a function of the TypeManager,
5251         and return MemberInfos, so that these can be used without an
5252         EmitContext (what we had before).
5253
5254 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
5255
5256         * expression.cs: Fix the case where the argument to params if the
5257         type of the params.  I omitted handling this before.   Fixed
5258
5259 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
5260
5261         * driver.cs: Call BootCorlib_PopulateCoreType
5262
5263         * class.cs (Property.CheckBase): Check for properties only, not
5264         for all members. 
5265
5266         * interface.cs: Temporary hack: try/catch around the
5267         CustomAttributeBuilder, because I am getting an exception that I
5268         do not understand.
5269
5270         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
5271         types whose definitions are required to be there (attributes are
5272         defined before standard types).
5273
5274         Compute definitions as we boot the various types, as they are used
5275         immediately (value_type class will need object_type, but if we do
5276         not initialize object_type, we will pass a null, which will let
5277         the runtime pick the System.Object from the existing corlib, which
5278         is not what we want).
5279
5280 2002-04-22  Patrik Torstensson <totte@labs2.com>
5281
5282         * cs-tokenizer.cs: fixed a number of trim() issues.
5283
5284 2002-04-22  Ravi Pratap  <ravi@ximian.com>
5285
5286         * expression.cs (Argument.Type): Ensure that we return the correct
5287         type when we have out or ref parameters [in which case we 
5288         append a "&"].
5289         
5290 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
5291
5292         * class.cs (Property, Indexer): Allow extern modifier in there. 
5293
5294         * typemanager.cs (InitBaseTypes): Initializes object_type and
5295         value_type, since those will be used early on during the bootstrap
5296         process to compile corlib.
5297
5298         (InitCoreTypes): Move code from here to InitBaseTypes.
5299
5300 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
5301
5302         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
5303         single-dimension arrays as using the ldlen opcode.  
5304
5305         Daniel Lewis discovered this optimization.  
5306
5307         * typemanager.cs: Add signature for System.Array::get_Length
5308
5309 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5310
5311         * statement.cs: report the error when the foreach does not apply to an
5312         array nor a collection.
5313
5314 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
5315
5316         * expression.cs: Add implicit conversions to the operator ~.
5317
5318         * constant.cs (DecimalConstant.Emit): Emit decimal value.
5319
5320         * typemanager.cs: Locate the decimal constructor.
5321
5322 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5323
5324         * attribute.cs: use the new property of TypeOf.
5325         * expression.cs: added 'get' property around typearg.
5326
5327         These changes fix a build breaker reported by NickD. Is this the
5328         correct way to fix?  If not, please, revert my changes and make it
5329         work :-).
5330
5331 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
5332
5333         * attribute.cs: Add support for typeof in attribute invocations.
5334         I am not sure that this is right though.
5335
5336 2002-04-14  Duncan Mak  <duncan@ximian.com>
5337
5338         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
5339         Binary.Operator.Division case.
5340
5341 2002-04-13  Ravi Pratap  <ravi@ximian.com>
5342
5343         * class.cs (DefineType): Ensure that we do a proper check on
5344         attribute types and also register it with the TypeManager.
5345
5346         (TypeContainer.Targets): The default for attribute types is
5347         AttributeTargets.All.
5348         
5349         * attribute.cs (ApplyAttributes): Registering the attribute type
5350         is done elsewhere, not when we discover we have a Usage attribute.
5351
5352 2002-04-12  Ravi Pratap  <ravi@ximian.com>
5353
5354         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
5355         and get rid of is_delegate parameter.
5356
5357         * everywhere : update.
5358         
5359 2002-04-12  Ravi Pratap  <ravi@ximian.com>
5360
5361         * cs-parser.jay (compilation_unit): Revamp completely to use
5362         some new ideas that I got from Rhys' grammar to solve the problems
5363         with assembly level attributes.
5364
5365         (outer_declaration): New grammar production.
5366
5367         (attribute_sections): Add.
5368
5369         (opt_attributes): Base on attribute_sections
5370
5371         (namespace_declaration): Allow opt_attributes to tackle the case
5372         when we have assembly level attributes - we are clever in this
5373         regard now ;-)
5374
5375         * attribute.cs (ApplyAttributes): Do not worry about assembly 
5376         attributes in the non-global context.
5377
5378         * rootcontext.cs (AddGlobalAttributes): Go back to using this
5379         instead of SetGlobalAttributes.
5380
5381         * class.cs, rootcontext.cs : Ensure we define and generate 
5382         attribute types before anything else.
5383
5384         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
5385         and flag the new error -20 for the case when the attribute type
5386         does not have valid targets specified. csc does not catch this.
5387
5388         * ../errors/errors.txt : update for error # -20
5389
5390 2002-04-11  Ravi Pratap  <ravi@ximian.com>
5391
5392         * support.cs (InternalParameters.ParameterModifier): Do some null
5393         checking and return sane values.
5394
5395         * class.cs (Method.Define): If we are a PInvoke method, ensure
5396         that we are static and extern. Report error # 601
5397
5398         * ../errors/cs0601.cs : Add test case for the above error.
5399
5400 2002-04-07  Ravi Pratap  <ravi@ximian.com>
5401
5402         * rootcontext.cs (attribute_types): We need to keep type of
5403         all attribute types separately and emit code for them first.
5404
5405         (RegisterAttribute) : Implement.
5406
5407         * class.cs (DefineType): Check if the current Type is a custom
5408         attribute type and register it accordingly.
5409
5410         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
5411         adding the first attribute twice and rename to
5412
5413         (SetGlobalAttributes): this.
5414
5415         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
5416         lookups.
5417
5418         * attribute.cs (ApplyAttributes): Take an additional argument telling us
5419         if we are processing global arguments. Hmm, I am unsure of this.
5420
5421 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5422
5423         * expression.cs: added static array of strings to avoid calling
5424         Enum.ToString () for Operator in Binary. Significant recover of
5425         performance.
5426
5427 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
5428
5429         * class.cs (FindMembers): Allow the Builders of the various
5430         members to be null.  If they are skip them.  This only happens
5431         during the PInvoke declaration.
5432
5433 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
5434
5435         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
5436         failure, so we do not keep going afterwards.
5437
5438         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
5439         wanted to pass `false' as the `is_delegate' argument.  If this is
5440         the case, why not use delegate_type == null to mean `is_delegate =
5441         false' and anything else as is_delegate = true.
5442
5443 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
5444
5445         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
5446         code for the section, not the beginning of the tests.
5447
5448 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
5449
5450         * cfold.cs: Handle operator + (Enum x, Underlying x) 
5451
5452         * expression.cs (Binary): same.  Warn about errors where we have
5453         Enum/Enum in operator + as well.
5454
5455 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
5456
5457         * statement.cs:
5458                 - added support for switch(bool)
5459                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
5460                 - add TableSwitchEmit() to handle table-based switch statements
5461
5462 2002-04-05  Ravi Pratap  <ravi@ximian.com>
5463
5464         * expression.cs (Invocation.OverloadResolve): Factor out code which
5465         does parameter compatibility checking with arguments so that we can 
5466         re-use the code even from Delegate.VerifyApplicability
5467
5468         (VerifyArgumentsCompat): Move above code here.
5469
5470         * delegate.cs (VerifyApplicability): Get rid of duplicate code
5471         and instead make a call to the above method.
5472
5473 2002-03-31  Ravi Pratap  <ravi@ximian.com>
5474
5475         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
5476         We use it to keep track of classes which are attribute types.
5477
5478 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
5479
5480         * delegate.cs (Delegate.Define): Correctly define the types in the
5481         presence of fixed and array parameters.
5482
5483         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
5484         doing FindMembers.
5485
5486         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
5487         include NonPublic after the first iteration.
5488
5489         * class.cs (Indexer.CheckBase): Only check if both parents are
5490         non-null. 
5491         
5492         * cs-parser.jay (accessor_body): If empty, set to null.
5493
5494         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
5495         same code path here to resolve constants names that we did have in
5496         MemberAccess.DoResolve.  There is too much code duplicated here.
5497
5498 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
5499
5500         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
5501
5502         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
5503         to MakeUnionSet.
5504
5505         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
5506         tokens, numbers and strings.
5507
5508         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
5509         parenthesis.
5510
5511         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
5512         asyncronous parameters and the regular parameters.  
5513
5514         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
5515         specify the target directory.
5516
5517         * expression.cs: (This.DoResolve): Simplify
5518         (As.Emit): Optimize, do not generate IsInst if the expression is
5519         always of the given type.
5520
5521         (Is.DoResolve): Bug fix, we were reporting both always/never for
5522         the is expression.
5523
5524         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
5525         creating too many unnecessary arrays.
5526
5527 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
5528
5529         * class.cs (EmitFieldInitializer): Use Assign expression to assign
5530         fields instead of rolling our own initializer.   Takes care of all
5531         implicit conversions, and drops unnecessary static checks/argument.
5532
5533 2002-03-31  Dick Porter  <dick@ximian.com>
5534
5535         * driver.cs: use the GetDirectories() return values properly, and
5536         use "/" as path separator.
5537
5538 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
5539
5540         * expression.cs (Unary): Optimize - - expr into expr.
5541         (Binary): Optimize a + (-b) into a -b.
5542
5543         * codegen.cs (CodeGen): Made all methods static.
5544
5545 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
5546
5547         * rootcontext.cs: 
5548
5549         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
5550         TypeBuilder property.
5551
5552         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
5553         instead. 
5554
5555         * tree.cs: Removed the various RecordXXXX, and replaced with a
5556         single RecordDecl.  Removed all the accessor methods, and just
5557         left a single access point Type 
5558
5559         * enum.cs: Rename DefineEnum to DefineType.
5560
5561         * decl.cs: New abstract method `DefineType' used to unify the
5562         Defines for Enumerations, Interfaces, TypeContainers and
5563         Delegates.
5564
5565         (FindType): Moved LookupInterfaceOrClass here.  Moved the
5566         LookupBaseClasses method that used to live in class.cs and
5567         interface.cs here, and renamed to FindType.
5568         
5569         * delegate.cs: Implement DefineType.  Take advantage of the
5570         refactored pattern for locating the parent builder without taking
5571         the parent_builder argument (which we know does not work if we are
5572         nested, and triggering a toplevel definition).
5573
5574 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
5575
5576         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
5577         accessibility of a member has changed during override and report
5578         an error if so.
5579
5580         * class.cs (Method.Define, Property.Define): Only complain on
5581         overrides if the method is private, any other accessibility is
5582         fine (and since we just checked the permission is the same, we are
5583         good to go).
5584
5585         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
5586         and elif are processed always.  The other pre-processing
5587         directives are only processed if we are "taking" the path
5588
5589 2002-03-29  Martin Baulig  <martin@gnome.org>
5590
5591         * class.cs (Method.Emit): Only emit symbolic debugging info if the
5592         current location is not Null.
5593
5594         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
5595         a separate method so we can profile it.
5596
5597         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
5598         `span.Seconds' are just seconds, but no minutes or hours.
5599         (MainDriver): Profile the CodeGen.SaveSymbols calls.
5600
5601 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
5602
5603         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
5604         Remove the gratuitous set of Final:
5605
5606                                 // If an interface implementation, then we can set Final.
5607                                 if (((flags & MethodAttributes.Abstract) == 0) &&
5608                                     implementing.DeclaringType.IsInterface)
5609                                         flags |= MethodAttributes.Final;
5610
5611         I do not know what I was smoking when I used that.
5612         
5613
5614         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
5615         step into fixing the name resolution issues for delegates and
5616         unifying the toplevel name resolution.
5617
5618 2002-03-28  Martin Baulig  <martin@gnome.org>
5619
5620         * class.cs (Method.Emit): If we have a symbol writer, call its
5621         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
5622         tell it about the current method.
5623
5624         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
5625         writer that we're going to emit the first byte of IL code for a new
5626         statement (a new source line).
5627         (EmitContext.EmitTopBlock): If we have a symbol writer, call
5628         EmitContext.Mark() before emitting any code.
5629
5630         * location.cs (SymbolDocument): Return null when we're Null.
5631
5632         * statement.cs (Statement): Moved the `Location loc' variable here.
5633         (Statement.EmitBoolExpression): If we have a symbol writer, call
5634         ec.Mark() before emitting any code to tell it that we're at the
5635         beginning of a new statement.
5636         (StatementExpression): Added `Location' argument to the constructor.
5637         (Block): Added public readonly variable `StartLocation' and public
5638         variable `EndLocation'.  The latter is to be set using SetEndLocation().
5639         (Block): Added constructor which takes a start and end location.
5640         (Block.SetEndLocation): New method. This sets the end location.
5641         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
5642         local variables we create.
5643         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
5644         each statement and do also mark the begin and end of the block.
5645
5646         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
5647         tell it the current lexer.Location, use Location.Null for the end of the
5648         block.
5649         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
5650         current block, set its end location using SetEndLocation().
5651         (statement_expression): StatementExpression constructor now takes the
5652         lexer.Location as additional argument.
5653         (for_statement, declare_local_variables): Likewise.
5654         (declare_local_variables): When creating a new implicit block, use the
5655         new Block constructor and pass it the lexer.Location.
5656
5657 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
5658
5659         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
5660         members also on the parent interfaces recursively.
5661
5662 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
5663
5664         * report.cs: Use new formats, since Gonzalo finished the missing
5665         bits. 
5666
5667         * expression.cs (Binary.ResolveOperator): added missing operator|
5668         operator& and operator^ for bool/bool.
5669
5670         * cs-parser.jay: CheckDef now takes a Location argument that is
5671         used to report errors more precisly (instead of reporting the end
5672         of a definition, we try to track something which is a lot closer
5673         to the source of the problem).
5674
5675         * cs-tokenizer.cs: Track global token use, so we can properly flag
5676         the use of #define/#undef after the first token has been seen.
5677
5678         Also, rename the reportXXXX to Error_DescriptiveName
5679
5680         * decl.cs (DeclSpace.IsTopLevel): Move property here from
5681         TypeContainer, so that Enum and Interface can use this too.
5682
5683         * class.cs (TypeContainer.LookupInterfaceOrClass,
5684         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
5685         `builder' argument.  Typically this was used to pass the parent
5686         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
5687         the definition).  
5688
5689         The problem is that a nested class could trigger the definition of
5690         a toplevel class, and the builder would be obviously wrong in that
5691         case. 
5692
5693         So we drop this argument, and we compute dynamically the
5694         TypeBuilder/ModuleBuilder (the correct information was available
5695         to us anyways from DeclSpace.Parent)
5696
5697         * interface.cs (Interface.DefineInterface): Drop builder
5698         parameter cleanup like class.cs
5699
5700         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
5701         like class.cs
5702
5703         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
5704         values. 
5705
5706         (Try.Emit): Propagate the returns value from the statement.
5707
5708         (Return.Emit): Even if we are leavning 
5709
5710         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
5711
5712         * modifiers.cs: Fix the computation of MethodAttributes flags.
5713
5714 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
5715
5716         * driver.cs: allow compilation of files that start with '/'.
5717         Add a default case when checking the argument of --target.
5718
5719 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
5720
5721         * interface.cs: Implement the same search algorithm for types in
5722         the interface code.
5723
5724         * delegate.cs: Do not allow multiple definition.
5725
5726         * Recovered ChangeLog that got accidentally amputated
5727
5728         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
5729
5730         * rootcontext.cs: Load manually enum to allow core classes to
5731         contain enumerations.
5732
5733         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
5734         Update to new static methods in TypeManager.
5735
5736         * typemanager.cs (GetMethod, GetConstructor): Use our
5737         implementation of FindMembers to find the members, since during
5738         corlib compilation, the types are TypeBuilders and GetMethod and
5739         GetConstructor do not work.
5740
5741         Make all methods in TypeManager static.
5742
5743         (InitCodeHelpers): Split the functionality from
5744         the InitCodeTypes function.
5745
5746         * driver.cs: Call InitCodeHelpers after we have populated the
5747         types. 
5748
5749         * cs-parser.jay (delegate_declaration): we did not used to compute
5750         the delegate name correctly for void delegates.
5751
5752 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
5753
5754         * rootcontext.cs (RootContext): Init the interface_resolve_order
5755         and type_container_resolve_order always.
5756
5757         (ResolveCore, BootstrapCorlib_ResolveClass,
5758         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
5759         compiler when compiling with --nostdlib
5760
5761         * class.cs (TypeContainer.DefineType): Check that our parent is
5762         not null.  This test is most important when we are bootstraping
5763         the core types.
5764
5765         * codegen.cs: Split out the symbol writing code.
5766
5767 2002-03-25  Martin Baulig  <martin@gnome.org>
5768
5769         * driver.cs (-g): Made -g an alias for --debug.
5770
5771 2002-03-24  Martin Baulig  <martin@gnome.org>
5772
5773         * codegen.cs (SymbolWriter): New public variable. Returns the
5774         current symbol writer.
5775         (CodeGen): Added `bool want_debugging_support' argument to the
5776          constructor. If true, tell the ModuleBuild that we want debugging
5777         support and ask it for the ISymbolWriter.
5778         (Save): If we have a symbol writer, call it's Close() method after
5779         saving the assembly.
5780
5781         * driver.c (--debug): New command line argument to create a
5782         debugger information file.
5783
5784         * location.cs (SymbolDocument): New public property. Returns an
5785         ISymbolDocumentWriter object for the current source file or null
5786         if we don't have a symbol writer.
5787
5788 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
5789
5790         * driver.cs (LoadAssembly): Correctly return when all the paths
5791         have been tried and not before.
5792
5793         * statement.cs (Switch.Emit): return the actual coverage for this
5794         statement (returns/not-returns)
5795
5796         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
5797         switch of the statement if we are the last switch section.  That
5798         kills two problems: try/catch problems (we used to emit an empty
5799         nop at the end) and switch statements where all branches would
5800         return. 
5801
5802 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
5803
5804         * driver.cs: Add default assemblies (the equivalent to the
5805         Microsoft CSC.RSP file)
5806
5807         * cs-tokenizer.cs: When updating `cols and setting it to zero,
5808         also update tokens_seen and set it to false.
5809
5810         * driver.cs: Implement --recurse for Mike.
5811
5812         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
5813         correctly splitting out the paths.
5814
5815 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
5816
5817         * interface.cs (Interface.PopulateProperty): Instead of using
5818         `parent' as the declaration space for the set parameters, use
5819         `this' 
5820
5821         * support.cs (InternalParameters): InternalParameters constructor
5822         takes a DeclSpace instead of a TypeContainer.
5823
5824         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
5825         types are being initialized, load the address of it before calling
5826         the function.  
5827
5828         (New): Provide a mechanism to disable the generation of local
5829         value type temporaries when the caller will be providing us with
5830         an address to store it.
5831
5832         (ArrayCreation.EmitDynamicInitializers): Use it.
5833
5834 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
5835
5836         * expression.cs (Invocation.EmitArguments): Only probe for array
5837         property if there is more than one argument.  Sorry about that.
5838
5839         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
5840         empty param arrays.
5841         
5842         * class.cs (Method.LabelParameters): Fix incorrect code path that
5843         prevented the `ParamArrayAttribute' from being applied to the
5844         params attribute.
5845
5846 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
5847
5848         * support.cs (ReflectionParameters): Correctly compute whether the
5849         last argument is a params array.  Fixes the problem with
5850         string.Split ('a')
5851
5852         * typemanager.cs: Make the assemblies array always be non-null
5853         (empty, but non-null)
5854
5855         * tree.cs (RecordDecl): New function that abstracts the recording
5856         of names.  This reports error 101, and provides a pointer to the
5857         previous declaration.  Fixes a crash in the compiler.
5858
5859         * cs-parser.jay (constructor_declaration): Update to new grammar,
5860         and provide a constructor_body that can be empty.
5861
5862 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
5863
5864         * driver.cs: Add support for --resources.
5865
5866         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
5867         Make all types for the various array helper methods be integer.
5868
5869         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
5870         CheckState to ConvCast.
5871
5872         (ConvCast): Now it takes a `checked' state argument, to avoid
5873         depending on the emit context for the conversion, and just using
5874         the resolve time setting.
5875
5876         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
5877         instead of Invocation.EmitArguments.  We do not emit the original
5878         arguments, instead we emit those which have been converted to
5879         unsigned int expressions.
5880
5881         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
5882
5883         * codegen.cs: ditto.
5884
5885         * expression.cs (LocalVariableReference): Drop the use of the
5886         Store function that depended on the variable index.
5887
5888         * statement.cs (VariableInfo): Drop the `Idx' property from this
5889         class, as this is not taking into account the indexes for
5890         temporaries tat we generate during the execution, getting the
5891         indexes wrong.
5892
5893         * class.cs: First emit class initializers, then call the parent
5894         constructor. 
5895
5896         * expression.cs (Binary): Fix opcode emision.
5897         (UnaryMutator.EmitCode): Support checked code generation
5898
5899         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
5900         matches for events for both the Static and Instance scans,
5901         pointing to the same element.   Fix that.
5902
5903 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
5904
5905         * rootcontext.cs (ResolveTree): Always set the
5906         interface_resolve_order, because nested interfaces will be calling
5907         into us.
5908
5909         * class.cs (GetInterfaceOrClass): Track the same resolution
5910         process used by TypeManager.LookupType.  This fixes the nested
5911         type lookups in class declarations (separate path from
5912         LookupType). 
5913
5914         (TypeContainer.DefineType): Also define nested interfaces.
5915         (TypeContainer.RegisterOrder): New public function used to
5916         register the order in which child interfaces need to be closed.
5917
5918         Nested interfaces need to be closed after their parents have been
5919         created. 
5920         
5921         * interface.cs (InterfaceAttr): Put all the logic for computing
5922         the interface attribute here. 
5923
5924         (DefineInterface): Register our interface order with the
5925         RootContext or with the TypeContainer depending on the case.
5926
5927 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
5928
5929         * cs-parser.jay: rework foreach statement to work with the new
5930         changes to the policy on SimpleNames.
5931         
5932         * report.cs: support Stacktrace on warnings as well.
5933
5934         * makefile: drop --unsafe and /unsafe from the compile.
5935
5936 2002-03-13  Ravi Pratap  <ravi@ximian.com>
5937
5938         * ecore.cs (StandardConversionExists): Modify to take an Expression
5939         as the first parameter. Ensure we do null -> reference type conversion
5940         checking.
5941
5942         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
5943         temporary Expression objects.
5944
5945 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
5946
5947         * interface.cs: workaround bug in method overloading resolution
5948         (there is already a bugzilla bug for it).
5949
5950 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
5951
5952         We could also solve this problem by having a separate path for
5953         performing type lookups, instead of DoResolve, we could have a
5954         ResolveType entry point, and only participating pieces of the
5955         production (simplename, deref, array) would implement this. 
5956         
5957         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
5958         signal SimpleName to only resolve type names and not attempt to
5959         resolve anything else.
5960
5961         * expression.cs (Cast): Set the flag.
5962
5963         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
5964
5965         * class.cs: Only report 108 if there is no `new' modifier.
5966
5967         * cs-parser.jay: rework foreach statement to work with the new
5968         changes to the policy on SimpleNames.
5969         
5970         * report.cs: support Stacktrace on warnings as well.
5971
5972         * makefile: drop --unsafe and /unsafe from the compile.
5973
5974 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
5975
5976         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5977         lookups here, instead of doing that at parse time.  This means
5978         that our grammar will not introduce `LocalVariableReferences' as
5979         expressions at this point.  That solves the problem of code like
5980         this:
5981
5982         class X {
5983            static void Main ()
5984            { int X = 1;
5985             { X x = null }}}
5986
5987         This is only half the fix.  The full fix requires parameters to
5988         also be handled in this way.
5989
5990         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
5991         makes the use more obvious of the DeclSpace.  The
5992         ec.TypeContainer.TypeBuilder is now only used to pull the
5993         TypeBuilder for it.
5994
5995         My theory is that I can get rid of the TypeBuilder completely from
5996         the EmitContext, and have typecasts where it is used (from
5997         DeclSpace to where it matters).  
5998
5999         The only pending problem is that the code that implements Aliases
6000         is on TypeContainer, and probably should go in DeclSpace.
6001
6002         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6003         lookups here, instead of doing that at parse time.  This means
6004         that our grammar will not introduce `LocalVariableReferences' as
6005         expressions at this point.  That solves the problem of code like
6006         this:
6007
6008         class X {
6009            static void Main ()
6010            { int X = 1;
6011             { X x = null }}}
6012
6013         This is only half the fix.  The full fix requires parameters to
6014         also be handled in this way.
6015
6016         * class.cs (Property.DefineMethod): When implementing an interface
6017         method, set newslot, when implementing an abstract method, do not
6018         set the flag (before we tried never setting it, or always setting
6019         it, which is the difference).
6020         (Indexer.DefineMethod): same.
6021         (Method.DefineMethod): same.
6022
6023         * ecore.cs: Only set the status used flag if we get back a Field.
6024
6025         * attribute.cs: Temporary hack, so Paolo can keep working.
6026
6027 2002-03-08  Ravi Pratap  <ravi@ximian.com>
6028
6029         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
6030         the unmanaged type in the case we have a MarshalAs attribute.
6031
6032         (Resolve): Handle the case when we are parsing the special MarshalAs
6033         attribute [we need to store the unmanaged type to use later]
6034         
6035         * typemanager.cs (marshal_as_attr_type): Built in type for the 
6036         MarshalAs Attribute.
6037
6038         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
6039         on parameters and accordingly set the marshalling info.
6040         
6041 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
6042
6043         * class.cs: Optimizing slightly by removing redundant code after
6044         we switched to the `NoTypes' return value.
6045         (Property.DefineMethod): use NoTypes here too.
6046
6047         This fixes the bug I introduced in my last batch of changes.
6048
6049 2002-03-05  Ravi Pratap  <ravi@ximian.com>
6050
6051         * tree.cs (RecordEnum): Add. We now keep track of enums too.
6052
6053         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
6054         Enums since those are types too. 
6055
6056         * cs-parser.jay (enum_declaration): Record enums as we parse them.
6057         
6058         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
6059         thanks to a call during the lookup process.
6060
6061 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
6062
6063         * statement.cs (Foreach): Lots of work to accomodate a particular
6064         kind of foreach statement that I had not kept in mind.  It is
6065         possible to have foreachs on classes that provide a GetEnumerator
6066         method that return objects that implement the "pattern" for using
6067         a foreach, there is no need to support GetEnumerator
6068         specifically. 
6069
6070         This is needed to compile nant.
6071
6072         * decl.cs: Only report 114 if the member is not `Finalize' and if
6073         the warning level is at least 2.
6074
6075         * class.cs: Moved the compare function from Method to
6076         MethodSignature. 
6077
6078         (MethodSignature.InheritableMemberSignatureCompare): Add new
6079         filter function that is used to extract inheritable methods from a
6080         class. 
6081
6082         (Method.Define): Use the new `inheritable_method_signature_filter'
6083         delegate
6084
6085         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
6086         command. 
6087
6088 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
6089
6090         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
6091
6092         * cs-parser.jay: Add opt_semicolon to the interface declaration.
6093
6094         * expression.cs: Pass location information to
6095         ConvertImplicitStandard. 
6096
6097         * class.cs: Added debugging code to track return values from
6098         interfaces. 
6099
6100 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
6101
6102         * expression.cs (Is.DoResolve): If either side of the `is' is an
6103         interface, do not flag the warning.
6104
6105         * ecore.cs (ImplicitReferenceConversion): We need a separate test
6106         for interfaces
6107
6108         * report.cs: Allow for --fatal to be used with --probe.
6109         
6110         * typemanager.cs (NoTypes): Move the definition for the empty Type
6111         array here. 
6112
6113         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
6114         properties. 
6115         (TypeContainer.DefineProxy): New function used to proxy to parent
6116         implementations when implementing interfaces.
6117         (TypeContainer.ParentImplements): used to lookup if our parent
6118         implements a public function that is required by an interface.
6119         (TypeContainer.VerifyPendingMethods): Hook this up.
6120
6121         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
6122         `modules' and `assemblies' arraylists into arrays.  We only grow
6123         these are the very early start up of the program, so this improves
6124         the speedof LookupType (nicely measured).
6125
6126         * expression.cs (MakeByteBlob): Replaced unsafe code with
6127         BitConverter, as suggested by Paolo.
6128
6129         * cfold.cs (ConstantFold.Binary): Special case: perform constant
6130         folding of string concatenation, but if either side is a string,
6131         and the other is not, then return null, and let the runtime use
6132         the concatenation on the string plus the object (using
6133         `Object.ToString'). 
6134
6135 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
6136
6137         Constant Folding has been implemented now.
6138         
6139         * expression.cs (Unary.Reduce): Do not throw an exception, catch
6140         the error instead on types that are not supported in one's
6141         complement. 
6142
6143         * constant.cs (Constant and all children): New set of functions to
6144         perform implict and explicit conversions.
6145         
6146         * ecore.cs (EnumConstant): Implement the new functions to perform
6147         conversion by proxying to the child expression.
6148
6149         * codegen.cs: (ConstantCheckState): Constant evaluation has its
6150         own separate setting that can not be turned off from the command
6151         line using --unchecked or --checked and is only controlled using
6152         the checked/unchecked statements and expressions.  This setting is
6153         used by the constant folder to flag errors.
6154
6155         * expression.cs (CheckedExpr, UncheckedExpr): Set the
6156         ConstantCheckState as well.   
6157
6158         During Resolve, they also have to flag the state, because the
6159         constant folder runs completely in the Resolve phase.
6160
6161         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
6162         well.
6163
6164 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
6165
6166         * cfold.cs: New file, this file contains the constant folder.
6167         
6168         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
6169         argument to track whether we are using the resulting address to
6170         load or store a value and provide better error messages. 
6171
6172         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
6173         new AddressOf arguments.
6174
6175         * statement.cs (Foreach.EmitCollectionForeach): Update
6176
6177         * expression.cs (Argument.Emit): Call AddressOf with proper
6178         arguments to track usage.
6179
6180         (New.DoEmit): Call AddressOf with new arguments.
6181
6182         (Unary.Emit): Adjust AddressOf call.
6183
6184 2002-03-01  Ravi Pratap  <ravi@ximian.com>
6185
6186         * cs-parser.jay (member_access): Change the case for pre-defined types
6187         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
6188         this suggestion.
6189
6190         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
6191         a method body.
6192
6193         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
6194         essentially like methods and apply attributes like MethodImplOptions to them too.
6195
6196         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
6197         not being null.
6198
6199         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
6200         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
6201         is the DeclSpace.
6202
6203         * Update code everywhere accordingly.
6204
6205         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
6206
6207         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
6208
6209 2002-02-28  Ravi Pratap  <ravi@ximian.com>
6210
6211         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
6212         try performing lookups against those instead of jumping straight into using
6213         the 'using' clauses.
6214
6215         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
6216
6217         (LookupType): Perform lookups in implicit parents too.
6218
6219         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
6220         sequence as RootContext.LookupType. 
6221
6222         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
6223         the various cases of namespace lookups into this method.
6224
6225 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
6226
6227         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
6228         in positional arguments)
6229
6230         * class.cs (Operator): Update the AllowedModifiers to contain
6231         extern. 
6232
6233         * cs-parser.jay: Update operator declaration to allow for the
6234         operator body to be empty.
6235
6236         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
6237         values. 
6238
6239 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
6240
6241         * class.cs (Method.Emit): Label parameters.
6242
6243         * driver.cs: Return 1 or 0 as the program exit code.
6244
6245 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
6246
6247         * expression.cs: Special case the `null' object when trying to
6248         auto-compute the type, as anything can be explicitly converted to
6249         that. 
6250
6251         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
6252         spotting this Paolo.
6253
6254         (Expression.ImplicitNumericConversion): Perform comparissions of
6255         the type using the underlying type in the case of an enumeration
6256         rather than using the enumeration type for the compare.
6257
6258         Cope with the underlying == type case, which is not possible to
6259         catch before. 
6260
6261         (Expression.ConvertNumericExplicit): Perform comparissions of
6262         the type using the underlying type in the case of an enumeration
6263         rather than using the enumeration type for the compare.
6264
6265         * driver.cs: If the user does not supply an extension, assume .exe
6266
6267         * cs-parser.jay (if_statement): Rewrote so that we can track the
6268         location for the if statement.
6269
6270         * expression.cs (Binary.ConstantFold): Only concat strings when
6271         the operation is "+", not everything ;-)
6272
6273         * statement.cs (Statement.EmitBoolExpression): Take a location
6274         argument. 
6275         (If, While, Do): Track location.
6276
6277         * expression.cs (Binary.ResolveOperator): In the object + string
6278         case, I was missing a call to ConvertImplicit
6279
6280 2002-02-25  Ravi Pratap  <ravi@ximian.com>
6281
6282         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
6283         Location arguments. Ensure we use RootContext.LookupType to do our work
6284         and not try to do a direct Type.GetType and ModuleBuilder.GetType
6285
6286         * interface.cs (PopulateMethod): Handle the type of the parameter being
6287         null gracefully.
6288
6289         * expression.cs (Invocation.BetterFunction): Handle the case when we 
6290         have a params method with no fixed arguments and a call is made with no
6291         arguments.
6292
6293 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
6294
6295         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
6296         the verbatim-string-literal
6297
6298         * support.cs (InternalParameters.ParameterModifier): handle null
6299         fixed parameters.
6300         (InternalParameters.ParameterType): ditto.
6301
6302         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
6303         duplicating the name of the variable parameter.
6304         (GetParameterByName): Fix bug where we were not looking up array
6305         paramters if they were the only present (thanks Paolo!).
6306         (GetParameterInfo): We only have an empty set of types if both
6307         fixed and array are set to null.
6308         (GetParameterInfo-idx): Handle FixedParameter == null
6309
6310         * cs-parser.jay: Handle the case where there is no catch
6311         statements (missing null test).
6312
6313 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
6314
6315         * driver.cs (MainDriver): Be conservative on our command line
6316         handling.
6317
6318         Catch DirectoryNotFoundException when calling GetFiles.
6319         
6320         (SplitPathAndPattern): Used to split the input specification into
6321         a path and a pattern that we can feed to Directory.GetFiles.
6322
6323 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
6324
6325         * statement.cs (Fixed): Implement the last case of the Fixed
6326         statement (string handling).
6327
6328         * expression.cs (StringPtr): New class used to return a char * to
6329         a string;  Used by the Fixed statement.
6330
6331         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
6332
6333         * expression.cs (Binary.ResolveOperator): Remove redundant
6334         MemberLookup pn parent type.
6335         Optimize union call, we do not need a union if the types are the same.
6336         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
6337         type.
6338
6339         Specialize the use of MemberLookup everywhere, instead of using
6340         the default settings. 
6341
6342         (StackAlloc): Implement stackalloc keyword.
6343
6344         * cs-parser.jay: Add rule to parse stackalloc.
6345         
6346         * driver.cs: Handle /h, /help, /?
6347
6348         * expression.cs (MakeByteBlob): Removed the hacks we had in place
6349         before we supported unsafe code.
6350         
6351         * makefile: add --unsafe to the self compilation of mcs.
6352
6353 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
6354
6355         * expression.cs (PointerArithmetic): New class that is used to
6356         perform pointer arithmetic.
6357         (Binary.Resolve): Handle pointer arithmetic
6358         Handle pointer comparission.
6359         (ArrayPtr): Utility expression class that is used to take the
6360         address of an array.
6361
6362         (ElementAccess): Implement array access for pointers
6363         
6364         * statement.cs (Fixed): Implement fixed statement for arrays, we
6365         are missing one more case before we are done.
6366
6367         * expression.cs (Indirection): Implement EmitAssign and set the
6368         ExprClass to Variable.  This allows pointer dereferences to be
6369         treated as variables, and to have values assigned to them.
6370         
6371         * ecore.cs (Expression.StoreFromPtr): New utility function to
6372         store values dereferencing.
6373
6374 2002-02-20  Ravi Pratap  <ravi@ximian.com>
6375
6376         * expression.cs (Binary.ResolveOperator): Ensure that we are
6377         not trying to operate on a void type - this fixes the reported
6378         bug.
6379
6380         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
6381         the parent implementation is sealed.
6382
6383         * ../errors/cs0239.cs : Add.
6384
6385         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
6386
6387         * typemanager.cs (unverifiable_code_type): Corresponds to 
6388         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
6389         which have unsafe code in them.
6390
6391         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
6392         unsafe context.
6393
6394 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
6395
6396         * cs-tokenizer.cs: Add support for @"litreal strings"
6397
6398         Make tokenizer accept pre-processor directives
6399         on any column (remove the old C-like limitation). 
6400
6401         * rootcontext.cs (EmitCode): Emit any global attributes.
6402         (AddGlobalAttributes): Used to keep track of assembly attributes. 
6403
6404         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
6405
6406         * cs-parser.jay: Add support for global attributes.  
6407
6408 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
6409
6410         * expression.cs (Indirection): New helper class.  Unary will
6411         create Indirection classes to be able to implement the
6412         IMemoryLocation interface on it.
6413
6414 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
6415
6416         * cs-parser.jay (fixed_statement): reference the right statement.
6417
6418         * statement.cs (Fixed.Emit): Finish implementing the fixed
6419         statement for the &x case.
6420
6421 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
6422
6423         * class.cs (Property.Define, Method.Define): Remove newslot when
6424         `implementing'.  
6425
6426         * modifiers.cs: My use of NewSlot when `Abstract' was set was
6427         wrong.  NewSlot should only be used if the `new' keyword is present.
6428
6429         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
6430         locating our system dir.  Sorry about this.
6431
6432 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
6433
6434         * driver.cs (GetSystemDir): Compute correctly the location of our
6435         system assemblies.  I was using the compiler directory instead of
6436         the library directory.
6437
6438 2002-02-13  Ravi Pratap  <ravi@ximian.com>
6439
6440         * expression.cs (BetterFunction): Put back in what Miguel commented out
6441         since it is the correct fix. The problem is elsewhere ;-)
6442
6443         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
6444         parameters of the parms method are themselves compatible or not !
6445
6446         (StandardConversionExists): Fix very dangerous bug where we were forgetting
6447         to check that a class implements an interface before saying that an implicit
6448         conversion was allowed. Use ImplementsInterface to do the checking.
6449
6450 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
6451
6452         * class.cs (Method.Define): Track whether we are an explicit
6453         implementation or not.  And only call DefineMethodOverride if we
6454         are an explicit implementation.
6455
6456         (Property.DefineMethod): Ditto.
6457
6458 2002-02-11  Ravi Pratap  <ravi@ximian.com>
6459
6460         * expression.cs (BetterFunction): Catch hideous bug which was
6461          preventing us from detecting ambiguous calls due to implicit casts i.e
6462         cs0121.
6463
6464 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
6465
6466         * support.cs (Pair): Remove un-needed method.  I figured why I was
6467         getting the error in cs-parser.jay, the variable in a foreach loop
6468         is readonly, and the compiler does not really treat this as a variable.
6469
6470         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
6471         instead of EQUALS in grammar.  
6472
6473         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
6474
6475         * expression.cs (Unary.DoResolve): Check whether the argument is
6476         managed or not.
6477
6478 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
6479
6480         * support.cs: Api for Pair to set a value.  Despite the fact that
6481         the variables are public the MS C# compiler refuses to compile
6482         code that accesses the field if the variable is part of a foreach
6483         statement. 
6484
6485         * statement.cs (Fixed): Begin implementation of the fixed
6486         statement.
6487
6488         (Block.AddVariable): Return the VariableInfo on success and null
6489         on failure instead of true/false. 
6490
6491         * cs-parser.jay (foreach): Catch errors on variables already
6492         defined (we were ignoring this value before) and properly unwind
6493         the block hierarchy
6494
6495         (fixed_statement): grammar for the fixed statement.
6496
6497 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
6498
6499         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
6500         pointer types to be incretemented.
6501
6502         (SizeOf): Implement.
6503
6504         * cs-parser.jay (pointer_member_access): Implement
6505         expr->IDENTIFIER production.
6506
6507         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
6508         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
6509         on safe contexts.
6510
6511         (Unary): Implement indirection.
6512
6513         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
6514         use in non-unsafe context).
6515
6516         (SimpleName.DoResolve): Check for pointers in field access on safe
6517         contexts. 
6518
6519         (Expression.LoadFromPtr): Factor the load-indirect code in this
6520         function.  This was duplicated in UnboxCast and ParameterReference
6521
6522 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
6523
6524         * expression.cs (ComposedCast): report an error if a pointer cast
6525         is used in a safe region.
6526
6527         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
6528         pointer type casts in unsafe context.
6529
6530         * codegen.cs (EmitContext): Set up IsUnsafe.
6531
6532         * cs-parser.jay (non_expression_type): Add productions for pointer
6533         casts. 
6534
6535         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
6536         code.  We should not use force into static mode if the method is
6537         not virtual.  Fixes bug in MIS
6538
6539         * statement.cs (Do.Emit, While.Emit, For.Emit,
6540         Statement.EmitBoolExpression): Add support to Do and While to
6541         propagate infinite loop as `I do return' semantics.
6542
6543         Improve the For case to also test for boolean constants.
6544
6545         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
6546         to the list of attributes we can add.
6547
6548         Remove `EmitContext' argument.
6549
6550         * class.cs (Method.Define): Apply parameter attributes.
6551         (Constructor.Define): Apply parameter attributes.
6552         (MethodCore.LabelParameters): Move here the core of labeling
6553         parameters. 
6554
6555         * support.cs (ReflectionParameters.ParameterModifier,
6556         InternalParameters.ParameterModifier): Use IsByRef on the type and
6557         only return the OUT bit for these parameters instead of in/out/ref
6558         flags.
6559
6560         This is because I miss-understood things.  The ParameterInfo.IsIn
6561         and IsOut represent whether the parameter has the [In] and [Out]
6562         attributes set.  
6563
6564 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
6565
6566         * ecore.cs (FieldExpr.Emit): Release temporaries.
6567
6568         * assign.cs (LocalTemporary.Release): new function.
6569
6570         * codegen.cs (EmitContext.GetTemporaryStorage,
6571         EmitContext.FreeTemporaryStorage): Rework the way we deal with
6572         temporary storage.  Now we can "put back" localbuilders when we
6573         are done with them
6574
6575 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
6576
6577         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
6578         need to make a copy of the variable to generate verifiable code.
6579
6580 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
6581
6582         * driver.cs: Compute dynamically the system directory.
6583
6584         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
6585         Slower, but more generally useful.  Used by the abstract
6586         registering implementation. 
6587
6588         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
6589         the rules for the special rule on Type/instances.  First check if
6590         we have the same name, and if so, try that special static path
6591         rather than the instance path.
6592         
6593 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
6594
6595         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
6596         for, while and if.
6597
6598         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
6599         Enum, ValueType, Delegate or Array for non-corlib compiles.
6600
6601         * cs-tokenizer.cs: Catch long identifiers (645)
6602
6603         * typemanager.cs (IndexerPropetyName): Ravi never tested this
6604         piece of code.
6605
6606         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
6607         fix, we were returning too early, so we were not registering
6608         pending methods from abstract classes.
6609
6610         Do not register pending methods if the class is abstract.
6611
6612         * expression.cs (Conditional.DoResolve): Report circular implicit
6613         conversions when we neecd to compute it for conditional
6614         expressions. 
6615
6616         (Is.DoResolve): If the expression is always of the provided type,
6617         flag warning 183.  If the expression can not ever be of the
6618         provided type flag warning 184.
6619
6620         * class.cs: Catch 169 as well.
6621
6622         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
6623         read. 
6624
6625 2002-01-18  Nick Drochak  <ndrochak@gol.com>
6626
6627         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
6628
6629 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
6630
6631         * interface.cs: (PopulateMethod): Check for pointers being defined
6632         only if the unsafe context is active.
6633         (PopulateProperty): ditto.
6634         (PopulateIndexer): ditto.
6635
6636         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
6637         specified.  If pointers are present, make sure that they are
6638         present in an unsafe context.
6639         (Constructor, Constructor.Define): ditto.
6640         (Field, Field.Define): ditto.
6641         (Property, Property.Define): ditto.
6642         (Event, Event.Define): ditto.
6643
6644         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
6645         hashtable if there are classes or structs defined.
6646
6647         * expression.cs (LocalVariableReference.DoResolve): Simplify this
6648         code, as the constant resolution moved.
6649
6650         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
6651         the metadata, so we can flag error 133. 
6652
6653         * decl.cs (MemberCore.UnsafeOK): New function to test that a
6654         pointer is being declared in an unsafe context.
6655
6656 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
6657
6658         * modifiers.cs (Modifiers.Check): Require a Location argument.
6659         Report error 227 for Unsafe use.
6660
6661         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
6662
6663         * statement.cs (For.Emit): If the test is null, then report that
6664         we do `return', as we wont reach anything afterwards.
6665
6666         (Switch.SwitchGoverningType): Track the expression that matched
6667         the conversion.
6668
6669         * driver.cs: Allow negative numbers as an error code to flag.
6670
6671         * cs-parser.jay: Handle 1551.
6672
6673         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
6674
6675 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
6676
6677         * cs-parser.jay: Report 1518 (type declaration can only contain
6678         class, struct, interface, enum or delegate)
6679
6680         (switch_label): Report 1523 (keywords `case' or `default' must
6681         preced code)
6682
6683         (opt_switch_sections): Report 1522 (empty switch)
6684
6685         * driver.cs: Report 1515 (response file specified multiple times)
6686         Report 1516 (Source file specified multiple times).
6687
6688         * expression.cs (Argument.Resolve): Signal 1510
6689
6690         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
6691         access not allowed in static code)
6692
6693 2002-01-11  Ravi Pratap  <ravi@ximian.com>
6694
6695         * typemanager.cs (IsPointerType): Utility method which we are going
6696         to need a lot.
6697
6698         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
6699         the object type, so we take care of that.
6700
6701         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
6702         
6703         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
6704         added to non-params parameters :-)
6705
6706         * typemanager.cs (CSharpName): Include 'void' type too. 
6707
6708         (void_ptr_type): Include in the set of core types.
6709
6710         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
6711         duplicating code.
6712
6713         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
6714         an unsafe context.
6715
6716         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
6717         completely forgotten about it.
6718
6719 2002-01-10  Ravi Pratap  <ravi@ximian.com>
6720
6721         * cs-parser.jay (pointer_type): Add. This begins our implementation
6722         of parsing rules for unsafe code.
6723
6724         (unsafe_statement): Implement.
6725
6726         (embedded_statement): Modify to include the above.
6727
6728         * statement.cs (Unsafe): Implement new class for unsafe blocks.
6729
6730         * codegen.cs (EmitContext.InUnsafe): Add. This determines
6731         if the current context is an unsafe one.
6732
6733         * cs-parser.jay (local_variable_pointer_type): Since local variable types
6734         are handled differently, we need separate rules for them.
6735
6736         (local_variable_declaration): Update to use local_variable_pointer_type
6737         to allow variable declarations of unmanaged pointer types.
6738
6739         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
6740         in unsafe contexts.
6741
6742         * ../errors/cs0214.cs : Add.
6743
6744 2002-01-16  Nick Drochak  <ndrochak@gol.com>
6745
6746         * makefile: remove 'response' file when cleaning.
6747
6748 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
6749
6750         * cs-parser.jay: Report 1524.
6751
6752 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
6753
6754         * typemanager.cs (RegisterMethod): drop checking if we have
6755         registered this from here
6756
6757 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
6758
6759         * class.cs (Method.EmitDestructor): Implement calling our base
6760         destructor. 
6761
6762         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
6763         value of InFinally.
6764
6765         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
6766         this routine and will wrap the call in a try/catch block.  Deal
6767         with the case.
6768
6769 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
6770
6771         * ecore.cs (Expression.MemberLookup): instead of taking a
6772         parameter `same_type' that was used to tell whether we could
6773         access private members we compute our containing type from the
6774         EmitContext.
6775
6776         (FieldExpr): Added partial support for volatile fields.  This does
6777         not work for volatile fields exposed from assemblies, as I can not
6778         figure out how to extract the modreq from it.
6779
6780         Updated all the source files to use this.
6781
6782         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
6783         because it is referenced by MemberLookup very often. 
6784
6785 2002-01-09  Ravi Pratap  <ravi@ximian.com>
6786
6787         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
6788         TypeBuilder.GetCustomAttributes to retrieve what we need.
6789
6790         Get rid of redundant default_member_attr_type as this is the same as
6791         default_member_type which already exists.
6792
6793         * interface.cs, attribute.cs : Update accordingly.
6794         
6795 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
6796
6797         * typemanager.cs: Enable IndexerPropertyName again.  It does not
6798         work for TYpeBuilders though.  Ravi, can you please fix this?
6799
6800         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
6801
6802         * expression.cs (Argument.Emit): Handle the case of ref objects
6803         being passed to ref functions;  
6804
6805         (ParameterReference.EmitLoad): Loads the content of the pointer
6806         without dereferencing.
6807
6808 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
6809
6810         * cs-tokenizer.cs: Implemented the pre-processing expressions.
6811
6812 2002-01-08  Ravi Pratap  <ravi@ximian.com>
6813
6814         * class.cs (Indexer.DefineMethod): Incorporate the interface
6815         type in the name of the method if we are doing explicit interface
6816         implementation.
6817
6818         * expression.cs (ConversionExists): Remove as it is completely obsolete.
6819
6820         (BetterConversion): Fix extremely trivial bug where we were referring to
6821         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
6822         again !
6823
6824         * ../errors/bug16.cs : Add although we have fixed it.
6825
6826 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
6827
6828         * expression.cs (BaseIndexer): Begin implementation.
6829
6830         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
6831
6832         * cs-parser.jay (indexer_declarator): Use qualified_identifier
6833         production directly to remove a shift/reduce, and implement
6834         explicit interface implementation.
6835
6836         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
6837         after a floating point suffix.
6838
6839         * expression.cs (DoNumericPromotions): Improved the conversion for
6840         uint/uint.  If we have a constant, we avoid doing a typecast to a
6841         larger type.
6842
6843         * class.cs (Indexer): Implement explicit interface implementation
6844         for indexers.
6845         
6846 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
6847
6848         * class.cs: make the default instance constructor public and hidebysig.
6849
6850 2001-01-03  Ravi Pratap  <ravi@ximian.com>
6851
6852         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
6853         so we can call it from elsewhere.
6854
6855         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
6856         we emit it internally if the class has a defined indexer; otherwise the user
6857         emits it by decorating the class definition with the DefaultMemberAttribute.
6858
6859         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
6860         attribute is not used on a type which defines an indexer.
6861
6862         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
6863         character when we skip whitespace.
6864
6865         * ../errors/cs0646.cs : Add.
6866
6867 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
6868
6869         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
6870         again. 
6871
6872         * makefile: Add practical target `mcs3.exe' which builds the third
6873         generation compiler. 
6874
6875         * expression.cs (New): Fix structures constructor calling.
6876
6877         * class.cs (Property, Method, Indexer): Emit Final flag on the
6878         method if we are an interface implementation and we are not
6879         abstract. 
6880
6881         * ecore.cs (PropertyExpr): New public field `IsBase', tells
6882         whether this property is referencing a `base' method.
6883
6884         * expression.cs (Invocation.EmitCall): take an extra argument:
6885         is_base, this is used to determine whether the `call' or
6886         `callvirt' opcode should be used.
6887
6888         
6889         * delegate.cs: update EmitCall.
6890
6891         * class.cs (Method.Define): Set NewSlot for the cases where we are
6892         not implementing an interface method.
6893
6894         (Property.Define): ditto.
6895
6896 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
6897
6898         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
6899         'r'.  Allows mcs to parse itself fully.
6900
6901 2002-01-02  Ravi Pratap  <ravi@ximian.com>
6902
6903         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
6904         of the number of initializers that require the InitializeArray method.
6905
6906         (CheckIndices): Store the Expression in all cases - not the plain value. Also
6907         update the above field where necessary.
6908
6909         (MakeByteBlob): Update accordingly.
6910
6911         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
6912         greater than 2.
6913
6914         (EmitDynamicInitializers): Update in accordance with the new optimization.
6915
6916         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
6917         same OpCode applies.
6918
6919         * cs-parser.jay : Fix some glaring errors I introduced.
6920
6921 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
6922
6923         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
6924         so that we can check for name clashes there too.
6925
6926         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
6927         for interface indexers.
6928
6929         * interfaces.cs (Define): Emit the default member attribute.
6930
6931         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
6932         variable was being referred to while setting the value ;-)
6933
6934 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
6935
6936         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
6937         byte-by-byte information when we know the data is zero.
6938
6939         Make the block always a multiple of 4, because
6940         DefineInitializedData has a bug.
6941
6942         * assign.cs: Fix, we should assign from the temporary, not from
6943         the source. 
6944
6945         * expression.cs (MakeByteBlob): Fix my incorrect code.
6946
6947 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
6948
6949         * typemanager.cs (EnumToUnderlying): This function is used to get
6950         the underlying type from an enumeration, because it does not
6951         always work. 
6952
6953         * constant.cs: Use the I4_S form for values between -128 and 127.
6954
6955         * statement.cs (Block.LookupLabel): Looks up a label.
6956         (Block): Drop support for labeled blocks.
6957
6958         (LabeledStatement): New kind of statement that represents a label
6959         only.
6960
6961         (Goto): Finally implement this bad boy.
6962         
6963         * cs-parser.jay: Update to reflect new mechanism to implement
6964         labels.
6965
6966 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
6967
6968         * codegen.cs (EmitContext.This): a codegen property that keeps the
6969         a single instance of this instead of creating many different this
6970         instances. 
6971
6972         * delegate.cs (Delegate.DoResolve): Update to use the property;
6973
6974         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
6975
6976         * expression.cs (BaseAccess.DoResolve): Ditto.
6977
6978 2001-12-29  Ravi Pratap  <ravi@ximian.com>
6979
6980         * typemanager.cs (methodimpl_attr_type): Add to hold the type
6981         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
6982
6983         (InitCoreTypes): Update accordingly.
6984
6985         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
6986         so we can quickly store the state.
6987
6988         (ApplyAttributes): Set the correct implementation flags
6989         for InternalCall methods.
6990
6991 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
6992
6993         * expression.cs (EmitCall): if a method is not virtual, then do
6994         not use callvirt on it.
6995
6996         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
6997         user defined stuff) requires the use of stobj, which takes an
6998         address on the stack instead of an array and an index.  So emit
6999         the Ldelema operation for it.
7000
7001         (EmitStoreOpcode): Use stobj for valuetypes.
7002
7003         (UnaryMutator.EmitCode): Use the right 1 value depending on
7004         whether we are dealing with int64/uint64, float or doubles.
7005
7006         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
7007         constructors that I implemented last night.
7008
7009         (Constructor.IsDefault): Fix to work properly for static
7010         constructors.
7011
7012         * cs-parser.jay (CheckDef): report method signature errors.
7013         Update error number 103 to be 132.
7014
7015         * decl.cs: New AdditionResult enumeration value: MethodExists.
7016         Although we do this check for methods later on in the semantic
7017         analysis, catching repeated default constructors is so easy that
7018         we catch these here. 
7019         
7020         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
7021         promotions code.
7022
7023         (ParameterReference.EmitAssign, Emit): handle
7024         bools as bytes.
7025
7026         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
7027         (ArrayAccess.EmitStoreOpcode): ditto.
7028
7029         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
7030
7031         * expression.cs (MakeByteBlob): Complete all the missing types
7032         (uint, short, ushort, byte, sbyte)
7033
7034         * class.cs: Only init instance field initializers on instance
7035         constructors. 
7036
7037         Rename `constructors' to instance_constructors. 
7038
7039         (TypeContainer.AddConstructor): Only add constructors to the list
7040         if it is not static.
7041
7042         Make sure that we handle default_static_constructor independently
7043         everywhere where we handle instance_constructors
7044
7045 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
7046
7047         * class.cs: Do not lookup or create a base initializer for a
7048         static constructor.
7049
7050         (ConstructorInitializer.Resolve): use the proper type to lookup
7051         for constructors.
7052
7053         * cs-parser.jay: Report error 1585 (modifiers between type and name).
7054
7055         * enum.cs, interface.cs: Remove CloseType, this is taken care by
7056         in DeclSpace. 
7057
7058         * decl.cs: CloseType is now an virtual method, the default
7059         implementation just closes this type.
7060         
7061 2001-12-28  Ravi Pratap  <ravi@ximian.com>
7062
7063         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
7064         to PreserveSig by default. Also emit HideBySig on such methods.
7065
7066         Basically, set the defaults to standard values.
7067
7068         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
7069         argument, if candidate is better, it can't be worse than the best !
7070
7071         (Invocation): Re-write bits to differentiate between methods being
7072         applicable in their expanded form and their normal form - for params
7073         methods of course.
7074
7075         Get rid of use_standard everywhere as only standard conversions are allowed
7076         in overload resolution. 
7077
7078         More spec conformance.
7079         
7080 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
7081
7082         * driver.cs: Add --timestamp, to see where the compiler spends
7083         most of its time.
7084
7085         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
7086         `this' in static code.
7087
7088         (SimpleName.DoResolve): Implement in terms of a helper function
7089         that allows static-references to be passed upstream to
7090         MemberAccess.
7091
7092         (Expression.ResolveWithSimpleName): Resolve specially simple
7093         names when called by MemberAccess to implement the special
7094         semantics. 
7095
7096         (Expression.ImplicitReferenceConversion): Handle conversions from
7097         Null to reference types before others, as Null's type is
7098         System.Object. 
7099
7100         * expression.cs (Invocation.EmitCall): Handle the special case of
7101         calling methods declared on a reference type from a ValueType
7102         (Base classes System.Object and System.Enum)
7103
7104         (MemberAccess.Resolve): Only perform lookups on Enumerations if
7105         the left hand side is a TypeExpr, not on every enumeration. 
7106
7107         (Binary.Resolve): If types are reference types, then do a cast to
7108         object on operators != and == of both arguments.
7109         
7110         * typemanager.cs (FindMembers): Extract instance and static
7111         members if requested.
7112
7113         * interface.cs (PopulateProperty): Use void_type instead of null
7114         as the return type for the setter method.
7115
7116         (PopulateIndexer): ditto.
7117
7118 2001-12-27  Ravi Pratap  <ravi@ximian.com>
7119
7120         * support.cs (ReflectionParameters): Fix minor bug where we
7121         were examining the wrong parameter for the ParamArray attribute.
7122
7123         Cope with requests for the type of the parameter at position
7124         greater than the params parameter's. We now return the element
7125         type of the params array as that makes more sense.
7126
7127         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
7128         accordingly as we no longer have to extract the element type
7129         ourselves.
7130
7131         (Invocation.OverloadResolve): Update.
7132
7133 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
7134
7135         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
7136         against IEnumerator, test whether the return value is a descendant
7137         of the IEnumerator interface.
7138
7139         * class.cs (Indexer.Define): Use an auxiliary method to implement
7140         the other bits of the method definition.  Begin support for
7141         explicit interface implementation.
7142
7143         (Property.DefineMethod): Use TypeManager.void_type instead of null
7144         for an empty return value.
7145
7146 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
7147
7148         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
7149         dealing with a FieldExpr which is composed of a FieldBuilder, in
7150         the code path we did extract the constant, but we should have
7151         obtained the underlying value to be able to cast it (otherwise we
7152         end up in an infinite loop, this is what Ravi was running into).
7153
7154         (ArrayCreation.UpdateIndices): Arrays might be empty.
7155
7156         (MemberAccess.ResolveMemberAccess): Add support for section
7157         14.5.4.1 that deals with the special case of E.I when E is a type
7158         and something else, that I can be a reference to a static member.
7159
7160         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
7161         handle a particular array type to create byte blobs, it is just
7162         something we dont generate byteblobs for.
7163
7164         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
7165         arguments. 
7166
7167         * location.cs (Push): remove the key from the hashtable that we
7168         are about to add.   This happens for empty files.
7169
7170         * driver.cs: Dispose files after we have parsed them.
7171
7172         (tokenize): new function that only runs the tokenizer on its
7173         input, for speed testing.
7174
7175 2001-12-26  Ravi Pratap  <ravi@ximian.com>
7176
7177         * class.cs (Event.Define): Define the private field only if there
7178         are no accessors defined.
7179
7180         * expression.cs (ResolveMemberAccess): If there is no associated
7181         field with the event, that means we have an event defined with its
7182         own accessors and we should flag error cs0070 since transforming
7183         ourselves into a field is not valid in that case.
7184
7185         * ecore.cs (SimpleName.DoResolve): Same as above.
7186
7187         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
7188         and charset to sane values.
7189
7190 2001-12-25  Ravi Pratap  <ravi@ximian.com>
7191
7192         * assign.cs (DoResolve): Perform check on events only if they 
7193         are being accessed outside the declaring type.
7194
7195         * cs-parser.jay (event_declarations): Update rules to correctly
7196         set the type of the implicit parameter etc.
7197
7198         (add_accessor, remove_accessor): Set current local parameters.
7199
7200         * expression.cs (Binary): For delegate addition and subtraction,
7201         cast the return value from the method into the appropriate delegate
7202         type.
7203
7204 2001-12-24  Ravi Pratap  <ravi@ximian.com>
7205
7206         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
7207         of these as the workaround is unnecessary.
7208
7209         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
7210         delegate data - none of that is needed at all.
7211
7212         Re-write bits to extract the instance expression and the delegate method
7213         correctly.
7214
7215         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
7216         on delegates too.
7217
7218         * attribute.cs (ApplyAttributes): New method to take care of common tasks
7219         of attaching attributes instead of duplicating code everywhere.
7220
7221         * everywhere : Update code to do attribute emission using the above method.
7222
7223 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
7224
7225         * expression.cs (IsParamsMethodApplicable): if there are not
7226         parameters, return immediately.
7227
7228         * ecore.cs: The 0 literal can be implicity converted to an enum
7229         type. 
7230
7231         (SimpleName.DoResolve): First lookup the type, then lookup the
7232         members. 
7233
7234         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
7235         want to get its address.  If the InstanceExpression is not
7236         addressable, store the result in a temporary variable, then get
7237         the address of it.
7238
7239         * codegen.cs: Only display 219 errors on warning level or above. 
7240
7241         * expression.cs (ArrayAccess): Make it implement the
7242         IMemoryLocation interface.
7243
7244         (Binary.DoResolve): handle the operator == (object a, object b)
7245         and operator != (object a, object b) without incurring into a
7246         BoxedCast (because 5 != o should never be performed).
7247
7248         Handle binary enumerator operators.
7249
7250         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
7251         value type, otherwise use Ldelem_ref.
7252
7253         Use precomputed names;
7254
7255         (AddressOf): Implement address of
7256
7257         * cs-parser.jay (labeled_statement): Fix recursive block
7258         addition by reworking the production.
7259
7260         * expression.cs (New.DoEmit): New has a special case:
7261                 
7262                  If we are dealing with a ValueType, we have a few
7263                  situations to deal with:
7264                 
7265                     * The target of New is a ValueType variable, that is
7266                       easy, we just pass this as the variable reference
7267                 
7268                     * The target of New is being passed as an argument,
7269                       to a boxing operation or a function that takes a
7270                       ValueType.
7271                 
7272                       In this case, we need to create a temporary variable
7273                       that is the argument of New.
7274
7275
7276 2001-12-23  Ravi Pratap  <ravi@ximian.com>
7277
7278         * rootcontext.cs (LookupType): Check that current_type is not null before
7279         going about looking at nested types.
7280
7281         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
7282         not implement the IAssignMethod interface any more.
7283
7284         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
7285         where we tranform them into FieldExprs if they are being resolved from within
7286         the declaring type.
7287
7288         * ecore.cs (SimpleName.DoResolve): Do the same here.
7289
7290         * assign.cs (DoResolve, Emit): Clean up code considerably. 
7291
7292         * ../errors/bug10.cs : Add.
7293
7294         * ../errors/cs0070.cs : Add.
7295
7296         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
7297
7298         * assign.cs : Get rid of EventIsLocal everywhere.
7299         
7300 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
7301
7302         * ecore.cs (ConvertIntLiteral): finished the implementation.
7303
7304         * statement.cs (SwitchLabel): Convert the value we are using as a
7305         key before looking up the table.
7306
7307 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
7308
7309         * codegen.cs (EmitTopBlock): Require a Location argument now.
7310
7311         * cs-parser.jay (constructor_declarator): We need to setup
7312         current_local_parameters before we parse the
7313         opt_constructor_initializer, to allow the variables to be bound
7314         to the constructor arguments.
7315
7316         * rootcontext.cs (LookupType): First lookup nested classes in our
7317         class and our parents before we go looking outside our class.
7318
7319         * expression.cs (ConstantFold): Extract/debox the values at the
7320         beginnning. 
7321
7322         * rootcontext.cs (EmitCode): Resolve the constants first before we
7323         resolve the types.  This is not really needed, but it helps debugging.
7324
7325         * statement.cs: report location.
7326         
7327         * cs-parser.jay: pass location to throw statement.
7328
7329         * driver.cs: Small bug fix.
7330
7331         * report.cs: Updated format to be 4-zero filled digits.
7332
7333 2001-12-22  Ravi Pratap  <ravi@ximian.com>
7334
7335         * expression.cs (CheckIndices): Fix minor bug where the wrong
7336         variable was being referred to ;-)
7337
7338         (DoEmit): Do not call EmitStaticInitializers when the 
7339         underlying type is System.Object.
7340
7341 2001-12-21  Ravi Pratap  <ravi@ximian.com>
7342
7343         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
7344         and do the usual workaround for SRE.
7345
7346         * class.cs (MyEventBuilder.EventType): New member to get at the type
7347         of the event, quickly.
7348
7349         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
7350
7351         * assign.cs (Assign.DoResolve): Handle the case when the target
7352         is an EventExpr and perform the necessary checks.
7353
7354         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
7355         interface.
7356
7357         (SimpleName.MemberStaticCheck): Include check for EventExpr.
7358
7359         (EventExpr): Set the type in the constructor itself since we 
7360         are meant to be born fully resolved.
7361
7362         (EventExpr.Define): Revert code I wrote earlier.
7363                 
7364         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
7365         instance expression is null. The instance expression is a This in that case
7366         or a null, depending on whether it is a static method or not.
7367
7368         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
7369         refers to more than one method.
7370
7371         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
7372         and accordingly flag errors.
7373
7374 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
7375
7376         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
7377
7378 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
7379
7380         * location.cs (ToString): Provide useful rutine.
7381
7382 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
7383
7384         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
7385         objects, return the actual integral boxed.
7386
7387         * statement.cs (SwitchLabel): define an ILLabel for each
7388         SwitchLabel. 
7389         
7390         (Switch.CheckSwitch): If the value is a Literal, extract
7391         the underlying literal.
7392         
7393         Also in the unused hashtable we had, add the SwitchLabel so we can
7394         quickly look this value up.
7395
7396         * constant.cs: Implement a bunch of new constants.  Rewrite
7397         Literal based on this.  Made changes everywhere to adapt to this.
7398         
7399         * expression.cs (Expression.MakeByteBlob): Optimize routine by
7400         dereferencing array only once, and also copes with enumrations.
7401
7402         bytes are two bytes wide, not one.
7403
7404         (Cast): Perform constant conversions.
7405         
7406         * ecore.cs (TryImplicitIntConversion): Return literals instead of
7407         wrappers to the literals here.
7408
7409         * expression.cs (DoNumericPromotions): long literals can converted
7410         to ulong implicity (this is taken care of elsewhere, but I was
7411         missing this spot).
7412
7413         * ecore.cs (Expression.Literalize): Make the return type Literal,
7414         to improve type checking.
7415
7416         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
7417
7418 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
7419
7420         * literal.cs: Revert code from ravi that checked the bounds.  The
7421         bounds are sane by the definition of the type itself. 
7422
7423         * typemanager.cs: Fix implementation of ImplementsInterface.  We
7424         need to actually look up in our parent hierarchy for interfaces
7425         implemented. 
7426
7427         * const.cs: Use the underlying type for enumerations
7428
7429         * delegate.cs: Compute the basename for the delegate creation,
7430         that should fix the delegate test case, and restore the correct
7431         Type Lookup semantics in rootcontext
7432
7433         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
7434         referencing a nested type with the Reflection API is using the "+"
7435         sign. 
7436
7437         * cs-parser.jay: Do not require EOF token at the end.
7438
7439 2001-12-20  Ravi Pratap  <ravi@ximian.com>
7440
7441         * rootcontext.cs (LookupType): Concatenate type names with
7442         a '.' instead of a '+' The test suite passes again.
7443
7444         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
7445         field of the enumeration.
7446
7447         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
7448         the case when the member is an EventExpr.
7449
7450         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
7451         static has an associated instance expression.
7452
7453         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
7454
7455         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
7456
7457         * class.cs (Event.Define): Register event and perform appropriate checks
7458         for error #111.
7459
7460         We define the Add and Remove methods even if the use provides none because
7461         in that case, we provide default implementations ourselves.
7462
7463         Define a private field of the type of the event. This is done by the CSC compiler
7464         and we should be doing it too ;-)
7465
7466         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
7467         More methods we use in code we generate.
7468
7469         (multicast_delegate_type, delegate_type): Two separate types since the distinction
7470         is important.
7471
7472         (InitCoreTypes): Update accordingly for the above.
7473
7474         * class.cs (Event.Emit): Generate code for default accessors that we provide
7475
7476         (EmitDefaultMethod): Do the job in the above.
7477
7478         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
7479         appropriate place.
7480
7481 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
7482
7483         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
7484         builders even if we were missing one.
7485
7486         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
7487         pass the Basename as our class name instead of the Name.  The
7488         basename will be correctly composed for us.
7489
7490         * parameter.cs (Paramters): Now takes a Location argument.
7491
7492         * decl.cs (DeclSpace.LookupType): Removed convenience function and
7493         make all the code call directly LookupType in RootContext and take
7494         this chance to pass the Location information everywhere.
7495
7496         * Everywhere: pass Location information.
7497
7498 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
7499
7500         * class.cs (Constructor.Define): Updated way of detecting the
7501         length of the parameters.
7502
7503         (TypeContainer.DefineType): Use basename as the type name for
7504         nested types.
7505
7506         (TypeContainer.Define): Do not recursively define types here, as
7507         definition is taken care in order by the RootContext.
7508
7509         * tree.cs: Keep track of namespaces in a per-file basis.
7510
7511         * parameter.cs (Parameter.ComputeSignature): Update to use
7512         DeclSpace. 
7513
7514         (Parameters.GetSignature): ditto.
7515
7516         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
7517         instead of a TypeContainer.
7518
7519         (Interface.SemanticAnalysis): Use `this' instead of our parent to
7520         resolve names.  Because we need to be resolve in our context, not
7521         our parents.
7522         
7523         * driver.cs: Implement response files.
7524
7525         * class.cs (TypeContainer.DefineType): If we are defined, do not
7526         redefine ourselves.
7527         
7528         (Event.Emit): Emit the code for add/remove handlers.
7529         (Event.Define): Save the MethodBuilders for add/remove.
7530
7531         * typemanager.cs: Use pair here too.
7532
7533         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
7534         DictionaryEntry requires the first argument to be non-null.  
7535         
7536         (enum_declaration): Compute full name for registering the
7537         enumeration.
7538         
7539         (delegate_declaration): Instead of using
7540         formal_parameter_list, use opt_formal_parameter_list as the list
7541         can be empty.
7542
7543         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
7544         (EventParsing): New property that controls whether `add' and
7545         `remove' are returned as tokens or identifiers (for events);
7546
7547 2001-12-19  Ravi Pratap  <ravi@ximian.com>
7548
7549         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
7550         use MyEventBuilder only and let it wrap the real builder for us.
7551
7552         (MyEventBuilder): Revamp constructor etc.
7553
7554         Implement all operations that we perform on EventBuilder in precisely the same
7555         way here too.
7556
7557         (FindMembers): Update to use the EventBuilder member.
7558
7559         (Event.Emit): Update accordingly.
7560
7561 2001-12-18  Ravi Pratap  <ravi@ximian.com>
7562
7563         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
7564         by calling the appropriate methods.
7565
7566         (GetCustomAttributes): Make stubs as they cannot possibly do anything
7567         useful.
7568
7569         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
7570
7571 2001-12-17  Ravi Pratap  <ravi@ximian.com>
7572
7573         * delegate.cs (Delegate.Populate): Check that the return type
7574         and various parameters types are indeed accessible.
7575
7576         * class.cs (Constructor.Define): Same here.
7577
7578         (Field.Define): Ditto.
7579
7580         (Event.Define): Ditto.
7581
7582         (Operator.Define): Check that the underlying Method defined itself
7583         correctly - so it's MethodBuilder should not be null.
7584
7585         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
7586         expression happens to be null.
7587
7588         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
7589         members but as of now we don't seem to be able to do anything really useful with it.
7590
7591         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
7592         not the EventBuilder.
7593
7594 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
7595
7596         * cs-tokenizer.cs: Add support for defines.
7597         Add support for #if, #elif, #else, #endif
7598         
7599         (eval_var): evaluates a variable.
7600         (eval): stubbed for evaluating functions.
7601
7602         * cs-parser.jay: Pass the defines information
7603
7604         * driver.cs: Add --define command line option.
7605
7606         * decl.cs: Move MemberCore here.
7607
7608         Make it the base class for DeclSpace.  This allows us to catch and
7609         report 108 and 109 for everything now.
7610
7611         * class.cs (TypeContainer.Define): Extract all the members
7612         before populating and emit the warning 108 (new keyword required
7613         to override) instead of having each member implement this.
7614
7615         (MemberCore.Define): New abstract method, we will be using this in
7616         the warning reporting engine in Populate.
7617         
7618         (Operator.Define): Adjust to new MemberCore protocol. 
7619
7620         * const.cs (Const): This does not derive from Expression, it is a
7621         temporary object we use to create fields, it is a MemberCore. 
7622
7623         * class.cs (Method.Define): Allow the entry point to be in a
7624         specific class.
7625
7626         * driver.cs: Rewrite the argument handler to clean it up a bit.
7627
7628         * rootcontext.cs: Made it just an auxiliary namespace feature by
7629         making everything static.
7630
7631         * driver.cs: Adapt code to use RootContext type name instead of
7632         instance variable.
7633
7634         * delegate.cs: Remove RootContext argument.
7635
7636         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
7637         argument. 
7638
7639         * class.cs (Event.Define): The lookup can fail.
7640         
7641         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
7642
7643         * expression.cs: Resolve the this instance before invoking the code.
7644
7645 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
7646
7647         * cs-parser.jay: Add a production in element_access that allows
7648         the thing to become a "type" reference.  This way we can parse
7649         things like "(string [])" as a type.
7650
7651         Note that this still does not handle the more complex rules of
7652         casts. 
7653         
7654
7655         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
7656
7657         * ecore.cs: (CopyNewMethods): new utility function used to
7658         assemble the list of methods from running FindMembers.
7659
7660         (MemberLookup): Rework FindMembers so that 
7661
7662 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
7663
7664         * class.cs (TypeContainer): Remove Delegates who fail to be
7665         defined.
7666
7667         * delegate.cs (Populate): Verify that we dont get null return
7668         values.   TODO: Check for AsAccessible.
7669
7670         * cs-parser.jay: Use basename to emit error 574 (destructor should
7671         have the same name as container class), not the full name.
7672
7673         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
7674         possible representation.  
7675
7676         Also implements integer type suffixes U and L.
7677
7678 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
7679
7680         * expression.cs (ArrayCreation.DoResolve): We need to do the
7681         argument resolution *always*.
7682
7683         * decl.cs: Make this hold the namespace.  Hold the root context as
7684         well.
7685         (LookupType): Move here.
7686
7687         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
7688
7689         * location.cs (Row, Name): Fixed the code, it was always returning
7690         references to the first file.
7691
7692         * interface.cs: Register properties defined through interfaces.
7693
7694         * driver.cs: Add support for globbing on the command line
7695
7696         * class.cs (Field): Make it derive from MemberCore as well.
7697         (Event): ditto.
7698
7699 2001-12-15  Ravi Pratap  <ravi@ximian.com>
7700
7701         * class.cs (Event::Define): Check that the type of the event is a delegate
7702         type else flag error #66.
7703
7704         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
7705         same.
7706
7707         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
7708         values of EntryPoint, CharSet etc etc.
7709
7710         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
7711
7712         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
7713         be null and we should ignore this. I am not sure if this is really clean. Apparently,
7714         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
7715         which needs this to do its work.
7716
7717         * ../errors/cs0066.cs : Add.
7718
7719 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
7720
7721         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
7722         helper functions.
7723
7724         * class.cs: (MethodSignature.MethodSignature): Removed hack that
7725         clears out the parameters field.
7726         (MemberSignatureCompare): Cleanup
7727
7728         (MemberCore): New base class used to share code between MethodCore
7729         and Property.
7730
7731         (RegisterRequiredImplementations) BindingFlags.Public requires
7732         either BindingFlags.Instace or Static.  Use instance here.
7733
7734         (Property): Refactored code to cope better with the full spec.
7735
7736         * parameter.cs (GetParameterInfo): Return an empty array instead
7737         of null on error.
7738
7739         * class.cs (Property): Abstract or extern properties have no bodies.
7740
7741         * parameter.cs (GetParameterInfo): return a zero-sized array.
7742
7743         * class.cs (TypeContainer.MethodModifiersValid): Move all the
7744         method modifier validation to the typecontainer so we can reuse
7745         this on properties.
7746
7747         (MethodCore.ParameterTypes): return an empty sized array of types.
7748
7749         (Property.Define): Test property modifier validity.
7750
7751         Add tests for sealed/override too.
7752
7753         (Method.Emit): abstract or extern methods have no bodies.
7754
7755 2001-12-14  Ravi Pratap  <ravi@ximian.com>
7756
7757         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
7758         thing.
7759
7760         (Method::Define, ::Emit): Modify accordingly.
7761
7762         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
7763
7764         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
7765
7766         * makefile: Pass in /unsafe.
7767
7768 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
7769
7770         * class.cs (MakeKey): Kill routine.
7771         
7772         * class.cs (TypeContainer.Define): Correctly define explicit
7773         method implementations (they require the full interface name plus
7774         the method name).
7775
7776         * typemanager.cs: Deply the PtrHashtable here and stop using the
7777         lame keys.  Things work so much better.
7778
7779         This of course broke everyone who depended on `RegisterMethod' to
7780         do the `test for existance' test.  This has to be done elsewhere.
7781
7782         * support.cs (PtrHashtable): A hashtable that avoid comparing with
7783         the object stupid Equals method (because, that like fails all over
7784         the place).  We still do not use it.
7785
7786         * class.cs (TypeContainer.SetRequiredInterface,
7787         TypeContainer.RequireMethods): Killed these two routines and moved
7788         all the functionality to RegisterRequiredImplementations.
7789
7790         (TypeContainer.RegisterRequiredImplementations): This routine now
7791         registers all the implementations required in an array for the
7792         interfaces and abstract methods.  We use an array of structures
7793         which can be computed ahead of time to reduce memory usage and we
7794         also assume that lookups are cheap as most classes will not
7795         implement too many interfaces.
7796
7797         We also avoid creating too many MethodSignatures.
7798
7799         (TypeContainer.IsInterfaceMethod): Update and optionally does not
7800         clear the "pending" bit if we find that there are problems with
7801         the declaration.
7802
7803         (TypeContainer.VerifyPendingMethods): Update to report errors of
7804         methods that look like implementations but are not.
7805
7806         (TypeContainer.Define): Add support for explicit interface method
7807         implementation. 
7808         
7809 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
7810
7811         * typemanager.cs: Keep track of the parameters here instead of
7812         being a feature of the TypeContainer.
7813
7814         * class.cs: Drop the registration of parameters here, as
7815         InterfaceMethods are also interface declarations.
7816
7817         * delegate.cs: Register methods with the TypeManager not only with
7818         the TypeContainer.  This code was buggy.
7819
7820         * interface.cs: Full registation here.
7821
7822 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
7823
7824         * expression.cs: Remove reducer for binary expressions, it can not
7825         be done this way.
7826
7827         * const.cs: Put here the code that used to go into constant.cs
7828
7829         * constant.cs: Put here the code for constants, this is a new base
7830         class for Literals.
7831
7832         * literal.cs: Make Literal derive from Constant.
7833
7834 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
7835
7836         * statement.cs (Return.Emit): Report error 157 if the user
7837         attempts to return from a finally block.
7838
7839         (Return.Emit): Instead of emitting a return, jump to the end of
7840         the function.
7841
7842         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
7843         LocalBuilder to store the result of the function.  ReturnLabel is
7844         the target where we jump.
7845         
7846
7847 2001-12-09  Radek Doulik  <rodo@ximian.com>
7848
7849         * cs-parser.jay: remember alias in current namespace
7850
7851         * ecore.cs (SimpleName::DoResolve): use aliases for types or
7852         namespaces
7853
7854         * class.cs (LookupAlias): lookup alias in my_namespace
7855
7856         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
7857         aliases hashtable
7858         (LookupAlias): lookup alias in this and if needed in parent
7859         namespaces
7860
7861 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
7862
7863         * support.cs: 
7864
7865         * rootcontext.cs: (ModuleBuilder) Made static, first step into
7866         making things static.  I need this to avoid passing the
7867         TypeContainer when calling ParameterType.
7868
7869         * support.cs (InternalParameters.ParameterType): Remove ugly hack
7870         that did string manipulation to compute the type and then call
7871         GetType.  Use Parameter.ParameterType instead.
7872
7873         * cs-tokenizer.cs: Consume the suffix for floating values.
7874
7875         * expression.cs (ParameterReference): figure out whether this is a
7876         reference parameter or not.  Kill an extra variable by computing
7877         the arg_idx during emission.
7878
7879         * parameter.cs (Parameters.GetParameterInfo): New overloaded
7880         function that returns whether a parameter is an out/ref value or not.
7881
7882         (Parameter.ParameterType): The type of the parameter (base,
7883         without ref/out applied).
7884         
7885         (Parameter.Resolve): Perform resolution here.
7886         (Parameter.ExternalType): The full type (with ref/out applied).
7887
7888         * statement.cs (Using.Emit, Using.EmitExpression): Implement
7889         support for expressions on the using statement.
7890
7891 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
7892
7893         * statement.cs (Using.EmitLocalVariableDecls): Split the
7894         localvariable handling of the using statement.
7895
7896         (Block.EmitMeta): Keep track of variable count across blocks.  We
7897         were reusing slots on separate branches of blocks.
7898
7899         (Try.Emit): Emit the general code block, we were not emitting it. 
7900
7901         Check the type of the declaration to be an IDisposable or
7902         something that can be implicity converted to it. 
7903
7904         Emit conversions if required.
7905
7906         * ecore.cs (EmptyExpression): New utility class.
7907         (Expression.ImplicitConversionExists): New utility function.
7908
7909 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
7910
7911         * statement.cs (Using): Implement.
7912
7913         * expression.cs (LocalVariableReference): Support read only variables.
7914
7915         * statement.cs: Remove the explicit emit for the Leave opcode.
7916         (VariableInfo): Add a readonly field.
7917
7918 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
7919
7920         * ecore.cs (ConvCast): new class used to encapsulate the various
7921         explicit integer conversions that works in both checked and
7922         unchecked contexts.
7923
7924         (Expression.ConvertNumericExplicit): Use new ConvCast class to
7925         properly generate the overflow opcodes.
7926
7927 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
7928
7929         * statement.cs: The correct type for the EmptyExpression is the
7930         element_type, not the variable type.  Ravi pointed this out.
7931
7932 2001-12-04  Ravi Pratap  <ravi@ximian.com>
7933
7934         * class.cs (Method::Define): Handle PInvoke methods specially
7935         by using DefinePInvokeMethod instead of the usual one.
7936
7937         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
7938         above to do the task of extracting information and defining the method.
7939         
7940 2001-12-04  Ravi Pratap  <ravi@ximian.com>
7941
7942         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
7943         of the condition for string type.
7944
7945         (Emit): Move that here. 
7946
7947         (ArrayCreation::CheckIndices): Keep string literals in their expression
7948         form.
7949
7950         (EmitDynamicInitializers): Handle strings appropriately.
7951
7952 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
7953
7954         * codegen.cs (EmitContext): Replace multiple variables with a
7955         single pointer to the current Switch statement.
7956
7957         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
7958         EmitContext.
7959
7960 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
7961
7962         * statement.cs 
7963
7964         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
7965         default'.
7966         
7967         (Foreach.Emit): Foreach on arrays was not setting
7968         up the loop variables (for break/continue).
7969
7970         (GotoCase): Semi-implented.
7971         
7972 2001-12-03  Ravi Pratap  <ravi@ximian.com>
7973
7974         * attribute.cs (CheckAttribute): Handle system attributes by using
7975         Attribute.GetAttributes to examine information we need.
7976
7977         (GetValidPlaces): Same here.
7978
7979         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
7980
7981         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
7982
7983         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
7984
7985         (Method::Define): Set appropriate flags if we have a DllImport attribute.
7986
7987         (Method::Emit): Handle the case when we are a PInvoke method.
7988
7989 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
7990
7991         * expression.cs: Use ResolveWithSimpleName on compound names.
7992
7993 2001-12-02  Ravi Pratap  <ravi@ximian.com>
7994
7995         * constant.cs (EmitConstant): Make sure we resolve the associated expression
7996         before trying to reduce it.
7997
7998         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
7999
8000         * constant.cs (LookupConstantValue): Implement.
8001
8002         (EmitConstant): Use the above in emitting the constant.
8003
8004         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
8005         that are user-defined by doing a LookupConstantValue on them.
8006
8007         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
8008         too, like above.
8009
8010 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
8011
8012         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
8013
8014         (BaseAccess.DoResolve): Implement.
8015
8016         (MemberAccess.DoResolve): Split this routine into a
8017         ResolveMemberAccess routine that can be used independently
8018
8019 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
8020
8021         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
8022         As that share bits of the implementation.  Is returns a boolean,
8023         while As returns the Type that is being probed.
8024
8025 2001-12-01  Ravi Pratap  <ravi@ximian.com>
8026
8027         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
8028         instead of a Literal - much easier.
8029
8030         (EnumInTransit): Remove - utterly useless :-)
8031
8032         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
8033
8034         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
8035
8036         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
8037         chain when we have no associated expression.
8038
8039 2001-11-30  Ravi Pratap  <ravi@ximian.com>
8040
8041         * constant.cs (Define): Use Location while reporting the errror.
8042
8043         Also emit a warning when 'new' is used and there is no inherited
8044         member to hide.
8045
8046         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
8047         populated.
8048
8049         (LookupEnumValue): Implement to lookup an enum member's value and define it
8050         if necessary.
8051
8052         (Populate): Re-write accordingly to use the above routine.
8053
8054 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
8055
8056         * expression.cs (This): Fix prototype for DoResolveLValue to
8057         override the base class DoResolveLValue.
8058
8059         * cs-parser.cs: Report errors cs574 and cs575 (destructor
8060         declarations) 
8061
8062         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
8063         (we need to load the address of the field here).  This fixes
8064         test-22. 
8065         
8066         (FieldExpr.DoResolveLValue): Call the DoResolve
8067         function to initialize the Instance expression.
8068         
8069         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
8070         correctly the GetEnumerator operation on a value type.
8071
8072         * cs-parser.jay: Add more simple parsing error catches.
8073
8074         * statement.cs (Switch): Add support for string switches.
8075         Handle null specially.
8076
8077         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
8078
8079 2001-11-28  Ravi Pratap  <ravi@ximian.com>
8080
8081         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
8082
8083         (declare_local_constant): New helper function.
8084
8085         * statement.cs (AddConstant): Keep a separate record of constants
8086
8087         (IsConstant): Implement to determine if a variable is a constant.
8088
8089         (GetConstantExpression): Implement.
8090
8091         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
8092
8093         * statement.cs (IsVariableDefined): Re-write.
8094
8095 2001-11-27  Ravi Pratap  <ravi@ximian.com>
8096
8097         * class.cs (TypeContainer::FindMembers): Look for constants
8098         in the case when we are looking for MemberTypes.Field
8099
8100         * expression.cs (MemberAccess::DoResolve): Check that in the
8101         case we are a FieldExpr and a Literal, we are not being accessed
8102         by an instance reference.
8103
8104         * cs-parser.jay (local_constant_declaration): Implement.
8105
8106         (declaration_statement): Implement for constant declarations.
8107
8108 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
8109
8110         * statement.cs (Switch): Catch double defaults.
8111
8112         (Switch): More work on the switch() statement
8113         implementation.  It works for integral values now, need to finish
8114         string support.
8115
8116
8117 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
8118
8119         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
8120         integer literals into other integer literals.  To be used by
8121         switch. 
8122
8123 2001-11-24  Ravi Pratap  <ravi@ximian.com>
8124
8125         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
8126         some memory.
8127
8128         (EmitDynamicInitializers): Cope with the above since we extract data
8129         directly from ArrayData now.
8130
8131         (ExpectInitializers): Keep track of whether initializers are mandatory
8132         or not.
8133
8134         (Bounds): Make it a hashtable to prevent the same dimension being 
8135         recorded for every element in that dimension.
8136
8137         (EmitDynamicInitializers): Fix bug which prevented the Set array method
8138         from being found.
8139
8140         Also fix bug which was causing the indices to be emitted in the reverse
8141         order.
8142
8143 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
8144
8145         * expression.cs (ArrayCreation): Implement the bits that Ravi left
8146         unfinished.  They do not work, because the underlying code is
8147         sloppy.
8148
8149 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8150
8151         * cs-parser.jay: Remove bogus fixme.
8152
8153         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
8154         on Switch statement.
8155         
8156 2001-11-23  Ravi Pratap  <ravi@ximian.com>
8157
8158         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
8159         the same. 
8160         
8161         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
8162         parameter. Apparently, any expression is allowed. 
8163
8164         (ValidateInitializers): Update accordingly.
8165
8166         (CheckIndices): Fix some tricky bugs thanks to recursion.
8167
8168         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
8169         I was being completely brain-dead.
8170
8171         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
8172         and re-write acordingly.
8173
8174         (DelegateInvocation): Re-write accordingly.
8175
8176         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
8177
8178         (MakeByteBlob): Handle types more correctly.
8179
8180         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
8181         initialization from expressions but it is incomplete because I am a complete
8182         Dodo :-|
8183
8184 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8185
8186         * statement.cs (If.Emit): Fix a bug that generated incorrect code
8187         on If.  Basically, we have to return `true' (ie, we do return to
8188         our caller) only if both branches of the if return.
8189
8190         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
8191         short-circuit operators, handle them as short circuit operators. 
8192
8193         (Cast.DoResolve): Resolve type.
8194         (Cast.Cast): Take an expression as the target type.
8195
8196         * cs-parser.jay (cast_expression): Remove old hack that only
8197         allowed a limited set of types to be handled.  Now we take a
8198         unary_expression and we resolve to a type during semantic
8199         analysis.
8200
8201         Use the grammar productions from Rhys to handle casts (this is
8202         not complete like Rhys syntax yet, we fail to handle that corner
8203         case that C# has regarding (-x), but we will get there.
8204         
8205 2001-11-22  Ravi Pratap  <ravi@ximian.com>
8206
8207         * class.cs (EmitFieldInitializer): Take care of the case when we have a
8208         field which is an array type.
8209
8210         * cs-parser.jay (declare_local_variables): Support array initialization too.
8211
8212         * typemanager.cs (MakeKey): Implement.
8213
8214         (everywhere): Use the above appropriately.
8215
8216         * cs-parser.jay (for_statement): Update for array initialization while
8217         declaring variables.
8218
8219         * ecore.cs : The error message was correct, it's the variable's names that
8220         were misleading ;-) Make the code more readable.
8221
8222         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
8223         the correct type etc.
8224
8225         (ConvertExplicit): Handle Enum types by examining the underlying type.
8226
8227 2001-11-21  Ravi Pratap  <ravi@ximian.com>
8228
8229         * parameter.cs (GetCallingConvention): Always return
8230         CallingConventions.Standard for now.
8231
8232 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8233
8234         * expression.cs (Binary.ResolveOperator): Update the values of `l'
8235         and `r' after calling DoNumericPromotions.
8236
8237         * ecore.cs: Fix error message (the types were in the wrong order).
8238
8239         * statement.cs (Foreach.ProbeCollectionType): Need to pass
8240         BindingFlags.Instance as well 
8241
8242         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
8243         implicit int literal conversion in an empty cast so that we
8244         propagate the right type upstream.
8245
8246         (UnboxCast): new class used to unbox value types.
8247         (Expression.ConvertExplicit): Add explicit type conversions done
8248         by unboxing.
8249
8250         (Expression.ImplicitNumericConversion): Oops, forgot to test for
8251         the target type before applying the implicit LongLiterals to ULong
8252         literal cast.
8253
8254 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
8255
8256         * cs-parser.jay (for_statement): Reworked the way For works: now
8257         we declare manually any variables that are introduced in
8258         for_initializer to solve the problem of having out-of-band code
8259         emition (that is what got for broken).
8260
8261         (declaration_statement): Perform the actual variable declaration
8262         that used to be done in local_variable_declaration here.
8263
8264         (local_variable_declaration): Do not declare anything, just pass
8265         the information on a DictionaryEntry
8266
8267 2001-11-20  Ravi Pratap  <ravi@ximian.com>
8268
8269         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
8270         re-write of the logic to now make it recursive.
8271
8272         (UpdateIndices): Re-write accordingly.
8273
8274         Store element data in a separate ArrayData list in the above methods.
8275
8276         (MakeByteBlob): Implement to dump the array data into a byte array.
8277
8278 2001-11-19  Ravi Pratap  <ravi@ximian.com>
8279
8280         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
8281         into CheckIndices.
8282
8283         * constant.cs (Define): Implement.
8284
8285         (EmitConstant): Re-write fully.
8286
8287         Pass in location info.
8288
8289         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
8290         respectively.
8291
8292         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
8293         DictionaryEntry since we need location info too.
8294
8295         (constant_declaration): Update accordingly.
8296
8297         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
8298         code into another method : UpdateIndices.
8299
8300 2001-11-18  Ravi Pratap  <ravi@ximian.com>
8301
8302         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
8303         some type checking etc.
8304
8305 2001-11-17  Ravi Pratap  <ravi@ximian.com>
8306
8307         * expression.cs (ArrayCreation::ValidateInitializers): Implement
8308         bits to provide dimension info if the user skips doing that.
8309
8310         Update second constructor to store the rank correctly.
8311
8312 2001-11-16  Ravi Pratap  <ravi@ximian.com>
8313
8314         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
8315         and try to implement.
8316
8317         * ../errors/cs0150.cs : Add.
8318
8319         * ../errors/cs0178.cs : Add.
8320
8321 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
8322
8323         * statement.cs: Implement foreach on multi-dimensional arrays. 
8324
8325         * parameter.cs (Parameters.GetParameterByName): Also lookup the
8326         name of the params argument.
8327
8328         * expression.cs: Use EmitStoreOpcode to get the right opcode while
8329         initializing the array.
8330
8331         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
8332         we can use this elsewhere.
8333
8334         * statement.cs: Finish implementation of foreach for single
8335         dimension arrays.
8336
8337         * cs-parser.jay: Use an out-of-band stack to pass information
8338         around, I wonder why I need this.
8339
8340         foreach_block: Make the new foreach_block the current_block.
8341
8342         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
8343         function used to return a static Parameters structure.  Used for
8344         empty parameters, as those are created very frequently.
8345
8346         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
8347
8348 2001-11-15  Ravi Pratap  <ravi@ximian.com>
8349
8350         * interface.cs : Default modifier is private, not public. The
8351         make verify test passes again.
8352
8353 2001-11-15  Ravi Pratap  <ravi@ximian.com>
8354
8355         * support.cs (ReflectionParameters): Fix logic to determine
8356         whether the last parameter is a params one. Test 9 passes again.
8357
8358         * delegate.cs (Populate): Register the builders we define with
8359         RegisterParameterForBuilder. Test 19 passes again.
8360
8361         * cs-parser.jay (property_declaration): Reference $6 instead
8362         of $$ to get at the location.
8363
8364         (indexer_declaration): Similar stuff.
8365
8366         (attribute): Ditto.
8367
8368         * class.cs (Property): Register parameters for the Get and Set methods
8369         if they exist. Test 23 passes again.
8370
8371         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
8372         call to EmitArguments as we are sure there aren't any params arguments. 
8373         Test 32 passes again.
8374
8375         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
8376         IndexOutOfRangeException. 
8377
8378         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
8379         Test 33 now passes again.
8380         
8381 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
8382
8383         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
8384         broke a bunch of things.  Will have to come up with a better way
8385         of tracking locations.
8386
8387         * statement.cs: Implemented foreach for single dimension arrays.
8388
8389 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
8390
8391         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
8392         an error.  This removes the lookup from the critical path.
8393
8394         * cs-parser.jay: Removed use of temporary_loc, which is completely
8395         broken. 
8396
8397 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
8398
8399         * support.cs (ReflectionParameters.ParameterModifier): Report
8400         whether the argument is a PARAMS argument or not.
8401
8402         * class.cs: Set the attribute `ParamArrayAttribute' on the
8403         parameter argument.
8404
8405         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
8406         and cons_param_array_attribute (ConstructorInfo for
8407         ParamArrayAttribute)., 
8408
8409         * codegen.cs: Emit the return using the `Return' statement, that
8410         way we can report the error correctly for missing return values. 
8411
8412         * class.cs (Method.Emit): Clean up.
8413
8414         * expression.cs (Argument.Resolve): Take another argument: the
8415         location where this argument is used.  Notice that this is not
8416         part of the "Argument" class as to reduce the size of the
8417         structure (we know the approximate location anyways).
8418
8419         Test if the argument is a variable-reference, if not, then
8420         complain with a 206.
8421
8422         (Argument.Emit): Emit addresses of variables.
8423
8424         (Argument.FullDesc): Simplify.
8425
8426         (Invocation.DoResolve): Update for Argument.Resolve.
8427
8428         (ElementAccess.DoResolve): ditto.
8429
8430         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
8431         method should be virtual, as this method is always virtual.
8432
8433         (NewDelegate.DoResolve): Update for Argument.Resolve.
8434
8435         * class.cs (ConstructorInitializer.DoResolve): ditto.
8436         
8437         * attribute.cs (Attribute.Resolve): ditto.
8438
8439 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
8440
8441         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
8442
8443         * expression.cs (ParameterReference): Drop IStackStorage and implement
8444         IAssignMethod instead. 
8445
8446         (LocalVariableReference): ditto.
8447         
8448         * ecore.cs (FieldExpr): Drop IStackStorage and implement
8449         IAssignMethod instead. 
8450
8451 2001-11-13  Miguel de Icaza <miguel@ximian.com>
8452
8453         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
8454         enumerations that are used in heavily used structures derive from
8455         byte in a laughable and pathetic attempt to reduce memory usage.
8456         This is the kind of pre-optimzations that you should not do at
8457         home without adult supervision.
8458
8459         * expression.cs (UnaryMutator): New class, used to handle ++ and
8460         -- separatedly from the other unary operators.  Cleans up the
8461         code, and kills the ExpressionStatement dependency in Unary.
8462
8463         (Unary): Removed `method' and `Arguments' from this class, making
8464         it smaller, and moving it all to SimpleCall, so I can reuse this
8465         code in other locations and avoid creating a lot of transient data
8466         strucutres when not required.
8467
8468         * cs-parser.jay: Adjust for new changes.
8469
8470 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
8471
8472         * enum.cs (Enum.Populate): If there is a failure during
8473         definition, return
8474
8475         * cs-parser.jay (opt_enum_base): we used to catch type errors
8476         here, but this is really incorrect.  The type error should be
8477         catched during semantic analysis.
8478
8479 2001-12-11  Ravi Pratap  <ravi@ximian.com>
8480
8481         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
8482         current_local_parameters as expected since I, in my stupidity, had forgotten
8483         to do this :-)
8484
8485         * attribute.cs (GetValidPlaces): Fix stupid bug.
8486
8487         * class.cs (Method::Emit): Perform check on applicability of attributes.
8488
8489         (Constructor::Emit): Ditto.
8490
8491         (Field::Emit): Ditto.
8492
8493         (Field.Location): Store location information.
8494
8495         (Property, Event, Indexer, Operator): Ditto.
8496
8497         * cs-parser.jay (field_declaration): Pass in location for each field.
8498
8499         * ../errors/cs0592.cs : Add.
8500
8501 2001-11-12  Ravi Pratap  <ravi@ximian.com>
8502
8503         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
8504
8505         (InitCoreTypes): Update accordingly.
8506
8507         (RegisterAttrType, LookupAttr): Implement.
8508
8509         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
8510         info about the same.
8511
8512         (Resolve): Update to populate the above as necessary.
8513
8514         (Error592): Helper.
8515
8516         (GetValidPlaces): Helper to the above.
8517
8518         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
8519
8520         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
8521
8522 2001-11-12  Ravi Pratap  <ravi@ximian.com>
8523
8524         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
8525
8526         * ../errors/cs0617.cs : Add.
8527
8528 2001-11-11  Ravi Pratap  <ravi@ximian.com>
8529
8530         * enum.cs (Emit): Rename to Populate to be more consistent with what
8531         we expect it to do and when exactly it is called.
8532
8533         * class.cs, rootcontext.cs : Update accordingly.
8534
8535         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
8536         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
8537
8538         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
8539
8540         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
8541         of a fieldinfo using the above, when dealing with a FieldBuilder.
8542
8543 2001-11-10  Ravi Pratap  <ravi@ximian.com>
8544
8545         * ../errors/cs0031.cs : Add.
8546
8547         * ../errors/cs1008.cs : Add.
8548
8549         * ../errrors/cs0543.cs : Add.
8550
8551         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
8552         enum type.
8553
8554         (FindMembers): Implement.
8555
8556         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
8557         enums and delegates too.
8558
8559         (enum_types): Rename to builder_to_enum.
8560
8561         (delegate_types): Rename to builder_to_delegate.
8562
8563         * delegate.cs (FindMembers): Implement.
8564
8565 2001-11-09  Ravi Pratap  <ravi@ximian.com>
8566
8567         * typemanager.cs (IsEnumType): Implement.
8568
8569         * enum.cs (Emit): Re-write parts to account for the underlying type
8570         better and perform checking etc.
8571
8572         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
8573         of the underlying type.
8574
8575         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
8576         value
8577
8578         * enum.cs (error31): Helper to report error #31.
8579
8580         * cs-parser.jay (enum_declaration): Store location of each member too.
8581
8582         * enum.cs (member_to_location): New hashtable. 
8583
8584         (AddEnumMember): Update location hashtable.
8585
8586         (Emit): Use the location of each member while reporting errors.
8587
8588 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
8589
8590         * cs-parser.jay: A for_initializer if is a
8591         local_variable_declaration really ammount to have an implicit
8592         block with the variable declaration and no initializer for for.
8593
8594         * statement.cs (For.Emit): Cope with null initializers.
8595
8596         This fixes the infinite loop on for initializers.
8597
8598 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
8599
8600         * enum.cs: More cleanup.
8601
8602         * ecore.cs: Remove dead code.
8603
8604         * class.cs (Property.Emit): More simplification.
8605         (Event.Emit): ditto.
8606
8607         Reworked to have less levels of indentation.
8608         
8609 2001-11-08  Ravi Pratap  <ravi@ximian.com>
8610
8611         * class.cs (Property): Emit attributes.
8612
8613         (Field): Ditto.
8614         
8615         (Event): Ditto.
8616
8617         (Indexer): Ditto.
8618
8619         (Operator): Ditto.
8620
8621         * enum.cs (Emit): Ditto.
8622
8623         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
8624         Enums too.
8625
8626         * class.cs (Field, Event, etc.): Move attribute generation into the
8627         Emit method everywhere.
8628
8629         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
8630         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
8631         as we had no way of defining nested enums !
8632
8633         * rootcontext.cs : Adjust code accordingly.
8634
8635         * typemanager.cs (AddEnumType): To keep track of enum types separately.
8636
8637 2001-11-07  Ravi Pratap  <ravi@ximian.com>
8638
8639         * expression.cs (EvalConstantExpression): Move into ecore.cs
8640         
8641         * enum.cs (Enum): Rename some members and make them public and readonly
8642         according to our convention.
8643
8644         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
8645         nothing else.
8646
8647         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
8648
8649         (Enum::Emit): Write a simple version for now which doesn't try to compute
8650         expressions. I shall modify this to be more robust in just a while.
8651
8652         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
8653
8654         (TypeContainer::CloseType): Create the Enum types too.
8655
8656         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
8657
8658         * expression.cs (EvalConstantExpression): Get rid of completely.
8659
8660         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
8661         user-defined values and other cases.
8662
8663         (IsValidEnumLiteral): Helper function.
8664
8665         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
8666         out there in the case we had a literal FieldExpr.
8667
8668         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
8669
8670         (Literalize): Revamp a bit to take two arguments.
8671         
8672         (EnumLiteral): New class which derives from Literal to wrap enum literals.
8673         
8674 2001-11-06  Ravi Pratap  <ravi@ximian.com>
8675
8676         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
8677
8678         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
8679
8680         (Resolve): Use the above to ensure we have proper initializers.
8681
8682 2001-11-05  Ravi Pratap  <ravi@ximian.com>
8683
8684         * expression.cs (Expression::EvalConstantExpression): New method to 
8685         evaluate constant expressions.
8686
8687         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
8688
8689 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
8690
8691         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
8692         in an array.
8693
8694         (Binary.ResolveOperator): Handle operator != (object a, object b)
8695         and operator == (object a, object b);
8696
8697         (Binary.DoNumericPromotions): Indicate whether the numeric
8698         promotion was possible.
8699
8700         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
8701         Implement.  
8702
8703         Made the ArrayAccess implement interface IAssignMethod instead of
8704         IStackStore as the order in which arguments are passed reflects
8705         this.
8706
8707         * assign.cs: Instead of using expr.ExprClass to select the way of
8708         assinging, probe for the IStackStore/IAssignMethod interfaces.
8709
8710         * typemanager.cs: Load InitializeArray definition.
8711
8712         * rootcontext.cs (RootContext.MakeStaticData): Used to define
8713         static data that can be used to initialize arrays. 
8714
8715 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
8716
8717         * expression.cs: Handle operator== and operator!= for booleans.
8718
8719         (Conditioal.Reduce): Implement reducer for the ?: operator.
8720
8721         (Conditional.Resolve): Implement dead code elimination.
8722
8723         (Binary.Resolve): Catch string literals and return a new
8724         concatenated string.
8725
8726         (Unary.Reduce): Implement reduction of unary expressions.
8727
8728         * ecore.cs: Split out the expression core handling here.
8729
8730         (Expression.Reduce): New method used to perform constant folding
8731         and CSE.  This is needed to support constant-expressions. 
8732         
8733         * statement.cs (Statement.EmitBoolExpression): Pass true and false
8734         targets, and optimize for !x.
8735
8736 2001-11-04  Ravi Pratap  <ravi@ximian.com>
8737
8738         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
8739         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
8740         set custom atttributes.
8741
8742         * literal.cs (Literal::GetValue): New abstract method to return the actual
8743         value of the literal, cast as an object.
8744
8745         (*Literal): Implement GetValue method.
8746
8747         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
8748         expressions to the arraylist but objects of type Argument.
8749
8750         * class.cs (TypeContainer::Emit): Emit our attributes too.
8751
8752         (Method::Emit, Constructor::Emit): Ditto.
8753
8754         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
8755         to be ignoring earlier.
8756
8757 2001-11-03  Ravi Pratap  <ravi@ximian.com>
8758
8759         * attribute.cs (AttributeSection::Define): Implement to do the business
8760         of constructing a CustomAttributeBuilder.
8761
8762         (Attribute): New trivial class. Increases readability of code.  
8763
8764         * cs-parser.jay : Update accordingly.
8765
8766         (positional_argument_list, named_argument_list, named_argument): New rules
8767
8768         (attribute_arguments): Use the above so that we are more correct.
8769         
8770 2001-11-02  Ravi Pratap  <ravi@ximian.com>
8771         
8772         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
8773         to perform all checks for a method with a params parameter.
8774
8775         (Invocation::OverloadResolve): Update to use the above method and therefore
8776         cope correctly with params method invocations.
8777
8778         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
8779         params too.
8780
8781         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
8782         constructors in our parent too because we can't afford to miss out on 
8783         protected ones ;-)
8784
8785         * attribute.cs (AttributeSection): New name for the class Attribute
8786
8787         Other trivial changes to improve readability.
8788
8789         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
8790         use the new class names.
8791         
8792 2001-11-01  Ravi Pratap  <ravi@ximian.com>
8793
8794         * class.cs (Method::Define): Complete definition for params types too
8795
8796         (Indexer::Define): Ditto.
8797
8798         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
8799         Cope everywhere with a request for info about the array parameter.
8800
8801 2001-11-01  Ravi Pratap  <ravi@ximian.com>
8802
8803         * tree.cs (RecordNamespace): Fix up to check for the correct key.
8804
8805         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
8806         local_variable_type to extract the string corresponding to the type.
8807
8808         (local_variable_type): Fixup the action to use the new helper method.
8809
8810         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
8811         go.
8812
8813         * expression.cs : Clean out code which uses the above.
8814
8815 2001-10-31  Ravi Pratap  <ravi@ximian.com>
8816         
8817         * typemanager.cs (RegisterMethod): Check if we already have an existing key
8818         and bale out if necessary by returning a false.
8819
8820         (RegisterProperty): Ditto.
8821
8822         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
8823         and print out appropriate error messages.
8824
8825         * interface.cs (everywhere): Ditto.
8826
8827         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
8828         location to constructor.
8829
8830         * class.cs (Property, Event, Indexer): Update accordingly.
8831
8832         * ../errors/cs111.cs : Added.
8833
8834         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
8835         of a method, as laid down by the spec.
8836
8837         (Invocation::OverloadResolve): Use the above method.
8838
8839 2001-10-31  Ravi Pratap  <ravi@ximian.com>
8840
8841         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
8842         now take a TypeContainer and a Parameters object.
8843
8844         (ParameterData): Modify return type of ParameterModifier method to be 
8845         Parameter.Modifier and not a string.
8846
8847         (ReflectionParameters, InternalParameters): Update accordingly.
8848
8849         * expression.cs (Argument::GetParameterModifier): Same here.
8850
8851         * support.cs (InternalParameters::ParameterType): Find a better way of determining
8852         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
8853         symbol in it at all so maybe this is only for now.
8854
8855 2001-10-30  Ravi Pratap  <ravi@ximian.com>
8856
8857         * support.cs (InternalParameters): Constructor now takes an extra argument 
8858         which is the actual Parameters class.
8859
8860         (ParameterDesc): Update to provide info on ref/out modifiers.
8861
8862         * class.cs (everywhere): Update call to InternalParameters to pass in
8863         the second argument too.
8864
8865         * support.cs (ParameterData): Add ParameterModifier, which is a method 
8866         to return the modifier info [ref/out etc]
8867
8868         (InternalParameters, ReflectionParameters): Implement the above.
8869
8870         * expression.cs (Argument::ParameterModifier): Similar function to return
8871         info about the argument's modifiers.
8872
8873         (Invocation::OverloadResolve): Update to take into account matching modifiers 
8874         too.
8875
8876         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
8877         a new SetFormalParameters object which we pass to InternalParameters.
8878
8879 2001-10-30  Ravi Pratap  <ravi@ximian.com>
8880
8881         * expression.cs (NewArray): Merge into the ArrayCreation class.
8882
8883 2001-10-29  Ravi Pratap  <ravi@ximian.com>
8884
8885         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
8886         NewUserdefinedArray into one as there wasn't much of a use in having
8887         two separate ones.
8888
8889         * expression.cs (Argument): Change field's name to ArgType from Type.
8890
8891         (Type): New readonly property which returns the proper type, taking into 
8892         account ref/out modifiers.
8893
8894         (everywhere): Adjust code accordingly for the above.
8895
8896         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
8897         whether we are emitting for a ref or out parameter.
8898
8899         * expression.cs (Argument::Emit): Use the above field to set the state.
8900
8901         (LocalVariableReference::Emit): Update to honour the flag and emit the
8902         right stuff.
8903
8904         * parameter.cs (Attributes): Set the correct flags for ref parameters.
8905
8906         * expression.cs (Argument::FullDesc): New function to provide a full desc.
8907
8908         * support.cs (ParameterData): Add method ParameterDesc to the interface.
8909
8910         (ReflectionParameters, InternalParameters): Implement the above method.
8911
8912         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
8913         reporting errors.
8914
8915         (Invocation::FullMethodDesc): Ditto. 
8916
8917 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
8918
8919         * cs-parser.jay: Add extra production for the second form of array
8920         creation. 
8921
8922         * expression.cs (ArrayCreation): Update to reflect the above
8923         change. 
8924
8925         * Small changes to prepare for Array initialization.
8926
8927 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
8928
8929         * typemanager.cs (ImplementsInterface): interface might be null;
8930         Deal with this problem;
8931
8932         Also, we do store negative hits on the cache (null values), so use
8933         this instead of calling t.GetInterfaces on the type everytime.
8934
8935 2001-10-28  Ravi Pratap  <ravi@ximian.com>
8936
8937         * typemanager.cs (IsBuiltinType): New method to help determine the same.
8938
8939         * expression.cs (New::DoResolve): Get rid of array creation code and instead
8940         split functionality out into different classes.
8941
8942         (New::FormArrayType): Move into NewBuiltinArray.
8943
8944         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
8945         quite useless.
8946
8947         (NewBuiltinArray): New class to handle creation of built-in arrays.
8948
8949         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
8950         account creation of one-dimensional arrays.
8951
8952         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
8953
8954         (NewUserdefinedArray::DoResolve): Implement.
8955
8956         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
8957
8958         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
8959         we maintain inside the TypeManager. This is necessary to perform lookups on the
8960         module builder.
8961
8962         (LookupType): Update to perform GetType on the module builders too.     
8963
8964         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
8965
8966         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
8967
8968 2001-10-23  Ravi Pratap  <ravi@ximian.com>
8969
8970         * expression.cs (New::DoResolve): Implement guts of array creation.
8971
8972         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
8973         
8974 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
8975
8976         * expression.cs: Fix bug I introduced lsat night that broke
8977         Delegates. 
8978
8979         (Expression.Resolve): Report a 246 error (can not resolve name)
8980         if we find a SimpleName in the stream.
8981         
8982         (Expression.ResolveLValue): Ditto.
8983         
8984         (Expression.ResolveWithSimpleName): This function is a variant of
8985         ResolveName, this one allows SimpleNames to be returned without a
8986         warning.  The only consumer of SimpleNames is MemberAccess
8987
8988 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
8989
8990         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
8991         might arrive here.  I have my doubts that this is correct.
8992
8993         * statement.cs (Lock): Implement lock statement.
8994
8995         * cs-parser.jay: Small fixes to support `lock' and `using'
8996
8997         * cs-tokenizer.cs: Remove extra space
8998
8999         * driver.cs: New flag --checked, allows to turn on integer math
9000         checking. 
9001
9002         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
9003         Threading.Monitor.Exit 
9004         
9005 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
9006
9007         * expression.cs (IndexerAccess::DoResolveLValue): Set the
9008         Expression Class to be IndexerAccess.
9009
9010         Notice that Indexer::DoResolve sets the eclass to Value.
9011
9012 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
9013
9014         * class.cs (TypeContainer::Emit): Emit code for indexers.
9015
9016         * assign.cs (IAssignMethod): New interface implemented by Indexers
9017         and Properties for handling assignment.
9018
9019         (Assign::Emit): Simplify and reuse code. 
9020         
9021         * expression.cs (IndexerAccess, PropertyExpr): Implement
9022         IAssignMethod, clean up old code. 
9023
9024 2001-10-22  Ravi Pratap  <ravi@ximian.com>
9025
9026         * typemanager.cs (ImplementsInterface): New method to determine if a type
9027         implements a given interface. Provides a nice cache too.
9028
9029         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
9030         method.
9031
9032         (ConvertReferenceExplicit): Ditto.
9033
9034         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
9035         various methods, with correct names etc.
9036
9037         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
9038         Operator.UnaryNegation.
9039
9040         * cs-parser.jay (operator_declarator): Be a little clever in the case where
9041         we have a unary plus or minus operator.
9042
9043         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
9044         UnaryMinus.
9045
9046         * everywhere : update accordingly.
9047
9048         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
9049         respectively.
9050
9051         * class.cs (Method::Define): For the case where we are implementing a method
9052         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
9053         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
9054         
9055 2001-10-21  Ravi Pratap  <ravi@ximian.com>
9056
9057         * interface.cs (FindMembers): Implement to work around S.R.E
9058         lameness.
9059
9060         * typemanager.cs (IsInterfaceType): Implement.
9061
9062         (FindMembers): Update to handle interface types too.
9063
9064         * expression.cs (ImplicitReferenceConversion): Re-write bits which
9065         use IsAssignableFrom as that is not correct - it doesn't work.
9066
9067         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
9068         and accordingly override EmitStatement.
9069
9070         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
9071         using the correct logic :-)
9072
9073 2001-10-19  Ravi Pratap  <ravi@ximian.com>
9074
9075         * ../errors/cs-11.cs : Add to demonstrate error -11 
9076
9077 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
9078
9079         * assign.cs (Assign::Resolve): Resolve right hand side first, and
9080         then pass this as a hint to ResolveLValue.
9081         
9082         * expression.cs (FieldExpr): Add Location information
9083
9084         (FieldExpr::LValueResolve): Report assignment to readonly
9085         variable. 
9086         
9087         (Expression::ExprClassFromMemberInfo): Pass location information.
9088
9089         (Expression::ResolveLValue): Add new method that resolves an
9090         LValue. 
9091
9092         (Expression::DoResolveLValue): Default invocation calls
9093         DoResolve. 
9094
9095         (Indexers): New class used to keep track of indexers in a given
9096         Type. 
9097
9098         (IStackStore): Renamed from LValue, as it did not really describe
9099         what this did.  Also ResolveLValue is gone from this interface and
9100         now is part of Expression.
9101
9102         (ElementAccess): Depending on the element access type
9103         
9104         * typemanager.cs: Add `indexer_name_type' as a Core type
9105         (System.Runtime.CompilerServices.IndexerNameAttribute)
9106
9107         * statement.cs (Goto): Take a location.
9108         
9109 2001-10-18  Ravi Pratap  <ravi@ximian.com>
9110
9111         * delegate.cs (Delegate::VerifyDelegate): New method to verify
9112         if two delegates are compatible.
9113
9114         (NewDelegate::DoResolve): Update to take care of the case when
9115         we instantiate a delegate from another delegate.
9116
9117         * typemanager.cs (FindMembers): Don't even try to look up members
9118         of Delegate types for now.
9119
9120 2001-10-18  Ravi Pratap  <ravi@ximian.com>
9121
9122         * delegate.cs (NewDelegate): New class to take care of delegate
9123         instantiation.
9124
9125         * expression.cs (New): Split the delegate related code out into 
9126         the NewDelegate class.
9127
9128         * delegate.cs (DelegateInvocation): New class to handle delegate 
9129         invocation.
9130
9131         * expression.cs (Invocation): Split out delegate related code into
9132         the DelegateInvocation class.
9133
9134 2001-10-17  Ravi Pratap  <ravi@ximian.com>
9135
9136         * expression.cs (New::DoResolve): Implement delegate creation fully
9137         and according to the spec.
9138
9139         (New::DoEmit): Update to handle delegates differently.
9140
9141         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
9142         because of which we were printing out arguments in reverse order !
9143
9144         * delegate.cs (VerifyMethod): Implement to check if the given method
9145         matches the delegate.
9146
9147         (FullDelegateDesc): Implement.
9148
9149         (VerifyApplicability): Implement.
9150
9151         * expression.cs (Invocation::DoResolve): Update to accordingly handle
9152         delegate invocations too.
9153
9154         (Invocation::Emit): Ditto.
9155
9156         * ../errors/cs1593.cs : Added.
9157
9158         * ../errors/cs1594.cs : Added.
9159
9160         * delegate.cs (InstanceExpression, TargetMethod): New properties.
9161
9162 2001-10-16  Ravi Pratap  <ravi@ximian.com>
9163
9164         * typemanager.cs (intptr_type): Core type for System.IntPtr
9165
9166         (InitCoreTypes): Update for the same.
9167
9168         (iasyncresult_type, asynccallback_type): Ditto.
9169
9170         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
9171         correct.
9172
9173         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
9174         too.
9175
9176         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
9177         the builders for the 4 members of a delegate type :-)
9178
9179         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
9180         type.
9181
9182         * expression.cs (New::DoResolve): Implement guts for delegate creation.
9183
9184         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
9185
9186 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
9187
9188         * statement.cs (Break::Emit): Implement.   
9189         (Continue::Emit): Implement.
9190
9191         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9192         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9193         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9194         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
9195         end loop
9196         
9197         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
9198         properties that track the label for the current loop (begin of the
9199         loop and end of the loop).
9200
9201 2001-10-15  Ravi Pratap  <ravi@ximian.com>
9202
9203         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
9204         use of emitting anything at all.
9205
9206         * class.cs, rootcontext.cs : Get rid of calls to the same.
9207
9208         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
9209
9210         (Populate): Define the constructor correctly and set the implementation
9211         attributes.
9212
9213         * typemanager.cs (delegate_types): New hashtable to hold delegates that
9214         have been defined.
9215
9216         (AddDelegateType): Implement.
9217
9218         (IsDelegateType): Implement helper method.
9219
9220         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
9221
9222         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
9223         and accordingly handle it.
9224
9225         * delegate.cs (Populate): Take TypeContainer argument.
9226         Implement bits to define the Invoke method. However, I still haven't figured out
9227         how to take care of the native int bit :-(
9228
9229         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
9230         Qualify the name of the delegate, not its return type !
9231
9232         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
9233         conversion.
9234
9235         (StandardConversionExists): Checking for array types turns out to be recursive.
9236
9237         (ConvertReferenceExplicit): Implement array conversion.
9238
9239         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
9240         
9241 2001-10-12  Ravi Pratap  <ravi@ximian.com>
9242
9243         * cs-parser.jay (delegate_declaration): Store the fully qualified
9244         name as it is a type declaration.
9245
9246         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
9247         readonly.
9248
9249         (DefineDelegate): Renamed from Define. Does the same thing essentially,
9250         as TypeContainer::DefineType.
9251
9252         (Populate): Method in which all the definition of the various methods (Invoke)
9253         etc is done.
9254
9255         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
9256         see.
9257         
9258         (CloseDelegate): Finally creates the delegate.
9259
9260         * class.cs (TypeContainer::DefineType): Update to define delegates.
9261         (Populate, Emit and CloseType): Do the same thing here too.
9262
9263         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
9264         delegates in all these operations.
9265
9266 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
9267
9268         * expression.cs: LocalTemporary: a new expression used to
9269         reference a temporary that has been created.
9270
9271         * assign.cs: Handle PropertyAccess back here, so that we can
9272         provide the proper semantic access to properties.
9273
9274         * expression.cs (Expression::ConvertReferenceExplicit): Implement
9275         a few more explicit conversions. 
9276
9277         * modifiers.cs: `NEW' modifier maps to HideBySig.
9278
9279         * expression.cs (PropertyExpr): Make this into an
9280         ExpressionStatement, and support the EmitStatement code path. 
9281
9282         Perform get/set error checking, clean up the interface.
9283
9284         * assign.cs: recognize PropertyExprs as targets, and if so, turn
9285         them into toplevel access objects.
9286
9287 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
9288
9289         * expression.cs: PropertyExpr::PropertyExpr: use work around the
9290         SRE.
9291
9292         * typemanager.cs: Keep track here of our PropertyBuilders again to
9293         work around lameness in SRE.
9294
9295 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
9296
9297         * expression.cs (LValue::LValueResolve): New method in the
9298         interface, used to perform a second resolution pass for LValues. 
9299         
9300         (This::DoResolve): Catch the use of this in static methods.
9301
9302         (This::LValueResolve): Implement.
9303
9304         (This::Store): Remove warning, assigning to `this' in structures
9305         is 
9306
9307         (Invocation::Emit): Deal with invocation of
9308         methods on value types.  We need to pass the address to structure
9309         methods rather than the object itself.  (The equivalent code to
9310         emit "this" for structures leaves the entire structure on the
9311         stack instead of a pointer to it). 
9312
9313         (ParameterReference::DoResolve): Compute the real index for the
9314         argument based on whether the method takes or not a `this' pointer
9315         (ie, the method is static).
9316
9317         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
9318         value types returned from functions when we need to invoke a
9319         method on the sturcture.
9320         
9321
9322 2001-10-11  Ravi Pratap  <ravi@ximian.com>
9323
9324         * class.cs (TypeContainer::DefineType): Method to actually do the business of
9325         defining the type in the Modulebuilder or Typebuilder. This is to take
9326         care of nested types which need to be defined on the TypeBuilder using
9327         DefineNestedMethod.
9328
9329         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
9330         methods in RootContext, only ported to be part of TypeContainer.
9331
9332         (TypeContainer::GetInterfaceOrClass): Ditto.
9333
9334         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
9335
9336         * interface.cs (Interface::DefineInterface): New method. Does exactly
9337         what RootContext.CreateInterface did earlier, only it takes care of nested types 
9338         too.
9339
9340         (Interface::GetInterfaces): Move from RootContext here and port.
9341
9342         (Interface::GetInterfaceByName): Same here.
9343
9344         * rootcontext.cs (ResolveTree): Re-write.
9345
9346         (PopulateTypes): Re-write.
9347
9348         * class.cs (TypeContainer::Populate): Populate nested types too.
9349         (TypeContainer::Emit): Emit nested members too.
9350
9351         * typemanager.cs (AddUserType): Do not make use of the FullName property,
9352         instead just use the name argument passed in as it is already fully
9353         qualified.
9354
9355         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
9356         to TypeContainer mapping to see if a type is user-defined.
9357
9358         * class.cs (TypeContainer::CloseType): Implement. 
9359
9360         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
9361         the default constructor.
9362         
9363         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
9364         twice.
9365
9366         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
9367
9368         * interface.cs (CloseType): Create the type here.
9369         
9370         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
9371         the hierarchy.
9372
9373         Remove all the methods which are now in TypeContainer.
9374
9375 2001-10-10  Ravi Pratap  <ravi@ximian.com>
9376
9377         * delegate.cs (Define): Re-write bits to define the delegate
9378         correctly.
9379
9380 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
9381
9382         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
9383
9384         * expression.cs (ImplicitReferenceConversion): handle null as well
9385         as a source to convert to any reference type.
9386
9387         * statement.cs (Return): Perform any implicit conversions to
9388         expected return type.  
9389
9390         Validate use of return statement.  
9391
9392         * codegen.cs (EmitContext): Pass the expected return type here.
9393
9394         * class.cs (Method, Constructor, Property): Pass expected return
9395         type to EmitContext.
9396
9397 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
9398
9399         * expression.cs: Make DoResolve take an EmitContext instead of a
9400         TypeContainer.
9401
9402         Replaced `l' and `location' for `loc', for consistency.
9403         
9404         (Error, Warning): Remove unneeded Tc argument.
9405
9406         * assign.cs, literal.cs, constant.cs: Update to new calling
9407         convention. 
9408         
9409         * codegen.cs: EmitContext now contains a flag indicating whether
9410         code is being generated in a static method or not.
9411
9412         * cs-parser.jay: DecomposeQI, new function that replaces the old
9413         QualifiedIdentifier.  Now we always decompose the assembled
9414         strings from qualified_identifier productions into a group of
9415         memberaccesses.
9416
9417 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
9418
9419         * rootcontext.cs: Deal with field-less struct types correctly now
9420         by passing the size option to Define Type.
9421
9422         * class.cs: Removed hack that created one static field. 
9423
9424 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
9425
9426         * statement.cs: Moved most of the code generation here. 
9427
9428 2001-10-09  Ravi Pratap  <ravi@ximian.com>
9429
9430         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
9431         seem very right.
9432
9433         (ElementAccess): Remove useless bits for now - keep checks as the spec
9434         says.
9435
9436 2001-10-08  Ravi Pratap  <ravi@ximian.com>
9437
9438         * expression.cs (ElementAccess::DoResolve): Remove my crap code
9439         and start performing checks according to the spec.
9440
9441 2001-10-07  Ravi Pratap  <ravi@ximian.com>
9442
9443         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
9444         rank_specifiers instead.
9445
9446         (rank_specifiers): Change the order in which the rank specifiers are stored
9447
9448         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
9449
9450         * expression.cs (ElementAccess): Implement the LValue interface too.
9451         
9452 2001-10-06  Ravi Pratap  <ravi@ximian.com>
9453         
9454         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
9455         except that user defined conversions are not included.
9456
9457         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
9458         perform the conversion of the return type, if necessary.
9459
9460         (New::DoResolve): Check whether we are creating an array or an object
9461         and accordingly do the needful.
9462
9463         (New::Emit): Same here.
9464
9465         (New::DoResolve): Implement guts of array creation.
9466
9467         (New::FormLookupType): Helper function.
9468
9469 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
9470
9471         * codegen.cs: Removed most of the code generation here, and move the
9472         corresponding code generation bits to the statement classes. 
9473
9474         Added support for try/catch/finalize and throw.
9475         
9476         * cs-parser.jay: Added support for try/catch/finalize.
9477
9478         * class.cs: Catch static methods having the flags override,
9479         virtual or abstract.
9480
9481         * expression.cs (UserCast): This user cast was not really doing
9482         what it was supposed to do.  Which is to be born in fully resolved
9483         state.  Parts of the resolution were being performed at Emit time! 
9484
9485         Fixed this code.
9486
9487 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
9488
9489         * expression.cs: Implicity convert the result from UserCast.
9490
9491 2001-10-05  Ravi Pratap  <ravi@ximian.com>
9492
9493         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
9494         prevented it from working correctly. 
9495
9496         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
9497         merely ConvertImplicit.
9498
9499 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
9500
9501         * typemanager.cs: Make the LookupTypeContainer function static,
9502         and not per-instance.  
9503
9504         * class.cs: Make static FindMembers (the one that takes a Type
9505         argument). 
9506
9507         * codegen.cs: Add EmitForeach here.
9508
9509         * cs-parser.jay: Make foreach a toplevel object instead of the
9510         inline expansion, as we need to perform semantic analysis on it. 
9511
9512 2001-10-05  Ravi Pratap  <ravi@ximian.com>
9513
9514         * expression.cs (Expression::ImplicitUserConversion): Rename to
9515         UserDefinedConversion.
9516
9517         (Expression::UserDefinedConversion): Take an extra argument specifying 
9518         whether we look for explicit user conversions too.
9519
9520         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
9521
9522         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
9523
9524         (ExplicitUserConversion): Make it a call to UserDefinedConversion
9525         with the appropriate arguments.
9526
9527         * cs-parser.jay (cast_expression): Record location too.
9528
9529         * expression.cs (Cast): Record location info.
9530
9531         (Expression::ConvertExplicit): Take location argument.
9532
9533         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
9534         to determine if we are doing explicit conversions.
9535
9536         (UserCast::Emit): Update accordingly.
9537
9538         (Expression::ConvertExplicit): Report an error if everything fails.
9539
9540         * ../errors/cs0030.cs : Add.
9541
9542 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
9543
9544         * modifiers.cs: If the ABSTRACT keyword is present, also set the
9545         virtual and newslot bits. 
9546
9547         * class.cs (TypeContainer::RegisterRequiredImplementations):
9548         Record methods we need.
9549
9550         (TypeContainer::MakeKey): Helper function to make keys for
9551         MethodBases, since the Methodbase key is useless.
9552
9553         (TypeContainer::Populate): Call RegisterRequiredImplementations
9554         before defining the methods.   
9555
9556         Create a mapping for method_builders_to_methods ahead of time
9557         instead of inside a tight loop.
9558
9559         (::RequireMethods):  Accept an object as the data to set into the
9560         hashtable so we can report interface vs abstract method mismatch.
9561
9562 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
9563
9564         * report.cs: Make all of it static.
9565
9566         * rootcontext.cs: Drop object_type and value_type computations, as
9567         we have those in the TypeManager anyways.
9568
9569         Drop report instance variable too, now it is a global.
9570
9571         * driver.cs: Use try/catch on command line handling.
9572
9573         Add --probe option to debug the error reporting system with a test
9574         suite. 
9575
9576         * report.cs: Add support for exiting program when a probe
9577         condition is reached.
9578
9579 2001-10-03  Ravi Pratap  <ravi@ximian.com>
9580
9581         * expression.cs (Binary::DoNumericPromotions): Fix the case when
9582         we do a forcible conversion regardless of type, to check if 
9583         ForceConversion returns a null.
9584
9585         (Binary::error19): Use location to report error.
9586
9587         (Unary::error23): Use location here too.
9588
9589         * ../errors/cs0019.cs : Check in.
9590
9591         * ../errors/cs0023.cs : Check in.
9592
9593         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
9594         case of a non-null MethodInfo object with a length of 0 !
9595
9596         (Binary::ResolveOperator): Flag error if overload resolution fails to find
9597         an applicable member - according to the spec :-)
9598         Also fix logic to find members in base types.
9599
9600         (Unary::ResolveOperator): Same here.
9601
9602         (Unary::report23): Change name to error23 and make first argument a TypeContainer
9603         as I was getting thoroughly confused between this and error19 :-)
9604         
9605         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
9606         (::FindMostEncompassedType): Implement.
9607         (::FindMostEncompassingType): Implement.
9608         (::StandardConversionExists): Implement.
9609
9610         (UserImplicitCast): Re-vamp. We now need info about most specific
9611         source and target types so that we can do the necessary conversions.
9612
9613         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
9614         mathematical union with no duplicates.
9615
9616 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
9617
9618         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
9619         in order from base classes to child classes, so that we can in
9620         child classes look up in our parent for method names and
9621         attributes (required for handling abstract, virtual, new, override
9622         constructs: we need to instrospect our base class, and if we dont
9623         populate the classes in order, the introspection might be
9624         incorrect.  For example, a method could query its parent before
9625         the parent has any methods and would determine that the parent has
9626         no abstract methods (while it could have had them)).
9627
9628         (RootContext::CreateType): Record the order in which we define the
9629         classes.
9630
9631 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
9632
9633         * class.cs (TypeContainer::Populate): Also method definitions can
9634         fail now, keep track of this.
9635
9636         (TypeContainer::FindMembers): Implement support for
9637         DeclaredOnly/noDeclaredOnly flag.
9638
9639         (Constructor::Emit) Return the ConstructorBuilder.
9640
9641         (Method::Emit) Return the MethodBuilder. 
9642         Check for abstract or virtual methods to be public.
9643
9644         * rootcontext.cs (RootContext::CreateType): Register all the
9645         abstract methods required for the class to be complete and the
9646         interface methods that must be implemented. 
9647
9648         * cs-parser.jay: Report error 501 (method requires body if it is
9649         not marked abstract or extern).
9650
9651         * expression.cs (TypeOf::Emit): Implement.
9652
9653         * typemanager.cs: runtime_handle_type, new global type.
9654
9655         * class.cs (Property::Emit): Generate code for properties.
9656
9657 2001-10-02  Ravi Pratap  <ravi@ximian.com>
9658
9659         * expression.cs (Unary::ResolveOperator): Find operators on base type
9660         too - we now conform exactly to the spec.
9661
9662         (Binary::ResolveOperator): Same here.
9663
9664         * class.cs (Operator::Define): Fix minor quirk in the tests.
9665
9666         * ../errors/cs0215.cs : Added.
9667
9668         * ../errors/cs0556.cs : Added.
9669
9670         * ../errors/cs0555.cs : Added.
9671
9672 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
9673
9674         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
9675         single integer which is really efficient
9676
9677 2001-10-01  Ravi Pratap  <ravi@ximian.com>
9678
9679         *  expression.cs (Expression::ImplicitUserConversion): Use location
9680         even in the case when we are examining True operators.
9681  
9682         * class.cs (Operator::Define): Perform extensive checks to conform
9683         with the rules for operator overloading in the spec.
9684
9685         * expression.cs (Expression::ImplicitReferenceConversion): Implement
9686         some of the other conversions mentioned in the spec.
9687
9688         * typemanager.cs (array_type): New static member for the System.Array built-in
9689         type.
9690
9691         (cloneable_interface): For System.ICloneable interface.
9692
9693         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
9694         we start resolving the tree and populating types.
9695
9696         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
9697  
9698 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
9699
9700         * expression.cs (Expression::ExprClassFromMemberInfo,
9701         Expression::Literalize): Create literal expressions from
9702         FieldInfos which are literals.
9703
9704         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
9705         type casts, because they were wrong.  The test suite in tests
9706         caught these ones.
9707
9708         (ImplicitNumericConversion): ushort to ulong requires a widening
9709         cast. 
9710
9711         Int32 constant to long requires widening cast as well.
9712
9713         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
9714         for integers because the type on the stack is not i4.
9715
9716 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
9717
9718         * expression.cs (report118): require location argument. 
9719
9720         * parameter.cs: Do not dereference potential null value.
9721
9722         * class.cs: Catch methods that lack the `new' keyword when
9723         overriding a name.  Report warnings when `new' is used without
9724         anything being there to override.
9725
9726         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
9727
9728         * class.cs: Only add constructor to hashtable if it is non-null
9729         (as now constructors can fail on define).
9730
9731         (TypeManager, Class, Struct): Take location arguments.
9732
9733         Catch field instance initialization in structs as errors.
9734
9735         accepting_filter: a new filter for FindMembers that is static so
9736         that we dont create an instance per invocation.
9737
9738         (Constructor::Define): Catch errors where a struct constructor is
9739         parameterless 
9740
9741         * cs-parser.jay: Pass location information for various new
9742         constructs. 
9743         
9744         * delegate.cs (Delegate): take a location argument.
9745
9746         * driver.cs: Do not call EmitCode if there were problesm in the
9747         Definition of the types, as many Builders wont be there. 
9748
9749         * decl.cs (Decl::Decl): Require a location argument.
9750
9751         * cs-tokenizer.cs: Handle properly hex constants that can not fit
9752         into integers, and find the most appropiate integer for it.
9753
9754         * literal.cs: Implement ULongLiteral.
9755
9756         * rootcontext.cs: Provide better information about the location of
9757         failure when CreateType fails.
9758         
9759 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
9760
9761         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
9762         as well.
9763
9764         * expression.cs (Binary::CheckShiftArguments): Add missing type
9765         computation.
9766         (Binary::ResolveOperator): Add type to the logical and and logical
9767         or, Bitwise And/Or and Exclusive Or code paths, it was missing
9768         before.
9769
9770         (Binary::DoNumericPromotions): In the case where either argument
9771         is ulong (and most signed types combined with ulong cause an
9772         error) perform implicit integer constant conversions as well.
9773
9774 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
9775
9776         * expression.cs (UserImplicitCast): Method should always be
9777         non-null. 
9778         (Invocation::BetterConversion): Simplified test for IntLiteral.
9779
9780         (Expression::ImplicitNumericConversion): Split this routine out.
9781         Put the code that performs implicit constant integer conversions
9782         here. 
9783
9784         (Expression::Resolve): Become a wrapper around DoResolve so we can
9785         check eclass and type being set after resolve.
9786
9787         (Invocation::Badness): Remove this dead function
9788
9789         (Binary::ResolveOperator): Do not compute the expensive argumnets
9790         unless we have a union for it.
9791
9792         (Probe::Emit): Is needs to do an isinst and then
9793         compare against null.
9794
9795         (::CanConvert): Added Location argument.  If the Location argument
9796         is null (Location.Null), then we do not report errors.  This is
9797         used by the `probe' mechanism of the Explicit conversion.  We do
9798         not want to generate an error for something that the user
9799         explicitly requested to be casted.  But the pipeline for an
9800         explicit cast first tests for potential implicit casts.
9801
9802         So for now, if the Location is null, it means `Probe only' to
9803         avoid adding another argument.   Might have to revise this
9804         strategy later.
9805
9806         (ClassCast): New class used to type cast objects into arbitrary
9807         classes (used in Explicit Reference Conversions).
9808
9809         Implement `as' as well.
9810
9811         Reverted all the patches from Ravi below: they were broken:
9812
9813                 * The use of `level' as a mechanism to stop recursive
9814                   invocations is wrong.  That was there just to catch the
9815                   bug with a strack trace but not as a way of addressing
9816                   the problem.
9817
9818                   To fix the problem we have to *understand* what is going
9819                   on and the interactions and come up with a plan, not
9820                   just get things going.
9821
9822                 * The use of the type conversion cache that I proposed
9823                   last night had an open topic: How does this work across
9824                   protection domains.  A user defined conversion might not
9825                   be public in the location where we are applying the
9826                   conversion, a different conversion might be selected
9827                   (ie, private A->B (better) but public B->A (worse),
9828                   inside A, A->B applies, but outside it, B->A will
9829                   apply).
9830
9831                 * On top of that (ie, even if the above is solved),
9832                   conversions in a cache need to be abstract.  Ie, `To
9833                   convert from an Int to a Short use an OpcodeCast', not
9834                   `To convert from an Int to a Short use the OpcodeCast on
9835                   the variable 5' (which is what this patch was doing).
9836         
9837 2001-09-28  Ravi Pratap  <ravi@ximian.com>
9838
9839         * expression.cs (Invocation::ConversionExists): Re-write to use
9840         the conversion cache
9841         
9842         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
9843         cache all conversions done, not just user-defined ones.
9844
9845         (Invocation::BetterConversion): The real culprit. Use ConversionExists
9846         to determine if a conversion exists instead of acutually trying to 
9847         perform the conversion. It's faster too.
9848
9849         (Expression::ConvertExplicit): Modify to use ConversionExists to check
9850         and only then attempt the implicit conversion.
9851
9852 2001-09-28  Ravi Pratap  <ravi@ximian.com>
9853
9854         * expression.cs (ConvertImplicit): Use a cache for conversions
9855         already found. Check level of recursion and bail out if necessary.
9856         
9857 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
9858
9859         * typemanager.cs (string_concat_string_string, string_concat_object_object):
9860         Export standard methods that we expect for string operations.
9861         
9862         * statement.cs (Block::UsageWarning): Track usage of variables and
9863         report the errors for not used variables.
9864
9865         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
9866         operator. 
9867
9868 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
9869
9870         * codegen.cs: remove unnneded code 
9871
9872         * expression.cs: Removed BuiltinTypeAccess class
9873
9874         Fix the order in which implicit conversions are
9875         done.  
9876
9877         The previous fixed dropped support for boxed conversions (adding a
9878         test to the test suite now)
9879
9880         (UserImplicitCast::CanConvert): Remove test for source being null,
9881         that code is broken.  We should not feed a null to begin with, if
9882         we do, then we should track the bug where the problem originates
9883         and not try to cover it up here.
9884
9885         Return a resolved expression of type UserImplicitCast on success
9886         rather than true/false.  Ravi: this is what I was talking about,
9887         the pattern is to use a static method as a "constructor" for
9888         objects. 
9889
9890         Also, do not create arguments until the very last minute,
9891         otherwise we always create the arguments even for lookups that
9892         will never be performed. 
9893
9894         (UserImplicitCast::Resolve): Eliminate, objects of type
9895         UserImplicitCast are born in a fully resolved state. 
9896         
9897         * typemanager.cs (InitCoreTypes): Init also value_type
9898         (System.ValueType). 
9899
9900         * expression.cs (Cast::Resolve): First resolve the child expression.
9901
9902         (LValue): Add new method AddressOf to be used by
9903         the `&' operator.  
9904
9905         Change the argument of Store to take an EmitContext instead of an
9906         ILGenerator, because things like FieldExpr need to be able to call
9907         their children expression to generate the instance code. 
9908
9909         (Expression::Error, Expression::Warning): Sugar functions for
9910         reporting errors.
9911
9912         (Expression::MemberLookup): Accept a TypeContainer instead of a
9913         Report as the first argument.
9914
9915         (Expression::ResolvePrimary): Killed.  I still want to improve
9916         this as currently the code is just not right.
9917
9918         (Expression::ResolveMemberAccess): Simplify, but it is still
9919         wrong. 
9920
9921         (Unary::Resolve): Catch errors in AddressOf operators.
9922
9923         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
9924         index to a byte for the short-version, or the compiler will choose
9925         the wrong Emit call, which generates the wrong data.
9926
9927         (ParameterReference::Emit, ::Store): same.
9928
9929         (FieldExpr::AddressOf): Implement.
9930         
9931         * typemanager.cs: TypeManager: made public variable instead of
9932         property.
9933         
9934         * driver.cs: document --fatal.
9935
9936         * report.cs (ErrorMessage, WarningMessage): new names for the old
9937         Error and Warning classes.
9938
9939         * cs-parser.jay (member_access): Turn built-in access to types
9940         into a normal simplename
9941
9942 2001-09-27  Ravi Pratap  <ravi@ximian.com>
9943
9944         * expression.cs (Invocation::BetterConversion): Fix to cope
9945         with q being null, since this was introducing a bug.
9946
9947         * expression.cs (ConvertImplicit): Do built-in conversions first.
9948
9949 2001-09-27  Ravi Pratap  <ravi@ximian.com>
9950
9951         * expression.cs (UserImplicitCast::Resolve): Fix bug.
9952
9953 2001-09-27  Ravi Pratap  <ravi@ximian.com>
9954
9955         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
9956         I had introduced long ago (what's new ?).
9957
9958         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
9959         the work of all the checking. 
9960         (ConvertImplicit): Call CanConvert and only then create object if necessary.
9961         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
9962
9963         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
9964         that is the right way. 
9965
9966         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
9967         overloading resolution. Use everywhere instead of cutting and pasting code.
9968
9969         (Binary::ResolveOperator): Use MakeUnionSet.
9970
9971         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
9972         we have to convert to bool types. Not complete yet.
9973         
9974 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
9975
9976         * typemanager.cs (TypeManager::CSharpName): support ushort.
9977
9978         * expression.cs (Expression::TryImplicitIntConversion): Attempts
9979         to provide an expression that performsn an implicit constant int
9980         conversion (section 6.1.6).
9981         (Expression::ConvertImplicitRequired): Reworked to include
9982         implicit constant expression conversions.
9983
9984         (Expression::ConvertNumericExplicit): Finished.
9985
9986         (Invocation::Emit): If InstanceExpression is null, then it means
9987         that we perform a call on this.
9988         
9989 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
9990
9991         * expression.cs (Unary::Emit): Remove some dead code.
9992         (Probe): Implement Resolve and Emit for `is'.
9993         (Expression::ConvertImplicitRequired): Attempt to do constant
9994         expression conversions here.  Maybe should be moved to
9995         ConvertImplicit, but I am not sure.
9996         (Expression::ImplicitLongConstantConversionPossible,
9997         Expression::ImplicitIntConstantConversionPossible): New functions
9998         that tell whether is it possible to apply an implicit constant
9999         expression conversion.
10000
10001         (ConvertNumericExplicit): Started work on explicit numeric
10002         conversions.
10003
10004         * cs-parser.jay: Update operator constants.
10005
10006         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
10007         (Parameters::GetSignature): Hook up VerifyArgs here.
10008         (Parameters::VerifyArgs): Verifies that no two arguments have the
10009         same name. 
10010
10011         * class.cs (Operator): Update the operator names to reflect the
10012         ones that the spec expects (as we are just stringizing the
10013         operator names).
10014         
10015         * expression.cs (Unary::ResolveOperator): Fix bug: Use
10016         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
10017         previous usage did only work for our methods.
10018         (Expression::ConvertImplicit): Handle decimal implicit numeric
10019         conversions as well.
10020         (Expression::InternalTypeConstructor): Used to invoke constructors
10021         on internal types for default promotions.
10022
10023         (Unary::Emit): Implement special handling for the pre/post
10024         increment/decrement for overloaded operators, as they need to have
10025         the same semantics as the other operators.
10026
10027         (Binary::ResolveOperator): ditto.
10028         (Invocation::ConversionExists): ditto.
10029         (UserImplicitCast::Resolve): ditto.
10030         
10031 2001-09-26  Ravi Pratap  <ravi@ximian.com>
10032
10033         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
10034         operator, return after emitting body. Regression tests pass again !
10035
10036         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
10037         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
10038         (Invocation::OverloadResolve): Ditto.
10039         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
10040
10041         * everywhere : update calls to the above methods accordingly.
10042
10043 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
10044
10045         * assign.cs (Assign): Make it inherit from ExpressionStatement.
10046
10047         * expression.cs (ExpressionStatement): New base class used for
10048         expressions that can appear in statements, so that we can provide
10049         an alternate path to generate expression that do not leave a value
10050         on the stack.
10051
10052         (Expression::Emit, and all the derivatives): We no longer return
10053         whether a value is left on the stack or not.  Every expression
10054         after being emitted leaves a single value on the stack.
10055
10056         * codegen.cs (EmitContext::EmitStatementExpression): Use the
10057         facilties of ExpressionStatement if possible.
10058
10059         * cs-parser.jay: Update statement_expression.
10060
10061 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
10062
10063         * driver.cs: Change the wording of message
10064
10065 2001-09-25  Ravi Pratap  <ravi@ximian.com>
10066
10067         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
10068         the type of the expression to the return type of the method if
10069         we have an overloaded operator match ! The regression tests pass again !
10070         (Unary::ResolveOperator): Ditto.
10071
10072         * expression.cs (Invocation::ConversionExists): Correct the member lookup
10073         to find "op_Implicit", not "implicit" ;-)
10074         (UserImplicitCast): New class to take care of user-defined implicit conversions.
10075         (ConvertImplicit, ForceConversion): Take TypeContainer argument
10076
10077         * everywhere : Correct calls to the above accordingly.
10078
10079         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
10080         (ConvertImplicit): Do user-defined conversion if it exists.
10081
10082 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
10083
10084         * assign.cs: track location.
10085         (Resolve): Use implicit conversions on assignment.
10086
10087         * literal.cs: Oops.  Not good, Emit of short access values should
10088         pass (Bytes) or the wrong argument will be selected.
10089
10090         * expression.cs (Unary::Emit): Emit code for -expr.
10091         
10092         (Unary::ResolveOperator): Handle `Substract' for non-constants
10093         (substract from zero from the non-constants).
10094         Deal with Doubles as well. 
10095         
10096         (Expression::ConvertImplicitRequired): New routine that reports an
10097         error if no implicit conversion exists. 
10098
10099         (Invocation::OverloadResolve): Store the converted implicit
10100         expressions if we make them
10101         
10102 2001-09-24  Ravi Pratap  <ravi@ximian.com>
10103
10104         * class.cs (ConstructorInitializer): Take a Location argument.
10105         (ConstructorBaseInitializer): Same here.
10106         (ConstructorThisInitializer): Same here.
10107
10108         * cs-parser.jay : Update all calls accordingly.
10109
10110         * expression.cs (Unary, Binary, New): Take location argument.
10111         Update accordingly everywhere.
10112
10113         * cs-parser.jay : Update all calls to the above to take a location
10114         argument.
10115
10116         * class.cs : Ditto.
10117
10118 2001-09-24  Ravi Pratap  <ravi@ximian.com>
10119
10120         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
10121         (Invocation::BetterConversion): Same here
10122         (Invocation::ConversionExists): Ditto.
10123
10124         (Invocation::ConversionExists): Implement.
10125
10126 2001-09-22  Ravi Pratap  <ravi@ximian.com>
10127
10128         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
10129         Also take an additional TypeContainer argument.
10130
10131         * All over : Pass in TypeContainer as argument to OverloadResolve.
10132
10133         * typemanager.cs (CSharpName): Update to check for the string type and return
10134         that too.
10135
10136         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
10137         a given method.
10138         
10139 2001-09-21  Ravi Pratap  <ravi@ximian.com>
10140
10141         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
10142         (Invocation::BetterFunction): Implement.
10143         (Invocation::BetterConversion): Implement.
10144         (Invocation::ConversionExists): Skeleton, no implementation yet.
10145
10146         Okay, things work fine !
10147
10148 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
10149
10150         * typemanager.cs: declare and load enum_type, delegate_type and
10151         void_type. 
10152
10153         * expression.cs (Expression::Emit): Now emit returns a value that
10154         tells whether a value is left on the stack or not.  This strategy
10155         might be reveted tomorrow with a mechanism that would address
10156         multiple assignments.
10157         (Expression::report118): Utility routine to report mismatches on
10158         the ExprClass.
10159
10160         (Unary::Report23): Report impossible type/operator combination
10161         utility function.
10162
10163         (Unary::IsIncrementableNumber): Whether the type can be
10164         incremented or decremented with add.
10165         (Unary::ResolveOperator): Also allow enumerations to be bitwise
10166         complemented. 
10167         (Unary::ResolveOperator): Implement ++, !, ~,
10168
10169         (Invocation::Emit): Deal with new Emit convetion.
10170         
10171         * All Expression derivatives: Updated their Emit method to return
10172         whether they leave values on the stack or not.
10173         
10174         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
10175         stack for expressions that are statements. 
10176
10177 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
10178
10179         * expression.cs (LValue): New interface.  Must be implemented by
10180         LValue objects.
10181         (LocalVariableReference, ParameterReference, FieldExpr): Implement
10182         LValue interface.
10183         
10184         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
10185         interface for generating code, simplifies the code.
10186
10187 2001-09-20  Ravi Pratap  <ravi@ximian.com>
10188
10189         * expression.cs (everywhere): Comment out return statements in ::Resolve
10190         methods to avoid the warnings.
10191
10192 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
10193
10194         * driver.cs (parse): Report error 2001 if we can not open the
10195         source file.
10196
10197         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
10198         not resolve it.
10199
10200         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
10201         object. 
10202
10203         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
10204         otherwise nested blocks end up with the same index.
10205
10206         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
10207
10208         * expression.cs:  Instead of having FIXMEs in the Resolve
10209         functions, throw exceptions so it is obvious that we are facing a
10210         bug. 
10211
10212         * cs-parser.jay (invocation_expression): Pass Location information.
10213
10214         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
10215         Use a basename for those routines because .NET does not like paths
10216         on them. 
10217
10218         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
10219         already defined.
10220
10221 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
10222
10223         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
10224         are loading the correct data types (throws an exception if not).
10225         (TypeManager::InitCoreTypes): Use CoreLookupType
10226
10227         * expression.cs (Unary::ResolveOperator): return the child
10228         expression for expressions which are just +expr.
10229         (Unary::ResolveOperator): Return negative literals for -LITERAL
10230         expressions (otherwise they are Unary {Literal}).
10231         (Invocation::Badness): Take into account `Implicit constant
10232         expression conversions'.
10233
10234         * literal.cs (LongLiteral): Implement long literal class.
10235         (IntLiteral): export the `Value' of the intliteral. 
10236
10237 2001-09-19  Ravi Pratap  <ravi@ximian.com>
10238
10239         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
10240
10241         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
10242         instead of 'Operator'
10243
10244         * expression.cs (Binary::ResolveOperator): Update accordingly.
10245         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
10246         and 'Minus'
10247
10248         * cs-parser.jay (unary_expression): Update to use the new names.
10249
10250         * gen-treedump.cs (GetUnary): Same here.
10251
10252         * expression.cs (Unary::Resolve): Implement.
10253         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
10254         operators are found instead of making noise ;-)
10255         (Unary::ResolveOperator): New method to do precisely the same thing which
10256         Binary::ResolveOperator does for Binary expressions.
10257         (Unary.method, .Arguments): Add.
10258         (Unary::OperName): Implement.   
10259         (Unary::ForceConversion): Copy and Paste !
10260
10261         * class.cs (Operator::Define): Fix a small bug for the case when we have 
10262         a unary operator.
10263
10264         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
10265         for the inbuilt operators. Only overloading works for now ;-)
10266
10267 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
10268
10269         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
10270         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
10271
10272         * expression.cs (This::Emit): Implement. 
10273         (This::Resolve): Implement.
10274         (TypeOf:Resolve): Implement.
10275         (Expression::ResolveSimpleName): Add an implicit this to instance
10276         field references. 
10277         (MemberAccess::Resolve): Deal with Parameters and Fields. 
10278         Bind instance variable to Field expressions.
10279         (FieldExpr::Instance): New field used to track the expression that
10280         represents the object instance.
10281         (FieldExpr::Resolve): Track potential errors from MemberLookup not
10282         binding 
10283         (FieldExpr::Emit): Implement.
10284
10285         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
10286         the last instruction contains a return opcode to avoid generating
10287         the last `ret' instruction (this generates correct code, and it is
10288         nice to pass the peverify output).
10289
10290         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
10291         initializer for static and instance variables.
10292         (Constructor::Emit): Allow initializer to be null in the case of
10293         static constructors.  Only emit initializer for instance
10294         constructors. 
10295
10296         (TypeContainer::FindMembers): Return a null array if there are no
10297         matches.
10298
10299         Also fix the code for the MemberTypes.Method branch, as it was not
10300         scanning that for operators (or tried to access null variables before).
10301
10302         * assign.cs (Assign::Emit): Handle instance and static fields. 
10303
10304         * TODO: Updated.
10305
10306         * driver.cs: Stop compilation if there are parse errors.
10307
10308         * cs-parser.jay (constructor_declaration): Provide default base
10309         initializer for non-static constructors.
10310         (constructor_declarator): Do not provide a default base
10311         initializers if none was specified.
10312         Catch the fact that constructors should not have parameters.
10313
10314         * class.cs: Do not emit parent class initializers for static
10315         constructors, that should be flagged as an error.
10316
10317 2001-09-18  Ravi Pratap  <ravi@ximian.com>
10318
10319         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
10320         Move back code into TypeContainer::Populate.
10321
10322 2001-09-18  Ravi Pratap  <ravi@ximian.com>
10323
10324         * class.cs (TypeContainer::AddConstructor): Fix the check to
10325         compare against Name, not Basename. 
10326         (Operator::OpType): Change Plus and Minus to Add and Subtract.
10327
10328         * cs-parser.jay : Update accordingly.
10329
10330         * class.cs (TypeContainer::FindMembers): For the case where we are searching
10331         for methods, don't forget to look into the operators too.
10332         (RegisterMethodBuilder): Helper method to take care of this for
10333         methods, constructors and operators.
10334         (Operator::Define): Completely revamp.
10335         (Operator.OperatorMethod, MethodName): New fields.
10336         (TypeContainer::Populate): Move the registering of builders into
10337         RegisterMethodBuilder.
10338         (Operator::Emit): Re-write.
10339
10340         * expression.cs (Binary::Emit): Comment out code path to emit method
10341         invocation stuff for the case when we have a user defined operator. I am
10342         just not able to get it right !
10343         
10344 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
10345
10346         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
10347         argument. 
10348
10349         (Expression::MemberLookup): Provide a version that allows to
10350         specify the MemberTypes and BindingFlags. 
10351
10352         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
10353         so it was not fetching variable information from outer blocks.
10354
10355         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
10356         Beforefieldinit as it was buggy.
10357
10358         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
10359         that Ravi put here.  
10360
10361         * class.cs (Constructor::Emit): Only emit if block is not null.
10362         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
10363         deal with this by semantically definining it as if the user had
10364         done it.
10365
10366         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
10367         constructors as we now "emit" them at a higher level.
10368
10369         (TypeContainer::DefineDefaultConstructor): Used to define the
10370         default constructors if none was provided.
10371
10372         (ConstructorInitializer): Add methods Resolve and Emit. 
10373         
10374         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
10375
10376 2001-09-17  Ravi Pratap  <ravi@ximian.com>
10377
10378         * class.cs (TypeContainer::EmitDefaultConstructor): Register
10379         the default constructor builder with our hashtable for methodbuilders
10380         to methodcores.
10381
10382         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
10383         and argument_count is 0 in which case we have a match.
10384         (Binary::ResolveOperator): More null checking and miscellaneous coding
10385         style cleanup.
10386
10387 2001-09-17  Ravi Pratap  <ravi@ximian.com>
10388
10389         * rootcontext.cs (IsNameSpace): Compare against null.
10390
10391         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
10392
10393         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
10394         and Unary::Operator.
10395
10396         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
10397         accordingly.
10398
10399         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
10400         we have overloaded operators.
10401         (Binary::ResolveOperator): Implement the part which does the operator overload
10402         resolution.
10403
10404         * class.cs (Operator::Emit): Implement.
10405         (TypeContainer::Emit): Emit the operators we have too.
10406
10407         * expression.cs (Binary::Emit): Update to emit the appropriate code for
10408         the case when we have a user-defined operator.
10409         
10410 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
10411
10412         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
10413
10414 2001-09-16  Ravi Pratap  <ravi@ximian.com>
10415
10416         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
10417         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
10418         (Constructor::Emit): Implement.
10419         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
10420         if we have no work to do. 
10421         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
10422         Emit method.
10423
10424         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
10425         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
10426
10427         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
10428         of parent.parent.
10429
10430 2001-09-15  Ravi Pratap  <ravi@ximian.com>
10431
10432         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
10433         in the source.
10434         (Tree::RecordNamespace): Method to do what the name says ;-)
10435         (Tree::Namespaces): Property to get at the namespaces hashtable.
10436
10437         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
10438         keep track.
10439
10440         * rootcontext.cs (IsNamespace): Fixed it :-)
10441
10442 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
10443
10444         * class.cs (TypeContainer::FindMembers): Add support for
10445         constructors. 
10446         (MethodCore): New class that encapsulates both the shared aspects
10447         of a Constructor and a Method.  
10448         (Method, Constructor): Factored pieces into MethodCore.
10449
10450         * driver.cs: Added --fatal which makes errors throw exceptions.
10451         Load System assembly as well as part of the standard library.
10452
10453         * report.cs: Allow throwing exceptions on errors for debugging.
10454
10455         * modifiers.cs: Do not use `parent', instead use the real type
10456         container to evaluate permission settings.
10457
10458         * class.cs: Put Ravi's patch back in.  He is right, and we will
10459         have to cope with the
10460
10461 2001-09-14  Ravi Pratap  <ravi@ximian.com>
10462
10463         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
10464         FamORAssem, not FamANDAssem.
10465         
10466 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
10467
10468         * driver.cs: Added --parse option that only parses its input files
10469         and terminates.
10470
10471         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
10472         incorrect.  IsTopLevel is not used to tell whether an object is
10473         root_types or not (that can be achieved by testing this ==
10474         root_types).  But to see if this is a top-level *class* (not
10475         necessarly our "toplevel" container). 
10476
10477 2001-09-14  Ravi Pratap  <ravi@ximian.com>
10478
10479         * enum.cs (Enum::Define): Modify to call the Lookup method on the
10480         parent instead of a direct call to GetType.
10481
10482 2001-09-14  Ravi Pratap  <ravi@ximian.com>
10483
10484         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
10485         Modifiers.TypeAttr. This should just be a call to that method.
10486
10487         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
10488         object so that we can determine if we are top-level or not.
10489
10490         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
10491         TypeContainer too.
10492
10493         * enum.cs (Enum::Define): Ditto.
10494
10495         * modifiers.cs (FieldAttr): Re-write.
10496
10497         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
10498         (TypeContainer::HaveStaticConstructor): New property to provide access
10499         to precisely that info.
10500
10501         * modifiers.cs (MethodAttr): Re-write.
10502         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
10503
10504         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
10505         of top-level types as claimed.
10506         
10507 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
10508
10509         * expression.cs (MemberLookup): Fruitless attempt to lookup
10510         constructors.  Maybe I need to emit default constructors?  That
10511         might be it (currently .NET emits this for me automatically).
10512         (Invocation::OverloadResolve): Cope with Arguments == null.
10513         (Invocation::EmitArguments): new function, shared by the new
10514         constructor and us.
10515         (Invocation::Emit): Handle static and instance methods.  Emit
10516         proper call instruction for virtual or non-virtual invocations.
10517         (New::Emit): Implement.
10518         (New::Resolve): Implement.
10519         (MemberAccess:Resolve): Implement.
10520         (MethodGroupExpr::InstanceExpression): used conforming to the spec
10521         to track instances.
10522         (FieldExpr::Resolve): Set type.
10523
10524         * support.cs: Handle empty arguments.
10525                 
10526         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
10527         SimpleLookup): Auxiliary routines to help parse a qualifier
10528         identifier.  
10529
10530         Update qualifier_identifier rule.
10531
10532         * codegen.cs: Removed debugging messages.
10533
10534         * class.cs: Make this a global thing, this acts just as a "key" to
10535         objects that we might have around.
10536
10537         (Populate): Only initialize method_builders_to_methods once.
10538
10539         * expression.cs (PropertyExpr): Initialize type from the
10540         PropertyType. 
10541
10542         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
10543         Resolve pattern.  Attempt to implicitly convert value to boolean.
10544         Emit code.
10545
10546         * expression.cs: Set the type for the int32/int32 argument case.
10547         (Binary::ResolveOperator): Set the return type to boolean for
10548         comparission operators
10549
10550         * typemanager.cs: Remove debugging print code.
10551
10552         (Invocation::Resolve): resolve type.
10553
10554         * class.cs: Allocate a MemberInfo of the correct size, as the code
10555         elsewhere depends on the test to reflect the correct contents.
10556
10557         (Method::) Keep track of parameters, due to System.Reflection holes
10558
10559         (TypeContainer::Populate): Keep track of MethodBuilders to Method
10560         mapping here.
10561
10562         (TypeContainer::FindMembers): Use ArrayList and then copy an array
10563         of the exact size and return that.
10564
10565         (Class::LookupMethodByBuilder): New function that maps
10566         MethodBuilders to its methods.  Required to locate the information
10567         on methods because System.Reflection bit us again.
10568
10569         * support.cs: New file, contains an interface ParameterData and
10570         two implementations: ReflectionParameters and InternalParameters
10571         used to access Parameter information.  We will need to grow this
10572         as required.
10573
10574         * expression.cs (Invocation::GetParameterData): implement a cache
10575         and a wrapper around the ParameterData creation for methods. 
10576         (Invocation::OverloadResolve): Use new code.
10577
10578 2001-09-13  Ravi Pratap  <ravi@ximian.com>
10579
10580         * class.cs (TypeContainer::EmitField): Remove and move into 
10581         (Field::Define): here and modify accordingly.
10582         (Field.FieldBuilder): New member.
10583         (TypeContainer::Populate): Update accordingly.
10584         (TypeContainer::FindMembers): Implement.
10585
10586 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
10587
10588         * statement.cs: (VariableInfo::VariableType): New field to be
10589         initialized with the full type once it is resolved. 
10590
10591 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
10592
10593         * parameter.cs (GetParameterInfo): Use a type cache to compute
10594         things only once, and to reuse this information
10595
10596         * expression.cs (LocalVariableReference::Emit): Implement.
10597         (OpcodeCast::Emit): fix.
10598
10599         (ParameterReference::Resolve): Implement.
10600         (ParameterReference::Emit): Implement.
10601
10602         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
10603         that are expressions need to stay as Expressions.
10604
10605         * typemanager.cs (CSharpName): Returns the C# name of a type if
10606         possible. 
10607
10608         * expression.cs (Expression::ConvertImplicit): New function that
10609         implements implicit type conversions.
10610
10611         (Expression::ImplicitReferenceConversion): Implements implicit
10612         reference conversions.
10613
10614         (EmptyCast): New type for transparent casts.
10615
10616         (OpcodeCast): New type for casts of types that are performed with
10617         a sequence of bytecodes.
10618         
10619         (BoxedCast): New type used for casting value types into reference
10620         types.  Emits a box opcode.
10621
10622         (Binary::DoNumericPromotions): Implements numeric promotions of
10623         and computation of the Binary::Type.
10624
10625         (Binary::EmitBranchable): Optimization.
10626
10627         (Binary::Emit): Implement code emission for expressions.
10628         
10629         * typemanager.cs (TypeManager): Added two new core types: sbyte
10630         and byte.
10631
10632 2001-09-12  Ravi Pratap  <ravi@ximian.com>
10633
10634         * class.cs (TypeContainer::FindMembers): Method which does exactly
10635         what Type.FindMembers does, only we don't have to use reflection. No
10636         implementation yet.
10637
10638         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
10639         typecontainer objects as we need to get at them.
10640         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
10641
10642         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
10643         typecontainer object.
10644
10645         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
10646         of just a Report object.
10647
10648 2001-09-11  Ravi Pratap  <ravi@ximian.com>
10649
10650         * class.cs (Event::Define): Go back to using the prefixes "add_" and
10651         "remove_"
10652         (TypeContainer::Populate): Now define the delegates of the type too.
10653         (TypeContainer.Delegates): Property to access the list of delegates defined
10654         in the type.
10655
10656         * delegates.cs (Delegate::Define): Implement partially.
10657
10658         * modifiers.cs (TypeAttr): Handle more flags.
10659
10660 2001-09-11  Ravi Pratap  <ravi@ximian.com>
10661
10662         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
10663         and not <=
10664         (Operator::Define): Re-write logic to get types by using the LookupType method
10665         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
10666         (Indexer::Define): Ditto.
10667         (Event::Define): Ditto.
10668         (Property::Define): Ditto.
10669         
10670 2001-09-10  Ravi Pratap  <ravi@ximian.com>
10671
10672         * class.cs (TypeContainer::Populate): Now define operators too. 
10673         (TypeContainer.Operators): New property to access the list of operators
10674         in a type.
10675         (Operator.OperatorMethodBuilder): New member to hold the method builder
10676         for the operator we are defining.
10677         (Operator::Define): Implement.
10678
10679 2001-09-10  Ravi Pratap  <ravi@ximian.com>
10680
10681         * class.cs (Event::Define): Make the prefixes of the accessor methods
10682         addOn_ and removeOn_ 
10683
10684         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
10685         of the location being passed in too. Ideally, this should go later since all
10686         error reporting should be done through the Report object.
10687
10688         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
10689         (Populate): Iterate thru the indexers we have and define them too.
10690         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
10691         for the get and set accessors.
10692         (Indexer::Define): Implement.
10693         
10694 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
10695
10696         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
10697         my previous implementation, did not work.
10698
10699         * typemanager.cs: Add a couple of missing types (the longs).
10700
10701         * literal.cs: Use TypeManager.bool_type instead of getting it.
10702
10703         * expression.cs (EventExpr): New kind of expressions.
10704         (Expressio::ExprClassFromMemberInfo): finish
10705
10706 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
10707
10708         * assign.cs: Emit stores to static fields differently.
10709
10710 2001-09-08  Ravi Pratap  <ravi@ximian.com>
10711
10712         * Merge in changes and adjust code to tackle conflicts. Backed out my
10713         code in Assign::Resolve ;-) 
10714
10715 2001-09-08  Ravi Pratap  <ravi@ximian.com>
10716
10717         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
10718         instead Report.Error and also pass in the location.
10719         (CSharpParser::Lexer): New readonly property to return the reference
10720         to the Tokenizer object.
10721         (declare_local_variables): Use Report.Error with location instead of plain 
10722         old error.
10723         (CheckDef): Ditto.
10724
10725         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
10726         (Operator.CheckBinaryOperator): Ditto.
10727
10728         * cs-parser.jay (operator_declarator): Update accordingly.
10729
10730         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
10731         (CheckBinaryOperator): Same here.
10732
10733         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
10734         on the name without any prefixes of namespace names etc. This is because we
10735         already might have something already fully qualified like 
10736         'System.Console.WriteLine'
10737
10738         * assign.cs (Resolve): Begin implementation. Stuck ;-)
10739
10740 2001-09-07  Ravi Pratap  <ravi@ximian.com>
10741
10742         * cs-tokenizer.cs (location): Return a string which also contains
10743         the file name.
10744
10745         * expression.cs (ElementAccess): New class for expressions of the
10746         type 'element access.'
10747         (BaseAccess): New class for expressions of the type 'base access.'
10748         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
10749         respectively.
10750         
10751         * cs-parser.jay (element_access): Implement action.
10752         (base_access): Implement actions.
10753         (checked_expression, unchecked_expression): Implement.
10754
10755         * cs-parser.jay (local_variable_type): Correct and implement.
10756         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
10757
10758         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
10759
10760         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
10761         name and the specifiers.
10762
10763         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
10764         
10765         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
10766         making them all public ;-)
10767
10768         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
10769         class anyways.
10770         
10771 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
10772
10773         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
10774         PropertyExprs.
10775         (FieldExpr, PropertyExprs): New resolved expressions.
10776         (SimpleName::MemberStaticCheck): Perform static checks for access
10777         to non-static fields on static methods. Maybe this should be
10778         generalized for MemberAccesses. 
10779         (SimpleName::ResolveSimpleName): More work on simple name
10780         resolution. 
10781
10782         * cs-parser.jay (primary_expression/qualified_identifier): track
10783         the parameter index.
10784
10785         * codegen.cs (CodeGen::Save): Catch save exception, report error.
10786         (EmitContext::EmitBoolExpression): Chain to expression generation
10787         instead of temporary hack.
10788         (::EmitStatementExpression): Put generic expression code generation.
10789
10790         * assign.cs (Assign::Emit): Implement variable assignments to
10791         local variables, parameters and fields.
10792
10793 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
10794
10795         * statement.cs (Block::GetVariableInfo): New method, returns the
10796         VariableInfo for a variable name in a block.
10797         (Block::GetVariableType): Implement in terms of GetVariableInfo
10798
10799         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
10800         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
10801
10802 2001-09-06  Ravi Pratap  <ravi@ximian.com>
10803
10804         * cs-parser.jay (operator_declaration): Continue on my quest : update
10805         to take attributes argument.
10806         (event_declaration): Ditto.
10807         (enum_declaration): Ditto.
10808         (indexer_declaration): Ditto.
10809         
10810         * class.cs (Operator::Operator): Update constructor accordingly.
10811         (Event::Event): Ditto.
10812
10813         * delegate.cs (Delegate::Delegate): Same here.
10814
10815         * enum.cs (Enum::Enum): Same here.
10816         
10817 2001-09-05  Ravi Pratap  <ravi@ximian.com>
10818
10819         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
10820
10821         * ../tests/cs0658.cs : New file to demonstrate error 0658.
10822
10823         * attribute.cs (Attributes): New class to encapsulate all attributes which were
10824         being passed around as an arraylist.
10825         (Attributes::AddAttribute): Method to add attribute sections.
10826
10827         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
10828         (struct_declaration): Update accordingly.
10829         (constant_declaration): Update.
10830         (field_declaration): Update.
10831         (method_header): Update.
10832         (fixed_parameter): Update.
10833         (parameter_array): Ditto.
10834         (property_declaration): Ditto.
10835         (destructor_declaration): Ditto.
10836         
10837         * class.cs (Struct::Struct): Update constructors accordingly.
10838         (Class::Class): Ditto.
10839         (Field::Field): Ditto.
10840         (Method::Method): Ditto.
10841         (Property::Property): Ditto.
10842         (TypeContainer::OptAttribute): update property's return type.
10843         
10844         * interface.cs (Interface.opt_attributes): New member.
10845         (Interface::Interface): Update to take the extra Attributes argument.
10846
10847         * parameter.cs (Parameter::Parameter): Ditto.
10848
10849         * constant.cs (Constant::Constant): Ditto.
10850
10851         * interface.cs (InterfaceMemberBase): New OptAttributes field.
10852         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
10853         the attributes as a parameter.
10854         (InterfaceProperty): Update constructor call.
10855         (InterfaceEvent): Ditto.
10856         (InterfaceMethod): Ditto.
10857         (InterfaceIndexer): Ditto.
10858
10859         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
10860         pass the attributes too.
10861         (interface_event_declaration): Ditto.
10862         (interface_property_declaration): Ditto.
10863         (interface_method_declaration): Ditto.
10864         (interface_declaration): Ditto.
10865
10866 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
10867
10868         * class.cs (Method::Define): Track the "static Main" definition to
10869         create an entry point. 
10870
10871         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
10872         EntryPoint if we find it. 
10873
10874         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
10875         (EmitContext::ig): Make this variable public.
10876
10877         * driver.cs: Make the default output file be the first file name
10878         with the .exe extension.  
10879
10880         Detect empty compilations
10881
10882         Handle various kinds of output targets.  Handle --target and
10883         rename -t to --dumper.
10884
10885         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
10886         methods inherited from Expression return now an Expression.  This
10887         will is used during the tree rewriting as we resolve them during
10888         semantic analysis.
10889
10890         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
10891         the spec.  Missing entirely is the information about
10892         accessability of elements of it.
10893
10894         (Expression::ExprClassFromMemberInfo): New constructor for
10895         Expressions that creates a fully initialized Expression based on
10896         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
10897         a Type.
10898
10899         (Invocation::Resolve): Begin implementing resolution of invocations.
10900         
10901         * literal.cs (StringLiteral):  Implement Emit.
10902
10903 2001-09-05  Ravi Pratap  <ravi@ximian.com>
10904
10905         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
10906         member.
10907         
10908 2001-09-04  Ravi Pratap  <ravi@ximian.com>
10909
10910         * cs-parser.jay (attribute_arguments): Implement actions.
10911         (attribute): Fix bug in production. Implement action.
10912         (attribute_list): Implement.
10913         (attribute_target): Implement.
10914         (attribute_target_specifier, opt_target_specifier): Implement
10915         (CheckAttributeTarget): New method to check if the attribute target
10916         is valid.
10917         (attribute_section): Implement.
10918         (opt_attributes): Implement.
10919
10920         * attribute.cs : New file to handle attributes.
10921         (Attribute): Class to hold attribute info.
10922
10923         * cs-parser.jay (opt_attribute_target_specifier): Remove production
10924         (attribute_section): Modify production to use 2 different rules to 
10925         achieve the same thing. 1 s/r conflict down !
10926         Clean out commented, useless, non-reducing dimension_separator rules.
10927         
10928         * class.cs (TypeContainer.attributes): New member to hold list
10929         of attributes for a type.
10930         (Struct::Struct): Modify to take one more argument, the attribute list.
10931         (Class::Class): Ditto.
10932         (Field::Field): Ditto.
10933         (Method::Method): Ditto.
10934         (Property::Property): Ditto.
10935         
10936         * cs-parser.jay (struct_declaration): Update constructor call to
10937         pass in the attributes too.
10938         (class_declaration): Ditto.
10939         (constant_declaration): Ditto.
10940         (field_declaration): Ditto.
10941         (method_header): Ditto.
10942         (fixed_parameter): Ditto.
10943         (parameter_array): Ditto.
10944         (property_declaration): Ditto.
10945
10946         * constant.cs (Constant::Constant): Update constructor similarly.
10947         Use System.Collections.
10948
10949         * parameter.cs (Parameter::Parameter): Update as above.
10950
10951 2001-09-02  Ravi Pratap  <ravi@ximian.com>
10952
10953         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
10954         (TypeContainer.delegates): New member to hold list of delegates.
10955
10956         * cs-parser.jay (delegate_declaration): Implement the action correctly 
10957         this time as I seem to be on crack ;-)
10958
10959 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
10960
10961         * rootcontext.cs (RootContext::IsNamespace): new function, used to
10962         tell whether an identifier represents a namespace.
10963
10964         * expression.cs (NamespaceExpr): A namespace expression, used only
10965         temporarly during expression resolution.
10966         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
10967         utility functions to resolve names on expressions.
10968
10969 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
10970
10971         * codegen.cs: Add hook for StatementExpressions. 
10972
10973         * class.cs: Fix inverted test for static flag in methods.
10974
10975 2001-09-02  Ravi Pratap  <ravi@ximian.com>
10976
10977         * class.cs (Operator::CheckUnaryOperator): Correct error number used
10978         to make it coincide with MS' number.
10979         (Operator::CheckBinaryOperator): Ditto.
10980
10981         * ../errors/errors.txt : Remove error numbers added earlier.
10982
10983         * ../errors/cs1019.cs : Test case for error # 1019
10984
10985         * ../errros/cs1020.cs : Test case for error # 1020
10986
10987         * cs-parser.jay : Clean out commented cruft.
10988         (dimension_separators, dimension_separator): Comment out. Ostensibly not
10989         used anywhere - non-reducing rule.
10990         (namespace_declarations): Non-reducing rule - comment out.
10991
10992         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
10993         with TypeContainer::AddEnum.
10994
10995         * delegate.cs : New file for delegate handling classes.
10996         (Delegate): Class for declaring delegates.
10997
10998         * makefile : Update.
10999
11000         * cs-parser.jay (delegate_declaration): Implement.
11001
11002 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
11003
11004         * class.cs (Event::Define): Implement.
11005         (Event.EventBuilder): New member.
11006
11007         * class.cs (TypeContainer::Populate): Update to define all enums and events
11008         we have.
11009         (Events): New property for the events arraylist we hold. Shouldn't we move to using
11010         readonly fields for all these cases ?
11011
11012 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
11013
11014         * class.cs (Property): Revamp to use the convention of making fields readonly.
11015         Accordingly modify code elsewhere.
11016
11017         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
11018         the Define method of the Property class.
11019
11020         * class.cs : Clean up applied patch and update references to variables etc. Fix 
11021         trivial bug.
11022         (TypeContainer::Populate): Update to define all the properties we have. Also
11023         define all enumerations.
11024
11025         * enum.cs (Define): Implement.
11026         
11027 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
11028
11029         * cs-parser.jay (overloadable_operator): The semantic value is an
11030         enum of the Operator class.
11031         (operator_declarator): Implement actions.
11032         (operator_declaration): Implement.
11033
11034         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
11035         validity of definitions.
11036         (Operator::CheckBinaryOperator): Static method to check for binary operators
11037         (TypeContainer::AddOperator): New method to add an operator to a type.
11038
11039         * cs-parser.jay (indexer_declaration): Added line to actually call the
11040         AddIndexer method so it gets added ;-)
11041
11042         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
11043         already taken care of by the MS compiler ?  
11044
11045 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
11046
11047         * class.cs (Operator): New class for operator declarations.
11048         (Operator::OpType): Enum for the various operators.
11049
11050 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
11051
11052         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
11053         ostensibly handle this in semantic analysis.
11054
11055         * cs-parser.jay (general_catch_clause): Comment out
11056         (specific_catch_clauses, specific_catch_clause): Ditto.
11057         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
11058         (catch_args, opt_catch_args): New productions.
11059         (catch_clause): Rewrite to use the new productions above
11060         (catch_clauses): Modify accordingly.
11061         (opt_catch_clauses): New production to use in try_statement
11062         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
11063         and re-write the code in the actions to extract the specific and
11064         general catch clauses by being a little smart ;-)
11065
11066         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
11067         Hooray, try and catch statements parse fine !
11068         
11069 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11070
11071         * statement.cs (Block::GetVariableType): Fix logic to extract the type
11072         string from the hashtable of variables.
11073
11074         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
11075         I end up making that mistake ;-)
11076         (catch_clauses): Fixed gross error which made Key and Value of the 
11077         DictionaryEntry the same : $1 !!
11078
11079 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11080
11081         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
11082
11083         * cs-parser.jay (event_declaration): Correct to remove the semicolon
11084         when the add and remove accessors are specified. 
11085
11086 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11087
11088         * cs-parser.jay (IndexerDeclaration): New helper class to hold
11089         information about indexer_declarator.
11090         (indexer_declarator): Implement actions.
11091         (parsing_indexer): New local boolean used to keep track of whether
11092         we are parsing indexers or properties. This is necessary because 
11093         implicit_parameters come into picture even for the get accessor in the 
11094         case of an indexer.
11095         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
11096
11097         * class.cs (Indexer): New class for indexer declarations.
11098         (TypeContainer::AddIndexer): New method to add an indexer to a type.
11099         (TypeContainer::indexers): New member to hold list of indexers for the
11100         type.
11101
11102 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
11103
11104         * cs-parser.jay (add_accessor_declaration): Implement action.
11105         (remove_accessor_declaration): Implement action.
11106         (event_accessors_declaration): Implement
11107         (variable_declarators): swap statements for first rule - trivial.
11108
11109         * class.cs (Event): New class to hold information about event
11110         declarations.
11111         (TypeContainer::AddEvent): New method to add an event to a type
11112         (TypeContainer::events): New member to hold list of events.
11113
11114         * cs-parser.jay (event_declaration): Implement actions.
11115
11116 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
11117
11118         * cs-parser.jay (dim_separators): Implement. Make it a string
11119         concatenating all the commas together, just as they appear.
11120         (opt_dim_separators): Modify accordingly
11121         (rank_specifiers): Update accordingly. Basically do the same
11122         thing - instead, collect the brackets here.
11123         (opt_rank_sepcifiers): Modify accordingly.
11124         (array_type): Modify to actually return the complete type string
11125         instead of ignoring the rank_specifiers.
11126         (expression_list): Implement to collect the expressions
11127         (variable_initializer): Implement. We make it a list of expressions
11128         essentially so that we can handle the array_initializer case neatly too.
11129         (variable_initializer_list): Implement.
11130         (array_initializer): Make it a list of variable_initializers
11131         (opt_array_initializer): Modify accordingly.
11132
11133         * expression.cs (New::NType): Add enumeration to help us
11134         keep track of whether we have an object/delegate creation
11135         or an array creation.
11136         (New:NewType, New::Rank, New::Indices, New::Initializers): New
11137         members to hold data about array creation.
11138         (New:New): Modify to update NewType
11139         (New:New): New Overloaded contructor for the array creation
11140         case.
11141
11142         * cs-parser.jay (array_creation_expression): Implement to call
11143         the overloaded New constructor.
11144         
11145 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
11146
11147         * class.cs (TypeContainer::Constructors): Return member
11148         constructors instead of returning null.
11149
11150 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
11151
11152         * typemanager.cs (InitCoreTypes): Initialize the various core
11153         types after we have populated the type manager with the user
11154         defined types (this distinction will be important later while
11155         compiling corlib.dll)
11156
11157         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
11158         on Expression Classification.  Now all expressions have a method
11159         `Resolve' and a method `Emit'.
11160
11161         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
11162         generation from working.     Also add some temporary debugging
11163         code. 
11164         
11165 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
11166
11167         * codegen.cs: Lots of code generation pieces.  This is only the
11168         beginning, will continue tomorrow with more touches of polish.  We
11169         handle the fundamentals of if, while, do, for, return.  Others are
11170         trickier and I need to start working on invocations soon.
11171         
11172         * gen-treedump.cs: Bug fix, use s.Increment here instead of
11173         s.InitStatement. 
11174
11175         * codegen.cs (EmitContext): New struct, used during code
11176         emission to keep a context.   Most of the code generation will be
11177         here. 
11178
11179         * cs-parser.jay: Add embedded blocks to the list of statements of
11180         this block.  So code generation proceeds in a top down fashion.
11181
11182 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
11183
11184         * statement.cs: Add support for multiple child blocks.
11185
11186 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
11187
11188         * codegen.cs (EmitCode): New function, will emit the code for a
11189         Block of code given a TypeContainer and its ILGenerator. 
11190
11191         * statement.cs (Block): Standard public readonly optimization.
11192         (Block::Block constructors): Link children. 
11193         (Block::Child): Child Linker.
11194         (Block::EmitVariables): Emits IL variable declarations.
11195
11196         * class.cs: Drop support for MethodGroups here, delay until
11197         Semantic Analysis.
11198         (Method::): Applied the same simplification that I did before, and
11199         move from Properties to public readonly fields.
11200         (Method::ParameterTypes): Returns the parameter types for the
11201         function, and implements a cache that will be useful later when I
11202         do error checking and the semantic analysis on the methods is
11203         performed.
11204         (Constructor::GetCallingConvention): Renamed from CallingConvetion
11205         and made a method, optional argument tells whether this is a class
11206         or a structure to apply the `has-this' bit.
11207         (Method::GetCallingConvention): Implement, returns the calling
11208         convention. 
11209         (Method::Define): Defines the type, a second pass is performed
11210         later to populate the methods.
11211
11212         (Constructor::ParameterTypes): implement a cache similar to the
11213         one on Method::ParameterTypes, useful later when we do semantic
11214         analysis. 
11215
11216         (TypeContainer::EmitMethod):  New method.  Emits methods.
11217
11218         * expression.cs: Removed MethodGroup class from here.
11219         
11220         * parameter.cs (Parameters::GetCallingConvention): new method.
11221
11222 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
11223
11224         * class.cs (TypeContainer::Populate): Drop RootContext from the
11225         argument. 
11226
11227         (Constructor::CallingConvention): Returns the calling convention.
11228         (Constructor::ParameterTypes): Returns the constructor parameter
11229         types. 
11230         
11231         (TypeContainer::AddConstructor): Keep track of default constructor
11232         and the default static constructor.
11233
11234         (Constructor::) Another class that starts using `public readonly'
11235         instead of properties. 
11236
11237         (Constructor::IsDefault): Whether this is a default constructor. 
11238
11239         (Field::) use readonly public fields instead of properties also.
11240
11241         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
11242         track of static constructors;  If none is used, turn on
11243         BeforeFieldInit in the TypeAttributes. 
11244
11245         * cs-parser.jay (opt_argument_list): now the return can be null
11246         for the cases where there are no arguments. 
11247
11248         (constructor_declarator): If there is no implicit `base' or
11249         `this', then invoke the default parent constructor. 
11250         
11251         * modifiers.cs (MethodAttr): New static function maps a set of
11252         modifiers flags into a MethodAttributes enum
11253         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
11254         MethodAttr, TypeAttr to represent the various mappings where the
11255         modifiers are used.
11256         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
11257
11258 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
11259
11260         * parameter.cs (GetParameterInfo): Fix bug where there would be no
11261         method arguments.
11262
11263         * interface.cs (PopulateIndexer): Implemented the code generator
11264         for interface indexers.
11265
11266 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
11267
11268         * interface.cs (InterfaceMemberBase): Now we track the new status
11269         here.  
11270
11271         (PopulateProperty): Implement property population.  Woohoo!  Got
11272         Methods and Properties going today. 
11273
11274         Removed all the properties for interfaces, and replaced them with
11275         `public readonly' fields. 
11276
11277 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
11278
11279         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
11280         initialize their hashtables/arraylists only when they are needed
11281         instead of doing this always.
11282
11283         * parameter.cs: Handle refs and out parameters.
11284
11285         * cs-parser.jay: Use an ArrayList to construct the arguments
11286         instead of the ParameterCollection, and then cast that to a
11287         Parameter[] array.
11288
11289         * parameter.cs: Drop the use of ParameterCollection and use
11290         instead arrays of Parameters.
11291
11292         (GetParameterInfo): Use the Type, not the Name when resolving
11293         types. 
11294
11295 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
11296
11297         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
11298         and instead use public readonly fields.
11299
11300         * class.cs: Put back walking code for type containers.
11301
11302 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
11303
11304         * class.cs (MakeConstant): Code to define constants.
11305
11306         * rootcontext.cs (LookupType): New function.  Used to locate types 
11307
11308         
11309 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
11310
11311         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
11312         this System.Reflection code is.  Kudos to Microsoft
11313         
11314         * typemanager.cs: Implement a type cache and avoid loading all
11315         types at boot time.  Wrap in LookupType the internals.  This made
11316         the compiler so much faster.  Wow.  I rule!
11317         
11318         * driver.cs: Make sure we always load mscorlib first (for
11319         debugging purposes, nothing really important).
11320
11321         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
11322         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
11323
11324         * rootcontext.cs: Lookup types on their namespace;  Lookup types
11325         on namespaces that have been imported using the `using' keyword.
11326
11327         * class.cs (TypeContainer::TypeAttr): Virtualize.
11328         (Class::TypeAttr): Return attributes suitable for this bad boy.
11329         (Struct::TypeAttr): ditto.
11330         Handle nested classes.
11331         (TypeContainer::) Remove all the type visiting code, it is now
11332         replaced with the rootcontext.cs code
11333
11334         * rootcontext.cs (GetClassBases): Added support for structs. 
11335
11336 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
11337
11338         * interface.cs, statement.cs, class.cs, parameter.cs,
11339         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
11340         Drop use of TypeRefs, and use strings instead.
11341
11342 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
11343
11344         * rootcontext.cs: 
11345
11346         * class.cs (Struct::Struct): set the SEALED flags after
11347         checking the modifiers.
11348         (TypeContainer::TypeAttr): new property, returns the
11349         TypeAttributes for a class.  
11350
11351         * cs-parser.jay (type_list): Oops, list production was creating a
11352         new list of base types.
11353
11354         * rootcontext.cs (StdLib): New property.
11355         (GetInterfaceTypeByName): returns an interface by type name, and
11356         encapsulates error handling here.
11357         (GetInterfaces): simplified.
11358         (ResolveTree): Encapsulated all the tree resolution here.
11359         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
11360         types. 
11361         
11362         * driver.cs: Add support for --nostdlib, to avoid loading the
11363         default assemblies.
11364         (Main): Do not put tree resolution here. 
11365
11366         * rootcontext.cs: Beginning of the class resolution.
11367
11368 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
11369
11370         * rootcontext.cs: Provide better error reporting. 
11371
11372         * cs-parser.jay (interface_base): set our $$ to be interfaces.
11373
11374         * rootcontext.cs (CreateInterface): Handle the case where there
11375         are no parent interfaces.
11376         
11377         (CloseTypes): Routine to flush types at the end.
11378         (CreateInterface): Track types.
11379         (GetInterfaces): Returns an array of Types from the list of
11380         defined interfaces.
11381
11382         * typemanager.c (AddUserType): Mechanism to track user types (puts
11383         the type on the global type hash, and allows us to close it at the
11384         end). 
11385         
11386 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
11387
11388         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
11389         RecordInterface instead.
11390
11391         * cs-parser.jay: Updated to reflect changes above.
11392
11393         * decl.cs (Definition): Keep track of the TypeBuilder type that
11394         represents this type here.  Not sure we will use it in the long
11395         run, but wont hurt for now.
11396
11397         * driver.cs: Smaller changes to accomodate the new code.
11398
11399         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
11400         when done. 
11401
11402         * rootcontext.cs (CreateInterface):  New method, used to create
11403         the System.TypeBuilder type for interfaces.
11404         (ResolveInterfaces): new entry point to resolve the interface
11405         hierarchy. 
11406         (CodeGen): Property, used to keep track of the code generator.
11407
11408 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
11409
11410         * cs-parser.jay: Add a second production for delegate_declaration
11411         with `VOID'.
11412
11413         (enum_body): Put an opt_comma here instead of putting it on
11414         enum_body or enum_member_declarations so we can handle trailing
11415         commas on enumeration members.  Gets rid of a shift/reduce.
11416         
11417         (type_list): Need a COMMA in the middle.
11418
11419         (indexer_declaration): Tell tokenizer to recognize get/set
11420
11421         * Remove old targets.
11422
11423         * Re-add the parser target.
11424
11425 2001-07-13  Simon Cozens <simon@simon-cozens.org>
11426
11427         * cs-parser.jay: Add precendence rules for a number of operators
11428         ot reduce the number of shift/reduce conflicts in the grammar.
11429         
11430 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
11431
11432         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
11433         and put it here.
11434
11435         Get rid of old crufty code.
11436
11437         * rootcontext.cs: Use this to keep track of the parsed
11438         representation and the defined types available to the program. 
11439
11440         * gen-treedump.cs: adjust for new convention.
11441
11442         * type.cs: Split out the type manager, and the assembly builder
11443         from here. 
11444
11445         * typemanager.cs: the type manager will live here now.
11446
11447         * cil-codegen.cs: And the code generator here. 
11448
11449 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
11450
11451         * makefile: Fixed up for easy making.
11452
11453 2001-07-13  Simon Cozens <simon@simon-cozens.org>
11454
11455         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
11456         the 
11457
11458         (unary_expression): Expand pre_increment_expression and
11459         post_decrement_expression to reduce a shift/reduce.
11460
11461 2001-07-11  Simon Cozens
11462
11463         * cs-tokenizer.cs: Hex numbers should begin with a 0.
11464
11465         Improve allow_keyword_as_indent name.
11466
11467 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
11468
11469         * Adjustments for Beta2. 
11470
11471 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
11472
11473         * decl.cs: Added `Define' abstract method.
11474         (InTransit): new property, used to catch recursive definitions. 
11475
11476         * interface.cs: Implement `Define'. 
11477
11478         * modifiers.cs: Map Modifiers.constants to
11479         System.Reflection.TypeAttribute flags.
11480
11481         * class.cs: Keep track of types and user-defined types.
11482         (BuilderInit): New method for creating an assembly
11483         (ResolveType): New function to launch the resolution process, only
11484         used by interfaces for now.
11485
11486         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
11487         that are inserted into the name space. 
11488
11489 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
11490
11491         * ARGH.  I have screwed up my tree so many times due to the use of
11492         rsync rather than using CVS.  Going to fix this at once. 
11493
11494         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
11495         load types.
11496
11497 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
11498
11499         * Experiment successful: Use System.Type rather that our own
11500         version of Type.  
11501
11502 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
11503
11504         * cs-parser.jay: Removed nsAliases from here.
11505
11506         Use new namespaces, handle `using XXX;' 
11507
11508         * namespace.cs: Reimplemented namespace handling, use a recursive
11509         definition of the class.  Now we can keep track of using clauses
11510         and catch invalid using clauses.
11511
11512 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
11513
11514         * gen-treedump.cs: Adapted for all the renaming.
11515
11516         * expression.cs (Expression): this class now has a Type property
11517         which returns an expression Type.
11518
11519         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
11520         `Type', as this has a different meaning now in the base
11521
11522 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
11523
11524         * interface.cs, class.cs: Removed from all the sources the
11525         references to signature computation, as we can not do method
11526         signature computation during the parsing time, as we are not
11527         trying to solve at that point distinguishing:
11528
11529         class X {
11530                 void a (Blah x) {}
11531                 void a (NS.Blah x) {}
11532         }
11533
11534         Which depending on the context might be valid or not, as we do not
11535         know if Blah is the same thing as NS.Blah at that point.
11536
11537         * Redid everything so the code uses TypeRefs now instead of
11538         Types.  TypeRefs are just temporary type placeholders, that need
11539         to be resolved.  They initially have a pointer to a string and the
11540         current scope in which they are used.  This is used later by the
11541         compiler to resolve the reference to an actual Type. 
11542
11543         * DeclSpace is no longer a CIR.Type, and neither are
11544         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
11545         are all DeclSpaces, but no Types. 
11546
11547         * type.cs (TypeRefManager): This implements the TypeRef manager,
11548         which keeps track of all the types that need to be resolved after
11549         the parsing has finished. 
11550
11551 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
11552
11553         * ARGH.  We are going to have to store `foreach' as a class rather
11554         than resolving it, as we need to verify error 1579 after name
11555         resolution.   *OR* we could keep a flag that says `This request to
11556         IEnumerator comes from a foreach statement' which we can then use
11557         to generate the error.
11558
11559 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
11560
11561         * class.cs (TypeContainer.AddMethod): we now add methods to the
11562         MethodGroup instead of the method hashtable.  
11563
11564         * expression.cs: Add MethodGroup abstraction, which gets us one
11565         step closer to the specification in the way we handle method
11566         declarations.  
11567
11568         * cs-parser.jay (primary_expression): qualified_identifier now
11569         tried to match up an identifier to a local variable reference or
11570         to a parameter reference.
11571
11572         current_local_parameters is now a parser global variable that
11573         points to the current parameters for the block, used during name
11574         lookup.
11575
11576         (property_declaration): Now creates an implicit `value' argument to
11577         the set accessor.
11578
11579 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
11580
11581         * parameter.cs: Do not use `param' arguments as part of the
11582         signature, per the spec.
11583
11584 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
11585
11586         * decl.cs: Base class for classes, structs and interfaces.  This
11587         is the "Declaration Space" 
11588
11589         * cs-parser.jay: Use CheckDef for checking declaration errors
11590         instead of having one on each function.
11591
11592         * class.cs: Factor out some code for handling error handling in
11593         accordance to the "Declarations" section in the "Basic Concepts"
11594         chapter in the ECMA C# spec.
11595
11596         * interface.cs: Make all interface member classes derive from
11597         InterfaceMemberBase.
11598
11599 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
11600
11601         * Many things: all interfaces are parsed and generated in
11602         gen-treedump.  Support for member variables, constructors,
11603         destructors, properties, constants is there.
11604
11605         Beginning of the IL backend, but very little done, just there for
11606         testing purposes. 
11607
11608 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
11609
11610         * cs-parser.jay: Fix labeled statement.
11611
11612         * cs-tokenizer.cs (escape): Escape " and ' always.
11613         ref_line, ref_name: keep track of the line/filename as instructed
11614         by #line by the compiler.
11615         Parse #line.
11616
11617 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
11618
11619         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
11620         to match the values in System.CodeDOM.
11621
11622         Divid renamed to Divide.
11623
11624         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
11625         statements. 
11626         (Statements.set): remove.
11627
11628         * System.CodeDOM/CodeCatchClause.cs: always have a valid
11629         statements. 
11630
11631         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
11632         falseStatements always have valid values. 
11633
11634         * cs-parser.jay: Use System.CodeDOM now.
11635