2003-05-27 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
2
3         * class.cs (Field.Define): Add missing test for pointers and
4         safety. 
5
6 2003-05-27  Ravi Pratap  <ravi@ximian.com>
7
8         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
9         we use the stobj opcode.
10
11         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
12         since it wasn't the correct fix. 
13
14         It still is puzzling that we are required to use stobj for IntPtr
15         which seems to be a ValueType.
16
17 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
18
19         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
20         during regular simple name resolution.   Now, the trick is that
21         instead of returning for processing the simplename, we do a
22         TypeManager.LookupType (ie, a rooted lookup as opposed to a
23         contextual lookup type).   If a match is found, return that, if
24         not, return for further composition.
25
26         This fixes long-standing 30485.
27
28         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
29         using the address to initialize an object, do an Stobj instead of
30         using the regular Stelem.
31
32         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
33         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
34         Because if we are a BaseIndexerAccess that value will be true.
35         Fixes 43643.
36
37         * statement.cs (GotoCase.Resolve): Return after reporting an
38         error, do not attempt to continue. 
39
40         * expression.cs (PointerArithmetic.Emit): If our operand is a
41         long, convert our constants to match the operand before
42         multiplying.  Convert to I type before adding.   Fixes 43670.
43         
44 2003-05-14  Ravi Pratap  <ravi@ximian.com>
45
46         * enum.cs (ImplicitConversionExists) : Rename to
47         ImplicitEnumConversionExists to remove ambiguity. 
48
49         * ecore.cs (NullCast): New type of cast expression class which
50         basically is very similar to EmptyCast with the difference being
51         it still is a constant since it is used only to cast a null to
52         something else
53         (eg. (string) null)
54
55         * convert.cs (ImplicitReferenceConversion): When casting a null
56         literal, we return a NullCast.
57
58         * literal.cs (NullLiteralTyped): Remove - I don't see why this
59         should be around anymore.
60
61         The renaming (reported was slightly wrong). Corrections:
62
63         ConvertImplicitStandard -> ImplicitConversionStandard
64         ConvertExplicitStandard -> ExplicitConversionStandard
65
66         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
67         before passing them in !
68
69         * convert.cs (ImplicitConversionStandard): When comparing for
70         equal expr and target types, ensure that expr is not a
71         NullLiteral.
72
73         In general, we must not be checking (expr_type ==
74         target_type) in the top level conversion methods
75         (ImplicitConversion, ExplicitConversion etc). This checking is
76         done in the methods that they delegate to.
77
78 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
79
80         * convert.cs: Move Error_CannotConvertType,
81         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
82         ImplicitNumericConversion, ImplicitConversionExists,
83         ImplicitUserConversionExists, StandardConversionExists,
84         FindMostEncompassedType, FindMostSpecificSource,
85         FindMostSpecificTarget, ImplicitUserConversion,
86         ExplicitUserConversion, GetConversionOperators,
87         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
88         TryImplicitIntConversion, Error_CannotConvertImplicit,
89         ConvertImplicitRequired, ConvertNumericExplicit,
90         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
91         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
92         its own file.
93
94         Perform the following renames:
95         
96         StandardConversionExists -> ImplicitStandardConversionExists
97         ConvertImplicit -> ImplicitConversion
98         ConvertImplicitStandard -> ImplicitStandardConversion
99         TryImplicitIntConversion -> ImplicitIntConversion
100         ConvertImplicitRequired -> ImplicitConversionRequired
101         ConvertNumericExplicit -> ExplicitNumericConversion
102         ConvertReferenceExplicit -> ExplicitReferenceConversion
103         ConvertExplicit -> ExplicitConversion
104         ConvertExplicitStandard -> ExplicitStandardConversion
105
106 2003-05-19  Martin Baulig  <martin@ximian.com>
107
108         * statement.cs (TypeInfo.StructInfo): Made this type protected.
109         (TypeInfo): Added support for structs having structs as fields.
110
111         * ecore.cs (FieldExpr): Implement IVariable.
112         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
113         VariableInfo for the field.
114
115 2003-05-18  Martin Baulig  <martin@ximian.com>
116
117         * expression.cs (This.DoResolve): Report a CS0027 if we're
118         emitting a field initializer.
119
120 2003-05-18  Martin Baulig  <martin@ximian.com>
121
122         * expression.cs (This.ResolveBase): New public function.
123         (This.DoResolve): Check for CS0188.
124
125         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
126         This.Resolve().
127
128         * ecore.cs (MethodGroupExpr.DoResolve): Set the
129         `instance_expression' to null if we don't have any non-static
130         methods.
131
132 2003-05-18  Martin Baulig  <martin@ximian.com>
133
134         Reworked the way how local variables and parameters are handled by
135         the flow analysis code.
136
137         * statement.cs (TypeInfo, VariableMap): New public classes.
138         (VariableInfo): New public class.  This is now responsible for
139         checking whether a variable has been assigned.  It is used for
140         parameters and local variables.
141         (Block.EmitMeta): Take the InternalParameters as argument; compute
142         the layout of the flow vectors here.
143         (Block.LocalMap, Block.ParameterMap): New public properties.
144         (FlowBranching): The .ctor doesn't get the InternalParameters
145         anymore since Block.EmitMeta() now computes the layout of the flow
146         vector.
147         (MyStructInfo): This class is now known as `StructInfo' and nested
148         in `TypeInfo'; we don't access this directly anymore.
149
150         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
151         property and removed IsAssigned(), IsFieldAssigned(),
152         SetAssigned() and SetFieldAssigned(); we now call them on the
153         VariableInfo so we don't need to duplicate this code everywhere.
154
155         * expression.cs (ParameterReference): Added `Block block' argument
156         to the .ctor.
157         (LocalVariableReference, ParameterReference, This): The new
158         VariableInfo class is now responsible for all the definite
159         assignment stuff.
160
161         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
162         IsParameterAssigned, SetParameterAssigned): Removed.
163
164 2003-05-18  Martin Baulig  <martin@ximian.com>
165
166         * typemanager.cs (InitCoreTypes): Try calling
167         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
168         the 3-args-version.  Corlib now also needs our `void_type'.
169         (GetMethod): Added overloaded version which takes an optional
170         `bool report_errors' to allow lookups of optional methods.
171
172 2003-05-12  Martin Baulig  <martin@ximian.com>
173
174         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
175         only used for locals and not for parameters.
176
177 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
178
179         * support.cs (InternalParameters.ParameterType): Return the
180         ExternalType of the parameter.
181
182         * parameter.cs (Parameter.ExternalType): drop the two arguments,
183         they were unused.
184
185 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
186
187         * class.cs (MethodData.Define): Do not set the `newslot' on
188         interface members, if they are also flagged as "override".
189
190         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
191         better code for ++i and i++.  This only works for static fields
192         and local variables.
193
194         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
195         want to pull the DeclSpace out of the builder_to_declspace instead
196         of the TypeBuilder (like in TypeContainer.FindMembers).
197
198         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
199         instead of LookupTypeContainer.  Fixes the crash on .NET for
200         looking up interface members.
201
202         * const.cs: Create our own emit context during the Definition
203         stage, so that constants are evaluated in the proper context, when
204         a recursive definition happens.
205
206 2003-05-11  Martin Baulig  <martin@ximian.com>
207
208         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
209         new block for a switch section.
210         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
211         the adding/lookup in the switch block.  Fixes #39828.
212
213 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
214
215         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
216         functionality: I needed to convert the data after I had performed
217         the add/sub operation into the operands type size.
218
219         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
220         pass the type for the box operation, otherwise the resulting
221         object would have been of type object.
222
223         (BoxedCast): Add constructor to specify the type to box as.
224
225 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
226
227         * iterators.cs: I was reusing the `count' variable inadvertently,
228         take steps to not allow this to happen.
229
230 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
231
232         * attribute.cs (Attribute.Resolve): Params attributes are encoded
233         by creating an array at the point where the params starts and
234         putting all those arguments there, then adjusting the size of the
235         array.
236
237 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
238
239         * expression.cs (New.AddressOf): Implement interface
240         IMemoryLocation.  This is used when the `new' operator is used in
241         the context of an invocation to a method on a value type.
242
243         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
244         example. 
245
246         * namespace.cs: Also check the using aliases here.
247
248         * driver.cs: Move the test for using validity after the types have
249         been entered, so we do a single pass that also includes the using
250         aliases. 
251
252         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
253         in the regular case.   CreateSiblingForFinally is doing extra
254         error checking.
255
256         * attribute.cs (GetAttributeArgumentExpression): Store the result
257         on an out value, and use the return value to indicate failure
258         instead of using null (which is a valid return for Constant.GetValue).
259
260         * statement.cs: Perform the analysis flow for the increment
261         portion after the statement, because this will be the real flow of
262         execution.  Fixes #42385
263
264         * codegen.cs (EmitContext.EmitArgument,
265         EmitContext.EmitStoreArgument): New helper functions when the
266         RemapToProxy flag is set.
267
268         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
269         function.
270
271         Add support for remapping parameters. 
272
273         * iterators.cs: Propagate parameter values;  Store parameter
274         values in the proxy classes.
275         
276 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
277
278         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
279         need a proxy reference;  I do not know what I was thinking
280
281         * cs-parser.jay (constructor_initializer): catch another error,
282         and display nice message.
283         
284         (field_declaration): catch void field declaration
285         to flag a better error. 
286
287         * class.cs (MemberBase.CheckBase): Report an error instead of a
288         warning if a new protected member is declared in a struct. 
289         (Field.Define): catch the error of readonly/volatile.
290
291         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
292
293         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
294         volatile variable is taken
295
296 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
297
298         * statement.cs (Fixed.Resolve): Report an error if we are not in
299         an unsafe context.
300
301 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
302
303         * typemanager.cs: reuse the code that handles type clashes for
304         delegates and enumerations.
305
306         * class.cs (Report28): Always report.
307
308         * expression.cs (EncodeAsAttribute): Allow nulls here.
309
310 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
311
312         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
313         the functionality for testing whether an expression is valid for
314         an attribute here.  Also handle the case of arrays of elements
315         being stored. 
316
317         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
318         encoding a linear array into an array of objects that are suitable
319         to be passed to an CustomAttributeBuilder.
320
321         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
322
323         * ecore.cs: (FieldExpr): Handle field remapping here.
324
325         * iteratators.cs: Pass the instance variable (if the method is an
326         instance method) to the constructors, so we can access the field
327         variables on the class.
328
329         TODO: Test this with structs.  I think the THIS variable on
330         structs might have to be a pointer, and not a refenrece
331
332 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
333
334         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
335         local variables to fields in a proxy class.
336
337         * iterators.cs (PopulateProxy): Rename our internal fields to
338         <XXX>.  
339         Create a <THIS> field if we are an instance method, so we can
340         reference our parent container variables.
341         (MapVariable): Called back from the EmitContext code to enter a
342         new variable to field mapping into the proxy class (we just create
343         a FieldBuilder).
344
345         * expression.cs
346         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
347         for using the remapped locals to fields.
348
349         I placed the code here, because that gives the same semantics to
350         local variables, and only changes the Emit code.
351
352         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
353         statements inside iterators.
354         (VariableInfo): Add a FieldBuilder for the cases when we are
355         remapping local variables to fields in a proxy class
356
357         * ecore.cs (SimpleNameResolve): Avoid testing two times for
358         current_block != null.
359
360         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
361         not cope with strings, as it has been moved to the
362         TableSwitchEmit.  Fixed bug in switch generation.
363
364         * expression.cs (New.DoResolve): Provide more context for the user
365         when reporting an error.
366
367         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
368         pointers. 
369
370         * expression.cs (MemberAccess.DoResolve): When we get a type back,
371         check the permissions for it.  Note than in a type-resolution
372         context the check was already present in DeclSpace.ResolveType,
373         but was missing from the MemberAccess.
374
375         (ArrayCreation.CheckIndices): warn if the user has
376         more nested levels of expressions, but there are no more
377         dimensions specified.  Avoids crash on bug 41906.
378
379 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
380
381         * statement.cs (Block): replace Implicit bool, for a generic
382         flags.   
383         New flag: `Unchecked'.  This is used during the EmitMeta phase
384         (which is out-of-line with the regular Resolve/Emit process for a
385         statement, as this is done ahead of time, but still gets a chance
386         to call constant resolve).
387         
388         (Block.Flags): new enum for adding a new flag.
389
390         (Block.EmitMeta): track the state of unchecked.
391         
392         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
393         to enable constant resolution to work there as well.
394
395 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
396
397         * typemanager.cs (ienumerable_type): Also look up
398         System.Collections.IEnumerable. 
399
400 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
401
402         TODO: Test more than one conditional per method.
403         
404         * class.cs (Indexer.Define): Report the location where the user is
405         referencing the unsupported feature.
406
407         (MethodData): Overload the use of `conditionals' to
408         minimize the creation of needless ArrayLists.   This saves roughly
409         212kb on my machine.
410
411         (Method): Implement the new IIteratorContainer interface.
412         (Method.SetYields): Implement the method by setting the ModFlags
413         to contain METHOD_YIELDS.
414         
415         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
416         which just got set to null.
417
418         * iterators.cs: New file.
419
420         (Yield, YieldBreak): New statements.
421
422         * statement.cs (Return.Resolve): Flag an error if we are used in
423         an iterator method.
424
425         * codegen.cs (InIterator): New flag set if the code is being
426         compiled in an iterator method.
427
428         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
429         internal modifier, and we just use it to avoid adding extra
430         fields, as this is seldom used.  
431
432         * cs-parser.jay: Add yield_statement (yield and yield break).
433
434         * driver.cs: New flag -v2 to turn on version 2 features. 
435
436         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
437         hashtable when v2 is enabled.
438
439 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
440
441         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
442         there is already a namespace defined with this name.
443
444         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
445         people upgraded their corlibs.
446
447         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
448         always use fully qualified types, no need to use the compiler
449         front end.
450
451         (TypeManager.IsNamespace): Use binarysearch.
452         
453         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
454         AddDelegate): I did not quite use the new IsValid API properly: I
455         have to pass the short-name and the fullname.  I was passing only
456         the basename instead of the fullname sometimes. 
457
458         (TypeContainer.DefineType): call NamespaceClash.
459
460         * interface.cs (Interface.DefineType): use NamespaceClash before
461         defining the type.
462
463         * delegate.cs (Delegate.DefineType): use NamespaceClash before
464         defining the type.
465
466         * enum.cs: (Enum.DefineType): use NamespaceClash before
467         defining the type.
468
469         * typemanager.cs (: 3-line patch that gives us some tasty 11%
470         speed increase.  First, use the negative_hits cache when we get a
471         negative.  Second, add the type with its full original name
472         instead of the new . and + encoded name (reflection uses + to
473         separate type from a nested type).  Use LookupTypeReflection
474         directly which bypasses the type->name hashtable (that we already
475         know does not contain the type.
476         
477         * decl.cs (DeclSpace.ResolveTypeExpr): track the
478         location/container type. 
479
480         * driver.cs: When passing utf8, use directly the UTF8Encoding.
481
482 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
483
484         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
485
486         * delegate.cs (NewDelegate.Resolve): Test whether an instance
487         method is being referenced in the method group from a static
488         context, and report error 120 if so.
489
490         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
491         Error118. 
492
493         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
494         is created, we create the A namespace).
495
496         * cs-parser.jay: A namespace also introduces a DeclarationFound.
497         Fixes #41591
498
499 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
500
501         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
502         invocation to ModuleBuilder.GetType with the same values will
503         return a new type instance, so we need to cache its return
504         values. 
505
506         * expression.cs (Binary.ResolveOperator): Only allow the compare
507         operators on enums if they are of the same type.
508
509         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
510         types of ValueType on their own case.  Before we were giving them
511         the same treatment as objects.
512
513         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
514         fullname.  Short name is used to compare against container name.
515         Fullname is used to check against defined namespace names.
516         
517         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
518         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
519
520         (Method.CheckBase): Call parent.
521         (MemberBase.CheckBase): Check for protected members on sealed
522         classes.
523         (PropertyBase.CheckBase): Call parent.
524         (Field.Define): Call parent.
525
526         * report.cs: Negative error codes are now mapped to 8000 - code,
527         so that the display is render more nicely.
528
529         * typemanager.cs: Do not use try/catch, instead report a regular
530         error. 
531
532         (GetPointerType, GetReferenceType): These methods provide
533         mechanisms to obtain the T* and T& from a T.  We had the code
534         previously scattered around the code base, and it also used
535         TypeManager.LookupType that would go through plenty of caches.
536         This one goes directly to the type source.
537
538         In some places we did the Type.GetType followed by
539         ModuleBuilder.GetType, but not in others, so this unifies the
540         processing as well.
541
542         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
543         statements now that we have namespace information.
544
545         * typemanager.cs (IsNamespace): New method, returns whether the
546         string presented is a namespace or not.
547
548         (ComputeNamespaces): New public entry point, computes the list of
549         available namespaces, using the GetNamespaces API call in Mono, or
550         the slower version in MS.NET.   
551
552         Now before we start the semantic analysis phase, we have a
553         complete list of namespaces including everything that the user has
554         provided.
555
556         Deleted old code to cache namespaces in .nsc files.
557
558 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
559
560         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
561         class/struct location definition Location for the implicit
562         constructor location.
563
564         (Operator.Define): Use the location of the operator for the
565         implicit Method definition.
566
567         (Constructor.Emit): use the constructor location for the implicit
568         base initializer constructor.
569
570         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
571         and the Expression class now contains two new methods:
572
573         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
574         isolate type lookup from the rest of the resolution process.
575
576         Since we use Expressions to hold type definitions due to the way
577         we parse the input we have historically overloaded Resolve to
578         perform the Type lookups if a special flag is passed.  Now this is
579         eliminated and two methods take their place. 
580         
581         The differences in the two methods between xStep and xTerminal is
582         that xStep is involved in our current lookup system that uses
583         SimpleNames to compose a name, while xTerminal is used just to
584         catch the case where the simplename lookup failed.
585         
586 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
587
588         * expression.cs (ResolveMemberAccess): Remove redundant code.
589         TypeExpr expressions are always born fully resolved.
590
591         * interface.cs (PopulateMethod): Do not lookup the types twice.
592         We were doing it once during SemanticAnalysis and once during
593         PopulateMethod.
594
595         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
596         in local variable type definitions, were being returned as a
597         SimpleName (we decomposed everything into a string), that is
598         because primary_expression was being used instead of a type in the
599         grammar (reduce/reduce conflicts).
600
601         The part that was wrong is that we converted the expression into a
602         string (an oversimplification in one hand, compounded with primary
603         expressions doing string concatenation).
604
605         So things like:
606
607         A.B.C [] x;
608
609         Would return "A.B.C[]" as a SimpleName.  This stopped things like
610         using clauses from working on this particular context.  And a type
611         was being matched directly against "A.B.C[]".
612
613         We now use the correct approach, and allow for ComposedCast to be
614         part of the unary expression.  So the "A.B.C []" become a composed
615         cast of "A.B.C" (as a nested group of MemberAccess with a
616         SimpleName at the end) plus the rank composition "[]". 
617
618         Also fixes 35567
619         
620 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
621
622         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
623         for the access level checking.
624
625         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
626         `TypeContainer container', because I kept getting confused when I
627         was debugging this code.
628
629         * expression.cs (Indexers): Instead of tracking getters/setters,
630         we now track them in parallel.  We create one arraylist less, but
631         most importantly it is possible now for the LValue code to find a
632         matching get for a set.
633
634         (IndexerAccess.DoResolveLValue): Update the code.
635         GetIndexersForType has been modified already to extract all the
636         indexers from a type.  The code assumed it did not.
637
638         Also make the code set the correct return type for the indexer.
639         This was fixed a long time ago for properties, but was missing for
640         indexers.  It used to be void_type.
641
642         (Binary.Emit): Test first for doubles instead of
643         floats, as they are more common.
644
645         (Binary.EmitBranchable): Use the .un version of the branch opcodes
646         when dealing with floats and the <=, >= operators.  This fixes bug
647         #39314 
648
649         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
650         to load the array value by emitting a load on the foreach variable
651         type.  This was incorrect.  
652
653         We now emit the code to load an element using the the array
654         variable type, and then we emit the conversion operator.
655
656         Fixed #40176
657
658 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
659
660         * attribute.cs: Avoid allocation of ArrayLists in the common case.
661
662 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
663
664         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
665         test for protection before we test for signatures. 
666
667         (MethodSignature.ToString): implement.
668
669         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
670         to the case where we reduced into a LongConstant.
671
672         * decl.cs (CheckAccessLevel): If the type is an array, we can not
673         depend on whether the information is acurrate, because the
674         Microsoft runtime will always claim that the array type is public,
675         regardless of the real state.
676
677         If the type is a pointer, another problem happens: the type is
678         reported as non-public in Microsoft.  
679
680         In both cases we have to call CheckAccessLevel recursively with
681         the underlying type as the argument to be tested.
682
683 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
684
685         * assign.cs (Assign.Emit): If we are dealing with a compound
686         assignment expression, we should use the code path that stores the
687         intermediate result in a temporary value.  This fixes #40903.
688
689         *expression.cs (Indirection.ToString): Provide ToString method for
690         debugging. 
691         
692 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
693
694         * class.cs: Null out fields holding references to Block objects so
695         they can be garbage collected.
696
697         * expression.cs (OverloadResolve): Remove unused local.
698
699 2003-04-07  Martin Baulig  <martin@ximian.com>
700
701         * codegen.cs (EmitContext.CurrentFile): New public field.
702         (EmitContext.Mark): Use the CurrentFile to check whether the
703         location is in the correct file.
704         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
705
706 2003-04-07  Martin Baulig  <martin@ximian.com>
707
708         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
709
710         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
711         location.  [FIXME: The location argument which gets passed to this
712         method is sometimes wrong!]
713
714 2003-04-07  Nick Drochak <ndrochak@gol.com>
715
716         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
717
718 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
719
720         * expression.cs (Indirection.EmitAssign): We were using the
721         temporary, but returning immediately instead of continuing the
722         EmitAssing flow.
723
724 2003-04-06  Martin Baulig  <martin@ximian.com>
725
726         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
727         if it's a nested child, but also deriving from the outer class.
728         See test 190.cs.
729
730         * typemanager.cs (IsNestedChildOf): Make this work if it's a
731         nested child, but also deriving from the outer class.  See
732         test-190.cs.
733         (FilterWithClosure): We may access private members of the outer
734         class if we're a nested child and deriving from the outer class.
735         (RealMemberLookup): Only set `closure_private_ok' if the
736         `original_bf' contained BindingFlags.NonPublic.
737
738 2003-04-05  Martin Baulig  <martin@ximian.com>
739
740         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
741
742 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
743
744         * class.cs (Event.Define): Do not allow abstract events to have
745         initializers. 
746
747 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
748
749         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
750         block in event declarations.
751
752         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
753         value type, get its address.
754
755         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
756         leaving a class on the stack instead of a boolean value (int
757         0/1).  Change the code so we compare against null, and then the
758         result against zero.
759
760         * class.cs (TypeContainer.GetClassBases): We were checking for the
761         parent class being sealed too late.
762
763         * expression.cs (Binary.Emit): For <= and >= when dealing with
764         floating point values, use cgt.un and clt.un instead of cgt and
765         clt alone.
766
767 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
768
769         * statement.cs: Apply the same optimization as MS: skip the 
770         GetEnumerator returning an IEnumerator, and use the one returning a 
771         CharEnumerator instead. This allows us to avoid the try-finally block 
772         and the boxing.
773
774 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
775
776         * cs-parser.jay: Attributes cannot be applied to
777                          namespaces. Fixes #40473
778
779 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
780
781         * class.cs:
782         (Add*): check if the name is valid using the full name for constants,
783         fields, properties and events.
784
785 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
786
787         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
788         char constants to be part of the enumeration.
789
790         * expression.cs (Conditional.DoResolve): Add support for operator
791         true. Implements the missing functionality from 14.12
792
793         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
794         operator true/false as required by the spec.
795
796         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
797         implicit conversion to boolean.
798
799         * statement.cs (Statement.ResolveBoolean): A boolean expression is
800         also one where the type implements `operator true'. 
801
802         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
803         get an expression that will invoke operator true based on an
804         expression.  
805
806         (GetConversionOperators): Removed the hack that called op_True
807         here.  
808
809         (Expression.ResolveBoolean): Move this from Statement.
810
811 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
812
813         * ecore.cs (FieldExpr): do not allow initialization of initonly
814         fields on derived classes
815
816 2003-03-13  Martin Baulig  <martin@ximian.com>
817
818         * statement.cs (Block.Emit): Call ig.BeginScope() and
819         ig.EndScope() when compiling with debugging info; call
820         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
821
822 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
823
824         * expression.cs (Indexers): Do not construct immediately, allow
825         for new members to be appended as we go.  Fixes 38143
826
827 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
828
829         * expression.cs: save/restore context when resolving an unchecked
830         expression.
831
832 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
833
834         * cfold.cs: Catch division by zero in modulus operator during
835         constant folding.
836
837 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
838
839         * interface.cs (Interface.DefineMembers): Avoid defining members
840         twice. 
841
842 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
843
844         * driver.cs: handle the +/- options for -noconfig
845
846         * statement.cs (Unckeched.Resolve): Also track the state of
847         unchecked in the Resolve phase.
848
849 2003-02-27  Martin Baulig  <martin@ximian.com>
850
851         * ecore.cs (Expression.MemberLookup): Don't create a
852         MethodGroupExpr for something which is not a method.  Fixes #38291.
853
854 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
855
856         * class.cs (MemberBase.CheckParameters): Also check that the type
857         is unmanaged if it is a pointer.
858
859         * expression.cs (SizeOf.Resolve): Add location information.
860
861         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
862         a managed type is declared.
863
864         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
865         parameter modifiers as well.  Fixes bug 38606
866
867         * class.cs: Very sad.  Am backing out the speed up changes
868         introduced by the ArrayList -> Array in the TypeContainer, as they
869         were not actually that much faster, and introduced a bug (no error
870         reports on duplicated methods).
871
872         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
873         source first, this will guarantee that we have a valid expression
874         before calling in lower levels functions that will require a
875         resolved object.  Then use this original_source in the
876         target.ResolveLValue instead of the original source that was
877         passed to us.
878
879         Another change.  Use target.Resolve instead of LValueResolve.
880         Although we are resolving for LValues, we will let the Assign code
881         take care of that (it will be called again from Resolve).  This
882         basically allows code like this:
883
884         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
885         class Y { void A (X x) { x [0] += o; }
886
887         The problem was that the indexer was trying to resolve for
888         set_Item (idx, object o) and never finding one.  The real set_Item
889         was set_Item (idx, X).  By delaying the process we get the right
890         semantics. 
891
892         Fixes bug 36505
893         
894 2003-02-23  Martin Baulig  <martin@ximian.com>
895
896         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
897         while calling DoEmit ().
898
899         * codegen.cs (EmitContext.Mark): Don't mark locations in other
900         source files; if you use the #line directive inside a method, the
901         compiler stops emitting line numbers for the debugger until it
902         reaches the end of the method or another #line directive which
903         restores the original file.
904
905 2003-02-23  Martin Baulig  <martin@ximian.com>
906
907         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
908
909 2003-02-23  Martin Baulig  <martin@ximian.com>
910
911         * statement.cs (Block.AddChildVariableNames): We need to call this
912         recursively, not just for our immediate children.
913
914 2003-02-23  Martin Baulig  <martin@ximian.com>
915
916         * class.cs (Event.Define): Always make the field private, like csc does.
917
918         * typemanager.cs (TypeManager.RealMemberLookup): Make events
919         actually work, fixes bug #37521.
920
921 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
922
923         * delegate.cs: When creating the various temporary "Parameters"
924         classes, make sure that we call the ComputeAndDefineParameterTypes
925         on those new parameters (just like we do with the formal ones), to
926         allow them to be resolved in the context of the DeclSpace.
927
928         This fixes the bug that Dick observed in Bugzilla #38530.
929
930 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
931
932         * expression.cs (ResolveMemberAccess): When resolving a constant,
933         do not attempt to pull a constant if the value was not able to
934         generate a valid constant.
935
936         * const.cs (LookupConstantValue): Do not report more errors than required.
937
938 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
939
940         * expression.cs: fixes bug #38328.
941
942 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
943
944         * class.cs: Changed all the various members that can be part of a
945         class from being an ArrayList to be an Array of the right type.
946         During the DefineType type_list, interface_list, delegate_list and
947         enum_list are turned into types, interfaces, delegates and enums
948         arrays.  
949
950         And during the member population, indexer_list, event_list,
951         constant_list, field_list, instance_constructor_list, method_list,
952         operator_list and property_list are turned into their real arrays.
953
954         Although we could probably perform this operation earlier, for
955         good error reporting we need to keep the lists and remove the
956         lists for longer than required.
957
958         This optimization was triggered by Paolo profiling the compiler
959         speed on the output of `gen-sample-program.pl' perl script. 
960
961         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
962         not crash in methods like MemberLookupFailed that use this field.  
963
964         This problem arises when the compiler fails to resolve a type
965         during interface type definition for example.
966
967 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
968
969         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
970         inherit from System.Object, so we have to stop at null, not only
971         when reaching System.Object.
972
973 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
974
975         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
976         DeclaredOnly because the parent indexer might have had a different
977         name, but did not loop until the top of the hierarchy was reached.
978
979         The problem this one fixes is 35492: when a class implemented an
980         indexer from an interface, we were getting the interface method
981         (which was abstract) and we were flagging an error (can not invoke
982         abstract method).
983
984         This also keeps bug 33089 functioning, and test-148 functioning.
985
986         * typemanager.cs (IsSpecialMethod): The correct way of figuring
987         out if a method is special is to see if it is declared in a
988         property or event, or whether it is one of the predefined operator
989         names.   This should fix correctly #36804.
990
991 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
992
993         The goal here is to remove the dependency on EmptyCast.Peel ().
994         Killing it completely.
995         
996         The problem is that currently in a number of places where
997         constants are expected, we have to "probe" for an EmptyCast, and
998         Peel, which is not the correct thing to do, as this will be
999         repetitive and will likely lead to errors. 
1000
1001         The idea is to remove any EmptyCasts that are used in casts that
1002         can be reduced to constants, so we only have to cope with
1003         constants. 
1004
1005         This bug hunt was triggered by Bug 37363 and the desire to remove
1006         the duplicate pattern where we were "peeling" emptycasts to check
1007         whether they were constants.  Now constants will always be
1008         constants.
1009         
1010         * ecore.cs: Use an enumconstant here instead of wrapping with
1011         EmptyCast.  
1012
1013         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
1014         throwing me off.  By handling this we can get rid of a few hacks.
1015         
1016         * statement.cs (Switch): Removed Peel() code.
1017
1018 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
1019
1020         * class.cs: Location information for error 508
1021
1022         * expression.cs (New.DoResolve): Add a guard against double
1023         resolution of an expression.  
1024
1025         The New DoResolve might be called twice when initializing field
1026         expressions (see EmitFieldInitializers, the call to
1027         GetInitializerExpression will perform a resolve on the expression,
1028         and later the assign will trigger another resolution
1029
1030         This leads to bugs (#37014)
1031
1032         * delegate.cs: The signature for EndInvoke should contain any ref
1033         or out parameters as well.  We were not doing this in the past. 
1034
1035         * class.cs (Field.Define): Do not overwrite the type definition
1036         inside the `volatile' group.  Turns out that volatile enumerations
1037         were changing the type here to perform a validity test, which
1038         broke conversions. 
1039
1040 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
1041
1042         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
1043         and structs, we do not want to load the instance variable
1044
1045         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
1046         enum_type has to be handled like an object reference (implicit
1047         conversions exists from this to object), but the regular IsClass
1048         and IsValueType tests will never return true for this one.
1049
1050         Also we use TypeManager.IsValueType instead of type.IsValueType,
1051         just for consistency with the rest of the code (this is only
1052         needed if we ever use the construct exposed by test-180.cs inside
1053         corlib, which we dont today).
1054
1055 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
1056
1057         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
1058         just InternalCall.
1059
1060 2003-02-09  Martin Baulig  <martin@ximian.com>
1061
1062         * namespace.cs (Namespace..ctor): Added SourceFile argument.
1063         (Namespace.DefineNamespaces): New static public method; this is
1064         called when we're compiling with debugging to add all namespaces
1065         to the symbol file.
1066
1067         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
1068         pass it to the Namespace's .ctor.
1069
1070         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
1071         and MethodBase arguments; pass the namespace ID to the symwriter;
1072         pass the MethodBase instead of the token to the symwriter.
1073         (SymbolWriter.DefineNamespace): New method to add a namespace to
1074         the symbol file.
1075
1076 2003-02-09  Martin Baulig  <martin@ximian.com>
1077
1078         * symbolwriter.cs: New file.  This is a wrapper around
1079         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
1080         methods here in near future.
1081
1082 2003-02-09  Martin Baulig  <martin@ximian.com>
1083
1084         * codegen.cs (EmitContext.Mark): Just pass the arguments to
1085         ILGenerator.MarkSequencePoint() which are actually used by the
1086         symbol writer.
1087
1088 2003-02-09  Martin Baulig  <martin@ximian.com>
1089
1090         * location.cs (SourceFile): New public sealed class.  This
1091         contains the name and an index which is used in the location's token.
1092         (Location): Reserve an appropriate number of bits in the token for
1093         the source file instead of walking over that list, this gives us a
1094         really huge performance improvement when compiling with debugging.
1095
1096         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
1097         `SourceFile' argument instead of a string.
1098         (Driver.ProcessFile): Add all the files via Location.AddFile(),
1099         but don't parse/tokenize here, we need to generate the list of all
1100         source files before we do that.
1101         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
1102         the files.
1103
1104         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
1105         instead of a string.
1106
1107         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
1108         of a string.
1109
1110 2003-02-09  Martin Baulig  <martin@ximian.com>
1111
1112         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
1113         filename on `#line default'.
1114
1115 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
1116
1117         * statement.cs: don't clear the pinned var when the fixed statement
1118         returns from the method (fixes bug#37752).
1119
1120 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
1121
1122         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
1123         to IsValueType.
1124
1125 2003-02-07  Martin Baulig  <martin@ximian.com>
1126
1127         * driver.cs: Removed the `--debug-args' command line argument.
1128
1129         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
1130         automatically by the AsssemblyBuilder.
1131         (CodeGen.InitializeSymbolWriter): We don't need to call any
1132         initialization function on the symbol writer anymore.  This method
1133         doesn't take any arguments.
1134
1135 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
1136
1137         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
1138         from referenced assemblies as well.
1139
1140 2003-02-02  Martin Baulig  <martin@ximian.com>
1141
1142         * class.cs (MethodData.Emit): Generate debugging info for external methods.
1143
1144 2003-02-02  Martin Baulig  <martin@ximian.com>
1145
1146         * class.cs (Constructor.Emit): Open the symbol writer before
1147         emitting the constructor initializer.
1148         (ConstructorInitializer.Emit): Call ec.Mark() to allow
1149         single-stepping through constructor initializers.
1150
1151 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
1152
1153         * class.cs: Handle error 549: do not allow virtual methods in
1154         sealed classes. 
1155
1156 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
1157
1158         * decl.cs: Check access levels when resolving types
1159         
1160 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
1161
1162         * statement.cs: Add parameters and locals set in catch blocks that might 
1163         return to set vector
1164
1165 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
1166
1167         * class.cs (Operator): Set the SpecialName flags for operators.
1168         
1169         * expression.cs (Invocation.DoResolve): Only block calls to
1170         accessors and operators on SpecialName methods.
1171
1172         (Cast.TryReduce): Handle conversions from char constants.
1173
1174
1175 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
1176
1177         * statement.cs: small memory and time optimization in FlowBranching.
1178         
1179 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
1180
1181         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
1182         problem that the last fix but in the other sid (Set).
1183
1184         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
1185         access when there is no indexer in the hierarchy.
1186         
1187 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
1188
1189         * class.cs: Combine some if statements.
1190
1191 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1192
1193         * driver.cs: fixed bug #37187.
1194
1195 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
1196
1197         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
1198         any indexer, it's needed to build a list with all the indexers in the
1199         hierarchy (AllGetters), else we have problems. Fixes #35653.
1200
1201 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
1202
1203         * class.cs (MethodData.Define): It is wrong for an interface
1204         implementation to be static in both cases: explicit and implicit.
1205         We were only handling this in one case.
1206
1207         Improve the if situation there to not have negations.
1208         
1209         * class.cs (Field.Define): Turns out that we do not need to check
1210         the unsafe bit on field definition, only on usage.  Remove the test.
1211
1212 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1213
1214         * driver.cs: use assembly.Location instead of Codebase (the latest
1215         patch made mcs fail when using MS assemblies).
1216
1217 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
1218
1219         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
1220         get the path to *corlib.dll.
1221
1222 2003-01-21  Nick Drochak <ndrochak@gol.com>
1223
1224         * cs-tokenizer.cs:
1225         * pending.cs:
1226         * typemanager.cs: Remove compiler warnings
1227
1228 2003-01-20  Duncan Mak  <duncan@ximian.com>
1229
1230         * AssemblyInfo.cs: Bump the version number to 0.19.
1231         
1232 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1233
1234         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
1235
1236 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
1237
1238         * class.cs (Constructor::Emit): Emit debugging info for constructors.
1239
1240 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
1241
1242         * cs-parser.jay: Small fix: we were not comparing the constructor
1243         name correctly.   Thanks to Zoltan for the initial pointer.
1244
1245 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
1246
1247         * cs-tokenizer.cs: Set file name when specified with #line
1248
1249 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
1250
1251         * cs-parser.jay: Only perform the constructor checks here if we
1252         are named like the class;  This will help provider a better
1253         error.  The constructor path is taken when a type definition is
1254         not found, but most likely the user forgot to add the type, so
1255         report that rather than the constructor error.
1256
1257 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
1258
1259         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
1260         allocations.
1261
1262 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
1263
1264         * cs-parser.jay: Add cleanup call.
1265
1266 2003-01-13  Duncan Mak  <duncan@ximian.com>
1267
1268         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
1269         consistent with other methods.
1270
1271 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
1272
1273         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
1274         
1275 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
1276
1277         * attribute.cs: only set GuidAttr to true when we have a
1278         GuidAttribute.
1279
1280 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1281
1282         * ecore.cs:
1283         * expression.cs:
1284         * typemanager.cs: fixes to allow mcs compile corlib with the new
1285         Type.IsSubclassOf fix.
1286
1287 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
1288
1289         * expression.cs (LocalVariableReference.DoResolve): Classify a
1290         constant as a value, not as a variable.   Also, set the type for
1291         the variable.
1292
1293         * cs-parser.jay (fixed_statement): take a type instead of a
1294         pointer_type, so we can produce a better error message later.
1295         
1296         * statement.cs (Fixed.Resolve): Flag types that are not pointers
1297         as an error.  
1298         
1299         (For.DoEmit): Make inifinite loops have a
1300         non-conditional branch back.
1301
1302         (Fixed.DoEmit): First populate the pinned variables, then emit the
1303         statement, then clear the variables.  Before I was emitting the
1304         code once for each fixed piece.
1305
1306
1307 2003-01-08  Martin Baulig  <martin@ximian.com>
1308
1309         * statement.cs (FlowBranching.MergeChild): A break in a
1310         SWITCH_SECTION does not leave a loop.  Fixes #36155.
1311
1312 2003-01-08  Martin Baulig  <martin@ximian.com>
1313
1314         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
1315         lives in the same number space than `param_map'.  Fixes #36154.
1316
1317 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
1318
1319         * cs-parser.jay (constructor_declaration): Set the
1320         Constructor.ModFlags before probing for it.  This makes the
1321         compiler report 514, 515 and 132 (the code was there, but got
1322         broken). 
1323
1324         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
1325         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
1326         (GotoCase.Resolve): Set `Returns' to ALWAYS.
1327
1328 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
1329
1330         * enum.cs: create the enum static fields using the enum type.
1331
1332 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
1333
1334         * class.cs: don't try to create the ParamBuilder for the return
1335         type if it's not needed (and handle it breaking for the ms runtime
1336         anyway).
1337
1338 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
1339
1340         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
1341
1342 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
1343
1344         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
1345         the command.   This showed up while compiling the JANET source
1346         code, which used \r as its only newline separator.
1347
1348 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
1349
1350         * class.cs (Method.Define): If we are an operator (because it
1351         reuses our code), then set the SpecialName and HideBySig.  #36128
1352
1353 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
1354
1355         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
1356         exception, report error 120 `object reference required'.
1357
1358         * driver.cs: Add --pause option, used during to measure the size
1359         of the process as it goes with --timestamp.
1360
1361         * expression.cs (Invocation.DoResolve): Do not allow methods with
1362         SpecialName to be invoked.
1363
1364 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
1365
1366         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
1367         number before adding it.
1368
1369 2002-12-21  Ravi Pratap  <ravi@ximian.com>
1370
1371         * ecore.cs (StandardImplicitConversion): When in an unsafe
1372         context, we allow conversion between void * to any other pointer
1373         type. This fixes bug #35973.
1374
1375 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
1376
1377         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
1378         is not thrown when extensionless outputs are used 
1379
1380 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1381
1382         * rootcontext.cs: fixed compilation of corlib.
1383
1384 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
1385
1386         * attribute.cs (Attributes.Contains): Add new method.
1387
1388         * class.cs (MethodCore.LabelParameters): if the parameter is an
1389         `out' parameter, check that no attribute `[In]' has been passed.
1390
1391         * enum.cs: Handle the `value__' name in an enumeration.
1392
1393 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
1394
1395         * decl.cs: Added special case to allow overrides on "protected
1396         internal" methods
1397         
1398 2002-12-18  Ravi Pratap  <ravi@ximian.com>
1399
1400         * attribute.cs (Attributes.AddAttributeSection): Rename to this
1401         since it makes much more sense.
1402
1403         (Attributes.ctor): Don't require a Location parameter.
1404         
1405         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
1406
1407         * attribute.cs (ApplyAttributes): Remove extra Location parameters
1408         since we already have that information per attribute.
1409
1410         * everywhere : make appropriate changes.
1411
1412         * class.cs (LabelParameters): Write the code which actually
1413         applies attributes to the return type. We can't do this on the MS
1414         .NET runtime so we flag a warning in the case an exception is
1415         thrown.
1416
1417 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
1418
1419         * const.cs: Handle implicit null conversions here too.
1420
1421 2002-12-17  Ravi Pratap  <ravi@ximian.com>
1422
1423         * class.cs (MethodCore.LabelParameters): Remove the extra
1424         Type [] parameter since it is completely unnecessary. Instead
1425         pass in the method's attributes so that we can extract
1426         the "return" attribute.
1427
1428 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
1429
1430         * cs-parser.jay (parse): Use Report.Error to flag errors instead
1431         of ignoring it and letting the compile continue.
1432
1433         * typemanager.cs (ChangeType): use an extra argument to return an
1434         error condition instead of throwing an exception.
1435
1436 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
1437
1438         * expression.cs (Unary.TryReduce): mimic the code for the regular
1439         code path.  Perform an implicit cast in the cases where we can
1440         implicitly convert to one of the integral types, and then reduce
1441         based on that constant.   This fixes bug #35483.
1442
1443 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1444
1445         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
1446
1447 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1448
1449         * namespace.cs: fixed bug #35489.
1450
1451 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
1452
1453         * class.cs: Remove some dead code.
1454
1455         * cs-parser.jay: Estimate the number of methods needed
1456         (RootContext.MethodCount);
1457
1458         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
1459         numbers instead of StringBuilders.
1460
1461         * support.cs (PtrHashtable): Add constructor with initial size;
1462         We can now reduce reallocations of the method table.
1463
1464 2002-12-10  Ravi Pratap  <ravi@ximian.com>
1465
1466         * attribute.cs (ApplyAttributes): Keep track of the emitted
1467         attributes on a per-target basis. This fixes bug #35413.
1468
1469 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
1470
1471         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
1472         default to the Windows 1252 encoding.
1473
1474         (UnixParseOption): Support version, thanks to Alp for the missing
1475         pointer. 
1476
1477         * AssemblyInfo.cs: Add nice assembly information.
1478
1479         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
1480         (bug 35169).
1481
1482         * cs-parser.jay: Allow a trailing comma before the close bracked
1483         in the attribute_section production.
1484
1485         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
1486         address of the instance was being taken, I will take this out,
1487         because we take the address of the object immediately here.
1488
1489 2002-12-09  Ravi Pratap  <ravi@ximian.com>
1490
1491         * typemanager.cs (AreMultipleAllowed): Take care of the most
1492         obvious case where attribute type is not in the current assembly -
1493         stupid me ;-)
1494
1495 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
1496
1497         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
1498         definitions, instead of doing that afterwards.  
1499
1500         Also we use a nice little hack, depending on the constructor, we
1501         know if we are a "composed" name or a simple name.  Hence, we
1502         avoid the IndexOf test, and we avoid 
1503
1504         * codegen.cs: Add code to assist in a bug reporter to track down
1505         the source of a compiler crash. 
1506
1507 2002-12-07  Ravi Pratap  <ravi@ximian.com>
1508
1509         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
1510         types have been emitted for a given element and flag an error
1511         if something which does not have AllowMultiple set is used more
1512         than once.
1513
1514         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
1515         attribute types and their corresponding AllowMultiple properties
1516
1517         (AreMultipleAllowed): Check the property for a given type.
1518
1519         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
1520         property in the case we have a TypeContainer.
1521
1522         (Attributes.AddAttribute): Detect duplicates and just skip on
1523         adding them. This trivial fix catches a pretty gross error in our
1524         attribute emission - global attributes were being emitted twice!
1525
1526         Bugzilla bug #33187 is now fixed.
1527
1528 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
1529
1530         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
1531         instead of pp_and).
1532
1533         * expression.cs (Binary.ResolveOperator): I can only use the
1534         Concat (string, string, string) and Concat (string, string,
1535         string, string) if the child is actually a concatenation of
1536         strings. 
1537
1538 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
1539
1540         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
1541         context where we need a 2-character lookahead.
1542
1543         * pending.cs (PendingImplementation): Rework so we can keep track
1544         of interface types all the time, and flag those which were
1545         implemented by parents as optional.
1546
1547 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
1548
1549         * expression.cs (Binary.ResolveOperator): Use
1550         String.Concat(string,string,string) or
1551         String.Concat(string,string,string,string) when possible. 
1552
1553         * typemanager: More helper methods.
1554
1555
1556 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
1557
1558         * pending.cs: remove the bogus return from GetMissingInterfaces()
1559         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
1560
1561 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1562
1563         * namespace.cs: avoid duplicated 'using xxx' being added to
1564         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
1565         when we get more than one 'using' statement for the same namespace.
1566         Report a CS0105 warning for it.
1567
1568 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
1569
1570         * cs-tokenizer.cs (consume_identifier): use read directly, instead
1571         of calling getChar/putback, uses internal knowledge of it.    
1572
1573         (xtoken): Reorder tokenizer so most common patterns are checked
1574         first.  This reduces the compilation time in another 5% (from 8.11s
1575         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
1576
1577         The parsing time is 22% of the compilation in mcs, and from that
1578         64% is spent on the tokenization process.  
1579
1580         I tried using a binary search for keywords, but this is slower
1581         than the hashtable.  Another option would be to do a couple of
1582         things:
1583
1584                 * Not use a StringBuilder, instead use an array of chars,
1585                   with a set value.  Notice that this way we could catch
1586                   the 645 error without having to do it *afterwards*.
1587
1588                 * We could write a hand-parser to avoid the hashtable
1589                   compares altogether.
1590
1591         The identifier consumption process takes 37% of the tokenization
1592         time.  Another 15% is spent on is_number.  56% of the time spent
1593         on is_number is spent on Int64.Parse:
1594
1595                 * We could probably choose based on the string length to
1596                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
1597                   computations. 
1598
1599         Another 3% is spend on wrapping `xtoken' in the `token' function.
1600
1601         Handle 0xa0 as whitespace (#34752)
1602         
1603 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
1604
1605         * typemanager.cs (IsCLRType): New routine to tell whether a type
1606         is one of the builtin types.  
1607
1608         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
1609         typecode in more places instead of doing pointer comparissions.
1610         We could leverage some knowledge about the way the typecodes are
1611         laid out.
1612
1613         New code to cache namespaces in assemblies, it is currently not
1614         invoked, to be used soon.
1615
1616         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
1617
1618         * expression.cs (Binary.ResolveOperator): specially handle
1619         strings, and do not perform user-defined operator overloading for
1620         built-in types.
1621
1622 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
1623
1624         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
1625         internalcall as it is a pretty simple operation;  Avoid whenever
1626         possible to call Char.IsLetter.
1627
1628         (consume_identifier): Cut by half the number of
1629         hashtable calls by merging the is_keyword and GetKeyword behavior.
1630
1631         Do not short-circuit, because if we do, we
1632         report errors (ie, #if false && true would produce an invalid
1633         directive error);
1634         
1635
1636 2002-11-24  Martin Baulig  <martin@ximian.com>
1637
1638         * expression.cs (Cast.TryReduce): If we're in checked syntax,
1639         check constant ranges and report a CS0221.  Fixes #33186.
1640
1641 2002-11-24  Martin Baulig  <martin@ximian.com>
1642
1643         * cs-parser.jay: Make this work for uninitialized variable
1644         declarations in the `for' initializer.  Fixes #32416.
1645
1646 2002-11-24  Martin Baulig  <martin@ximian.com>
1647
1648         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
1649         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
1650
1651 2002-11-24  Martin Baulig  <martin@ximian.com>
1652
1653         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
1654         argument; if true, we also check for user-defined conversions.
1655         This is only needed if both arguments are of a user-defined type.
1656         Fixes #30443, added test-175.cs.
1657         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
1658
1659         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
1660
1661 2002-11-24  Martin Baulig  <martin@ximian.com>
1662
1663         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
1664         function to get the store opcode.
1665         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
1666         only emit the Ldelema if the store opcode is Stobj.  You must run
1667         both test-34 and test-167 to test this.  Fixes #34529.
1668
1669 2002-11-23  Martin Baulig  <martin@ximian.com>
1670
1671         * ecore.cs (Expression.MemberLookup): Added additional
1672         `qualifier_type' argument which is used when we're being called
1673         from MemberAccess.DoResolve() and null if we're called from a
1674         SimpleName lookup.
1675         (Expression.MemberLookupFailed): New method to report errors; this
1676         does the CS1540 check and reports the correct error message.
1677
1678         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
1679         argument for the CS1540 check and redone the way how we're dealing
1680         with private members.  See the comment in the source code for details.
1681         (FilterWithClosure): Reverted this back to revision 1.197; renamed
1682         `closure_start_type' to `closure_qualifier_type' and check whether
1683         it's not null.  It was not this filter being broken, it was just
1684         being called with the wrong arguments.
1685
1686         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
1687         and pass it the correct `qualifier_type'; this also does the error
1688         handling for us.
1689
1690 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
1691
1692         * expression.cs (Invocation.EmitParams): If the we are dealing
1693         with a non-built-in value type, load its address as well.
1694
1695         (ArrayCreation): Use a a pretty constant instead
1696         of the hardcoded value 2.   Use 6 instead of 2 for the number of
1697         static initializers.  
1698
1699         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
1700         because they are not really value types, just glorified integers. 
1701
1702         * driver.cs: Do not append .exe, the CSC compiler does not do it.
1703
1704         * ecore.cs: Remove redundant code for enumerations, make them use
1705         the same code path as everything else, fixes the casting issue
1706         with enumerations in Windows.Forms.
1707
1708         * attribute.cs: Do only cast to string if it is a string, the
1709         validation happens later.
1710
1711         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
1712         people upgrade their corlibs.
1713
1714         * ecore.cs: Oops, enumerations were not following the entire code path
1715
1716 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
1717
1718         * typemanager.cs (FilterWithClosure): Commented out the test for
1719         1540 in typemanager.cs, as it has problems when accessing
1720         protected methods from a parent class (see test-174.cs). 
1721
1722         * attribute.cs (Attribute.ValidateGuid): new method.
1723         (Attribute.Resolve): Use above.
1724
1725 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
1726
1727         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
1728
1729         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
1730         handling for enumerations, as we only needed the TypeContainer
1731         functionality to begin with (this is required for the fix below to
1732         work for enums that reference constants in a container class for
1733         example). 
1734
1735         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
1736
1737         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
1738         a valid TypeBuilder to perform lookups on.o
1739
1740         * class.cs (InheritableMemberSignatureCompare): Use true in the
1741         call to GetGetMethod and GetSetMethod, because we are comparing
1742         the signature, and we need to get the methods *even* if they are
1743         private. 
1744
1745         (PropertyBase.CheckBase): ditto.
1746
1747         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
1748         GotoCase.Resolve): Use Peel on EmpytCasts.
1749
1750         * ecore.cs (EmptyCast): drop child, add Peel method.
1751
1752 2002-11-17  Martin Baulig  <martin@ximian.com>
1753
1754         * ecore.cs (EmptyCast.Child): New public property.
1755
1756         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
1757         label resolved to an EmptyCast.  Fixes #34162.
1758         (GotoCase.Resolve): Likewise.
1759         (Block.EmitMeta): Likewise.
1760
1761 2002-11-17  Martin Baulig  <martin@ximian.com>
1762
1763         * expression.cs (Invocation.BetterConversion): Prefer int over
1764         uint; short over ushort; long over ulong for integer literals.
1765         Use ImplicitConversionExists instead of StandardConversionExists
1766         since we also need to check for user-defined implicit conversions.
1767         Fixes #34165.  Added test-173.cs.
1768
1769 2002-11-16  Martin Baulig  <martin@ximian.com>
1770
1771         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
1772         with the `true' and `false' literals.  Fixes #33151.
1773
1774 2002-11-16  Martin Baulig  <martin@ximian.com>
1775
1776         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
1777         October 22nd; don't do the cs1540 check for static members.
1778
1779         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
1780         now using our own filter here and doing the cs1540 check again.
1781
1782 2002-11-16  Martin Baulig  <martin@ximian.com>
1783
1784         * support.cs (InternalParameters): Don't crash if we don't have
1785         any fixed parameters.  Fixes #33532.
1786
1787 2002-11-16  Martin Baulig  <martin@ximian.com>
1788
1789         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
1790         when looking up static methods to make this work on Windows.
1791         Fixes #33773.
1792
1793 2002-11-16  Martin Baulig  <martin@ximian.com>
1794
1795         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
1796         a setter rather than using PropertyInfo.CanWrite.
1797
1798 2002-11-15  Nick Drochak  <ndrochak@gol.com>
1799
1800         * class.cs: Allow acces to block member by subclasses. Fixes build
1801         breaker.
1802
1803 2002-11-14  Martin Baulig  <martin@ximian.com>
1804
1805         * class.cs (Constructor.Emit): Added the extern/block check.
1806         Fixes bug #33678.
1807
1808 2002-11-14  Martin Baulig  <martin@ximian.com>
1809
1810         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
1811         iteration while looking for indexers, this is needed because the
1812         indexer may have a different name in our base classes.  Fixed the
1813         error reporting (no indexers at all, not get accessor, no
1814         overloaded match).  Fixes bug #33089.
1815         (IndexerAccess.DoResolveLValue): Likewise.
1816
1817 2002-11-14  Martin Baulig  <martin@ximian.com>
1818
1819         * class.cs (PropertyBase.CheckBase): Make this work for multiple
1820         indexers.  Fixes the first part of bug #33089.
1821         (MethodSignature.InheritableMemberSignatureCompare): Added support
1822         for properties.
1823
1824 2002-11-13  Ravi Pratap  <ravi@ximian.com>
1825
1826         * attribute.cs (Attribute.Resolve): Catch the
1827         NullReferenceException and report it since it isn't supposed to
1828         happen. 
1829         
1830 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
1831
1832         * expression.cs (Binary.EmitBranchable): Also handle the cases for
1833         LogicalOr and LogicalAnd that can benefit from recursively
1834         handling EmitBranchable.  The code now should be nice for Paolo.
1835
1836 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
1837
1838         * typemanager.cs (LookupType): Added a negative-hit hashtable for
1839         the Type lookups, as we perform quite a number of lookups on
1840         non-Types.  This can be removed once we can deterministically tell
1841         whether we have a type or a namespace in advance.
1842
1843         But this might require special hacks from our corlib.
1844
1845         * TODO: updated.
1846
1847         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
1848         and double which avoids a conversion from an integer to a double.
1849
1850         * expression.cs: tiny optimization, avoid calling IsConstant,
1851         because it effectively performs the lookup twice.
1852
1853 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
1854
1855         But a bogus return here to keep the semantics of the old code
1856         until the Mono runtime is fixed.
1857         
1858         * pending.cs (GetMissingInterfaces): New method used to remove all
1859         the interfaces that are already implemented by our parent
1860         classes from the list of pending methods. 
1861
1862         * interface.cs: Add checks for calls after ResolveTypeExpr.
1863
1864 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
1865
1866         * class.cs (Class.Emit): Report warning 67: event not used if the
1867         warning level is beyond 3.
1868
1869         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
1870         being a NullLiteral.
1871
1872         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
1873         specifiers. 
1874
1875         * class.cs (TypeContainer.GetClassBases): Cover a missing code
1876         path that might fail if a type can not be resolved.
1877
1878         * expression.cs (Binary.Emit): Emit unsigned versions of the
1879         operators. 
1880
1881         * driver.cs: use error 5.
1882         
1883 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
1884
1885         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
1886
1887 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
1888
1889         * cs-parser.jay (switch_section): A beautiful patch from Martin
1890         Baulig that fixed 33094.
1891
1892 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
1893
1894         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
1895         Check whether the base is abstract and report an error if so.
1896
1897         * expression.cs (IndexerAccess.DoResolveLValue,
1898         IndexerAccess.DoResolve): ditto. 
1899
1900         (Invocation.DoResolve): ditto.
1901         
1902         (Invocation.FullMethodDesc): Improve the report string.
1903
1904         * statement.cs (Block): Eliminate IsVariableDefined as it is
1905         basically just a wrapper for GetVariableInfo.
1906
1907         * ecore.cs (SimpleName): Use new 
1908
1909         * support.cs (ReflectionParamter.ParameterType): We unwrap the
1910         type, as we return the actual parameter ref/unref state on a
1911         different call.
1912
1913 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
1914
1915         * support.cs: Return proper flags REF/OUT fixing the previous
1916         commit.  
1917
1918         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
1919         not used to mean `ref' but `ref or out' in ParameterReference
1920         
1921         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
1922         full type signature instead of calling TypeManger.CSharpName
1923         ourselves. 
1924
1925         * support.cs (InternalParameters.ParameterDesc): Do not compare
1926         directly to the modflags, because REF/OUT will actually be bitsets
1927         if set. 
1928
1929         * delegate.cs (VerifyMethod): Check also the modifiers.
1930
1931         * cs-tokenizer.cs: Fix bug where floating point values with an
1932         exponent where a sign was missing was ignored.
1933
1934         * driver.cs: Allow multiple assemblies to be specified in a single
1935         /r: argument
1936
1937 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
1938
1939         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
1940         because identifiers after a parenthesis would end up in this kind
1941         of production, and we needed to desamiguate it for having casts
1942         like:
1943
1944                 (UserDefinedType *) xxx
1945
1946 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
1947
1948         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
1949         we should set on the Bindingflags.NonPublic, but not turn on
1950         private_ok.  private_ok controls whether a Private member is
1951         returned (this is chekced on the filter routine), while the
1952         BindingFlags.NonPublic just controls whether private/protected
1953         will be allowed.   This fixes the problem part of the problem of
1954         private properties being allowed to be used in derived classes.
1955
1956         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
1957         so we can call the children DoResolveLValue method (this will
1958         properly signal errors on lvalue assignments to base properties)
1959         
1960         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
1961         getter are null, and we have a property info, we know that this
1962         happened because the lookup failed, so we report an error 122 for
1963         protection level violation.
1964
1965         We also silently return if setter and getter are null in the
1966         resolve functions, this condition only happens if we have flagged
1967         the error before.  This is the other half of the problem. 
1968
1969         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
1970         not have accessibility information, that is why we were returning
1971         true in the filter function in typemanager.cs.
1972
1973         To properly report 122 (property is inaccessible because of its
1974         protection level) correctly, we report this error in ResolveAccess
1975         by failing if both the setter and the getter are lacking (ie, the
1976         lookup failed). 
1977
1978         DoResolve and DoLResolve have been modified to check for both
1979         setter/getter being null and returning silently, the reason being
1980         that I did not want to put the knowledge about this error in upper
1981         layers, like:
1982
1983         int old = Report.Errors;
1984         x = new PropertyExpr (...);
1985         if (old != Report.Errors)
1986                 return null;
1987         else
1988                 return x;
1989
1990         So the property expr is returned, but it is invalid, so the error
1991         will be flagged during the resolve process. 
1992
1993         * class.cs: Remove InheritablePropertySignatureCompare from the
1994         class, as we no longer depend on the property signature to compute
1995         whether it is possible to implement a method or not.
1996
1997         The reason is that calling PropertyInfo.GetGetMethod will return
1998         null (in .NET, in Mono it works, and we should change this), in
1999         cases where the Get Method does not exist in that particular
2000         class.
2001
2002         So this code:
2003
2004         class X { public virtual int A { get { return 1; } } }
2005         class Y : X { }
2006         class Z : Y { public override int A { get { return 2; } } }
2007
2008         Would fail in Z because the parent (Y) would not have the property
2009         defined.  So we avoid this completely now (because the alternative
2010         fix was ugly and slow), and we now depend exclusively on the
2011         method names.
2012
2013         (PropertyBase.CheckBase): Use a method-base mechanism to find our
2014         reference method, instead of using the property.
2015
2016         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
2017         routines are gone now.
2018
2019         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
2020         names, they were incorrectly named.
2021
2022         * cs-tokenizer.cs: Return are more gentle token on failure. 
2023
2024         * pending.cs (PendingImplementation.InterfaceMethod): This routine
2025         had an out-of-sync index variable, which caused it to remove from
2026         the list of pending methods the wrong method sometimes.
2027
2028 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
2029
2030         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
2031         CanWrite, because those refer to this particular instance of the
2032         property, and do not take into account the fact that we can
2033         override single members of a property.
2034
2035         Constructor requires an EmitContext.  The resolution process does
2036         not happen here, but we need to compute the accessors before,
2037         because the resolution does not always happen for properties.
2038         
2039         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
2040         subclass, before we did not update this flag, but we did update
2041         bindingflags. 
2042
2043         (GetAccessors): Drop this routine, as it did not work in the
2044         presence of partially overwritten set/get methods. 
2045
2046         Notice that this broke the cs1540 detection, but that will require
2047         more thinking. 
2048         
2049 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2050
2051         * class.cs:
2052         * codegen.cs:
2053         * driver.cs: issue a warning instead of an error if we don't support
2054         debugging for the platform. Also ignore a couple of errors that may
2055         arise when trying to write the symbols. Undo my previous patch.
2056
2057 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2058
2059         * driver.cs: ignore /debug switch except for Unix platforms.
2060
2061 2002-10-23  Nick Drochak  <ndrochak@gol.com>
2062
2063         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
2064
2065 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
2066
2067         * driver.cs: Do not make mcs-debug conditional, so we do not break
2068         builds that use it.
2069
2070         * statement.cs (UsageVector.MergeChildren): I would like Martin to
2071         review this patch.  But basically after all the children variables
2072         have been merged, the value of "Breaks" was not being set to
2073         new_breaks for Switch blocks.  I think that it should be set after
2074         it has executed.  Currently I set this to the value of new_breaks,
2075         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
2076         conservative, but I do not understand this code very well.
2077
2078         I did not break anything in the build, so that is good ;-)
2079
2080         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
2081
2082 2002-10-20  Mark Crichton  <crichton@gimp.org>
2083
2084         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
2085
2086 2002-10-20  Nick Drochak  <ndrochak@gol.com>
2087
2088         * cfold.cs: Fixed compile blocker.
2089
2090 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
2091
2092         * driver.cs: I was chekcing the key, not the file.
2093
2094 2002-10-19  Ravi Pratap  <ravi@ximian.com>
2095
2096         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
2097         message that we were generating - we just need to silently return
2098         a null.
2099
2100 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
2101
2102         * class.cs (Event.Define): Change my previous commit, as this
2103         breaks the debugger.  This is a temporary hack, as it seems like
2104         the compiler is generating events incorrectly to begin with.
2105
2106         * expression.cs (Binary.ResolveOperator): Added support for 
2107         "U operator - (E x, E y)"
2108
2109         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
2110         y)".
2111
2112         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
2113         init-only variables, but this path did not take into account that
2114         there might be also instance readonly variables.  Correct this
2115         problem. 
2116
2117         This fixes bug 32253
2118
2119         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
2120         delegates as well.
2121
2122         * driver.cs: Change the extension for modules to `netmodule'
2123
2124         * cs-parser.jay: Improved slightly the location tracking for
2125         the debugger symbols.
2126
2127         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
2128         modifiers that were specified instead of the hardcoded value
2129         (FamAndAssem).  This was basically ignoring the static modifier,
2130         and others.  Fixes 32429.
2131
2132         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
2133         fixed a bug in the process (32476)
2134
2135         * expression.cs (ArrayAccess.EmitAssign): Patch from
2136         hwang_rob@yahoo.ca that fixes bug 31834.3
2137
2138 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
2139
2140         * driver.cs: Make the module extension .netmodule.
2141
2142 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
2143
2144         * driver.cs: Report an error if the resource file is not found
2145         instead of crashing.
2146
2147         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
2148         false, like Emit does.
2149
2150 2002-10-16  Nick Drochak  <ndrochak@gol.com>
2151
2152         * typemanager.cs: Remove unused private member.  Also reported mcs
2153         bug to report this as a warning like csc.
2154
2155 2002-10-15  Martin Baulig  <martin@gnome.org>
2156
2157         * statement.cs (Statement.Emit): Made this a virtual method; emits
2158         the line number info and calls DoEmit().
2159         (Statement.DoEmit): New protected abstract method, formerly knows
2160         as Statement.Emit().
2161
2162         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
2163
2164 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
2165
2166         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
2167         have fixed a remaining problem: not every AddXXXX was adding a
2168         fully qualified name.  
2169
2170         Now everyone registers a fully qualified name in the DeclSpace as
2171         being defined instead of the partial name.  
2172
2173         Downsides: we are slower than we need to be due to the excess
2174         copies and the names being registered this way.  
2175
2176         The reason for this is that we currently depend (on the corlib
2177         bootstrap for instance) that types are fully qualified, because
2178         we dump all the types in the namespace, and we should really have
2179         types inserted into the proper namespace, so we can only store the
2180         basenames in the defined_names array.
2181
2182 2002-10-10  Martin Baulig  <martin@gnome.org>
2183
2184         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
2185         from bug #31834, see the bug report for a testcase which is
2186         miscompiled.
2187
2188 2002-10-10  Martin Baulig  <martin@gnome.org>
2189
2190         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
2191         flow analysis code for this.
2192
2193         * statement.cs (Do, While, For): Tell the flow analysis code about
2194         infinite loops.
2195         (FlowBranching.UsageVector): Added support for infinite loops.
2196         (Block.Resolve): Moved the dead code elimination here and use flow
2197         analysis to do it.
2198
2199 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
2200
2201         * class.cs (Field.Define): Catch cycles on struct type
2202         definitions. 
2203
2204         * typemanager.cs (IsUnmanagedtype): Do not recursively check
2205         fields if the fields are static.  We only need to check instance
2206         fields. 
2207
2208         * expression.cs (As.DoResolve): Test for reference type.
2209
2210         * statement.cs (Using.ResolveExpression): Use
2211         ConvertImplicitRequired, not ConvertImplicit which reports an
2212         error on failture
2213         (Using.ResolveLocalVariableDecls): ditto.
2214
2215         * expression.cs (Binary.ResolveOperator): Report errors in a few
2216         places where we had to.
2217
2218         * typemanager.cs (IsUnmanagedtype): Finish implementation.
2219
2220 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
2221
2222         * expression.cs: Use StoreFromPtr instead of extracting the type
2223         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
2224
2225         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
2226         an enumeration value to a System.Enum, but System.Enum is not a
2227         value type, but an class type, so we need to box.
2228
2229         (Expression.ConvertExplicit): One codepath could return
2230         errors but not flag them.  Fix this.  Fixes #31853
2231
2232         * parameter.cs (Resolve): Do not allow void as a parameter type.
2233
2234 2002-10-06  Martin Baulig  <martin@gnome.org>
2235
2236         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
2237         if it's a class type and not a struct.  Fixes #31815.
2238
2239 2002-10-06  Martin Baulig  <martin@gnome.org>
2240
2241         * statement.cs: Reworked the flow analysis code a bit to make it
2242         usable for dead code elimination.
2243
2244 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2245
2246         * cs-parser.jay: allow empty source files. Fixes bug #31781.
2247
2248 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
2249
2250         * expression.cs (ComposedCast.DoResolveType): A quick workaround
2251         to fix the test 165, will investigate deeper.
2252
2253 2002-10-04  Martin Baulig  <martin@gnome.org>
2254
2255         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
2256         finally blocks actually work.
2257         (Try.Resolve): We don't need to create a sibling for `finally' if
2258         there is no finally block.
2259
2260 2002-10-04  Martin Baulig  <martin@gnome.org>
2261
2262         * class.cs (Constructor.Define): The default accessibility for a
2263         non-default constructor is private, not public.
2264
2265 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
2266
2267         * class.cs (Constructor): Make AllowedModifiers public, add
2268         EXTERN.
2269
2270         * cs-parser.jay: Perform the modifiers test here, as the
2271         constructor for the Constructor class usually receives a zero
2272         because of the way we create it (first we create, later we
2273         customize, and we were never checking the modifiers).
2274
2275         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
2276         is a version of LookupTypeReflection that includes the type-name
2277         cache.  This can be used as a fast path for functions that know
2278         the fully qualified name and are only calling into *.GetType() to
2279         obtain a composed type.
2280
2281         This is also used by TypeManager.LookupType during its type
2282         composition.
2283
2284         (LookupType): We now also track the real type name, as sometimes
2285         we can get a quey for the real type name from things like
2286         ComposedCast.  This fixes bug 31422.
2287         
2288         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
2289         complete type fullname, it does not have to go through the type
2290         resolution system to obtain the composed version of the type (for
2291         obtaining arrays or pointers).
2292         
2293         (Conditional.Emit): Use the EmitBoolExpression to
2294         generate nicer code, as requested by Paolo.
2295
2296         (ArrayCreation.CheckIndices): Use the patch from
2297         hwang_rob@yahoo.ca to validate the array initializers. 
2298
2299 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
2300
2301         * class.cs (ConstructorInitializer.Emit): simplify code by using
2302         Invocation.EmitCall, and at the same time, fix the bugs in calling
2303         parent constructors that took variable arguments. 
2304
2305         * ecore.cs (Expression.ConvertNumericExplicit,
2306         Expression.ImplicitNumericConversion): Remove the code that
2307         manually wrapped decimal (InternalTypeConstructor call is now gone
2308         as well).
2309
2310         * expression.cs (Cast.TryReduce): Also handle decimal types when
2311         trying to perform a constant fold on the type.
2312
2313         * typemanager.cs (IsUnmanagedtype): Partially implemented.
2314
2315         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
2316         that only turned off an error report, and did nothing else. 
2317
2318 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
2319
2320         * driver.cs: Handle and ignore /fullpaths
2321
2322 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
2323
2324         * expression.cs (Binary.ResolveOperator): Catch the case where
2325         DoNumericPromotions returns true, 
2326
2327         (Binary.DoNumericPromotions): Simplify the code, and the tests.
2328
2329 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
2330
2331         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
2332         report error 70.
2333
2334 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
2335
2336         * ecore.cs (ConvertNumericExplicit): It is not enough that the
2337         conversion exists, but it is also required that the conversion be
2338         performed.  This manifested in "(Type64Enum) 2".  
2339
2340         * class.cs (TypeManager.AddMethod): The fix is not to change
2341         AddEnum, because that one was using a fully qualified name (every
2342         DeclSpace derivative does), but to change the AddMethod routine
2343         that was using an un-namespaced name.  This now correctly reports
2344         the duplicated name.
2345
2346         Revert patch until I can properly fix it.  The issue
2347         is that we have a shared Type space across all namespaces
2348         currently, which is wrong.
2349
2350         Options include making the Namespace a DeclSpace, and merge
2351         current_namespace/current_container in the parser.
2352
2353 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
2354
2355         * cs-parser.jay: Improve error reporting when we get a different
2356         kind of expression in local_variable_type and
2357         local_variable_pointer_type. 
2358
2359         Propagate this to avoid missleading errors being reported.
2360
2361         * ecore.cs (ImplicitReferenceConversion): treat
2362         TypeManager.value_type as a target just like object_type.   As
2363         code like this:
2364
2365         ValueType v = 1;
2366
2367         Is valid, and needs to result in the int 1 being boxed before it
2368         is assigned to the value type v.
2369
2370         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
2371         to validate the enumeration name.
2372
2373         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
2374         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
2375         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
2376
2377         * ecore.cs (TryImplicitIntConversion): When doing an
2378         implicit-enumeration-conversion, check if the type is 64-bits and
2379         perform a conversion before passing to EnumConstant.
2380
2381 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
2382
2383         * decl.cs (Error_AmbiguousTypeReference); New routine used to
2384         report ambiguous type references.  Unlike the MS version, we
2385         report what the ambiguity is.   Innovation at work ;-)
2386
2387         (DeclSpace.FindType): Require a location argument to
2388         display when we display an ambiguous error.
2389
2390         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
2391
2392         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
2393
2394         * expression.cs (EmitDynamicInitializers): Apply patch from
2395         hwang_rob@yahoo.ca that fixes the order in which we emit our
2396         initializers. 
2397
2398 2002-09-21  Martin Baulig  <martin@gnome.org>
2399
2400         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
2401         delegate takes no arguments.
2402
2403 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
2404
2405         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
2406         from integers.
2407
2408         * expression.cs: Extract the underlying type.
2409
2410         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
2411
2412         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
2413
2414 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
2415
2416         * class.cs (TypeContainer.DefineType): We can not use the nice
2417         PackingSize with the size set to 1 DefineType method, because it
2418         will not allow us to define the interfaces that the struct
2419         implements.
2420
2421         This completes the fixing of bug 27287
2422
2423         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
2424         means also structs.  This fixes part of the problem. 
2425         (Expresion.ImplicitReferenceConversionExists): ditto.
2426
2427         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
2428         error if there were no errors reported during the type lookup
2429         process, to avoid duplicates or redundant errors.  Without this
2430         you would get an ambiguous errors plus a type not found.  We have
2431         beaten the user enough with the first error.  
2432
2433         (DeclSparce.FindType): Emit a warning if we have an ambiguous
2434         reference. 
2435
2436         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
2437         during the resolution process, stop the lookup, this avoids
2438         repeated error reports (same error twice).
2439
2440         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
2441
2442         * typemanager.cs (LookupType): Redo the type lookup code to match
2443         the needs of System.Reflection.  
2444
2445         The issue is that System.Reflection requires references to nested
2446         types to begin with a "+" sign instead of a dot.  So toplevel
2447         types look like: "NameSpace.TopLevelClass", and nested ones look
2448         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
2449         levels. 
2450
2451 2002-09-19  Martin Baulig  <martin@gnome.org>
2452
2453         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
2454         says that a method always returns or always throws an exception,
2455         don't report the CS0161.
2456
2457         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
2458         set `Returns = new_returns'.
2459
2460 2002-09-19  Martin Baulig  <martin@gnome.org>
2461
2462         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
2463         to an enum constant, check for a CS0176.
2464
2465 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
2466
2467         * class.cs (TypeContainer.CheckPairedOperators): Now we check
2468         for operators that must be in pairs and report errors.
2469
2470         * ecore.cs (SimpleName.DoResolveType): During the initial type
2471         resolution process, when we define types recursively, we must
2472         check first for types in our current scope before we perform
2473         lookups in the enclosing scopes.
2474
2475         * expression.cs (MakeByteBlob): Handle Decimal blobs.
2476
2477         (Invocation.VerifyArgumentsCompat): Call
2478         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
2479         I thought we were supposed to always call this, but there are a
2480         few places in the code where we dont do it.
2481
2482 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
2483
2484         * driver.cs: Add support in -linkres and -resource to specify the
2485         name of the identifier.
2486
2487 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
2488
2489         * ecore.cs (StandardConversionExists): Sync with the conversion
2490         code: allow anything-* to void* conversions.
2491
2492         (FindMostSpecificSource): Use an Expression argument
2493         instead of a Type, because we might be handed over a Literal which
2494         gets a few more implicit conversions that plain types do not.  So
2495         this information was being lost.
2496
2497         Also, we drop the temporary type-holder expression when not
2498         required.
2499
2500 2002-09-17  Martin Baulig  <martin@gnome.org>
2501
2502         * class.cs (PropertyBase.CheckBase): Don't check the base class if
2503         this is an explicit interface implementation.
2504
2505 2002-09-17  Martin Baulig  <martin@gnome.org>
2506
2507         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
2508         different `IndexerName' attributes.
2509
2510         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
2511         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
2512         virtual CommonResolve().
2513
2514 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
2515
2516         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
2517         and convert that to the UnderlyingType.
2518
2519         * statement.cs (Foreach.Resolve): Indexers are just like variables
2520         or PropertyAccesses.
2521
2522         * cs-tokenizer.cs (consume_string): Track line numbers and columns
2523         inside quoted strings, we were not doing this before.
2524
2525 2002-09-16  Martin Baulig  <martin@gnome.org>
2526
2527         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
2528         resolve it.  This is needed for the definite assignment check of the
2529         instance expression, fixes bug #29846.
2530         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
2531
2532 2002-09-16  Nick Drochak  <ndrochak@gol.com>
2533
2534         * parameter.cs: Fix compile error.  Cannot reference static member
2535         from an instance object.  Is this an mcs bug?
2536
2537 2002-09-14  Martin Baulig  <martin@gnome.org>
2538
2539         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
2540         multiple times.  Fixes bug #30295, added test-166.cs.
2541
2542 2002-09-14  Martin Baulig  <martin@gnome.org>
2543
2544         * statement.cs (Block.Emit): Don't emit unreachable code.
2545         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
2546         `break' statements.
2547         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
2548
2549 2002-09-14  Martin Baulig  <martin@gnome.org>
2550
2551         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
2552         is set.
2553
2554 2002-09-14  Martin Baulig  <martin@gnome.org>
2555
2556         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
2557         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
2558         be false on the ms runtime.
2559
2560 2002-09-13  Martin Baulig  <martin@gnome.org>
2561
2562         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
2563         the CS0038 error message.
2564
2565 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
2566
2567         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
2568         constant inside, return it.
2569
2570 2002-09-12  Martin Baulig  <martin@gnome.org>
2571
2572         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
2573         implicit conversion can be done between enum types.
2574
2575         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
2576         check whether an implicit conversion to the current enum's UnderlyingType
2577         exists and report an error if not.
2578
2579         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
2580         without debugging support.
2581
2582         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
2583         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
2584
2585 2002-09-12  Martin Baulig  <martin@gnome.org>
2586
2587         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
2588
2589         * ecore.cs (IMemberExpr.DeclaringType): New property.
2590         (SimpleName.SimpleNameResolve): Check whether we're accessing a
2591         nonstatic member of an outer type (CS0038).
2592
2593 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
2594
2595         * driver.cs: Activate the using-error detector at warning level
2596         4 (at least for MS-compatible APIs).
2597
2598         * namespace.cs (VerifyUsing): Small buglett fix.
2599
2600         * pending.cs (PendingImplementation): pass the container pointer. 
2601
2602         * interface.cs (GetMethods): Allow for recursive definition.  Long
2603         term, I would like to move every type to support recursive
2604         definitions, not the current ordering mechanism that we have right
2605         now.
2606
2607         The situation is this: Attributes are handled before interfaces,
2608         so we can apply attributes to interfaces.  But some attributes
2609         implement interfaces, we will now handle the simple cases
2610         (recursive definitions will just get an error).  
2611
2612         * parameter.cs: Only invalidate types at the end if we fail to
2613         lookup all types.  
2614
2615 2002-09-09  Martin Baulig  <martin@gnome.org>
2616
2617         * ecore.cs (PropertyExpr.Emit): Also check for
2618         TypeManager.system_int_array_get_length so this'll also work when
2619         compiling corlib.  Fixes #30003.
2620
2621 2002-09-09  Martin Baulig  <martin@gnome.org>
2622
2623         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
2624         and throw an exception if we can't get the type's size.  Fixed #30040,
2625         added test-165.cs.
2626
2627 2002-09-09  Martin Baulig  <martin@gnome.org>
2628
2629         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
2630
2631         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
2632         context.  Fixes bug #30027.
2633
2634         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
2635         virtual functions.  Fixes bug #30043, added test-164.cs.
2636
2637 2002-09-08  Ravi Pratap  <ravi@ximian.com>
2638
2639         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
2640
2641 2002-09-08  Nick Drochak  <ndrochak@gol.com>
2642
2643         * driver.cs: Use an object to get the windows codepage since it's not a
2644         static property.
2645
2646 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
2647
2648         * statement.cs (For.Emit): for infinite loops (test == null)
2649         return whether there is a break inside, not always "true".
2650
2651         * namespace.cs (UsingEntry): New struct to hold the name of the
2652         using definition, the location where it is defined, and whether it
2653         has been used in a successful type lookup.
2654         
2655         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
2656         strings.
2657
2658         * decl.cs: ditto.
2659
2660 2002-09-06  Ravi Pratap  <ravi@ximian.com>
2661
2662         * attribute.cs : Fix incorrect code which relied on catching
2663         a NullReferenceException to detect a null being passed in
2664         where an object was expected.
2665
2666 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
2667
2668         * statement.cs (Try): flag the catch variable as assigned
2669
2670         * expression.cs (Cast): Simplified by using ResolveType instead of
2671         manually resolving.
2672
2673         * statement.cs (Catch): Fix bug by using ResolveType.
2674
2675 2002-09-06  Ravi Pratap  <ravi@ximian.com>
2676
2677         * expression.cs (BetterConversion): Special case for when we have
2678         a NullLiteral as the argument and we have to choose between string
2679         and object types - we choose string the way csc does.
2680
2681         * attribute.cs (Attribute.Resolve): Catch the
2682         NullReferenceException and report error #182 since the Mono
2683         runtime no more has the bug and having this exception raised means
2684         we tried to select a constructor which takes an object and is
2685         passed a null.
2686
2687 2002-09-05  Ravi Pratap  <ravi@ximian.com>
2688
2689         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
2690         message (1502, 1503) when we can't locate a method after overload
2691         resolution. This is much more informative and closes the bug
2692         Miguel reported.
2693
2694         * interface.cs (PopulateMethod): Return if there are no argument
2695         types. Fixes a NullReferenceException bug.
2696
2697         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
2698         expressions too. Previously we were checking only in one place for
2699         positional arguments leaving out named arguments.
2700
2701         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
2702         type to the enum type is not allowed. Remove code corresponding to
2703         that.
2704
2705         (ConvertNumericExplicit): Allow explicit conversions from
2706         the underlying type to enum type. This precisely follows the spec
2707         and closes a bug filed by Gonzalo.
2708         
2709 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2710
2711         * compiler.csproj:
2712         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
2713
2714 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
2715
2716         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
2717         it was important that we stored the right value after the
2718         reduction in `converted'.
2719
2720 2002-09-04  Martin Baulig  <martin@gnome.org>
2721
2722         * location.cs (Location.SymbolDocument): Use full pathnames for the
2723         source files.
2724
2725 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
2726
2727         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
2728         of the expression resolve mechanism, because that will catch the
2729         SimpleName error failures.
2730
2731         (Conditional): If we can not resolve the
2732         expression, return, do not crash.
2733
2734 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2735
2736         * cs-tokenizer.cs:
2737         (location): display token name instead of its number.
2738
2739 2002-08-28  Martin Baulig  <martin@gnome.org>
2740
2741         * expression.cs (Binary.ResolveOperator): Don't silently return
2742         but return an error if an operator cannot be applied between two
2743         enum types.
2744
2745 2002-08-28  Martin Baulig  <martin@gnome.org>
2746
2747         * class.cs (Constructor.Define): Set the permission attributes
2748         correctly instead of making all constructors public.
2749
2750 2002-08-28  Martin Baulig  <martin@gnome.org>
2751
2752         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
2753         for private members before reporting a CS0103; if we find anything,
2754         it's a CS0122.
2755
2756 2002-08-28  Martin Baulig  <martin@gnome.org>
2757
2758         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
2759         to check whether `closure_start_type == closure_invocation_type',
2760         we also need to check whether `m.DeclaringType == closure_invocation_type'
2761         before bypassing the permission checks.  We might be accessing
2762         protected/private members from the base class.
2763         (TypeManager.RealMemberLookup): Only set private_ok if private
2764         members were requested via BindingFlags.NonPublic.
2765
2766         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
2767
2768         * expression.cs (MemberAccess.ResolveMemberAccess): Set
2769         MethodGroupExpr.IsExplicitImpl if appropriate.
2770         (Invocation.DoResolve): Don't report the CS0120 for explicit
2771         interface implementations.
2772
2773 2002-08-27  Martin Baulig  <martin@gnome.org>
2774
2775         * expression.cs (Invocation.DoResolve): If this is a static
2776         method and we don't have an InstanceExpression, we must report
2777         a CS0120.
2778
2779 2002-08-25  Martin Baulig  <martin@gnome.org>
2780
2781         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
2782         `==' between a valuetype and an object.
2783
2784 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
2785
2786         * ecore.cs (TypeExpr): Provide a ToString method.
2787
2788 2002-08-24  Martin Baulig  <martin@gnome.org>
2789
2790         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
2791         now called proggie.dbg and it's a binary file.
2792
2793 2002-08-23  Martin Baulig  <martin@gnome.org>
2794
2795         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
2796
2797 2002-08-23  Martin Baulig  <martin@gnome.org>
2798
2799         * struct.cs (MyStructInfo.ctor): Make this work with empty
2800         structs; it's not allowed to use foreach() on null.
2801
2802 2002-08-23  Martin Baulig  <martin@gnome.org>
2803
2804         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
2805         writer the full pathname of the generated assembly.
2806
2807 2002-08-23  Martin Baulig  <martin@gnome.org>
2808
2809         * statements.cs (FlowBranching.UsageVector.MergeChildren):
2810         A `finally' block never returns or breaks; improved handling of
2811         unreachable code.
2812
2813 2002-08-23  Martin Baulig  <martin@gnome.org>
2814
2815         * statement.cs (Throw.Resolve): Allow `throw null'.
2816
2817 2002-08-23  Martin Baulig  <martin@gnome.org>
2818
2819         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
2820         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
2821         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
2822         MemberLookup would return a wrong event if this is an explicit
2823         interface implementation and the class has an event with the same
2824         name.
2825
2826 2002-08-23  Martin Baulig  <martin@gnome.org>
2827
2828         * statement.cs (Block.AddChildVariableNames): New public method.
2829         (Block.AddChildVariableName): Likewise.
2830         (Block.IsVariableNameUsedInChildBlock): Likewise.
2831         (Block.AddVariable): Check whether a variable name has already
2832         been used in a child block.
2833
2834         * cs-parser.jay (declare_local_variables): Mark all variable names
2835         from the current block as being used in a child block in the
2836         implicit block.
2837
2838 2002-08-23  Martin Baulig  <martin@gnome.org>
2839
2840         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
2841         find the symbol writer.
2842
2843         * driver.cs: csc also allows the arguments to /define being
2844         separated by commas, not only by semicolons.
2845
2846 2002-08-23  Martin Baulig  <martin@gnome.org>
2847
2848         * interface.cs (Interface.GetMembers): Added static check for events.
2849
2850 2002-08-15  Martin Baulig  <martin@gnome.org>
2851
2852         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
2853         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
2854
2855         * ecore.cs (Expression.MemberLookup): Added documentation and explained
2856         why the MethodData.EmitDestructor() change was necessary.
2857
2858 2002-08-20  Martin Baulig  <martin@gnome.org>
2859
2860         * class.cs (TypeContainer.FindMembers): Added static check for events.
2861
2862         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
2863
2864         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
2865         use Type.GetEvents(), not Type.FindMembers().
2866
2867 2002-08-20  Martin Baulig  <martin@gnome.org>
2868
2869         * decl.cs (MemberCache): Added a special method cache which will
2870         be used for method-only searched.  This ensures that a method
2871         search will return a MethodInfo with the correct ReflectedType for
2872         inherited methods.      
2873
2874 2002-08-20  Martin Baulig  <martin@gnome.org>
2875
2876         * decl.cs (DeclSpace.FindMembers): Made this public.
2877
2878 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2879
2880         * delegate.cs: fixed build on windows.
2881         [FIXME:  Filed as bug #29150: MCS must report these errors.]
2882
2883 2002-08-19  Ravi Pratap  <ravi@ximian.com>
2884
2885         * ecore.cs (StandardConversionExists): Return a false
2886         if we are trying to convert the void type to anything else
2887         since that is not allowed.
2888
2889         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
2890         we flag error 70 in the event an event is trying to be accessed
2891         directly from outside the declaring type.
2892
2893 2002-08-20  Martin Baulig  <martin@gnome.org>
2894
2895         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
2896         MemberCache from typemanager.cs to decl.cs.
2897
2898 2002-08-19  Martin Baulig  <martin@gnome.org>
2899
2900         * class.cs (TypeContainer): Implement IMemberContainer.
2901         (TypeContainer.DefineMembers): Create the MemberCache.
2902         (TypeContainer.FindMembers): Do better BindingFlags checking; only
2903         return public members if BindingFlags.Public was given, check
2904         whether members are static.
2905
2906 2002-08-16  Martin Baulig  <martin@gnome.org>
2907
2908         * decl.cs (DeclSpace.Define): Splitted this in Define and
2909         DefineMembers.  DefineMembers is called first and initializes the
2910         MemberCache.
2911
2912         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
2913         DefineMembers() on all our DeclSpaces.
2914
2915         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
2916         but call DefineMembers() on all nested interfaces.  We call their
2917         Define() in our new Define() function.
2918
2919         * interface.cs (Interface): Implement IMemberContainer.
2920         (Interface.Define): Moved all code except the attribute stuf to
2921         DefineMembers().
2922         (Interface.DefineMembers): Initialize the member cache.
2923
2924         * typemanager.cs (IMemberFinder): Removed this interface, we don't
2925         need this anymore since we can use MemberCache.FindMembers directly.
2926
2927 2002-08-19  Martin Baulig  <martin@gnome.org>
2928
2929         * typemanager.cs (MemberCache): When creating the cache for an
2930         interface type, add all inherited members.
2931         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
2932         to `out bool used_cache' and documented it.
2933         (TypeManager.MemberLookup): If we already used the cache in the first
2934         iteration, we don't need to do the interfaces check.
2935
2936 2002-08-19  Martin Baulig  <martin@gnome.org>
2937
2938         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
2939         here from IMemberFinder and don't implement this interface anymore.
2940         (DeclSpace.MemberCache): Moved here from IMemberFinder.
2941
2942         * typemanager.cs (IMemberFinder): This interface is now only used by
2943         classes which actually support the member cache.
2944         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
2945         since we only put DeclSpaces into this Hashtable.
2946         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
2947         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
2948
2949 2002-08-16  Martin Baulig  <martin@gnome.org>
2950
2951         * typemanager.cs (ICachingMemberFinder): Removed.
2952         (IMemberFinder.MemberCache): New property.
2953         (TypeManager.FindMembers): Merged this with RealFindMembers().
2954         This function will never be called from TypeManager.MemberLookup()
2955         so we can't use the cache here, just the IMemberFinder.
2956         (TypeManager.MemberLookup_FindMembers): Check whether the
2957         IMemberFinder has a MemberCache and call the cache's FindMembers
2958         function.
2959         (MemberCache): Rewrote larger parts of this yet another time and
2960         cleaned it up a bit.
2961
2962 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
2963
2964         * driver.cs (LoadArgs): Support quoting.
2965
2966         (Usage): Show the CSC-like command line arguments.
2967
2968         Improved a few error messages.
2969
2970 2002-08-15  Martin Baulig  <martin@gnome.org>
2971
2972         * typemanager.cs (IMemberContainer.Type): New property.
2973         (IMemberContainer.IsInterface): New property.
2974
2975         The following changes are conditional to BROKEN_RUNTIME, which is
2976         defined at the top of the file.
2977
2978         * typemanager.cs (MemberCache.MemberCache): Don't add the base
2979         class'es members, but add all members from TypeHandle.ObjectType
2980         if we're an interface.
2981         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
2982         is the current type.
2983         (MemberCache.CacheEntry.Container): Removed this field.
2984         (TypeHandle.GetMembers): Include inherited members.
2985
2986 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2987
2988         * typemanager.cs: fixed compilation and added a comment on a field that
2989         is never used.
2990
2991 2002-08-15  Martin Baulig  <martin@gnome.org>
2992
2993         * class.cs (ConstructorInitializer.Resolve): In the
2994         Expression.MemberLookup call, use the queried_type as
2995         invocation_type.
2996
2997         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
2998         declared' attribute, it's always true.
2999         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
3000         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
3001         temporary wrapper for FindMembers which tells MemberLookup whether
3002         members from the base classes are included in the return value.
3003         This will go away soon.
3004         (TypeManager.MemberLookup): Use this temporary hack here; once the
3005         new MemberCache is completed, we don't need to do the DeclaredOnly
3006         looping here anymore since the MemberCache will take care of this.
3007         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
3008         (MemberCache): When creating the MemberCache for a class, get
3009         members from the current class and all its base classes.
3010         (MemberCache.CacheEntry.Container): New field.  This is a
3011         temporary hack until the Mono runtime is fixed to distinguish
3012         between ReflectedType and DeclaringType.  It allows us to use MCS
3013         with both the MS runtime and the unfixed Mono runtime without
3014         problems and without accecting performance.
3015         (MemberCache.SearchMembers): The DeclaredOnly looping from
3016         TypeManager.MemberLookup is now done here.      
3017
3018 2002-08-14  Martin Baulig  <martin@gnome.org>
3019
3020         * statement.cs (MyStructInfo.MyStructInfo): Don't call
3021         Type.GetFields on dynamic types but get the fields from the
3022         corresponding TypeContainer.
3023         (MyStructInfo.GetStructInfo): Added check for enum types.
3024
3025         * typemanager.cs (MemberList.IsSynchronized): Implemented.
3026         (MemberList.SyncRoot): Implemented.
3027         (TypeManager.FilterWithClosure): No need to check permissions if
3028         closure_start_type == closure_invocation_type, don't crash if
3029         closure_invocation_type is null.
3030
3031 2002-08-13  Martin Baulig  <martin@gnome.org>
3032
3033         Rewrote TypeContainer.FindMembers to use a member cache.  This
3034         gives us a speed increase of about 35% for the self-hosting MCS
3035         build and of about 15-20% for the class libs (both on GNU/Linux).
3036
3037         * report.cs (Timer): New class to get enhanced profiling.  This
3038         whole class is "TIMER" conditional since it remarkably slows down
3039         compilation speed.
3040
3041         * class.cs (MemberList): New class.  This is an IList wrapper
3042         which we're now using instead of passing MemberInfo[]'s around to
3043         avoid copying this array unnecessarily.
3044         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
3045         (ICachingMemberFinder, IMemberContainer): New interface.
3046         (TypeManager.FilterWithClosure): If `criteria' is null, the name
3047         has already been checked, otherwise use it for the name comparision.
3048         (TypeManager.FindMembers): Renamed to RealMemberFinder and
3049         provided wrapper which tries to use ICachingMemberFinder.FindMembers
3050         if possible.  Returns a MemberList, not a MemberInfo [].
3051         (TypeHandle): New class, implements IMemberContainer.  We create
3052         one instance of this class per type, it contains a MemberCache
3053         which is used to do the member lookups.
3054         (MemberCache): New class.  Each instance of this class contains
3055         all members of a type and a name-based hash table.
3056         (MemberCache.FindMembers): This is our new member lookup
3057         function.  First, it looks up all members of the requested name in
3058         the hash table.  Then, it walks this list and sorts out all
3059         applicable members and returns them.
3060
3061 2002-08-13  Martin Baulig  <martin@gnome.org>
3062
3063         In addition to a nice code cleanup, this gives us a performance
3064         increase of about 1.4% on GNU/Linux - not much, but it's already
3065         half a second for the self-hosting MCS compilation.
3066
3067         * typemanager.cs (IMemberFinder): New interface.  It is used by
3068         TypeManager.FindMembers to call FindMembers on a TypeContainer,
3069         Enum, Delegate or Interface.
3070         (TypeManager.finder_to_member_finder): New PtrHashtable.
3071         (TypeManager.finder_to_container): Removed.
3072         (TypeManager.finder_to_delegate): Removed.
3073         (TypeManager.finder_to_interface): Removed.
3074         (TypeManager.finder_to_enum): Removed.
3075
3076         * interface.cs (Interface): Implement IMemberFinder.
3077
3078         * delegate.cs (Delegate): Implement IMemberFinder.
3079
3080         * enum.cs (Enum): Implement IMemberFinder.
3081
3082         * class.cs (TypeContainer): Implement IMemberFinder.
3083
3084 2002-08-12  Martin Baulig  <martin@gnome.org>
3085
3086         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
3087
3088 2002-08-12  Martin Baulig  <martin@gnome.org>
3089
3090         * ecore.cs (ITypeExpression): New interface for expressions which
3091         resolve to a type.
3092         (TypeExpression): Renamed to TypeLookupExpression.
3093         (Expression.DoResolve): If we're doing a types-only lookup, the
3094         expression must implement the ITypeExpression interface and we
3095         call DoResolveType() on it.
3096         (SimpleName): Implement the new ITypeExpression interface.
3097         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
3098         hack, the situation that we're only looking up types can't happen
3099         anymore when this method is called.  Moved the type lookup code to
3100         DoResolveType() and call it.
3101         (SimpleName.DoResolveType): This ITypeExpression interface method
3102         is now doing the types-only lookup.
3103         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
3104         (ResolveFlags): Added MaskExprClass.
3105
3106         * expression.cs (MemberAccess): Implement the ITypeExpression
3107         interface.
3108         (MemberAccess.DoResolve): Added support for a types-only lookup
3109         when we're called via ITypeExpression.DoResolveType().
3110         (ComposedCast): Implement the ITypeExpression interface.
3111
3112         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
3113         Expression.Resolve() with ResolveFlags.Type instead.
3114
3115 2002-08-12  Martin Baulig  <martin@gnome.org>
3116
3117         * interface.cs (Interface.Define): Apply attributes.
3118
3119         * attribute.cs (Attribute.ApplyAttributes): Added support for
3120         interface attributes.
3121
3122 2002-08-11  Martin Baulig  <martin@gnome.org>
3123
3124         * statement.cs (Block.Emit): Only check the "this" variable if we
3125         do not always throw an exception.
3126
3127         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
3128         whether the property has a set accessor.
3129
3130 2002-08-11  Martin Baulig  <martin@gnome.org>
3131
3132         Added control flow analysis support for structs.
3133
3134         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
3135         with control flow analysis turned off.
3136         (IVariable): New interface.
3137         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
3138         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
3139         (FieldExpr.DoResolve): Resolve the instance expression with flow
3140         analysis turned off and do the definite assignment check after the
3141         resolving when we know what the expression will resolve to.
3142
3143         * expression.cs (LocalVariableReference, ParameterReference):
3144         Implement the new IVariable interface, only call the flow analysis
3145         code if ec.DoFlowAnalysis is true.
3146         (This): Added constructor which takes a Block argument.  Implement
3147         the new IVariable interface.
3148         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
3149         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
3150         This does the definite assignment checks for struct members.
3151
3152         * class.cs (Constructor.Emit): If this is a non-static `struct'
3153         constructor which doesn't have any initializer, call
3154         Block.AddThisVariable() to tell the flow analysis code that all
3155         struct elements must be initialized before control returns from
3156         the constructor.
3157
3158         * statement.cs (MyStructInfo): New public class.
3159         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
3160         argument to this indexer.  If non-zero, check an individual struct
3161         member, not the whole struct.
3162         (FlowBranching.CheckOutParameters): Check struct members.
3163         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
3164         overloaded versions of these methods which take an additional
3165         `int field_idx' argument to check struct members.
3166         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
3167         overloaded versions of these methods which take an additional
3168         `string field_name' argument to check struct member.s
3169         (VariableInfo): Implement the IVariable interface.
3170         (VariableInfo.StructInfo): New public property.  Returns the
3171         MyStructInfo instance of the variable if it's a struct or null.
3172         (Block.AddThisVariable): New public method.  This is called from
3173         Constructor.Emit() for non-static `struct' constructor which do
3174         not have any initializer.  It creates a special variable for the
3175         "this" instance variable which will be checked by the flow
3176         analysis code to ensure that all of the struct's fields are
3177         initialized before control returns from the constructor.
3178         (UsageVector): Added support for struct members.  If a
3179         variable/parameter is a struct with N members, we reserve a slot
3180         in the usage vector for each member.  A struct is considered fully
3181         initialized if either the struct itself (slot 0) or all its
3182         members are initialized.
3183
3184 2002-08-08  Martin Baulig  <martin@gnome.org>
3185
3186         * driver.cs (Driver.MainDriver): Only report an error CS5001
3187         if there were no compilation errors.
3188
3189         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
3190         `UnsafeContext' property to determine whether the parent is in
3191         unsafe context rather than checking the parent's ModFlags:
3192         classes nested in an unsafe class are unsafe as well.
3193
3194 2002-08-08  Martin Baulig  <martin@gnome.org>
3195
3196         * statement.cs (UsageVector.MergeChildren): Distinguish between
3197         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
3198         we return.  Added test17() and test18() to test-154.cs.
3199
3200 2002-08-08  Martin Baulig  <martin@gnome.org>
3201
3202         * typemanager.cs (TypeManager.FilterWithClosure): If we have
3203         Family access, make sure the invoking type isn't a subclass of the
3204         queried type (that'd be a CS1540).
3205
3206         * ecore.cs (Expression.MemberLookup): Added overloaded version of
3207         this method which takes an additional `Type invocation_type'.
3208
3209         * expression.cs (BaseAccess.DoResolve): Use the base type as
3210         invocation and query type.
3211         (MemberAccess.DoResolve): If the lookup failed and we're about to
3212         report a CS0122, try a lookup with the ec.ContainerType - if this
3213         succeeds, we must report a CS1540.
3214
3215 2002-08-08  Martin Baulig  <martin@gnome.org>
3216
3217         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
3218         (MethodGroupExpr): Implement the IMemberExpr interface.
3219
3220         * expression (MemberAccess.ResolveMemberAccess): No need to have
3221         any special code for MethodGroupExprs anymore, they're now
3222         IMemberExprs.   
3223
3224 2002-08-08  Martin Baulig  <martin@gnome.org>
3225
3226         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
3227         Family, FamANDAssem and FamORAssem permissions.
3228         (TypeManager.IsSubclassOrNestedChildOf): New public method.
3229
3230 2002-08-08  Martin Baulig  <martin@gnome.org>
3231
3232         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
3233         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
3234         or loop block.
3235
3236 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
3237
3238         * driver.cs: implemented /resource option to embed managed resources.
3239
3240 2002-08-07  Martin Baulig  <martin@gnome.org>
3241
3242         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
3243         (FieldBase.HasFieldInitializer): New public property.
3244         (FieldBase.GetInitializerExpression): New public method.  Resolves and
3245         returns the field initializer and makes sure it is only resolved once.
3246         (TypeContainer.EmitFieldInitializers): Call
3247         FieldBase.GetInitializerExpression to get the initializer, this ensures
3248         that it isn't resolved multiple times.
3249
3250         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
3251         the resolving process (SimpleName/MemberLookup) that we're currently
3252         emitting a field initializer (which must not access any instance members,
3253         this is an error CS0236).
3254
3255         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
3256         argument, if the `IsFieldInitializer' flag is set, we must report and
3257         error CS0236 and not an error CS0120.   
3258
3259 2002-08-07  Martin Baulig  <martin@gnome.org>
3260
3261         * ecore.cs (IMemberExpr): New public interface.
3262         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
3263         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
3264         if the expression is an IMemberExpr.
3265
3266         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
3267         to be null, implicitly default to `this' if we're non-static in
3268         this case.  Simplified the code a lot by using the new IMemberExpr
3269         interface.  Also fixed bug #28176 here.
3270
3271 2002-08-06  Martin Baulig  <martin@gnome.org>
3272
3273         * cs-parser.jay (SimpleLookup): Removed.  We need to create
3274         ParameterReferences during semantic analysis so that we can do a
3275         type-only search when resolving Cast, TypeOf and SizeOf.
3276         (block): Pass the `current_local_parameters' to the Block's
3277         constructor.
3278
3279         * class.cs (ConstructorInitializer): Added `Parameters parameters'
3280         argument to the constructor.
3281         (ConstructorInitializer.Resolve): Create a temporary implicit
3282         block with the parameters.
3283
3284         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
3285         references here if we aren't doing a type-only search.
3286
3287         * statement.cs (Block): Added constructor which takes a
3288         `Parameters parameters' argument.
3289         (Block.Parameters): New public property.
3290
3291         * support.cs (InternalParameters.Parameters): Renamed `parameters'
3292         to `Parameters' and made it public readonly.
3293
3294 2002-08-06  Martin Baulig  <martin@gnome.org>
3295
3296         * ecore.cs (Expression.Warning): Made this public as well.
3297
3298         * report.cs (Report.Debug): Print the contents of collections.
3299
3300 2002-08-06  Martin Baulig  <martin@gnome.org>
3301
3302         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
3303         used to tell Resolve() which kinds of expressions it may return.
3304         (Expression.Resolve): Added overloaded version of this method which
3305         takes a `ResolveFlags flags' argument.  This can be used to tell
3306         Resolve() which kinds of expressions it may return.  Reports a
3307         CS0118 on error.
3308         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
3309         ResolveFlags.SimpleName.
3310         (Expression.Error118): Added overloaded version of this method which
3311         takes a `ResolveFlags flags' argument.  It uses the flags to determine
3312         which kinds of expressions are allowed.
3313
3314         * expression.cs (Argument.ResolveMethodGroup): New public method.
3315         Resolves an argument, but allows a MethodGroup to be returned.
3316         This is used when invoking a delegate.
3317
3318         * TODO: Updated a bit.
3319
3320 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3321
3322         Fixed compilation with csc.
3323
3324         * ecore.cs: Expression.Error made public. Is this correct? Should
3325         Warning be made public too?
3326
3327         * expression.cs: use ea.Location instead of ea.loc.
3328         [FIXME:  Filed as bug #28607: MCS must report these errors.]
3329
3330 2002-08-06  Martin Baulig  <martin@gnome.org>
3331
3332         * ecore.cs (Expression.loc): Moved the location here instead of
3333         duplicating it in all derived classes.
3334         (Expression.Location): New public property.
3335         (Expression.Error, Expression.Warning): Made them non-static and
3336         removed the location argument.
3337         (Expression.Warning): Added overloaded version which takes an
3338         `int level' argument.
3339         (Expression.Error118): Make this non-static and removed the
3340         expression and location arguments.
3341         (TypeExpr): Added location argument to the constructor.
3342
3343         * expression.cs (StaticCallExpr): Added location argument to
3344         the constructor.
3345         (Indirection, PointerArithmetic): Likewise.
3346         (CheckedExpr, UnCheckedExpr): Likewise.
3347         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
3348         (StringPtr): Likewise.
3349
3350
3351 2002-08-05  Martin Baulig  <martin@gnome.org>
3352
3353         * expression.cs (BaseAccess.DoResolve): Actually report errors.
3354
3355         * assign.cs (Assign.DoResolve): Check whether the source
3356         expression is a value or variable.
3357
3358         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
3359         while resolving the corresponding blocks.
3360
3361         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
3362         an error, don't silently return null.
3363
3364         * statement.cs (Block.AddVariable): Do the error reporting here
3365         and distinguish between CS0128 and CS0136.
3366         (Block.DoResolve): Report all unused labels (warning CS0164).
3367         (LabeledStatement): Pass the location to the constructor.
3368         (LabeledStatement.HasBeenReferenced): New property.
3369         (LabeledStatement.Resolve): Set it to true here.
3370
3371         * statement.cs (Return.Emit): Return success even after reporting
3372         a type mismatch error (CS0126 or CS0127), this is what csc does and
3373         it avoids confusing the users with any consecutive errors.
3374
3375 2002-08-05  Martin Baulig  <martin@gnome.org>
3376
3377         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
3378
3379         * const.cs (Const.LookupConstantValue): Catch circular definitions.
3380
3381         * expression.cs (MemberAccess.DoResolve): Silently return if an
3382         error has already been reported.
3383
3384         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
3385         error has already been reported.
3386
3387 2002-08-05  Martin Baulig  <martin@gnome.org>
3388
3389         * statement.cs (UsageVector): Only initialize the `parameters'
3390         vector if we actually have any "out" parameters.
3391
3392 2002-08-05  Martin Baulig  <martin@gnome.org>
3393
3394         * expression.cs (Binary.ResolveOperator): When combining delegates,
3395         they must have the same type.
3396
3397 2002-08-05  Martin Baulig  <martin@gnome.org>
3398
3399         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
3400         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
3401         work with the ms runtime and we also don't need it: if we're a
3402         PropertyBuilder and not in the `indexer_arguments' hash, then we
3403         are a property and not an indexer.
3404
3405         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
3406         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
3407         since the latter one doesn't work with the ms runtime.
3408
3409 2002-08-03  Martin Baulig  <martin@gnome.org>
3410
3411         Fixed bugs #27998 and #22735.
3412
3413         * class.cs (Method.IsOperator): New public field.
3414         (Method.CheckBase): Report CS0111 if there's already a method
3415         with the same parameters in the current class.  Report CS0508 when
3416         attempting to change the return type of an inherited method.
3417         (MethodData.Emit): Report CS0179 if a method doesn't have a body
3418         and it's not marked abstract or extern.
3419         (PropertyBase): New abstract base class for Property and Indexer.
3420         (PropertyBase.CheckBase): Moved here from Property and made it work
3421         for indexers.
3422         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
3423         the same so we can reuse it there.
3424         (Property, Indexer): Derive from PropertyBase.
3425         (MethodSignature.inheritable_property_signature_filter): New delegate
3426         to find properties and indexers.
3427
3428         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
3429         argument and improved error reporting.
3430
3431         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
3432         EmptyReadOnlyParameters and made it a property.
3433
3434         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
3435         version of this method which takes a `PropertyInfo indexer'.
3436         (TypeManager.RegisterIndexer): New method.
3437
3438         * class.cs: Added myself as author of this file :-)
3439
3440 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3441
3442         * class.cs: fixed compilation on windoze.
3443
3444 2002-08-03  Martin Baulig  <martin@gnome.org>
3445
3446         * interface.cs (Interface.GetInterfaceBases): Check whether all
3447         base interfaces are at least as accessible than the current one.
3448
3449         * class.cs (TypeContainer.GetClassBases): Check whether base types
3450         are at least as accessible than the current type.
3451         (TypeContainer.AsAccessible): Implemented and made non-static.
3452         (MemberBase.CheckParameters): Report errors if the accessibility
3453         checks fail.
3454
3455         * delegate.cs (Delegate.Delegate): The default visibility is
3456         internal for top-level types and private for nested types.
3457         (Delegate.Define): Report errors if the accessibility checks fail.
3458
3459         * enum.cs (Enum.Enum): The default visibility is internal for
3460         top-level types and private for nested types.
3461         (Enum.DefineType): Compute the correct visibility.
3462
3463         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
3464         function which takes a `bool is_toplevel' instead of a TypeContainer.
3465
3466         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
3467         builtin type.
3468
3469 2002-08-02  Martin Baulig  <martin@gnome.org>
3470
3471         * expression.cs (LocalVariableReferenc): Added constructor which
3472         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
3473         (LocalVariableReference.IsReadOnly): New property.
3474         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
3475         variable is readonly, use our own readonly flag to do this; you can
3476         use the new constructor to get a writable reference to a read-only
3477         variable.
3478
3479         * cs-parser.jay (foreach_statement, using_statement): Get a writable
3480         reference to the local variable.
3481
3482 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
3483
3484         * rootcontext.cs (ResolveCore): Also include System.Exception
3485
3486         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
3487         we reach an EmptyStatement.
3488
3489         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
3490         is also fine.
3491
3492         * expression.cs (Binary.ResolveOperator): Check error result in
3493         two places.
3494
3495         use brtrue/brfalse directly and avoid compares to null.
3496
3497 2002-08-02  Martin Baulig  <martin@gnome.org>
3498
3499         * class.cs (TypeContainer.Define): Define all nested interfaces here.
3500         Fixes bug #28407, added test-155.cs.
3501
3502 2002-08-01  Martin Baulig  <martin@gnome.org>
3503
3504         * class.cs (Event.EmitDefaultMethod): Make this work with static
3505         events.  Fixes #28311, added verify-3.cs.
3506
3507 2002-08-01  Martin Baulig  <martin@gnome.org>
3508
3509         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
3510         `is_disposable' fields.
3511         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
3512         `hm.is_disposable' if we're using the collection pattern.
3513         (Foreach.EmitCollectionForeach): Use the correct type for the
3514         enumerator's local variable, only emit the try/finally block if
3515         necessary (fixes #27713).
3516
3517 2002-08-01  Martin Baulig  <martin@gnome.org>
3518
3519         * ecore.cs (Expression.report118): Renamed to Error118 and made
3520         it public static.
3521
3522         * statement.cs (Throw.Resolve): Check whether the expression is of
3523         the correct type (CS0118) and whether the type derives from
3524         System.Exception (CS0155).
3525         (Catch.Resolve): New method.  Do the type lookup here and check
3526         whether it derives from System.Exception (CS0155).
3527         (Catch.CatchType, Catch.IsGeneral): New public properties.
3528
3529         * typemanager.cs (TypeManager.exception_type): Added.
3530
3531 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
3532
3533         * driver.cs: Updated About function.
3534
3535 2002-07-31  Martin Baulig  <martin@gnome.org>
3536
3537         Implemented Control Flow Analysis.
3538
3539         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
3540         (EmitContext.CurrentBranching): Added.
3541         (EmitContext.StartFlowBranching): Added.
3542         (EmitContext.EndFlowBranching): Added.
3543         (EmitContext.KillFlowBranching): Added.
3544         (EmitContext.IsVariableAssigned): Added.
3545         (EmitContext.SetVariableAssigned): Added.
3546         (EmitContext.IsParameterAssigned): Added.
3547         (EmitContext.SetParameterAssigned): Added.
3548         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
3549         Added control flow analysis stuff here.
3550
3551         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
3552         resolve the expression as lvalue.
3553         (LocalVariableReference.DoResolve): Check whether the variable has
3554         already been assigned.
3555         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
3556         the parameter as assigned here.
3557         (ParameterReference.DoResolve): Check whether the parameter has already
3558         been assigned.
3559         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
3560         expression as lvalue.
3561
3562         * statement.cs (FlowBranching): New class for the flow analysis code.
3563         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
3564         (LabeledStatement.IsDefined): New public property.
3565         (LabeledStatement.AddUsageVector): New public method to tell flow
3566         analyis that the label may be reached via a forward jump.
3567         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
3568         flow analysis.
3569         (VariableInfo.Number): New public field.  This is used by flow analysis
3570         to number all locals of a block.
3571         (Block.CountVariables): New public property.  This is the number of
3572         local variables in this block (including the locals from all parent
3573         blocks).
3574         (Block.EmitMeta): Number all the variables.
3575
3576         * statement.cs: Added flow analysis support to all classes.
3577
3578 2002-07-31  Martin Baulig  <martin@gnome.org>
3579
3580         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
3581         To get debugging messages, compile mcs with /define:MCS_DEBUG and
3582         then use this argument.
3583
3584         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
3585
3586         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
3587         use this to specify /define options.
3588
3589 2002-07-29  Martin Baulig  <martin@gnome.org>
3590
3591         * statement.cs (Fixed): Moved all code that does variable lookups
3592         and resolvings from Emit to Resolve.
3593
3594         * statement.cs (For): Moved all code that does variable lookups
3595         and resolvings from Emit to Resolve.
3596
3597         * statement.cs (Using): Moved all code that does variable lookups
3598         and resolvings from Emit to Resolve.
3599
3600 2002-07-29  Martin Baulig  <martin@gnome.org>
3601
3602         * attribute.cs (Attribute.Resolve): Explicitly catch a
3603         System.NullReferenceException when creating the
3604         CustromAttributeBuilder and report a different warning message.
3605
3606 2002-07-29  Martin Baulig  <martin@gnome.org>
3607
3608         * support.cs (ParameterData.ParameterName): Added method to
3609         get the name of a parameter.
3610
3611         * typemanager.cs (TypeManager.IsValueType): New public method.
3612
3613 2002-07-29  Martin Baulig  <martin@gnome.org>
3614
3615         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
3616         is a flag which specifies that it's either ref or out.
3617         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
3618         the out parameter to `out Parameter.Modifier mod', also set the
3619         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
3620
3621         * support.cs (InternalParameters.ParameterModifier): Distinguish
3622         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3623         Parameter.Modifier.ISBYREF flag if it's either ref or out.
3624
3625         * expression.cs (Argument.GetParameterModifier): Distinguish
3626         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3627         Parameter.Modifier.ISBYREF flag if it's either ref or out.
3628
3629 2002-07-29  Martin Baulig  <martin@gnome.org>
3630
3631         * expression.cs (ParameterReference.ParameterReference): Added
3632         `Location loc' argument to the constructor.
3633
3634         * cs-parser.jay: Pass location to ParameterReference.
3635
3636 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
3637
3638         * statement.cs (Try): Initialize the location.
3639
3640         * cs-parser.jay: pass location to Try.
3641
3642         * expression.cs (Unary.Reduce): Change the prototype to return
3643         whether a constant fold could be performed or not.  The result is
3644         returned in an out parameters.  In the case of Indirection and
3645         AddressOf, we want to perform the full tests.
3646
3647 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
3648
3649         * statement.cs (Statement.Emit): Flag dead code.
3650
3651 2002-07-27  Andrew Birkett  <andy@nobugs.org>
3652
3653         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
3654
3655 2002-07-27  Martin Baulig  <martin@gnome.org>
3656
3657         * class.cs (MethodData.Define): Put back call to
3658         TypeManager.AddMethod(), accidentally commented this out.
3659
3660         * report.cs (Debug): New public method to print debugging information,
3661         this is `[Conditional ("DEBUG")]'.
3662
3663 2002-07-26  Martin Baulig  <martin@gnome.org>
3664
3665         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
3666         (switch_statement): Push the current_block to the switch_stack and
3667         pop it again when we're done with the switch.
3668         (switch_section): The new block is a child of the current_block.
3669         Fixes bug #24007, added test-152.cs.
3670
3671 2002-07-27  Martin Baulig  <martin@gnome.org>
3672
3673         * expression.cs (Invocation.EmitArguments): When calling a varargs
3674         function with only its fixed arguments, we need to pass an empty
3675         array.
3676
3677 2002-07-27  Martin Baulig  <martin@gnome.org>
3678
3679         Mono 0.13 has been released.
3680
3681 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
3682
3683         * driver.cs: Rename --resource to --linkres, because that is what
3684         we do currently, we dont support --resource yet.
3685
3686         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
3687
3688 2002-07-25  Martin Baulig  <martin@gnome.org>
3689
3690         * class.cs (MethodData): New public class.  This is a `method builder'
3691         class for a method or one accessor of a Property/Indexer/Event.
3692         (MethodData.GetMethodFlags): Moved here from MemberBase.
3693         (MethodData.ApplyAttributes): Likewise.
3694         (MethodData.ApplyObsoleteAttribute): Likewise.
3695         (MethodData.ApplyConditionalAttribute): Likewise.
3696         (MethodData.ApplyDllImportAttribute): Likewise.
3697         (MethodData.CheckAbstractAndExternal): Likewise.
3698         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
3699         (MethodData.Emit): Formerly known as Method.Emit().
3700         (MemberBase): Moved everything which was specific to a single
3701         accessor/method to MethodData.
3702         (Method): Create a new MethodData and call Define() and Emit() on it.
3703         (Property, Indexer, Event): Create a new MethodData objects for each
3704         accessor and call Define() and Emit() on them.
3705
3706 2002-07-25  Martin Baulig  <martin@gnome.org>
3707
3708         Made MethodCore derive from MemberBase to reuse the code from there.
3709         MemberBase now also checks for attributes.
3710
3711         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
3712         (MemberBase.GetMethodFlags): Moved here from class Method and marked
3713         as virtual.
3714         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
3715         `CallingConventions cc' and `Attributes opt_attrs' arguments.
3716         (MemberBase.ApplyAttributes): New virtual method; applies the
3717         attributes to a method or accessor.
3718         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
3719         (MemberBase.ApplyConditionalAttribute): Likewise.
3720         (MemberBase.ApplyDllImportAttribute): Likewise.
3721         (MemberBase.CheckAbstractAndExternal): Likewise.
3722         (MethodCore.ParameterTypes): This is now a property instead of a
3723         method, it's initialized from DoDefineParameters().
3724         (MethodCore.ParameterInfo): Removed the set accessor.
3725         (MethodCore.DoDefineParameters): New protected virtual method to
3726         initialize ParameterTypes and ParameterInfo.
3727         (Method.GetReturnType): We can now simply return the MemberType.
3728         (Method.GetMethodFlags): Override the MemberBase version and add
3729         the conditional flags.
3730         (Method.CheckBase): Moved some code from Define() here, call
3731         DoDefineParameters() here.
3732         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
3733         here to avoid some larger code duplication.
3734         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
3735         ensure that abstract and external accessors don't declare a body.
3736
3737         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
3738         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
3739         lookup in the attribute's parent classes, so we need to abort as soon
3740         as we found the first match.
3741         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
3742         the attribute has no arguments.
3743
3744         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
3745         of a Method.
3746
3747 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3748
3749         * cs-parser.jay: reverted previous patch.
3750
3751 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3752
3753         * cs-parser.jay: fixed bug #22119.
3754
3755 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3756
3757         * attribute.cs: fixed compilation. The error was:
3758         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
3759         be assigned to before control leaves the current method."
3760         [FIXME:  Filed as bug #28186: MCS must report this error.]
3761
3762 2002-07-25  Martin Baulig  <martin@gnome.org>
3763
3764         * attribute.cs (Attribute.Conditional_GetConditionName): New static
3765         method to pull the condition name ouf of a Conditional attribute.
3766         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
3767         the obsolete message and error flag out of an Obsolete attribute.
3768
3769         * class.cs (Method.GetMethodFlags): New public method to get the
3770         TypeManager.MethodFlags for this method.
3771         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
3772         private methods.
3773         (Method.Define): Get and apply the Obsolete and Conditional attributes;
3774         if we're overriding a virtual function, set the new private variable
3775         `parent_method'; call the new TypeManager.AddMethod().
3776
3777         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
3778         the MethodBuilder and the Method in a PtrHashtable.
3779         (TypeManager.builder_to_method): Added for this purpose.
3780         (TypeManager.MethodFlags): Added IsObsoleteError.
3781         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
3782         Obsolete and Conditional arguments in MethodBuilders.  If we discover
3783         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
3784         the message from the attribute.
3785
3786 2002-07-24  Martin Baulig  <martin@gnome.org>
3787
3788         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
3789         preprocessor directives, ensure that the argument to #define/#undef is
3790         exactly one identifier and that it's actually an identifier.
3791
3792         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
3793         did not work ....
3794
3795 2002-07-24  Martin Baulig  <martin@gnome.org>
3796
3797         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
3798         initialize it to TypeManager.object_type in the constructor.
3799         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
3800         of the `hm.get_current' method if we're using the collection pattern.
3801         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
3802         for the explicit conversion to make it work when we're using the collection
3803         pattern and the `Current' property has a different return type than `object'.
3804         Fixes #27713.
3805
3806 2002-07-24  Martin Baulig  <martin@gnome.org>
3807
3808         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
3809         does not match, but don't report any errors.  This method is called in
3810         order for all methods in a MethodGroupExpr until a matching method is
3811         found, so we don't want to bail out if the first method doesn't match.
3812         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
3813         matches, report the 123.  Fixes #28070.
3814
3815 2002-07-24  Martin Baulig  <martin@gnome.org>
3816
3817         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
3818         TypeManager.TypeToCoreType() to the top of the method so the
3819         following equality checks will work.  Fixes #28107.
3820
3821 2002-07-24  Martin Baulig  <martin@gnome.org>
3822
3823         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
3824         operand is of type uint, and the other operand is of type sbyte,
3825         short or int, the operands are converted to type long." -
3826         Actually do what this comment already told us.  Fixes bug #28106,
3827         added test-150.cs.
3828
3829 2002-07-24  Martin Baulig  <martin@gnome.org>
3830
3831         * class.cs (MethodBase): New abstract class.  This is now a base
3832         class for Property, Indexer and Event to avoid some code duplication
3833         in their Define() and DefineMethods() methods.
3834         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
3835         generic methods for Define() and DefineMethods().
3836         (FieldBase): Derive from MemberBase, not MemberCore.
3837         (Property): Derive from MemberBase, not MemberCore.
3838         (Property.DefineMethod): Moved all the code from this method to the
3839         new MethodBase.DefineAccessor(), just call it with appropriate
3840         argumetnts.
3841         (Property.Define): Call the new Property.DoDefine(), this does some
3842         sanity checks and we don't need to duplicate the code everywhere.
3843         (Event): Derive from MemberBase, not MemberCore.
3844         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
3845         accessors, this will also make them work with interface events.
3846         (Indexer): Derive from MemberBase, not MemberCore.
3847         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
3848         (Indexer.Define): Use the new MethodBase functions.
3849
3850         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
3851         argument to the constructor.
3852         (Interface.FindMembers): Added support for interface events.
3853         (Interface.PopluateEvent): Implemented.
3854
3855         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
3856
3857 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
3858
3859         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
3860         but this is required to check for a method name being the same as
3861         the containing class.  
3862
3863         Handle this now.
3864
3865 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3866
3867         * interface.cs: initialize variable.
3868
3869 2002-07-23  Martin Baulig  <martin@gnome.org>
3870
3871         Implemented the IndexerName attribute in interfaces.
3872
3873         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
3874         name if this is an explicit interface implementation.
3875         (Indexer.InterfaceIndexerName): New public variable.  If we're
3876         implementing an interface indexer, this is the IndexerName in that
3877         interface.  Otherwise, it's the IndexerName.
3878         (Indexer.DefineMethod): If we're implementing interface indexer,
3879         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
3880         and Pending.ImplementIndexer methods.
3881         (Indexer.Define): Also define the PropertyBuilder if we're
3882         implementing an interface indexer and this is neither an explicit
3883         interface implementation nor do the IndexerName match the one in
3884         the interface.
3885
3886         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
3887         If a method is defined here, then we always need to create a proxy
3888         for it.  This is used when implementing interface indexers.
3889         (Pending.IsInterfaceIndexer): New public method.
3890         (Pending.ImplementIndexer): New public method.
3891         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
3892         This is used when implementing interface indexers to define a proxy
3893         if necessary.
3894         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
3895         define a proxy if necessary.
3896
3897         * interface.cs (Interface.IndexerName): New public variable.
3898         (Interface.PopulateIndexer): Set the IndexerName.
3899         (Interface.DefineIndexers): New private method.  Populate all the
3900         indexers and make sure their IndexerNames match.
3901
3902         * typemanager.cs (IndexerPropertyName): Added support for interface
3903         indexers.
3904
3905 2002-07-22  Martin Baulig  <martin@gnome.org>
3906
3907         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
3908         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
3909         ret if HasReturnLabel.
3910         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
3911         variables.
3912
3913         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
3914         and set the ec.LoopBeginTryCatchLevel.
3915         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
3916         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
3917         the current ec.TryCatchLevel, the branch goes out of an exception
3918         block.  In this case, we need to use Leave and not Br.
3919
3920 2002-07-22  Martin Baulig  <martin@gnome.org>
3921
3922         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
3923         block unless the block does not always return or it is contained in
3924         another try { ... } catch { ... } block.  Fixes bug #26506.
3925         Added verify-1.cs to the test suite.
3926
3927 2002-07-22  Martin Baulig  <martin@gnome.org>
3928
3929         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
3930         then we do not always return.  Fixes bug #24985.
3931
3932 2002-07-22  Martin Baulig  <martin@gnome.org>
3933
3934         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
3935         lookup on a per-class level; ie. walk up the class hierarchy until we
3936         found at least one applicable method, then choose the best among them.
3937         Fixes bug #24463 and test-29.cs.
3938
3939 2002-07-22  Martin Baulig  <martin@gnome.org>
3940
3941         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
3942         return types of the methods.  The return type is not part of the
3943         signature and we must not check it to make the `new' modifier work.
3944         Fixes bug #27999, also added test-147.cs.
3945         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
3946
3947         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
3948         on the method's return type.
3949
3950 2002-07-21  Martin Baulig  <martin@gnome.org>
3951
3952         * assign.cs: Make this work if the rightmost source is a constant and
3953         we need to do an implicit type conversion.  Also adding a few more tests
3954         to test-38.cs which should have caught this.
3955
3956         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
3957         target in the makefile for this.  The makefile.gnu is primarily intended
3958         for end-users who don't want to debug the compiler.
3959
3960 2002-07-21  Martin Baulig  <martin@gnome.org>
3961
3962         * assign.cs: Improved the Assign class so it can now handle embedded
3963         assignments (X = Y = Z = something).  As a side-effect this'll now also
3964         consume less local variables.  test-38.cs now passes with MCS, added
3965         a few new test cases to that test.
3966
3967 2002-07-20  Martin Baulig  <martin@gnome.org>
3968
3969         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
3970         instructions.  Fixes bug #27977, also added test-146.cs.
3971
3972 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3973
3974         * cs-tokenizer.cs: fixed getHex ().
3975
3976 2002-07-19  Martin Baulig  <martin@gnome.org>
3977
3978         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
3979         not Type.GetType() to lookup the array type.  This is needed when
3980         we're constructing an array of a user-defined type.
3981         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
3982         single-dimensional arrays, but also for single-dimensial arrays of
3983         type decimal.
3984
3985 2002-07-19  Martin Baulig  <martin@gnome.org>
3986
3987         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
3988         this function is called, it's not allowed to share LocalBuilders
3989         among ILGenerators.
3990
3991 2002-07-19  Martin Baulig  <martin@gnome.org>
3992
3993         * expression.cs (Argument.Resolve): Report an error 118 when trying
3994         to pass a type as argument.
3995
3996 2002-07-18  Martin Baulig  <martin@gnome.org>
3997
3998         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
3999         Conv_R_Un for the signed `long' type.
4000
4001 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
4002
4003         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
4004         `expr' for the temporary result, as that will fail if we do
4005         multiple resolves on the same expression.
4006
4007 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
4008
4009         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
4010         ec.TypeContainer for looking up aliases. 
4011
4012         * class.cs (TypeContainer): Remove LookupAlias from here.
4013
4014         * decl.cs (DeclSpace); Move here.
4015
4016 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
4017
4018         * class.cs (FindMembers): Only call filter if the constructor
4019         bulider is not null.
4020
4021         Also handle delegates in `NestedTypes' now.  Now we will perform
4022         type lookups using the standard resolution process.  This also
4023         fixes a bug.
4024
4025         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
4026         This uses Expressions (the limited kind that can be parsed by the
4027         tree) instead of strings.
4028
4029         * expression.cs (ComposedCast.ToString): Implement, used to flag
4030         errors since now we have to render expressions.
4031
4032         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
4033         FormArrayType. 
4034
4035         * ecore.cs (SimpleName.ToString): ditto.
4036
4037         * cs-parser.jay: Instead of using strings to assemble types, use
4038         Expressions to assemble the type (using SimpleName, ComposedCast,
4039         MemberAccess).  This should fix the type lookups in declarations,
4040         because we were using a different code path for this.
4041
4042         * statement.cs (Block.Resolve): Continue processing statements
4043         even when there is an error.
4044
4045 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
4046
4047         * class.cs (Event.Define): Also remove the `remove' method from
4048         the list of pending items.
4049
4050         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
4051         generate more compact code. 
4052
4053 2002-07-17  Martin Baulig  <martin@gnome.org>
4054
4055         * const.cs (Const.LookupConstantValue): Add support for constant
4056         `unchecked' and `checked' expressions.
4057         Also adding test case test-140.cs for this.
4058
4059 2002-07-17  Martin Baulig  <martin@gnome.org>
4060
4061         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
4062         check whether mi.ReturnType implements the IEnumerator interface; the
4063         `==' and the IsAssignableFrom() will fail in this situation.
4064
4065 2002-07-16  Ravi Pratap  <ravi@ximian.com>
4066
4067         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
4068         here too.
4069
4070 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4071
4072         * expression.cs: fixed bug #27811.
4073
4074 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
4075
4076         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
4077         Molaro: when we are a ref, the value already contains a pointer
4078         value, do not take the address of it.
4079
4080 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
4081         * removed mb-parser.jay and mb-tokenizer.cs
4082
4083 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4084
4085         * expression.cs: check against the building corlib void type.
4086
4087 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
4088
4089         * ecore.cs: fix for valuetype static readonly fields: when 
4090         initializing them, we need their address, not the address of a copy.
4091
4092 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
4093
4094         * typemanager.cs: register also enum_type in corlib.
4095
4096 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4097
4098         * class.cs: allow calling this (but not base) initializers in structs.
4099
4100 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
4101
4102         * ecore.cs: make sure we compare against the building base types
4103         in GetTypeSize ().
4104
4105 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
4106
4107         * typemanager.cs: fix TypeToCoreType() to handle void and object
4108         (corlib gets no more typerefs after this change).
4109
4110 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
4111
4112         * expression.cs (ArrayCreation.EmitArrayArguments): use
4113         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
4114
4115         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
4116         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
4117         array indexes, the runtime actually forbids them.
4118
4119         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
4120         for array arguments here.
4121
4122         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
4123         instead of the default for ValueTypes.
4124
4125         (New.DoEmit): Use IsValueType instead of
4126         IsSubclassOf (value_type)
4127         (New.DoResolve): ditto.
4128         (Invocation.EmitCall): ditto.
4129
4130         * assign.cs (Assign): ditto.
4131
4132         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
4133         Statements *are* currently doing part of their resolution during
4134         Emit.  
4135
4136         Expressions do always resolve during resolve, but statements are
4137         only required to propagate resolution to their children.
4138
4139 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
4140
4141         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
4142
4143         (LoadAssembly): Do not add the dll if it is already specified
4144         
4145         (MainDriver): Add the System directory to the link path at the end,
4146         after all the other -L arguments. 
4147
4148         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
4149         wrong opcode for loading bytes and bools (ldelem.i1 instead of
4150         ldelem.u1) and using the opposite for sbytes.
4151
4152         This fixes Digger, and we can finally run it.
4153
4154         * driver.cs (UnixParseOption): Move the option parsing here.  
4155         (CSCParseOption): Implement CSC-like parsing of options.
4156
4157         We now support both modes of operation, the old Unix way, and the
4158         new CSC-like way.  This should help those who wanted to make cross
4159         platform makefiles.
4160
4161         The only thing broken is that /r:, /reference: and /lib: are not
4162         implemented, because I want to make those have the same semantics
4163         as the CSC compiler has, and kill once and for all the confussion
4164         around this.   Will be doing this tomorrow.
4165
4166         * statement.cs (Unsafe.Resolve): The state is checked during
4167         resolve, not emit, so we have to set the flags for IsUnsfe here.
4168
4169 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
4170
4171         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
4172         not catch the Error_ObjectRefRequired in SimpleName (as it is
4173         possible to have a class/instance variable name that later gets
4174         deambiguated), we have to check this here.      
4175
4176 2002-07-10  Ravi Pratap  <ravi@ximian.com>
4177
4178         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
4179         make static and put into Expression.
4180
4181         (Event.Define): Register the private field of the event with the 
4182         TypeManager so that GetFieldFromEvent can get at it.
4183
4184         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
4185         keep track of the private field associated with an event which
4186         has no accessors.
4187
4188         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
4189         private field.
4190
4191         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
4192         
4193 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
4194
4195         * expression.cs (Binary.EmitBranchable): this routine emits the
4196         Binary expression in a branchable context.  This basically means:
4197         we need to branch somewhere, not just get the value on the stack.
4198
4199         This works together with Statement.EmitBoolExpression.
4200
4201         * statement.cs (Statement.EmitBoolExpression): Use
4202         EmitBranchable. 
4203
4204 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
4205
4206         * statement.cs (For): Reduce the number of jumps in loops.
4207
4208         (For): Implement loop inversion for the For statement.
4209
4210         (Break): We can be breaking out of a Try/Catch controlled section
4211         (foreach might have an implicit try/catch clause), so we need to
4212         use Leave instead of Br.
4213
4214         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
4215         now).  If the instace expression supports IMemoryLocation, we use
4216         the AddressOf method from the IMemoryLocation to extract the
4217         address instead of emitting the instance.
4218
4219         This showed up with `This', as we were emitting the instance
4220         always (Emit) instead of the Address of This.  Particularly
4221         interesting when This is a value type, as we dont want the Emit
4222         effect (which was to load the object).
4223         
4224 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
4225
4226         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
4227
4228         * statement.cs (Checked): Set the CheckedState during the resolve
4229         process too, as the ConvCast operations track the checked state on
4230         the resolve process, and not emit.
4231
4232         * cs-parser.jay (namespace_member_declaration): Flag that we have
4233         found a declaration when we do.  This is used to flag error 1529
4234
4235         * driver.cs: Report ok when we display the help only.
4236
4237 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
4238
4239         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
4240
4241 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
4242
4243         * cs-tokenizer.cs (define): We also have to track locally the
4244         defines.  AllDefines is just used for the Conditional Attribute,
4245         but we also need the local defines for the current source code. 
4246
4247 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
4248
4249         * statement.cs (While, For, Do): These loops can exit through a
4250         Break statement, use this information to tell whether the
4251         statement is the last piece of code.
4252
4253         (Break): Flag that we break.
4254
4255         * codegen.cs (EmitContexts): New `Breaks' state variable.
4256
4257 2002-07-03  Martin Baulig  <martin@gnome.org>
4258
4259         * class.cs (TypeContainer.MethodModifiersValid): Allow override
4260         modifiers in method declarations in structs.  Otherwise, you won't
4261         be able to override things like Object.Equals().
4262
4263 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
4264
4265         * class.cs (Method, Property, Indexer): Do not allow the public
4266         modifier to be used in explicit interface implementations.
4267
4268         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
4269         override modifiers in method declarations in structs
4270
4271 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
4272
4273         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
4274         integer or real overflow, report an error
4275
4276 2002-07-02  Martin Baulig  <martin@gnome.org>
4277
4278         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
4279         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
4280         to tell the runtime about our newly created System.Object and
4281         System.ValueType types.
4282
4283 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
4284
4285         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
4286         struct instead of Ldarg/Starg.
4287
4288 2002-07-02  Martin Baulig  <martin@gnome.org>
4289
4290         * expression.cs (Indirection.Indirection): Call
4291         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
4292
4293 2002-07-02  Martin Baulig  <martin@gnome.org>
4294
4295         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
4296         ValueType, call TypeManager.TypeToCoreType() on it.
4297         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
4298         the OpCodes.Newarr argument.
4299
4300 2002-07-02  Martin Baulig  <martin@gnome.org>
4301
4302         * expression.cs (Invocation.EmitCall): When compiling corlib,
4303         replace all calls to the system's System.Array type to calls to
4304         the newly created one.
4305
4306         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
4307         System.Array methods.
4308         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
4309         from the system's System.Array type which must be replaced.
4310
4311 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
4312
4313         * typemanager.cs: load unverifiable_code_ctor so we can build
4314         corlib using the correct type. Avoid using GetTypeCode() with
4315         TypeBuilders.
4316         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
4317         TypeManager.object_type to allow building corlib.
4318
4319 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
4320
4321         * ecore.cs: handle System.Enum separately in LoadFromPtr().
4322
4323 2002-07-01  Martin Baulig  <martin@gnome.org>
4324
4325         * class.cs: Make the last change actually work, we need to check
4326         whether `ifaces != null' to avoid a crash.
4327
4328 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4329
4330         * class.cs: when we build structs without fields that implement
4331         interfaces, we need to add the interfaces separately, since there is
4332         no API to both set the size and add the interfaces at type creation
4333         time.
4334
4335 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4336
4337         * expression.cs: the dimension arguments to the array constructors
4338         need to be converted if they are a long.
4339
4340 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
4341
4342         * class.cs: don't emit ldarg.0 if there is no parent constructor
4343         (fixes showstopper for corlib).
4344
4345 2002-06-29  Martin Baulig  <martin@gnome.org>
4346
4347         MCS now compiles corlib on GNU/Linux :-)
4348
4349         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
4350         ie. check for MethodImplOptions.InternalCall.
4351
4352         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
4353         and TypeManager.attribute_type are null, so we must explicitly check
4354         whether parent is not null to find out whether it's an attribute type.
4355         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
4356         and SetBuilder, not only if the property is neither abstract nor external.
4357         This is necessary to set the MethodImplOptions on the accessor methods.
4358         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
4359         SetBuilder, see Property.Emit().
4360
4361         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
4362         populate "System.Object", "System.ValueType" and "System.Attribute" since
4363         they've already been populated from BootCorlib_PopulateCoreTypes().
4364
4365 2002-06-29  Martin Baulig  <martin@gnome.org>
4366
4367         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
4368         is the NullLiteral, we also need to make sure that target_type is not
4369         an enum type.   
4370
4371 2002-06-29  Martin Baulig  <martin@gnome.org>
4372
4373         * rootcontext.cs (RootContext.ResolveCore): We must initialize
4374         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
4375         before calling BootstrapCorlib_ResolveDelegate ().
4376
4377 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4378
4379         * statement.cs: fixed build-breaker. All tests passed ok.
4380
4381 2002-06-27  Martin Baulig  <martin@gnome.org>
4382
4383         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
4384         for System.Decimal when compiling corlib.
4385
4386 2002-06-27  Martin Baulig  <martin@gnome.org>
4387
4388         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
4389         switch blocks which contain nothing but a default clause.
4390
4391 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
4392
4393        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
4394
4395 2002-06-27  Martin Baulig  <martin@gnome.org>
4396
4397         * ecore.cs (PropertyExpr.PropertyExpr): Call
4398         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
4399
4400         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
4401         is already a TypeBuilder.
4402
4403 2002-06-27  Martin Baulig  <martin@gnome.org>
4404
4405         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
4406         `target_type == TypeManager.array_type', not IsAssignableFrom() in
4407         the "from an array-type to System.Array" case.  This makes it work
4408         when compiling corlib.
4409
4410 2002-06-27  Martin Baulig  <martin@gnome.org>
4411
4412         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
4413         non-static PropertyExpr, set its InstanceExpression.  This makes
4414         the `ICollection.Count' property work in System/Array.cs.
4415
4416 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
4417
4418         * driver.cs: Made error handling more consistent.  Errors now
4419         tracked by Report class, so many methods which used to return int
4420         now return void.  Main() now prints success/failure and 
4421         errors/warnings message.
4422
4423         Renamed '--probe' compiler argument to '--expect-error'.  Removed
4424         the magic number return values (123 and 124).  Now, if the
4425         expected error occurs, the compiler exits with success (exit value
4426         0).  If the compilation completes without seeing that particular
4427         error, the compiler exits with failure (exit value 1).  The
4428         makefile in mcs/errors has been changed to handle the new behaviour.
4429
4430         * report.cs: Made 'expected error' number a property and renamed
4431         it from 'Probe' to 'ExpectedError'.
4432
4433         * genericparser.cs: Removed error handling support, since it is
4434         now all done by Report class.
4435
4436         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
4437         class, so parse() no longer returns an int.
4438
4439         * namespace.cs: Use Report.Error instead of GenericParser.error
4440
4441 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
4442
4443         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
4444         TypeContainer.AddOperator): At the front of the list put the
4445         explicit implementations, so they get resolved/defined first. 
4446
4447 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
4448
4449         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
4450         interface type is implemented by this TypeContainer.  Used during
4451         explicit interface implementation.
4452
4453         (Property.Define, Indexer.Define, Method.Define): Validate that
4454         the given interface in the explicit implementation is one of the
4455         base classes for the containing type.
4456
4457         Also if we are explicitly implementing an interface, but there is
4458         no match in the pending implementation table, report an error.
4459
4460         (Property.Define): Only define the property if we are
4461         not explicitly implementing a property from an interface.  Use the
4462         correct name also for those properties (the same CSC uses,
4463         although that is really not needed).
4464         
4465         (Property.Emit): Do not emit attributes for explicitly implemented
4466         properties, as there is no TypeBuilder.
4467
4468         (Indexer.Emit): ditto.
4469
4470         Hiding then means that we do not really *implement* a pending
4471         implementation, which makes code fail.
4472
4473 2002-06-22  Martin Baulig  <martin@gnome.org>
4474
4475         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
4476         the return value of Object.GetType().  [FIXME: we need to do this whenever
4477         we get a type back from the reflection library].
4478
4479 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
4480
4481         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
4482
4483 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
4484
4485         * attribute.cs: Return null if we can not look up the type.
4486
4487         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
4488         the interface types found.
4489
4490         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
4491         interface types found.
4492
4493         * typemanager.cs (GetInterfaces): Make this routine returns alll
4494         the interfaces and work around the lame differences between
4495         System.Type and System.Reflection.Emit.TypeBuilder in the results
4496         result for GetInterfaces.
4497         
4498         (ExpandInterfaces): Given an array of interface types, expand and
4499         eliminate repeated ocurrences of an interface.  This expands in
4500         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
4501         be IA, IB, IC.
4502         
4503 2002-06-21  Martin Baulig  <martin@gnome.org>
4504
4505         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
4506         on System.Enum.
4507
4508 2002-06-21  Martin Baulig  <martin@gnome.org>
4509
4510         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
4511         and called with one of the core types, return the corresponding typebuilder for
4512         that type.
4513
4514         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
4515         element type.
4516
4517 2002-06-21  Martin Baulig  <martin@gnome.org>
4518
4519         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
4520         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
4521         (Expression.ConvertReferenceExplicit): Likewise.
4522
4523         * expression.cs (ElementAccess.DoResolve): Likewise.
4524         (ElementAccess.DoResolveLValue): Likewise.
4525
4526 2002-06-10  Martin Baulig  <martin@gnome.org>
4527
4528         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
4529         add the "value" parameter to the parameter list.
4530
4531         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
4532         to our caller.
4533
4534 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
4535
4536         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
4537         the argument to an int, uint, long or ulong, per the spec.  Also
4538         catch negative constants in array creation.
4539
4540 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
4541
4542         * class.cs: do not allow the same interface to appear twice in
4543         the definition list.
4544
4545 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
4546
4547         * ecore.cs: don't use ldlen with System.Array.
4548
4549 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
4550
4551         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
4552
4553 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
4554
4555         * modifiers.cs: produce correct field attributes for protected
4556         internal. Easy fix so miguel can work on ther harder stuff:-)
4557
4558 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
4559
4560         * pending.cs: New file.  Move the code from class.cs here.
4561         Support clearning the pending flag for all methods (when not doing
4562         explicit interface implementation).
4563
4564 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
4565
4566         * rootcontext.cs: added a couple more types needed to bootstrap.
4567
4568 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
4569
4570         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
4571         constructor in the type, instead of any constructor in the type
4572         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
4573         a bug in the Mono runtime when applying the params attribute). 
4574
4575 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
4576         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
4577
4578 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
4579
4580         * expression.cs (Unary.ResolveOperator): Use TypeManager
4581         to resolve the type.
4582         
4583 2002-06-13  Ravi Pratap  <ravi@ximian.com>
4584
4585         * cs-parser.jay (enum_member_declaration): Pass in the attributes
4586         attached.
4587
4588         * enum.cs (AddEnumMember): Add support to store the attributes associated 
4589         with each member too.
4590
4591         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
4592         field builders too - this takes care of the enum member case.
4593
4594 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
4595
4596         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
4597         address-of operator on both value types and pointers.
4598         
4599 2002-06-10  Martin Baulig  <martin@gnome.org>
4600
4601         * interface.cs (Interface.PopulateIndexer): Add the indexer's
4602         PropertyBuilder to the `property_builders' list.
4603
4604         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
4605         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
4606         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
4607         find any indexers which are inherited from an interface.
4608
4609 2002-06-09  Martin Baulig  <martin@gnome.org>
4610
4611         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
4612         the same type as the constant if necessary.  There's also a test-130.cs
4613         for this.
4614
4615         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
4616
4617         * typemanager.cs (TypeManager.ChangeType): Previously known as
4618         Enum.ChangeEnumType().
4619
4620 2002-06-09  Martin Baulig  <martin@gnome.org>
4621
4622         * expression.cs (Cast.TryReduce): Added support for consts.
4623
4624 2002-06-08  Ravi Pratap  <ravi@ximian.com>
4625
4626         * class.cs (Accessor): Hold attributes information so we can pass
4627         it along.
4628
4629         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
4630         Modify to pass in attributes attached to the methods.
4631
4632         (add_accessor_declaration, remove_accessor_declaration): Ditto.
4633
4634         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
4635         to handle the Accessor kind :-)
4636
4637         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
4638         
4639 2002-06-08  Martin Baulig  <martin@gnome.org>
4640
4641         * expression.cs (Unary.TryReduceNegative): Added support for
4642         ULongConstants.
4643
4644 2002-06-08  Martin Baulig  <martin@gnome.org>
4645
4646         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
4647         name can't be found in the `defined_names' - the caller will do a
4648         MemberLookup in this case and thus find methods in System.Enum
4649         such as Enum.IsDefined().
4650
4651 2002-06-08  Martin Baulig  <martin@gnome.org>
4652
4653         * enum.cs (Enum.ChangeEnumType): This is a custom version of
4654         Convert.ChangeType() which works with TypeBuilder created types.
4655         (Enum.LookupEnumValue, Enum.Define): Use it here.
4656
4657         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
4658         `TypeBuilder.BaseType != null' check.
4659         (TypeContainer.FindMembers): Only lookup parent members if we
4660         actually have a parent.
4661         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
4662         (ConstructorInitializer.Resolve): Likewise.
4663
4664         * interface.cs (Interface.FindMembers): Added
4665         `TypeBuilder.BaseType != null' check.
4666
4667         * rootcontext.cs (RootContext.ResolveCore): Added
4668         "System.Runtime.CompilerServices.IndexerNameAttribute" to
4669         classes_second_stage.
4670
4671         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
4672         debug_type and trace_type when compiling with --nostdlib.       
4673
4674 2002-06-07  Martin Baulig  <martin@gnome.org>
4675
4676         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
4677         (AddField): Set it to true when adding a non-static field.
4678         (DefineType): Use `have_nonstatic_fields' to find out whether we
4679         have non-static fields, not `Fields != null'.
4680
4681 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
4682
4683         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
4684         dereferencing a null on the static-field code path)
4685
4686 2002-05-30  Martin Baulig  <martin@gnome.org>
4687
4688         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
4689         to take command line arguments.  Use reflection to call the new
4690         custom `Initialize' function on the symbol writer and pass it the
4691         command line arguments.
4692
4693         * driver.cs (--debug-args): New command line argument to pass command
4694         line arguments to the symbol writer.
4695
4696 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
4697
4698         * assign.cs (DoResolve): Forgot to do the implicit conversion to
4699         the target type for indexers and properties.  Thanks to Joe for
4700         catching this.
4701
4702 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
4703
4704         * typemanager.cs (MethodFlags): returns the method flags
4705         (Obsolete/ShouldIgnore) that control warning emission and whether
4706         the invocation should be made, or ignored. 
4707
4708         * expression.cs (Invocation.Emit): Remove previous hack, we should
4709         not do this on matching a base type, we should do this based on an attribute
4710
4711         Only emit calls to System.Diagnostics.Debug and
4712         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
4713         on the command line.
4714
4715         * rootcontext.cs: Global settings for tracing and debugging.
4716
4717         * cs-tokenizer.cs (define): New utility function to track
4718         defines.   Set the global settings for TRACE and DEBUG if found.
4719
4720 2002-05-25  Ravi Pratap  <ravi@ximian.com>
4721
4722         * interface.cs (Populate*): Pass in the TypeContainer as well as
4723         the DeclSpace as parameters so that we can create EmitContexts and
4724         then use that to apply attributes etc.
4725
4726         (PopulateMethod, PopulateEvent, PopulateProperty)
4727         (PopulateIndexer): Apply attributes everywhere.
4728
4729         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
4730         etc.
4731
4732         (ApplyAttributes): Update accordingly.
4733
4734         We now apply interface attributes for all members too.
4735
4736 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
4737
4738         * class.cs (Indexer.Define); Correctly check if we are explicit
4739         implementation (instead of checking the Name for a ".", we
4740         directly look up if the InterfaceType was specified).
4741
4742         Delay the creation of the PropertyBuilder.
4743
4744         Only create the PropertyBuilder if we are not an explicit
4745         interface implementation.   This means that explicit interface
4746         implementation members do not participate in regular function
4747         lookups, and hence fixes another major ambiguity problem in
4748         overload resolution (that was the visible effect).
4749
4750         (DefineMethod): Return whether we are doing an interface
4751         implementation. 
4752         
4753         * typemanager.cs: Temporary hack until we get attributes in
4754         interfaces (Ravi is working on that) and we get IndexerName
4755         support in interfaces.
4756
4757         * interface.cs: Register the indexers as properties.
4758
4759         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
4760         warning, I have verified that this is a bug in the .NET runtime
4761         (JavaScript suffers of the same problem).
4762
4763         * typemanager.cs (MemberLookup): When looking up members for
4764         interfaces, the parent of an interface is the implicit
4765         System.Object (so we succeed in searches of Object methods in an
4766         interface method invocation.  Example:  IEnumerable x;  x.ToString
4767         ()) 
4768
4769 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
4770
4771         * class.cs (Event): Events should also register if they do
4772         implement the methods that an interface requires.
4773
4774         * typemanager.cs (MemberLookup); use the new GetInterfaces
4775         method. 
4776
4777         (GetInterfaces): The code used to lookup interfaces for a type is
4778         used in more than one place, factor it here. 
4779
4780         * driver.cs: Track the errors at the bottom of the file, we kept
4781         on going.
4782
4783         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
4784         instance if the method we are calling is static!
4785
4786 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
4787
4788         * attribute.cs (ApplyAttributes): Make this function filter out
4789         the IndexerName attribute (as that attribute in reality is never
4790         applied) and return the string constant for the IndexerName
4791         attribute. 
4792
4793         * class.cs (TypeContainer.Emit): Validate that all the indexers
4794         have the same IndexerName attribute, and if so, set the
4795         DefaultName attribute on the class. 
4796
4797         * typemanager.cs: The return value might contain other stuff (not
4798         only methods).  For instance, consider a method with an "Item"
4799         property and an Item method.
4800
4801         * class.cs: If there is a problem with the parameter types,
4802         return. 
4803
4804 2002-05-24  Ravi Pratap  <ravi@ximian.com>
4805
4806         * ecore.cs (ImplicitConversionExists): Wrapper function which also
4807         looks at user defined conversion after making a call to 
4808         StandardConversionExists - we need this for overload resolution.
4809
4810         * expression.cs : Update accordingly the various method calls.
4811
4812         This fixes 2 bugs filed against implicit user defined conversions 
4813
4814 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
4815
4816         * statement.cs: Track the result of the assignment.
4817
4818 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
4819
4820         * expression.cs (MemberAccess): Improved error reporting for
4821         inaccessible members.
4822
4823 2002-05-22  Martin Baulig  <martin@gnome.org>
4824
4825         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
4826         itself with debugging support.
4827
4828 2002-05-22  Martin Baulig  <martin@gnome.org>
4829
4830         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
4831         Removed, this isn't needed anymore.
4832
4833 2002-05-20  Martin Baulig  <martin@gnome.org>
4834
4835         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
4836         be underlying type for an enum.
4837
4838 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
4839
4840         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
4841         that splits out the loading of just the core types.
4842
4843         * rootcontext.cs (ResolveCore): Split the struct resolution in
4844         two, so we can load the enumeration underlying types before any
4845         enums are used.
4846
4847         * expression.cs (Is): Bandaid until we fix properly Switch (see
4848         bug #24985 for details).
4849
4850         * typemanager.cs (ImplementsInterface): The hashtable will contain
4851         a null if there are no interfaces implemented.
4852
4853 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
4854
4855         * cs-parser.jay (indexer_declarator): It is fine to have array
4856         parameters
4857
4858 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
4859
4860         * typemanager.cs: (RegisterBuilder): New function used to register
4861         TypeBuilders that implement interfaces.  Since
4862         TypeBuilder.GetInterfaces (as usual) does not work with lame
4863         Reflection.Emit. 
4864         (AddUserType): register interfaces.
4865
4866         (ImplementsInterface): Use the builder_to_ifaces hash if we are
4867         dealing with TypeBuilder.  Also, arrays are showing up as
4868         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
4869         methods can not be invoked on them!
4870
4871         * ecore.cs (ExplicitReferenceConversionExists): Made public.
4872         (ImplicitReferenceConversionExists): Split out from
4873         StandardConversionExists. 
4874
4875         * expression.cs (As): We were only implementing one of the three
4876         cases for the as operator.  We now implement them all.
4877         (Is): Implement the various other cases for Is as well.
4878
4879         * typemanager.cs (CACHE): New define used to control if we want or
4880         not the FindMembers cache.  Seems to have a negative impact on
4881         performance currently
4882
4883         (MemberLookup): Nested types have full acess to
4884         enclosing type members
4885
4886         Remove code that coped with instance/static returns for events, we
4887         now catch this in RealFindMembers.
4888
4889         (RealFindMembers): only perform static lookup if the instance
4890         lookup did not return a type or an event.  
4891
4892 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
4893
4894         * assign.cs (CompoundAssign): We pass more semantic information
4895         now to Compound Assignments than we did before: now we have all
4896         the information at hand, and now we resolve the target *before* we
4897         do the expression expansion, which allows the "CacheValue" method
4898         to have the effect we intended (before, a [x] += 1 would generate
4899         two differen ArrayAccess expressions from the ElementAccess,
4900         during the resolution process).
4901
4902         (CompoundAssign.DoResolve): Resolve target and original_source here.
4903
4904 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
4905
4906         * expression.cs (ArrayAccess): dropped debugging information. 
4907
4908         * typemanager.cs: Small bug fix: I was always returning i_members,
4909         instead of one of i_members or s_members (depending on which had
4910         the content).
4911
4912         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
4913         method is invoked before any code generation takes place, and it
4914         is a mechanism to inform that the expression will be invoked more
4915         than once, and that the method should use temporary values to
4916         avoid having side effects
4917
4918         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
4919         
4920         * ecore.cs (Expression.CacheTemporaries): Provide empty default
4921         implementation.
4922
4923         * expression.cs (Indirection, ArrayAccess): Add support for
4924         CacheTemporaries in these two bad boys. 
4925
4926         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
4927         ldobj or ldind_ref.  
4928         (StoreFromPtr): Handle stobj as well.
4929
4930         * expression.cs (UnaryMutator): Share more code.
4931         
4932         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
4933         down: I was not tracking the Filter function as well, which
4934         was affecting the results of the cache.
4935
4936 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
4937
4938         * attribute.cs: Remove the hack to handle the CharSet property on
4939         StructLayouts. 
4940
4941 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
4942
4943         * attribute.cs (DoResolve): More uglyness, we now only try to
4944         resolve the attribute partially, to extract the CharSet
4945         information (only if we are a StructLayout attribute).  Otherwise 
4946
4947         (GetExtraTypeInfo): Add some code to conditionally kill in the
4948         future this.   I am more and more convinced that the .NET
4949         framework has special code to handle the attribute setting on
4950         certain elements.
4951
4952         * expression.cs (IsParamsMethodApplicable): Revert my previous
4953         foreach change here, it was wrong.
4954
4955 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
4956
4957         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
4958         (pp_expr): do not abort on unknown input, just return.
4959         (eval): abort if there are pending chars.
4960
4961         * attribute.cs (Attribute.Resolve): Positional parameters are
4962         optional.  Deal with that case.
4963
4964         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
4965         the Ansi/Unicode/Auto information for the type.
4966
4967         (TypeContainer.DefineType): instantiate the EmitContext here, as
4968         we will be using it during the type definition (to resolve
4969         attributes) and during the emit phase.
4970
4971         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
4972         to pull type information out of the attributes
4973
4974         (Attribute.Resolve): track the constructor builder, and allow for
4975         multiple invocations (structs and classes will use this).
4976
4977         * ecore.cs (MemberLookupFinal): new version with all the
4978         parameters customizable.
4979
4980         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
4981         constructors.  Return if the result value is null (as the error
4982         would have been flagged already by MemberLookupFinal)
4983
4984         Do not allow instances of abstract classes or interfaces to be
4985         created.
4986         
4987         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
4988         We have to compare the assembly property here when dealing with
4989         FamANDAssem and Assembly access modifiers, because we might be
4990         creating an assembly from *modules* (that means that we are not
4991         getting TypeBuilders for types defined in other modules that are
4992         part of this assembly).
4993
4994         (Method.Emit): If the method is marked abstract and has a body,
4995         emit an error. 
4996
4997         (TypeContainer.DefineMembers): If both the defined member and the
4998         parent name match are methods, then do not emit any warnings: let
4999         the Method.Define routine take care of flagging warnings.  But if
5000         there is a mismatch (method overrides something else, or method is
5001         overriwritten by something, then emit warning).
5002
5003         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
5004         set to null, this means `do not check for the return type on the
5005         signature'. 
5006
5007         (Method.Define): set the return type for the method signature to
5008         null, so that we get methods with the same name and parameters and
5009         different return types.  This is used to flag warning 114 (you are
5010         hiding a method, and you probably want to use the new/override
5011         keywords instead).
5012
5013         * typemanager.cs (MemberLookup): Implemented proper access
5014         control, closing a long standing set of bug reports.  The problem
5015         was that the Framework only has two bits: Public and NonPublic,
5016         and NonPublic includes private and protected methods, but we need
5017         to enforce the FamANDAssem, FamOrAssem and Family. 
5018
5019 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
5020
5021         * statement.cs (GotoCase): Return true: Ammounts to giving up
5022         knowledge on whether we return or not, and letting the other case
5023         be responsible for it.
5024
5025 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
5026
5027         * driver.cs: Do not load directories for each file processed, only
5028         do it if there is a pattern.
5029
5030         * ecore.cs: Report readonly assigns here as well, as we might have
5031         been resolved only by MemberAccess.
5032
5033         (SimpleName.SimpleNameResolve): Also be useful for LValue
5034         resolution.   We need this to propagate assign to local readonly variables
5035
5036         * typemanager.cs: Use a ptrhashtable for the criteria, because we
5037         do not want to reuse potential criteria memory.
5038
5039         * class.cs (MyEventBuilder): Set reflected_type;
5040
5041         * ecore.cs (Constantify): Added support for constifying bools.
5042
5043         (RootContext.LookupType): Added a cache for values looked up in
5044         the declaration space.
5045
5046         * typemanager.cs (FindMembers): Now is a front-end to
5047         RealFindMembers, and provides a two-level hashtable-based cache to
5048         the request.  
5049
5050         15% performance improvement: from 22.5 to 19.2 seconds.
5051
5052         * expression.cs (IsParamsMethodApplicable): use foreach.
5053         (Invocation.DoResolve): ditto.
5054         (New.DoResolve): ditto.
5055         (ArrayCreation.DoResolve): ditto.
5056
5057         * ecore.cs (FindMostEncompassingType): use foreach.
5058
5059         * delegate.cs (NewDelegate.DoResolve): Use foreach
5060
5061         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
5062         (RemoveMethods): use foreach.
5063
5064         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
5065         nested foreach statements instead of for, and also break out of
5066         the inner loop once a match is found.
5067         
5068         (Invocation.OverloadResolve): Use foreach, simplify the code. 
5069
5070 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
5071
5072         * cfold.cs (BinaryFold): During an enumeration evaluation context,
5073         we actually unwrap the expression to allow for extra information
5074         to be extracted. 
5075
5076         * expression.cs: Use Shr_Un on unsigned operations. 
5077
5078 2002-05-08  Ravi Pratap  <ravi@ximian.com>
5079
5080         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
5081         applicable operators was not being considered correctly. This closes
5082         the bug Miguel reported.
5083
5084 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
5085
5086         * attribute.cs: check that the type derives from System.Attribute
5087         and report the correct error in that case (moved the duplicate code to
5088         its own method, too).
5089
5090 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
5091
5092         * attribute.cs: lookup attribute type name as the spec says: first the
5093         bare attribute name and then name + "Attribute" (nant compiles with
5094         mcs after this fix).
5095
5096 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
5097
5098         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
5099         Because of the way we parse things, we should try to see if a
5100         UIntConstant can fit in an integer.
5101
5102 2002-05-07  Ravi Pratap  <ravi@ximian.com>
5103
5104         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
5105         when we are in an explicit context.
5106
5107         (ConvertReferenceExplicit): When converting from Iface type S to Class
5108         T make sure the rules are implemented as an OR.
5109
5110         * parameter.cs (ParameterType): Make it a property for now although the
5111         purpose really isn't anything immediate.
5112         
5113         * expression.cs (Is*Applicable): Do better checking on the parameter type
5114         of a ref/out parameter. The ones from the system assemblies are already 
5115         marked with the correct type so we don't need to do any correction.
5116
5117         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
5118         the object type is standard too so include that.
5119
5120 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5121
5122         * ecore.cs (StandardConversionExists): Augment with missing code:
5123         deal with IntConstant, LongConstants and Enumerations.
5124
5125         * assign.cs: Report the error, instead of failing silently
5126
5127         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
5128         typecontainer that they are declared, because the
5129         typecontainer/namespace will have the list of using clauses that
5130         need to be applied.
5131
5132         Assembly Attributes were escaping the normal registration
5133         mechanism. 
5134
5135         (EmitCode): Apply attributes within an EmitContext that represents
5136         the container they were declared on.
5137         
5138         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
5139
5140 2002-05-06  Ravi Pratap  <ravi@ximian.com>
5141
5142         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
5143         Revamp completely - make much cleaner as we now operate only
5144         on a set of Types.
5145
5146         (FindMostSpecificSource, FindMostSpecificTarget): New methods
5147         to implement the logic detailed in the spec more correctly.
5148
5149         (UserDefinedConversion): Update accordingly.
5150
5151 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5152
5153         * statement.cs: Return flow analysis information up.
5154
5155         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
5156         and the default.
5157
5158         (token): Do not consume an extra character before calling
5159         decimal_digits.
5160
5161 2002-05-06  Piers Haken <piersh@friskit.com>
5162
5163         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
5164
5165 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5166
5167         * class.cs (Constructor.Emit): Set the IsStatic flag in the
5168         EmitContext during the instance constructor initializer
5169         resolution, to stop access to instance variables.
5170
5171         This is mandated by the spec, last paragraph of the `constructor
5172         initializers' section. 
5173
5174 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
5175
5176         * cs-parser.jay, class.cs (Accessor): new class used to represent
5177         an accessor (get or set).  In the past we used `null' to represent
5178         a missing accessor.  But this is ambiguous because there was no
5179         way to tell in abstract indexers/properties if one of them was
5180         specified.
5181
5182         Now there is a way of addressing that.
5183
5184         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
5185         instead of FindMembers.
5186
5187         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
5188         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
5189
5190         * attribute.cs: Treat indexers and properties as the same in terms
5191         of applying attributes
5192
5193         * ecore.cs (FindMostEncompassedType): Use statically initialized
5194         EmptyExpressions()s like we do elsewhere to avoid creating useless
5195         objects (and we take this out of the tight loop).
5196
5197         (GetConversionOperators): Move the code to extract the actual
5198         operators to a separate routine to clean things up.
5199
5200 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
5201
5202         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
5203         events are always registered FieldBuilders.
5204         
5205         * class.cs (FieldBase): New class shared by Fields 
5206
5207         * delegate.cs: If we are a toplevel delegate, use our full name.
5208         If we are a nested delegate, then only use our tail name.
5209
5210 2002-05-02  Ravi Pratap  <ravi@ximian.com>
5211
5212         * expression.cs (IsApplicable): Ensure that we add the "&" to
5213         ref/out types before comparing it with the type of the argument.
5214
5215         (IsParamsMethodApplicable): Ditto.
5216
5217         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
5218         silly me ;-)
5219
5220         * delegate.cs : Handle the case when we have more than one applicable
5221         method. Flag an error only when we finish checking all.
5222
5223 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
5224
5225         * expression.cs: Add support for boolean static initializers.
5226
5227 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
5228
5229         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
5230
5231         * parameter.cs (ComputeParameterTypes,
5232         ComputeAndDefineParameterTypes): Better error handling: now we
5233         clear the `types' cache if we fail during any of the type lookups.
5234         We also return the status code correctly to our caller
5235
5236         * delegate.cs: If we fail to define a delegate, abort the extra
5237         steps. 
5238
5239         * expression.cs (Binary.ResolveOperator): for
5240         operator==(object,object) and operator !=(object, object) we also
5241         have to verify that there is an implicit conversion from one to
5242         the other.
5243
5244         (ArrayAccess.DoResolve): Array Access can operate on
5245         non-variables. 
5246
5247 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
5248
5249         * assign.cs (CompoundAssign): A new class used as a "flag" that
5250         the assignment actually is happening as part of a compound
5251         assignment operator.
5252
5253         During compound assignment, a few new rules exist to enable things
5254         like:
5255
5256         byte b |= 1 + 2
5257
5258         From the spec:
5259         
5260         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
5261         to the type of x) if y is implicitly convertible to the type of x,
5262         and the operator is a builtin operator and the return type of the
5263         operator is explicitly convertible to the type of x. 
5264
5265         * rootcontext.cs: Reset warning level to 2.  4 catches various
5266         "interesting" features in mcs, we must clean this up at some
5267         point, but currently am trying to kill other bugs ;-)
5268
5269         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
5270         in container classes as well.  
5271
5272         * expression.cs (Binary.ResolveOperator): Handle string case
5273         before anything else (as operator overloading does emit an error
5274         before doing anything else).
5275
5276         This code could go away when we move to a table driven model, but
5277         i could not come up with a good plan last night.
5278         
5279 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
5280
5281         * typemanager.cs (CSharpName): reimplementation using regex.
5282         * class.cs: added null check for fields in Emit
5283         * rootcontext.cs: set warninglevel to 4
5284
5285 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
5286
5287         * typemanager.cs (CSharpName): reimplemented with Lupus
5288         suggestion.
5289
5290 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
5291
5292         * statement.cs (If): correclty implement Resolve, because we were
5293         not catching sem errors in there.  The same process is needed
5294         everywhere else. 
5295         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
5296         
5297
5298         (Statement.Warning_DeadCodeFound): Factorize code.
5299         (While): Report dead code here too.
5300
5301         (Statement): Added Resolve virtual method to allow
5302         for resolution split from the emit code.
5303
5304 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
5305
5306         * statement.cs (EmitBoolExpression): No longer try to resolve the
5307         expression here.    
5308         (MakeBoolean): New utility function that resolve, implicitly
5309         converts to boolean and tags the expression. 
5310         
5311
5312         (If, Do): Implement dead code elimination.
5313         (While): Implement loop inversion
5314
5315         (Do, While, For, If): Resolve the expression prior to calling our
5316         code generation.
5317
5318 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
5319
5320         * class.cs:
5321           - added method Report28 (warning: program has more than one entry point)
5322           - added method IsEntryPoint, implements paragraph 10.1 of the spec
5323           - modified method Method.Define, the part at the end of the method
5324
5325         * rootcontext.cs: added static public Location EntryPointLocation;
5326           
5327         * ../errors/cs0028.cs : Add test case for the above warning.              
5328
5329         * typemanager.cs:
5330           - modified method CSharpName to allow arrays of primitive type to
5331             be printed nicely (e.g. instead of System.Int32[][] it now prints
5332             int[][])
5333           - added method CSharpSignature: returns the signature of a method
5334             in string format to be used in reporting errors, warnings, etc.
5335
5336         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
5337         with String.Empty.
5338         
5339 2002-04-26  Ravi Pratap  <ravi@ximian.com>
5340
5341         * delegate.cs (Define): Fix extremely silly bug where I was
5342         setting the type of the 'object' parameter of the BeginInvoke
5343         method to System.IAsyncResult instead of System.Object ;-)
5344
5345 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
5346
5347         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
5348         here. 
5349
5350         (Constructor.Emit): return if we fail to initialize the
5351         constructor.  Another door closed!  
5352
5353         * expression.cs (New.DoResolve): Improve error message (from -6 to
5354         1501).  Use DeclaredOnly lookup to find the exact constructor.
5355
5356         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
5357         loop.  This is useful.
5358
5359         * cs-parser.jay: Adjust the default parameters so that destructors
5360         have the proper signature.
5361
5362 2002-04-26  Martin Baulig  <martin@gnome.org>
5363
5364         * driver.cs (LoadAssembly): If `assembly' contains any characters
5365         which are only valid in path names and not in assembly names
5366         (currently slash, backslash and point), use Assembly.LoadFrom ()
5367         instead of Assembly.Load () on the `assembly' (before iteration
5368         over the link_paths).
5369
5370 2002-04-26  Martin Baulig  <martin@gnome.org>
5371
5372         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
5373
5374 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
5375
5376         * class.cs (Property): use the new typemanager.MemberLookup
5377
5378         (TypeContainer.MemberLookup): Implement using the
5379         TypeManager.MemberLookup now. 
5380         
5381         * typemanager.cs: Make MemberLookup a function of the TypeManager,
5382         and return MemberInfos, so that these can be used without an
5383         EmitContext (what we had before).
5384
5385 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
5386
5387         * expression.cs: Fix the case where the argument to params if the
5388         type of the params.  I omitted handling this before.   Fixed
5389
5390 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
5391
5392         * driver.cs: Call BootCorlib_PopulateCoreType
5393
5394         * class.cs (Property.CheckBase): Check for properties only, not
5395         for all members. 
5396
5397         * interface.cs: Temporary hack: try/catch around the
5398         CustomAttributeBuilder, because I am getting an exception that I
5399         do not understand.
5400
5401         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
5402         types whose definitions are required to be there (attributes are
5403         defined before standard types).
5404
5405         Compute definitions as we boot the various types, as they are used
5406         immediately (value_type class will need object_type, but if we do
5407         not initialize object_type, we will pass a null, which will let
5408         the runtime pick the System.Object from the existing corlib, which
5409         is not what we want).
5410
5411 2002-04-22  Patrik Torstensson <totte@labs2.com>
5412
5413         * cs-tokenizer.cs: fixed a number of trim() issues.
5414
5415 2002-04-22  Ravi Pratap  <ravi@ximian.com>
5416
5417         * expression.cs (Argument.Type): Ensure that we return the correct
5418         type when we have out or ref parameters [in which case we 
5419         append a "&"].
5420         
5421 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
5422
5423         * class.cs (Property, Indexer): Allow extern modifier in there. 
5424
5425         * typemanager.cs (InitBaseTypes): Initializes object_type and
5426         value_type, since those will be used early on during the bootstrap
5427         process to compile corlib.
5428
5429         (InitCoreTypes): Move code from here to InitBaseTypes.
5430
5431 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
5432
5433         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
5434         single-dimension arrays as using the ldlen opcode.  
5435
5436         Daniel Lewis discovered this optimization.  
5437
5438         * typemanager.cs: Add signature for System.Array::get_Length
5439
5440 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5441
5442         * statement.cs: report the error when the foreach does not apply to an
5443         array nor a collection.
5444
5445 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
5446
5447         * expression.cs: Add implicit conversions to the operator ~.
5448
5449         * constant.cs (DecimalConstant.Emit): Emit decimal value.
5450
5451         * typemanager.cs: Locate the decimal constructor.
5452
5453 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5454
5455         * attribute.cs: use the new property of TypeOf.
5456         * expression.cs: added 'get' property around typearg.
5457
5458         These changes fix a build breaker reported by NickD. Is this the
5459         correct way to fix?  If not, please, revert my changes and make it
5460         work :-).
5461
5462 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
5463
5464         * attribute.cs: Add support for typeof in attribute invocations.
5465         I am not sure that this is right though.
5466
5467 2002-04-14  Duncan Mak  <duncan@ximian.com>
5468
5469         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
5470         Binary.Operator.Division case.
5471
5472 2002-04-13  Ravi Pratap  <ravi@ximian.com>
5473
5474         * class.cs (DefineType): Ensure that we do a proper check on
5475         attribute types and also register it with the TypeManager.
5476
5477         (TypeContainer.Targets): The default for attribute types is
5478         AttributeTargets.All.
5479         
5480         * attribute.cs (ApplyAttributes): Registering the attribute type
5481         is done elsewhere, not when we discover we have a Usage attribute.
5482
5483 2002-04-12  Ravi Pratap  <ravi@ximian.com>
5484
5485         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
5486         and get rid of is_delegate parameter.
5487
5488         * everywhere : update.
5489         
5490 2002-04-12  Ravi Pratap  <ravi@ximian.com>
5491
5492         * cs-parser.jay (compilation_unit): Revamp completely to use
5493         some new ideas that I got from Rhys' grammar to solve the problems
5494         with assembly level attributes.
5495
5496         (outer_declaration): New grammar production.
5497
5498         (attribute_sections): Add.
5499
5500         (opt_attributes): Base on attribute_sections
5501
5502         (namespace_declaration): Allow opt_attributes to tackle the case
5503         when we have assembly level attributes - we are clever in this
5504         regard now ;-)
5505
5506         * attribute.cs (ApplyAttributes): Do not worry about assembly 
5507         attributes in the non-global context.
5508
5509         * rootcontext.cs (AddGlobalAttributes): Go back to using this
5510         instead of SetGlobalAttributes.
5511
5512         * class.cs, rootcontext.cs : Ensure we define and generate 
5513         attribute types before anything else.
5514
5515         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
5516         and flag the new error -20 for the case when the attribute type
5517         does not have valid targets specified. csc does not catch this.
5518
5519         * ../errors/errors.txt : update for error # -20
5520
5521 2002-04-11  Ravi Pratap  <ravi@ximian.com>
5522
5523         * support.cs (InternalParameters.ParameterModifier): Do some null
5524         checking and return sane values.
5525
5526         * class.cs (Method.Define): If we are a PInvoke method, ensure
5527         that we are static and extern. Report error # 601
5528
5529         * ../errors/cs0601.cs : Add test case for the above error.
5530
5531 2002-04-07  Ravi Pratap  <ravi@ximian.com>
5532
5533         * rootcontext.cs (attribute_types): We need to keep type of
5534         all attribute types separately and emit code for them first.
5535
5536         (RegisterAttribute) : Implement.
5537
5538         * class.cs (DefineType): Check if the current Type is a custom
5539         attribute type and register it accordingly.
5540
5541         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
5542         adding the first attribute twice and rename to
5543
5544         (SetGlobalAttributes): this.
5545
5546         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
5547         lookups.
5548
5549         * attribute.cs (ApplyAttributes): Take an additional argument telling us
5550         if we are processing global arguments. Hmm, I am unsure of this.
5551
5552 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5553
5554         * expression.cs: added static array of strings to avoid calling
5555         Enum.ToString () for Operator in Binary. Significant recover of
5556         performance.
5557
5558 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
5559
5560         * class.cs (FindMembers): Allow the Builders of the various
5561         members to be null.  If they are skip them.  This only happens
5562         during the PInvoke declaration.
5563
5564 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
5565
5566         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
5567         failure, so we do not keep going afterwards.
5568
5569         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
5570         wanted to pass `false' as the `is_delegate' argument.  If this is
5571         the case, why not use delegate_type == null to mean `is_delegate =
5572         false' and anything else as is_delegate = true.
5573
5574 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
5575
5576         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
5577         code for the section, not the beginning of the tests.
5578
5579 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
5580
5581         * cfold.cs: Handle operator + (Enum x, Underlying x) 
5582
5583         * expression.cs (Binary): same.  Warn about errors where we have
5584         Enum/Enum in operator + as well.
5585
5586 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
5587
5588         * statement.cs:
5589                 - added support for switch(bool)
5590                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
5591                 - add TableSwitchEmit() to handle table-based switch statements
5592
5593 2002-04-05  Ravi Pratap  <ravi@ximian.com>
5594
5595         * expression.cs (Invocation.OverloadResolve): Factor out code which
5596         does parameter compatibility checking with arguments so that we can 
5597         re-use the code even from Delegate.VerifyApplicability
5598
5599         (VerifyArgumentsCompat): Move above code here.
5600
5601         * delegate.cs (VerifyApplicability): Get rid of duplicate code
5602         and instead make a call to the above method.
5603
5604 2002-03-31  Ravi Pratap  <ravi@ximian.com>
5605
5606         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
5607         We use it to keep track of classes which are attribute types.
5608
5609 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
5610
5611         * delegate.cs (Delegate.Define): Correctly define the types in the
5612         presence of fixed and array parameters.
5613
5614         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
5615         doing FindMembers.
5616
5617         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
5618         include NonPublic after the first iteration.
5619
5620         * class.cs (Indexer.CheckBase): Only check if both parents are
5621         non-null. 
5622         
5623         * cs-parser.jay (accessor_body): If empty, set to null.
5624
5625         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
5626         same code path here to resolve constants names that we did have in
5627         MemberAccess.DoResolve.  There is too much code duplicated here.
5628
5629 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
5630
5631         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
5632
5633         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
5634         to MakeUnionSet.
5635
5636         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
5637         tokens, numbers and strings.
5638
5639         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
5640         parenthesis.
5641
5642         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
5643         asyncronous parameters and the regular parameters.  
5644
5645         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
5646         specify the target directory.
5647
5648         * expression.cs: (This.DoResolve): Simplify
5649         (As.Emit): Optimize, do not generate IsInst if the expression is
5650         always of the given type.
5651
5652         (Is.DoResolve): Bug fix, we were reporting both always/never for
5653         the is expression.
5654
5655         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
5656         creating too many unnecessary arrays.
5657
5658 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
5659
5660         * class.cs (EmitFieldInitializer): Use Assign expression to assign
5661         fields instead of rolling our own initializer.   Takes care of all
5662         implicit conversions, and drops unnecessary static checks/argument.
5663
5664 2002-03-31  Dick Porter  <dick@ximian.com>
5665
5666         * driver.cs: use the GetDirectories() return values properly, and
5667         use "/" as path separator.
5668
5669 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
5670
5671         * expression.cs (Unary): Optimize - - expr into expr.
5672         (Binary): Optimize a + (-b) into a -b.
5673
5674         * codegen.cs (CodeGen): Made all methods static.
5675
5676 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
5677
5678         * rootcontext.cs: 
5679
5680         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
5681         TypeBuilder property.
5682
5683         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
5684         instead. 
5685
5686         * tree.cs: Removed the various RecordXXXX, and replaced with a
5687         single RecordDecl.  Removed all the accessor methods, and just
5688         left a single access point Type 
5689
5690         * enum.cs: Rename DefineEnum to DefineType.
5691
5692         * decl.cs: New abstract method `DefineType' used to unify the
5693         Defines for Enumerations, Interfaces, TypeContainers and
5694         Delegates.
5695
5696         (FindType): Moved LookupInterfaceOrClass here.  Moved the
5697         LookupBaseClasses method that used to live in class.cs and
5698         interface.cs here, and renamed to FindType.
5699         
5700         * delegate.cs: Implement DefineType.  Take advantage of the
5701         refactored pattern for locating the parent builder without taking
5702         the parent_builder argument (which we know does not work if we are
5703         nested, and triggering a toplevel definition).
5704
5705 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
5706
5707         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
5708         accessibility of a member has changed during override and report
5709         an error if so.
5710
5711         * class.cs (Method.Define, Property.Define): Only complain on
5712         overrides if the method is private, any other accessibility is
5713         fine (and since we just checked the permission is the same, we are
5714         good to go).
5715
5716         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
5717         and elif are processed always.  The other pre-processing
5718         directives are only processed if we are "taking" the path
5719
5720 2002-03-29  Martin Baulig  <martin@gnome.org>
5721
5722         * class.cs (Method.Emit): Only emit symbolic debugging info if the
5723         current location is not Null.
5724
5725         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
5726         a separate method so we can profile it.
5727
5728         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
5729         `span.Seconds' are just seconds, but no minutes or hours.
5730         (MainDriver): Profile the CodeGen.SaveSymbols calls.
5731
5732 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
5733
5734         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
5735         Remove the gratuitous set of Final:
5736
5737                                 // If an interface implementation, then we can set Final.
5738                                 if (((flags & MethodAttributes.Abstract) == 0) &&
5739                                     implementing.DeclaringType.IsInterface)
5740                                         flags |= MethodAttributes.Final;
5741
5742         I do not know what I was smoking when I used that.
5743         
5744
5745         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
5746         step into fixing the name resolution issues for delegates and
5747         unifying the toplevel name resolution.
5748
5749 2002-03-28  Martin Baulig  <martin@gnome.org>
5750
5751         * class.cs (Method.Emit): If we have a symbol writer, call its
5752         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
5753         tell it about the current method.
5754
5755         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
5756         writer that we're going to emit the first byte of IL code for a new
5757         statement (a new source line).
5758         (EmitContext.EmitTopBlock): If we have a symbol writer, call
5759         EmitContext.Mark() before emitting any code.
5760
5761         * location.cs (SymbolDocument): Return null when we're Null.
5762
5763         * statement.cs (Statement): Moved the `Location loc' variable here.
5764         (Statement.EmitBoolExpression): If we have a symbol writer, call
5765         ec.Mark() before emitting any code to tell it that we're at the
5766         beginning of a new statement.
5767         (StatementExpression): Added `Location' argument to the constructor.
5768         (Block): Added public readonly variable `StartLocation' and public
5769         variable `EndLocation'.  The latter is to be set using SetEndLocation().
5770         (Block): Added constructor which takes a start and end location.
5771         (Block.SetEndLocation): New method. This sets the end location.
5772         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
5773         local variables we create.
5774         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
5775         each statement and do also mark the begin and end of the block.
5776
5777         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
5778         tell it the current lexer.Location, use Location.Null for the end of the
5779         block.
5780         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
5781         current block, set its end location using SetEndLocation().
5782         (statement_expression): StatementExpression constructor now takes the
5783         lexer.Location as additional argument.
5784         (for_statement, declare_local_variables): Likewise.
5785         (declare_local_variables): When creating a new implicit block, use the
5786         new Block constructor and pass it the lexer.Location.
5787
5788 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
5789
5790         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
5791         members also on the parent interfaces recursively.
5792
5793 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
5794
5795         * report.cs: Use new formats, since Gonzalo finished the missing
5796         bits. 
5797
5798         * expression.cs (Binary.ResolveOperator): added missing operator|
5799         operator& and operator^ for bool/bool.
5800
5801         * cs-parser.jay: CheckDef now takes a Location argument that is
5802         used to report errors more precisly (instead of reporting the end
5803         of a definition, we try to track something which is a lot closer
5804         to the source of the problem).
5805
5806         * cs-tokenizer.cs: Track global token use, so we can properly flag
5807         the use of #define/#undef after the first token has been seen.
5808
5809         Also, rename the reportXXXX to Error_DescriptiveName
5810
5811         * decl.cs (DeclSpace.IsTopLevel): Move property here from
5812         TypeContainer, so that Enum and Interface can use this too.
5813
5814         * class.cs (TypeContainer.LookupInterfaceOrClass,
5815         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
5816         `builder' argument.  Typically this was used to pass the parent
5817         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
5818         the definition).  
5819
5820         The problem is that a nested class could trigger the definition of
5821         a toplevel class, and the builder would be obviously wrong in that
5822         case. 
5823
5824         So we drop this argument, and we compute dynamically the
5825         TypeBuilder/ModuleBuilder (the correct information was available
5826         to us anyways from DeclSpace.Parent)
5827
5828         * interface.cs (Interface.DefineInterface): Drop builder
5829         parameter cleanup like class.cs
5830
5831         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
5832         like class.cs
5833
5834         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
5835         values. 
5836
5837         (Try.Emit): Propagate the returns value from the statement.
5838
5839         (Return.Emit): Even if we are leavning 
5840
5841         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
5842
5843         * modifiers.cs: Fix the computation of MethodAttributes flags.
5844
5845 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
5846
5847         * driver.cs: allow compilation of files that start with '/'.
5848         Add a default case when checking the argument of --target.
5849
5850 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
5851
5852         * interface.cs: Implement the same search algorithm for types in
5853         the interface code.
5854
5855         * delegate.cs: Do not allow multiple definition.
5856
5857         * Recovered ChangeLog that got accidentally amputated
5858
5859         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
5860
5861         * rootcontext.cs: Load manually enum to allow core classes to
5862         contain enumerations.
5863
5864         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
5865         Update to new static methods in TypeManager.
5866
5867         * typemanager.cs (GetMethod, GetConstructor): Use our
5868         implementation of FindMembers to find the members, since during
5869         corlib compilation, the types are TypeBuilders and GetMethod and
5870         GetConstructor do not work.
5871
5872         Make all methods in TypeManager static.
5873
5874         (InitCodeHelpers): Split the functionality from
5875         the InitCodeTypes function.
5876
5877         * driver.cs: Call InitCodeHelpers after we have populated the
5878         types. 
5879
5880         * cs-parser.jay (delegate_declaration): we did not used to compute
5881         the delegate name correctly for void delegates.
5882
5883 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
5884
5885         * rootcontext.cs (RootContext): Init the interface_resolve_order
5886         and type_container_resolve_order always.
5887
5888         (ResolveCore, BootstrapCorlib_ResolveClass,
5889         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
5890         compiler when compiling with --nostdlib
5891
5892         * class.cs (TypeContainer.DefineType): Check that our parent is
5893         not null.  This test is most important when we are bootstraping
5894         the core types.
5895
5896         * codegen.cs: Split out the symbol writing code.
5897
5898 2002-03-25  Martin Baulig  <martin@gnome.org>
5899
5900         * driver.cs (-g): Made -g an alias for --debug.
5901
5902 2002-03-24  Martin Baulig  <martin@gnome.org>
5903
5904         * codegen.cs (SymbolWriter): New public variable. Returns the
5905         current symbol writer.
5906         (CodeGen): Added `bool want_debugging_support' argument to the
5907          constructor. If true, tell the ModuleBuild that we want debugging
5908         support and ask it for the ISymbolWriter.
5909         (Save): If we have a symbol writer, call it's Close() method after
5910         saving the assembly.
5911
5912         * driver.c (--debug): New command line argument to create a
5913         debugger information file.
5914
5915         * location.cs (SymbolDocument): New public property. Returns an
5916         ISymbolDocumentWriter object for the current source file or null
5917         if we don't have a symbol writer.
5918
5919 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
5920
5921         * driver.cs (LoadAssembly): Correctly return when all the paths
5922         have been tried and not before.
5923
5924         * statement.cs (Switch.Emit): return the actual coverage for this
5925         statement (returns/not-returns)
5926
5927         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
5928         switch of the statement if we are the last switch section.  That
5929         kills two problems: try/catch problems (we used to emit an empty
5930         nop at the end) and switch statements where all branches would
5931         return. 
5932
5933 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
5934
5935         * driver.cs: Add default assemblies (the equivalent to the
5936         Microsoft CSC.RSP file)
5937
5938         * cs-tokenizer.cs: When updating `cols and setting it to zero,
5939         also update tokens_seen and set it to false.
5940
5941         * driver.cs: Implement --recurse for Mike.
5942
5943         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
5944         correctly splitting out the paths.
5945
5946 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
5947
5948         * interface.cs (Interface.PopulateProperty): Instead of using
5949         `parent' as the declaration space for the set parameters, use
5950         `this' 
5951
5952         * support.cs (InternalParameters): InternalParameters constructor
5953         takes a DeclSpace instead of a TypeContainer.
5954
5955         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
5956         types are being initialized, load the address of it before calling
5957         the function.  
5958
5959         (New): Provide a mechanism to disable the generation of local
5960         value type temporaries when the caller will be providing us with
5961         an address to store it.
5962
5963         (ArrayCreation.EmitDynamicInitializers): Use it.
5964
5965 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
5966
5967         * expression.cs (Invocation.EmitArguments): Only probe for array
5968         property if there is more than one argument.  Sorry about that.
5969
5970         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
5971         empty param arrays.
5972         
5973         * class.cs (Method.LabelParameters): Fix incorrect code path that
5974         prevented the `ParamArrayAttribute' from being applied to the
5975         params attribute.
5976
5977 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
5978
5979         * support.cs (ReflectionParameters): Correctly compute whether the
5980         last argument is a params array.  Fixes the problem with
5981         string.Split ('a')
5982
5983         * typemanager.cs: Make the assemblies array always be non-null
5984         (empty, but non-null)
5985
5986         * tree.cs (RecordDecl): New function that abstracts the recording
5987         of names.  This reports error 101, and provides a pointer to the
5988         previous declaration.  Fixes a crash in the compiler.
5989
5990         * cs-parser.jay (constructor_declaration): Update to new grammar,
5991         and provide a constructor_body that can be empty.
5992
5993 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
5994
5995         * driver.cs: Add support for --resources.
5996
5997         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
5998         Make all types for the various array helper methods be integer.
5999
6000         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
6001         CheckState to ConvCast.
6002
6003         (ConvCast): Now it takes a `checked' state argument, to avoid
6004         depending on the emit context for the conversion, and just using
6005         the resolve time setting.
6006
6007         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
6008         instead of Invocation.EmitArguments.  We do not emit the original
6009         arguments, instead we emit those which have been converted to
6010         unsigned int expressions.
6011
6012         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
6013
6014         * codegen.cs: ditto.
6015
6016         * expression.cs (LocalVariableReference): Drop the use of the
6017         Store function that depended on the variable index.
6018
6019         * statement.cs (VariableInfo): Drop the `Idx' property from this
6020         class, as this is not taking into account the indexes for
6021         temporaries tat we generate during the execution, getting the
6022         indexes wrong.
6023
6024         * class.cs: First emit class initializers, then call the parent
6025         constructor. 
6026
6027         * expression.cs (Binary): Fix opcode emision.
6028         (UnaryMutator.EmitCode): Support checked code generation
6029
6030         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
6031         matches for events for both the Static and Instance scans,
6032         pointing to the same element.   Fix that.
6033
6034 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
6035
6036         * rootcontext.cs (ResolveTree): Always set the
6037         interface_resolve_order, because nested interfaces will be calling
6038         into us.
6039
6040         * class.cs (GetInterfaceOrClass): Track the same resolution
6041         process used by TypeManager.LookupType.  This fixes the nested
6042         type lookups in class declarations (separate path from
6043         LookupType). 
6044
6045         (TypeContainer.DefineType): Also define nested interfaces.
6046         (TypeContainer.RegisterOrder): New public function used to
6047         register the order in which child interfaces need to be closed.
6048
6049         Nested interfaces need to be closed after their parents have been
6050         created. 
6051         
6052         * interface.cs (InterfaceAttr): Put all the logic for computing
6053         the interface attribute here. 
6054
6055         (DefineInterface): Register our interface order with the
6056         RootContext or with the TypeContainer depending on the case.
6057
6058 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
6059
6060         * cs-parser.jay: rework foreach statement to work with the new
6061         changes to the policy on SimpleNames.
6062         
6063         * report.cs: support Stacktrace on warnings as well.
6064
6065         * makefile: drop --unsafe and /unsafe from the compile.
6066
6067 2002-03-13  Ravi Pratap  <ravi@ximian.com>
6068
6069         * ecore.cs (StandardConversionExists): Modify to take an Expression
6070         as the first parameter. Ensure we do null -> reference type conversion
6071         checking.
6072
6073         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
6074         temporary Expression objects.
6075
6076 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
6077
6078         * interface.cs: workaround bug in method overloading resolution
6079         (there is already a bugzilla bug for it).
6080
6081 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
6082
6083         We could also solve this problem by having a separate path for
6084         performing type lookups, instead of DoResolve, we could have a
6085         ResolveType entry point, and only participating pieces of the
6086         production (simplename, deref, array) would implement this. 
6087         
6088         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
6089         signal SimpleName to only resolve type names and not attempt to
6090         resolve anything else.
6091
6092         * expression.cs (Cast): Set the flag.
6093
6094         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
6095
6096         * class.cs: Only report 108 if there is no `new' modifier.
6097
6098         * cs-parser.jay: rework foreach statement to work with the new
6099         changes to the policy on SimpleNames.
6100         
6101         * report.cs: support Stacktrace on warnings as well.
6102
6103         * makefile: drop --unsafe and /unsafe from the compile.
6104
6105 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
6106
6107         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6108         lookups here, instead of doing that at parse time.  This means
6109         that our grammar will not introduce `LocalVariableReferences' as
6110         expressions at this point.  That solves the problem of code like
6111         this:
6112
6113         class X {
6114            static void Main ()
6115            { int X = 1;
6116             { X x = null }}}
6117
6118         This is only half the fix.  The full fix requires parameters to
6119         also be handled in this way.
6120
6121         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
6122         makes the use more obvious of the DeclSpace.  The
6123         ec.TypeContainer.TypeBuilder is now only used to pull the
6124         TypeBuilder for it.
6125
6126         My theory is that I can get rid of the TypeBuilder completely from
6127         the EmitContext, and have typecasts where it is used (from
6128         DeclSpace to where it matters).  
6129
6130         The only pending problem is that the code that implements Aliases
6131         is on TypeContainer, and probably should go in DeclSpace.
6132
6133         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6134         lookups here, instead of doing that at parse time.  This means
6135         that our grammar will not introduce `LocalVariableReferences' as
6136         expressions at this point.  That solves the problem of code like
6137         this:
6138
6139         class X {
6140            static void Main ()
6141            { int X = 1;
6142             { X x = null }}}
6143
6144         This is only half the fix.  The full fix requires parameters to
6145         also be handled in this way.
6146
6147         * class.cs (Property.DefineMethod): When implementing an interface
6148         method, set newslot, when implementing an abstract method, do not
6149         set the flag (before we tried never setting it, or always setting
6150         it, which is the difference).
6151         (Indexer.DefineMethod): same.
6152         (Method.DefineMethod): same.
6153
6154         * ecore.cs: Only set the status used flag if we get back a Field.
6155
6156         * attribute.cs: Temporary hack, so Paolo can keep working.
6157
6158 2002-03-08  Ravi Pratap  <ravi@ximian.com>
6159
6160         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
6161         the unmanaged type in the case we have a MarshalAs attribute.
6162
6163         (Resolve): Handle the case when we are parsing the special MarshalAs
6164         attribute [we need to store the unmanaged type to use later]
6165         
6166         * typemanager.cs (marshal_as_attr_type): Built in type for the 
6167         MarshalAs Attribute.
6168
6169         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
6170         on parameters and accordingly set the marshalling info.
6171         
6172 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
6173
6174         * class.cs: Optimizing slightly by removing redundant code after
6175         we switched to the `NoTypes' return value.
6176         (Property.DefineMethod): use NoTypes here too.
6177
6178         This fixes the bug I introduced in my last batch of changes.
6179
6180 2002-03-05  Ravi Pratap  <ravi@ximian.com>
6181
6182         * tree.cs (RecordEnum): Add. We now keep track of enums too.
6183
6184         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
6185         Enums since those are types too. 
6186
6187         * cs-parser.jay (enum_declaration): Record enums as we parse them.
6188         
6189         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
6190         thanks to a call during the lookup process.
6191
6192 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
6193
6194         * statement.cs (Foreach): Lots of work to accomodate a particular
6195         kind of foreach statement that I had not kept in mind.  It is
6196         possible to have foreachs on classes that provide a GetEnumerator
6197         method that return objects that implement the "pattern" for using
6198         a foreach, there is no need to support GetEnumerator
6199         specifically. 
6200
6201         This is needed to compile nant.
6202
6203         * decl.cs: Only report 114 if the member is not `Finalize' and if
6204         the warning level is at least 2.
6205
6206         * class.cs: Moved the compare function from Method to
6207         MethodSignature. 
6208
6209         (MethodSignature.InheritableMemberSignatureCompare): Add new
6210         filter function that is used to extract inheritable methods from a
6211         class. 
6212
6213         (Method.Define): Use the new `inheritable_method_signature_filter'
6214         delegate
6215
6216         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
6217         command. 
6218
6219 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
6220
6221         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
6222
6223         * cs-parser.jay: Add opt_semicolon to the interface declaration.
6224
6225         * expression.cs: Pass location information to
6226         ConvertImplicitStandard. 
6227
6228         * class.cs: Added debugging code to track return values from
6229         interfaces. 
6230
6231 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
6232
6233         * expression.cs (Is.DoResolve): If either side of the `is' is an
6234         interface, do not flag the warning.
6235
6236         * ecore.cs (ImplicitReferenceConversion): We need a separate test
6237         for interfaces
6238
6239         * report.cs: Allow for --fatal to be used with --probe.
6240         
6241         * typemanager.cs (NoTypes): Move the definition for the empty Type
6242         array here. 
6243
6244         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
6245         properties. 
6246         (TypeContainer.DefineProxy): New function used to proxy to parent
6247         implementations when implementing interfaces.
6248         (TypeContainer.ParentImplements): used to lookup if our parent
6249         implements a public function that is required by an interface.
6250         (TypeContainer.VerifyPendingMethods): Hook this up.
6251
6252         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
6253         `modules' and `assemblies' arraylists into arrays.  We only grow
6254         these are the very early start up of the program, so this improves
6255         the speedof LookupType (nicely measured).
6256
6257         * expression.cs (MakeByteBlob): Replaced unsafe code with
6258         BitConverter, as suggested by Paolo.
6259
6260         * cfold.cs (ConstantFold.Binary): Special case: perform constant
6261         folding of string concatenation, but if either side is a string,
6262         and the other is not, then return null, and let the runtime use
6263         the concatenation on the string plus the object (using
6264         `Object.ToString'). 
6265
6266 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
6267
6268         Constant Folding has been implemented now.
6269         
6270         * expression.cs (Unary.Reduce): Do not throw an exception, catch
6271         the error instead on types that are not supported in one's
6272         complement. 
6273
6274         * constant.cs (Constant and all children): New set of functions to
6275         perform implict and explicit conversions.
6276         
6277         * ecore.cs (EnumConstant): Implement the new functions to perform
6278         conversion by proxying to the child expression.
6279
6280         * codegen.cs: (ConstantCheckState): Constant evaluation has its
6281         own separate setting that can not be turned off from the command
6282         line using --unchecked or --checked and is only controlled using
6283         the checked/unchecked statements and expressions.  This setting is
6284         used by the constant folder to flag errors.
6285
6286         * expression.cs (CheckedExpr, UncheckedExpr): Set the
6287         ConstantCheckState as well.   
6288
6289         During Resolve, they also have to flag the state, because the
6290         constant folder runs completely in the Resolve phase.
6291
6292         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
6293         well.
6294
6295 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
6296
6297         * cfold.cs: New file, this file contains the constant folder.
6298         
6299         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
6300         argument to track whether we are using the resulting address to
6301         load or store a value and provide better error messages. 
6302
6303         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
6304         new AddressOf arguments.
6305
6306         * statement.cs (Foreach.EmitCollectionForeach): Update
6307
6308         * expression.cs (Argument.Emit): Call AddressOf with proper
6309         arguments to track usage.
6310
6311         (New.DoEmit): Call AddressOf with new arguments.
6312
6313         (Unary.Emit): Adjust AddressOf call.
6314
6315 2002-03-01  Ravi Pratap  <ravi@ximian.com>
6316
6317         * cs-parser.jay (member_access): Change the case for pre-defined types
6318         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
6319         this suggestion.
6320
6321         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
6322         a method body.
6323
6324         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
6325         essentially like methods and apply attributes like MethodImplOptions to them too.
6326
6327         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
6328         not being null.
6329
6330         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
6331         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
6332         is the DeclSpace.
6333
6334         * Update code everywhere accordingly.
6335
6336         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
6337
6338         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
6339
6340 2002-02-28  Ravi Pratap  <ravi@ximian.com>
6341
6342         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
6343         try performing lookups against those instead of jumping straight into using
6344         the 'using' clauses.
6345
6346         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
6347
6348         (LookupType): Perform lookups in implicit parents too.
6349
6350         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
6351         sequence as RootContext.LookupType. 
6352
6353         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
6354         the various cases of namespace lookups into this method.
6355
6356 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
6357
6358         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
6359         in positional arguments)
6360
6361         * class.cs (Operator): Update the AllowedModifiers to contain
6362         extern. 
6363
6364         * cs-parser.jay: Update operator declaration to allow for the
6365         operator body to be empty.
6366
6367         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
6368         values. 
6369
6370 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
6371
6372         * class.cs (Method.Emit): Label parameters.
6373
6374         * driver.cs: Return 1 or 0 as the program exit code.
6375
6376 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
6377
6378         * expression.cs: Special case the `null' object when trying to
6379         auto-compute the type, as anything can be explicitly converted to
6380         that. 
6381
6382         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
6383         spotting this Paolo.
6384
6385         (Expression.ImplicitNumericConversion): Perform comparissions of
6386         the type using the underlying type in the case of an enumeration
6387         rather than using the enumeration type for the compare.
6388
6389         Cope with the underlying == type case, which is not possible to
6390         catch before. 
6391
6392         (Expression.ConvertNumericExplicit): Perform comparissions of
6393         the type using the underlying type in the case of an enumeration
6394         rather than using the enumeration type for the compare.
6395
6396         * driver.cs: If the user does not supply an extension, assume .exe
6397
6398         * cs-parser.jay (if_statement): Rewrote so that we can track the
6399         location for the if statement.
6400
6401         * expression.cs (Binary.ConstantFold): Only concat strings when
6402         the operation is "+", not everything ;-)
6403
6404         * statement.cs (Statement.EmitBoolExpression): Take a location
6405         argument. 
6406         (If, While, Do): Track location.
6407
6408         * expression.cs (Binary.ResolveOperator): In the object + string
6409         case, I was missing a call to ConvertImplicit
6410
6411 2002-02-25  Ravi Pratap  <ravi@ximian.com>
6412
6413         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
6414         Location arguments. Ensure we use RootContext.LookupType to do our work
6415         and not try to do a direct Type.GetType and ModuleBuilder.GetType
6416
6417         * interface.cs (PopulateMethod): Handle the type of the parameter being
6418         null gracefully.
6419
6420         * expression.cs (Invocation.BetterFunction): Handle the case when we 
6421         have a params method with no fixed arguments and a call is made with no
6422         arguments.
6423
6424 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
6425
6426         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
6427         the verbatim-string-literal
6428
6429         * support.cs (InternalParameters.ParameterModifier): handle null
6430         fixed parameters.
6431         (InternalParameters.ParameterType): ditto.
6432
6433         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
6434         duplicating the name of the variable parameter.
6435         (GetParameterByName): Fix bug where we were not looking up array
6436         paramters if they were the only present (thanks Paolo!).
6437         (GetParameterInfo): We only have an empty set of types if both
6438         fixed and array are set to null.
6439         (GetParameterInfo-idx): Handle FixedParameter == null
6440
6441         * cs-parser.jay: Handle the case where there is no catch
6442         statements (missing null test).
6443
6444 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
6445
6446         * driver.cs (MainDriver): Be conservative on our command line
6447         handling.
6448
6449         Catch DirectoryNotFoundException when calling GetFiles.
6450         
6451         (SplitPathAndPattern): Used to split the input specification into
6452         a path and a pattern that we can feed to Directory.GetFiles.
6453
6454 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
6455
6456         * statement.cs (Fixed): Implement the last case of the Fixed
6457         statement (string handling).
6458
6459         * expression.cs (StringPtr): New class used to return a char * to
6460         a string;  Used by the Fixed statement.
6461
6462         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
6463
6464         * expression.cs (Binary.ResolveOperator): Remove redundant
6465         MemberLookup pn parent type.
6466         Optimize union call, we do not need a union if the types are the same.
6467         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
6468         type.
6469
6470         Specialize the use of MemberLookup everywhere, instead of using
6471         the default settings. 
6472
6473         (StackAlloc): Implement stackalloc keyword.
6474
6475         * cs-parser.jay: Add rule to parse stackalloc.
6476         
6477         * driver.cs: Handle /h, /help, /?
6478
6479         * expression.cs (MakeByteBlob): Removed the hacks we had in place
6480         before we supported unsafe code.
6481         
6482         * makefile: add --unsafe to the self compilation of mcs.
6483
6484 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
6485
6486         * expression.cs (PointerArithmetic): New class that is used to
6487         perform pointer arithmetic.
6488         (Binary.Resolve): Handle pointer arithmetic
6489         Handle pointer comparission.
6490         (ArrayPtr): Utility expression class that is used to take the
6491         address of an array.
6492
6493         (ElementAccess): Implement array access for pointers
6494         
6495         * statement.cs (Fixed): Implement fixed statement for arrays, we
6496         are missing one more case before we are done.
6497
6498         * expression.cs (Indirection): Implement EmitAssign and set the
6499         ExprClass to Variable.  This allows pointer dereferences to be
6500         treated as variables, and to have values assigned to them.
6501         
6502         * ecore.cs (Expression.StoreFromPtr): New utility function to
6503         store values dereferencing.
6504
6505 2002-02-20  Ravi Pratap  <ravi@ximian.com>
6506
6507         * expression.cs (Binary.ResolveOperator): Ensure that we are
6508         not trying to operate on a void type - this fixes the reported
6509         bug.
6510
6511         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
6512         the parent implementation is sealed.
6513
6514         * ../errors/cs0239.cs : Add.
6515
6516         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
6517
6518         * typemanager.cs (unverifiable_code_type): Corresponds to 
6519         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
6520         which have unsafe code in them.
6521
6522         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
6523         unsafe context.
6524
6525 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
6526
6527         * cs-tokenizer.cs: Add support for @"litreal strings"
6528
6529         Make tokenizer accept pre-processor directives
6530         on any column (remove the old C-like limitation). 
6531
6532         * rootcontext.cs (EmitCode): Emit any global attributes.
6533         (AddGlobalAttributes): Used to keep track of assembly attributes. 
6534
6535         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
6536
6537         * cs-parser.jay: Add support for global attributes.  
6538
6539 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
6540
6541         * expression.cs (Indirection): New helper class.  Unary will
6542         create Indirection classes to be able to implement the
6543         IMemoryLocation interface on it.
6544
6545 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
6546
6547         * cs-parser.jay (fixed_statement): reference the right statement.
6548
6549         * statement.cs (Fixed.Emit): Finish implementing the fixed
6550         statement for the &x case.
6551
6552 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
6553
6554         * class.cs (Property.Define, Method.Define): Remove newslot when
6555         `implementing'.  
6556
6557         * modifiers.cs: My use of NewSlot when `Abstract' was set was
6558         wrong.  NewSlot should only be used if the `new' keyword is present.
6559
6560         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
6561         locating our system dir.  Sorry about this.
6562
6563 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
6564
6565         * driver.cs (GetSystemDir): Compute correctly the location of our
6566         system assemblies.  I was using the compiler directory instead of
6567         the library directory.
6568
6569 2002-02-13  Ravi Pratap  <ravi@ximian.com>
6570
6571         * expression.cs (BetterFunction): Put back in what Miguel commented out
6572         since it is the correct fix. The problem is elsewhere ;-)
6573
6574         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
6575         parameters of the parms method are themselves compatible or not !
6576
6577         (StandardConversionExists): Fix very dangerous bug where we were forgetting
6578         to check that a class implements an interface before saying that an implicit
6579         conversion was allowed. Use ImplementsInterface to do the checking.
6580
6581 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
6582
6583         * class.cs (Method.Define): Track whether we are an explicit
6584         implementation or not.  And only call DefineMethodOverride if we
6585         are an explicit implementation.
6586
6587         (Property.DefineMethod): Ditto.
6588
6589 2002-02-11  Ravi Pratap  <ravi@ximian.com>
6590
6591         * expression.cs (BetterFunction): Catch hideous bug which was
6592          preventing us from detecting ambiguous calls due to implicit casts i.e
6593         cs0121.
6594
6595 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
6596
6597         * support.cs (Pair): Remove un-needed method.  I figured why I was
6598         getting the error in cs-parser.jay, the variable in a foreach loop
6599         is readonly, and the compiler does not really treat this as a variable.
6600
6601         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
6602         instead of EQUALS in grammar.  
6603
6604         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
6605
6606         * expression.cs (Unary.DoResolve): Check whether the argument is
6607         managed or not.
6608
6609 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
6610
6611         * support.cs: Api for Pair to set a value.  Despite the fact that
6612         the variables are public the MS C# compiler refuses to compile
6613         code that accesses the field if the variable is part of a foreach
6614         statement. 
6615
6616         * statement.cs (Fixed): Begin implementation of the fixed
6617         statement.
6618
6619         (Block.AddVariable): Return the VariableInfo on success and null
6620         on failure instead of true/false. 
6621
6622         * cs-parser.jay (foreach): Catch errors on variables already
6623         defined (we were ignoring this value before) and properly unwind
6624         the block hierarchy
6625
6626         (fixed_statement): grammar for the fixed statement.
6627
6628 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
6629
6630         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
6631         pointer types to be incretemented.
6632
6633         (SizeOf): Implement.
6634
6635         * cs-parser.jay (pointer_member_access): Implement
6636         expr->IDENTIFIER production.
6637
6638         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
6639         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
6640         on safe contexts.
6641
6642         (Unary): Implement indirection.
6643
6644         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
6645         use in non-unsafe context).
6646
6647         (SimpleName.DoResolve): Check for pointers in field access on safe
6648         contexts. 
6649
6650         (Expression.LoadFromPtr): Factor the load-indirect code in this
6651         function.  This was duplicated in UnboxCast and ParameterReference
6652
6653 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
6654
6655         * expression.cs (ComposedCast): report an error if a pointer cast
6656         is used in a safe region.
6657
6658         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
6659         pointer type casts in unsafe context.
6660
6661         * codegen.cs (EmitContext): Set up IsUnsafe.
6662
6663         * cs-parser.jay (non_expression_type): Add productions for pointer
6664         casts. 
6665
6666         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
6667         code.  We should not use force into static mode if the method is
6668         not virtual.  Fixes bug in MIS
6669
6670         * statement.cs (Do.Emit, While.Emit, For.Emit,
6671         Statement.EmitBoolExpression): Add support to Do and While to
6672         propagate infinite loop as `I do return' semantics.
6673
6674         Improve the For case to also test for boolean constants.
6675
6676         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
6677         to the list of attributes we can add.
6678
6679         Remove `EmitContext' argument.
6680
6681         * class.cs (Method.Define): Apply parameter attributes.
6682         (Constructor.Define): Apply parameter attributes.
6683         (MethodCore.LabelParameters): Move here the core of labeling
6684         parameters. 
6685
6686         * support.cs (ReflectionParameters.ParameterModifier,
6687         InternalParameters.ParameterModifier): Use IsByRef on the type and
6688         only return the OUT bit for these parameters instead of in/out/ref
6689         flags.
6690
6691         This is because I miss-understood things.  The ParameterInfo.IsIn
6692         and IsOut represent whether the parameter has the [In] and [Out]
6693         attributes set.  
6694
6695 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
6696
6697         * ecore.cs (FieldExpr.Emit): Release temporaries.
6698
6699         * assign.cs (LocalTemporary.Release): new function.
6700
6701         * codegen.cs (EmitContext.GetTemporaryStorage,
6702         EmitContext.FreeTemporaryStorage): Rework the way we deal with
6703         temporary storage.  Now we can "put back" localbuilders when we
6704         are done with them
6705
6706 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
6707
6708         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
6709         need to make a copy of the variable to generate verifiable code.
6710
6711 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
6712
6713         * driver.cs: Compute dynamically the system directory.
6714
6715         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
6716         Slower, but more generally useful.  Used by the abstract
6717         registering implementation. 
6718
6719         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
6720         the rules for the special rule on Type/instances.  First check if
6721         we have the same name, and if so, try that special static path
6722         rather than the instance path.
6723         
6724 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
6725
6726         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
6727         for, while and if.
6728
6729         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
6730         Enum, ValueType, Delegate or Array for non-corlib compiles.
6731
6732         * cs-tokenizer.cs: Catch long identifiers (645)
6733
6734         * typemanager.cs (IndexerPropetyName): Ravi never tested this
6735         piece of code.
6736
6737         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
6738         fix, we were returning too early, so we were not registering
6739         pending methods from abstract classes.
6740
6741         Do not register pending methods if the class is abstract.
6742
6743         * expression.cs (Conditional.DoResolve): Report circular implicit
6744         conversions when we neecd to compute it for conditional
6745         expressions. 
6746
6747         (Is.DoResolve): If the expression is always of the provided type,
6748         flag warning 183.  If the expression can not ever be of the
6749         provided type flag warning 184.
6750
6751         * class.cs: Catch 169 as well.
6752
6753         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
6754         read. 
6755
6756 2002-01-18  Nick Drochak  <ndrochak@gol.com>
6757
6758         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
6759
6760 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
6761
6762         * interface.cs: (PopulateMethod): Check for pointers being defined
6763         only if the unsafe context is active.
6764         (PopulateProperty): ditto.
6765         (PopulateIndexer): ditto.
6766
6767         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
6768         specified.  If pointers are present, make sure that they are
6769         present in an unsafe context.
6770         (Constructor, Constructor.Define): ditto.
6771         (Field, Field.Define): ditto.
6772         (Property, Property.Define): ditto.
6773         (Event, Event.Define): ditto.
6774
6775         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
6776         hashtable if there are classes or structs defined.
6777
6778         * expression.cs (LocalVariableReference.DoResolve): Simplify this
6779         code, as the constant resolution moved.
6780
6781         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
6782         the metadata, so we can flag error 133. 
6783
6784         * decl.cs (MemberCore.UnsafeOK): New function to test that a
6785         pointer is being declared in an unsafe context.
6786
6787 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
6788
6789         * modifiers.cs (Modifiers.Check): Require a Location argument.
6790         Report error 227 for Unsafe use.
6791
6792         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
6793
6794         * statement.cs (For.Emit): If the test is null, then report that
6795         we do `return', as we wont reach anything afterwards.
6796
6797         (Switch.SwitchGoverningType): Track the expression that matched
6798         the conversion.
6799
6800         * driver.cs: Allow negative numbers as an error code to flag.
6801
6802         * cs-parser.jay: Handle 1551.
6803
6804         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
6805
6806 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
6807
6808         * cs-parser.jay: Report 1518 (type declaration can only contain
6809         class, struct, interface, enum or delegate)
6810
6811         (switch_label): Report 1523 (keywords `case' or `default' must
6812         preced code)
6813
6814         (opt_switch_sections): Report 1522 (empty switch)
6815
6816         * driver.cs: Report 1515 (response file specified multiple times)
6817         Report 1516 (Source file specified multiple times).
6818
6819         * expression.cs (Argument.Resolve): Signal 1510
6820
6821         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
6822         access not allowed in static code)
6823
6824 2002-01-11  Ravi Pratap  <ravi@ximian.com>
6825
6826         * typemanager.cs (IsPointerType): Utility method which we are going
6827         to need a lot.
6828
6829         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
6830         the object type, so we take care of that.
6831
6832         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
6833         
6834         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
6835         added to non-params parameters :-)
6836
6837         * typemanager.cs (CSharpName): Include 'void' type too. 
6838
6839         (void_ptr_type): Include in the set of core types.
6840
6841         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
6842         duplicating code.
6843
6844         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
6845         an unsafe context.
6846
6847         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
6848         completely forgotten about it.
6849
6850 2002-01-10  Ravi Pratap  <ravi@ximian.com>
6851
6852         * cs-parser.jay (pointer_type): Add. This begins our implementation
6853         of parsing rules for unsafe code.
6854
6855         (unsafe_statement): Implement.
6856
6857         (embedded_statement): Modify to include the above.
6858
6859         * statement.cs (Unsafe): Implement new class for unsafe blocks.
6860
6861         * codegen.cs (EmitContext.InUnsafe): Add. This determines
6862         if the current context is an unsafe one.
6863
6864         * cs-parser.jay (local_variable_pointer_type): Since local variable types
6865         are handled differently, we need separate rules for them.
6866
6867         (local_variable_declaration): Update to use local_variable_pointer_type
6868         to allow variable declarations of unmanaged pointer types.
6869
6870         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
6871         in unsafe contexts.
6872
6873         * ../errors/cs0214.cs : Add.
6874
6875 2002-01-16  Nick Drochak  <ndrochak@gol.com>
6876
6877         * makefile: remove 'response' file when cleaning.
6878
6879 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
6880
6881         * cs-parser.jay: Report 1524.
6882
6883 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
6884
6885         * typemanager.cs (RegisterMethod): drop checking if we have
6886         registered this from here
6887
6888 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
6889
6890         * class.cs (Method.EmitDestructor): Implement calling our base
6891         destructor. 
6892
6893         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
6894         value of InFinally.
6895
6896         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
6897         this routine and will wrap the call in a try/catch block.  Deal
6898         with the case.
6899
6900 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
6901
6902         * ecore.cs (Expression.MemberLookup): instead of taking a
6903         parameter `same_type' that was used to tell whether we could
6904         access private members we compute our containing type from the
6905         EmitContext.
6906
6907         (FieldExpr): Added partial support for volatile fields.  This does
6908         not work for volatile fields exposed from assemblies, as I can not
6909         figure out how to extract the modreq from it.
6910
6911         Updated all the source files to use this.
6912
6913         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
6914         because it is referenced by MemberLookup very often. 
6915
6916 2002-01-09  Ravi Pratap  <ravi@ximian.com>
6917
6918         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
6919         TypeBuilder.GetCustomAttributes to retrieve what we need.
6920
6921         Get rid of redundant default_member_attr_type as this is the same as
6922         default_member_type which already exists.
6923
6924         * interface.cs, attribute.cs : Update accordingly.
6925         
6926 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
6927
6928         * typemanager.cs: Enable IndexerPropertyName again.  It does not
6929         work for TYpeBuilders though.  Ravi, can you please fix this?
6930
6931         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
6932
6933         * expression.cs (Argument.Emit): Handle the case of ref objects
6934         being passed to ref functions;  
6935
6936         (ParameterReference.EmitLoad): Loads the content of the pointer
6937         without dereferencing.
6938
6939 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
6940
6941         * cs-tokenizer.cs: Implemented the pre-processing expressions.
6942
6943 2002-01-08  Ravi Pratap  <ravi@ximian.com>
6944
6945         * class.cs (Indexer.DefineMethod): Incorporate the interface
6946         type in the name of the method if we are doing explicit interface
6947         implementation.
6948
6949         * expression.cs (ConversionExists): Remove as it is completely obsolete.
6950
6951         (BetterConversion): Fix extremely trivial bug where we were referring to
6952         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
6953         again !
6954
6955         * ../errors/bug16.cs : Add although we have fixed it.
6956
6957 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
6958
6959         * expression.cs (BaseIndexer): Begin implementation.
6960
6961         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
6962
6963         * cs-parser.jay (indexer_declarator): Use qualified_identifier
6964         production directly to remove a shift/reduce, and implement
6965         explicit interface implementation.
6966
6967         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
6968         after a floating point suffix.
6969
6970         * expression.cs (DoNumericPromotions): Improved the conversion for
6971         uint/uint.  If we have a constant, we avoid doing a typecast to a
6972         larger type.
6973
6974         * class.cs (Indexer): Implement explicit interface implementation
6975         for indexers.
6976         
6977 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
6978
6979         * class.cs: make the default instance constructor public and hidebysig.
6980
6981 2001-01-03  Ravi Pratap  <ravi@ximian.com>
6982
6983         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
6984         so we can call it from elsewhere.
6985
6986         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
6987         we emit it internally if the class has a defined indexer; otherwise the user
6988         emits it by decorating the class definition with the DefaultMemberAttribute.
6989
6990         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
6991         attribute is not used on a type which defines an indexer.
6992
6993         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
6994         character when we skip whitespace.
6995
6996         * ../errors/cs0646.cs : Add.
6997
6998 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
6999
7000         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
7001         again. 
7002
7003         * makefile: Add practical target `mcs3.exe' which builds the third
7004         generation compiler. 
7005
7006         * expression.cs (New): Fix structures constructor calling.
7007
7008         * class.cs (Property, Method, Indexer): Emit Final flag on the
7009         method if we are an interface implementation and we are not
7010         abstract. 
7011
7012         * ecore.cs (PropertyExpr): New public field `IsBase', tells
7013         whether this property is referencing a `base' method.
7014
7015         * expression.cs (Invocation.EmitCall): take an extra argument:
7016         is_base, this is used to determine whether the `call' or
7017         `callvirt' opcode should be used.
7018
7019         
7020         * delegate.cs: update EmitCall.
7021
7022         * class.cs (Method.Define): Set NewSlot for the cases where we are
7023         not implementing an interface method.
7024
7025         (Property.Define): ditto.
7026
7027 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
7028
7029         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
7030         'r'.  Allows mcs to parse itself fully.
7031
7032 2002-01-02  Ravi Pratap  <ravi@ximian.com>
7033
7034         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
7035         of the number of initializers that require the InitializeArray method.
7036
7037         (CheckIndices): Store the Expression in all cases - not the plain value. Also
7038         update the above field where necessary.
7039
7040         (MakeByteBlob): Update accordingly.
7041
7042         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
7043         greater than 2.
7044
7045         (EmitDynamicInitializers): Update in accordance with the new optimization.
7046
7047         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
7048         same OpCode applies.
7049
7050         * cs-parser.jay : Fix some glaring errors I introduced.
7051
7052 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
7053
7054         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
7055         so that we can check for name clashes there too.
7056
7057         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
7058         for interface indexers.
7059
7060         * interfaces.cs (Define): Emit the default member attribute.
7061
7062         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
7063         variable was being referred to while setting the value ;-)
7064
7065 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
7066
7067         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
7068         byte-by-byte information when we know the data is zero.
7069
7070         Make the block always a multiple of 4, because
7071         DefineInitializedData has a bug.
7072
7073         * assign.cs: Fix, we should assign from the temporary, not from
7074         the source. 
7075
7076         * expression.cs (MakeByteBlob): Fix my incorrect code.
7077
7078 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
7079
7080         * typemanager.cs (EnumToUnderlying): This function is used to get
7081         the underlying type from an enumeration, because it does not
7082         always work. 
7083
7084         * constant.cs: Use the I4_S form for values between -128 and 127.
7085
7086         * statement.cs (Block.LookupLabel): Looks up a label.
7087         (Block): Drop support for labeled blocks.
7088
7089         (LabeledStatement): New kind of statement that represents a label
7090         only.
7091
7092         (Goto): Finally implement this bad boy.
7093         
7094         * cs-parser.jay: Update to reflect new mechanism to implement
7095         labels.
7096
7097 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
7098
7099         * codegen.cs (EmitContext.This): a codegen property that keeps the
7100         a single instance of this instead of creating many different this
7101         instances. 
7102
7103         * delegate.cs (Delegate.DoResolve): Update to use the property;
7104
7105         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
7106
7107         * expression.cs (BaseAccess.DoResolve): Ditto.
7108
7109 2001-12-29  Ravi Pratap  <ravi@ximian.com>
7110
7111         * typemanager.cs (methodimpl_attr_type): Add to hold the type
7112         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
7113
7114         (InitCoreTypes): Update accordingly.
7115
7116         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
7117         so we can quickly store the state.
7118
7119         (ApplyAttributes): Set the correct implementation flags
7120         for InternalCall methods.
7121
7122 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
7123
7124         * expression.cs (EmitCall): if a method is not virtual, then do
7125         not use callvirt on it.
7126
7127         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
7128         user defined stuff) requires the use of stobj, which takes an
7129         address on the stack instead of an array and an index.  So emit
7130         the Ldelema operation for it.
7131
7132         (EmitStoreOpcode): Use stobj for valuetypes.
7133
7134         (UnaryMutator.EmitCode): Use the right 1 value depending on
7135         whether we are dealing with int64/uint64, float or doubles.
7136
7137         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
7138         constructors that I implemented last night.
7139
7140         (Constructor.IsDefault): Fix to work properly for static
7141         constructors.
7142
7143         * cs-parser.jay (CheckDef): report method signature errors.
7144         Update error number 103 to be 132.
7145
7146         * decl.cs: New AdditionResult enumeration value: MethodExists.
7147         Although we do this check for methods later on in the semantic
7148         analysis, catching repeated default constructors is so easy that
7149         we catch these here. 
7150         
7151         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
7152         promotions code.
7153
7154         (ParameterReference.EmitAssign, Emit): handle
7155         bools as bytes.
7156
7157         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
7158         (ArrayAccess.EmitStoreOpcode): ditto.
7159
7160         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
7161
7162         * expression.cs (MakeByteBlob): Complete all the missing types
7163         (uint, short, ushort, byte, sbyte)
7164
7165         * class.cs: Only init instance field initializers on instance
7166         constructors. 
7167
7168         Rename `constructors' to instance_constructors. 
7169
7170         (TypeContainer.AddConstructor): Only add constructors to the list
7171         if it is not static.
7172
7173         Make sure that we handle default_static_constructor independently
7174         everywhere where we handle instance_constructors
7175
7176 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
7177
7178         * class.cs: Do not lookup or create a base initializer for a
7179         static constructor.
7180
7181         (ConstructorInitializer.Resolve): use the proper type to lookup
7182         for constructors.
7183
7184         * cs-parser.jay: Report error 1585 (modifiers between type and name).
7185
7186         * enum.cs, interface.cs: Remove CloseType, this is taken care by
7187         in DeclSpace. 
7188
7189         * decl.cs: CloseType is now an virtual method, the default
7190         implementation just closes this type.
7191         
7192 2001-12-28  Ravi Pratap  <ravi@ximian.com>
7193
7194         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
7195         to PreserveSig by default. Also emit HideBySig on such methods.
7196
7197         Basically, set the defaults to standard values.
7198
7199         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
7200         argument, if candidate is better, it can't be worse than the best !
7201
7202         (Invocation): Re-write bits to differentiate between methods being
7203         applicable in their expanded form and their normal form - for params
7204         methods of course.
7205
7206         Get rid of use_standard everywhere as only standard conversions are allowed
7207         in overload resolution. 
7208
7209         More spec conformance.
7210         
7211 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
7212
7213         * driver.cs: Add --timestamp, to see where the compiler spends
7214         most of its time.
7215
7216         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
7217         `this' in static code.
7218
7219         (SimpleName.DoResolve): Implement in terms of a helper function
7220         that allows static-references to be passed upstream to
7221         MemberAccess.
7222
7223         (Expression.ResolveWithSimpleName): Resolve specially simple
7224         names when called by MemberAccess to implement the special
7225         semantics. 
7226
7227         (Expression.ImplicitReferenceConversion): Handle conversions from
7228         Null to reference types before others, as Null's type is
7229         System.Object. 
7230
7231         * expression.cs (Invocation.EmitCall): Handle the special case of
7232         calling methods declared on a reference type from a ValueType
7233         (Base classes System.Object and System.Enum)
7234
7235         (MemberAccess.Resolve): Only perform lookups on Enumerations if
7236         the left hand side is a TypeExpr, not on every enumeration. 
7237
7238         (Binary.Resolve): If types are reference types, then do a cast to
7239         object on operators != and == of both arguments.
7240         
7241         * typemanager.cs (FindMembers): Extract instance and static
7242         members if requested.
7243
7244         * interface.cs (PopulateProperty): Use void_type instead of null
7245         as the return type for the setter method.
7246
7247         (PopulateIndexer): ditto.
7248
7249 2001-12-27  Ravi Pratap  <ravi@ximian.com>
7250
7251         * support.cs (ReflectionParameters): Fix minor bug where we
7252         were examining the wrong parameter for the ParamArray attribute.
7253
7254         Cope with requests for the type of the parameter at position
7255         greater than the params parameter's. We now return the element
7256         type of the params array as that makes more sense.
7257
7258         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
7259         accordingly as we no longer have to extract the element type
7260         ourselves.
7261
7262         (Invocation.OverloadResolve): Update.
7263
7264 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
7265
7266         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
7267         against IEnumerator, test whether the return value is a descendant
7268         of the IEnumerator interface.
7269
7270         * class.cs (Indexer.Define): Use an auxiliary method to implement
7271         the other bits of the method definition.  Begin support for
7272         explicit interface implementation.
7273
7274         (Property.DefineMethod): Use TypeManager.void_type instead of null
7275         for an empty return value.
7276
7277 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
7278
7279         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
7280         dealing with a FieldExpr which is composed of a FieldBuilder, in
7281         the code path we did extract the constant, but we should have
7282         obtained the underlying value to be able to cast it (otherwise we
7283         end up in an infinite loop, this is what Ravi was running into).
7284
7285         (ArrayCreation.UpdateIndices): Arrays might be empty.
7286
7287         (MemberAccess.ResolveMemberAccess): Add support for section
7288         14.5.4.1 that deals with the special case of E.I when E is a type
7289         and something else, that I can be a reference to a static member.
7290
7291         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
7292         handle a particular array type to create byte blobs, it is just
7293         something we dont generate byteblobs for.
7294
7295         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
7296         arguments. 
7297
7298         * location.cs (Push): remove the key from the hashtable that we
7299         are about to add.   This happens for empty files.
7300
7301         * driver.cs: Dispose files after we have parsed them.
7302
7303         (tokenize): new function that only runs the tokenizer on its
7304         input, for speed testing.
7305
7306 2001-12-26  Ravi Pratap  <ravi@ximian.com>
7307
7308         * class.cs (Event.Define): Define the private field only if there
7309         are no accessors defined.
7310
7311         * expression.cs (ResolveMemberAccess): If there is no associated
7312         field with the event, that means we have an event defined with its
7313         own accessors and we should flag error cs0070 since transforming
7314         ourselves into a field is not valid in that case.
7315
7316         * ecore.cs (SimpleName.DoResolve): Same as above.
7317
7318         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
7319         and charset to sane values.
7320
7321 2001-12-25  Ravi Pratap  <ravi@ximian.com>
7322
7323         * assign.cs (DoResolve): Perform check on events only if they 
7324         are being accessed outside the declaring type.
7325
7326         * cs-parser.jay (event_declarations): Update rules to correctly
7327         set the type of the implicit parameter etc.
7328
7329         (add_accessor, remove_accessor): Set current local parameters.
7330
7331         * expression.cs (Binary): For delegate addition and subtraction,
7332         cast the return value from the method into the appropriate delegate
7333         type.
7334
7335 2001-12-24  Ravi Pratap  <ravi@ximian.com>
7336
7337         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
7338         of these as the workaround is unnecessary.
7339
7340         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
7341         delegate data - none of that is needed at all.
7342
7343         Re-write bits to extract the instance expression and the delegate method
7344         correctly.
7345
7346         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
7347         on delegates too.
7348
7349         * attribute.cs (ApplyAttributes): New method to take care of common tasks
7350         of attaching attributes instead of duplicating code everywhere.
7351
7352         * everywhere : Update code to do attribute emission using the above method.
7353
7354 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
7355
7356         * expression.cs (IsParamsMethodApplicable): if there are not
7357         parameters, return immediately.
7358
7359         * ecore.cs: The 0 literal can be implicity converted to an enum
7360         type. 
7361
7362         (SimpleName.DoResolve): First lookup the type, then lookup the
7363         members. 
7364
7365         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
7366         want to get its address.  If the InstanceExpression is not
7367         addressable, store the result in a temporary variable, then get
7368         the address of it.
7369
7370         * codegen.cs: Only display 219 errors on warning level or above. 
7371
7372         * expression.cs (ArrayAccess): Make it implement the
7373         IMemoryLocation interface.
7374
7375         (Binary.DoResolve): handle the operator == (object a, object b)
7376         and operator != (object a, object b) without incurring into a
7377         BoxedCast (because 5 != o should never be performed).
7378
7379         Handle binary enumerator operators.
7380
7381         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
7382         value type, otherwise use Ldelem_ref.
7383
7384         Use precomputed names;
7385
7386         (AddressOf): Implement address of
7387
7388         * cs-parser.jay (labeled_statement): Fix recursive block
7389         addition by reworking the production.
7390
7391         * expression.cs (New.DoEmit): New has a special case:
7392                 
7393                  If we are dealing with a ValueType, we have a few
7394                  situations to deal with:
7395                 
7396                     * The target of New is a ValueType variable, that is
7397                       easy, we just pass this as the variable reference
7398                 
7399                     * The target of New is being passed as an argument,
7400                       to a boxing operation or a function that takes a
7401                       ValueType.
7402                 
7403                       In this case, we need to create a temporary variable
7404                       that is the argument of New.
7405
7406
7407 2001-12-23  Ravi Pratap  <ravi@ximian.com>
7408
7409         * rootcontext.cs (LookupType): Check that current_type is not null before
7410         going about looking at nested types.
7411
7412         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
7413         not implement the IAssignMethod interface any more.
7414
7415         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
7416         where we tranform them into FieldExprs if they are being resolved from within
7417         the declaring type.
7418
7419         * ecore.cs (SimpleName.DoResolve): Do the same here.
7420
7421         * assign.cs (DoResolve, Emit): Clean up code considerably. 
7422
7423         * ../errors/bug10.cs : Add.
7424
7425         * ../errors/cs0070.cs : Add.
7426
7427         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
7428
7429         * assign.cs : Get rid of EventIsLocal everywhere.
7430         
7431 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
7432
7433         * ecore.cs (ConvertIntLiteral): finished the implementation.
7434
7435         * statement.cs (SwitchLabel): Convert the value we are using as a
7436         key before looking up the table.
7437
7438 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
7439
7440         * codegen.cs (EmitTopBlock): Require a Location argument now.
7441
7442         * cs-parser.jay (constructor_declarator): We need to setup
7443         current_local_parameters before we parse the
7444         opt_constructor_initializer, to allow the variables to be bound
7445         to the constructor arguments.
7446
7447         * rootcontext.cs (LookupType): First lookup nested classes in our
7448         class and our parents before we go looking outside our class.
7449
7450         * expression.cs (ConstantFold): Extract/debox the values at the
7451         beginnning. 
7452
7453         * rootcontext.cs (EmitCode): Resolve the constants first before we
7454         resolve the types.  This is not really needed, but it helps debugging.
7455
7456         * statement.cs: report location.
7457         
7458         * cs-parser.jay: pass location to throw statement.
7459
7460         * driver.cs: Small bug fix.
7461
7462         * report.cs: Updated format to be 4-zero filled digits.
7463
7464 2001-12-22  Ravi Pratap  <ravi@ximian.com>
7465
7466         * expression.cs (CheckIndices): Fix minor bug where the wrong
7467         variable was being referred to ;-)
7468
7469         (DoEmit): Do not call EmitStaticInitializers when the 
7470         underlying type is System.Object.
7471
7472 2001-12-21  Ravi Pratap  <ravi@ximian.com>
7473
7474         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
7475         and do the usual workaround for SRE.
7476
7477         * class.cs (MyEventBuilder.EventType): New member to get at the type
7478         of the event, quickly.
7479
7480         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
7481
7482         * assign.cs (Assign.DoResolve): Handle the case when the target
7483         is an EventExpr and perform the necessary checks.
7484
7485         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
7486         interface.
7487
7488         (SimpleName.MemberStaticCheck): Include check for EventExpr.
7489
7490         (EventExpr): Set the type in the constructor itself since we 
7491         are meant to be born fully resolved.
7492
7493         (EventExpr.Define): Revert code I wrote earlier.
7494                 
7495         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
7496         instance expression is null. The instance expression is a This in that case
7497         or a null, depending on whether it is a static method or not.
7498
7499         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
7500         refers to more than one method.
7501
7502         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
7503         and accordingly flag errors.
7504
7505 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
7506
7507         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
7508
7509 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
7510
7511         * location.cs (ToString): Provide useful rutine.
7512
7513 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
7514
7515         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
7516         objects, return the actual integral boxed.
7517
7518         * statement.cs (SwitchLabel): define an ILLabel for each
7519         SwitchLabel. 
7520         
7521         (Switch.CheckSwitch): If the value is a Literal, extract
7522         the underlying literal.
7523         
7524         Also in the unused hashtable we had, add the SwitchLabel so we can
7525         quickly look this value up.
7526
7527         * constant.cs: Implement a bunch of new constants.  Rewrite
7528         Literal based on this.  Made changes everywhere to adapt to this.
7529         
7530         * expression.cs (Expression.MakeByteBlob): Optimize routine by
7531         dereferencing array only once, and also copes with enumrations.
7532
7533         bytes are two bytes wide, not one.
7534
7535         (Cast): Perform constant conversions.
7536         
7537         * ecore.cs (TryImplicitIntConversion): Return literals instead of
7538         wrappers to the literals here.
7539
7540         * expression.cs (DoNumericPromotions): long literals can converted
7541         to ulong implicity (this is taken care of elsewhere, but I was
7542         missing this spot).
7543
7544         * ecore.cs (Expression.Literalize): Make the return type Literal,
7545         to improve type checking.
7546
7547         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
7548
7549 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
7550
7551         * literal.cs: Revert code from ravi that checked the bounds.  The
7552         bounds are sane by the definition of the type itself. 
7553
7554         * typemanager.cs: Fix implementation of ImplementsInterface.  We
7555         need to actually look up in our parent hierarchy for interfaces
7556         implemented. 
7557
7558         * const.cs: Use the underlying type for enumerations
7559
7560         * delegate.cs: Compute the basename for the delegate creation,
7561         that should fix the delegate test case, and restore the correct
7562         Type Lookup semantics in rootcontext
7563
7564         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
7565         referencing a nested type with the Reflection API is using the "+"
7566         sign. 
7567
7568         * cs-parser.jay: Do not require EOF token at the end.
7569
7570 2001-12-20  Ravi Pratap  <ravi@ximian.com>
7571
7572         * rootcontext.cs (LookupType): Concatenate type names with
7573         a '.' instead of a '+' The test suite passes again.
7574
7575         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
7576         field of the enumeration.
7577
7578         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
7579         the case when the member is an EventExpr.
7580
7581         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
7582         static has an associated instance expression.
7583
7584         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
7585
7586         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
7587
7588         * class.cs (Event.Define): Register event and perform appropriate checks
7589         for error #111.
7590
7591         We define the Add and Remove methods even if the use provides none because
7592         in that case, we provide default implementations ourselves.
7593
7594         Define a private field of the type of the event. This is done by the CSC compiler
7595         and we should be doing it too ;-)
7596
7597         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
7598         More methods we use in code we generate.
7599
7600         (multicast_delegate_type, delegate_type): Two separate types since the distinction
7601         is important.
7602
7603         (InitCoreTypes): Update accordingly for the above.
7604
7605         * class.cs (Event.Emit): Generate code for default accessors that we provide
7606
7607         (EmitDefaultMethod): Do the job in the above.
7608
7609         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
7610         appropriate place.
7611
7612 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
7613
7614         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
7615         builders even if we were missing one.
7616
7617         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
7618         pass the Basename as our class name instead of the Name.  The
7619         basename will be correctly composed for us.
7620
7621         * parameter.cs (Paramters): Now takes a Location argument.
7622
7623         * decl.cs (DeclSpace.LookupType): Removed convenience function and
7624         make all the code call directly LookupType in RootContext and take
7625         this chance to pass the Location information everywhere.
7626
7627         * Everywhere: pass Location information.
7628
7629 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
7630
7631         * class.cs (Constructor.Define): Updated way of detecting the
7632         length of the parameters.
7633
7634         (TypeContainer.DefineType): Use basename as the type name for
7635         nested types.
7636
7637         (TypeContainer.Define): Do not recursively define types here, as
7638         definition is taken care in order by the RootContext.
7639
7640         * tree.cs: Keep track of namespaces in a per-file basis.
7641
7642         * parameter.cs (Parameter.ComputeSignature): Update to use
7643         DeclSpace. 
7644
7645         (Parameters.GetSignature): ditto.
7646
7647         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
7648         instead of a TypeContainer.
7649
7650         (Interface.SemanticAnalysis): Use `this' instead of our parent to
7651         resolve names.  Because we need to be resolve in our context, not
7652         our parents.
7653         
7654         * driver.cs: Implement response files.
7655
7656         * class.cs (TypeContainer.DefineType): If we are defined, do not
7657         redefine ourselves.
7658         
7659         (Event.Emit): Emit the code for add/remove handlers.
7660         (Event.Define): Save the MethodBuilders for add/remove.
7661
7662         * typemanager.cs: Use pair here too.
7663
7664         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
7665         DictionaryEntry requires the first argument to be non-null.  
7666         
7667         (enum_declaration): Compute full name for registering the
7668         enumeration.
7669         
7670         (delegate_declaration): Instead of using
7671         formal_parameter_list, use opt_formal_parameter_list as the list
7672         can be empty.
7673
7674         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
7675         (EventParsing): New property that controls whether `add' and
7676         `remove' are returned as tokens or identifiers (for events);
7677
7678 2001-12-19  Ravi Pratap  <ravi@ximian.com>
7679
7680         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
7681         use MyEventBuilder only and let it wrap the real builder for us.
7682
7683         (MyEventBuilder): Revamp constructor etc.
7684
7685         Implement all operations that we perform on EventBuilder in precisely the same
7686         way here too.
7687
7688         (FindMembers): Update to use the EventBuilder member.
7689
7690         (Event.Emit): Update accordingly.
7691
7692 2001-12-18  Ravi Pratap  <ravi@ximian.com>
7693
7694         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
7695         by calling the appropriate methods.
7696
7697         (GetCustomAttributes): Make stubs as they cannot possibly do anything
7698         useful.
7699
7700         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
7701
7702 2001-12-17  Ravi Pratap  <ravi@ximian.com>
7703
7704         * delegate.cs (Delegate.Populate): Check that the return type
7705         and various parameters types are indeed accessible.
7706
7707         * class.cs (Constructor.Define): Same here.
7708
7709         (Field.Define): Ditto.
7710
7711         (Event.Define): Ditto.
7712
7713         (Operator.Define): Check that the underlying Method defined itself
7714         correctly - so it's MethodBuilder should not be null.
7715
7716         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
7717         expression happens to be null.
7718
7719         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
7720         members but as of now we don't seem to be able to do anything really useful with it.
7721
7722         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
7723         not the EventBuilder.
7724
7725 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
7726
7727         * cs-tokenizer.cs: Add support for defines.
7728         Add support for #if, #elif, #else, #endif
7729         
7730         (eval_var): evaluates a variable.
7731         (eval): stubbed for evaluating functions.
7732
7733         * cs-parser.jay: Pass the defines information
7734
7735         * driver.cs: Add --define command line option.
7736
7737         * decl.cs: Move MemberCore here.
7738
7739         Make it the base class for DeclSpace.  This allows us to catch and
7740         report 108 and 109 for everything now.
7741
7742         * class.cs (TypeContainer.Define): Extract all the members
7743         before populating and emit the warning 108 (new keyword required
7744         to override) instead of having each member implement this.
7745
7746         (MemberCore.Define): New abstract method, we will be using this in
7747         the warning reporting engine in Populate.
7748         
7749         (Operator.Define): Adjust to new MemberCore protocol. 
7750
7751         * const.cs (Const): This does not derive from Expression, it is a
7752         temporary object we use to create fields, it is a MemberCore. 
7753
7754         * class.cs (Method.Define): Allow the entry point to be in a
7755         specific class.
7756
7757         * driver.cs: Rewrite the argument handler to clean it up a bit.
7758
7759         * rootcontext.cs: Made it just an auxiliary namespace feature by
7760         making everything static.
7761
7762         * driver.cs: Adapt code to use RootContext type name instead of
7763         instance variable.
7764
7765         * delegate.cs: Remove RootContext argument.
7766
7767         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
7768         argument. 
7769
7770         * class.cs (Event.Define): The lookup can fail.
7771         
7772         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
7773
7774         * expression.cs: Resolve the this instance before invoking the code.
7775
7776 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
7777
7778         * cs-parser.jay: Add a production in element_access that allows
7779         the thing to become a "type" reference.  This way we can parse
7780         things like "(string [])" as a type.
7781
7782         Note that this still does not handle the more complex rules of
7783         casts. 
7784         
7785
7786         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
7787
7788         * ecore.cs: (CopyNewMethods): new utility function used to
7789         assemble the list of methods from running FindMembers.
7790
7791         (MemberLookup): Rework FindMembers so that 
7792
7793 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
7794
7795         * class.cs (TypeContainer): Remove Delegates who fail to be
7796         defined.
7797
7798         * delegate.cs (Populate): Verify that we dont get null return
7799         values.   TODO: Check for AsAccessible.
7800
7801         * cs-parser.jay: Use basename to emit error 574 (destructor should
7802         have the same name as container class), not the full name.
7803
7804         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
7805         possible representation.  
7806
7807         Also implements integer type suffixes U and L.
7808
7809 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
7810
7811         * expression.cs (ArrayCreation.DoResolve): We need to do the
7812         argument resolution *always*.
7813
7814         * decl.cs: Make this hold the namespace.  Hold the root context as
7815         well.
7816         (LookupType): Move here.
7817
7818         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
7819
7820         * location.cs (Row, Name): Fixed the code, it was always returning
7821         references to the first file.
7822
7823         * interface.cs: Register properties defined through interfaces.
7824
7825         * driver.cs: Add support for globbing on the command line
7826
7827         * class.cs (Field): Make it derive from MemberCore as well.
7828         (Event): ditto.
7829
7830 2001-12-15  Ravi Pratap  <ravi@ximian.com>
7831
7832         * class.cs (Event::Define): Check that the type of the event is a delegate
7833         type else flag error #66.
7834
7835         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
7836         same.
7837
7838         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
7839         values of EntryPoint, CharSet etc etc.
7840
7841         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
7842
7843         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
7844         be null and we should ignore this. I am not sure if this is really clean. Apparently,
7845         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
7846         which needs this to do its work.
7847
7848         * ../errors/cs0066.cs : Add.
7849
7850 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
7851
7852         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
7853         helper functions.
7854
7855         * class.cs: (MethodSignature.MethodSignature): Removed hack that
7856         clears out the parameters field.
7857         (MemberSignatureCompare): Cleanup
7858
7859         (MemberCore): New base class used to share code between MethodCore
7860         and Property.
7861
7862         (RegisterRequiredImplementations) BindingFlags.Public requires
7863         either BindingFlags.Instace or Static.  Use instance here.
7864
7865         (Property): Refactored code to cope better with the full spec.
7866
7867         * parameter.cs (GetParameterInfo): Return an empty array instead
7868         of null on error.
7869
7870         * class.cs (Property): Abstract or extern properties have no bodies.
7871
7872         * parameter.cs (GetParameterInfo): return a zero-sized array.
7873
7874         * class.cs (TypeContainer.MethodModifiersValid): Move all the
7875         method modifier validation to the typecontainer so we can reuse
7876         this on properties.
7877
7878         (MethodCore.ParameterTypes): return an empty sized array of types.
7879
7880         (Property.Define): Test property modifier validity.
7881
7882         Add tests for sealed/override too.
7883
7884         (Method.Emit): abstract or extern methods have no bodies.
7885
7886 2001-12-14  Ravi Pratap  <ravi@ximian.com>
7887
7888         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
7889         thing.
7890
7891         (Method::Define, ::Emit): Modify accordingly.
7892
7893         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
7894
7895         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
7896
7897         * makefile: Pass in /unsafe.
7898
7899 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
7900
7901         * class.cs (MakeKey): Kill routine.
7902         
7903         * class.cs (TypeContainer.Define): Correctly define explicit
7904         method implementations (they require the full interface name plus
7905         the method name).
7906
7907         * typemanager.cs: Deply the PtrHashtable here and stop using the
7908         lame keys.  Things work so much better.
7909
7910         This of course broke everyone who depended on `RegisterMethod' to
7911         do the `test for existance' test.  This has to be done elsewhere.
7912
7913         * support.cs (PtrHashtable): A hashtable that avoid comparing with
7914         the object stupid Equals method (because, that like fails all over
7915         the place).  We still do not use it.
7916
7917         * class.cs (TypeContainer.SetRequiredInterface,
7918         TypeContainer.RequireMethods): Killed these two routines and moved
7919         all the functionality to RegisterRequiredImplementations.
7920
7921         (TypeContainer.RegisterRequiredImplementations): This routine now
7922         registers all the implementations required in an array for the
7923         interfaces and abstract methods.  We use an array of structures
7924         which can be computed ahead of time to reduce memory usage and we
7925         also assume that lookups are cheap as most classes will not
7926         implement too many interfaces.
7927
7928         We also avoid creating too many MethodSignatures.
7929
7930         (TypeContainer.IsInterfaceMethod): Update and optionally does not
7931         clear the "pending" bit if we find that there are problems with
7932         the declaration.
7933
7934         (TypeContainer.VerifyPendingMethods): Update to report errors of
7935         methods that look like implementations but are not.
7936
7937         (TypeContainer.Define): Add support for explicit interface method
7938         implementation. 
7939         
7940 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
7941
7942         * typemanager.cs: Keep track of the parameters here instead of
7943         being a feature of the TypeContainer.
7944
7945         * class.cs: Drop the registration of parameters here, as
7946         InterfaceMethods are also interface declarations.
7947
7948         * delegate.cs: Register methods with the TypeManager not only with
7949         the TypeContainer.  This code was buggy.
7950
7951         * interface.cs: Full registation here.
7952
7953 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
7954
7955         * expression.cs: Remove reducer for binary expressions, it can not
7956         be done this way.
7957
7958         * const.cs: Put here the code that used to go into constant.cs
7959
7960         * constant.cs: Put here the code for constants, this is a new base
7961         class for Literals.
7962
7963         * literal.cs: Make Literal derive from Constant.
7964
7965 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
7966
7967         * statement.cs (Return.Emit): Report error 157 if the user
7968         attempts to return from a finally block.
7969
7970         (Return.Emit): Instead of emitting a return, jump to the end of
7971         the function.
7972
7973         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
7974         LocalBuilder to store the result of the function.  ReturnLabel is
7975         the target where we jump.
7976         
7977
7978 2001-12-09  Radek Doulik  <rodo@ximian.com>
7979
7980         * cs-parser.jay: remember alias in current namespace
7981
7982         * ecore.cs (SimpleName::DoResolve): use aliases for types or
7983         namespaces
7984
7985         * class.cs (LookupAlias): lookup alias in my_namespace
7986
7987         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
7988         aliases hashtable
7989         (LookupAlias): lookup alias in this and if needed in parent
7990         namespaces
7991
7992 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
7993
7994         * support.cs: 
7995
7996         * rootcontext.cs: (ModuleBuilder) Made static, first step into
7997         making things static.  I need this to avoid passing the
7998         TypeContainer when calling ParameterType.
7999
8000         * support.cs (InternalParameters.ParameterType): Remove ugly hack
8001         that did string manipulation to compute the type and then call
8002         GetType.  Use Parameter.ParameterType instead.
8003
8004         * cs-tokenizer.cs: Consume the suffix for floating values.
8005
8006         * expression.cs (ParameterReference): figure out whether this is a
8007         reference parameter or not.  Kill an extra variable by computing
8008         the arg_idx during emission.
8009
8010         * parameter.cs (Parameters.GetParameterInfo): New overloaded
8011         function that returns whether a parameter is an out/ref value or not.
8012
8013         (Parameter.ParameterType): The type of the parameter (base,
8014         without ref/out applied).
8015         
8016         (Parameter.Resolve): Perform resolution here.
8017         (Parameter.ExternalType): The full type (with ref/out applied).
8018
8019         * statement.cs (Using.Emit, Using.EmitExpression): Implement
8020         support for expressions on the using statement.
8021
8022 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
8023
8024         * statement.cs (Using.EmitLocalVariableDecls): Split the
8025         localvariable handling of the using statement.
8026
8027         (Block.EmitMeta): Keep track of variable count across blocks.  We
8028         were reusing slots on separate branches of blocks.
8029
8030         (Try.Emit): Emit the general code block, we were not emitting it. 
8031
8032         Check the type of the declaration to be an IDisposable or
8033         something that can be implicity converted to it. 
8034
8035         Emit conversions if required.
8036
8037         * ecore.cs (EmptyExpression): New utility class.
8038         (Expression.ImplicitConversionExists): New utility function.
8039
8040 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
8041
8042         * statement.cs (Using): Implement.
8043
8044         * expression.cs (LocalVariableReference): Support read only variables.
8045
8046         * statement.cs: Remove the explicit emit for the Leave opcode.
8047         (VariableInfo): Add a readonly field.
8048
8049 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
8050
8051         * ecore.cs (ConvCast): new class used to encapsulate the various
8052         explicit integer conversions that works in both checked and
8053         unchecked contexts.
8054
8055         (Expression.ConvertNumericExplicit): Use new ConvCast class to
8056         properly generate the overflow opcodes.
8057
8058 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
8059
8060         * statement.cs: The correct type for the EmptyExpression is the
8061         element_type, not the variable type.  Ravi pointed this out.
8062
8063 2001-12-04  Ravi Pratap  <ravi@ximian.com>
8064
8065         * class.cs (Method::Define): Handle PInvoke methods specially
8066         by using DefinePInvokeMethod instead of the usual one.
8067
8068         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
8069         above to do the task of extracting information and defining the method.
8070         
8071 2001-12-04  Ravi Pratap  <ravi@ximian.com>
8072
8073         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
8074         of the condition for string type.
8075
8076         (Emit): Move that here. 
8077
8078         (ArrayCreation::CheckIndices): Keep string literals in their expression
8079         form.
8080
8081         (EmitDynamicInitializers): Handle strings appropriately.
8082
8083 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
8084
8085         * codegen.cs (EmitContext): Replace multiple variables with a
8086         single pointer to the current Switch statement.
8087
8088         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
8089         EmitContext.
8090
8091 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
8092
8093         * statement.cs 
8094
8095         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
8096         default'.
8097         
8098         (Foreach.Emit): Foreach on arrays was not setting
8099         up the loop variables (for break/continue).
8100
8101         (GotoCase): Semi-implented.
8102         
8103 2001-12-03  Ravi Pratap  <ravi@ximian.com>
8104
8105         * attribute.cs (CheckAttribute): Handle system attributes by using
8106         Attribute.GetAttributes to examine information we need.
8107
8108         (GetValidPlaces): Same here.
8109
8110         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
8111
8112         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
8113
8114         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
8115
8116         (Method::Define): Set appropriate flags if we have a DllImport attribute.
8117
8118         (Method::Emit): Handle the case when we are a PInvoke method.
8119
8120 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
8121
8122         * expression.cs: Use ResolveWithSimpleName on compound names.
8123
8124 2001-12-02  Ravi Pratap  <ravi@ximian.com>
8125
8126         * constant.cs (EmitConstant): Make sure we resolve the associated expression
8127         before trying to reduce it.
8128
8129         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
8130
8131         * constant.cs (LookupConstantValue): Implement.
8132
8133         (EmitConstant): Use the above in emitting the constant.
8134
8135         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
8136         that are user-defined by doing a LookupConstantValue on them.
8137
8138         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
8139         too, like above.
8140
8141 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
8142
8143         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
8144
8145         (BaseAccess.DoResolve): Implement.
8146
8147         (MemberAccess.DoResolve): Split this routine into a
8148         ResolveMemberAccess routine that can be used independently
8149
8150 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
8151
8152         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
8153         As that share bits of the implementation.  Is returns a boolean,
8154         while As returns the Type that is being probed.
8155
8156 2001-12-01  Ravi Pratap  <ravi@ximian.com>
8157
8158         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
8159         instead of a Literal - much easier.
8160
8161         (EnumInTransit): Remove - utterly useless :-)
8162
8163         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
8164
8165         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
8166
8167         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
8168         chain when we have no associated expression.
8169
8170 2001-11-30  Ravi Pratap  <ravi@ximian.com>
8171
8172         * constant.cs (Define): Use Location while reporting the errror.
8173
8174         Also emit a warning when 'new' is used and there is no inherited
8175         member to hide.
8176
8177         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
8178         populated.
8179
8180         (LookupEnumValue): Implement to lookup an enum member's value and define it
8181         if necessary.
8182
8183         (Populate): Re-write accordingly to use the above routine.
8184
8185 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
8186
8187         * expression.cs (This): Fix prototype for DoResolveLValue to
8188         override the base class DoResolveLValue.
8189
8190         * cs-parser.cs: Report errors cs574 and cs575 (destructor
8191         declarations) 
8192
8193         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
8194         (we need to load the address of the field here).  This fixes
8195         test-22. 
8196         
8197         (FieldExpr.DoResolveLValue): Call the DoResolve
8198         function to initialize the Instance expression.
8199         
8200         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
8201         correctly the GetEnumerator operation on a value type.
8202
8203         * cs-parser.jay: Add more simple parsing error catches.
8204
8205         * statement.cs (Switch): Add support for string switches.
8206         Handle null specially.
8207
8208         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
8209
8210 2001-11-28  Ravi Pratap  <ravi@ximian.com>
8211
8212         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
8213
8214         (declare_local_constant): New helper function.
8215
8216         * statement.cs (AddConstant): Keep a separate record of constants
8217
8218         (IsConstant): Implement to determine if a variable is a constant.
8219
8220         (GetConstantExpression): Implement.
8221
8222         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
8223
8224         * statement.cs (IsVariableDefined): Re-write.
8225
8226 2001-11-27  Ravi Pratap  <ravi@ximian.com>
8227
8228         * class.cs (TypeContainer::FindMembers): Look for constants
8229         in the case when we are looking for MemberTypes.Field
8230
8231         * expression.cs (MemberAccess::DoResolve): Check that in the
8232         case we are a FieldExpr and a Literal, we are not being accessed
8233         by an instance reference.
8234
8235         * cs-parser.jay (local_constant_declaration): Implement.
8236
8237         (declaration_statement): Implement for constant declarations.
8238
8239 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
8240
8241         * statement.cs (Switch): Catch double defaults.
8242
8243         (Switch): More work on the switch() statement
8244         implementation.  It works for integral values now, need to finish
8245         string support.
8246
8247
8248 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
8249
8250         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
8251         integer literals into other integer literals.  To be used by
8252         switch. 
8253
8254 2001-11-24  Ravi Pratap  <ravi@ximian.com>
8255
8256         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
8257         some memory.
8258
8259         (EmitDynamicInitializers): Cope with the above since we extract data
8260         directly from ArrayData now.
8261
8262         (ExpectInitializers): Keep track of whether initializers are mandatory
8263         or not.
8264
8265         (Bounds): Make it a hashtable to prevent the same dimension being 
8266         recorded for every element in that dimension.
8267
8268         (EmitDynamicInitializers): Fix bug which prevented the Set array method
8269         from being found.
8270
8271         Also fix bug which was causing the indices to be emitted in the reverse
8272         order.
8273
8274 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
8275
8276         * expression.cs (ArrayCreation): Implement the bits that Ravi left
8277         unfinished.  They do not work, because the underlying code is
8278         sloppy.
8279
8280 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8281
8282         * cs-parser.jay: Remove bogus fixme.
8283
8284         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
8285         on Switch statement.
8286         
8287 2001-11-23  Ravi Pratap  <ravi@ximian.com>
8288
8289         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
8290         the same. 
8291         
8292         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
8293         parameter. Apparently, any expression is allowed. 
8294
8295         (ValidateInitializers): Update accordingly.
8296
8297         (CheckIndices): Fix some tricky bugs thanks to recursion.
8298
8299         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
8300         I was being completely brain-dead.
8301
8302         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
8303         and re-write acordingly.
8304
8305         (DelegateInvocation): Re-write accordingly.
8306
8307         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
8308
8309         (MakeByteBlob): Handle types more correctly.
8310
8311         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
8312         initialization from expressions but it is incomplete because I am a complete
8313         Dodo :-|
8314
8315 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8316
8317         * statement.cs (If.Emit): Fix a bug that generated incorrect code
8318         on If.  Basically, we have to return `true' (ie, we do return to
8319         our caller) only if both branches of the if return.
8320
8321         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
8322         short-circuit operators, handle them as short circuit operators. 
8323
8324         (Cast.DoResolve): Resolve type.
8325         (Cast.Cast): Take an expression as the target type.
8326
8327         * cs-parser.jay (cast_expression): Remove old hack that only
8328         allowed a limited set of types to be handled.  Now we take a
8329         unary_expression and we resolve to a type during semantic
8330         analysis.
8331
8332         Use the grammar productions from Rhys to handle casts (this is
8333         not complete like Rhys syntax yet, we fail to handle that corner
8334         case that C# has regarding (-x), but we will get there.
8335         
8336 2001-11-22  Ravi Pratap  <ravi@ximian.com>
8337
8338         * class.cs (EmitFieldInitializer): Take care of the case when we have a
8339         field which is an array type.
8340
8341         * cs-parser.jay (declare_local_variables): Support array initialization too.
8342
8343         * typemanager.cs (MakeKey): Implement.
8344
8345         (everywhere): Use the above appropriately.
8346
8347         * cs-parser.jay (for_statement): Update for array initialization while
8348         declaring variables.
8349
8350         * ecore.cs : The error message was correct, it's the variable's names that
8351         were misleading ;-) Make the code more readable.
8352
8353         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
8354         the correct type etc.
8355
8356         (ConvertExplicit): Handle Enum types by examining the underlying type.
8357
8358 2001-11-21  Ravi Pratap  <ravi@ximian.com>
8359
8360         * parameter.cs (GetCallingConvention): Always return
8361         CallingConventions.Standard for now.
8362
8363 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8364
8365         * expression.cs (Binary.ResolveOperator): Update the values of `l'
8366         and `r' after calling DoNumericPromotions.
8367
8368         * ecore.cs: Fix error message (the types were in the wrong order).
8369
8370         * statement.cs (Foreach.ProbeCollectionType): Need to pass
8371         BindingFlags.Instance as well 
8372
8373         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
8374         implicit int literal conversion in an empty cast so that we
8375         propagate the right type upstream.
8376
8377         (UnboxCast): new class used to unbox value types.
8378         (Expression.ConvertExplicit): Add explicit type conversions done
8379         by unboxing.
8380
8381         (Expression.ImplicitNumericConversion): Oops, forgot to test for
8382         the target type before applying the implicit LongLiterals to ULong
8383         literal cast.
8384
8385 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
8386
8387         * cs-parser.jay (for_statement): Reworked the way For works: now
8388         we declare manually any variables that are introduced in
8389         for_initializer to solve the problem of having out-of-band code
8390         emition (that is what got for broken).
8391
8392         (declaration_statement): Perform the actual variable declaration
8393         that used to be done in local_variable_declaration here.
8394
8395         (local_variable_declaration): Do not declare anything, just pass
8396         the information on a DictionaryEntry
8397
8398 2001-11-20  Ravi Pratap  <ravi@ximian.com>
8399
8400         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
8401         re-write of the logic to now make it recursive.
8402
8403         (UpdateIndices): Re-write accordingly.
8404
8405         Store element data in a separate ArrayData list in the above methods.
8406
8407         (MakeByteBlob): Implement to dump the array data into a byte array.
8408
8409 2001-11-19  Ravi Pratap  <ravi@ximian.com>
8410
8411         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
8412         into CheckIndices.
8413
8414         * constant.cs (Define): Implement.
8415
8416         (EmitConstant): Re-write fully.
8417
8418         Pass in location info.
8419
8420         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
8421         respectively.
8422
8423         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
8424         DictionaryEntry since we need location info too.
8425
8426         (constant_declaration): Update accordingly.
8427
8428         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
8429         code into another method : UpdateIndices.
8430
8431 2001-11-18  Ravi Pratap  <ravi@ximian.com>
8432
8433         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
8434         some type checking etc.
8435
8436 2001-11-17  Ravi Pratap  <ravi@ximian.com>
8437
8438         * expression.cs (ArrayCreation::ValidateInitializers): Implement
8439         bits to provide dimension info if the user skips doing that.
8440
8441         Update second constructor to store the rank correctly.
8442
8443 2001-11-16  Ravi Pratap  <ravi@ximian.com>
8444
8445         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
8446         and try to implement.
8447
8448         * ../errors/cs0150.cs : Add.
8449
8450         * ../errors/cs0178.cs : Add.
8451
8452 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
8453
8454         * statement.cs: Implement foreach on multi-dimensional arrays. 
8455
8456         * parameter.cs (Parameters.GetParameterByName): Also lookup the
8457         name of the params argument.
8458
8459         * expression.cs: Use EmitStoreOpcode to get the right opcode while
8460         initializing the array.
8461
8462         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
8463         we can use this elsewhere.
8464
8465         * statement.cs: Finish implementation of foreach for single
8466         dimension arrays.
8467
8468         * cs-parser.jay: Use an out-of-band stack to pass information
8469         around, I wonder why I need this.
8470
8471         foreach_block: Make the new foreach_block the current_block.
8472
8473         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
8474         function used to return a static Parameters structure.  Used for
8475         empty parameters, as those are created very frequently.
8476
8477         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
8478
8479 2001-11-15  Ravi Pratap  <ravi@ximian.com>
8480
8481         * interface.cs : Default modifier is private, not public. The
8482         make verify test passes again.
8483
8484 2001-11-15  Ravi Pratap  <ravi@ximian.com>
8485
8486         * support.cs (ReflectionParameters): Fix logic to determine
8487         whether the last parameter is a params one. Test 9 passes again.
8488
8489         * delegate.cs (Populate): Register the builders we define with
8490         RegisterParameterForBuilder. Test 19 passes again.
8491
8492         * cs-parser.jay (property_declaration): Reference $6 instead
8493         of $$ to get at the location.
8494
8495         (indexer_declaration): Similar stuff.
8496
8497         (attribute): Ditto.
8498
8499         * class.cs (Property): Register parameters for the Get and Set methods
8500         if they exist. Test 23 passes again.
8501
8502         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
8503         call to EmitArguments as we are sure there aren't any params arguments. 
8504         Test 32 passes again.
8505
8506         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
8507         IndexOutOfRangeException. 
8508
8509         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
8510         Test 33 now passes again.
8511         
8512 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
8513
8514         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
8515         broke a bunch of things.  Will have to come up with a better way
8516         of tracking locations.
8517
8518         * statement.cs: Implemented foreach for single dimension arrays.
8519
8520 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
8521
8522         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
8523         an error.  This removes the lookup from the critical path.
8524
8525         * cs-parser.jay: Removed use of temporary_loc, which is completely
8526         broken. 
8527
8528 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
8529
8530         * support.cs (ReflectionParameters.ParameterModifier): Report
8531         whether the argument is a PARAMS argument or not.
8532
8533         * class.cs: Set the attribute `ParamArrayAttribute' on the
8534         parameter argument.
8535
8536         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
8537         and cons_param_array_attribute (ConstructorInfo for
8538         ParamArrayAttribute)., 
8539
8540         * codegen.cs: Emit the return using the `Return' statement, that
8541         way we can report the error correctly for missing return values. 
8542
8543         * class.cs (Method.Emit): Clean up.
8544
8545         * expression.cs (Argument.Resolve): Take another argument: the
8546         location where this argument is used.  Notice that this is not
8547         part of the "Argument" class as to reduce the size of the
8548         structure (we know the approximate location anyways).
8549
8550         Test if the argument is a variable-reference, if not, then
8551         complain with a 206.
8552
8553         (Argument.Emit): Emit addresses of variables.
8554
8555         (Argument.FullDesc): Simplify.
8556
8557         (Invocation.DoResolve): Update for Argument.Resolve.
8558
8559         (ElementAccess.DoResolve): ditto.
8560
8561         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
8562         method should be virtual, as this method is always virtual.
8563
8564         (NewDelegate.DoResolve): Update for Argument.Resolve.
8565
8566         * class.cs (ConstructorInitializer.DoResolve): ditto.
8567         
8568         * attribute.cs (Attribute.Resolve): ditto.
8569
8570 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
8571
8572         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
8573
8574         * expression.cs (ParameterReference): Drop IStackStorage and implement
8575         IAssignMethod instead. 
8576
8577         (LocalVariableReference): ditto.
8578         
8579         * ecore.cs (FieldExpr): Drop IStackStorage and implement
8580         IAssignMethod instead. 
8581
8582 2001-11-13  Miguel de Icaza <miguel@ximian.com>
8583
8584         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
8585         enumerations that are used in heavily used structures derive from
8586         byte in a laughable and pathetic attempt to reduce memory usage.
8587         This is the kind of pre-optimzations that you should not do at
8588         home without adult supervision.
8589
8590         * expression.cs (UnaryMutator): New class, used to handle ++ and
8591         -- separatedly from the other unary operators.  Cleans up the
8592         code, and kills the ExpressionStatement dependency in Unary.
8593
8594         (Unary): Removed `method' and `Arguments' from this class, making
8595         it smaller, and moving it all to SimpleCall, so I can reuse this
8596         code in other locations and avoid creating a lot of transient data
8597         strucutres when not required.
8598
8599         * cs-parser.jay: Adjust for new changes.
8600
8601 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
8602
8603         * enum.cs (Enum.Populate): If there is a failure during
8604         definition, return
8605
8606         * cs-parser.jay (opt_enum_base): we used to catch type errors
8607         here, but this is really incorrect.  The type error should be
8608         catched during semantic analysis.
8609
8610 2001-12-11  Ravi Pratap  <ravi@ximian.com>
8611
8612         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
8613         current_local_parameters as expected since I, in my stupidity, had forgotten
8614         to do this :-)
8615
8616         * attribute.cs (GetValidPlaces): Fix stupid bug.
8617
8618         * class.cs (Method::Emit): Perform check on applicability of attributes.
8619
8620         (Constructor::Emit): Ditto.
8621
8622         (Field::Emit): Ditto.
8623
8624         (Field.Location): Store location information.
8625
8626         (Property, Event, Indexer, Operator): Ditto.
8627
8628         * cs-parser.jay (field_declaration): Pass in location for each field.
8629
8630         * ../errors/cs0592.cs : Add.
8631
8632 2001-11-12  Ravi Pratap  <ravi@ximian.com>
8633
8634         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
8635
8636         (InitCoreTypes): Update accordingly.
8637
8638         (RegisterAttrType, LookupAttr): Implement.
8639
8640         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
8641         info about the same.
8642
8643         (Resolve): Update to populate the above as necessary.
8644
8645         (Error592): Helper.
8646
8647         (GetValidPlaces): Helper to the above.
8648
8649         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
8650
8651         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
8652
8653 2001-11-12  Ravi Pratap  <ravi@ximian.com>
8654
8655         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
8656
8657         * ../errors/cs0617.cs : Add.
8658
8659 2001-11-11  Ravi Pratap  <ravi@ximian.com>
8660
8661         * enum.cs (Emit): Rename to Populate to be more consistent with what
8662         we expect it to do and when exactly it is called.
8663
8664         * class.cs, rootcontext.cs : Update accordingly.
8665
8666         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
8667         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
8668
8669         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
8670
8671         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
8672         of a fieldinfo using the above, when dealing with a FieldBuilder.
8673
8674 2001-11-10  Ravi Pratap  <ravi@ximian.com>
8675
8676         * ../errors/cs0031.cs : Add.
8677
8678         * ../errors/cs1008.cs : Add.
8679
8680         * ../errrors/cs0543.cs : Add.
8681
8682         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
8683         enum type.
8684
8685         (FindMembers): Implement.
8686
8687         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
8688         enums and delegates too.
8689
8690         (enum_types): Rename to builder_to_enum.
8691
8692         (delegate_types): Rename to builder_to_delegate.
8693
8694         * delegate.cs (FindMembers): Implement.
8695
8696 2001-11-09  Ravi Pratap  <ravi@ximian.com>
8697
8698         * typemanager.cs (IsEnumType): Implement.
8699
8700         * enum.cs (Emit): Re-write parts to account for the underlying type
8701         better and perform checking etc.
8702
8703         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
8704         of the underlying type.
8705
8706         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
8707         value
8708
8709         * enum.cs (error31): Helper to report error #31.
8710
8711         * cs-parser.jay (enum_declaration): Store location of each member too.
8712
8713         * enum.cs (member_to_location): New hashtable. 
8714
8715         (AddEnumMember): Update location hashtable.
8716
8717         (Emit): Use the location of each member while reporting errors.
8718
8719 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
8720
8721         * cs-parser.jay: A for_initializer if is a
8722         local_variable_declaration really ammount to have an implicit
8723         block with the variable declaration and no initializer for for.
8724
8725         * statement.cs (For.Emit): Cope with null initializers.
8726
8727         This fixes the infinite loop on for initializers.
8728
8729 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
8730
8731         * enum.cs: More cleanup.
8732
8733         * ecore.cs: Remove dead code.
8734
8735         * class.cs (Property.Emit): More simplification.
8736         (Event.Emit): ditto.
8737
8738         Reworked to have less levels of indentation.
8739         
8740 2001-11-08  Ravi Pratap  <ravi@ximian.com>
8741
8742         * class.cs (Property): Emit attributes.
8743
8744         (Field): Ditto.
8745         
8746         (Event): Ditto.
8747
8748         (Indexer): Ditto.
8749
8750         (Operator): Ditto.
8751
8752         * enum.cs (Emit): Ditto.
8753
8754         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
8755         Enums too.
8756
8757         * class.cs (Field, Event, etc.): Move attribute generation into the
8758         Emit method everywhere.
8759
8760         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
8761         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
8762         as we had no way of defining nested enums !
8763
8764         * rootcontext.cs : Adjust code accordingly.
8765
8766         * typemanager.cs (AddEnumType): To keep track of enum types separately.
8767
8768 2001-11-07  Ravi Pratap  <ravi@ximian.com>
8769
8770         * expression.cs (EvalConstantExpression): Move into ecore.cs
8771         
8772         * enum.cs (Enum): Rename some members and make them public and readonly
8773         according to our convention.
8774
8775         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
8776         nothing else.
8777
8778         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
8779
8780         (Enum::Emit): Write a simple version for now which doesn't try to compute
8781         expressions. I shall modify this to be more robust in just a while.
8782
8783         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
8784
8785         (TypeContainer::CloseType): Create the Enum types too.
8786
8787         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
8788
8789         * expression.cs (EvalConstantExpression): Get rid of completely.
8790
8791         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
8792         user-defined values and other cases.
8793
8794         (IsValidEnumLiteral): Helper function.
8795
8796         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
8797         out there in the case we had a literal FieldExpr.
8798
8799         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
8800
8801         (Literalize): Revamp a bit to take two arguments.
8802         
8803         (EnumLiteral): New class which derives from Literal to wrap enum literals.
8804         
8805 2001-11-06  Ravi Pratap  <ravi@ximian.com>
8806
8807         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
8808
8809         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
8810
8811         (Resolve): Use the above to ensure we have proper initializers.
8812
8813 2001-11-05  Ravi Pratap  <ravi@ximian.com>
8814
8815         * expression.cs (Expression::EvalConstantExpression): New method to 
8816         evaluate constant expressions.
8817
8818         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
8819
8820 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
8821
8822         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
8823         in an array.
8824
8825         (Binary.ResolveOperator): Handle operator != (object a, object b)
8826         and operator == (object a, object b);
8827
8828         (Binary.DoNumericPromotions): Indicate whether the numeric
8829         promotion was possible.
8830
8831         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
8832         Implement.  
8833
8834         Made the ArrayAccess implement interface IAssignMethod instead of
8835         IStackStore as the order in which arguments are passed reflects
8836         this.
8837
8838         * assign.cs: Instead of using expr.ExprClass to select the way of
8839         assinging, probe for the IStackStore/IAssignMethod interfaces.
8840
8841         * typemanager.cs: Load InitializeArray definition.
8842
8843         * rootcontext.cs (RootContext.MakeStaticData): Used to define
8844         static data that can be used to initialize arrays. 
8845
8846 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
8847
8848         * expression.cs: Handle operator== and operator!= for booleans.
8849
8850         (Conditioal.Reduce): Implement reducer for the ?: operator.
8851
8852         (Conditional.Resolve): Implement dead code elimination.
8853
8854         (Binary.Resolve): Catch string literals and return a new
8855         concatenated string.
8856
8857         (Unary.Reduce): Implement reduction of unary expressions.
8858
8859         * ecore.cs: Split out the expression core handling here.
8860
8861         (Expression.Reduce): New method used to perform constant folding
8862         and CSE.  This is needed to support constant-expressions. 
8863         
8864         * statement.cs (Statement.EmitBoolExpression): Pass true and false
8865         targets, and optimize for !x.
8866
8867 2001-11-04  Ravi Pratap  <ravi@ximian.com>
8868
8869         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
8870         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
8871         set custom atttributes.
8872
8873         * literal.cs (Literal::GetValue): New abstract method to return the actual
8874         value of the literal, cast as an object.
8875
8876         (*Literal): Implement GetValue method.
8877
8878         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
8879         expressions to the arraylist but objects of type Argument.
8880
8881         * class.cs (TypeContainer::Emit): Emit our attributes too.
8882
8883         (Method::Emit, Constructor::Emit): Ditto.
8884
8885         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
8886         to be ignoring earlier.
8887
8888 2001-11-03  Ravi Pratap  <ravi@ximian.com>
8889
8890         * attribute.cs (AttributeSection::Define): Implement to do the business
8891         of constructing a CustomAttributeBuilder.
8892
8893         (Attribute): New trivial class. Increases readability of code.  
8894
8895         * cs-parser.jay : Update accordingly.
8896
8897         (positional_argument_list, named_argument_list, named_argument): New rules
8898
8899         (attribute_arguments): Use the above so that we are more correct.
8900         
8901 2001-11-02  Ravi Pratap  <ravi@ximian.com>
8902         
8903         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
8904         to perform all checks for a method with a params parameter.
8905
8906         (Invocation::OverloadResolve): Update to use the above method and therefore
8907         cope correctly with params method invocations.
8908
8909         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
8910         params too.
8911
8912         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
8913         constructors in our parent too because we can't afford to miss out on 
8914         protected ones ;-)
8915
8916         * attribute.cs (AttributeSection): New name for the class Attribute
8917
8918         Other trivial changes to improve readability.
8919
8920         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
8921         use the new class names.
8922         
8923 2001-11-01  Ravi Pratap  <ravi@ximian.com>
8924
8925         * class.cs (Method::Define): Complete definition for params types too
8926
8927         (Indexer::Define): Ditto.
8928
8929         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
8930         Cope everywhere with a request for info about the array parameter.
8931
8932 2001-11-01  Ravi Pratap  <ravi@ximian.com>
8933
8934         * tree.cs (RecordNamespace): Fix up to check for the correct key.
8935
8936         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
8937         local_variable_type to extract the string corresponding to the type.
8938
8939         (local_variable_type): Fixup the action to use the new helper method.
8940
8941         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
8942         go.
8943
8944         * expression.cs : Clean out code which uses the above.
8945
8946 2001-10-31  Ravi Pratap  <ravi@ximian.com>
8947         
8948         * typemanager.cs (RegisterMethod): Check if we already have an existing key
8949         and bale out if necessary by returning a false.
8950
8951         (RegisterProperty): Ditto.
8952
8953         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
8954         and print out appropriate error messages.
8955
8956         * interface.cs (everywhere): Ditto.
8957
8958         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
8959         location to constructor.
8960
8961         * class.cs (Property, Event, Indexer): Update accordingly.
8962
8963         * ../errors/cs111.cs : Added.
8964
8965         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
8966         of a method, as laid down by the spec.
8967
8968         (Invocation::OverloadResolve): Use the above method.
8969
8970 2001-10-31  Ravi Pratap  <ravi@ximian.com>
8971
8972         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
8973         now take a TypeContainer and a Parameters object.
8974
8975         (ParameterData): Modify return type of ParameterModifier method to be 
8976         Parameter.Modifier and not a string.
8977
8978         (ReflectionParameters, InternalParameters): Update accordingly.
8979
8980         * expression.cs (Argument::GetParameterModifier): Same here.
8981
8982         * support.cs (InternalParameters::ParameterType): Find a better way of determining
8983         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
8984         symbol in it at all so maybe this is only for now.
8985
8986 2001-10-30  Ravi Pratap  <ravi@ximian.com>
8987
8988         * support.cs (InternalParameters): Constructor now takes an extra argument 
8989         which is the actual Parameters class.
8990
8991         (ParameterDesc): Update to provide info on ref/out modifiers.
8992
8993         * class.cs (everywhere): Update call to InternalParameters to pass in
8994         the second argument too.
8995
8996         * support.cs (ParameterData): Add ParameterModifier, which is a method 
8997         to return the modifier info [ref/out etc]
8998
8999         (InternalParameters, ReflectionParameters): Implement the above.
9000
9001         * expression.cs (Argument::ParameterModifier): Similar function to return
9002         info about the argument's modifiers.
9003
9004         (Invocation::OverloadResolve): Update to take into account matching modifiers 
9005         too.
9006
9007         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
9008         a new SetFormalParameters object which we pass to InternalParameters.
9009
9010 2001-10-30  Ravi Pratap  <ravi@ximian.com>
9011
9012         * expression.cs (NewArray): Merge into the ArrayCreation class.
9013
9014 2001-10-29  Ravi Pratap  <ravi@ximian.com>
9015
9016         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
9017         NewUserdefinedArray into one as there wasn't much of a use in having
9018         two separate ones.
9019
9020         * expression.cs (Argument): Change field's name to ArgType from Type.
9021
9022         (Type): New readonly property which returns the proper type, taking into 
9023         account ref/out modifiers.
9024
9025         (everywhere): Adjust code accordingly for the above.
9026
9027         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
9028         whether we are emitting for a ref or out parameter.
9029
9030         * expression.cs (Argument::Emit): Use the above field to set the state.
9031
9032         (LocalVariableReference::Emit): Update to honour the flag and emit the
9033         right stuff.
9034
9035         * parameter.cs (Attributes): Set the correct flags for ref parameters.
9036
9037         * expression.cs (Argument::FullDesc): New function to provide a full desc.
9038
9039         * support.cs (ParameterData): Add method ParameterDesc to the interface.
9040
9041         (ReflectionParameters, InternalParameters): Implement the above method.
9042
9043         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
9044         reporting errors.
9045
9046         (Invocation::FullMethodDesc): Ditto. 
9047
9048 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
9049
9050         * cs-parser.jay: Add extra production for the second form of array
9051         creation. 
9052
9053         * expression.cs (ArrayCreation): Update to reflect the above
9054         change. 
9055
9056         * Small changes to prepare for Array initialization.
9057
9058 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
9059
9060         * typemanager.cs (ImplementsInterface): interface might be null;
9061         Deal with this problem;
9062
9063         Also, we do store negative hits on the cache (null values), so use
9064         this instead of calling t.GetInterfaces on the type everytime.
9065
9066 2001-10-28  Ravi Pratap  <ravi@ximian.com>
9067
9068         * typemanager.cs (IsBuiltinType): New method to help determine the same.
9069
9070         * expression.cs (New::DoResolve): Get rid of array creation code and instead
9071         split functionality out into different classes.
9072
9073         (New::FormArrayType): Move into NewBuiltinArray.
9074
9075         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
9076         quite useless.
9077
9078         (NewBuiltinArray): New class to handle creation of built-in arrays.
9079
9080         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
9081         account creation of one-dimensional arrays.
9082
9083         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
9084
9085         (NewUserdefinedArray::DoResolve): Implement.
9086
9087         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
9088
9089         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
9090         we maintain inside the TypeManager. This is necessary to perform lookups on the
9091         module builder.
9092
9093         (LookupType): Update to perform GetType on the module builders too.     
9094
9095         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
9096
9097         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
9098
9099 2001-10-23  Ravi Pratap  <ravi@ximian.com>
9100
9101         * expression.cs (New::DoResolve): Implement guts of array creation.
9102
9103         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
9104         
9105 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
9106
9107         * expression.cs: Fix bug I introduced lsat night that broke
9108         Delegates. 
9109
9110         (Expression.Resolve): Report a 246 error (can not resolve name)
9111         if we find a SimpleName in the stream.
9112         
9113         (Expression.ResolveLValue): Ditto.
9114         
9115         (Expression.ResolveWithSimpleName): This function is a variant of
9116         ResolveName, this one allows SimpleNames to be returned without a
9117         warning.  The only consumer of SimpleNames is MemberAccess
9118
9119 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
9120
9121         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
9122         might arrive here.  I have my doubts that this is correct.
9123
9124         * statement.cs (Lock): Implement lock statement.
9125
9126         * cs-parser.jay: Small fixes to support `lock' and `using'
9127
9128         * cs-tokenizer.cs: Remove extra space
9129
9130         * driver.cs: New flag --checked, allows to turn on integer math
9131         checking. 
9132
9133         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
9134         Threading.Monitor.Exit 
9135         
9136 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
9137
9138         * expression.cs (IndexerAccess::DoResolveLValue): Set the
9139         Expression Class to be IndexerAccess.
9140
9141         Notice that Indexer::DoResolve sets the eclass to Value.
9142
9143 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
9144
9145         * class.cs (TypeContainer::Emit): Emit code for indexers.
9146
9147         * assign.cs (IAssignMethod): New interface implemented by Indexers
9148         and Properties for handling assignment.
9149
9150         (Assign::Emit): Simplify and reuse code. 
9151         
9152         * expression.cs (IndexerAccess, PropertyExpr): Implement
9153         IAssignMethod, clean up old code. 
9154
9155 2001-10-22  Ravi Pratap  <ravi@ximian.com>
9156
9157         * typemanager.cs (ImplementsInterface): New method to determine if a type
9158         implements a given interface. Provides a nice cache too.
9159
9160         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
9161         method.
9162
9163         (ConvertReferenceExplicit): Ditto.
9164
9165         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
9166         various methods, with correct names etc.
9167
9168         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
9169         Operator.UnaryNegation.
9170
9171         * cs-parser.jay (operator_declarator): Be a little clever in the case where
9172         we have a unary plus or minus operator.
9173
9174         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
9175         UnaryMinus.
9176
9177         * everywhere : update accordingly.
9178
9179         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
9180         respectively.
9181
9182         * class.cs (Method::Define): For the case where we are implementing a method
9183         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
9184         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
9185         
9186 2001-10-21  Ravi Pratap  <ravi@ximian.com>
9187
9188         * interface.cs (FindMembers): Implement to work around S.R.E
9189         lameness.
9190
9191         * typemanager.cs (IsInterfaceType): Implement.
9192
9193         (FindMembers): Update to handle interface types too.
9194
9195         * expression.cs (ImplicitReferenceConversion): Re-write bits which
9196         use IsAssignableFrom as that is not correct - it doesn't work.
9197
9198         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
9199         and accordingly override EmitStatement.
9200
9201         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
9202         using the correct logic :-)
9203
9204 2001-10-19  Ravi Pratap  <ravi@ximian.com>
9205
9206         * ../errors/cs-11.cs : Add to demonstrate error -11 
9207
9208 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
9209
9210         * assign.cs (Assign::Resolve): Resolve right hand side first, and
9211         then pass this as a hint to ResolveLValue.
9212         
9213         * expression.cs (FieldExpr): Add Location information
9214
9215         (FieldExpr::LValueResolve): Report assignment to readonly
9216         variable. 
9217         
9218         (Expression::ExprClassFromMemberInfo): Pass location information.
9219
9220         (Expression::ResolveLValue): Add new method that resolves an
9221         LValue. 
9222
9223         (Expression::DoResolveLValue): Default invocation calls
9224         DoResolve. 
9225
9226         (Indexers): New class used to keep track of indexers in a given
9227         Type. 
9228
9229         (IStackStore): Renamed from LValue, as it did not really describe
9230         what this did.  Also ResolveLValue is gone from this interface and
9231         now is part of Expression.
9232
9233         (ElementAccess): Depending on the element access type
9234         
9235         * typemanager.cs: Add `indexer_name_type' as a Core type
9236         (System.Runtime.CompilerServices.IndexerNameAttribute)
9237
9238         * statement.cs (Goto): Take a location.
9239         
9240 2001-10-18  Ravi Pratap  <ravi@ximian.com>
9241
9242         * delegate.cs (Delegate::VerifyDelegate): New method to verify
9243         if two delegates are compatible.
9244
9245         (NewDelegate::DoResolve): Update to take care of the case when
9246         we instantiate a delegate from another delegate.
9247
9248         * typemanager.cs (FindMembers): Don't even try to look up members
9249         of Delegate types for now.
9250
9251 2001-10-18  Ravi Pratap  <ravi@ximian.com>
9252
9253         * delegate.cs (NewDelegate): New class to take care of delegate
9254         instantiation.
9255
9256         * expression.cs (New): Split the delegate related code out into 
9257         the NewDelegate class.
9258
9259         * delegate.cs (DelegateInvocation): New class to handle delegate 
9260         invocation.
9261
9262         * expression.cs (Invocation): Split out delegate related code into
9263         the DelegateInvocation class.
9264
9265 2001-10-17  Ravi Pratap  <ravi@ximian.com>
9266
9267         * expression.cs (New::DoResolve): Implement delegate creation fully
9268         and according to the spec.
9269
9270         (New::DoEmit): Update to handle delegates differently.
9271
9272         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
9273         because of which we were printing out arguments in reverse order !
9274
9275         * delegate.cs (VerifyMethod): Implement to check if the given method
9276         matches the delegate.
9277
9278         (FullDelegateDesc): Implement.
9279
9280         (VerifyApplicability): Implement.
9281
9282         * expression.cs (Invocation::DoResolve): Update to accordingly handle
9283         delegate invocations too.
9284
9285         (Invocation::Emit): Ditto.
9286
9287         * ../errors/cs1593.cs : Added.
9288
9289         * ../errors/cs1594.cs : Added.
9290
9291         * delegate.cs (InstanceExpression, TargetMethod): New properties.
9292
9293 2001-10-16  Ravi Pratap  <ravi@ximian.com>
9294
9295         * typemanager.cs (intptr_type): Core type for System.IntPtr
9296
9297         (InitCoreTypes): Update for the same.
9298
9299         (iasyncresult_type, asynccallback_type): Ditto.
9300
9301         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
9302         correct.
9303
9304         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
9305         too.
9306
9307         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
9308         the builders for the 4 members of a delegate type :-)
9309
9310         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
9311         type.
9312
9313         * expression.cs (New::DoResolve): Implement guts for delegate creation.
9314
9315         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
9316
9317 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
9318
9319         * statement.cs (Break::Emit): Implement.   
9320         (Continue::Emit): Implement.
9321
9322         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9323         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9324         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9325         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
9326         end loop
9327         
9328         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
9329         properties that track the label for the current loop (begin of the
9330         loop and end of the loop).
9331
9332 2001-10-15  Ravi Pratap  <ravi@ximian.com>
9333
9334         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
9335         use of emitting anything at all.
9336
9337         * class.cs, rootcontext.cs : Get rid of calls to the same.
9338
9339         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
9340
9341         (Populate): Define the constructor correctly and set the implementation
9342         attributes.
9343
9344         * typemanager.cs (delegate_types): New hashtable to hold delegates that
9345         have been defined.
9346
9347         (AddDelegateType): Implement.
9348
9349         (IsDelegateType): Implement helper method.
9350
9351         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
9352
9353         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
9354         and accordingly handle it.
9355
9356         * delegate.cs (Populate): Take TypeContainer argument.
9357         Implement bits to define the Invoke method. However, I still haven't figured out
9358         how to take care of the native int bit :-(
9359
9360         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
9361         Qualify the name of the delegate, not its return type !
9362
9363         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
9364         conversion.
9365
9366         (StandardConversionExists): Checking for array types turns out to be recursive.
9367
9368         (ConvertReferenceExplicit): Implement array conversion.
9369
9370         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
9371         
9372 2001-10-12  Ravi Pratap  <ravi@ximian.com>
9373
9374         * cs-parser.jay (delegate_declaration): Store the fully qualified
9375         name as it is a type declaration.
9376
9377         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
9378         readonly.
9379
9380         (DefineDelegate): Renamed from Define. Does the same thing essentially,
9381         as TypeContainer::DefineType.
9382
9383         (Populate): Method in which all the definition of the various methods (Invoke)
9384         etc is done.
9385
9386         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
9387         see.
9388         
9389         (CloseDelegate): Finally creates the delegate.
9390
9391         * class.cs (TypeContainer::DefineType): Update to define delegates.
9392         (Populate, Emit and CloseType): Do the same thing here too.
9393
9394         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
9395         delegates in all these operations.
9396
9397 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
9398
9399         * expression.cs: LocalTemporary: a new expression used to
9400         reference a temporary that has been created.
9401
9402         * assign.cs: Handle PropertyAccess back here, so that we can
9403         provide the proper semantic access to properties.
9404
9405         * expression.cs (Expression::ConvertReferenceExplicit): Implement
9406         a few more explicit conversions. 
9407
9408         * modifiers.cs: `NEW' modifier maps to HideBySig.
9409
9410         * expression.cs (PropertyExpr): Make this into an
9411         ExpressionStatement, and support the EmitStatement code path. 
9412
9413         Perform get/set error checking, clean up the interface.
9414
9415         * assign.cs: recognize PropertyExprs as targets, and if so, turn
9416         them into toplevel access objects.
9417
9418 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
9419
9420         * expression.cs: PropertyExpr::PropertyExpr: use work around the
9421         SRE.
9422
9423         * typemanager.cs: Keep track here of our PropertyBuilders again to
9424         work around lameness in SRE.
9425
9426 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
9427
9428         * expression.cs (LValue::LValueResolve): New method in the
9429         interface, used to perform a second resolution pass for LValues. 
9430         
9431         (This::DoResolve): Catch the use of this in static methods.
9432
9433         (This::LValueResolve): Implement.
9434
9435         (This::Store): Remove warning, assigning to `this' in structures
9436         is 
9437
9438         (Invocation::Emit): Deal with invocation of
9439         methods on value types.  We need to pass the address to structure
9440         methods rather than the object itself.  (The equivalent code to
9441         emit "this" for structures leaves the entire structure on the
9442         stack instead of a pointer to it). 
9443
9444         (ParameterReference::DoResolve): Compute the real index for the
9445         argument based on whether the method takes or not a `this' pointer
9446         (ie, the method is static).
9447
9448         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
9449         value types returned from functions when we need to invoke a
9450         method on the sturcture.
9451         
9452
9453 2001-10-11  Ravi Pratap  <ravi@ximian.com>
9454
9455         * class.cs (TypeContainer::DefineType): Method to actually do the business of
9456         defining the type in the Modulebuilder or Typebuilder. This is to take
9457         care of nested types which need to be defined on the TypeBuilder using
9458         DefineNestedMethod.
9459
9460         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
9461         methods in RootContext, only ported to be part of TypeContainer.
9462
9463         (TypeContainer::GetInterfaceOrClass): Ditto.
9464
9465         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
9466
9467         * interface.cs (Interface::DefineInterface): New method. Does exactly
9468         what RootContext.CreateInterface did earlier, only it takes care of nested types 
9469         too.
9470
9471         (Interface::GetInterfaces): Move from RootContext here and port.
9472
9473         (Interface::GetInterfaceByName): Same here.
9474
9475         * rootcontext.cs (ResolveTree): Re-write.
9476
9477         (PopulateTypes): Re-write.
9478
9479         * class.cs (TypeContainer::Populate): Populate nested types too.
9480         (TypeContainer::Emit): Emit nested members too.
9481
9482         * typemanager.cs (AddUserType): Do not make use of the FullName property,
9483         instead just use the name argument passed in as it is already fully
9484         qualified.
9485
9486         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
9487         to TypeContainer mapping to see if a type is user-defined.
9488
9489         * class.cs (TypeContainer::CloseType): Implement. 
9490
9491         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
9492         the default constructor.
9493         
9494         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
9495         twice.
9496
9497         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
9498
9499         * interface.cs (CloseType): Create the type here.
9500         
9501         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
9502         the hierarchy.
9503
9504         Remove all the methods which are now in TypeContainer.
9505
9506 2001-10-10  Ravi Pratap  <ravi@ximian.com>
9507
9508         * delegate.cs (Define): Re-write bits to define the delegate
9509         correctly.
9510
9511 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
9512
9513         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
9514
9515         * expression.cs (ImplicitReferenceConversion): handle null as well
9516         as a source to convert to any reference type.
9517
9518         * statement.cs (Return): Perform any implicit conversions to
9519         expected return type.  
9520
9521         Validate use of return statement.  
9522
9523         * codegen.cs (EmitContext): Pass the expected return type here.
9524
9525         * class.cs (Method, Constructor, Property): Pass expected return
9526         type to EmitContext.
9527
9528 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
9529
9530         * expression.cs: Make DoResolve take an EmitContext instead of a
9531         TypeContainer.
9532
9533         Replaced `l' and `location' for `loc', for consistency.
9534         
9535         (Error, Warning): Remove unneeded Tc argument.
9536
9537         * assign.cs, literal.cs, constant.cs: Update to new calling
9538         convention. 
9539         
9540         * codegen.cs: EmitContext now contains a flag indicating whether
9541         code is being generated in a static method or not.
9542
9543         * cs-parser.jay: DecomposeQI, new function that replaces the old
9544         QualifiedIdentifier.  Now we always decompose the assembled
9545         strings from qualified_identifier productions into a group of
9546         memberaccesses.
9547
9548 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
9549
9550         * rootcontext.cs: Deal with field-less struct types correctly now
9551         by passing the size option to Define Type.
9552
9553         * class.cs: Removed hack that created one static field. 
9554
9555 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
9556
9557         * statement.cs: Moved most of the code generation here. 
9558
9559 2001-10-09  Ravi Pratap  <ravi@ximian.com>
9560
9561         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
9562         seem very right.
9563
9564         (ElementAccess): Remove useless bits for now - keep checks as the spec
9565         says.
9566
9567 2001-10-08  Ravi Pratap  <ravi@ximian.com>
9568
9569         * expression.cs (ElementAccess::DoResolve): Remove my crap code
9570         and start performing checks according to the spec.
9571
9572 2001-10-07  Ravi Pratap  <ravi@ximian.com>
9573
9574         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
9575         rank_specifiers instead.
9576
9577         (rank_specifiers): Change the order in which the rank specifiers are stored
9578
9579         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
9580
9581         * expression.cs (ElementAccess): Implement the LValue interface too.
9582         
9583 2001-10-06  Ravi Pratap  <ravi@ximian.com>
9584         
9585         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
9586         except that user defined conversions are not included.
9587
9588         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
9589         perform the conversion of the return type, if necessary.
9590
9591         (New::DoResolve): Check whether we are creating an array or an object
9592         and accordingly do the needful.
9593
9594         (New::Emit): Same here.
9595
9596         (New::DoResolve): Implement guts of array creation.
9597
9598         (New::FormLookupType): Helper function.
9599
9600 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
9601
9602         * codegen.cs: Removed most of the code generation here, and move the
9603         corresponding code generation bits to the statement classes. 
9604
9605         Added support for try/catch/finalize and throw.
9606         
9607         * cs-parser.jay: Added support for try/catch/finalize.
9608
9609         * class.cs: Catch static methods having the flags override,
9610         virtual or abstract.
9611
9612         * expression.cs (UserCast): This user cast was not really doing
9613         what it was supposed to do.  Which is to be born in fully resolved
9614         state.  Parts of the resolution were being performed at Emit time! 
9615
9616         Fixed this code.
9617
9618 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
9619
9620         * expression.cs: Implicity convert the result from UserCast.
9621
9622 2001-10-05  Ravi Pratap  <ravi@ximian.com>
9623
9624         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
9625         prevented it from working correctly. 
9626
9627         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
9628         merely ConvertImplicit.
9629
9630 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
9631
9632         * typemanager.cs: Make the LookupTypeContainer function static,
9633         and not per-instance.  
9634
9635         * class.cs: Make static FindMembers (the one that takes a Type
9636         argument). 
9637
9638         * codegen.cs: Add EmitForeach here.
9639
9640         * cs-parser.jay: Make foreach a toplevel object instead of the
9641         inline expansion, as we need to perform semantic analysis on it. 
9642
9643 2001-10-05  Ravi Pratap  <ravi@ximian.com>
9644
9645         * expression.cs (Expression::ImplicitUserConversion): Rename to
9646         UserDefinedConversion.
9647
9648         (Expression::UserDefinedConversion): Take an extra argument specifying 
9649         whether we look for explicit user conversions too.
9650
9651         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
9652
9653         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
9654
9655         (ExplicitUserConversion): Make it a call to UserDefinedConversion
9656         with the appropriate arguments.
9657
9658         * cs-parser.jay (cast_expression): Record location too.
9659
9660         * expression.cs (Cast): Record location info.
9661
9662         (Expression::ConvertExplicit): Take location argument.
9663
9664         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
9665         to determine if we are doing explicit conversions.
9666
9667         (UserCast::Emit): Update accordingly.
9668
9669         (Expression::ConvertExplicit): Report an error if everything fails.
9670
9671         * ../errors/cs0030.cs : Add.
9672
9673 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
9674
9675         * modifiers.cs: If the ABSTRACT keyword is present, also set the
9676         virtual and newslot bits. 
9677
9678         * class.cs (TypeContainer::RegisterRequiredImplementations):
9679         Record methods we need.
9680
9681         (TypeContainer::MakeKey): Helper function to make keys for
9682         MethodBases, since the Methodbase key is useless.
9683
9684         (TypeContainer::Populate): Call RegisterRequiredImplementations
9685         before defining the methods.   
9686
9687         Create a mapping for method_builders_to_methods ahead of time
9688         instead of inside a tight loop.
9689
9690         (::RequireMethods):  Accept an object as the data to set into the
9691         hashtable so we can report interface vs abstract method mismatch.
9692
9693 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
9694
9695         * report.cs: Make all of it static.
9696
9697         * rootcontext.cs: Drop object_type and value_type computations, as
9698         we have those in the TypeManager anyways.
9699
9700         Drop report instance variable too, now it is a global.
9701
9702         * driver.cs: Use try/catch on command line handling.
9703
9704         Add --probe option to debug the error reporting system with a test
9705         suite. 
9706
9707         * report.cs: Add support for exiting program when a probe
9708         condition is reached.
9709
9710 2001-10-03  Ravi Pratap  <ravi@ximian.com>
9711
9712         * expression.cs (Binary::DoNumericPromotions): Fix the case when
9713         we do a forcible conversion regardless of type, to check if 
9714         ForceConversion returns a null.
9715
9716         (Binary::error19): Use location to report error.
9717
9718         (Unary::error23): Use location here too.
9719
9720         * ../errors/cs0019.cs : Check in.
9721
9722         * ../errors/cs0023.cs : Check in.
9723
9724         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
9725         case of a non-null MethodInfo object with a length of 0 !
9726
9727         (Binary::ResolveOperator): Flag error if overload resolution fails to find
9728         an applicable member - according to the spec :-)
9729         Also fix logic to find members in base types.
9730
9731         (Unary::ResolveOperator): Same here.
9732
9733         (Unary::report23): Change name to error23 and make first argument a TypeContainer
9734         as I was getting thoroughly confused between this and error19 :-)
9735         
9736         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
9737         (::FindMostEncompassedType): Implement.
9738         (::FindMostEncompassingType): Implement.
9739         (::StandardConversionExists): Implement.
9740
9741         (UserImplicitCast): Re-vamp. We now need info about most specific
9742         source and target types so that we can do the necessary conversions.
9743
9744         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
9745         mathematical union with no duplicates.
9746
9747 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
9748
9749         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
9750         in order from base classes to child classes, so that we can in
9751         child classes look up in our parent for method names and
9752         attributes (required for handling abstract, virtual, new, override
9753         constructs: we need to instrospect our base class, and if we dont
9754         populate the classes in order, the introspection might be
9755         incorrect.  For example, a method could query its parent before
9756         the parent has any methods and would determine that the parent has
9757         no abstract methods (while it could have had them)).
9758
9759         (RootContext::CreateType): Record the order in which we define the
9760         classes.
9761
9762 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
9763
9764         * class.cs (TypeContainer::Populate): Also method definitions can
9765         fail now, keep track of this.
9766
9767         (TypeContainer::FindMembers): Implement support for
9768         DeclaredOnly/noDeclaredOnly flag.
9769
9770         (Constructor::Emit) Return the ConstructorBuilder.
9771
9772         (Method::Emit) Return the MethodBuilder. 
9773         Check for abstract or virtual methods to be public.
9774
9775         * rootcontext.cs (RootContext::CreateType): Register all the
9776         abstract methods required for the class to be complete and the
9777         interface methods that must be implemented. 
9778
9779         * cs-parser.jay: Report error 501 (method requires body if it is
9780         not marked abstract or extern).
9781
9782         * expression.cs (TypeOf::Emit): Implement.
9783
9784         * typemanager.cs: runtime_handle_type, new global type.
9785
9786         * class.cs (Property::Emit): Generate code for properties.
9787
9788 2001-10-02  Ravi Pratap  <ravi@ximian.com>
9789
9790         * expression.cs (Unary::ResolveOperator): Find operators on base type
9791         too - we now conform exactly to the spec.
9792
9793         (Binary::ResolveOperator): Same here.
9794
9795         * class.cs (Operator::Define): Fix minor quirk in the tests.
9796
9797         * ../errors/cs0215.cs : Added.
9798
9799         * ../errors/cs0556.cs : Added.
9800
9801         * ../errors/cs0555.cs : Added.
9802
9803 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
9804
9805         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
9806         single integer which is really efficient
9807
9808 2001-10-01  Ravi Pratap  <ravi@ximian.com>
9809
9810         *  expression.cs (Expression::ImplicitUserConversion): Use location
9811         even in the case when we are examining True operators.
9812  
9813         * class.cs (Operator::Define): Perform extensive checks to conform
9814         with the rules for operator overloading in the spec.
9815
9816         * expression.cs (Expression::ImplicitReferenceConversion): Implement
9817         some of the other conversions mentioned in the spec.
9818
9819         * typemanager.cs (array_type): New static member for the System.Array built-in
9820         type.
9821
9822         (cloneable_interface): For System.ICloneable interface.
9823
9824         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
9825         we start resolving the tree and populating types.
9826
9827         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
9828  
9829 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
9830
9831         * expression.cs (Expression::ExprClassFromMemberInfo,
9832         Expression::Literalize): Create literal expressions from
9833         FieldInfos which are literals.
9834
9835         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
9836         type casts, because they were wrong.  The test suite in tests
9837         caught these ones.
9838
9839         (ImplicitNumericConversion): ushort to ulong requires a widening
9840         cast. 
9841
9842         Int32 constant to long requires widening cast as well.
9843
9844         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
9845         for integers because the type on the stack is not i4.
9846
9847 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
9848
9849         * expression.cs (report118): require location argument. 
9850
9851         * parameter.cs: Do not dereference potential null value.
9852
9853         * class.cs: Catch methods that lack the `new' keyword when
9854         overriding a name.  Report warnings when `new' is used without
9855         anything being there to override.
9856
9857         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
9858
9859         * class.cs: Only add constructor to hashtable if it is non-null
9860         (as now constructors can fail on define).
9861
9862         (TypeManager, Class, Struct): Take location arguments.
9863
9864         Catch field instance initialization in structs as errors.
9865
9866         accepting_filter: a new filter for FindMembers that is static so
9867         that we dont create an instance per invocation.
9868
9869         (Constructor::Define): Catch errors where a struct constructor is
9870         parameterless 
9871
9872         * cs-parser.jay: Pass location information for various new
9873         constructs. 
9874         
9875         * delegate.cs (Delegate): take a location argument.
9876
9877         * driver.cs: Do not call EmitCode if there were problesm in the
9878         Definition of the types, as many Builders wont be there. 
9879
9880         * decl.cs (Decl::Decl): Require a location argument.
9881
9882         * cs-tokenizer.cs: Handle properly hex constants that can not fit
9883         into integers, and find the most appropiate integer for it.
9884
9885         * literal.cs: Implement ULongLiteral.
9886
9887         * rootcontext.cs: Provide better information about the location of
9888         failure when CreateType fails.
9889         
9890 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
9891
9892         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
9893         as well.
9894
9895         * expression.cs (Binary::CheckShiftArguments): Add missing type
9896         computation.
9897         (Binary::ResolveOperator): Add type to the logical and and logical
9898         or, Bitwise And/Or and Exclusive Or code paths, it was missing
9899         before.
9900
9901         (Binary::DoNumericPromotions): In the case where either argument
9902         is ulong (and most signed types combined with ulong cause an
9903         error) perform implicit integer constant conversions as well.
9904
9905 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
9906
9907         * expression.cs (UserImplicitCast): Method should always be
9908         non-null. 
9909         (Invocation::BetterConversion): Simplified test for IntLiteral.
9910
9911         (Expression::ImplicitNumericConversion): Split this routine out.
9912         Put the code that performs implicit constant integer conversions
9913         here. 
9914
9915         (Expression::Resolve): Become a wrapper around DoResolve so we can
9916         check eclass and type being set after resolve.
9917
9918         (Invocation::Badness): Remove this dead function
9919
9920         (Binary::ResolveOperator): Do not compute the expensive argumnets
9921         unless we have a union for it.
9922
9923         (Probe::Emit): Is needs to do an isinst and then
9924         compare against null.
9925
9926         (::CanConvert): Added Location argument.  If the Location argument
9927         is null (Location.Null), then we do not report errors.  This is
9928         used by the `probe' mechanism of the Explicit conversion.  We do
9929         not want to generate an error for something that the user
9930         explicitly requested to be casted.  But the pipeline for an
9931         explicit cast first tests for potential implicit casts.
9932
9933         So for now, if the Location is null, it means `Probe only' to
9934         avoid adding another argument.   Might have to revise this
9935         strategy later.
9936
9937         (ClassCast): New class used to type cast objects into arbitrary
9938         classes (used in Explicit Reference Conversions).
9939
9940         Implement `as' as well.
9941
9942         Reverted all the patches from Ravi below: they were broken:
9943
9944                 * The use of `level' as a mechanism to stop recursive
9945                   invocations is wrong.  That was there just to catch the
9946                   bug with a strack trace but not as a way of addressing
9947                   the problem.
9948
9949                   To fix the problem we have to *understand* what is going
9950                   on and the interactions and come up with a plan, not
9951                   just get things going.
9952
9953                 * The use of the type conversion cache that I proposed
9954                   last night had an open topic: How does this work across
9955                   protection domains.  A user defined conversion might not
9956                   be public in the location where we are applying the
9957                   conversion, a different conversion might be selected
9958                   (ie, private A->B (better) but public B->A (worse),
9959                   inside A, A->B applies, but outside it, B->A will
9960                   apply).
9961
9962                 * On top of that (ie, even if the above is solved),
9963                   conversions in a cache need to be abstract.  Ie, `To
9964                   convert from an Int to a Short use an OpcodeCast', not
9965                   `To convert from an Int to a Short use the OpcodeCast on
9966                   the variable 5' (which is what this patch was doing).
9967         
9968 2001-09-28  Ravi Pratap  <ravi@ximian.com>
9969
9970         * expression.cs (Invocation::ConversionExists): Re-write to use
9971         the conversion cache
9972         
9973         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
9974         cache all conversions done, not just user-defined ones.
9975
9976         (Invocation::BetterConversion): The real culprit. Use ConversionExists
9977         to determine if a conversion exists instead of acutually trying to 
9978         perform the conversion. It's faster too.
9979
9980         (Expression::ConvertExplicit): Modify to use ConversionExists to check
9981         and only then attempt the implicit conversion.
9982
9983 2001-09-28  Ravi Pratap  <ravi@ximian.com>
9984
9985         * expression.cs (ConvertImplicit): Use a cache for conversions
9986         already found. Check level of recursion and bail out if necessary.
9987         
9988 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
9989
9990         * typemanager.cs (string_concat_string_string, string_concat_object_object):
9991         Export standard methods that we expect for string operations.
9992         
9993         * statement.cs (Block::UsageWarning): Track usage of variables and
9994         report the errors for not used variables.
9995
9996         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
9997         operator. 
9998
9999 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
10000
10001         * codegen.cs: remove unnneded code 
10002
10003         * expression.cs: Removed BuiltinTypeAccess class
10004
10005         Fix the order in which implicit conversions are
10006         done.  
10007
10008         The previous fixed dropped support for boxed conversions (adding a
10009         test to the test suite now)
10010
10011         (UserImplicitCast::CanConvert): Remove test for source being null,
10012         that code is broken.  We should not feed a null to begin with, if
10013         we do, then we should track the bug where the problem originates
10014         and not try to cover it up here.
10015
10016         Return a resolved expression of type UserImplicitCast on success
10017         rather than true/false.  Ravi: this is what I was talking about,
10018         the pattern is to use a static method as a "constructor" for
10019         objects. 
10020
10021         Also, do not create arguments until the very last minute,
10022         otherwise we always create the arguments even for lookups that
10023         will never be performed. 
10024
10025         (UserImplicitCast::Resolve): Eliminate, objects of type
10026         UserImplicitCast are born in a fully resolved state. 
10027         
10028         * typemanager.cs (InitCoreTypes): Init also value_type
10029         (System.ValueType). 
10030
10031         * expression.cs (Cast::Resolve): First resolve the child expression.
10032
10033         (LValue): Add new method AddressOf to be used by
10034         the `&' operator.  
10035
10036         Change the argument of Store to take an EmitContext instead of an
10037         ILGenerator, because things like FieldExpr need to be able to call
10038         their children expression to generate the instance code. 
10039
10040         (Expression::Error, Expression::Warning): Sugar functions for
10041         reporting errors.
10042
10043         (Expression::MemberLookup): Accept a TypeContainer instead of a
10044         Report as the first argument.
10045
10046         (Expression::ResolvePrimary): Killed.  I still want to improve
10047         this as currently the code is just not right.
10048
10049         (Expression::ResolveMemberAccess): Simplify, but it is still
10050         wrong. 
10051
10052         (Unary::Resolve): Catch errors in AddressOf operators.
10053
10054         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
10055         index to a byte for the short-version, or the compiler will choose
10056         the wrong Emit call, which generates the wrong data.
10057
10058         (ParameterReference::Emit, ::Store): same.
10059
10060         (FieldExpr::AddressOf): Implement.
10061         
10062         * typemanager.cs: TypeManager: made public variable instead of
10063         property.
10064         
10065         * driver.cs: document --fatal.
10066
10067         * report.cs (ErrorMessage, WarningMessage): new names for the old
10068         Error and Warning classes.
10069
10070         * cs-parser.jay (member_access): Turn built-in access to types
10071         into a normal simplename
10072
10073 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10074
10075         * expression.cs (Invocation::BetterConversion): Fix to cope
10076         with q being null, since this was introducing a bug.
10077
10078         * expression.cs (ConvertImplicit): Do built-in conversions first.
10079
10080 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10081
10082         * expression.cs (UserImplicitCast::Resolve): Fix bug.
10083
10084 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10085
10086         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
10087         I had introduced long ago (what's new ?).
10088
10089         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
10090         the work of all the checking. 
10091         (ConvertImplicit): Call CanConvert and only then create object if necessary.
10092         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
10093
10094         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
10095         that is the right way. 
10096
10097         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
10098         overloading resolution. Use everywhere instead of cutting and pasting code.
10099
10100         (Binary::ResolveOperator): Use MakeUnionSet.
10101
10102         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
10103         we have to convert to bool types. Not complete yet.
10104         
10105 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
10106
10107         * typemanager.cs (TypeManager::CSharpName): support ushort.
10108
10109         * expression.cs (Expression::TryImplicitIntConversion): Attempts
10110         to provide an expression that performsn an implicit constant int
10111         conversion (section 6.1.6).
10112         (Expression::ConvertImplicitRequired): Reworked to include
10113         implicit constant expression conversions.
10114
10115         (Expression::ConvertNumericExplicit): Finished.
10116
10117         (Invocation::Emit): If InstanceExpression is null, then it means
10118         that we perform a call on this.
10119         
10120 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
10121
10122         * expression.cs (Unary::Emit): Remove some dead code.
10123         (Probe): Implement Resolve and Emit for `is'.
10124         (Expression::ConvertImplicitRequired): Attempt to do constant
10125         expression conversions here.  Maybe should be moved to
10126         ConvertImplicit, but I am not sure.
10127         (Expression::ImplicitLongConstantConversionPossible,
10128         Expression::ImplicitIntConstantConversionPossible): New functions
10129         that tell whether is it possible to apply an implicit constant
10130         expression conversion.
10131
10132         (ConvertNumericExplicit): Started work on explicit numeric
10133         conversions.
10134
10135         * cs-parser.jay: Update operator constants.
10136
10137         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
10138         (Parameters::GetSignature): Hook up VerifyArgs here.
10139         (Parameters::VerifyArgs): Verifies that no two arguments have the
10140         same name. 
10141
10142         * class.cs (Operator): Update the operator names to reflect the
10143         ones that the spec expects (as we are just stringizing the
10144         operator names).
10145         
10146         * expression.cs (Unary::ResolveOperator): Fix bug: Use
10147         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
10148         previous usage did only work for our methods.
10149         (Expression::ConvertImplicit): Handle decimal implicit numeric
10150         conversions as well.
10151         (Expression::InternalTypeConstructor): Used to invoke constructors
10152         on internal types for default promotions.
10153
10154         (Unary::Emit): Implement special handling for the pre/post
10155         increment/decrement for overloaded operators, as they need to have
10156         the same semantics as the other operators.
10157
10158         (Binary::ResolveOperator): ditto.
10159         (Invocation::ConversionExists): ditto.
10160         (UserImplicitCast::Resolve): ditto.
10161         
10162 2001-09-26  Ravi Pratap  <ravi@ximian.com>
10163
10164         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
10165         operator, return after emitting body. Regression tests pass again !
10166
10167         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
10168         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
10169         (Invocation::OverloadResolve): Ditto.
10170         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
10171
10172         * everywhere : update calls to the above methods accordingly.
10173
10174 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
10175
10176         * assign.cs (Assign): Make it inherit from ExpressionStatement.
10177
10178         * expression.cs (ExpressionStatement): New base class used for
10179         expressions that can appear in statements, so that we can provide
10180         an alternate path to generate expression that do not leave a value
10181         on the stack.
10182
10183         (Expression::Emit, and all the derivatives): We no longer return
10184         whether a value is left on the stack or not.  Every expression
10185         after being emitted leaves a single value on the stack.
10186
10187         * codegen.cs (EmitContext::EmitStatementExpression): Use the
10188         facilties of ExpressionStatement if possible.
10189
10190         * cs-parser.jay: Update statement_expression.
10191
10192 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
10193
10194         * driver.cs: Change the wording of message
10195
10196 2001-09-25  Ravi Pratap  <ravi@ximian.com>
10197
10198         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
10199         the type of the expression to the return type of the method if
10200         we have an overloaded operator match ! The regression tests pass again !
10201         (Unary::ResolveOperator): Ditto.
10202
10203         * expression.cs (Invocation::ConversionExists): Correct the member lookup
10204         to find "op_Implicit", not "implicit" ;-)
10205         (UserImplicitCast): New class to take care of user-defined implicit conversions.
10206         (ConvertImplicit, ForceConversion): Take TypeContainer argument
10207
10208         * everywhere : Correct calls to the above accordingly.
10209
10210         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
10211         (ConvertImplicit): Do user-defined conversion if it exists.
10212
10213 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
10214
10215         * assign.cs: track location.
10216         (Resolve): Use implicit conversions on assignment.
10217
10218         * literal.cs: Oops.  Not good, Emit of short access values should
10219         pass (Bytes) or the wrong argument will be selected.
10220
10221         * expression.cs (Unary::Emit): Emit code for -expr.
10222         
10223         (Unary::ResolveOperator): Handle `Substract' for non-constants
10224         (substract from zero from the non-constants).
10225         Deal with Doubles as well. 
10226         
10227         (Expression::ConvertImplicitRequired): New routine that reports an
10228         error if no implicit conversion exists. 
10229
10230         (Invocation::OverloadResolve): Store the converted implicit
10231         expressions if we make them
10232         
10233 2001-09-24  Ravi Pratap  <ravi@ximian.com>
10234
10235         * class.cs (ConstructorInitializer): Take a Location argument.
10236         (ConstructorBaseInitializer): Same here.
10237         (ConstructorThisInitializer): Same here.
10238
10239         * cs-parser.jay : Update all calls accordingly.
10240
10241         * expression.cs (Unary, Binary, New): Take location argument.
10242         Update accordingly everywhere.
10243
10244         * cs-parser.jay : Update all calls to the above to take a location
10245         argument.
10246
10247         * class.cs : Ditto.
10248
10249 2001-09-24  Ravi Pratap  <ravi@ximian.com>
10250
10251         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
10252         (Invocation::BetterConversion): Same here
10253         (Invocation::ConversionExists): Ditto.
10254
10255         (Invocation::ConversionExists): Implement.
10256
10257 2001-09-22  Ravi Pratap  <ravi@ximian.com>
10258
10259         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
10260         Also take an additional TypeContainer argument.
10261
10262         * All over : Pass in TypeContainer as argument to OverloadResolve.
10263
10264         * typemanager.cs (CSharpName): Update to check for the string type and return
10265         that too.
10266
10267         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
10268         a given method.
10269         
10270 2001-09-21  Ravi Pratap  <ravi@ximian.com>
10271
10272         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
10273         (Invocation::BetterFunction): Implement.
10274         (Invocation::BetterConversion): Implement.
10275         (Invocation::ConversionExists): Skeleton, no implementation yet.
10276
10277         Okay, things work fine !
10278
10279 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
10280
10281         * typemanager.cs: declare and load enum_type, delegate_type and
10282         void_type. 
10283
10284         * expression.cs (Expression::Emit): Now emit returns a value that
10285         tells whether a value is left on the stack or not.  This strategy
10286         might be reveted tomorrow with a mechanism that would address
10287         multiple assignments.
10288         (Expression::report118): Utility routine to report mismatches on
10289         the ExprClass.
10290
10291         (Unary::Report23): Report impossible type/operator combination
10292         utility function.
10293
10294         (Unary::IsIncrementableNumber): Whether the type can be
10295         incremented or decremented with add.
10296         (Unary::ResolveOperator): Also allow enumerations to be bitwise
10297         complemented. 
10298         (Unary::ResolveOperator): Implement ++, !, ~,
10299
10300         (Invocation::Emit): Deal with new Emit convetion.
10301         
10302         * All Expression derivatives: Updated their Emit method to return
10303         whether they leave values on the stack or not.
10304         
10305         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
10306         stack for expressions that are statements. 
10307
10308 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
10309
10310         * expression.cs (LValue): New interface.  Must be implemented by
10311         LValue objects.
10312         (LocalVariableReference, ParameterReference, FieldExpr): Implement
10313         LValue interface.
10314         
10315         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
10316         interface for generating code, simplifies the code.
10317
10318 2001-09-20  Ravi Pratap  <ravi@ximian.com>
10319
10320         * expression.cs (everywhere): Comment out return statements in ::Resolve
10321         methods to avoid the warnings.
10322
10323 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
10324
10325         * driver.cs (parse): Report error 2001 if we can not open the
10326         source file.
10327
10328         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
10329         not resolve it.
10330
10331         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
10332         object. 
10333
10334         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
10335         otherwise nested blocks end up with the same index.
10336
10337         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
10338
10339         * expression.cs:  Instead of having FIXMEs in the Resolve
10340         functions, throw exceptions so it is obvious that we are facing a
10341         bug. 
10342
10343         * cs-parser.jay (invocation_expression): Pass Location information.
10344
10345         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
10346         Use a basename for those routines because .NET does not like paths
10347         on them. 
10348
10349         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
10350         already defined.
10351
10352 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
10353
10354         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
10355         are loading the correct data types (throws an exception if not).
10356         (TypeManager::InitCoreTypes): Use CoreLookupType
10357
10358         * expression.cs (Unary::ResolveOperator): return the child
10359         expression for expressions which are just +expr.
10360         (Unary::ResolveOperator): Return negative literals for -LITERAL
10361         expressions (otherwise they are Unary {Literal}).
10362         (Invocation::Badness): Take into account `Implicit constant
10363         expression conversions'.
10364
10365         * literal.cs (LongLiteral): Implement long literal class.
10366         (IntLiteral): export the `Value' of the intliteral. 
10367
10368 2001-09-19  Ravi Pratap  <ravi@ximian.com>
10369
10370         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
10371
10372         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
10373         instead of 'Operator'
10374
10375         * expression.cs (Binary::ResolveOperator): Update accordingly.
10376         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
10377         and 'Minus'
10378
10379         * cs-parser.jay (unary_expression): Update to use the new names.
10380
10381         * gen-treedump.cs (GetUnary): Same here.
10382
10383         * expression.cs (Unary::Resolve): Implement.
10384         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
10385         operators are found instead of making noise ;-)
10386         (Unary::ResolveOperator): New method to do precisely the same thing which
10387         Binary::ResolveOperator does for Binary expressions.
10388         (Unary.method, .Arguments): Add.
10389         (Unary::OperName): Implement.   
10390         (Unary::ForceConversion): Copy and Paste !
10391
10392         * class.cs (Operator::Define): Fix a small bug for the case when we have 
10393         a unary operator.
10394
10395         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
10396         for the inbuilt operators. Only overloading works for now ;-)
10397
10398 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
10399
10400         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
10401         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
10402
10403         * expression.cs (This::Emit): Implement. 
10404         (This::Resolve): Implement.
10405         (TypeOf:Resolve): Implement.
10406         (Expression::ResolveSimpleName): Add an implicit this to instance
10407         field references. 
10408         (MemberAccess::Resolve): Deal with Parameters and Fields. 
10409         Bind instance variable to Field expressions.
10410         (FieldExpr::Instance): New field used to track the expression that
10411         represents the object instance.
10412         (FieldExpr::Resolve): Track potential errors from MemberLookup not
10413         binding 
10414         (FieldExpr::Emit): Implement.
10415
10416         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
10417         the last instruction contains a return opcode to avoid generating
10418         the last `ret' instruction (this generates correct code, and it is
10419         nice to pass the peverify output).
10420
10421         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
10422         initializer for static and instance variables.
10423         (Constructor::Emit): Allow initializer to be null in the case of
10424         static constructors.  Only emit initializer for instance
10425         constructors. 
10426
10427         (TypeContainer::FindMembers): Return a null array if there are no
10428         matches.
10429
10430         Also fix the code for the MemberTypes.Method branch, as it was not
10431         scanning that for operators (or tried to access null variables before).
10432
10433         * assign.cs (Assign::Emit): Handle instance and static fields. 
10434
10435         * TODO: Updated.
10436
10437         * driver.cs: Stop compilation if there are parse errors.
10438
10439         * cs-parser.jay (constructor_declaration): Provide default base
10440         initializer for non-static constructors.
10441         (constructor_declarator): Do not provide a default base
10442         initializers if none was specified.
10443         Catch the fact that constructors should not have parameters.
10444
10445         * class.cs: Do not emit parent class initializers for static
10446         constructors, that should be flagged as an error.
10447
10448 2001-09-18  Ravi Pratap  <ravi@ximian.com>
10449
10450         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
10451         Move back code into TypeContainer::Populate.
10452
10453 2001-09-18  Ravi Pratap  <ravi@ximian.com>
10454
10455         * class.cs (TypeContainer::AddConstructor): Fix the check to
10456         compare against Name, not Basename. 
10457         (Operator::OpType): Change Plus and Minus to Add and Subtract.
10458
10459         * cs-parser.jay : Update accordingly.
10460
10461         * class.cs (TypeContainer::FindMembers): For the case where we are searching
10462         for methods, don't forget to look into the operators too.
10463         (RegisterMethodBuilder): Helper method to take care of this for
10464         methods, constructors and operators.
10465         (Operator::Define): Completely revamp.
10466         (Operator.OperatorMethod, MethodName): New fields.
10467         (TypeContainer::Populate): Move the registering of builders into
10468         RegisterMethodBuilder.
10469         (Operator::Emit): Re-write.
10470
10471         * expression.cs (Binary::Emit): Comment out code path to emit method
10472         invocation stuff for the case when we have a user defined operator. I am
10473         just not able to get it right !
10474         
10475 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
10476
10477         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
10478         argument. 
10479
10480         (Expression::MemberLookup): Provide a version that allows to
10481         specify the MemberTypes and BindingFlags. 
10482
10483         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
10484         so it was not fetching variable information from outer blocks.
10485
10486         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
10487         Beforefieldinit as it was buggy.
10488
10489         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
10490         that Ravi put here.  
10491
10492         * class.cs (Constructor::Emit): Only emit if block is not null.
10493         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
10494         deal with this by semantically definining it as if the user had
10495         done it.
10496
10497         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
10498         constructors as we now "emit" them at a higher level.
10499
10500         (TypeContainer::DefineDefaultConstructor): Used to define the
10501         default constructors if none was provided.
10502
10503         (ConstructorInitializer): Add methods Resolve and Emit. 
10504         
10505         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
10506
10507 2001-09-17  Ravi Pratap  <ravi@ximian.com>
10508
10509         * class.cs (TypeContainer::EmitDefaultConstructor): Register
10510         the default constructor builder with our hashtable for methodbuilders
10511         to methodcores.
10512
10513         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
10514         and argument_count is 0 in which case we have a match.
10515         (Binary::ResolveOperator): More null checking and miscellaneous coding
10516         style cleanup.
10517
10518 2001-09-17  Ravi Pratap  <ravi@ximian.com>
10519
10520         * rootcontext.cs (IsNameSpace): Compare against null.
10521
10522         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
10523
10524         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
10525         and Unary::Operator.
10526
10527         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
10528         accordingly.
10529
10530         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
10531         we have overloaded operators.
10532         (Binary::ResolveOperator): Implement the part which does the operator overload
10533         resolution.
10534
10535         * class.cs (Operator::Emit): Implement.
10536         (TypeContainer::Emit): Emit the operators we have too.
10537
10538         * expression.cs (Binary::Emit): Update to emit the appropriate code for
10539         the case when we have a user-defined operator.
10540         
10541 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
10542
10543         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
10544
10545 2001-09-16  Ravi Pratap  <ravi@ximian.com>
10546
10547         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
10548         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
10549         (Constructor::Emit): Implement.
10550         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
10551         if we have no work to do. 
10552         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
10553         Emit method.
10554
10555         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
10556         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
10557
10558         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
10559         of parent.parent.
10560
10561 2001-09-15  Ravi Pratap  <ravi@ximian.com>
10562
10563         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
10564         in the source.
10565         (Tree::RecordNamespace): Method to do what the name says ;-)
10566         (Tree::Namespaces): Property to get at the namespaces hashtable.
10567
10568         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
10569         keep track.
10570
10571         * rootcontext.cs (IsNamespace): Fixed it :-)
10572
10573 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
10574
10575         * class.cs (TypeContainer::FindMembers): Add support for
10576         constructors. 
10577         (MethodCore): New class that encapsulates both the shared aspects
10578         of a Constructor and a Method.  
10579         (Method, Constructor): Factored pieces into MethodCore.
10580
10581         * driver.cs: Added --fatal which makes errors throw exceptions.
10582         Load System assembly as well as part of the standard library.
10583
10584         * report.cs: Allow throwing exceptions on errors for debugging.
10585
10586         * modifiers.cs: Do not use `parent', instead use the real type
10587         container to evaluate permission settings.
10588
10589         * class.cs: Put Ravi's patch back in.  He is right, and we will
10590         have to cope with the
10591
10592 2001-09-14  Ravi Pratap  <ravi@ximian.com>
10593
10594         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
10595         FamORAssem, not FamANDAssem.
10596         
10597 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
10598
10599         * driver.cs: Added --parse option that only parses its input files
10600         and terminates.
10601
10602         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
10603         incorrect.  IsTopLevel is not used to tell whether an object is
10604         root_types or not (that can be achieved by testing this ==
10605         root_types).  But to see if this is a top-level *class* (not
10606         necessarly our "toplevel" container). 
10607
10608 2001-09-14  Ravi Pratap  <ravi@ximian.com>
10609
10610         * enum.cs (Enum::Define): Modify to call the Lookup method on the
10611         parent instead of a direct call to GetType.
10612
10613 2001-09-14  Ravi Pratap  <ravi@ximian.com>
10614
10615         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
10616         Modifiers.TypeAttr. This should just be a call to that method.
10617
10618         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
10619         object so that we can determine if we are top-level or not.
10620
10621         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
10622         TypeContainer too.
10623
10624         * enum.cs (Enum::Define): Ditto.
10625
10626         * modifiers.cs (FieldAttr): Re-write.
10627
10628         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
10629         (TypeContainer::HaveStaticConstructor): New property to provide access
10630         to precisely that info.
10631
10632         * modifiers.cs (MethodAttr): Re-write.
10633         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
10634
10635         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
10636         of top-level types as claimed.
10637         
10638 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
10639
10640         * expression.cs (MemberLookup): Fruitless attempt to lookup
10641         constructors.  Maybe I need to emit default constructors?  That
10642         might be it (currently .NET emits this for me automatically).
10643         (Invocation::OverloadResolve): Cope with Arguments == null.
10644         (Invocation::EmitArguments): new function, shared by the new
10645         constructor and us.
10646         (Invocation::Emit): Handle static and instance methods.  Emit
10647         proper call instruction for virtual or non-virtual invocations.
10648         (New::Emit): Implement.
10649         (New::Resolve): Implement.
10650         (MemberAccess:Resolve): Implement.
10651         (MethodGroupExpr::InstanceExpression): used conforming to the spec
10652         to track instances.
10653         (FieldExpr::Resolve): Set type.
10654
10655         * support.cs: Handle empty arguments.
10656                 
10657         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
10658         SimpleLookup): Auxiliary routines to help parse a qualifier
10659         identifier.  
10660
10661         Update qualifier_identifier rule.
10662
10663         * codegen.cs: Removed debugging messages.
10664
10665         * class.cs: Make this a global thing, this acts just as a "key" to
10666         objects that we might have around.
10667
10668         (Populate): Only initialize method_builders_to_methods once.
10669
10670         * expression.cs (PropertyExpr): Initialize type from the
10671         PropertyType. 
10672
10673         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
10674         Resolve pattern.  Attempt to implicitly convert value to boolean.
10675         Emit code.
10676
10677         * expression.cs: Set the type for the int32/int32 argument case.
10678         (Binary::ResolveOperator): Set the return type to boolean for
10679         comparission operators
10680
10681         * typemanager.cs: Remove debugging print code.
10682
10683         (Invocation::Resolve): resolve type.
10684
10685         * class.cs: Allocate a MemberInfo of the correct size, as the code
10686         elsewhere depends on the test to reflect the correct contents.
10687
10688         (Method::) Keep track of parameters, due to System.Reflection holes
10689
10690         (TypeContainer::Populate): Keep track of MethodBuilders to Method
10691         mapping here.
10692
10693         (TypeContainer::FindMembers): Use ArrayList and then copy an array
10694         of the exact size and return that.
10695
10696         (Class::LookupMethodByBuilder): New function that maps
10697         MethodBuilders to its methods.  Required to locate the information
10698         on methods because System.Reflection bit us again.
10699
10700         * support.cs: New file, contains an interface ParameterData and
10701         two implementations: ReflectionParameters and InternalParameters
10702         used to access Parameter information.  We will need to grow this
10703         as required.
10704
10705         * expression.cs (Invocation::GetParameterData): implement a cache
10706         and a wrapper around the ParameterData creation for methods. 
10707         (Invocation::OverloadResolve): Use new code.
10708
10709 2001-09-13  Ravi Pratap  <ravi@ximian.com>
10710
10711         * class.cs (TypeContainer::EmitField): Remove and move into 
10712         (Field::Define): here and modify accordingly.
10713         (Field.FieldBuilder): New member.
10714         (TypeContainer::Populate): Update accordingly.
10715         (TypeContainer::FindMembers): Implement.
10716
10717 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
10718
10719         * statement.cs: (VariableInfo::VariableType): New field to be
10720         initialized with the full type once it is resolved. 
10721
10722 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
10723
10724         * parameter.cs (GetParameterInfo): Use a type cache to compute
10725         things only once, and to reuse this information
10726
10727         * expression.cs (LocalVariableReference::Emit): Implement.
10728         (OpcodeCast::Emit): fix.
10729
10730         (ParameterReference::Resolve): Implement.
10731         (ParameterReference::Emit): Implement.
10732
10733         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
10734         that are expressions need to stay as Expressions.
10735
10736         * typemanager.cs (CSharpName): Returns the C# name of a type if
10737         possible. 
10738
10739         * expression.cs (Expression::ConvertImplicit): New function that
10740         implements implicit type conversions.
10741
10742         (Expression::ImplicitReferenceConversion): Implements implicit
10743         reference conversions.
10744
10745         (EmptyCast): New type for transparent casts.
10746
10747         (OpcodeCast): New type for casts of types that are performed with
10748         a sequence of bytecodes.
10749         
10750         (BoxedCast): New type used for casting value types into reference
10751         types.  Emits a box opcode.
10752
10753         (Binary::DoNumericPromotions): Implements numeric promotions of
10754         and computation of the Binary::Type.
10755
10756         (Binary::EmitBranchable): Optimization.
10757
10758         (Binary::Emit): Implement code emission for expressions.
10759         
10760         * typemanager.cs (TypeManager): Added two new core types: sbyte
10761         and byte.
10762
10763 2001-09-12  Ravi Pratap  <ravi@ximian.com>
10764
10765         * class.cs (TypeContainer::FindMembers): Method which does exactly
10766         what Type.FindMembers does, only we don't have to use reflection. No
10767         implementation yet.
10768
10769         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
10770         typecontainer objects as we need to get at them.
10771         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
10772
10773         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
10774         typecontainer object.
10775
10776         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
10777         of just a Report object.
10778
10779 2001-09-11  Ravi Pratap  <ravi@ximian.com>
10780
10781         * class.cs (Event::Define): Go back to using the prefixes "add_" and
10782         "remove_"
10783         (TypeContainer::Populate): Now define the delegates of the type too.
10784         (TypeContainer.Delegates): Property to access the list of delegates defined
10785         in the type.
10786
10787         * delegates.cs (Delegate::Define): Implement partially.
10788
10789         * modifiers.cs (TypeAttr): Handle more flags.
10790
10791 2001-09-11  Ravi Pratap  <ravi@ximian.com>
10792
10793         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
10794         and not <=
10795         (Operator::Define): Re-write logic to get types by using the LookupType method
10796         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
10797         (Indexer::Define): Ditto.
10798         (Event::Define): Ditto.
10799         (Property::Define): Ditto.
10800         
10801 2001-09-10  Ravi Pratap  <ravi@ximian.com>
10802
10803         * class.cs (TypeContainer::Populate): Now define operators too. 
10804         (TypeContainer.Operators): New property to access the list of operators
10805         in a type.
10806         (Operator.OperatorMethodBuilder): New member to hold the method builder
10807         for the operator we are defining.
10808         (Operator::Define): Implement.
10809
10810 2001-09-10  Ravi Pratap  <ravi@ximian.com>
10811
10812         * class.cs (Event::Define): Make the prefixes of the accessor methods
10813         addOn_ and removeOn_ 
10814
10815         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
10816         of the location being passed in too. Ideally, this should go later since all
10817         error reporting should be done through the Report object.
10818
10819         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
10820         (Populate): Iterate thru the indexers we have and define them too.
10821         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
10822         for the get and set accessors.
10823         (Indexer::Define): Implement.
10824         
10825 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
10826
10827         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
10828         my previous implementation, did not work.
10829
10830         * typemanager.cs: Add a couple of missing types (the longs).
10831
10832         * literal.cs: Use TypeManager.bool_type instead of getting it.
10833
10834         * expression.cs (EventExpr): New kind of expressions.
10835         (Expressio::ExprClassFromMemberInfo): finish
10836
10837 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
10838
10839         * assign.cs: Emit stores to static fields differently.
10840
10841 2001-09-08  Ravi Pratap  <ravi@ximian.com>
10842
10843         * Merge in changes and adjust code to tackle conflicts. Backed out my
10844         code in Assign::Resolve ;-) 
10845
10846 2001-09-08  Ravi Pratap  <ravi@ximian.com>
10847
10848         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
10849         instead Report.Error and also pass in the location.
10850         (CSharpParser::Lexer): New readonly property to return the reference
10851         to the Tokenizer object.
10852         (declare_local_variables): Use Report.Error with location instead of plain 
10853         old error.
10854         (CheckDef): Ditto.
10855
10856         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
10857         (Operator.CheckBinaryOperator): Ditto.
10858
10859         * cs-parser.jay (operator_declarator): Update accordingly.
10860
10861         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
10862         (CheckBinaryOperator): Same here.
10863
10864         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
10865         on the name without any prefixes of namespace names etc. This is because we
10866         already might have something already fully qualified like 
10867         'System.Console.WriteLine'
10868
10869         * assign.cs (Resolve): Begin implementation. Stuck ;-)
10870
10871 2001-09-07  Ravi Pratap  <ravi@ximian.com>
10872
10873         * cs-tokenizer.cs (location): Return a string which also contains
10874         the file name.
10875
10876         * expression.cs (ElementAccess): New class for expressions of the
10877         type 'element access.'
10878         (BaseAccess): New class for expressions of the type 'base access.'
10879         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
10880         respectively.
10881         
10882         * cs-parser.jay (element_access): Implement action.
10883         (base_access): Implement actions.
10884         (checked_expression, unchecked_expression): Implement.
10885
10886         * cs-parser.jay (local_variable_type): Correct and implement.
10887         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
10888
10889         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
10890
10891         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
10892         name and the specifiers.
10893
10894         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
10895         
10896         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
10897         making them all public ;-)
10898
10899         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
10900         class anyways.
10901         
10902 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
10903
10904         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
10905         PropertyExprs.
10906         (FieldExpr, PropertyExprs): New resolved expressions.
10907         (SimpleName::MemberStaticCheck): Perform static checks for access
10908         to non-static fields on static methods. Maybe this should be
10909         generalized for MemberAccesses. 
10910         (SimpleName::ResolveSimpleName): More work on simple name
10911         resolution. 
10912
10913         * cs-parser.jay (primary_expression/qualified_identifier): track
10914         the parameter index.
10915
10916         * codegen.cs (CodeGen::Save): Catch save exception, report error.
10917         (EmitContext::EmitBoolExpression): Chain to expression generation
10918         instead of temporary hack.
10919         (::EmitStatementExpression): Put generic expression code generation.
10920
10921         * assign.cs (Assign::Emit): Implement variable assignments to
10922         local variables, parameters and fields.
10923
10924 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
10925
10926         * statement.cs (Block::GetVariableInfo): New method, returns the
10927         VariableInfo for a variable name in a block.
10928         (Block::GetVariableType): Implement in terms of GetVariableInfo
10929
10930         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
10931         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
10932
10933 2001-09-06  Ravi Pratap  <ravi@ximian.com>
10934
10935         * cs-parser.jay (operator_declaration): Continue on my quest : update
10936         to take attributes argument.
10937         (event_declaration): Ditto.
10938         (enum_declaration): Ditto.
10939         (indexer_declaration): Ditto.
10940         
10941         * class.cs (Operator::Operator): Update constructor accordingly.
10942         (Event::Event): Ditto.
10943
10944         * delegate.cs (Delegate::Delegate): Same here.
10945
10946         * enum.cs (Enum::Enum): Same here.
10947         
10948 2001-09-05  Ravi Pratap  <ravi@ximian.com>
10949
10950         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
10951
10952         * ../tests/cs0658.cs : New file to demonstrate error 0658.
10953
10954         * attribute.cs (Attributes): New class to encapsulate all attributes which were
10955         being passed around as an arraylist.
10956         (Attributes::AddAttribute): Method to add attribute sections.
10957
10958         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
10959         (struct_declaration): Update accordingly.
10960         (constant_declaration): Update.
10961         (field_declaration): Update.
10962         (method_header): Update.
10963         (fixed_parameter): Update.
10964         (parameter_array): Ditto.
10965         (property_declaration): Ditto.
10966         (destructor_declaration): Ditto.
10967         
10968         * class.cs (Struct::Struct): Update constructors accordingly.
10969         (Class::Class): Ditto.
10970         (Field::Field): Ditto.
10971         (Method::Method): Ditto.
10972         (Property::Property): Ditto.
10973         (TypeContainer::OptAttribute): update property's return type.
10974         
10975         * interface.cs (Interface.opt_attributes): New member.
10976         (Interface::Interface): Update to take the extra Attributes argument.
10977
10978         * parameter.cs (Parameter::Parameter): Ditto.
10979
10980         * constant.cs (Constant::Constant): Ditto.
10981
10982         * interface.cs (InterfaceMemberBase): New OptAttributes field.
10983         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
10984         the attributes as a parameter.
10985         (InterfaceProperty): Update constructor call.
10986         (InterfaceEvent): Ditto.
10987         (InterfaceMethod): Ditto.
10988         (InterfaceIndexer): Ditto.
10989
10990         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
10991         pass the attributes too.
10992         (interface_event_declaration): Ditto.
10993         (interface_property_declaration): Ditto.
10994         (interface_method_declaration): Ditto.
10995         (interface_declaration): Ditto.
10996
10997 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
10998
10999         * class.cs (Method::Define): Track the "static Main" definition to
11000         create an entry point. 
11001
11002         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
11003         EntryPoint if we find it. 
11004
11005         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
11006         (EmitContext::ig): Make this variable public.
11007
11008         * driver.cs: Make the default output file be the first file name
11009         with the .exe extension.  
11010
11011         Detect empty compilations
11012
11013         Handle various kinds of output targets.  Handle --target and
11014         rename -t to --dumper.
11015
11016         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
11017         methods inherited from Expression return now an Expression.  This
11018         will is used during the tree rewriting as we resolve them during
11019         semantic analysis.
11020
11021         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
11022         the spec.  Missing entirely is the information about
11023         accessability of elements of it.
11024
11025         (Expression::ExprClassFromMemberInfo): New constructor for
11026         Expressions that creates a fully initialized Expression based on
11027         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
11028         a Type.
11029
11030         (Invocation::Resolve): Begin implementing resolution of invocations.
11031         
11032         * literal.cs (StringLiteral):  Implement Emit.
11033
11034 2001-09-05  Ravi Pratap  <ravi@ximian.com>
11035
11036         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
11037         member.
11038         
11039 2001-09-04  Ravi Pratap  <ravi@ximian.com>
11040
11041         * cs-parser.jay (attribute_arguments): Implement actions.
11042         (attribute): Fix bug in production. Implement action.
11043         (attribute_list): Implement.
11044         (attribute_target): Implement.
11045         (attribute_target_specifier, opt_target_specifier): Implement
11046         (CheckAttributeTarget): New method to check if the attribute target
11047         is valid.
11048         (attribute_section): Implement.
11049         (opt_attributes): Implement.
11050
11051         * attribute.cs : New file to handle attributes.
11052         (Attribute): Class to hold attribute info.
11053
11054         * cs-parser.jay (opt_attribute_target_specifier): Remove production
11055         (attribute_section): Modify production to use 2 different rules to 
11056         achieve the same thing. 1 s/r conflict down !
11057         Clean out commented, useless, non-reducing dimension_separator rules.
11058         
11059         * class.cs (TypeContainer.attributes): New member to hold list
11060         of attributes for a type.
11061         (Struct::Struct): Modify to take one more argument, the attribute list.
11062         (Class::Class): Ditto.
11063         (Field::Field): Ditto.
11064         (Method::Method): Ditto.
11065         (Property::Property): Ditto.
11066         
11067         * cs-parser.jay (struct_declaration): Update constructor call to
11068         pass in the attributes too.
11069         (class_declaration): Ditto.
11070         (constant_declaration): Ditto.
11071         (field_declaration): Ditto.
11072         (method_header): Ditto.
11073         (fixed_parameter): Ditto.
11074         (parameter_array): Ditto.
11075         (property_declaration): Ditto.
11076
11077         * constant.cs (Constant::Constant): Update constructor similarly.
11078         Use System.Collections.
11079
11080         * parameter.cs (Parameter::Parameter): Update as above.
11081
11082 2001-09-02  Ravi Pratap  <ravi@ximian.com>
11083
11084         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
11085         (TypeContainer.delegates): New member to hold list of delegates.
11086
11087         * cs-parser.jay (delegate_declaration): Implement the action correctly 
11088         this time as I seem to be on crack ;-)
11089
11090 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
11091
11092         * rootcontext.cs (RootContext::IsNamespace): new function, used to
11093         tell whether an identifier represents a namespace.
11094
11095         * expression.cs (NamespaceExpr): A namespace expression, used only
11096         temporarly during expression resolution.
11097         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
11098         utility functions to resolve names on expressions.
11099
11100 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
11101
11102         * codegen.cs: Add hook for StatementExpressions. 
11103
11104         * class.cs: Fix inverted test for static flag in methods.
11105
11106 2001-09-02  Ravi Pratap  <ravi@ximian.com>
11107
11108         * class.cs (Operator::CheckUnaryOperator): Correct error number used
11109         to make it coincide with MS' number.
11110         (Operator::CheckBinaryOperator): Ditto.
11111
11112         * ../errors/errors.txt : Remove error numbers added earlier.
11113
11114         * ../errors/cs1019.cs : Test case for error # 1019
11115
11116         * ../errros/cs1020.cs : Test case for error # 1020
11117
11118         * cs-parser.jay : Clean out commented cruft.
11119         (dimension_separators, dimension_separator): Comment out. Ostensibly not
11120         used anywhere - non-reducing rule.
11121         (namespace_declarations): Non-reducing rule - comment out.
11122
11123         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
11124         with TypeContainer::AddEnum.
11125
11126         * delegate.cs : New file for delegate handling classes.
11127         (Delegate): Class for declaring delegates.
11128
11129         * makefile : Update.
11130
11131         * cs-parser.jay (delegate_declaration): Implement.
11132
11133 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
11134
11135         * class.cs (Event::Define): Implement.
11136         (Event.EventBuilder): New member.
11137
11138         * class.cs (TypeContainer::Populate): Update to define all enums and events
11139         we have.
11140         (Events): New property for the events arraylist we hold. Shouldn't we move to using
11141         readonly fields for all these cases ?
11142
11143 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
11144
11145         * class.cs (Property): Revamp to use the convention of making fields readonly.
11146         Accordingly modify code elsewhere.
11147
11148         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
11149         the Define method of the Property class.
11150
11151         * class.cs : Clean up applied patch and update references to variables etc. Fix 
11152         trivial bug.
11153         (TypeContainer::Populate): Update to define all the properties we have. Also
11154         define all enumerations.
11155
11156         * enum.cs (Define): Implement.
11157         
11158 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
11159
11160         * cs-parser.jay (overloadable_operator): The semantic value is an
11161         enum of the Operator class.
11162         (operator_declarator): Implement actions.
11163         (operator_declaration): Implement.
11164
11165         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
11166         validity of definitions.
11167         (Operator::CheckBinaryOperator): Static method to check for binary operators
11168         (TypeContainer::AddOperator): New method to add an operator to a type.
11169
11170         * cs-parser.jay (indexer_declaration): Added line to actually call the
11171         AddIndexer method so it gets added ;-)
11172
11173         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
11174         already taken care of by the MS compiler ?  
11175
11176 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
11177
11178         * class.cs (Operator): New class for operator declarations.
11179         (Operator::OpType): Enum for the various operators.
11180
11181 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
11182
11183         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
11184         ostensibly handle this in semantic analysis.
11185
11186         * cs-parser.jay (general_catch_clause): Comment out
11187         (specific_catch_clauses, specific_catch_clause): Ditto.
11188         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
11189         (catch_args, opt_catch_args): New productions.
11190         (catch_clause): Rewrite to use the new productions above
11191         (catch_clauses): Modify accordingly.
11192         (opt_catch_clauses): New production to use in try_statement
11193         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
11194         and re-write the code in the actions to extract the specific and
11195         general catch clauses by being a little smart ;-)
11196
11197         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
11198         Hooray, try and catch statements parse fine !
11199         
11200 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11201
11202         * statement.cs (Block::GetVariableType): Fix logic to extract the type
11203         string from the hashtable of variables.
11204
11205         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
11206         I end up making that mistake ;-)
11207         (catch_clauses): Fixed gross error which made Key and Value of the 
11208         DictionaryEntry the same : $1 !!
11209
11210 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11211
11212         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
11213
11214         * cs-parser.jay (event_declaration): Correct to remove the semicolon
11215         when the add and remove accessors are specified. 
11216
11217 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11218
11219         * cs-parser.jay (IndexerDeclaration): New helper class to hold
11220         information about indexer_declarator.
11221         (indexer_declarator): Implement actions.
11222         (parsing_indexer): New local boolean used to keep track of whether
11223         we are parsing indexers or properties. This is necessary because 
11224         implicit_parameters come into picture even for the get accessor in the 
11225         case of an indexer.
11226         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
11227
11228         * class.cs (Indexer): New class for indexer declarations.
11229         (TypeContainer::AddIndexer): New method to add an indexer to a type.
11230         (TypeContainer::indexers): New member to hold list of indexers for the
11231         type.
11232
11233 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
11234
11235         * cs-parser.jay (add_accessor_declaration): Implement action.
11236         (remove_accessor_declaration): Implement action.
11237         (event_accessors_declaration): Implement
11238         (variable_declarators): swap statements for first rule - trivial.
11239
11240         * class.cs (Event): New class to hold information about event
11241         declarations.
11242         (TypeContainer::AddEvent): New method to add an event to a type
11243         (TypeContainer::events): New member to hold list of events.
11244
11245         * cs-parser.jay (event_declaration): Implement actions.
11246
11247 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
11248
11249         * cs-parser.jay (dim_separators): Implement. Make it a string
11250         concatenating all the commas together, just as they appear.
11251         (opt_dim_separators): Modify accordingly
11252         (rank_specifiers): Update accordingly. Basically do the same
11253         thing - instead, collect the brackets here.
11254         (opt_rank_sepcifiers): Modify accordingly.
11255         (array_type): Modify to actually return the complete type string
11256         instead of ignoring the rank_specifiers.
11257         (expression_list): Implement to collect the expressions
11258         (variable_initializer): Implement. We make it a list of expressions
11259         essentially so that we can handle the array_initializer case neatly too.
11260         (variable_initializer_list): Implement.
11261         (array_initializer): Make it a list of variable_initializers
11262         (opt_array_initializer): Modify accordingly.
11263
11264         * expression.cs (New::NType): Add enumeration to help us
11265         keep track of whether we have an object/delegate creation
11266         or an array creation.
11267         (New:NewType, New::Rank, New::Indices, New::Initializers): New
11268         members to hold data about array creation.
11269         (New:New): Modify to update NewType
11270         (New:New): New Overloaded contructor for the array creation
11271         case.
11272
11273         * cs-parser.jay (array_creation_expression): Implement to call
11274         the overloaded New constructor.
11275         
11276 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
11277
11278         * class.cs (TypeContainer::Constructors): Return member
11279         constructors instead of returning null.
11280
11281 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
11282
11283         * typemanager.cs (InitCoreTypes): Initialize the various core
11284         types after we have populated the type manager with the user
11285         defined types (this distinction will be important later while
11286         compiling corlib.dll)
11287
11288         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
11289         on Expression Classification.  Now all expressions have a method
11290         `Resolve' and a method `Emit'.
11291
11292         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
11293         generation from working.     Also add some temporary debugging
11294         code. 
11295         
11296 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
11297
11298         * codegen.cs: Lots of code generation pieces.  This is only the
11299         beginning, will continue tomorrow with more touches of polish.  We
11300         handle the fundamentals of if, while, do, for, return.  Others are
11301         trickier and I need to start working on invocations soon.
11302         
11303         * gen-treedump.cs: Bug fix, use s.Increment here instead of
11304         s.InitStatement. 
11305
11306         * codegen.cs (EmitContext): New struct, used during code
11307         emission to keep a context.   Most of the code generation will be
11308         here. 
11309
11310         * cs-parser.jay: Add embedded blocks to the list of statements of
11311         this block.  So code generation proceeds in a top down fashion.
11312
11313 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
11314
11315         * statement.cs: Add support for multiple child blocks.
11316
11317 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
11318
11319         * codegen.cs (EmitCode): New function, will emit the code for a
11320         Block of code given a TypeContainer and its ILGenerator. 
11321
11322         * statement.cs (Block): Standard public readonly optimization.
11323         (Block::Block constructors): Link children. 
11324         (Block::Child): Child Linker.
11325         (Block::EmitVariables): Emits IL variable declarations.
11326
11327         * class.cs: Drop support for MethodGroups here, delay until
11328         Semantic Analysis.
11329         (Method::): Applied the same simplification that I did before, and
11330         move from Properties to public readonly fields.
11331         (Method::ParameterTypes): Returns the parameter types for the
11332         function, and implements a cache that will be useful later when I
11333         do error checking and the semantic analysis on the methods is
11334         performed.
11335         (Constructor::GetCallingConvention): Renamed from CallingConvetion
11336         and made a method, optional argument tells whether this is a class
11337         or a structure to apply the `has-this' bit.
11338         (Method::GetCallingConvention): Implement, returns the calling
11339         convention. 
11340         (Method::Define): Defines the type, a second pass is performed
11341         later to populate the methods.
11342
11343         (Constructor::ParameterTypes): implement a cache similar to the
11344         one on Method::ParameterTypes, useful later when we do semantic
11345         analysis. 
11346
11347         (TypeContainer::EmitMethod):  New method.  Emits methods.
11348
11349         * expression.cs: Removed MethodGroup class from here.
11350         
11351         * parameter.cs (Parameters::GetCallingConvention): new method.
11352
11353 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
11354
11355         * class.cs (TypeContainer::Populate): Drop RootContext from the
11356         argument. 
11357
11358         (Constructor::CallingConvention): Returns the calling convention.
11359         (Constructor::ParameterTypes): Returns the constructor parameter
11360         types. 
11361         
11362         (TypeContainer::AddConstructor): Keep track of default constructor
11363         and the default static constructor.
11364
11365         (Constructor::) Another class that starts using `public readonly'
11366         instead of properties. 
11367
11368         (Constructor::IsDefault): Whether this is a default constructor. 
11369
11370         (Field::) use readonly public fields instead of properties also.
11371
11372         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
11373         track of static constructors;  If none is used, turn on
11374         BeforeFieldInit in the TypeAttributes. 
11375
11376         * cs-parser.jay (opt_argument_list): now the return can be null
11377         for the cases where there are no arguments. 
11378
11379         (constructor_declarator): If there is no implicit `base' or
11380         `this', then invoke the default parent constructor. 
11381         
11382         * modifiers.cs (MethodAttr): New static function maps a set of
11383         modifiers flags into a MethodAttributes enum
11384         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
11385         MethodAttr, TypeAttr to represent the various mappings where the
11386         modifiers are used.
11387         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
11388
11389 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
11390
11391         * parameter.cs (GetParameterInfo): Fix bug where there would be no
11392         method arguments.
11393
11394         * interface.cs (PopulateIndexer): Implemented the code generator
11395         for interface indexers.
11396
11397 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
11398
11399         * interface.cs (InterfaceMemberBase): Now we track the new status
11400         here.  
11401
11402         (PopulateProperty): Implement property population.  Woohoo!  Got
11403         Methods and Properties going today. 
11404
11405         Removed all the properties for interfaces, and replaced them with
11406         `public readonly' fields. 
11407
11408 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
11409
11410         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
11411         initialize their hashtables/arraylists only when they are needed
11412         instead of doing this always.
11413
11414         * parameter.cs: Handle refs and out parameters.
11415
11416         * cs-parser.jay: Use an ArrayList to construct the arguments
11417         instead of the ParameterCollection, and then cast that to a
11418         Parameter[] array.
11419
11420         * parameter.cs: Drop the use of ParameterCollection and use
11421         instead arrays of Parameters.
11422
11423         (GetParameterInfo): Use the Type, not the Name when resolving
11424         types. 
11425
11426 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
11427
11428         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
11429         and instead use public readonly fields.
11430
11431         * class.cs: Put back walking code for type containers.
11432
11433 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
11434
11435         * class.cs (MakeConstant): Code to define constants.
11436
11437         * rootcontext.cs (LookupType): New function.  Used to locate types 
11438
11439         
11440 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
11441
11442         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
11443         this System.Reflection code is.  Kudos to Microsoft
11444         
11445         * typemanager.cs: Implement a type cache and avoid loading all
11446         types at boot time.  Wrap in LookupType the internals.  This made
11447         the compiler so much faster.  Wow.  I rule!
11448         
11449         * driver.cs: Make sure we always load mscorlib first (for
11450         debugging purposes, nothing really important).
11451
11452         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
11453         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
11454
11455         * rootcontext.cs: Lookup types on their namespace;  Lookup types
11456         on namespaces that have been imported using the `using' keyword.
11457
11458         * class.cs (TypeContainer::TypeAttr): Virtualize.
11459         (Class::TypeAttr): Return attributes suitable for this bad boy.
11460         (Struct::TypeAttr): ditto.
11461         Handle nested classes.
11462         (TypeContainer::) Remove all the type visiting code, it is now
11463         replaced with the rootcontext.cs code
11464
11465         * rootcontext.cs (GetClassBases): Added support for structs. 
11466
11467 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
11468
11469         * interface.cs, statement.cs, class.cs, parameter.cs,
11470         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
11471         Drop use of TypeRefs, and use strings instead.
11472
11473 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
11474
11475         * rootcontext.cs: 
11476
11477         * class.cs (Struct::Struct): set the SEALED flags after
11478         checking the modifiers.
11479         (TypeContainer::TypeAttr): new property, returns the
11480         TypeAttributes for a class.  
11481
11482         * cs-parser.jay (type_list): Oops, list production was creating a
11483         new list of base types.
11484
11485         * rootcontext.cs (StdLib): New property.
11486         (GetInterfaceTypeByName): returns an interface by type name, and
11487         encapsulates error handling here.
11488         (GetInterfaces): simplified.
11489         (ResolveTree): Encapsulated all the tree resolution here.
11490         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
11491         types. 
11492         
11493         * driver.cs: Add support for --nostdlib, to avoid loading the
11494         default assemblies.
11495         (Main): Do not put tree resolution here. 
11496
11497         * rootcontext.cs: Beginning of the class resolution.
11498
11499 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
11500
11501         * rootcontext.cs: Provide better error reporting. 
11502
11503         * cs-parser.jay (interface_base): set our $$ to be interfaces.
11504
11505         * rootcontext.cs (CreateInterface): Handle the case where there
11506         are no parent interfaces.
11507         
11508         (CloseTypes): Routine to flush types at the end.
11509         (CreateInterface): Track types.
11510         (GetInterfaces): Returns an array of Types from the list of
11511         defined interfaces.
11512
11513         * typemanager.c (AddUserType): Mechanism to track user types (puts
11514         the type on the global type hash, and allows us to close it at the
11515         end). 
11516         
11517 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
11518
11519         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
11520         RecordInterface instead.
11521
11522         * cs-parser.jay: Updated to reflect changes above.
11523
11524         * decl.cs (Definition): Keep track of the TypeBuilder type that
11525         represents this type here.  Not sure we will use it in the long
11526         run, but wont hurt for now.
11527
11528         * driver.cs: Smaller changes to accomodate the new code.
11529
11530         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
11531         when done. 
11532
11533         * rootcontext.cs (CreateInterface):  New method, used to create
11534         the System.TypeBuilder type for interfaces.
11535         (ResolveInterfaces): new entry point to resolve the interface
11536         hierarchy. 
11537         (CodeGen): Property, used to keep track of the code generator.
11538
11539 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
11540
11541         * cs-parser.jay: Add a second production for delegate_declaration
11542         with `VOID'.
11543
11544         (enum_body): Put an opt_comma here instead of putting it on
11545         enum_body or enum_member_declarations so we can handle trailing
11546         commas on enumeration members.  Gets rid of a shift/reduce.
11547         
11548         (type_list): Need a COMMA in the middle.
11549
11550         (indexer_declaration): Tell tokenizer to recognize get/set
11551
11552         * Remove old targets.
11553
11554         * Re-add the parser target.
11555
11556 2001-07-13  Simon Cozens <simon@simon-cozens.org>
11557
11558         * cs-parser.jay: Add precendence rules for a number of operators
11559         ot reduce the number of shift/reduce conflicts in the grammar.
11560         
11561 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
11562
11563         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
11564         and put it here.
11565
11566         Get rid of old crufty code.
11567
11568         * rootcontext.cs: Use this to keep track of the parsed
11569         representation and the defined types available to the program. 
11570
11571         * gen-treedump.cs: adjust for new convention.
11572
11573         * type.cs: Split out the type manager, and the assembly builder
11574         from here. 
11575
11576         * typemanager.cs: the type manager will live here now.
11577
11578         * cil-codegen.cs: And the code generator here. 
11579
11580 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
11581
11582         * makefile: Fixed up for easy making.
11583
11584 2001-07-13  Simon Cozens <simon@simon-cozens.org>
11585
11586         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
11587         the 
11588
11589         (unary_expression): Expand pre_increment_expression and
11590         post_decrement_expression to reduce a shift/reduce.
11591
11592 2001-07-11  Simon Cozens
11593
11594         * cs-tokenizer.cs: Hex numbers should begin with a 0.
11595
11596         Improve allow_keyword_as_indent name.
11597
11598 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
11599
11600         * Adjustments for Beta2. 
11601
11602 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
11603
11604         * decl.cs: Added `Define' abstract method.
11605         (InTransit): new property, used to catch recursive definitions. 
11606
11607         * interface.cs: Implement `Define'. 
11608
11609         * modifiers.cs: Map Modifiers.constants to
11610         System.Reflection.TypeAttribute flags.
11611
11612         * class.cs: Keep track of types and user-defined types.
11613         (BuilderInit): New method for creating an assembly
11614         (ResolveType): New function to launch the resolution process, only
11615         used by interfaces for now.
11616
11617         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
11618         that are inserted into the name space. 
11619
11620 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
11621
11622         * ARGH.  I have screwed up my tree so many times due to the use of
11623         rsync rather than using CVS.  Going to fix this at once. 
11624
11625         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
11626         load types.
11627
11628 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
11629
11630         * Experiment successful: Use System.Type rather that our own
11631         version of Type.  
11632
11633 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
11634
11635         * cs-parser.jay: Removed nsAliases from here.
11636
11637         Use new namespaces, handle `using XXX;' 
11638
11639         * namespace.cs: Reimplemented namespace handling, use a recursive
11640         definition of the class.  Now we can keep track of using clauses
11641         and catch invalid using clauses.
11642
11643 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
11644
11645         * gen-treedump.cs: Adapted for all the renaming.
11646
11647         * expression.cs (Expression): this class now has a Type property
11648         which returns an expression Type.
11649
11650         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
11651         `Type', as this has a different meaning now in the base
11652
11653 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
11654
11655         * interface.cs, class.cs: Removed from all the sources the
11656         references to signature computation, as we can not do method
11657         signature computation during the parsing time, as we are not
11658         trying to solve at that point distinguishing:
11659
11660         class X {
11661                 void a (Blah x) {}
11662                 void a (NS.Blah x) {}
11663         }
11664
11665         Which depending on the context might be valid or not, as we do not
11666         know if Blah is the same thing as NS.Blah at that point.
11667
11668         * Redid everything so the code uses TypeRefs now instead of
11669         Types.  TypeRefs are just temporary type placeholders, that need
11670         to be resolved.  They initially have a pointer to a string and the
11671         current scope in which they are used.  This is used later by the
11672         compiler to resolve the reference to an actual Type. 
11673
11674         * DeclSpace is no longer a CIR.Type, and neither are
11675         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
11676         are all DeclSpaces, but no Types. 
11677
11678         * type.cs (TypeRefManager): This implements the TypeRef manager,
11679         which keeps track of all the types that need to be resolved after
11680         the parsing has finished. 
11681
11682 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
11683
11684         * ARGH.  We are going to have to store `foreach' as a class rather
11685         than resolving it, as we need to verify error 1579 after name
11686         resolution.   *OR* we could keep a flag that says `This request to
11687         IEnumerator comes from a foreach statement' which we can then use
11688         to generate the error.
11689
11690 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
11691
11692         * class.cs (TypeContainer.AddMethod): we now add methods to the
11693         MethodGroup instead of the method hashtable.  
11694
11695         * expression.cs: Add MethodGroup abstraction, which gets us one
11696         step closer to the specification in the way we handle method
11697         declarations.  
11698
11699         * cs-parser.jay (primary_expression): qualified_identifier now
11700         tried to match up an identifier to a local variable reference or
11701         to a parameter reference.
11702
11703         current_local_parameters is now a parser global variable that
11704         points to the current parameters for the block, used during name
11705         lookup.
11706
11707         (property_declaration): Now creates an implicit `value' argument to
11708         the set accessor.
11709
11710 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
11711
11712         * parameter.cs: Do not use `param' arguments as part of the
11713         signature, per the spec.
11714
11715 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
11716
11717         * decl.cs: Base class for classes, structs and interfaces.  This
11718         is the "Declaration Space" 
11719
11720         * cs-parser.jay: Use CheckDef for checking declaration errors
11721         instead of having one on each function.
11722
11723         * class.cs: Factor out some code for handling error handling in
11724         accordance to the "Declarations" section in the "Basic Concepts"
11725         chapter in the ECMA C# spec.
11726
11727         * interface.cs: Make all interface member classes derive from
11728         InterfaceMemberBase.
11729
11730 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
11731
11732         * Many things: all interfaces are parsed and generated in
11733         gen-treedump.  Support for member variables, constructors,
11734         destructors, properties, constants is there.
11735
11736         Beginning of the IL backend, but very little done, just there for
11737         testing purposes. 
11738
11739 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
11740
11741         * cs-parser.jay: Fix labeled statement.
11742
11743         * cs-tokenizer.cs (escape): Escape " and ' always.
11744         ref_line, ref_name: keep track of the line/filename as instructed
11745         by #line by the compiler.
11746         Parse #line.
11747
11748 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
11749
11750         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
11751         to match the values in System.CodeDOM.
11752
11753         Divid renamed to Divide.
11754
11755         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
11756         statements. 
11757         (Statements.set): remove.
11758
11759         * System.CodeDOM/CodeCatchClause.cs: always have a valid
11760         statements. 
11761
11762         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
11763         falseStatements always have valid values. 
11764
11765         * cs-parser.jay: Use System.CodeDOM now.
11766