2003-12-08 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / mcs / ChangeLog
1 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
2
3         * codegen.cs (Init): Create the dynamic assembly with 
4         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
5
6 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
7
8         * support.cs: Make the PtrHashtable use only one
9         instance of its comparer.
10
11 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
12
13         * typemanager.cs: Fix lookup of GetNamespaces.
14
15 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
16
17         * expression.cs: Removed redundant line.
18
19         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
20         ArrayLists, use for loops with bounds.  
21
22         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
23         arraylist.
24
25         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
26         arraylists, use for loop with bounds.
27
28         The above three changes give us a 0.071 second performance
29         improvement out of 3.294 seconds down to 3.223.  On my machine
30         the above changes reduced the memory usage by 1,387 KB during
31         compiler bootstrap.
32
33         * cs-parser.jay (QualifiedIdentifier): New class used to represent
34         QualifiedIdentifiers.  Before we created a new string through
35         concatenation, and mostly later on, the result would be
36         manipulated by DecomposeQI through string manipulation.
37
38         This reduced the compiler memory usage for bootstrapping from
39         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
40         compile times in 0.05 seconds.
41
42 2003-11-28  Dick Porter  <dick@ximian.com>
43
44         * support.cs: Do string compares with the Invariant culture.
45
46         * rootcontext.cs: 
47         * gen-treedump.cs: 
48         * expression.cs: 
49         * driver.cs: 
50         * decl.cs: 
51         * codegen.cs: 
52         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
53         the comparison is done with the Invariant culture.
54
55 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
56
57         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
58         GetEnumerator method.
59
60         (ProbeCollectionType): Iterate starting at the most specific type
61         upwards looking for a GetEnumerator
62
63         * expression.cs: Shift count can be up to 31 for int/uint and 63
64         for long/ulong.
65
66 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
67
68         * statement.cs (Block.LookupLabel): Also look for the label on the
69         children blocks.  Use a hash table to keep track of visited
70         nodes. 
71
72         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
73         we actually did transform the other operand, otherwise fall back
74         to the common codepath that casts to long.
75
76         * cs-tokenizer.cs: Use the same code pattern as the int case.
77         Maybe I should do the parsing myself, and avoid depending on the
78         Parse routines to get this done.
79
80 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
81
82         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
83         which fixes bug 51347.  This time test it.
84         
85         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
86         attributes for example can not tell the difference between these.
87         The difference was only a syntax feature of the language. 
88
89         * attribute.cs: Apply attributes to delegates.
90
91         * delegate.cs: Call the apply attributes method.
92
93 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
94
95         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
96         comparing 0 vs Byte.MinValue, not the value
97
98         (ImplicitConversionRequired): When reporting a conversion error,
99         use error 31 to print out the constant error instead of the
100         simpler 29.
101
102         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
103         which fixes bug 51347.
104         
105 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
106
107         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
108         which fixes the -warnaserror command line option.
109         
110 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
111
112         * cfold.cs (DoNumericPromotions): During constant folding of
113         additions on UIntConstant, special case intconstants with
114         IntConstants like we do on the expression binary operator. 
115
116 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
117
118         * convert.cs (ImplicitReferenceConversion): We were missing a case
119         (System.Enum are not value types or class types, so we need to
120         classify them separatedly).
121
122         * driver.cs: We do not support error 2007.
123
124 2003-11-12 Jackson Harper <jackson@ximian.com>
125
126         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
127         system directory. Also use the full file name so users can
128         libraries names mscorlib-o-tron.dll in a non system dir.
129         
130 2003-11-10  Martin Baulig  <martin@ximian.com>
131
132         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
133         (TypeManager.InitCoreTypes): Initialize them here, but instead of
134         calling `ResolveType()' on them, directly assign their `Type'.
135
136 2003-11-08  Martin Baulig  <martin@ximian.com>
137
138         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
139         return value and the `out parent' parameter.
140         (TypeContainer.DefineType): Moved the CS0644 check into
141         GetClassBases().  Don't pass the interface types to the
142         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
143         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
144
145         * ecore.cs (TypeExpr.IsAttribute): New property.
146         (TypeExpr.GetInterfaces): New method.
147
148         * interface.cs (Interface.GetInterfaceTypeByName): Return a
149         TypeExpr instead of a Type.
150         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
151         (Interface.DefineType): Don't pass the interface types to the
152         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
153         them later and then call `TypeBulider.AddInterfaceImplementation()'.
154
155         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
156         instead of a `Type[]'.
157         (TypeManager.RegisterBuilder): Likewise.
158         (TypeManager.AddUserInterface): Likewise.
159         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
160         `Type[]' and also return a `TypeExpr[]'.
161         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
162
163 2003-11-08  Martin Baulig  <martin@ximian.com>
164
165         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
166         Expression.     
167
168 2003-11-08  Martin Baulig  <martin@ximian.com>
169
170         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
171         TypeManager.ResolveExpressionTypes().
172
173         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
174         instead of an Expression.
175         (TypeExpr): This is now an abstract base class for `TypeExpression'.
176         (TypeExpression): New public class; formerly known as `TypeExpr'.
177
178         * expression.cs (ComposedCast): Derive from TypeExpr.
179
180         * typemanager.cs (TypeManager.system_*_expr): These are now
181         TypExpr's instead of Expression's.
182         (TypeManager.ResolveExpressionTypes): New public static function;
183         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
184         of them.        
185
186 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
187
188         * expression.cs (New.DoResolve): Do not dereference value that
189         might be a null return.
190
191         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
192         sure that the constant value has the right type.  Fixes an
193         unreported bug, similar to 50425.
194
195         * const.cs (Const.LookupConstantValue): Call
196         ImplicitStandardConversionExists before doing a conversion to
197         avoid havng the TypeManager.ChangeType do conversions.
198
199         Reduced the number of casts used
200
201         (Const.ChangeType): New routine to enable reuse of the constant
202         type changing code from statement.
203
204         * typemanager.cs (ChangeType): Move common initialization to
205         static global variables.
206
207         Fixes #50425.
208
209         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
210         every value type to go through, even if it was void.  Fix that. 
211
212         * cs-tokenizer.cs: Use is_identifier_start_character on the start
213         character of the define, and the is_identifier_part_character for
214         the rest of the string.
215
216 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
217
218         * expression.cs (UnaryMutator.EmitCode): When I updated
219         LocalVariableReference.DoResolve, I overdid it, and dropped an
220         optimization done on local variable references.
221
222 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
223
224         * ecore.cs: Convert the return from Ldlen into an int.
225
226 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
227
228         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
229         the accessibility, this is a special case for toplevel non-public
230         classes (internal for instance).
231
232 2003-10-20  Nick Drochak <ndrochak@gol.com>
233
234         * ecore.cs: Fix typo and build.  Needed another right paren.
235
236 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
237
238         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
239         `internal' case regular and protected, but not allowing protected
240         to be evaluated later.  Bug 49840
241
242 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
243
244         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
245         to kb.Nlast, and not the kb.nFirst to isolate the switch
246         statement.
247
248         Extract the underlying type, so enumerations of long/ulong are
249         treated like long/ulong.
250
251 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
252
253         * expression.cs (New): Overload the meaning of RequestedType to
254         track the possible creation of the NewDelegate type, since
255         DoResolve is invoked more than once for new constructors on field
256         initialization.
257
258         See bugs: #48800 and #37014
259
260         * cs-parser.jay (declare_local_constants): Take an arraylist
261         instead of a single constant.
262
263         (local_constant_declaration): It should take a
264         constant_declarators, not a constant_declarator.  Fixes 49487
265
266         * convert.cs: Fix error report.
267
268 2003-10-13 Jackson Harper <jackson@ximian.com>
269
270         * typemanager.cs (TypeToCoreType): Add float and double this fixes
271         bug #49611
272         
273 2003-10-09  Martin Baulig  <martin@ximian.com>
274
275         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
276         to the .ctor.
277         (MethodCore.DoDefineParameters): Removed the TypeContainer
278         argument; use the DeclSpace which was passed to the .ctor instead.
279         (MethodCore.CheckParameter): Take a DeclSpace instead of a
280         TypeContainer; we only need a DeclSpace here.
281
282 2003-10-09  Martin Baulig  <martin@ximian.com>
283
284         * class.cs (MethodData): Added additional `DeclSpace ds' argument
285         to the .ctor.
286         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
287         EmitContext's .ctor.    
288
289 2003-10-09  Martin Baulig  <martin@ximian.com>
290
291         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
292         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
293         AsAccessible(), moved them as well.
294
295         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
296
297 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
298
299         * cs-parser.jay : Renamed yyName to yyNames related to jay.
300
301 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
302
303         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
304         generation for >=, as spotted by Paolo, bug 48679.  
305         Patch from David Waite.
306
307         * cs-tokenizer.cs: Add handling for #pragma.
308
309         * cs-parser.jay: Allow for both yield and yield return in the
310         syntax.  The anti-cobolization of C# fight will go on!
311
312         * class.cs (TypeBuilder.DefineType): Catch error condition here
313         (Parent.DefineType erroring out and returning null).
314
315         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
316         coping with enumerations variables, we were mistakenly processing
317         them as a regular value type instead of built-in types.  Fixes the
318         bug #48063
319
320         * typemanager.cs (IsBuiltinOrEnum): New method.
321
322 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
323
324         * cs-parser.jay: Upgrade: yield now needs the return clause.
325
326 2003-09-19  Martin Baulig  <martin@ximian.com>
327
328         * decl.cs (MemberCache.SetupCacheForInterface): Take a
329         `MemberCache parent' argument.  Normally, an interface doesn't
330         have a parent type except System.Object, but we use this in gmcs
331         for generic type parameters.
332
333 2003-09-18  Martin Baulig  <martin@ximian.com>
334
335         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
336         on `type.IsInterface'; don't check whether the type has a parent
337         to determine whether it's an interface.
338
339 2003-09-15  Martin Baulig  <martin@ximian.com>
340
341         * class.cs (TypeContainer.DefineType): Added an error flag to
342         avoid reporting duplicate CS0146's ("class definition is
343         circular.").
344
345         * driver.cs (Driver.MainDriver): Abort if
346         RootContext.ResolveTree() reported any errors.
347
348 2003-09-07  Martin Baulig  <martin@ximian.com>
349
350         * report.cs (Error, Warning): Added overloaded versions which take
351         a `params object[] args' and call String.Format().
352
353 2003-09-07  Martin Baulig  <martin@ximian.com>
354
355         * decl.cs (DeclSpace..ctor): Don't call
356         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
357         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
358         (DeclSpace.RecordDecl): New method.
359
360         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
361
362 2003-09-02  Ravi Pratap  <ravi@ximian.com>
363
364         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
365         value attributes to be applied to ParameterBuilders.
366
367         * class.cs (MethodCore.LabelParameters): Make static and more
368         generic so that it can be used from other places - like interface
369         methods, for instance.
370
371         * interface.cs (Interface.Emit): Call LabelParameters before
372         emitting attributes on the InterfaceMethod.
373
374 2003-08-26  Martin Baulig  <martin@ximian.com>
375
376         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
377         resolving aliases; fixes #47927.
378
379 2003-08-26  Martin Baulig  <martin@ximian.com>
380
381         * statement.cs (Using.DoResolve): This is internally emitting a
382         try/finally clause, so we need to set ec.NeedExplicitReturn if we
383         do not always return.  Fixes #47681.
384
385 2003-08-26  Martin Baulig  <martin@ximian.com>
386
387         * decl.cs (MemberCore): Moved WarningNotHiding(),
388         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
389         into MemberBase.
390         (AdditionResult): Make this nested in DeclSpace.
391         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
392         argument; call NamespaceEntry.Define() unless we're nested in a
393         class or struct.
394
395         * namespace.cs (Namespace.DefineName): New public function.  This
396         is called from DeclSpace's .ctor to add 
397         (Namespace.Lookup): Include DeclSpaces in the lookup.
398
399         * class.cs (Operator): Derive from MemberBase, not MemberCore.
400
401         * const.cs (Const): Derive from MemberBase, not MemberCore.     
402
403 2003-08-25  Martin Baulig  <martin@ximian.com>
404
405         * convert.cs (Convert.ExplicitReferenceConversion): When
406         converting from an interface type to a class, unbox if the target
407         type is a struct type.  Fixes #47822.
408
409 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
410
411         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
412         #47854.
413
414 2003-08-22  Martin Baulig  <martin@ximian.com>
415
416         * class.cs (TypeManager.DefineType): When defining a nested type,
417         call DefineType() on our parent; fixes #47801.
418
419 2003-08-22  Martin Baulig  <martin@ximian.com>
420
421         * class.cs (MethodData.Define): While checking if a method is an
422         interface implementation, improve the test a bit more to fix #47654.
423
424 2003-08-22  Martin Baulig  <martin@ximian.com>
425
426         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
427         correctly; fixes #47722.
428
429 2003-08-22  Martin Baulig  <martin@ximian.com>
430
431         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
432         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
433
434         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
435
436 2003-08-22  Martin Baulig  <martin@ximian.com>
437
438         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
439         can only be assigned in static constructors.  Fixes #47161.
440
441 2003-08-22  Martin Baulig  <martin@ximian.com>
442
443         Rewrote and improved the flow analysis code.
444
445         * flowbranching.cs (FlowBranching): Make this class abstract.
446         (FlowBranching.CreateBranching): New static function to create a
447         new flow branching.
448         (FlowBranchingBlock, FlowBranchingException): New classes.
449         (FlowBranching.UsageVector.Type): New public readonly field.
450         (FlowBranching.UsageVector.Breaks): Removed the setter.
451         (FlowBranching.UsageVector.Returns): Removed the setter.
452         (FlowBranching.UsageVector): Added Break(), Return(),
453         NeverReachable() and Throw() methods to modify the reachability.
454         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
455         done by FlowBranching.Merge().
456         (FlowBranching.UsageVector.MergeChild): New method; merges the
457         merge result into the current vector.
458         (FlowBranching.Merge): New abstract method to merge a branching.
459
460 2003-08-12  Martin Baulig  <martin@ximian.com>
461
462         * expression.cs (Indirection.CacheTemporaries): Create the
463         LocalTemporary with the pointer type, not its element type.
464
465 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
466
467         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
468         token was a keyword or not.
469
470         Add `error' options where an IDENTIFIER was expected;  Provide
471         CheckToken and CheckIdentifierToken convenience error reporting
472         functions. 
473
474         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
475
476         * decl.cs: Rename `NamespaceEntry Namespace' public field into
477         NameSpaceEntry NameSpaceEntry.
478
479         (LookupInterfaceOrClass): Avoid creating a full qualified name
480         from namespace and name: avoid doing lookups when we know the
481         namespace is non-existant.   Use new Tree.LookupByNamespace which
482         looks up DeclSpaces based on their namespace, name pair.
483
484         * driver.cs: Provide a new `parser verbose' to display the
485         exception thrown during parsing.  This is turned off by default
486         now, so the output of a failure from mcs is more graceful.
487
488         * namespace.cs: Track all the namespaces defined in a hashtable
489         for quick lookup.
490         
491         (IsNamespace): New method
492
493 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
494
495         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
496         we know that we need to concatenate (full typename can never be
497         null). 
498
499         * class.cs: ditto.
500
501         * statement.cs: Use a bitfield;  Do not initialize to null things
502         which are done by the constructor by default.
503
504         * cs-parser.jay: bug fix, parameter was 4, not 3.
505
506         * expression.cs: Just use the property;
507
508         * statement.cs: No need for GetVariableInfo method.
509
510 2003-08-08  Martin Baulig  <martin@ximian.com>
511
512         * flowanalysis.cs (FlowReturns): This is now nested in the
513         `FlowBranching' class.
514         (MyBitVector): Moved this here from statement.cs.
515         (FlowBranching.SiblingType): New enum type.
516         (FlowBranching.CreateSibling): Added `SiblingType' argument.
517
518 2003-08-07  Martin Baulig  <martin@ximian.com>
519
520         * flowanalysis.cs (FlowBranchingType): This is now nested in the
521         `FlowBranching' class and called `BranchingType'.
522
523 2003-08-07  Martin Baulig  <martin@ximian.com>
524
525         * flowanalysis.cs: Moved all the control flow analysis code into
526         its own file.
527
528 2003-08-07  Martin Baulig  <martin@ximian.com>
529
530         * assign.cs (Assign.DoResolve): `target' must either be an
531         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
532         #37319.
533
534 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
535
536         * expression.cs (BinaryMethod): This kind of expression is created by the
537         Binary class if it determines that the operator has to be handled
538         by a method.
539
540         (BinaryDelegate): This kind of expression is created if we are
541         dealing with a + or - operator on delegates.
542
543         (Binary): remove method, argumetns, and DelegateOperator: when
544         dealing with methods, 
545         
546         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
547
548         * statement.cs (Block): use bitfields for the three extra booleans
549         we had in use.   Remove unused topblock parameter.
550
551         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
552
553         * assign.cs: Drop extra unneeded tests.
554
555 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
556
557         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
558
559         * statement.cs (Foreach): Use VariableStorage instead of
560         LocalBuilders.   
561
562         * codegen.cs (VariableStorage): New class used by clients that
563         require a variable stored: locals or fields for variables that
564         need to live across yield.
565
566         Maybe provide a convenience api for EmitThis+EmitLoad?
567
568         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
569         these bad boys.
570
571 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
572
573         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
574         RemapParameterLValue): New methods that are used to turn a
575         precomputed FieldInfo into an expression like this:
576
577                 instance.FieldInfo
578
579         The idea is to use this instead of making LocalVariableReference
580         have more than one meaning.
581
582         * cs-parser.jay: Add error production to BASE.
583
584         * ecore.cs: Deal with TypeManager.GetField returning null, which
585         is now a valid return value.
586
587         (FieldExprNoAddress): New expression for Fields whose address can
588         not be taken.
589
590         * expression.cs (LocalVariableReference): During the resolve
591         phases, create new expressions if we are in a remapping context.
592         Remove code that dealt with remapping here.
593
594         (ParameterReference): same.
595
596         (ProxyInstance): New expression, like the `This' expression, but
597         it is born fully resolved.  We know what we are doing, so remove
598         the errors that are targeted to user-provided uses of `this'.
599
600         * statement.cs (Foreach): our variable is now stored as an
601         Expression;  During resolution, follow the protocol, dont just
602         assume it will return this.
603         
604 2003-08-06  Martin Baulig  <martin@ximian.com>
605
606         * support.cs (SeekableStreamReader.cs): New public class.
607
608         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
609         SeekableStreamReader instead of the normal StreamReader.
610
611 2003-08-04  Martin Baulig  <martin@ximian.com>
612
613         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
614         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
615         deambiguate casts and delegate invocations.
616         (parenthesized_expression): Use the new tokens to ensure this is
617         not a cast of method invocation.
618
619         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
620         when reading a `)' and Deambiguate_CloseParens () was previously
621         called.
622
623         * expression.cs (ParenthesizedExpression): New class.  This is
624         just used for the CS0075 test.
625         (Binary.DoResolve): Check for CS0075.   
626
627 2003-07-29  Ravi Pratap  <ravi@ximian.com>
628
629         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
630         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
631         reference comparison.
632
633         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
634         examine the ReturnType for equality - this is necessary in the
635         cases of implicit and explicit operators whose signature also
636         includes the return type.
637
638 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
639
640         * namespace.cs: Cache the result of the namespace computation,
641         instead of computing it every time.
642
643 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
644
645         * decl.cs: Use a global arraylist that we reuse over invocations
646         to avoid excesive memory consumption.  Reduces memory usage on an
647         mcs compile by one meg (45 average).
648
649         * typemanager.cs (LookupTypeReflection): In .NET pointers are
650         private, work around that.
651
652 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
653
654         * literal.cs (IntLiteral): Define Zero and One static literals. 
655
656         * cs-parser.jay (integer_literal): use static literals to reduce
657         memory usage for the most used literals (0, 1 and -1).  211kb
658         reduced in memory usage.
659
660         Replace all calls to `new ArrayList' with `new
661         ArrayList(4)' which is a good average number for most allocations,
662         and also requires only 16 bytes of memory for its buffer by
663         default. 
664
665         This reduced MCS memory usage in seven megabytes for the RSS after
666         bootstrapping.
667
668 2003-07-28  Ravi Pratap  <ravi@ximian.com>
669
670         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
671         handle params methods the correct way by forming only one
672         applicable set with params and normal methods in them. Earlier we
673         were looking at params methods only if we found no normal methods
674         which was not the correct thing to do.
675
676         (Invocation.BetterFunction): Take separate arguments indicating
677         when candidate and the best method are params methods in their
678         expanded form.
679
680         This fixes bugs #43367 and #46199.
681
682         * attribute.cs: Documentation updates.
683
684         (CheckAttribute): Rename to CheckAttributeTarget.
685         (GetValidPlaces): Rename to GetValidTargets.
686
687         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
688         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
689
690         Fixes bug #44468.
691
692 2003-07-28  Martin Baulig  <martin@ximian.com>
693
694         * class.cs (TypeContainer.DefineMembers): Use the base type's full
695         name when looking up the base class of a nested class.  Fixes #46977.
696
697 2003-07-26  Martin Baulig  <martin@ximian.com>
698
699         * expression.cs (Indexers.Indexer): New nested struct; contains
700         getter, setter and the indexer's type.
701         (Indexers.Properties): This is now an ArrayList of
702         Indexers.Indexer's.
703         (IndexerAccess.DoResolveLValue): Correctly set the type if the
704         indexer doesn't have any getters.
705
706         * assign.cs (Assign.DoResolve): Also do the implicit conversions
707         for embedded property and indexer assignments.
708
709 2003-07-26  Martin Baulig  <martin@ximian.com>
710
711         * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
712         preprocessor directive is not the first non-whitespace character
713         on a line.
714
715 2003-07-26  Martin Baulig  <martin@ximian.com>
716
717         * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
718         namespace parsing, follow the spec more closely.
719
720         * rootcontext.cs (RootContext.NamespaceLookup): Use the new
721         NamespaceEntry.Lookup().
722
723 2003-07-25  Martin Baulig  <martin@ximian.com>
724
725         * MethodCore.cs (OverridesSomething): New public field; it's set
726         from TypeContainer.DefineMembers if this method overrides
727         something (which doesn't need to be a method).  Fix #39462.
728
729 2003-07-25  Ravi Pratap  <ravi@ximian.com>
730
731         * typemanager.cs (GetMembers): Ensure that the list of members is
732         reversed. This keeps things in sync.
733
734         * attribute.cs (Attribute.CheckAttribute): Break as soon as we
735         find an AttributeUsage attribute.
736
737         * expression.cs (Invocation.OverloadResolve): Perform the check
738         which disallows Invoke to be directly called on a Delegate.
739
740         (Error_InvokeOnDelegate): Report error cs1533.
741         
742 2003-07-25  Martin Baulig  <martin@ximian.com>
743
744         * expression.cs (Indexers.GetIndexersForType): Only look in the
745         interface hierarchy if the requested type is already an
746         interface.  Fixes #46788 while keeping #46502 fixed.
747
748 2003-07-25  Martin Baulig  <martin@ximian.com>
749
750         * class.cs (TypeContainer.DefineMembers): Check whether all
751         readonly fields have been assigned and report warning CS0649 if
752         not.
753
754         * statement.cs (LocalInfo.IsFixed): Always return true if this is
755         a valuetype.
756
757 2003-07-24  Ravi Pratap  <ravi@ximian.com>
758
759         * decl.cs (MemberCache.AddMethods): Reverse the order of the array
760         returned from GetMethods to make things consistent with the
761         assumptions MCS makes about ordering of methods.
762
763         This should comprehensively fix bug #45127 and it does :-)
764
765         * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
766         ordering is actually reverse.
767
768         * Clean up some debug messages I left lying around.
769
770         * interface.cs (Populate*): Get rid of code which emits attributes
771         since the stage in which we emit attributes is the 'Emit' stage,
772         not the define stage.
773
774         (Emit): Move attribute emission for interface members here.
775         
776 2003-07-22  Ravi Pratap  <ravi@ximian.com>
777
778         * expression.cs (Invocation.OverloadResolve): Follow the spec more
779         closely: we eliminate methods in base types when we have an
780         applicable method in a top-level type.
781
782         Please see section 14.5.5.1 for an exact description of what goes
783         on. 
784
785         This fixes bug #45127 and a host of other related to corlib compilation.
786
787         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
788         array is the method corresponding to the top-level type (this is
789         because of the changes made to icall.c) so we change this
790         accordingly.
791
792         (MethodGroupExpr.Name): This too.
793
794         * typemanager.cs (GetElementType): New method which does the right
795         thing when compiling corlib. 
796
797         * everywhere: Make use of the above in the relevant places.
798
799 2003-07-22  Martin Baulig  <martin@ximian.com>
800
801         * cs-parser.jay (invocation_expression): Moved
802         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
803         `cast_expression', but create a InvocationOrCast which later
804         resolves to either an Invocation or a Cast.
805
806         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
807         method; call this before EmitStatement() to make sure that this
808         expression can be used as a statement.
809
810         * expression.cs (InvocationOrCast): New class; resolves to either
811         an Invocation or a Cast.
812
813         * statement.cs (StatementExpression): Call ResolveStatement() on
814         the ExpressionStatement before emitting it.
815
816 2003-07-21  Martin Baulig  <martin@ximian.com>
817
818         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
819         `ref' and `out' attributes match; fixes #46220.
820         (MemberAccess.ResolveMemberAccess): You can't reference a type
821         through an expression; fixes #33180.
822         (Indexers.GetIndexersForType): Don't return the indexers from
823         interfaces the class implements; fixes #46502.
824
825 2003-07-21  Martin Baulig  <martin@ximian.com>
826
827         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
828         CS0661 checks; fixes bug #30442.
829
830 2003-07-21  Martin Baulig  <martin@ximian.com>
831
832         * decl.cs (AdditionResult): Added `Error'.
833
834         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
835
836         * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
837         makes cs0031.cs actually work.
838
839 2003-07-20  Martin Baulig  <martin@ximian.com>
840
841         * namespace.cs: Fixed that bug which caused a crash when compiling
842         the debugger's GUI.
843
844 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
845
846         * typemanager.cs (LookupTypeReflection): Never expose types which
847         are NotPublic, NestedPrivate, NestedAssembly, or
848         NestedFamANDAssem.  We used to return these, and later do a check
849         that would report a meaningful error, but the problem is that we
850         would not get the real match, if there was a name override.
851
852 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
853
854         * namespace.cs (Namespace, Name): Do not compute the namespace
855         name dynamically, compute it in the constructor.  This reduced
856         memory usage by 1697 KB.
857
858         * driver.cs: Use --pause to pause at the end.
859
860 2003-07-17  Peter Williams  <peter@newton.cx>
861
862         * Makefile: Change the name of the test target so that it doesn't
863         conflict with the recursive test target.
864
865 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
866
867         * expression.cs (LocalVariableReference.Emit, EmitAssign,
868         AddressOf): Do not use EmitThis, that was wrong, use the actual
869         this pointer.
870
871 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
872
873         * class.cs (MethodData.Define): While checking if a method is an
874         interface implementation, improve the test: If we are not public
875         (use new test here: use the computed MethodAttributes directly,
876         instead of the parsed modifier flags) check if the `implementing'
877         method comes from an interface or not.
878
879         * pending.cs (VerifyPendingMethods): Slightly better error
880         message.
881
882         * makefile: add test target that does the mcs bootstrap.
883
884 2003-07-16  Ravi Pratap  <ravi@ximian.com>
885
886         * interface.cs (Define): Do nothing here since there are no
887         members to populate etc. Move the attribute emission out of here
888         since this was just totally the wrong place to put it. Attribute
889         application happens during the 'Emit' phase, not in the 'Define'
890         phase.
891
892         (Emit): Add this method and move the attribute emission here
893
894         * rootcontext.cs (EmitCode): Call the Emit method on interface
895         types too.
896
897 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
898
899         * expression.cs (OverloadResolve): Report error only if Location
900         is not 'Null' which means that there was a probe going on.
901
902 2003-07-14  Martin Baulig  <martin@ximian.com>
903
904         * expression.cs (ConditionalLogicalOperator): New public class to
905         implement user defined conditional logical operators.
906         This is section 14.11.2 in the spec and bug #40505.
907
908 2003-07-14  Martin Baulig  <martin@ximian.com>
909
910         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
911
912 2003-07-14  Martin Baulig  <martin@ximian.com>
913
914         * codegen.cs (EmitContext.InFixedInitializer): New public field.
915
916         * ecore.cs (IVariable.VerifyFixed): New interface method.
917
918         * expression.cs (Unary.ResolveOperator): When resolving the `&'
919         operator, check whether the variable is actually fixed.  Fixes bug
920         #36055.  Set a variable definitely assigned when taking its
921         address as required by the spec.
922
923         * statement.cs (LocalInfo.IsFixed): New field.
924         (LocalInfo.MakePinned): Set `IsFixed' to true.
925
926 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
927
928         * attribute.cs (Attribute.Resolve): While doing a Member lookup
929         for .ctors, ensure that we only ask for members declared in the
930         attribute type (BindingFlags.DeclaredOnly).
931
932         Fixes bug #43632.
933
934         * expression.cs (Error_WrongNumArguments): Report error 1501
935         correctly the way CSC does.
936
937 2003-07-13  Martin Baulig  <martin@ximian.com>
938
939         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
940         lookup on the fully qualified name, to make things like "X.X" work
941         where "X.X" is a fully qualified type name, but we also have a
942         namespace "X" in the using list.  Fixes #41975.
943
944 2003-07-13  Martin Baulig  <martin@ximian.com>
945
946         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
947         function. If we're a CompoundAssign, we need to create an embedded
948         CompoundAssign, not an embedded Assign.
949         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
950         Fixes #45854.
951
952 2003-07-13  Martin Baulig  <martin@ximian.com>
953
954         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
955         work to fix bug #46088.
956
957 2003-07-13  Ravi Pratap <ravi@ximian.com>
958
959         * class.cs (Operator.Emit): Do not emit attributes here - it is
960         taken care of by the Method class that we delegate too. This takes
961         care of bug #45876.
962         
963 2003-07-10  Martin Baulig  <martin@ximian.com>
964
965         * expression.cs (TypeOfVoid): New class.
966         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
967
968 2003-07-10  Martin Baulig  <martin@ximian.com>
969
970         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
971         bug #35957.
972
973 2003-07-10  Martin Baulig  <martin@ximian.com>
974
975         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
976         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
977
978         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
979
980         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
981
982 2003-07-10  Martin Baulig  <martin@ximian.com>
983
984         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
985         of decimal.  Fixes #42850.
986
987         NOTE: I also fixed the created byte blob, but this doesn't work on
988         the MS runtime and csc never produces any byte blobs for decimal
989         arrays.
990
991 2003-07-10  Martin Baulig  <martin@ximian.com>
992
993         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
994         structs; fixes #32068.
995         (Block.AddChildVariableNames): Fixed #44302.
996
997 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
998
999         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
1000         
1001 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1002
1003         * attribute.cs: And this test is onger needed.
1004
1005 2003-07-08  Martin Baulig  <martin@ximian.com>
1006
1007         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
1008         inaccessible types.  Fixes #36313.
1009
1010         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
1011
1012         * namespace.cs (NamespaceEntry): Create implicit entries for all
1013         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
1014         implicit entries for N1.N2 and N1.
1015
1016 2003-07-08  Martin Baulig  <martin@ximian.com>
1017
1018         Rewrote the handling of namespaces to fix a lot of the issues
1019         wrt. `using' aliases etc.
1020
1021         * namespace.cs (Namespace): Splitted this class into a
1022         per-assembly `Namespace' and a per-file `NamespaceEntry'.
1023
1024         * typemanager.cs (TypeManager.IsNamespace): Removed.
1025         (TypeManager.ComputeNamespaces): Only compute namespaces from
1026         loaded assemblies here, not the namespaces from the assembly we're
1027         currently compiling.
1028
1029 2003-07-08  Martin Baulig  <martin@ximian.com>
1030
1031         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
1032
1033 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1034
1035         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
1036         already fixed it.  
1037
1038         I thought about the memory savings here, but LookupTypeReflection
1039         is used under already very constrained scenarios.  Compiling
1040         corlib or mcs only exposes one hit, so it would not really reduce
1041         any memory consumption.
1042
1043 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1044
1045         * typemanager.cs: fixes bug #45889 by only adding public types from
1046         other assemblies to the list of known types.
1047
1048 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1049
1050         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
1051         on the type we resolved.
1052
1053 2003-07-05  Martin Baulig  <martin@ximian.com>
1054
1055         * pending.cs (PendingImplementation.ParentImplements): Don't
1056         create the proxy if the parent is abstract.
1057
1058         * class.cs (TypeContainer.DefineIndexers): Process explicit
1059         interface implementations first.  Fixes #37714.
1060
1061 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
1062
1063         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
1064         defined recursively;  but since we modify the input parameters
1065         (left is set to `this' temporarily), we reset this value if the
1066         left_is_explicit is false, which gives the original semantics to
1067         the code.  
1068
1069         * literal.cs (NullPointer): new class used to represent a null
1070         literal in a pointer context.
1071
1072         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
1073         type is a pointer, use a NullPointer object instead of a
1074         NullLiteral.   Closes 43687
1075
1076         (ExplicitConversion): Convert pointer values using
1077         the conv opcode to the proper type.
1078
1079         * ecore.cs (New): change ValueTypeVariable property into a method,
1080         that returns whether the valuetype is suitable for being used.
1081
1082         * expression.cs (Binary.DoNumericPromotions): Only return if we
1083         the int constant was a valid uint, and we can return both left and
1084         right as uints.  If not, we continue processing, to trigger the
1085         type conversion.  This fixes 39018.
1086
1087         * statement.cs (Block.EmitMeta): During constant resolution, set
1088         the CurrentBlock property on the emitcontext, so that we resolve
1089         constants propertly.
1090
1091 2003-07-02  Martin Baulig  <martin@ximian.com>
1092
1093         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
1094         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
1095
1096         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
1097         than emitting it here.
1098
1099         * statement.cs: Fixed some more flow analysis bugs.
1100
1101 2003-07-02  Martin Baulig  <martin@ximian.com>
1102
1103         * class.cs (MethodData.Define): When implementing interface
1104         methods, set Final unless we're Virtual.
1105
1106         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
1107         check work for interface methods.
1108
1109 2003-07-01  Martin Baulig  <martin@ximian.com>
1110
1111         * ecore.cs (EmitContext.This): Replaced this property with a
1112         GetThis() method which takes a Location argument.  This ensures
1113         that we get the correct error location for a CS0188.
1114
1115 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
1116
1117         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1118         ImplicitStandardConversion.
1119
1120         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1121
1122 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
1123
1124         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1125         optimization.
1126
1127 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
1128
1129         * class.cs (Constructor.Define): Turn off initlocals for unsafe
1130         constructors.
1131
1132         (MethodData.Define): Turn off initlocals for unsafe methods.
1133
1134 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
1135
1136         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1137         complete;  Fixes #37521.
1138
1139         * delegate.cs: Use Modifiers.TypeAttr to compute the
1140         TypeAttributes, instead of rolling our own.  This makes the flags
1141         correct for the delegates.
1142
1143 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
1144
1145         * class.cs (Constructor.Define): Set the private flag for static
1146         constructors as well.
1147
1148         * cs-parser.jay (statement_expression): Set the return value to
1149         null, to avoid a crash when we catch an error.
1150
1151 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
1152
1153         * cs-parser.jay: Applied patch from Jackson that adds support for
1154         extern and unsafe modifiers to destructor declarations.
1155
1156         * expression.cs: Report error 21 if the user is trying to index a
1157         System.Array.
1158
1159         * driver.cs: Add an error message, suggested by the bug report.
1160
1161         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1162         if we do not have a ": this ()" constructor initializer.  Fixes 45149
1163
1164 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
1165
1166         * namespace.cs: Add some information to reduce FAQs.
1167
1168 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
1169
1170         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1171         underlying enumeration types.  Fixes #43915.
1172
1173         * expression.cs: Treat ushort/short as legal values to be used in
1174         bitwise operations.
1175
1176 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1177
1178         * delegate.cs: transfer custom attributes for paramenters from
1179         the delegate declaration to Invoke and BeginInvoke.
1180
1181 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1182
1183         * attribute.cs: handle custom marshalers and emit marshal info
1184         for fields, too.
1185
1186 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
1187
1188         * makefile.gnu: Added anonymous.cs to the compiler sources.
1189
1190 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
1191
1192         * iterators.cs: Change the name of the proxy class to include two
1193         underscores.
1194
1195         * cs-parser.jay: Update grammar to include anonymous methods.
1196         
1197         * anonymous.cs: new file.
1198
1199 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
1200
1201         * class.cs (Field.Define): Add missing test for pointers and
1202         safety. 
1203
1204 2003-05-27  Ravi Pratap  <ravi@ximian.com>
1205
1206         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
1207         we use the stobj opcode.
1208
1209         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
1210         since it wasn't the correct fix. 
1211
1212         It still is puzzling that we are required to use stobj for IntPtr
1213         which seems to be a ValueType.
1214
1215 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
1216
1217         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
1218         during regular simple name resolution.   Now, the trick is that
1219         instead of returning for processing the simplename, we do a
1220         TypeManager.LookupType (ie, a rooted lookup as opposed to a
1221         contextual lookup type).   If a match is found, return that, if
1222         not, return for further composition.
1223
1224         This fixes long-standing 30485.
1225
1226         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1227         using the address to initialize an object, do an Stobj instead of
1228         using the regular Stelem.
1229
1230         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1231         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1232         Because if we are a BaseIndexerAccess that value will be true.
1233         Fixes 43643.
1234
1235         * statement.cs (GotoCase.Resolve): Return after reporting an
1236         error, do not attempt to continue. 
1237
1238         * expression.cs (PointerArithmetic.Emit): If our operand is a
1239         long, convert our constants to match the operand before
1240         multiplying.  Convert to I type before adding.   Fixes 43670.
1241         
1242 2003-05-14  Ravi Pratap  <ravi@ximian.com>
1243
1244         * enum.cs (ImplicitConversionExists) : Rename to
1245         ImplicitEnumConversionExists to remove ambiguity. 
1246
1247         * ecore.cs (NullCast): New type of cast expression class which
1248         basically is very similar to EmptyCast with the difference being
1249         it still is a constant since it is used only to cast a null to
1250         something else
1251         (eg. (string) null)
1252
1253         * convert.cs (ImplicitReferenceConversion): When casting a null
1254         literal, we return a NullCast.
1255
1256         * literal.cs (NullLiteralTyped): Remove - I don't see why this
1257         should be around anymore.
1258
1259         The renaming (reported was slightly wrong). Corrections:
1260
1261         ConvertImplicitStandard -> ImplicitConversionStandard
1262         ConvertExplicitStandard -> ExplicitConversionStandard
1263
1264         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1265         before passing them in !
1266
1267         * convert.cs (ImplicitConversionStandard): When comparing for
1268         equal expr and target types, ensure that expr is not a
1269         NullLiteral.
1270
1271         In general, we must not be checking (expr_type ==
1272         target_type) in the top level conversion methods
1273         (ImplicitConversion, ExplicitConversion etc). This checking is
1274         done in the methods that they delegate to.
1275
1276 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
1277
1278         * convert.cs: Move Error_CannotConvertType,
1279         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1280         ImplicitNumericConversion, ImplicitConversionExists,
1281         ImplicitUserConversionExists, StandardConversionExists,
1282         FindMostEncompassedType, FindMostSpecificSource,
1283         FindMostSpecificTarget, ImplicitUserConversion,
1284         ExplicitUserConversion, GetConversionOperators,
1285         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1286         TryImplicitIntConversion, Error_CannotConvertImplicit,
1287         ConvertImplicitRequired, ConvertNumericExplicit,
1288         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1289         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1290         its own file.
1291
1292         Perform the following renames:
1293         
1294         StandardConversionExists -> ImplicitStandardConversionExists
1295         ConvertImplicit -> ImplicitConversion
1296         ConvertImplicitStandard -> ImplicitStandardConversion
1297         TryImplicitIntConversion -> ImplicitIntConversion
1298         ConvertImplicitRequired -> ImplicitConversionRequired
1299         ConvertNumericExplicit -> ExplicitNumericConversion
1300         ConvertReferenceExplicit -> ExplicitReferenceConversion
1301         ConvertExplicit -> ExplicitConversion
1302         ConvertExplicitStandard -> ExplicitStandardConversion
1303
1304 2003-05-19  Martin Baulig  <martin@ximian.com>
1305
1306         * statement.cs (TypeInfo.StructInfo): Made this type protected.
1307         (TypeInfo): Added support for structs having structs as fields.
1308
1309         * ecore.cs (FieldExpr): Implement IVariable.
1310         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1311         VariableInfo for the field.
1312
1313 2003-05-18  Martin Baulig  <martin@ximian.com>
1314
1315         * expression.cs (This.DoResolve): Report a CS0027 if we're
1316         emitting a field initializer.
1317
1318 2003-05-18  Martin Baulig  <martin@ximian.com>
1319
1320         * expression.cs (This.ResolveBase): New public function.
1321         (This.DoResolve): Check for CS0188.
1322
1323         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1324         This.Resolve().
1325
1326         * ecore.cs (MethodGroupExpr.DoResolve): Set the
1327         `instance_expression' to null if we don't have any non-static
1328         methods.
1329
1330 2003-05-18  Martin Baulig  <martin@ximian.com>
1331
1332         Reworked the way how local variables and parameters are handled by
1333         the flow analysis code.
1334
1335         * statement.cs (TypeInfo, VariableMap): New public classes.
1336         (VariableInfo): New public class.  This is now responsible for
1337         checking whether a variable has been assigned.  It is used for
1338         parameters and local variables.
1339         (Block.EmitMeta): Take the InternalParameters as argument; compute
1340         the layout of the flow vectors here.
1341         (Block.LocalMap, Block.ParameterMap): New public properties.
1342         (FlowBranching): The .ctor doesn't get the InternalParameters
1343         anymore since Block.EmitMeta() now computes the layout of the flow
1344         vector.
1345         (MyStructInfo): This class is now known as `StructInfo' and nested
1346         in `TypeInfo'; we don't access this directly anymore.
1347
1348         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1349         property and removed IsAssigned(), IsFieldAssigned(),
1350         SetAssigned() and SetFieldAssigned(); we now call them on the
1351         VariableInfo so we don't need to duplicate this code everywhere.
1352
1353         * expression.cs (ParameterReference): Added `Block block' argument
1354         to the .ctor.
1355         (LocalVariableReference, ParameterReference, This): The new
1356         VariableInfo class is now responsible for all the definite
1357         assignment stuff.
1358
1359         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1360         IsParameterAssigned, SetParameterAssigned): Removed.
1361
1362 2003-05-18  Martin Baulig  <martin@ximian.com>
1363
1364         * typemanager.cs (InitCoreTypes): Try calling
1365         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1366         the 3-args-version.  Corlib now also needs our `void_type'.
1367         (GetMethod): Added overloaded version which takes an optional
1368         `bool report_errors' to allow lookups of optional methods.
1369
1370 2003-05-12  Martin Baulig  <martin@ximian.com>
1371
1372         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1373         only used for locals and not for parameters.
1374
1375 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
1376
1377         * support.cs (InternalParameters.ParameterType): Return the
1378         ExternalType of the parameter.
1379
1380         * parameter.cs (Parameter.ExternalType): drop the two arguments,
1381         they were unused.
1382
1383 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
1384
1385         * class.cs (MethodData.Define): Do not set the `newslot' on
1386         interface members, if they are also flagged as "override".
1387
1388         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1389         better code for ++i and i++.  This only works for static fields
1390         and local variables.
1391
1392         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1393         want to pull the DeclSpace out of the builder_to_declspace instead
1394         of the TypeBuilder (like in TypeContainer.FindMembers).
1395
1396         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1397         instead of LookupTypeContainer.  Fixes the crash on .NET for
1398         looking up interface members.
1399
1400         * const.cs: Create our own emit context during the Definition
1401         stage, so that constants are evaluated in the proper context, when
1402         a recursive definition happens.
1403
1404 2003-05-11  Martin Baulig  <martin@ximian.com>
1405
1406         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
1407         new block for a switch section.
1408         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1409         the adding/lookup in the switch block.  Fixes #39828.
1410
1411 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
1412
1413         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1414         functionality: I needed to convert the data after I had performed
1415         the add/sub operation into the operands type size.
1416
1417         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1418         pass the type for the box operation, otherwise the resulting
1419         object would have been of type object.
1420
1421         (BoxedCast): Add constructor to specify the type to box as.
1422
1423 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
1424
1425         * iterators.cs: I was reusing the `count' variable inadvertently,
1426         take steps to not allow this to happen.
1427
1428 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
1429
1430         * attribute.cs (Attribute.Resolve): Params attributes are encoded
1431         by creating an array at the point where the params starts and
1432         putting all those arguments there, then adjusting the size of the
1433         array.
1434
1435 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
1436
1437         * expression.cs (New.AddressOf): Implement interface
1438         IMemoryLocation.  This is used when the `new' operator is used in
1439         the context of an invocation to a method on a value type.
1440
1441         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1442         example. 
1443
1444         * namespace.cs: Also check the using aliases here.
1445
1446         * driver.cs: Move the test for using validity after the types have
1447         been entered, so we do a single pass that also includes the using
1448         aliases. 
1449
1450         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1451         in the regular case.   CreateSiblingForFinally is doing extra
1452         error checking.
1453
1454         * attribute.cs (GetAttributeArgumentExpression): Store the result
1455         on an out value, and use the return value to indicate failure
1456         instead of using null (which is a valid return for Constant.GetValue).
1457
1458         * statement.cs: Perform the analysis flow for the increment
1459         portion after the statement, because this will be the real flow of
1460         execution.  Fixes #42385
1461
1462         * codegen.cs (EmitContext.EmitArgument,
1463         EmitContext.EmitStoreArgument): New helper functions when the
1464         RemapToProxy flag is set.
1465
1466         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1467         function.
1468
1469         Add support for remapping parameters. 
1470
1471         * iterators.cs: Propagate parameter values;  Store parameter
1472         values in the proxy classes.
1473         
1474 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
1475
1476         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
1477         need a proxy reference;  I do not know what I was thinking
1478
1479         * cs-parser.jay (constructor_initializer): catch another error,
1480         and display nice message.
1481         
1482         (field_declaration): catch void field declaration
1483         to flag a better error. 
1484
1485         * class.cs (MemberBase.CheckBase): Report an error instead of a
1486         warning if a new protected member is declared in a struct. 
1487         (Field.Define): catch the error of readonly/volatile.
1488
1489         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1490
1491         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
1492         volatile variable is taken
1493
1494 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
1495
1496         * statement.cs (Fixed.Resolve): Report an error if we are not in
1497         an unsafe context.
1498
1499 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
1500
1501         * typemanager.cs: reuse the code that handles type clashes for
1502         delegates and enumerations.
1503
1504         * class.cs (Report28): Always report.
1505
1506         * expression.cs (EncodeAsAttribute): Allow nulls here.
1507
1508 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
1509
1510         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1511         the functionality for testing whether an expression is valid for
1512         an attribute here.  Also handle the case of arrays of elements
1513         being stored. 
1514
1515         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1516         encoding a linear array into an array of objects that are suitable
1517         to be passed to an CustomAttributeBuilder.
1518
1519         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1520
1521         * ecore.cs: (FieldExpr): Handle field remapping here.
1522
1523         * iteratators.cs: Pass the instance variable (if the method is an
1524         instance method) to the constructors, so we can access the field
1525         variables on the class.
1526
1527         TODO: Test this with structs.  I think the THIS variable on
1528         structs might have to be a pointer, and not a refenrece
1529
1530 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
1531
1532         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1533         local variables to fields in a proxy class.
1534
1535         * iterators.cs (PopulateProxy): Rename our internal fields to
1536         <XXX>.  
1537         Create a <THIS> field if we are an instance method, so we can
1538         reference our parent container variables.
1539         (MapVariable): Called back from the EmitContext code to enter a
1540         new variable to field mapping into the proxy class (we just create
1541         a FieldBuilder).
1542
1543         * expression.cs
1544         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1545         for using the remapped locals to fields.
1546
1547         I placed the code here, because that gives the same semantics to
1548         local variables, and only changes the Emit code.
1549
1550         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1551         statements inside iterators.
1552         (VariableInfo): Add a FieldBuilder for the cases when we are
1553         remapping local variables to fields in a proxy class
1554
1555         * ecore.cs (SimpleNameResolve): Avoid testing two times for
1556         current_block != null.
1557
1558         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1559         not cope with strings, as it has been moved to the
1560         TableSwitchEmit.  Fixed bug in switch generation.
1561
1562         * expression.cs (New.DoResolve): Provide more context for the user
1563         when reporting an error.
1564
1565         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1566         pointers. 
1567
1568         * expression.cs (MemberAccess.DoResolve): When we get a type back,
1569         check the permissions for it.  Note than in a type-resolution
1570         context the check was already present in DeclSpace.ResolveType,
1571         but was missing from the MemberAccess.
1572
1573         (ArrayCreation.CheckIndices): warn if the user has
1574         more nested levels of expressions, but there are no more
1575         dimensions specified.  Avoids crash on bug 41906.
1576
1577 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
1578
1579         * statement.cs (Block): replace Implicit bool, for a generic
1580         flags.   
1581         New flag: `Unchecked'.  This is used during the EmitMeta phase
1582         (which is out-of-line with the regular Resolve/Emit process for a
1583         statement, as this is done ahead of time, but still gets a chance
1584         to call constant resolve).
1585         
1586         (Block.Flags): new enum for adding a new flag.
1587
1588         (Block.EmitMeta): track the state of unchecked.
1589         
1590         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1591         to enable constant resolution to work there as well.
1592
1593 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
1594
1595         * typemanager.cs (ienumerable_type): Also look up
1596         System.Collections.IEnumerable. 
1597
1598 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
1599
1600         TODO: Test more than one conditional per method.
1601         
1602         * class.cs (Indexer.Define): Report the location where the user is
1603         referencing the unsupported feature.
1604
1605         (MethodData): Overload the use of `conditionals' to
1606         minimize the creation of needless ArrayLists.   This saves roughly
1607         212kb on my machine.
1608
1609         (Method): Implement the new IIteratorContainer interface.
1610         (Method.SetYields): Implement the method by setting the ModFlags
1611         to contain METHOD_YIELDS.
1612         
1613         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1614         which just got set to null.
1615
1616         * iterators.cs: New file.
1617
1618         (Yield, YieldBreak): New statements.
1619
1620         * statement.cs (Return.Resolve): Flag an error if we are used in
1621         an iterator method.
1622
1623         * codegen.cs (InIterator): New flag set if the code is being
1624         compiled in an iterator method.
1625
1626         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
1627         internal modifier, and we just use it to avoid adding extra
1628         fields, as this is seldom used.  
1629
1630         * cs-parser.jay: Add yield_statement (yield and yield break).
1631
1632         * driver.cs: New flag -v2 to turn on version 2 features. 
1633
1634         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1635         hashtable when v2 is enabled.
1636
1637 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
1638
1639         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1640         there is already a namespace defined with this name.
1641
1642         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1643         people upgraded their corlibs.
1644
1645         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1646         always use fully qualified types, no need to use the compiler
1647         front end.
1648
1649         (TypeManager.IsNamespace): Use binarysearch.
1650         
1651         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1652         AddDelegate): I did not quite use the new IsValid API properly: I
1653         have to pass the short-name and the fullname.  I was passing only
1654         the basename instead of the fullname sometimes. 
1655
1656         (TypeContainer.DefineType): call NamespaceClash.
1657
1658         * interface.cs (Interface.DefineType): use NamespaceClash before
1659         defining the type.
1660
1661         * delegate.cs (Delegate.DefineType): use NamespaceClash before
1662         defining the type.
1663
1664         * enum.cs: (Enum.DefineType): use NamespaceClash before
1665         defining the type.
1666
1667         * typemanager.cs (: 3-line patch that gives us some tasty 11%
1668         speed increase.  First, use the negative_hits cache when we get a
1669         negative.  Second, add the type with its full original name
1670         instead of the new . and + encoded name (reflection uses + to
1671         separate type from a nested type).  Use LookupTypeReflection
1672         directly which bypasses the type->name hashtable (that we already
1673         know does not contain the type.
1674         
1675         * decl.cs (DeclSpace.ResolveTypeExpr): track the
1676         location/container type. 
1677
1678         * driver.cs: When passing utf8, use directly the UTF8Encoding.
1679
1680 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
1681
1682         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1683
1684         * delegate.cs (NewDelegate.Resolve): Test whether an instance
1685         method is being referenced in the method group from a static
1686         context, and report error 120 if so.
1687
1688         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1689         Error118. 
1690
1691         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1692         is created, we create the A namespace).
1693
1694         * cs-parser.jay: A namespace also introduces a DeclarationFound.
1695         Fixes #41591
1696
1697 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
1698
1699         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1700         invocation to ModuleBuilder.GetType with the same values will
1701         return a new type instance, so we need to cache its return
1702         values. 
1703
1704         * expression.cs (Binary.ResolveOperator): Only allow the compare
1705         operators on enums if they are of the same type.
1706
1707         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1708         types of ValueType on their own case.  Before we were giving them
1709         the same treatment as objects.
1710
1711         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1712         fullname.  Short name is used to compare against container name.
1713         Fullname is used to check against defined namespace names.
1714         
1715         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1716         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1717
1718         (Method.CheckBase): Call parent.
1719         (MemberBase.CheckBase): Check for protected members on sealed
1720         classes.
1721         (PropertyBase.CheckBase): Call parent.
1722         (Field.Define): Call parent.
1723
1724         * report.cs: Negative error codes are now mapped to 8000 - code,
1725         so that the display is render more nicely.
1726
1727         * typemanager.cs: Do not use try/catch, instead report a regular
1728         error. 
1729
1730         (GetPointerType, GetReferenceType): These methods provide
1731         mechanisms to obtain the T* and T& from a T.  We had the code
1732         previously scattered around the code base, and it also used
1733         TypeManager.LookupType that would go through plenty of caches.
1734         This one goes directly to the type source.
1735
1736         In some places we did the Type.GetType followed by
1737         ModuleBuilder.GetType, but not in others, so this unifies the
1738         processing as well.
1739
1740         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1741         statements now that we have namespace information.
1742
1743         * typemanager.cs (IsNamespace): New method, returns whether the
1744         string presented is a namespace or not.
1745
1746         (ComputeNamespaces): New public entry point, computes the list of
1747         available namespaces, using the GetNamespaces API call in Mono, or
1748         the slower version in MS.NET.   
1749
1750         Now before we start the semantic analysis phase, we have a
1751         complete list of namespaces including everything that the user has
1752         provided.
1753
1754         Deleted old code to cache namespaces in .nsc files.
1755
1756 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
1757
1758         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1759         class/struct location definition Location for the implicit
1760         constructor location.
1761
1762         (Operator.Define): Use the location of the operator for the
1763         implicit Method definition.
1764
1765         (Constructor.Emit): use the constructor location for the implicit
1766         base initializer constructor.
1767
1768         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
1769         and the Expression class now contains two new methods:
1770
1771         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
1772         isolate type lookup from the rest of the resolution process.
1773
1774         Since we use Expressions to hold type definitions due to the way
1775         we parse the input we have historically overloaded Resolve to
1776         perform the Type lookups if a special flag is passed.  Now this is
1777         eliminated and two methods take their place. 
1778         
1779         The differences in the two methods between xStep and xTerminal is
1780         that xStep is involved in our current lookup system that uses
1781         SimpleNames to compose a name, while xTerminal is used just to
1782         catch the case where the simplename lookup failed.
1783         
1784 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
1785
1786         * expression.cs (ResolveMemberAccess): Remove redundant code.
1787         TypeExpr expressions are always born fully resolved.
1788
1789         * interface.cs (PopulateMethod): Do not lookup the types twice.
1790         We were doing it once during SemanticAnalysis and once during
1791         PopulateMethod.
1792
1793         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1794         in local variable type definitions, were being returned as a
1795         SimpleName (we decomposed everything into a string), that is
1796         because primary_expression was being used instead of a type in the
1797         grammar (reduce/reduce conflicts).
1798
1799         The part that was wrong is that we converted the expression into a
1800         string (an oversimplification in one hand, compounded with primary
1801         expressions doing string concatenation).
1802
1803         So things like:
1804
1805         A.B.C [] x;
1806
1807         Would return "A.B.C[]" as a SimpleName.  This stopped things like
1808         using clauses from working on this particular context.  And a type
1809         was being matched directly against "A.B.C[]".
1810
1811         We now use the correct approach, and allow for ComposedCast to be
1812         part of the unary expression.  So the "A.B.C []" become a composed
1813         cast of "A.B.C" (as a nested group of MemberAccess with a
1814         SimpleName at the end) plus the rank composition "[]". 
1815
1816         Also fixes 35567
1817         
1818 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
1819
1820         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1821         for the access level checking.
1822
1823         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
1824         `TypeContainer container', because I kept getting confused when I
1825         was debugging this code.
1826
1827         * expression.cs (Indexers): Instead of tracking getters/setters,
1828         we now track them in parallel.  We create one arraylist less, but
1829         most importantly it is possible now for the LValue code to find a
1830         matching get for a set.
1831
1832         (IndexerAccess.DoResolveLValue): Update the code.
1833         GetIndexersForType has been modified already to extract all the
1834         indexers from a type.  The code assumed it did not.
1835
1836         Also make the code set the correct return type for the indexer.
1837         This was fixed a long time ago for properties, but was missing for
1838         indexers.  It used to be void_type.
1839
1840         (Binary.Emit): Test first for doubles instead of
1841         floats, as they are more common.
1842
1843         (Binary.EmitBranchable): Use the .un version of the branch opcodes
1844         when dealing with floats and the <=, >= operators.  This fixes bug
1845         #39314 
1846
1847         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1848         to load the array value by emitting a load on the foreach variable
1849         type.  This was incorrect.  
1850
1851         We now emit the code to load an element using the the array
1852         variable type, and then we emit the conversion operator.
1853
1854         Fixed #40176
1855
1856 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
1857
1858         * attribute.cs: Avoid allocation of ArrayLists in the common case.
1859
1860 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
1861
1862         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1863         test for protection before we test for signatures. 
1864
1865         (MethodSignature.ToString): implement.
1866
1867         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1868         to the case where we reduced into a LongConstant.
1869
1870         * decl.cs (CheckAccessLevel): If the type is an array, we can not
1871         depend on whether the information is acurrate, because the
1872         Microsoft runtime will always claim that the array type is public,
1873         regardless of the real state.
1874
1875         If the type is a pointer, another problem happens: the type is
1876         reported as non-public in Microsoft.  
1877
1878         In both cases we have to call CheckAccessLevel recursively with
1879         the underlying type as the argument to be tested.
1880
1881 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
1882
1883         * assign.cs (Assign.Emit): If we are dealing with a compound
1884         assignment expression, we should use the code path that stores the
1885         intermediate result in a temporary value.  This fixes #40903.
1886
1887         *expression.cs (Indirection.ToString): Provide ToString method for
1888         debugging. 
1889         
1890 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
1891
1892         * class.cs: Null out fields holding references to Block objects so
1893         they can be garbage collected.
1894
1895         * expression.cs (OverloadResolve): Remove unused local.
1896
1897 2003-04-07  Martin Baulig  <martin@ximian.com>
1898
1899         * codegen.cs (EmitContext.CurrentFile): New public field.
1900         (EmitContext.Mark): Use the CurrentFile to check whether the
1901         location is in the correct file.
1902         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1903
1904 2003-04-07  Martin Baulig  <martin@ximian.com>
1905
1906         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1907
1908         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1909         location.  [FIXME: The location argument which gets passed to this
1910         method is sometimes wrong!]
1911
1912 2003-04-07  Nick Drochak <ndrochak@gol.com>
1913
1914         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1915
1916 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
1917
1918         * expression.cs (Indirection.EmitAssign): We were using the
1919         temporary, but returning immediately instead of continuing the
1920         EmitAssing flow.
1921
1922 2003-04-06  Martin Baulig  <martin@ximian.com>
1923
1924         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1925         if it's a nested child, but also deriving from the outer class.
1926         See test 190.cs.
1927
1928         * typemanager.cs (IsNestedChildOf): Make this work if it's a
1929         nested child, but also deriving from the outer class.  See
1930         test-190.cs.
1931         (FilterWithClosure): We may access private members of the outer
1932         class if we're a nested child and deriving from the outer class.
1933         (RealMemberLookup): Only set `closure_private_ok' if the
1934         `original_bf' contained BindingFlags.NonPublic.
1935
1936 2003-04-05  Martin Baulig  <martin@ximian.com>
1937
1938         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
1939
1940 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
1941
1942         * class.cs (Event.Define): Do not allow abstract events to have
1943         initializers. 
1944
1945 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
1946
1947         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1948         block in event declarations.
1949
1950         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1951         value type, get its address.
1952
1953         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1954         leaving a class on the stack instead of a boolean value (int
1955         0/1).  Change the code so we compare against null, and then the
1956         result against zero.
1957
1958         * class.cs (TypeContainer.GetClassBases): We were checking for the
1959         parent class being sealed too late.
1960
1961         * expression.cs (Binary.Emit): For <= and >= when dealing with
1962         floating point values, use cgt.un and clt.un instead of cgt and
1963         clt alone.
1964
1965 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
1966
1967         * statement.cs: Apply the same optimization as MS: skip the 
1968         GetEnumerator returning an IEnumerator, and use the one returning a 
1969         CharEnumerator instead. This allows us to avoid the try-finally block 
1970         and the boxing.
1971
1972 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
1973
1974         * cs-parser.jay: Attributes cannot be applied to
1975                          namespaces. Fixes #40473
1976
1977 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1978
1979         * class.cs:
1980         (Add*): check if the name is valid using the full name for constants,
1981         fields, properties and events.
1982
1983 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
1984
1985         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1986         char constants to be part of the enumeration.
1987
1988         * expression.cs (Conditional.DoResolve): Add support for operator
1989         true. Implements the missing functionality from 14.12
1990
1991         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1992         operator true/false as required by the spec.
1993
1994         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1995         implicit conversion to boolean.
1996
1997         * statement.cs (Statement.ResolveBoolean): A boolean expression is
1998         also one where the type implements `operator true'. 
1999
2000         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
2001         get an expression that will invoke operator true based on an
2002         expression.  
2003
2004         (GetConversionOperators): Removed the hack that called op_True
2005         here.  
2006
2007         (Expression.ResolveBoolean): Move this from Statement.
2008
2009 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
2010
2011         * ecore.cs (FieldExpr): do not allow initialization of initonly
2012         fields on derived classes
2013
2014 2003-03-13  Martin Baulig  <martin@ximian.com>
2015
2016         * statement.cs (Block.Emit): Call ig.BeginScope() and
2017         ig.EndScope() when compiling with debugging info; call
2018         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
2019
2020 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
2021
2022         * expression.cs (Indexers): Do not construct immediately, allow
2023         for new members to be appended as we go.  Fixes 38143
2024
2025 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2026
2027         * expression.cs: save/restore context when resolving an unchecked
2028         expression.
2029
2030 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
2031
2032         * cfold.cs: Catch division by zero in modulus operator during
2033         constant folding.
2034
2035 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
2036
2037         * interface.cs (Interface.DefineMembers): Avoid defining members
2038         twice. 
2039
2040 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
2041
2042         * driver.cs: handle the +/- options for -noconfig
2043
2044         * statement.cs (Unckeched.Resolve): Also track the state of
2045         unchecked in the Resolve phase.
2046
2047 2003-02-27  Martin Baulig  <martin@ximian.com>
2048
2049         * ecore.cs (Expression.MemberLookup): Don't create a
2050         MethodGroupExpr for something which is not a method.  Fixes #38291.
2051
2052 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
2053
2054         * class.cs (MemberBase.CheckParameters): Also check that the type
2055         is unmanaged if it is a pointer.
2056
2057         * expression.cs (SizeOf.Resolve): Add location information.
2058
2059         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
2060         a managed type is declared.
2061
2062         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
2063         parameter modifiers as well.  Fixes bug 38606
2064
2065         * class.cs: Very sad.  Am backing out the speed up changes
2066         introduced by the ArrayList -> Array in the TypeContainer, as they
2067         were not actually that much faster, and introduced a bug (no error
2068         reports on duplicated methods).
2069
2070         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
2071         source first, this will guarantee that we have a valid expression
2072         before calling in lower levels functions that will require a
2073         resolved object.  Then use this original_source in the
2074         target.ResolveLValue instead of the original source that was
2075         passed to us.
2076
2077         Another change.  Use target.Resolve instead of LValueResolve.
2078         Although we are resolving for LValues, we will let the Assign code
2079         take care of that (it will be called again from Resolve).  This
2080         basically allows code like this:
2081
2082         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
2083         class Y { void A (X x) { x [0] += o; }
2084
2085         The problem was that the indexer was trying to resolve for
2086         set_Item (idx, object o) and never finding one.  The real set_Item
2087         was set_Item (idx, X).  By delaying the process we get the right
2088         semantics. 
2089
2090         Fixes bug 36505
2091         
2092 2003-02-23  Martin Baulig  <martin@ximian.com>
2093
2094         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
2095         while calling DoEmit ().
2096
2097         * codegen.cs (EmitContext.Mark): Don't mark locations in other
2098         source files; if you use the #line directive inside a method, the
2099         compiler stops emitting line numbers for the debugger until it
2100         reaches the end of the method or another #line directive which
2101         restores the original file.
2102
2103 2003-02-23  Martin Baulig  <martin@ximian.com>
2104
2105         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
2106
2107 2003-02-23  Martin Baulig  <martin@ximian.com>
2108
2109         * statement.cs (Block.AddChildVariableNames): We need to call this
2110         recursively, not just for our immediate children.
2111
2112 2003-02-23  Martin Baulig  <martin@ximian.com>
2113
2114         * class.cs (Event.Define): Always make the field private, like csc does.
2115
2116         * typemanager.cs (TypeManager.RealMemberLookup): Make events
2117         actually work, fixes bug #37521.
2118
2119 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
2120
2121         * delegate.cs: When creating the various temporary "Parameters"
2122         classes, make sure that we call the ComputeAndDefineParameterTypes
2123         on those new parameters (just like we do with the formal ones), to
2124         allow them to be resolved in the context of the DeclSpace.
2125
2126         This fixes the bug that Dick observed in Bugzilla #38530.
2127
2128 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
2129
2130         * expression.cs (ResolveMemberAccess): When resolving a constant,
2131         do not attempt to pull a constant if the value was not able to
2132         generate a valid constant.
2133
2134         * const.cs (LookupConstantValue): Do not report more errors than required.
2135
2136 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2137
2138         * expression.cs: fixes bug #38328.
2139
2140 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2141
2142         * class.cs: Changed all the various members that can be part of a
2143         class from being an ArrayList to be an Array of the right type.
2144         During the DefineType type_list, interface_list, delegate_list and
2145         enum_list are turned into types, interfaces, delegates and enums
2146         arrays.  
2147
2148         And during the member population, indexer_list, event_list,
2149         constant_list, field_list, instance_constructor_list, method_list,
2150         operator_list and property_list are turned into their real arrays.
2151
2152         Although we could probably perform this operation earlier, for
2153         good error reporting we need to keep the lists and remove the
2154         lists for longer than required.
2155
2156         This optimization was triggered by Paolo profiling the compiler
2157         speed on the output of `gen-sample-program.pl' perl script. 
2158
2159         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2160         not crash in methods like MemberLookupFailed that use this field.  
2161
2162         This problem arises when the compiler fails to resolve a type
2163         during interface type definition for example.
2164
2165 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2166
2167         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2168         inherit from System.Object, so we have to stop at null, not only
2169         when reaching System.Object.
2170
2171 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
2172
2173         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2174         DeclaredOnly because the parent indexer might have had a different
2175         name, but did not loop until the top of the hierarchy was reached.
2176
2177         The problem this one fixes is 35492: when a class implemented an
2178         indexer from an interface, we were getting the interface method
2179         (which was abstract) and we were flagging an error (can not invoke
2180         abstract method).
2181
2182         This also keeps bug 33089 functioning, and test-148 functioning.
2183
2184         * typemanager.cs (IsSpecialMethod): The correct way of figuring
2185         out if a method is special is to see if it is declared in a
2186         property or event, or whether it is one of the predefined operator
2187         names.   This should fix correctly #36804.
2188
2189 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
2190
2191         The goal here is to remove the dependency on EmptyCast.Peel ().
2192         Killing it completely.
2193         
2194         The problem is that currently in a number of places where
2195         constants are expected, we have to "probe" for an EmptyCast, and
2196         Peel, which is not the correct thing to do, as this will be
2197         repetitive and will likely lead to errors. 
2198
2199         The idea is to remove any EmptyCasts that are used in casts that
2200         can be reduced to constants, so we only have to cope with
2201         constants. 
2202
2203         This bug hunt was triggered by Bug 37363 and the desire to remove
2204         the duplicate pattern where we were "peeling" emptycasts to check
2205         whether they were constants.  Now constants will always be
2206         constants.
2207         
2208         * ecore.cs: Use an enumconstant here instead of wrapping with
2209         EmptyCast.  
2210
2211         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
2212         throwing me off.  By handling this we can get rid of a few hacks.
2213         
2214         * statement.cs (Switch): Removed Peel() code.
2215
2216 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
2217
2218         * class.cs: Location information for error 508
2219
2220         * expression.cs (New.DoResolve): Add a guard against double
2221         resolution of an expression.  
2222
2223         The New DoResolve might be called twice when initializing field
2224         expressions (see EmitFieldInitializers, the call to
2225         GetInitializerExpression will perform a resolve on the expression,
2226         and later the assign will trigger another resolution
2227
2228         This leads to bugs (#37014)
2229
2230         * delegate.cs: The signature for EndInvoke should contain any ref
2231         or out parameters as well.  We were not doing this in the past. 
2232
2233         * class.cs (Field.Define): Do not overwrite the type definition
2234         inside the `volatile' group.  Turns out that volatile enumerations
2235         were changing the type here to perform a validity test, which
2236         broke conversions. 
2237
2238 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
2239
2240         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2241         and structs, we do not want to load the instance variable
2242
2243         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2244         enum_type has to be handled like an object reference (implicit
2245         conversions exists from this to object), but the regular IsClass
2246         and IsValueType tests will never return true for this one.
2247
2248         Also we use TypeManager.IsValueType instead of type.IsValueType,
2249         just for consistency with the rest of the code (this is only
2250         needed if we ever use the construct exposed by test-180.cs inside
2251         corlib, which we dont today).
2252
2253 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
2254
2255         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2256         just InternalCall.
2257
2258 2003-02-09  Martin Baulig  <martin@ximian.com>
2259
2260         * namespace.cs (Namespace..ctor): Added SourceFile argument.
2261         (Namespace.DefineNamespaces): New static public method; this is
2262         called when we're compiling with debugging to add all namespaces
2263         to the symbol file.
2264
2265         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2266         pass it to the Namespace's .ctor.
2267
2268         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2269         and MethodBase arguments; pass the namespace ID to the symwriter;
2270         pass the MethodBase instead of the token to the symwriter.
2271         (SymbolWriter.DefineNamespace): New method to add a namespace to
2272         the symbol file.
2273
2274 2003-02-09  Martin Baulig  <martin@ximian.com>
2275
2276         * symbolwriter.cs: New file.  This is a wrapper around
2277         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
2278         methods here in near future.
2279
2280 2003-02-09  Martin Baulig  <martin@ximian.com>
2281
2282         * codegen.cs (EmitContext.Mark): Just pass the arguments to
2283         ILGenerator.MarkSequencePoint() which are actually used by the
2284         symbol writer.
2285
2286 2003-02-09  Martin Baulig  <martin@ximian.com>
2287
2288         * location.cs (SourceFile): New public sealed class.  This
2289         contains the name and an index which is used in the location's token.
2290         (Location): Reserve an appropriate number of bits in the token for
2291         the source file instead of walking over that list, this gives us a
2292         really huge performance improvement when compiling with debugging.
2293
2294         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2295         `SourceFile' argument instead of a string.
2296         (Driver.ProcessFile): Add all the files via Location.AddFile(),
2297         but don't parse/tokenize here, we need to generate the list of all
2298         source files before we do that.
2299         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
2300         the files.
2301
2302         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2303         instead of a string.
2304
2305         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2306         of a string.
2307
2308 2003-02-09  Martin Baulig  <martin@ximian.com>
2309
2310         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2311         filename on `#line default'.
2312
2313 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2314
2315         * statement.cs: don't clear the pinned var when the fixed statement
2316         returns from the method (fixes bug#37752).
2317
2318 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2319
2320         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
2321         to IsValueType.
2322
2323 2003-02-07  Martin Baulig  <martin@ximian.com>
2324
2325         * driver.cs: Removed the `--debug-args' command line argument.
2326
2327         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2328         automatically by the AsssemblyBuilder.
2329         (CodeGen.InitializeSymbolWriter): We don't need to call any
2330         initialization function on the symbol writer anymore.  This method
2331         doesn't take any arguments.
2332
2333 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
2334
2335         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2336         from referenced assemblies as well.
2337
2338 2003-02-02  Martin Baulig  <martin@ximian.com>
2339
2340         * class.cs (MethodData.Emit): Generate debugging info for external methods.
2341
2342 2003-02-02  Martin Baulig  <martin@ximian.com>
2343
2344         * class.cs (Constructor.Emit): Open the symbol writer before
2345         emitting the constructor initializer.
2346         (ConstructorInitializer.Emit): Call ec.Mark() to allow
2347         single-stepping through constructor initializers.
2348
2349 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
2350
2351         * class.cs: Handle error 549: do not allow virtual methods in
2352         sealed classes. 
2353
2354 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2355
2356         * decl.cs: Check access levels when resolving types
2357         
2358 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2359
2360         * statement.cs: Add parameters and locals set in catch blocks that might 
2361         return to set vector
2362
2363 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
2364
2365         * class.cs (Operator): Set the SpecialName flags for operators.
2366         
2367         * expression.cs (Invocation.DoResolve): Only block calls to
2368         accessors and operators on SpecialName methods.
2369
2370         (Cast.TryReduce): Handle conversions from char constants.
2371
2372
2373 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2374
2375         * statement.cs: small memory and time optimization in FlowBranching.
2376         
2377 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
2378
2379         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2380         problem that the last fix but in the other sid (Set).
2381
2382         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2383         access when there is no indexer in the hierarchy.
2384         
2385 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2386
2387         * class.cs: Combine some if statements.
2388
2389 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2390
2391         * driver.cs: fixed bug #37187.
2392
2393 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
2394
2395         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2396         any indexer, it's needed to build a list with all the indexers in the
2397         hierarchy (AllGetters), else we have problems. Fixes #35653.
2398
2399 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
2400
2401         * class.cs (MethodData.Define): It is wrong for an interface
2402         implementation to be static in both cases: explicit and implicit.
2403         We were only handling this in one case.
2404
2405         Improve the if situation there to not have negations.
2406         
2407         * class.cs (Field.Define): Turns out that we do not need to check
2408         the unsafe bit on field definition, only on usage.  Remove the test.
2409
2410 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2411
2412         * driver.cs: use assembly.Location instead of Codebase (the latest
2413         patch made mcs fail when using MS assemblies).
2414
2415 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
2416
2417         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2418         get the path to *corlib.dll.
2419
2420 2003-01-21  Nick Drochak <ndrochak@gol.com>
2421
2422         * cs-tokenizer.cs:
2423         * pending.cs:
2424         * typemanager.cs: Remove compiler warnings
2425
2426 2003-01-20  Duncan Mak  <duncan@ximian.com>
2427
2428         * AssemblyInfo.cs: Bump the version number to 0.19.
2429         
2430 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2431
2432         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2433
2434 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
2435
2436         * class.cs (Constructor::Emit): Emit debugging info for constructors.
2437
2438 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
2439
2440         * cs-parser.jay: Small fix: we were not comparing the constructor
2441         name correctly.   Thanks to Zoltan for the initial pointer.
2442
2443 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2444
2445         * cs-tokenizer.cs: Set file name when specified with #line
2446
2447 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
2448
2449         * cs-parser.jay: Only perform the constructor checks here if we
2450         are named like the class;  This will help provider a better
2451         error.  The constructor path is taken when a type definition is
2452         not found, but most likely the user forgot to add the type, so
2453         report that rather than the constructor error.
2454
2455 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2456
2457         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2458         allocations.
2459
2460 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2461
2462         * cs-parser.jay: Add cleanup call.
2463
2464 2003-01-13  Duncan Mak  <duncan@ximian.com>
2465
2466         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2467         consistent with other methods.
2468
2469 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2470
2471         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2472         
2473 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2474
2475         * attribute.cs: only set GuidAttr to true when we have a
2476         GuidAttribute.
2477
2478 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2479
2480         * ecore.cs:
2481         * expression.cs:
2482         * typemanager.cs: fixes to allow mcs compile corlib with the new
2483         Type.IsSubclassOf fix.
2484
2485 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
2486
2487         * expression.cs (LocalVariableReference.DoResolve): Classify a
2488         constant as a value, not as a variable.   Also, set the type for
2489         the variable.
2490
2491         * cs-parser.jay (fixed_statement): take a type instead of a
2492         pointer_type, so we can produce a better error message later.
2493         
2494         * statement.cs (Fixed.Resolve): Flag types that are not pointers
2495         as an error.  
2496         
2497         (For.DoEmit): Make inifinite loops have a
2498         non-conditional branch back.
2499
2500         (Fixed.DoEmit): First populate the pinned variables, then emit the
2501         statement, then clear the variables.  Before I was emitting the
2502         code once for each fixed piece.
2503
2504
2505 2003-01-08  Martin Baulig  <martin@ximian.com>
2506
2507         * statement.cs (FlowBranching.MergeChild): A break in a
2508         SWITCH_SECTION does not leave a loop.  Fixes #36155.
2509
2510 2003-01-08  Martin Baulig  <martin@ximian.com>
2511
2512         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2513         lives in the same number space than `param_map'.  Fixes #36154.
2514
2515 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
2516
2517         * cs-parser.jay (constructor_declaration): Set the
2518         Constructor.ModFlags before probing for it.  This makes the
2519         compiler report 514, 515 and 132 (the code was there, but got
2520         broken). 
2521
2522         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2523         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2524         (GotoCase.Resolve): Set `Returns' to ALWAYS.
2525
2526 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2527
2528         * enum.cs: create the enum static fields using the enum type.
2529
2530 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2531
2532         * class.cs: don't try to create the ParamBuilder for the return
2533         type if it's not needed (and handle it breaking for the ms runtime
2534         anyway).
2535
2536 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2537
2538         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2539
2540 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
2541
2542         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2543         the command.   This showed up while compiling the JANET source
2544         code, which used \r as its only newline separator.
2545
2546 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
2547
2548         * class.cs (Method.Define): If we are an operator (because it
2549         reuses our code), then set the SpecialName and HideBySig.  #36128
2550
2551 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
2552
2553         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2554         exception, report error 120 `object reference required'.
2555
2556         * driver.cs: Add --pause option, used during to measure the size
2557         of the process as it goes with --timestamp.
2558
2559         * expression.cs (Invocation.DoResolve): Do not allow methods with
2560         SpecialName to be invoked.
2561
2562 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
2563
2564         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2565         number before adding it.
2566
2567 2002-12-21  Ravi Pratap  <ravi@ximian.com>
2568
2569         * ecore.cs (StandardImplicitConversion): When in an unsafe
2570         context, we allow conversion between void * to any other pointer
2571         type. This fixes bug #35973.
2572
2573 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2574
2575         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2576         is not thrown when extensionless outputs are used 
2577
2578 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2579
2580         * rootcontext.cs: fixed compilation of corlib.
2581
2582 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
2583
2584         * attribute.cs (Attributes.Contains): Add new method.
2585
2586         * class.cs (MethodCore.LabelParameters): if the parameter is an
2587         `out' parameter, check that no attribute `[In]' has been passed.
2588
2589         * enum.cs: Handle the `value__' name in an enumeration.
2590
2591 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
2592
2593         * decl.cs: Added special case to allow overrides on "protected
2594         internal" methods
2595         
2596 2002-12-18  Ravi Pratap  <ravi@ximian.com>
2597
2598         * attribute.cs (Attributes.AddAttributeSection): Rename to this
2599         since it makes much more sense.
2600
2601         (Attributes.ctor): Don't require a Location parameter.
2602         
2603         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2604
2605         * attribute.cs (ApplyAttributes): Remove extra Location parameters
2606         since we already have that information per attribute.
2607
2608         * everywhere : make appropriate changes.
2609
2610         * class.cs (LabelParameters): Write the code which actually
2611         applies attributes to the return type. We can't do this on the MS
2612         .NET runtime so we flag a warning in the case an exception is
2613         thrown.
2614
2615 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
2616
2617         * const.cs: Handle implicit null conversions here too.
2618
2619 2002-12-17  Ravi Pratap  <ravi@ximian.com>
2620
2621         * class.cs (MethodCore.LabelParameters): Remove the extra
2622         Type [] parameter since it is completely unnecessary. Instead
2623         pass in the method's attributes so that we can extract
2624         the "return" attribute.
2625
2626 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
2627
2628         * cs-parser.jay (parse): Use Report.Error to flag errors instead
2629         of ignoring it and letting the compile continue.
2630
2631         * typemanager.cs (ChangeType): use an extra argument to return an
2632         error condition instead of throwing an exception.
2633
2634 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
2635
2636         * expression.cs (Unary.TryReduce): mimic the code for the regular
2637         code path.  Perform an implicit cast in the cases where we can
2638         implicitly convert to one of the integral types, and then reduce
2639         based on that constant.   This fixes bug #35483.
2640
2641 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2642
2643         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2644
2645 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2646
2647         * namespace.cs: fixed bug #35489.
2648
2649 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
2650
2651         * class.cs: Remove some dead code.
2652
2653         * cs-parser.jay: Estimate the number of methods needed
2654         (RootContext.MethodCount);
2655
2656         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2657         numbers instead of StringBuilders.
2658
2659         * support.cs (PtrHashtable): Add constructor with initial size;
2660         We can now reduce reallocations of the method table.
2661
2662 2002-12-10  Ravi Pratap  <ravi@ximian.com>
2663
2664         * attribute.cs (ApplyAttributes): Keep track of the emitted
2665         attributes on a per-target basis. This fixes bug #35413.
2666
2667 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
2668
2669         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2670         default to the Windows 1252 encoding.
2671
2672         (UnixParseOption): Support version, thanks to Alp for the missing
2673         pointer. 
2674
2675         * AssemblyInfo.cs: Add nice assembly information.
2676
2677         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2678         (bug 35169).
2679
2680         * cs-parser.jay: Allow a trailing comma before the close bracked
2681         in the attribute_section production.
2682
2683         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2684         address of the instance was being taken, I will take this out,
2685         because we take the address of the object immediately here.
2686
2687 2002-12-09  Ravi Pratap  <ravi@ximian.com>
2688
2689         * typemanager.cs (AreMultipleAllowed): Take care of the most
2690         obvious case where attribute type is not in the current assembly -
2691         stupid me ;-)
2692
2693 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
2694
2695         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2696         definitions, instead of doing that afterwards.  
2697
2698         Also we use a nice little hack, depending on the constructor, we
2699         know if we are a "composed" name or a simple name.  Hence, we
2700         avoid the IndexOf test, and we avoid 
2701
2702         * codegen.cs: Add code to assist in a bug reporter to track down
2703         the source of a compiler crash. 
2704
2705 2002-12-07  Ravi Pratap  <ravi@ximian.com>
2706
2707         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2708         types have been emitted for a given element and flag an error
2709         if something which does not have AllowMultiple set is used more
2710         than once.
2711
2712         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2713         attribute types and their corresponding AllowMultiple properties
2714
2715         (AreMultipleAllowed): Check the property for a given type.
2716
2717         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2718         property in the case we have a TypeContainer.
2719
2720         (Attributes.AddAttribute): Detect duplicates and just skip on
2721         adding them. This trivial fix catches a pretty gross error in our
2722         attribute emission - global attributes were being emitted twice!
2723
2724         Bugzilla bug #33187 is now fixed.
2725
2726 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
2727
2728         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2729         instead of pp_and).
2730
2731         * expression.cs (Binary.ResolveOperator): I can only use the
2732         Concat (string, string, string) and Concat (string, string,
2733         string, string) if the child is actually a concatenation of
2734         strings. 
2735
2736 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
2737
2738         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2739         context where we need a 2-character lookahead.
2740
2741         * pending.cs (PendingImplementation): Rework so we can keep track
2742         of interface types all the time, and flag those which were
2743         implemented by parents as optional.
2744
2745 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
2746
2747         * expression.cs (Binary.ResolveOperator): Use
2748         String.Concat(string,string,string) or
2749         String.Concat(string,string,string,string) when possible. 
2750
2751         * typemanager: More helper methods.
2752
2753
2754 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2755
2756         * pending.cs: remove the bogus return from GetMissingInterfaces()
2757         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2758
2759 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2760
2761         * namespace.cs: avoid duplicated 'using xxx' being added to
2762         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2763         when we get more than one 'using' statement for the same namespace.
2764         Report a CS0105 warning for it.
2765
2766 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
2767
2768         * cs-tokenizer.cs (consume_identifier): use read directly, instead
2769         of calling getChar/putback, uses internal knowledge of it.    
2770
2771         (xtoken): Reorder tokenizer so most common patterns are checked
2772         first.  This reduces the compilation time in another 5% (from 8.11s
2773         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2774
2775         The parsing time is 22% of the compilation in mcs, and from that
2776         64% is spent on the tokenization process.  
2777
2778         I tried using a binary search for keywords, but this is slower
2779         than the hashtable.  Another option would be to do a couple of
2780         things:
2781
2782                 * Not use a StringBuilder, instead use an array of chars,
2783                   with a set value.  Notice that this way we could catch
2784                   the 645 error without having to do it *afterwards*.
2785
2786                 * We could write a hand-parser to avoid the hashtable
2787                   compares altogether.
2788
2789         The identifier consumption process takes 37% of the tokenization
2790         time.  Another 15% is spent on is_number.  56% of the time spent
2791         on is_number is spent on Int64.Parse:
2792
2793                 * We could probably choose based on the string length to
2794                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
2795                   computations. 
2796
2797         Another 3% is spend on wrapping `xtoken' in the `token' function.
2798
2799         Handle 0xa0 as whitespace (#34752)
2800         
2801 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
2802
2803         * typemanager.cs (IsCLRType): New routine to tell whether a type
2804         is one of the builtin types.  
2805
2806         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
2807         typecode in more places instead of doing pointer comparissions.
2808         We could leverage some knowledge about the way the typecodes are
2809         laid out.
2810
2811         New code to cache namespaces in assemblies, it is currently not
2812         invoked, to be used soon.
2813
2814         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2815
2816         * expression.cs (Binary.ResolveOperator): specially handle
2817         strings, and do not perform user-defined operator overloading for
2818         built-in types.
2819
2820 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
2821
2822         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2823         internalcall as it is a pretty simple operation;  Avoid whenever
2824         possible to call Char.IsLetter.
2825
2826         (consume_identifier): Cut by half the number of
2827         hashtable calls by merging the is_keyword and GetKeyword behavior.
2828
2829         Do not short-circuit, because if we do, we
2830         report errors (ie, #if false && true would produce an invalid
2831         directive error);
2832         
2833
2834 2002-11-24  Martin Baulig  <martin@ximian.com>
2835
2836         * expression.cs (Cast.TryReduce): If we're in checked syntax,
2837         check constant ranges and report a CS0221.  Fixes #33186.
2838
2839 2002-11-24  Martin Baulig  <martin@ximian.com>
2840
2841         * cs-parser.jay: Make this work for uninitialized variable
2842         declarations in the `for' initializer.  Fixes #32416.
2843
2844 2002-11-24  Martin Baulig  <martin@ximian.com>
2845
2846         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2847         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
2848
2849 2002-11-24  Martin Baulig  <martin@ximian.com>
2850
2851         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2852         argument; if true, we also check for user-defined conversions.
2853         This is only needed if both arguments are of a user-defined type.
2854         Fixes #30443, added test-175.cs.
2855         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2856
2857         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2858
2859 2002-11-24  Martin Baulig  <martin@ximian.com>
2860
2861         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2862         function to get the store opcode.
2863         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2864         only emit the Ldelema if the store opcode is Stobj.  You must run
2865         both test-34 and test-167 to test this.  Fixes #34529.
2866
2867 2002-11-23  Martin Baulig  <martin@ximian.com>
2868
2869         * ecore.cs (Expression.MemberLookup): Added additional
2870         `qualifier_type' argument which is used when we're being called
2871         from MemberAccess.DoResolve() and null if we're called from a
2872         SimpleName lookup.
2873         (Expression.MemberLookupFailed): New method to report errors; this
2874         does the CS1540 check and reports the correct error message.
2875
2876         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2877         argument for the CS1540 check and redone the way how we're dealing
2878         with private members.  See the comment in the source code for details.
2879         (FilterWithClosure): Reverted this back to revision 1.197; renamed
2880         `closure_start_type' to `closure_qualifier_type' and check whether
2881         it's not null.  It was not this filter being broken, it was just
2882         being called with the wrong arguments.
2883
2884         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2885         and pass it the correct `qualifier_type'; this also does the error
2886         handling for us.
2887
2888 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
2889
2890         * expression.cs (Invocation.EmitParams): If the we are dealing
2891         with a non-built-in value type, load its address as well.
2892
2893         (ArrayCreation): Use a a pretty constant instead
2894         of the hardcoded value 2.   Use 6 instead of 2 for the number of
2895         static initializers.  
2896
2897         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2898         because they are not really value types, just glorified integers. 
2899
2900         * driver.cs: Do not append .exe, the CSC compiler does not do it.
2901
2902         * ecore.cs: Remove redundant code for enumerations, make them use
2903         the same code path as everything else, fixes the casting issue
2904         with enumerations in Windows.Forms.
2905
2906         * attribute.cs: Do only cast to string if it is a string, the
2907         validation happens later.
2908
2909         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2910         people upgrade their corlibs.
2911
2912         * ecore.cs: Oops, enumerations were not following the entire code path
2913
2914 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
2915
2916         * typemanager.cs (FilterWithClosure): Commented out the test for
2917         1540 in typemanager.cs, as it has problems when accessing
2918         protected methods from a parent class (see test-174.cs). 
2919
2920         * attribute.cs (Attribute.ValidateGuid): new method.
2921         (Attribute.Resolve): Use above.
2922
2923 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
2924
2925         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2926
2927         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2928         handling for enumerations, as we only needed the TypeContainer
2929         functionality to begin with (this is required for the fix below to
2930         work for enums that reference constants in a container class for
2931         example). 
2932
2933         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2934
2935         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2936         a valid TypeBuilder to perform lookups on.o
2937
2938         * class.cs (InheritableMemberSignatureCompare): Use true in the
2939         call to GetGetMethod and GetSetMethod, because we are comparing
2940         the signature, and we need to get the methods *even* if they are
2941         private. 
2942
2943         (PropertyBase.CheckBase): ditto.
2944
2945         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2946         GotoCase.Resolve): Use Peel on EmpytCasts.
2947
2948         * ecore.cs (EmptyCast): drop child, add Peel method.
2949
2950 2002-11-17  Martin Baulig  <martin@ximian.com>
2951
2952         * ecore.cs (EmptyCast.Child): New public property.
2953
2954         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2955         label resolved to an EmptyCast.  Fixes #34162.
2956         (GotoCase.Resolve): Likewise.
2957         (Block.EmitMeta): Likewise.
2958
2959 2002-11-17  Martin Baulig  <martin@ximian.com>
2960
2961         * expression.cs (Invocation.BetterConversion): Prefer int over
2962         uint; short over ushort; long over ulong for integer literals.
2963         Use ImplicitConversionExists instead of StandardConversionExists
2964         since we also need to check for user-defined implicit conversions.
2965         Fixes #34165.  Added test-173.cs.
2966
2967 2002-11-16  Martin Baulig  <martin@ximian.com>
2968
2969         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2970         with the `true' and `false' literals.  Fixes #33151.
2971
2972 2002-11-16  Martin Baulig  <martin@ximian.com>
2973
2974         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2975         October 22nd; don't do the cs1540 check for static members.
2976
2977         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2978         now using our own filter here and doing the cs1540 check again.
2979
2980 2002-11-16  Martin Baulig  <martin@ximian.com>
2981
2982         * support.cs (InternalParameters): Don't crash if we don't have
2983         any fixed parameters.  Fixes #33532.
2984
2985 2002-11-16  Martin Baulig  <martin@ximian.com>
2986
2987         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2988         when looking up static methods to make this work on Windows.
2989         Fixes #33773.
2990
2991 2002-11-16  Martin Baulig  <martin@ximian.com>
2992
2993         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2994         a setter rather than using PropertyInfo.CanWrite.
2995
2996 2002-11-15  Nick Drochak  <ndrochak@gol.com>
2997
2998         * class.cs: Allow acces to block member by subclasses. Fixes build
2999         breaker.
3000
3001 2002-11-14  Martin Baulig  <martin@ximian.com>
3002
3003         * class.cs (Constructor.Emit): Added the extern/block check.
3004         Fixes bug #33678.
3005
3006 2002-11-14  Martin Baulig  <martin@ximian.com>
3007
3008         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
3009         iteration while looking for indexers, this is needed because the
3010         indexer may have a different name in our base classes.  Fixed the
3011         error reporting (no indexers at all, not get accessor, no
3012         overloaded match).  Fixes bug #33089.
3013         (IndexerAccess.DoResolveLValue): Likewise.
3014
3015 2002-11-14  Martin Baulig  <martin@ximian.com>
3016
3017         * class.cs (PropertyBase.CheckBase): Make this work for multiple
3018         indexers.  Fixes the first part of bug #33089.
3019         (MethodSignature.InheritableMemberSignatureCompare): Added support
3020         for properties.
3021
3022 2002-11-13  Ravi Pratap  <ravi@ximian.com>
3023
3024         * attribute.cs (Attribute.Resolve): Catch the
3025         NullReferenceException and report it since it isn't supposed to
3026         happen. 
3027         
3028 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
3029
3030         * expression.cs (Binary.EmitBranchable): Also handle the cases for
3031         LogicalOr and LogicalAnd that can benefit from recursively
3032         handling EmitBranchable.  The code now should be nice for Paolo.
3033
3034 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
3035
3036         * typemanager.cs (LookupType): Added a negative-hit hashtable for
3037         the Type lookups, as we perform quite a number of lookups on
3038         non-Types.  This can be removed once we can deterministically tell
3039         whether we have a type or a namespace in advance.
3040
3041         But this might require special hacks from our corlib.
3042
3043         * TODO: updated.
3044
3045         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
3046         and double which avoids a conversion from an integer to a double.
3047
3048         * expression.cs: tiny optimization, avoid calling IsConstant,
3049         because it effectively performs the lookup twice.
3050
3051 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
3052
3053         But a bogus return here to keep the semantics of the old code
3054         until the Mono runtime is fixed.
3055         
3056         * pending.cs (GetMissingInterfaces): New method used to remove all
3057         the interfaces that are already implemented by our parent
3058         classes from the list of pending methods. 
3059
3060         * interface.cs: Add checks for calls after ResolveTypeExpr.
3061
3062 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
3063
3064         * class.cs (Class.Emit): Report warning 67: event not used if the
3065         warning level is beyond 3.
3066
3067         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
3068         being a NullLiteral.
3069
3070         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
3071         specifiers. 
3072
3073         * class.cs (TypeContainer.GetClassBases): Cover a missing code
3074         path that might fail if a type can not be resolved.
3075
3076         * expression.cs (Binary.Emit): Emit unsigned versions of the
3077         operators. 
3078
3079         * driver.cs: use error 5.
3080         
3081 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
3082
3083         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
3084
3085 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
3086
3087         * cs-parser.jay (switch_section): A beautiful patch from Martin
3088         Baulig that fixed 33094.
3089
3090 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
3091
3092         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
3093         Check whether the base is abstract and report an error if so.
3094
3095         * expression.cs (IndexerAccess.DoResolveLValue,
3096         IndexerAccess.DoResolve): ditto. 
3097
3098         (Invocation.DoResolve): ditto.
3099         
3100         (Invocation.FullMethodDesc): Improve the report string.
3101
3102         * statement.cs (Block): Eliminate IsVariableDefined as it is
3103         basically just a wrapper for GetVariableInfo.
3104
3105         * ecore.cs (SimpleName): Use new 
3106
3107         * support.cs (ReflectionParamter.ParameterType): We unwrap the
3108         type, as we return the actual parameter ref/unref state on a
3109         different call.
3110
3111 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
3112
3113         * support.cs: Return proper flags REF/OUT fixing the previous
3114         commit.  
3115
3116         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
3117         not used to mean `ref' but `ref or out' in ParameterReference
3118         
3119         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3120         full type signature instead of calling TypeManger.CSharpName
3121         ourselves. 
3122
3123         * support.cs (InternalParameters.ParameterDesc): Do not compare
3124         directly to the modflags, because REF/OUT will actually be bitsets
3125         if set. 
3126
3127         * delegate.cs (VerifyMethod): Check also the modifiers.
3128
3129         * cs-tokenizer.cs: Fix bug where floating point values with an
3130         exponent where a sign was missing was ignored.
3131
3132         * driver.cs: Allow multiple assemblies to be specified in a single
3133         /r: argument
3134
3135 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
3136
3137         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
3138         because identifiers after a parenthesis would end up in this kind
3139         of production, and we needed to desamiguate it for having casts
3140         like:
3141
3142                 (UserDefinedType *) xxx
3143
3144 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
3145
3146         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3147         we should set on the Bindingflags.NonPublic, but not turn on
3148         private_ok.  private_ok controls whether a Private member is
3149         returned (this is chekced on the filter routine), while the
3150         BindingFlags.NonPublic just controls whether private/protected
3151         will be allowed.   This fixes the problem part of the problem of
3152         private properties being allowed to be used in derived classes.
3153
3154         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3155         so we can call the children DoResolveLValue method (this will
3156         properly signal errors on lvalue assignments to base properties)
3157         
3158         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3159         getter are null, and we have a property info, we know that this
3160         happened because the lookup failed, so we report an error 122 for
3161         protection level violation.
3162
3163         We also silently return if setter and getter are null in the
3164         resolve functions, this condition only happens if we have flagged
3165         the error before.  This is the other half of the problem. 
3166
3167         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3168         not have accessibility information, that is why we were returning
3169         true in the filter function in typemanager.cs.
3170
3171         To properly report 122 (property is inaccessible because of its
3172         protection level) correctly, we report this error in ResolveAccess
3173         by failing if both the setter and the getter are lacking (ie, the
3174         lookup failed). 
3175
3176         DoResolve and DoLResolve have been modified to check for both
3177         setter/getter being null and returning silently, the reason being
3178         that I did not want to put the knowledge about this error in upper
3179         layers, like:
3180
3181         int old = Report.Errors;
3182         x = new PropertyExpr (...);
3183         if (old != Report.Errors)
3184                 return null;
3185         else
3186                 return x;
3187
3188         So the property expr is returned, but it is invalid, so the error
3189         will be flagged during the resolve process. 
3190
3191         * class.cs: Remove InheritablePropertySignatureCompare from the
3192         class, as we no longer depend on the property signature to compute
3193         whether it is possible to implement a method or not.
3194
3195         The reason is that calling PropertyInfo.GetGetMethod will return
3196         null (in .NET, in Mono it works, and we should change this), in
3197         cases where the Get Method does not exist in that particular
3198         class.
3199
3200         So this code:
3201
3202         class X { public virtual int A { get { return 1; } } }
3203         class Y : X { }
3204         class Z : Y { public override int A { get { return 2; } } }
3205
3206         Would fail in Z because the parent (Y) would not have the property
3207         defined.  So we avoid this completely now (because the alternative
3208         fix was ugly and slow), and we now depend exclusively on the
3209         method names.
3210
3211         (PropertyBase.CheckBase): Use a method-base mechanism to find our
3212         reference method, instead of using the property.
3213
3214         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
3215         routines are gone now.
3216
3217         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
3218         names, they were incorrectly named.
3219
3220         * cs-tokenizer.cs: Return are more gentle token on failure. 
3221
3222         * pending.cs (PendingImplementation.InterfaceMethod): This routine
3223         had an out-of-sync index variable, which caused it to remove from
3224         the list of pending methods the wrong method sometimes.
3225
3226 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
3227
3228         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
3229         CanWrite, because those refer to this particular instance of the
3230         property, and do not take into account the fact that we can
3231         override single members of a property.
3232
3233         Constructor requires an EmitContext.  The resolution process does
3234         not happen here, but we need to compute the accessors before,
3235         because the resolution does not always happen for properties.
3236         
3237         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3238         subclass, before we did not update this flag, but we did update
3239         bindingflags. 
3240
3241         (GetAccessors): Drop this routine, as it did not work in the
3242         presence of partially overwritten set/get methods. 
3243
3244         Notice that this broke the cs1540 detection, but that will require
3245         more thinking. 
3246         
3247 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3248
3249         * class.cs:
3250         * codegen.cs:
3251         * driver.cs: issue a warning instead of an error if we don't support
3252         debugging for the platform. Also ignore a couple of errors that may
3253         arise when trying to write the symbols. Undo my previous patch.
3254
3255 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3256
3257         * driver.cs: ignore /debug switch except for Unix platforms.
3258
3259 2002-10-23  Nick Drochak  <ndrochak@gol.com>
3260
3261         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3262
3263 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
3264
3265         * driver.cs: Do not make mcs-debug conditional, so we do not break
3266         builds that use it.
3267
3268         * statement.cs (UsageVector.MergeChildren): I would like Martin to
3269         review this patch.  But basically after all the children variables
3270         have been merged, the value of "Breaks" was not being set to
3271         new_breaks for Switch blocks.  I think that it should be set after
3272         it has executed.  Currently I set this to the value of new_breaks,
3273         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3274         conservative, but I do not understand this code very well.
3275
3276         I did not break anything in the build, so that is good ;-)
3277
3278         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3279
3280 2002-10-20  Mark Crichton  <crichton@gimp.org>
3281
3282         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
3283
3284 2002-10-20  Nick Drochak  <ndrochak@gol.com>
3285
3286         * cfold.cs: Fixed compile blocker.
3287
3288 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
3289
3290         * driver.cs: I was chekcing the key, not the file.
3291
3292 2002-10-19  Ravi Pratap  <ravi@ximian.com>
3293
3294         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3295         message that we were generating - we just need to silently return
3296         a null.
3297
3298 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
3299
3300         * class.cs (Event.Define): Change my previous commit, as this
3301         breaks the debugger.  This is a temporary hack, as it seems like
3302         the compiler is generating events incorrectly to begin with.
3303
3304         * expression.cs (Binary.ResolveOperator): Added support for 
3305         "U operator - (E x, E y)"
3306
3307         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3308         y)".
3309
3310         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3311         init-only variables, but this path did not take into account that
3312         there might be also instance readonly variables.  Correct this
3313         problem. 
3314
3315         This fixes bug 32253
3316
3317         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3318         delegates as well.
3319
3320         * driver.cs: Change the extension for modules to `netmodule'
3321
3322         * cs-parser.jay: Improved slightly the location tracking for
3323         the debugger symbols.
3324
3325         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3326         modifiers that were specified instead of the hardcoded value
3327         (FamAndAssem).  This was basically ignoring the static modifier,
3328         and others.  Fixes 32429.
3329
3330         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3331         fixed a bug in the process (32476)
3332
3333         * expression.cs (ArrayAccess.EmitAssign): Patch from
3334         hwang_rob@yahoo.ca that fixes bug 31834.3
3335
3336 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
3337
3338         * driver.cs: Make the module extension .netmodule.
3339
3340 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
3341
3342         * driver.cs: Report an error if the resource file is not found
3343         instead of crashing.
3344
3345         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3346         false, like Emit does.
3347
3348 2002-10-16  Nick Drochak  <ndrochak@gol.com>
3349
3350         * typemanager.cs: Remove unused private member.  Also reported mcs
3351         bug to report this as a warning like csc.
3352
3353 2002-10-15  Martin Baulig  <martin@gnome.org>
3354
3355         * statement.cs (Statement.Emit): Made this a virtual method; emits
3356         the line number info and calls DoEmit().
3357         (Statement.DoEmit): New protected abstract method, formerly knows
3358         as Statement.Emit().
3359
3360         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3361
3362 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
3363
3364         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3365         have fixed a remaining problem: not every AddXXXX was adding a
3366         fully qualified name.  
3367
3368         Now everyone registers a fully qualified name in the DeclSpace as
3369         being defined instead of the partial name.  
3370
3371         Downsides: we are slower than we need to be due to the excess
3372         copies and the names being registered this way.  
3373
3374         The reason for this is that we currently depend (on the corlib
3375         bootstrap for instance) that types are fully qualified, because
3376         we dump all the types in the namespace, and we should really have
3377         types inserted into the proper namespace, so we can only store the
3378         basenames in the defined_names array.
3379
3380 2002-10-10  Martin Baulig  <martin@gnome.org>
3381
3382         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3383         from bug #31834, see the bug report for a testcase which is
3384         miscompiled.
3385
3386 2002-10-10  Martin Baulig  <martin@gnome.org>
3387
3388         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3389         flow analysis code for this.
3390
3391         * statement.cs (Do, While, For): Tell the flow analysis code about
3392         infinite loops.
3393         (FlowBranching.UsageVector): Added support for infinite loops.
3394         (Block.Resolve): Moved the dead code elimination here and use flow
3395         analysis to do it.
3396
3397 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
3398
3399         * class.cs (Field.Define): Catch cycles on struct type
3400         definitions. 
3401
3402         * typemanager.cs (IsUnmanagedtype): Do not recursively check
3403         fields if the fields are static.  We only need to check instance
3404         fields. 
3405
3406         * expression.cs (As.DoResolve): Test for reference type.
3407
3408         * statement.cs (Using.ResolveExpression): Use
3409         ConvertImplicitRequired, not ConvertImplicit which reports an
3410         error on failture
3411         (Using.ResolveLocalVariableDecls): ditto.
3412
3413         * expression.cs (Binary.ResolveOperator): Report errors in a few
3414         places where we had to.
3415
3416         * typemanager.cs (IsUnmanagedtype): Finish implementation.
3417
3418 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
3419
3420         * expression.cs: Use StoreFromPtr instead of extracting the type
3421         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
3422
3423         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3424         an enumeration value to a System.Enum, but System.Enum is not a
3425         value type, but an class type, so we need to box.
3426
3427         (Expression.ConvertExplicit): One codepath could return
3428         errors but not flag them.  Fix this.  Fixes #31853
3429
3430         * parameter.cs (Resolve): Do not allow void as a parameter type.
3431
3432 2002-10-06  Martin Baulig  <martin@gnome.org>
3433
3434         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3435         if it's a class type and not a struct.  Fixes #31815.
3436
3437 2002-10-06  Martin Baulig  <martin@gnome.org>
3438
3439         * statement.cs: Reworked the flow analysis code a bit to make it
3440         usable for dead code elimination.
3441
3442 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3443
3444         * cs-parser.jay: allow empty source files. Fixes bug #31781.
3445
3446 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3447
3448         * expression.cs (ComposedCast.DoResolveType): A quick workaround
3449         to fix the test 165, will investigate deeper.
3450
3451 2002-10-04  Martin Baulig  <martin@gnome.org>
3452
3453         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3454         finally blocks actually work.
3455         (Try.Resolve): We don't need to create a sibling for `finally' if
3456         there is no finally block.
3457
3458 2002-10-04  Martin Baulig  <martin@gnome.org>
3459
3460         * class.cs (Constructor.Define): The default accessibility for a
3461         non-default constructor is private, not public.
3462
3463 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3464
3465         * class.cs (Constructor): Make AllowedModifiers public, add
3466         EXTERN.
3467
3468         * cs-parser.jay: Perform the modifiers test here, as the
3469         constructor for the Constructor class usually receives a zero
3470         because of the way we create it (first we create, later we
3471         customize, and we were never checking the modifiers).
3472
3473         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3474         is a version of LookupTypeReflection that includes the type-name
3475         cache.  This can be used as a fast path for functions that know
3476         the fully qualified name and are only calling into *.GetType() to
3477         obtain a composed type.
3478
3479         This is also used by TypeManager.LookupType during its type
3480         composition.
3481
3482         (LookupType): We now also track the real type name, as sometimes
3483         we can get a quey for the real type name from things like
3484         ComposedCast.  This fixes bug 31422.
3485         
3486         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3487         complete type fullname, it does not have to go through the type
3488         resolution system to obtain the composed version of the type (for
3489         obtaining arrays or pointers).
3490         
3491         (Conditional.Emit): Use the EmitBoolExpression to
3492         generate nicer code, as requested by Paolo.
3493
3494         (ArrayCreation.CheckIndices): Use the patch from
3495         hwang_rob@yahoo.ca to validate the array initializers. 
3496
3497 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
3498
3499         * class.cs (ConstructorInitializer.Emit): simplify code by using
3500         Invocation.EmitCall, and at the same time, fix the bugs in calling
3501         parent constructors that took variable arguments. 
3502
3503         * ecore.cs (Expression.ConvertNumericExplicit,
3504         Expression.ImplicitNumericConversion): Remove the code that
3505         manually wrapped decimal (InternalTypeConstructor call is now gone
3506         as well).
3507
3508         * expression.cs (Cast.TryReduce): Also handle decimal types when
3509         trying to perform a constant fold on the type.
3510
3511         * typemanager.cs (IsUnmanagedtype): Partially implemented.
3512
3513         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3514         that only turned off an error report, and did nothing else. 
3515
3516 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
3517
3518         * driver.cs: Handle and ignore /fullpaths
3519
3520 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
3521
3522         * expression.cs (Binary.ResolveOperator): Catch the case where
3523         DoNumericPromotions returns true, 
3524
3525         (Binary.DoNumericPromotions): Simplify the code, and the tests.
3526
3527 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
3528
3529         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3530         report error 70.
3531
3532 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
3533
3534         * ecore.cs (ConvertNumericExplicit): It is not enough that the
3535         conversion exists, but it is also required that the conversion be
3536         performed.  This manifested in "(Type64Enum) 2".  
3537
3538         * class.cs (TypeManager.AddMethod): The fix is not to change
3539         AddEnum, because that one was using a fully qualified name (every
3540         DeclSpace derivative does), but to change the AddMethod routine
3541         that was using an un-namespaced name.  This now correctly reports
3542         the duplicated name.
3543
3544         Revert patch until I can properly fix it.  The issue
3545         is that we have a shared Type space across all namespaces
3546         currently, which is wrong.
3547
3548         Options include making the Namespace a DeclSpace, and merge
3549         current_namespace/current_container in the parser.
3550
3551 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
3552
3553         * cs-parser.jay: Improve error reporting when we get a different
3554         kind of expression in local_variable_type and
3555         local_variable_pointer_type. 
3556
3557         Propagate this to avoid missleading errors being reported.
3558
3559         * ecore.cs (ImplicitReferenceConversion): treat
3560         TypeManager.value_type as a target just like object_type.   As
3561         code like this:
3562
3563         ValueType v = 1;
3564
3565         Is valid, and needs to result in the int 1 being boxed before it
3566         is assigned to the value type v.
3567
3568         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3569         to validate the enumeration name.
3570
3571         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3572         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
3573         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3574
3575         * ecore.cs (TryImplicitIntConversion): When doing an
3576         implicit-enumeration-conversion, check if the type is 64-bits and
3577         perform a conversion before passing to EnumConstant.
3578
3579 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
3580
3581         * decl.cs (Error_AmbiguousTypeReference); New routine used to
3582         report ambiguous type references.  Unlike the MS version, we
3583         report what the ambiguity is.   Innovation at work ;-)
3584
3585         (DeclSpace.FindType): Require a location argument to
3586         display when we display an ambiguous error.
3587
3588         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3589
3590         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3591
3592         * expression.cs (EmitDynamicInitializers): Apply patch from
3593         hwang_rob@yahoo.ca that fixes the order in which we emit our
3594         initializers. 
3595
3596 2002-09-21  Martin Baulig  <martin@gnome.org>
3597
3598         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3599         delegate takes no arguments.
3600
3601 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
3602
3603         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3604         from integers.
3605
3606         * expression.cs: Extract the underlying type.
3607
3608         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3609
3610         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3611
3612 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
3613
3614         * class.cs (TypeContainer.DefineType): We can not use the nice
3615         PackingSize with the size set to 1 DefineType method, because it
3616         will not allow us to define the interfaces that the struct
3617         implements.
3618
3619         This completes the fixing of bug 27287
3620
3621         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3622         means also structs.  This fixes part of the problem. 
3623         (Expresion.ImplicitReferenceConversionExists): ditto.
3624
3625         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3626         error if there were no errors reported during the type lookup
3627         process, to avoid duplicates or redundant errors.  Without this
3628         you would get an ambiguous errors plus a type not found.  We have
3629         beaten the user enough with the first error.  
3630
3631         (DeclSparce.FindType): Emit a warning if we have an ambiguous
3632         reference. 
3633
3634         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3635         during the resolution process, stop the lookup, this avoids
3636         repeated error reports (same error twice).
3637
3638         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3639
3640         * typemanager.cs (LookupType): Redo the type lookup code to match
3641         the needs of System.Reflection.  
3642
3643         The issue is that System.Reflection requires references to nested
3644         types to begin with a "+" sign instead of a dot.  So toplevel
3645         types look like: "NameSpace.TopLevelClass", and nested ones look
3646         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3647         levels. 
3648
3649 2002-09-19  Martin Baulig  <martin@gnome.org>
3650
3651         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3652         says that a method always returns or always throws an exception,
3653         don't report the CS0161.
3654
3655         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3656         set `Returns = new_returns'.
3657
3658 2002-09-19  Martin Baulig  <martin@gnome.org>
3659
3660         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3661         to an enum constant, check for a CS0176.
3662
3663 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
3664
3665         * class.cs (TypeContainer.CheckPairedOperators): Now we check
3666         for operators that must be in pairs and report errors.
3667
3668         * ecore.cs (SimpleName.DoResolveType): During the initial type
3669         resolution process, when we define types recursively, we must
3670         check first for types in our current scope before we perform
3671         lookups in the enclosing scopes.
3672
3673         * expression.cs (MakeByteBlob): Handle Decimal blobs.
3674
3675         (Invocation.VerifyArgumentsCompat): Call
3676         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3677         I thought we were supposed to always call this, but there are a
3678         few places in the code where we dont do it.
3679
3680 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
3681
3682         * driver.cs: Add support in -linkres and -resource to specify the
3683         name of the identifier.
3684
3685 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3686
3687         * ecore.cs (StandardConversionExists): Sync with the conversion
3688         code: allow anything-* to void* conversions.
3689
3690         (FindMostSpecificSource): Use an Expression argument
3691         instead of a Type, because we might be handed over a Literal which
3692         gets a few more implicit conversions that plain types do not.  So
3693         this information was being lost.
3694
3695         Also, we drop the temporary type-holder expression when not
3696         required.
3697
3698 2002-09-17  Martin Baulig  <martin@gnome.org>
3699
3700         * class.cs (PropertyBase.CheckBase): Don't check the base class if
3701         this is an explicit interface implementation.
3702
3703 2002-09-17  Martin Baulig  <martin@gnome.org>
3704
3705         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3706         different `IndexerName' attributes.
3707
3708         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3709         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3710         virtual CommonResolve().
3711
3712 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3713
3714         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3715         and convert that to the UnderlyingType.
3716
3717         * statement.cs (Foreach.Resolve): Indexers are just like variables
3718         or PropertyAccesses.
3719
3720         * cs-tokenizer.cs (consume_string): Track line numbers and columns
3721         inside quoted strings, we were not doing this before.
3722
3723 2002-09-16  Martin Baulig  <martin@gnome.org>
3724
3725         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3726         resolve it.  This is needed for the definite assignment check of the
3727         instance expression, fixes bug #29846.
3728         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3729
3730 2002-09-16  Nick Drochak  <ndrochak@gol.com>
3731
3732         * parameter.cs: Fix compile error.  Cannot reference static member
3733         from an instance object.  Is this an mcs bug?
3734
3735 2002-09-14  Martin Baulig  <martin@gnome.org>
3736
3737         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3738         multiple times.  Fixes bug #30295, added test-166.cs.
3739
3740 2002-09-14  Martin Baulig  <martin@gnome.org>
3741
3742         * statement.cs (Block.Emit): Don't emit unreachable code.
3743         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3744         `break' statements.
3745         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3746
3747 2002-09-14  Martin Baulig  <martin@gnome.org>
3748
3749         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3750         is set.
3751
3752 2002-09-14  Martin Baulig  <martin@gnome.org>
3753
3754         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3755         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3756         be false on the ms runtime.
3757
3758 2002-09-13  Martin Baulig  <martin@gnome.org>
3759
3760         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3761         the CS0038 error message.
3762
3763 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
3764
3765         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3766         constant inside, return it.
3767
3768 2002-09-12  Martin Baulig  <martin@gnome.org>
3769
3770         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3771         implicit conversion can be done between enum types.
3772
3773         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3774         check whether an implicit conversion to the current enum's UnderlyingType
3775         exists and report an error if not.
3776
3777         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3778         without debugging support.
3779
3780         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3781         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
3782
3783 2002-09-12  Martin Baulig  <martin@gnome.org>
3784
3785         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3786
3787         * ecore.cs (IMemberExpr.DeclaringType): New property.
3788         (SimpleName.SimpleNameResolve): Check whether we're accessing a
3789         nonstatic member of an outer type (CS0038).
3790
3791 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
3792
3793         * driver.cs: Activate the using-error detector at warning level
3794         4 (at least for MS-compatible APIs).
3795
3796         * namespace.cs (VerifyUsing): Small buglett fix.
3797
3798         * pending.cs (PendingImplementation): pass the container pointer. 
3799
3800         * interface.cs (GetMethods): Allow for recursive definition.  Long
3801         term, I would like to move every type to support recursive
3802         definitions, not the current ordering mechanism that we have right
3803         now.
3804
3805         The situation is this: Attributes are handled before interfaces,
3806         so we can apply attributes to interfaces.  But some attributes
3807         implement interfaces, we will now handle the simple cases
3808         (recursive definitions will just get an error).  
3809
3810         * parameter.cs: Only invalidate types at the end if we fail to
3811         lookup all types.  
3812
3813 2002-09-09  Martin Baulig  <martin@gnome.org>
3814
3815         * ecore.cs (PropertyExpr.Emit): Also check for
3816         TypeManager.system_int_array_get_length so this'll also work when
3817         compiling corlib.  Fixes #30003.
3818
3819 2002-09-09  Martin Baulig  <martin@gnome.org>
3820
3821         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3822         and throw an exception if we can't get the type's size.  Fixed #30040,
3823         added test-165.cs.
3824
3825 2002-09-09  Martin Baulig  <martin@gnome.org>
3826
3827         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3828
3829         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3830         context.  Fixes bug #30027.
3831
3832         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3833         virtual functions.  Fixes bug #30043, added test-164.cs.
3834
3835 2002-09-08  Ravi Pratap  <ravi@ximian.com>
3836
3837         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3838
3839 2002-09-08  Nick Drochak  <ndrochak@gol.com>
3840
3841         * driver.cs: Use an object to get the windows codepage since it's not a
3842         static property.
3843
3844 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
3845
3846         * statement.cs (For.Emit): for infinite loops (test == null)
3847         return whether there is a break inside, not always "true".
3848
3849         * namespace.cs (UsingEntry): New struct to hold the name of the
3850         using definition, the location where it is defined, and whether it
3851         has been used in a successful type lookup.
3852         
3853         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3854         strings.
3855
3856         * decl.cs: ditto.
3857
3858 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3859
3860         * attribute.cs : Fix incorrect code which relied on catching
3861         a NullReferenceException to detect a null being passed in
3862         where an object was expected.
3863
3864 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
3865
3866         * statement.cs (Try): flag the catch variable as assigned
3867
3868         * expression.cs (Cast): Simplified by using ResolveType instead of
3869         manually resolving.
3870
3871         * statement.cs (Catch): Fix bug by using ResolveType.
3872
3873 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3874
3875         * expression.cs (BetterConversion): Special case for when we have
3876         a NullLiteral as the argument and we have to choose between string
3877         and object types - we choose string the way csc does.
3878
3879         * attribute.cs (Attribute.Resolve): Catch the
3880         NullReferenceException and report error #182 since the Mono
3881         runtime no more has the bug and having this exception raised means
3882         we tried to select a constructor which takes an object and is
3883         passed a null.
3884
3885 2002-09-05  Ravi Pratap  <ravi@ximian.com>
3886
3887         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3888         message (1502, 1503) when we can't locate a method after overload
3889         resolution. This is much more informative and closes the bug
3890         Miguel reported.
3891
3892         * interface.cs (PopulateMethod): Return if there are no argument
3893         types. Fixes a NullReferenceException bug.
3894
3895         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3896         expressions too. Previously we were checking only in one place for
3897         positional arguments leaving out named arguments.
3898
3899         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3900         type to the enum type is not allowed. Remove code corresponding to
3901         that.
3902
3903         (ConvertNumericExplicit): Allow explicit conversions from
3904         the underlying type to enum type. This precisely follows the spec
3905         and closes a bug filed by Gonzalo.
3906         
3907 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3908
3909         * compiler.csproj:
3910         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3911
3912 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
3913
3914         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3915         it was important that we stored the right value after the
3916         reduction in `converted'.
3917
3918 2002-09-04  Martin Baulig  <martin@gnome.org>
3919
3920         * location.cs (Location.SymbolDocument): Use full pathnames for the
3921         source files.
3922
3923 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
3924
3925         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3926         of the expression resolve mechanism, because that will catch the
3927         SimpleName error failures.
3928
3929         (Conditional): If we can not resolve the
3930         expression, return, do not crash.
3931
3932 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3933
3934         * cs-tokenizer.cs:
3935         (location): display token name instead of its number.
3936
3937 2002-08-28  Martin Baulig  <martin@gnome.org>
3938
3939         * expression.cs (Binary.ResolveOperator): Don't silently return
3940         but return an error if an operator cannot be applied between two
3941         enum types.
3942
3943 2002-08-28  Martin Baulig  <martin@gnome.org>
3944
3945         * class.cs (Constructor.Define): Set the permission attributes
3946         correctly instead of making all constructors public.
3947
3948 2002-08-28  Martin Baulig  <martin@gnome.org>
3949
3950         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3951         for private members before reporting a CS0103; if we find anything,
3952         it's a CS0122.
3953
3954 2002-08-28  Martin Baulig  <martin@gnome.org>
3955
3956         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3957         to check whether `closure_start_type == closure_invocation_type',
3958         we also need to check whether `m.DeclaringType == closure_invocation_type'
3959         before bypassing the permission checks.  We might be accessing
3960         protected/private members from the base class.
3961         (TypeManager.RealMemberLookup): Only set private_ok if private
3962         members were requested via BindingFlags.NonPublic.
3963
3964         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3965
3966         * expression.cs (MemberAccess.ResolveMemberAccess): Set
3967         MethodGroupExpr.IsExplicitImpl if appropriate.
3968         (Invocation.DoResolve): Don't report the CS0120 for explicit
3969         interface implementations.
3970
3971 2002-08-27  Martin Baulig  <martin@gnome.org>
3972
3973         * expression.cs (Invocation.DoResolve): If this is a static
3974         method and we don't have an InstanceExpression, we must report
3975         a CS0120.
3976
3977 2002-08-25  Martin Baulig  <martin@gnome.org>
3978
3979         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3980         `==' between a valuetype and an object.
3981
3982 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
3983
3984         * ecore.cs (TypeExpr): Provide a ToString method.
3985
3986 2002-08-24  Martin Baulig  <martin@gnome.org>
3987
3988         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3989         now called proggie.dbg and it's a binary file.
3990
3991 2002-08-23  Martin Baulig  <martin@gnome.org>
3992
3993         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3994
3995 2002-08-23  Martin Baulig  <martin@gnome.org>
3996
3997         * struct.cs (MyStructInfo.ctor): Make this work with empty
3998         structs; it's not allowed to use foreach() on null.
3999
4000 2002-08-23  Martin Baulig  <martin@gnome.org>
4001
4002         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
4003         writer the full pathname of the generated assembly.
4004
4005 2002-08-23  Martin Baulig  <martin@gnome.org>
4006
4007         * statements.cs (FlowBranching.UsageVector.MergeChildren):
4008         A `finally' block never returns or breaks; improved handling of
4009         unreachable code.
4010
4011 2002-08-23  Martin Baulig  <martin@gnome.org>
4012
4013         * statement.cs (Throw.Resolve): Allow `throw null'.
4014
4015 2002-08-23  Martin Baulig  <martin@gnome.org>
4016
4017         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
4018         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
4019         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
4020         MemberLookup would return a wrong event if this is an explicit
4021         interface implementation and the class has an event with the same
4022         name.
4023
4024 2002-08-23  Martin Baulig  <martin@gnome.org>
4025
4026         * statement.cs (Block.AddChildVariableNames): New public method.
4027         (Block.AddChildVariableName): Likewise.
4028         (Block.IsVariableNameUsedInChildBlock): Likewise.
4029         (Block.AddVariable): Check whether a variable name has already
4030         been used in a child block.
4031
4032         * cs-parser.jay (declare_local_variables): Mark all variable names
4033         from the current block as being used in a child block in the
4034         implicit block.
4035
4036 2002-08-23  Martin Baulig  <martin@gnome.org>
4037
4038         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
4039         find the symbol writer.
4040
4041         * driver.cs: csc also allows the arguments to /define being
4042         separated by commas, not only by semicolons.
4043
4044 2002-08-23  Martin Baulig  <martin@gnome.org>
4045
4046         * interface.cs (Interface.GetMembers): Added static check for events.
4047
4048 2002-08-15  Martin Baulig  <martin@gnome.org>
4049
4050         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
4051         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
4052
4053         * ecore.cs (Expression.MemberLookup): Added documentation and explained
4054         why the MethodData.EmitDestructor() change was necessary.
4055
4056 2002-08-20  Martin Baulig  <martin@gnome.org>
4057
4058         * class.cs (TypeContainer.FindMembers): Added static check for events.
4059
4060         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
4061
4062         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
4063         use Type.GetEvents(), not Type.FindMembers().
4064
4065 2002-08-20  Martin Baulig  <martin@gnome.org>
4066
4067         * decl.cs (MemberCache): Added a special method cache which will
4068         be used for method-only searched.  This ensures that a method
4069         search will return a MethodInfo with the correct ReflectedType for
4070         inherited methods.      
4071
4072 2002-08-20  Martin Baulig  <martin@gnome.org>
4073
4074         * decl.cs (DeclSpace.FindMembers): Made this public.
4075
4076 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4077
4078         * delegate.cs: fixed build on windows.
4079         [FIXME:  Filed as bug #29150: MCS must report these errors.]
4080
4081 2002-08-19  Ravi Pratap  <ravi@ximian.com>
4082
4083         * ecore.cs (StandardConversionExists): Return a false
4084         if we are trying to convert the void type to anything else
4085         since that is not allowed.
4086
4087         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
4088         we flag error 70 in the event an event is trying to be accessed
4089         directly from outside the declaring type.
4090
4091 2002-08-20  Martin Baulig  <martin@gnome.org>
4092
4093         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
4094         MemberCache from typemanager.cs to decl.cs.
4095
4096 2002-08-19  Martin Baulig  <martin@gnome.org>
4097
4098         * class.cs (TypeContainer): Implement IMemberContainer.
4099         (TypeContainer.DefineMembers): Create the MemberCache.
4100         (TypeContainer.FindMembers): Do better BindingFlags checking; only
4101         return public members if BindingFlags.Public was given, check
4102         whether members are static.
4103
4104 2002-08-16  Martin Baulig  <martin@gnome.org>
4105
4106         * decl.cs (DeclSpace.Define): Splitted this in Define and
4107         DefineMembers.  DefineMembers is called first and initializes the
4108         MemberCache.
4109
4110         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
4111         DefineMembers() on all our DeclSpaces.
4112
4113         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
4114         but call DefineMembers() on all nested interfaces.  We call their
4115         Define() in our new Define() function.
4116
4117         * interface.cs (Interface): Implement IMemberContainer.
4118         (Interface.Define): Moved all code except the attribute stuf to
4119         DefineMembers().
4120         (Interface.DefineMembers): Initialize the member cache.
4121
4122         * typemanager.cs (IMemberFinder): Removed this interface, we don't
4123         need this anymore since we can use MemberCache.FindMembers directly.
4124
4125 2002-08-19  Martin Baulig  <martin@gnome.org>
4126
4127         * typemanager.cs (MemberCache): When creating the cache for an
4128         interface type, add all inherited members.
4129         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4130         to `out bool used_cache' and documented it.
4131         (TypeManager.MemberLookup): If we already used the cache in the first
4132         iteration, we don't need to do the interfaces check.
4133
4134 2002-08-19  Martin Baulig  <martin@gnome.org>
4135
4136         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
4137         here from IMemberFinder and don't implement this interface anymore.
4138         (DeclSpace.MemberCache): Moved here from IMemberFinder.
4139
4140         * typemanager.cs (IMemberFinder): This interface is now only used by
4141         classes which actually support the member cache.
4142         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4143         since we only put DeclSpaces into this Hashtable.
4144         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4145         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4146
4147 2002-08-16  Martin Baulig  <martin@gnome.org>
4148
4149         * typemanager.cs (ICachingMemberFinder): Removed.
4150         (IMemberFinder.MemberCache): New property.
4151         (TypeManager.FindMembers): Merged this with RealFindMembers().
4152         This function will never be called from TypeManager.MemberLookup()
4153         so we can't use the cache here, just the IMemberFinder.
4154         (TypeManager.MemberLookup_FindMembers): Check whether the
4155         IMemberFinder has a MemberCache and call the cache's FindMembers
4156         function.
4157         (MemberCache): Rewrote larger parts of this yet another time and
4158         cleaned it up a bit.
4159
4160 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
4161
4162         * driver.cs (LoadArgs): Support quoting.
4163
4164         (Usage): Show the CSC-like command line arguments.
4165
4166         Improved a few error messages.
4167
4168 2002-08-15  Martin Baulig  <martin@gnome.org>
4169
4170         * typemanager.cs (IMemberContainer.Type): New property.
4171         (IMemberContainer.IsInterface): New property.
4172
4173         The following changes are conditional to BROKEN_RUNTIME, which is
4174         defined at the top of the file.
4175
4176         * typemanager.cs (MemberCache.MemberCache): Don't add the base
4177         class'es members, but add all members from TypeHandle.ObjectType
4178         if we're an interface.
4179         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4180         is the current type.
4181         (MemberCache.CacheEntry.Container): Removed this field.
4182         (TypeHandle.GetMembers): Include inherited members.
4183
4184 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4185
4186         * typemanager.cs: fixed compilation and added a comment on a field that
4187         is never used.
4188
4189 2002-08-15  Martin Baulig  <martin@gnome.org>
4190
4191         * class.cs (ConstructorInitializer.Resolve): In the
4192         Expression.MemberLookup call, use the queried_type as
4193         invocation_type.
4194
4195         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4196         declared' attribute, it's always true.
4197         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4198         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4199         temporary wrapper for FindMembers which tells MemberLookup whether
4200         members from the base classes are included in the return value.
4201         This will go away soon.
4202         (TypeManager.MemberLookup): Use this temporary hack here; once the
4203         new MemberCache is completed, we don't need to do the DeclaredOnly
4204         looping here anymore since the MemberCache will take care of this.
4205         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4206         (MemberCache): When creating the MemberCache for a class, get
4207         members from the current class and all its base classes.
4208         (MemberCache.CacheEntry.Container): New field.  This is a
4209         temporary hack until the Mono runtime is fixed to distinguish
4210         between ReflectedType and DeclaringType.  It allows us to use MCS
4211         with both the MS runtime and the unfixed Mono runtime without
4212         problems and without accecting performance.
4213         (MemberCache.SearchMembers): The DeclaredOnly looping from
4214         TypeManager.MemberLookup is now done here.      
4215
4216 2002-08-14  Martin Baulig  <martin@gnome.org>
4217
4218         * statement.cs (MyStructInfo.MyStructInfo): Don't call
4219         Type.GetFields on dynamic types but get the fields from the
4220         corresponding TypeContainer.
4221         (MyStructInfo.GetStructInfo): Added check for enum types.
4222
4223         * typemanager.cs (MemberList.IsSynchronized): Implemented.
4224         (MemberList.SyncRoot): Implemented.
4225         (TypeManager.FilterWithClosure): No need to check permissions if
4226         closure_start_type == closure_invocation_type, don't crash if
4227         closure_invocation_type is null.
4228
4229 2002-08-13  Martin Baulig  <martin@gnome.org>
4230
4231         Rewrote TypeContainer.FindMembers to use a member cache.  This
4232         gives us a speed increase of about 35% for the self-hosting MCS
4233         build and of about 15-20% for the class libs (both on GNU/Linux).
4234
4235         * report.cs (Timer): New class to get enhanced profiling.  This
4236         whole class is "TIMER" conditional since it remarkably slows down
4237         compilation speed.
4238
4239         * class.cs (MemberList): New class.  This is an IList wrapper
4240         which we're now using instead of passing MemberInfo[]'s around to
4241         avoid copying this array unnecessarily.
4242         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4243         (ICachingMemberFinder, IMemberContainer): New interface.
4244         (TypeManager.FilterWithClosure): If `criteria' is null, the name
4245         has already been checked, otherwise use it for the name comparision.
4246         (TypeManager.FindMembers): Renamed to RealMemberFinder and
4247         provided wrapper which tries to use ICachingMemberFinder.FindMembers
4248         if possible.  Returns a MemberList, not a MemberInfo [].
4249         (TypeHandle): New class, implements IMemberContainer.  We create
4250         one instance of this class per type, it contains a MemberCache
4251         which is used to do the member lookups.
4252         (MemberCache): New class.  Each instance of this class contains
4253         all members of a type and a name-based hash table.
4254         (MemberCache.FindMembers): This is our new member lookup
4255         function.  First, it looks up all members of the requested name in
4256         the hash table.  Then, it walks this list and sorts out all
4257         applicable members and returns them.
4258
4259 2002-08-13  Martin Baulig  <martin@gnome.org>
4260
4261         In addition to a nice code cleanup, this gives us a performance
4262         increase of about 1.4% on GNU/Linux - not much, but it's already
4263         half a second for the self-hosting MCS compilation.
4264
4265         * typemanager.cs (IMemberFinder): New interface.  It is used by
4266         TypeManager.FindMembers to call FindMembers on a TypeContainer,
4267         Enum, Delegate or Interface.
4268         (TypeManager.finder_to_member_finder): New PtrHashtable.
4269         (TypeManager.finder_to_container): Removed.
4270         (TypeManager.finder_to_delegate): Removed.
4271         (TypeManager.finder_to_interface): Removed.
4272         (TypeManager.finder_to_enum): Removed.
4273
4274         * interface.cs (Interface): Implement IMemberFinder.
4275
4276         * delegate.cs (Delegate): Implement IMemberFinder.
4277
4278         * enum.cs (Enum): Implement IMemberFinder.
4279
4280         * class.cs (TypeContainer): Implement IMemberFinder.
4281
4282 2002-08-12  Martin Baulig  <martin@gnome.org>
4283
4284         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4285
4286 2002-08-12  Martin Baulig  <martin@gnome.org>
4287
4288         * ecore.cs (ITypeExpression): New interface for expressions which
4289         resolve to a type.
4290         (TypeExpression): Renamed to TypeLookupExpression.
4291         (Expression.DoResolve): If we're doing a types-only lookup, the
4292         expression must implement the ITypeExpression interface and we
4293         call DoResolveType() on it.
4294         (SimpleName): Implement the new ITypeExpression interface.
4295         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4296         hack, the situation that we're only looking up types can't happen
4297         anymore when this method is called.  Moved the type lookup code to
4298         DoResolveType() and call it.
4299         (SimpleName.DoResolveType): This ITypeExpression interface method
4300         is now doing the types-only lookup.
4301         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4302         (ResolveFlags): Added MaskExprClass.
4303
4304         * expression.cs (MemberAccess): Implement the ITypeExpression
4305         interface.
4306         (MemberAccess.DoResolve): Added support for a types-only lookup
4307         when we're called via ITypeExpression.DoResolveType().
4308         (ComposedCast): Implement the ITypeExpression interface.
4309
4310         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
4311         Expression.Resolve() with ResolveFlags.Type instead.
4312
4313 2002-08-12  Martin Baulig  <martin@gnome.org>
4314
4315         * interface.cs (Interface.Define): Apply attributes.
4316
4317         * attribute.cs (Attribute.ApplyAttributes): Added support for
4318         interface attributes.
4319
4320 2002-08-11  Martin Baulig  <martin@gnome.org>
4321
4322         * statement.cs (Block.Emit): Only check the "this" variable if we
4323         do not always throw an exception.
4324
4325         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4326         whether the property has a set accessor.
4327
4328 2002-08-11  Martin Baulig  <martin@gnome.org>
4329
4330         Added control flow analysis support for structs.
4331
4332         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4333         with control flow analysis turned off.
4334         (IVariable): New interface.
4335         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4336         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4337         (FieldExpr.DoResolve): Resolve the instance expression with flow
4338         analysis turned off and do the definite assignment check after the
4339         resolving when we know what the expression will resolve to.
4340
4341         * expression.cs (LocalVariableReference, ParameterReference):
4342         Implement the new IVariable interface, only call the flow analysis
4343         code if ec.DoFlowAnalysis is true.
4344         (This): Added constructor which takes a Block argument.  Implement
4345         the new IVariable interface.
4346         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4347         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4348         This does the definite assignment checks for struct members.
4349
4350         * class.cs (Constructor.Emit): If this is a non-static `struct'
4351         constructor which doesn't have any initializer, call
4352         Block.AddThisVariable() to tell the flow analysis code that all
4353         struct elements must be initialized before control returns from
4354         the constructor.
4355
4356         * statement.cs (MyStructInfo): New public class.
4357         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4358         argument to this indexer.  If non-zero, check an individual struct
4359         member, not the whole struct.
4360         (FlowBranching.CheckOutParameters): Check struct members.
4361         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4362         overloaded versions of these methods which take an additional
4363         `int field_idx' argument to check struct members.
4364         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4365         overloaded versions of these methods which take an additional
4366         `string field_name' argument to check struct member.s
4367         (VariableInfo): Implement the IVariable interface.
4368         (VariableInfo.StructInfo): New public property.  Returns the
4369         MyStructInfo instance of the variable if it's a struct or null.
4370         (Block.AddThisVariable): New public method.  This is called from
4371         Constructor.Emit() for non-static `struct' constructor which do
4372         not have any initializer.  It creates a special variable for the
4373         "this" instance variable which will be checked by the flow
4374         analysis code to ensure that all of the struct's fields are
4375         initialized before control returns from the constructor.
4376         (UsageVector): Added support for struct members.  If a
4377         variable/parameter is a struct with N members, we reserve a slot
4378         in the usage vector for each member.  A struct is considered fully
4379         initialized if either the struct itself (slot 0) or all its
4380         members are initialized.
4381
4382 2002-08-08  Martin Baulig  <martin@gnome.org>
4383
4384         * driver.cs (Driver.MainDriver): Only report an error CS5001
4385         if there were no compilation errors.
4386
4387         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4388         `UnsafeContext' property to determine whether the parent is in
4389         unsafe context rather than checking the parent's ModFlags:
4390         classes nested in an unsafe class are unsafe as well.
4391
4392 2002-08-08  Martin Baulig  <martin@gnome.org>
4393
4394         * statement.cs (UsageVector.MergeChildren): Distinguish between
4395         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4396         we return.  Added test17() and test18() to test-154.cs.
4397
4398 2002-08-08  Martin Baulig  <martin@gnome.org>
4399
4400         * typemanager.cs (TypeManager.FilterWithClosure): If we have
4401         Family access, make sure the invoking type isn't a subclass of the
4402         queried type (that'd be a CS1540).
4403
4404         * ecore.cs (Expression.MemberLookup): Added overloaded version of
4405         this method which takes an additional `Type invocation_type'.
4406
4407         * expression.cs (BaseAccess.DoResolve): Use the base type as
4408         invocation and query type.
4409         (MemberAccess.DoResolve): If the lookup failed and we're about to
4410         report a CS0122, try a lookup with the ec.ContainerType - if this
4411         succeeds, we must report a CS1540.
4412
4413 2002-08-08  Martin Baulig  <martin@gnome.org>
4414
4415         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4416         (MethodGroupExpr): Implement the IMemberExpr interface.
4417
4418         * expression (MemberAccess.ResolveMemberAccess): No need to have
4419         any special code for MethodGroupExprs anymore, they're now
4420         IMemberExprs.   
4421
4422 2002-08-08  Martin Baulig  <martin@gnome.org>
4423
4424         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4425         Family, FamANDAssem and FamORAssem permissions.
4426         (TypeManager.IsSubclassOrNestedChildOf): New public method.
4427
4428 2002-08-08  Martin Baulig  <martin@gnome.org>
4429
4430         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4431         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4432         or loop block.
4433
4434 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4435
4436         * driver.cs: implemented /resource option to embed managed resources.
4437
4438 2002-08-07  Martin Baulig  <martin@gnome.org>
4439
4440         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4441         (FieldBase.HasFieldInitializer): New public property.
4442         (FieldBase.GetInitializerExpression): New public method.  Resolves and
4443         returns the field initializer and makes sure it is only resolved once.
4444         (TypeContainer.EmitFieldInitializers): Call
4445         FieldBase.GetInitializerExpression to get the initializer, this ensures
4446         that it isn't resolved multiple times.
4447
4448         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
4449         the resolving process (SimpleName/MemberLookup) that we're currently
4450         emitting a field initializer (which must not access any instance members,
4451         this is an error CS0236).
4452
4453         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4454         argument, if the `IsFieldInitializer' flag is set, we must report and
4455         error CS0236 and not an error CS0120.   
4456
4457 2002-08-07  Martin Baulig  <martin@gnome.org>
4458
4459         * ecore.cs (IMemberExpr): New public interface.
4460         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4461         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4462         if the expression is an IMemberExpr.
4463
4464         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4465         to be null, implicitly default to `this' if we're non-static in
4466         this case.  Simplified the code a lot by using the new IMemberExpr
4467         interface.  Also fixed bug #28176 here.
4468
4469 2002-08-06  Martin Baulig  <martin@gnome.org>
4470
4471         * cs-parser.jay (SimpleLookup): Removed.  We need to create
4472         ParameterReferences during semantic analysis so that we can do a
4473         type-only search when resolving Cast, TypeOf and SizeOf.
4474         (block): Pass the `current_local_parameters' to the Block's
4475         constructor.
4476
4477         * class.cs (ConstructorInitializer): Added `Parameters parameters'
4478         argument to the constructor.
4479         (ConstructorInitializer.Resolve): Create a temporary implicit
4480         block with the parameters.
4481
4482         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4483         references here if we aren't doing a type-only search.
4484
4485         * statement.cs (Block): Added constructor which takes a
4486         `Parameters parameters' argument.
4487         (Block.Parameters): New public property.
4488
4489         * support.cs (InternalParameters.Parameters): Renamed `parameters'
4490         to `Parameters' and made it public readonly.
4491
4492 2002-08-06  Martin Baulig  <martin@gnome.org>
4493
4494         * ecore.cs (Expression.Warning): Made this public as well.
4495
4496         * report.cs (Report.Debug): Print the contents of collections.
4497
4498 2002-08-06  Martin Baulig  <martin@gnome.org>
4499
4500         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
4501         used to tell Resolve() which kinds of expressions it may return.
4502         (Expression.Resolve): Added overloaded version of this method which
4503         takes a `ResolveFlags flags' argument.  This can be used to tell
4504         Resolve() which kinds of expressions it may return.  Reports a
4505         CS0118 on error.
4506         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4507         ResolveFlags.SimpleName.
4508         (Expression.Error118): Added overloaded version of this method which
4509         takes a `ResolveFlags flags' argument.  It uses the flags to determine
4510         which kinds of expressions are allowed.
4511
4512         * expression.cs (Argument.ResolveMethodGroup): New public method.
4513         Resolves an argument, but allows a MethodGroup to be returned.
4514         This is used when invoking a delegate.
4515
4516         * TODO: Updated a bit.
4517
4518 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4519
4520         Fixed compilation with csc.
4521
4522         * ecore.cs: Expression.Error made public. Is this correct? Should
4523         Warning be made public too?
4524
4525         * expression.cs: use ea.Location instead of ea.loc.
4526         [FIXME:  Filed as bug #28607: MCS must report these errors.]
4527
4528 2002-08-06  Martin Baulig  <martin@gnome.org>
4529
4530         * ecore.cs (Expression.loc): Moved the location here instead of
4531         duplicating it in all derived classes.
4532         (Expression.Location): New public property.
4533         (Expression.Error, Expression.Warning): Made them non-static and
4534         removed the location argument.
4535         (Expression.Warning): Added overloaded version which takes an
4536         `int level' argument.
4537         (Expression.Error118): Make this non-static and removed the
4538         expression and location arguments.
4539         (TypeExpr): Added location argument to the constructor.
4540
4541         * expression.cs (StaticCallExpr): Added location argument to
4542         the constructor.
4543         (Indirection, PointerArithmetic): Likewise.
4544         (CheckedExpr, UnCheckedExpr): Likewise.
4545         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4546         (StringPtr): Likewise.
4547
4548
4549 2002-08-05  Martin Baulig  <martin@gnome.org>
4550
4551         * expression.cs (BaseAccess.DoResolve): Actually report errors.
4552
4553         * assign.cs (Assign.DoResolve): Check whether the source
4554         expression is a value or variable.
4555
4556         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4557         while resolving the corresponding blocks.
4558
4559         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4560         an error, don't silently return null.
4561
4562         * statement.cs (Block.AddVariable): Do the error reporting here
4563         and distinguish between CS0128 and CS0136.
4564         (Block.DoResolve): Report all unused labels (warning CS0164).
4565         (LabeledStatement): Pass the location to the constructor.
4566         (LabeledStatement.HasBeenReferenced): New property.
4567         (LabeledStatement.Resolve): Set it to true here.
4568
4569         * statement.cs (Return.Emit): Return success even after reporting
4570         a type mismatch error (CS0126 or CS0127), this is what csc does and
4571         it avoids confusing the users with any consecutive errors.
4572
4573 2002-08-05  Martin Baulig  <martin@gnome.org>
4574
4575         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4576
4577         * const.cs (Const.LookupConstantValue): Catch circular definitions.
4578
4579         * expression.cs (MemberAccess.DoResolve): Silently return if an
4580         error has already been reported.
4581
4582         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4583         error has already been reported.
4584
4585 2002-08-05  Martin Baulig  <martin@gnome.org>
4586
4587         * statement.cs (UsageVector): Only initialize the `parameters'
4588         vector if we actually have any "out" parameters.
4589
4590 2002-08-05  Martin Baulig  <martin@gnome.org>
4591
4592         * expression.cs (Binary.ResolveOperator): When combining delegates,
4593         they must have the same type.
4594
4595 2002-08-05  Martin Baulig  <martin@gnome.org>
4596
4597         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4598         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4599         work with the ms runtime and we also don't need it: if we're a
4600         PropertyBuilder and not in the `indexer_arguments' hash, then we
4601         are a property and not an indexer.
4602
4603         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4604         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4605         since the latter one doesn't work with the ms runtime.
4606
4607 2002-08-03  Martin Baulig  <martin@gnome.org>
4608
4609         Fixed bugs #27998 and #22735.
4610
4611         * class.cs (Method.IsOperator): New public field.
4612         (Method.CheckBase): Report CS0111 if there's already a method
4613         with the same parameters in the current class.  Report CS0508 when
4614         attempting to change the return type of an inherited method.
4615         (MethodData.Emit): Report CS0179 if a method doesn't have a body
4616         and it's not marked abstract or extern.
4617         (PropertyBase): New abstract base class for Property and Indexer.
4618         (PropertyBase.CheckBase): Moved here from Property and made it work
4619         for indexers.
4620         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4621         the same so we can reuse it there.
4622         (Property, Indexer): Derive from PropertyBase.
4623         (MethodSignature.inheritable_property_signature_filter): New delegate
4624         to find properties and indexers.
4625
4626         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4627         argument and improved error reporting.
4628
4629         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4630         EmptyReadOnlyParameters and made it a property.
4631
4632         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4633         version of this method which takes a `PropertyInfo indexer'.
4634         (TypeManager.RegisterIndexer): New method.
4635
4636         * class.cs: Added myself as author of this file :-)
4637
4638 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4639
4640         * class.cs: fixed compilation on windoze.
4641
4642 2002-08-03  Martin Baulig  <martin@gnome.org>
4643
4644         * interface.cs (Interface.GetInterfaceBases): Check whether all
4645         base interfaces are at least as accessible than the current one.
4646
4647         * class.cs (TypeContainer.GetClassBases): Check whether base types
4648         are at least as accessible than the current type.
4649         (TypeContainer.AsAccessible): Implemented and made non-static.
4650         (MemberBase.CheckParameters): Report errors if the accessibility
4651         checks fail.
4652
4653         * delegate.cs (Delegate.Delegate): The default visibility is
4654         internal for top-level types and private for nested types.
4655         (Delegate.Define): Report errors if the accessibility checks fail.
4656
4657         * enum.cs (Enum.Enum): The default visibility is internal for
4658         top-level types and private for nested types.
4659         (Enum.DefineType): Compute the correct visibility.
4660
4661         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4662         function which takes a `bool is_toplevel' instead of a TypeContainer.
4663
4664         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4665         builtin type.
4666
4667 2002-08-02  Martin Baulig  <martin@gnome.org>
4668
4669         * expression.cs (LocalVariableReferenc): Added constructor which
4670         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4671         (LocalVariableReference.IsReadOnly): New property.
4672         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4673         variable is readonly, use our own readonly flag to do this; you can
4674         use the new constructor to get a writable reference to a read-only
4675         variable.
4676
4677         * cs-parser.jay (foreach_statement, using_statement): Get a writable
4678         reference to the local variable.
4679
4680 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
4681
4682         * rootcontext.cs (ResolveCore): Also include System.Exception
4683
4684         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4685         we reach an EmptyStatement.
4686
4687         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4688         is also fine.
4689
4690         * expression.cs (Binary.ResolveOperator): Check error result in
4691         two places.
4692
4693         use brtrue/brfalse directly and avoid compares to null.
4694
4695 2002-08-02  Martin Baulig  <martin@gnome.org>
4696
4697         * class.cs (TypeContainer.Define): Define all nested interfaces here.
4698         Fixes bug #28407, added test-155.cs.
4699
4700 2002-08-01  Martin Baulig  <martin@gnome.org>
4701
4702         * class.cs (Event.EmitDefaultMethod): Make this work with static
4703         events.  Fixes #28311, added verify-3.cs.
4704
4705 2002-08-01  Martin Baulig  <martin@gnome.org>
4706
4707         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4708         `is_disposable' fields.
4709         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4710         `hm.is_disposable' if we're using the collection pattern.
4711         (Foreach.EmitCollectionForeach): Use the correct type for the
4712         enumerator's local variable, only emit the try/finally block if
4713         necessary (fixes #27713).
4714
4715 2002-08-01  Martin Baulig  <martin@gnome.org>
4716
4717         * ecore.cs (Expression.report118): Renamed to Error118 and made
4718         it public static.
4719
4720         * statement.cs (Throw.Resolve): Check whether the expression is of
4721         the correct type (CS0118) and whether the type derives from
4722         System.Exception (CS0155).
4723         (Catch.Resolve): New method.  Do the type lookup here and check
4724         whether it derives from System.Exception (CS0155).
4725         (Catch.CatchType, Catch.IsGeneral): New public properties.
4726
4727         * typemanager.cs (TypeManager.exception_type): Added.
4728
4729 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
4730
4731         * driver.cs: Updated About function.
4732
4733 2002-07-31  Martin Baulig  <martin@gnome.org>
4734
4735         Implemented Control Flow Analysis.
4736
4737         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4738         (EmitContext.CurrentBranching): Added.
4739         (EmitContext.StartFlowBranching): Added.
4740         (EmitContext.EndFlowBranching): Added.
4741         (EmitContext.KillFlowBranching): Added.
4742         (EmitContext.IsVariableAssigned): Added.
4743         (EmitContext.SetVariableAssigned): Added.
4744         (EmitContext.IsParameterAssigned): Added.
4745         (EmitContext.SetParameterAssigned): Added.
4746         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4747         Added control flow analysis stuff here.
4748
4749         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4750         resolve the expression as lvalue.
4751         (LocalVariableReference.DoResolve): Check whether the variable has
4752         already been assigned.
4753         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4754         the parameter as assigned here.
4755         (ParameterReference.DoResolve): Check whether the parameter has already
4756         been assigned.
4757         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4758         expression as lvalue.
4759
4760         * statement.cs (FlowBranching): New class for the flow analysis code.
4761         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4762         (LabeledStatement.IsDefined): New public property.
4763         (LabeledStatement.AddUsageVector): New public method to tell flow
4764         analyis that the label may be reached via a forward jump.
4765         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4766         flow analysis.
4767         (VariableInfo.Number): New public field.  This is used by flow analysis
4768         to number all locals of a block.
4769         (Block.CountVariables): New public property.  This is the number of
4770         local variables in this block (including the locals from all parent
4771         blocks).
4772         (Block.EmitMeta): Number all the variables.
4773
4774         * statement.cs: Added flow analysis support to all classes.
4775
4776 2002-07-31  Martin Baulig  <martin@gnome.org>
4777
4778         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4779         To get debugging messages, compile mcs with /define:MCS_DEBUG and
4780         then use this argument.
4781
4782         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4783
4784         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4785         use this to specify /define options.
4786
4787 2002-07-29  Martin Baulig  <martin@gnome.org>
4788
4789         * statement.cs (Fixed): Moved all code that does variable lookups
4790         and resolvings from Emit to Resolve.
4791
4792         * statement.cs (For): Moved all code that does variable lookups
4793         and resolvings from Emit to Resolve.
4794
4795         * statement.cs (Using): Moved all code that does variable lookups
4796         and resolvings from Emit to Resolve.
4797
4798 2002-07-29  Martin Baulig  <martin@gnome.org>
4799
4800         * attribute.cs (Attribute.Resolve): Explicitly catch a
4801         System.NullReferenceException when creating the
4802         CustromAttributeBuilder and report a different warning message.
4803
4804 2002-07-29  Martin Baulig  <martin@gnome.org>
4805
4806         * support.cs (ParameterData.ParameterName): Added method to
4807         get the name of a parameter.
4808
4809         * typemanager.cs (TypeManager.IsValueType): New public method.
4810
4811 2002-07-29  Martin Baulig  <martin@gnome.org>
4812
4813         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
4814         is a flag which specifies that it's either ref or out.
4815         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4816         the out parameter to `out Parameter.Modifier mod', also set the
4817         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4818
4819         * support.cs (InternalParameters.ParameterModifier): Distinguish
4820         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4821         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4822
4823         * expression.cs (Argument.GetParameterModifier): Distinguish
4824         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4825         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4826
4827 2002-07-29  Martin Baulig  <martin@gnome.org>
4828
4829         * expression.cs (ParameterReference.ParameterReference): Added
4830         `Location loc' argument to the constructor.
4831
4832         * cs-parser.jay: Pass location to ParameterReference.
4833
4834 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
4835
4836         * statement.cs (Try): Initialize the location.
4837
4838         * cs-parser.jay: pass location to Try.
4839
4840         * expression.cs (Unary.Reduce): Change the prototype to return
4841         whether a constant fold could be performed or not.  The result is
4842         returned in an out parameters.  In the case of Indirection and
4843         AddressOf, we want to perform the full tests.
4844
4845 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
4846
4847         * statement.cs (Statement.Emit): Flag dead code.
4848
4849 2002-07-27  Andrew Birkett  <andy@nobugs.org>
4850
4851         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4852
4853 2002-07-27  Martin Baulig  <martin@gnome.org>
4854
4855         * class.cs (MethodData.Define): Put back call to
4856         TypeManager.AddMethod(), accidentally commented this out.
4857
4858         * report.cs (Debug): New public method to print debugging information,
4859         this is `[Conditional ("DEBUG")]'.
4860
4861 2002-07-26  Martin Baulig  <martin@gnome.org>
4862
4863         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4864         (switch_statement): Push the current_block to the switch_stack and
4865         pop it again when we're done with the switch.
4866         (switch_section): The new block is a child of the current_block.
4867         Fixes bug #24007, added test-152.cs.
4868
4869 2002-07-27  Martin Baulig  <martin@gnome.org>
4870
4871         * expression.cs (Invocation.EmitArguments): When calling a varargs
4872         function with only its fixed arguments, we need to pass an empty
4873         array.
4874
4875 2002-07-27  Martin Baulig  <martin@gnome.org>
4876
4877         Mono 0.13 has been released.
4878
4879 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
4880
4881         * driver.cs: Rename --resource to --linkres, because that is what
4882         we do currently, we dont support --resource yet.
4883
4884         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4885
4886 2002-07-25  Martin Baulig  <martin@gnome.org>
4887
4888         * class.cs (MethodData): New public class.  This is a `method builder'
4889         class for a method or one accessor of a Property/Indexer/Event.
4890         (MethodData.GetMethodFlags): Moved here from MemberBase.
4891         (MethodData.ApplyAttributes): Likewise.
4892         (MethodData.ApplyObsoleteAttribute): Likewise.
4893         (MethodData.ApplyConditionalAttribute): Likewise.
4894         (MethodData.ApplyDllImportAttribute): Likewise.
4895         (MethodData.CheckAbstractAndExternal): Likewise.
4896         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4897         (MethodData.Emit): Formerly known as Method.Emit().
4898         (MemberBase): Moved everything which was specific to a single
4899         accessor/method to MethodData.
4900         (Method): Create a new MethodData and call Define() and Emit() on it.
4901         (Property, Indexer, Event): Create a new MethodData objects for each
4902         accessor and call Define() and Emit() on them.
4903
4904 2002-07-25  Martin Baulig  <martin@gnome.org>
4905
4906         Made MethodCore derive from MemberBase to reuse the code from there.
4907         MemberBase now also checks for attributes.
4908
4909         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4910         (MemberBase.GetMethodFlags): Moved here from class Method and marked
4911         as virtual.
4912         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4913         `CallingConventions cc' and `Attributes opt_attrs' arguments.
4914         (MemberBase.ApplyAttributes): New virtual method; applies the
4915         attributes to a method or accessor.
4916         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4917         (MemberBase.ApplyConditionalAttribute): Likewise.
4918         (MemberBase.ApplyDllImportAttribute): Likewise.
4919         (MemberBase.CheckAbstractAndExternal): Likewise.
4920         (MethodCore.ParameterTypes): This is now a property instead of a
4921         method, it's initialized from DoDefineParameters().
4922         (MethodCore.ParameterInfo): Removed the set accessor.
4923         (MethodCore.DoDefineParameters): New protected virtual method to
4924         initialize ParameterTypes and ParameterInfo.
4925         (Method.GetReturnType): We can now simply return the MemberType.
4926         (Method.GetMethodFlags): Override the MemberBase version and add
4927         the conditional flags.
4928         (Method.CheckBase): Moved some code from Define() here, call
4929         DoDefineParameters() here.
4930         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4931         here to avoid some larger code duplication.
4932         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4933         ensure that abstract and external accessors don't declare a body.
4934
4935         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4936         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4937         lookup in the attribute's parent classes, so we need to abort as soon
4938         as we found the first match.
4939         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4940         the attribute has no arguments.
4941
4942         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4943         of a Method.
4944
4945 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4946
4947         * cs-parser.jay: reverted previous patch.
4948
4949 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4950
4951         * cs-parser.jay: fixed bug #22119.
4952
4953 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4954
4955         * attribute.cs: fixed compilation. The error was:
4956         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
4957         be assigned to before control leaves the current method."
4958         [FIXME:  Filed as bug #28186: MCS must report this error.]
4959
4960 2002-07-25  Martin Baulig  <martin@gnome.org>
4961
4962         * attribute.cs (Attribute.Conditional_GetConditionName): New static
4963         method to pull the condition name ouf of a Conditional attribute.
4964         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4965         the obsolete message and error flag out of an Obsolete attribute.
4966
4967         * class.cs (Method.GetMethodFlags): New public method to get the
4968         TypeManager.MethodFlags for this method.
4969         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4970         private methods.
4971         (Method.Define): Get and apply the Obsolete and Conditional attributes;
4972         if we're overriding a virtual function, set the new private variable
4973         `parent_method'; call the new TypeManager.AddMethod().
4974
4975         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
4976         the MethodBuilder and the Method in a PtrHashtable.
4977         (TypeManager.builder_to_method): Added for this purpose.
4978         (TypeManager.MethodFlags): Added IsObsoleteError.
4979         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
4980         Obsolete and Conditional arguments in MethodBuilders.  If we discover
4981         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4982         the message from the attribute.
4983
4984 2002-07-24  Martin Baulig  <martin@gnome.org>
4985
4986         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4987         preprocessor directives, ensure that the argument to #define/#undef is
4988         exactly one identifier and that it's actually an identifier.
4989
4990         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4991         did not work ....
4992
4993 2002-07-24  Martin Baulig  <martin@gnome.org>
4994
4995         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4996         initialize it to TypeManager.object_type in the constructor.
4997         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4998         of the `hm.get_current' method if we're using the collection pattern.
4999         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
5000         for the explicit conversion to make it work when we're using the collection
5001         pattern and the `Current' property has a different return type than `object'.
5002         Fixes #27713.
5003
5004 2002-07-24  Martin Baulig  <martin@gnome.org>
5005
5006         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
5007         does not match, but don't report any errors.  This method is called in
5008         order for all methods in a MethodGroupExpr until a matching method is
5009         found, so we don't want to bail out if the first method doesn't match.
5010         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
5011         matches, report the 123.  Fixes #28070.
5012
5013 2002-07-24  Martin Baulig  <martin@gnome.org>
5014
5015         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
5016         TypeManager.TypeToCoreType() to the top of the method so the
5017         following equality checks will work.  Fixes #28107.
5018
5019 2002-07-24  Martin Baulig  <martin@gnome.org>
5020
5021         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
5022         operand is of type uint, and the other operand is of type sbyte,
5023         short or int, the operands are converted to type long." -
5024         Actually do what this comment already told us.  Fixes bug #28106,
5025         added test-150.cs.
5026
5027 2002-07-24  Martin Baulig  <martin@gnome.org>
5028
5029         * class.cs (MethodBase): New abstract class.  This is now a base
5030         class for Property, Indexer and Event to avoid some code duplication
5031         in their Define() and DefineMethods() methods.
5032         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
5033         generic methods for Define() and DefineMethods().
5034         (FieldBase): Derive from MemberBase, not MemberCore.
5035         (Property): Derive from MemberBase, not MemberCore.
5036         (Property.DefineMethod): Moved all the code from this method to the
5037         new MethodBase.DefineAccessor(), just call it with appropriate
5038         argumetnts.
5039         (Property.Define): Call the new Property.DoDefine(), this does some
5040         sanity checks and we don't need to duplicate the code everywhere.
5041         (Event): Derive from MemberBase, not MemberCore.
5042         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
5043         accessors, this will also make them work with interface events.
5044         (Indexer): Derive from MemberBase, not MemberCore.
5045         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
5046         (Indexer.Define): Use the new MethodBase functions.
5047
5048         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
5049         argument to the constructor.
5050         (Interface.FindMembers): Added support for interface events.
5051         (Interface.PopluateEvent): Implemented.
5052
5053         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
5054
5055 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
5056
5057         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
5058         but this is required to check for a method name being the same as
5059         the containing class.  
5060
5061         Handle this now.
5062
5063 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5064
5065         * interface.cs: initialize variable.
5066
5067 2002-07-23  Martin Baulig  <martin@gnome.org>
5068
5069         Implemented the IndexerName attribute in interfaces.
5070
5071         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
5072         name if this is an explicit interface implementation.
5073         (Indexer.InterfaceIndexerName): New public variable.  If we're
5074         implementing an interface indexer, this is the IndexerName in that
5075         interface.  Otherwise, it's the IndexerName.
5076         (Indexer.DefineMethod): If we're implementing interface indexer,
5077         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
5078         and Pending.ImplementIndexer methods.
5079         (Indexer.Define): Also define the PropertyBuilder if we're
5080         implementing an interface indexer and this is neither an explicit
5081         interface implementation nor do the IndexerName match the one in
5082         the interface.
5083
5084         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
5085         If a method is defined here, then we always need to create a proxy
5086         for it.  This is used when implementing interface indexers.
5087         (Pending.IsInterfaceIndexer): New public method.
5088         (Pending.ImplementIndexer): New public method.
5089         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
5090         This is used when implementing interface indexers to define a proxy
5091         if necessary.
5092         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
5093         define a proxy if necessary.
5094
5095         * interface.cs (Interface.IndexerName): New public variable.
5096         (Interface.PopulateIndexer): Set the IndexerName.
5097         (Interface.DefineIndexers): New private method.  Populate all the
5098         indexers and make sure their IndexerNames match.
5099
5100         * typemanager.cs (IndexerPropertyName): Added support for interface
5101         indexers.
5102
5103 2002-07-22  Martin Baulig  <martin@gnome.org>
5104
5105         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
5106         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
5107         ret if HasReturnLabel.
5108         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
5109         variables.
5110
5111         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
5112         and set the ec.LoopBeginTryCatchLevel.
5113         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
5114         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5115         the current ec.TryCatchLevel, the branch goes out of an exception
5116         block.  In this case, we need to use Leave and not Br.
5117
5118 2002-07-22  Martin Baulig  <martin@gnome.org>
5119
5120         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5121         block unless the block does not always return or it is contained in
5122         another try { ... } catch { ... } block.  Fixes bug #26506.
5123         Added verify-1.cs to the test suite.
5124
5125 2002-07-22  Martin Baulig  <martin@gnome.org>
5126
5127         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5128         then we do not always return.  Fixes bug #24985.
5129
5130 2002-07-22  Martin Baulig  <martin@gnome.org>
5131
5132         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5133         lookup on a per-class level; ie. walk up the class hierarchy until we
5134         found at least one applicable method, then choose the best among them.
5135         Fixes bug #24463 and test-29.cs.
5136
5137 2002-07-22  Martin Baulig  <martin@gnome.org>
5138
5139         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5140         return types of the methods.  The return type is not part of the
5141         signature and we must not check it to make the `new' modifier work.
5142         Fixes bug #27999, also added test-147.cs.
5143         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5144
5145         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5146         on the method's return type.
5147
5148 2002-07-21  Martin Baulig  <martin@gnome.org>
5149
5150         * assign.cs: Make this work if the rightmost source is a constant and
5151         we need to do an implicit type conversion.  Also adding a few more tests
5152         to test-38.cs which should have caught this.
5153
5154         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5155         target in the makefile for this.  The makefile.gnu is primarily intended
5156         for end-users who don't want to debug the compiler.
5157
5158 2002-07-21  Martin Baulig  <martin@gnome.org>
5159
5160         * assign.cs: Improved the Assign class so it can now handle embedded
5161         assignments (X = Y = Z = something).  As a side-effect this'll now also
5162         consume less local variables.  test-38.cs now passes with MCS, added
5163         a few new test cases to that test.
5164
5165 2002-07-20  Martin Baulig  <martin@gnome.org>
5166
5167         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5168         instructions.  Fixes bug #27977, also added test-146.cs.
5169
5170 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5171
5172         * cs-tokenizer.cs: fixed getHex ().
5173
5174 2002-07-19  Martin Baulig  <martin@gnome.org>
5175
5176         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5177         not Type.GetType() to lookup the array type.  This is needed when
5178         we're constructing an array of a user-defined type.
5179         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5180         single-dimensional arrays, but also for single-dimensial arrays of
5181         type decimal.
5182
5183 2002-07-19  Martin Baulig  <martin@gnome.org>
5184
5185         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5186         this function is called, it's not allowed to share LocalBuilders
5187         among ILGenerators.
5188
5189 2002-07-19  Martin Baulig  <martin@gnome.org>
5190
5191         * expression.cs (Argument.Resolve): Report an error 118 when trying
5192         to pass a type as argument.
5193
5194 2002-07-18  Martin Baulig  <martin@gnome.org>
5195
5196         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5197         Conv_R_Un for the signed `long' type.
5198
5199 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
5200
5201         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5202         `expr' for the temporary result, as that will fail if we do
5203         multiple resolves on the same expression.
5204
5205 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
5206
5207         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
5208         ec.TypeContainer for looking up aliases. 
5209
5210         * class.cs (TypeContainer): Remove LookupAlias from here.
5211
5212         * decl.cs (DeclSpace); Move here.
5213
5214 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
5215
5216         * class.cs (FindMembers): Only call filter if the constructor
5217         bulider is not null.
5218
5219         Also handle delegates in `NestedTypes' now.  Now we will perform
5220         type lookups using the standard resolution process.  This also
5221         fixes a bug.
5222
5223         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
5224         This uses Expressions (the limited kind that can be parsed by the
5225         tree) instead of strings.
5226
5227         * expression.cs (ComposedCast.ToString): Implement, used to flag
5228         errors since now we have to render expressions.
5229
5230         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
5231         FormArrayType. 
5232
5233         * ecore.cs (SimpleName.ToString): ditto.
5234
5235         * cs-parser.jay: Instead of using strings to assemble types, use
5236         Expressions to assemble the type (using SimpleName, ComposedCast,
5237         MemberAccess).  This should fix the type lookups in declarations,
5238         because we were using a different code path for this.
5239
5240         * statement.cs (Block.Resolve): Continue processing statements
5241         even when there is an error.
5242
5243 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
5244
5245         * class.cs (Event.Define): Also remove the `remove' method from
5246         the list of pending items.
5247
5248         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5249         generate more compact code. 
5250
5251 2002-07-17  Martin Baulig  <martin@gnome.org>
5252
5253         * const.cs (Const.LookupConstantValue): Add support for constant
5254         `unchecked' and `checked' expressions.
5255         Also adding test case test-140.cs for this.
5256
5257 2002-07-17  Martin Baulig  <martin@gnome.org>
5258
5259         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5260         check whether mi.ReturnType implements the IEnumerator interface; the
5261         `==' and the IsAssignableFrom() will fail in this situation.
5262
5263 2002-07-16  Ravi Pratap  <ravi@ximian.com>
5264
5265         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
5266         here too.
5267
5268 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5269
5270         * expression.cs: fixed bug #27811.
5271
5272 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
5273
5274         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5275         Molaro: when we are a ref, the value already contains a pointer
5276         value, do not take the address of it.
5277
5278 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5279         * removed mb-parser.jay and mb-tokenizer.cs
5280
5281 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5282
5283         * expression.cs: check against the building corlib void type.
5284
5285 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5286
5287         * ecore.cs: fix for valuetype static readonly fields: when 
5288         initializing them, we need their address, not the address of a copy.
5289
5290 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5291
5292         * typemanager.cs: register also enum_type in corlib.
5293
5294 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5295
5296         * class.cs: allow calling this (but not base) initializers in structs.
5297
5298 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5299
5300         * ecore.cs: make sure we compare against the building base types
5301         in GetTypeSize ().
5302
5303 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5304
5305         * typemanager.cs: fix TypeToCoreType() to handle void and object
5306         (corlib gets no more typerefs after this change).
5307
5308 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
5309
5310         * expression.cs (ArrayCreation.EmitArrayArguments): use
5311         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5312
5313         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5314         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
5315         array indexes, the runtime actually forbids them.
5316
5317         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5318         for array arguments here.
5319
5320         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5321         instead of the default for ValueTypes.
5322
5323         (New.DoEmit): Use IsValueType instead of
5324         IsSubclassOf (value_type)
5325         (New.DoResolve): ditto.
5326         (Invocation.EmitCall): ditto.
5327
5328         * assign.cs (Assign): ditto.
5329
5330         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5331         Statements *are* currently doing part of their resolution during
5332         Emit.  
5333
5334         Expressions do always resolve during resolve, but statements are
5335         only required to propagate resolution to their children.
5336
5337 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
5338
5339         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5340
5341         (LoadAssembly): Do not add the dll if it is already specified
5342         
5343         (MainDriver): Add the System directory to the link path at the end,
5344         after all the other -L arguments. 
5345
5346         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5347         wrong opcode for loading bytes and bools (ldelem.i1 instead of
5348         ldelem.u1) and using the opposite for sbytes.
5349
5350         This fixes Digger, and we can finally run it.
5351
5352         * driver.cs (UnixParseOption): Move the option parsing here.  
5353         (CSCParseOption): Implement CSC-like parsing of options.
5354
5355         We now support both modes of operation, the old Unix way, and the
5356         new CSC-like way.  This should help those who wanted to make cross
5357         platform makefiles.
5358
5359         The only thing broken is that /r:, /reference: and /lib: are not
5360         implemented, because I want to make those have the same semantics
5361         as the CSC compiler has, and kill once and for all the confussion
5362         around this.   Will be doing this tomorrow.
5363
5364         * statement.cs (Unsafe.Resolve): The state is checked during
5365         resolve, not emit, so we have to set the flags for IsUnsfe here.
5366
5367 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5368
5369         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5370         not catch the Error_ObjectRefRequired in SimpleName (as it is
5371         possible to have a class/instance variable name that later gets
5372         deambiguated), we have to check this here.      
5373
5374 2002-07-10  Ravi Pratap  <ravi@ximian.com>
5375
5376         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5377         make static and put into Expression.
5378
5379         (Event.Define): Register the private field of the event with the 
5380         TypeManager so that GetFieldFromEvent can get at it.
5381
5382         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5383         keep track of the private field associated with an event which
5384         has no accessors.
5385
5386         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5387         private field.
5388
5389         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5390         
5391 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5392
5393         * expression.cs (Binary.EmitBranchable): this routine emits the
5394         Binary expression in a branchable context.  This basically means:
5395         we need to branch somewhere, not just get the value on the stack.
5396
5397         This works together with Statement.EmitBoolExpression.
5398
5399         * statement.cs (Statement.EmitBoolExpression): Use
5400         EmitBranchable. 
5401
5402 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
5403
5404         * statement.cs (For): Reduce the number of jumps in loops.
5405
5406         (For): Implement loop inversion for the For statement.
5407
5408         (Break): We can be breaking out of a Try/Catch controlled section
5409         (foreach might have an implicit try/catch clause), so we need to
5410         use Leave instead of Br.
5411
5412         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5413         now).  If the instace expression supports IMemoryLocation, we use
5414         the AddressOf method from the IMemoryLocation to extract the
5415         address instead of emitting the instance.
5416
5417         This showed up with `This', as we were emitting the instance
5418         always (Emit) instead of the Address of This.  Particularly
5419         interesting when This is a value type, as we dont want the Emit
5420         effect (which was to load the object).
5421         
5422 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
5423
5424         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5425
5426         * statement.cs (Checked): Set the CheckedState during the resolve
5427         process too, as the ConvCast operations track the checked state on
5428         the resolve process, and not emit.
5429
5430         * cs-parser.jay (namespace_member_declaration): Flag that we have
5431         found a declaration when we do.  This is used to flag error 1529
5432
5433         * driver.cs: Report ok when we display the help only.
5434
5435 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
5436
5437         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5438
5439 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
5440
5441         * cs-tokenizer.cs (define): We also have to track locally the
5442         defines.  AllDefines is just used for the Conditional Attribute,
5443         but we also need the local defines for the current source code. 
5444
5445 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
5446
5447         * statement.cs (While, For, Do): These loops can exit through a
5448         Break statement, use this information to tell whether the
5449         statement is the last piece of code.
5450
5451         (Break): Flag that we break.
5452
5453         * codegen.cs (EmitContexts): New `Breaks' state variable.
5454
5455 2002-07-03  Martin Baulig  <martin@gnome.org>
5456
5457         * class.cs (TypeContainer.MethodModifiersValid): Allow override
5458         modifiers in method declarations in structs.  Otherwise, you won't
5459         be able to override things like Object.Equals().
5460
5461 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5462
5463         * class.cs (Method, Property, Indexer): Do not allow the public
5464         modifier to be used in explicit interface implementations.
5465
5466         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5467         override modifiers in method declarations in structs
5468
5469 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
5470
5471         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5472         integer or real overflow, report an error
5473
5474 2002-07-02  Martin Baulig  <martin@gnome.org>
5475
5476         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5477         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5478         to tell the runtime about our newly created System.Object and
5479         System.ValueType types.
5480
5481 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5482
5483         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5484         struct instead of Ldarg/Starg.
5485
5486 2002-07-02  Martin Baulig  <martin@gnome.org>
5487
5488         * expression.cs (Indirection.Indirection): Call
5489         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5490
5491 2002-07-02  Martin Baulig  <martin@gnome.org>
5492
5493         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5494         ValueType, call TypeManager.TypeToCoreType() on it.
5495         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5496         the OpCodes.Newarr argument.
5497
5498 2002-07-02  Martin Baulig  <martin@gnome.org>
5499
5500         * expression.cs (Invocation.EmitCall): When compiling corlib,
5501         replace all calls to the system's System.Array type to calls to
5502         the newly created one.
5503
5504         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5505         System.Array methods.
5506         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5507         from the system's System.Array type which must be replaced.
5508
5509 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5510
5511         * typemanager.cs: load unverifiable_code_ctor so we can build
5512         corlib using the correct type. Avoid using GetTypeCode() with
5513         TypeBuilders.
5514         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5515         TypeManager.object_type to allow building corlib.
5516
5517 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5518
5519         * ecore.cs: handle System.Enum separately in LoadFromPtr().
5520
5521 2002-07-01  Martin Baulig  <martin@gnome.org>
5522
5523         * class.cs: Make the last change actually work, we need to check
5524         whether `ifaces != null' to avoid a crash.
5525
5526 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5527
5528         * class.cs: when we build structs without fields that implement
5529         interfaces, we need to add the interfaces separately, since there is
5530         no API to both set the size and add the interfaces at type creation
5531         time.
5532
5533 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5534
5535         * expression.cs: the dimension arguments to the array constructors
5536         need to be converted if they are a long.
5537
5538 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5539
5540         * class.cs: don't emit ldarg.0 if there is no parent constructor
5541         (fixes showstopper for corlib).
5542
5543 2002-06-29  Martin Baulig  <martin@gnome.org>
5544
5545         MCS now compiles corlib on GNU/Linux :-)
5546
5547         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5548         ie. check for MethodImplOptions.InternalCall.
5549
5550         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5551         and TypeManager.attribute_type are null, so we must explicitly check
5552         whether parent is not null to find out whether it's an attribute type.
5553         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5554         and SetBuilder, not only if the property is neither abstract nor external.
5555         This is necessary to set the MethodImplOptions on the accessor methods.
5556         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5557         SetBuilder, see Property.Emit().
5558
5559         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5560         populate "System.Object", "System.ValueType" and "System.Attribute" since
5561         they've already been populated from BootCorlib_PopulateCoreTypes().
5562
5563 2002-06-29  Martin Baulig  <martin@gnome.org>
5564
5565         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5566         is the NullLiteral, we also need to make sure that target_type is not
5567         an enum type.   
5568
5569 2002-06-29  Martin Baulig  <martin@gnome.org>
5570
5571         * rootcontext.cs (RootContext.ResolveCore): We must initialize
5572         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5573         before calling BootstrapCorlib_ResolveDelegate ().
5574
5575 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5576
5577         * statement.cs: fixed build-breaker. All tests passed ok.
5578
5579 2002-06-27  Martin Baulig  <martin@gnome.org>
5580
5581         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5582         for System.Decimal when compiling corlib.
5583
5584 2002-06-27  Martin Baulig  <martin@gnome.org>
5585
5586         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5587         switch blocks which contain nothing but a default clause.
5588
5589 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
5590
5591        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5592
5593 2002-06-27  Martin Baulig  <martin@gnome.org>
5594
5595         * ecore.cs (PropertyExpr.PropertyExpr): Call
5596         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5597
5598         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5599         is already a TypeBuilder.
5600
5601 2002-06-27  Martin Baulig  <martin@gnome.org>
5602
5603         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5604         `target_type == TypeManager.array_type', not IsAssignableFrom() in
5605         the "from an array-type to System.Array" case.  This makes it work
5606         when compiling corlib.
5607
5608 2002-06-27  Martin Baulig  <martin@gnome.org>
5609
5610         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5611         non-static PropertyExpr, set its InstanceExpression.  This makes
5612         the `ICollection.Count' property work in System/Array.cs.
5613
5614 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
5615
5616         * driver.cs: Made error handling more consistent.  Errors now
5617         tracked by Report class, so many methods which used to return int
5618         now return void.  Main() now prints success/failure and 
5619         errors/warnings message.
5620
5621         Renamed '--probe' compiler argument to '--expect-error'.  Removed
5622         the magic number return values (123 and 124).  Now, if the
5623         expected error occurs, the compiler exits with success (exit value
5624         0).  If the compilation completes without seeing that particular
5625         error, the compiler exits with failure (exit value 1).  The
5626         makefile in mcs/errors has been changed to handle the new behaviour.
5627
5628         * report.cs: Made 'expected error' number a property and renamed
5629         it from 'Probe' to 'ExpectedError'.
5630
5631         * genericparser.cs: Removed error handling support, since it is
5632         now all done by Report class.
5633
5634         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5635         class, so parse() no longer returns an int.
5636
5637         * namespace.cs: Use Report.Error instead of GenericParser.error
5638
5639 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
5640
5641         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5642         TypeContainer.AddOperator): At the front of the list put the
5643         explicit implementations, so they get resolved/defined first. 
5644
5645 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
5646
5647         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5648         interface type is implemented by this TypeContainer.  Used during
5649         explicit interface implementation.
5650
5651         (Property.Define, Indexer.Define, Method.Define): Validate that
5652         the given interface in the explicit implementation is one of the
5653         base classes for the containing type.
5654
5655         Also if we are explicitly implementing an interface, but there is
5656         no match in the pending implementation table, report an error.
5657
5658         (Property.Define): Only define the property if we are
5659         not explicitly implementing a property from an interface.  Use the
5660         correct name also for those properties (the same CSC uses,
5661         although that is really not needed).
5662         
5663         (Property.Emit): Do not emit attributes for explicitly implemented
5664         properties, as there is no TypeBuilder.
5665
5666         (Indexer.Emit): ditto.
5667
5668         Hiding then means that we do not really *implement* a pending
5669         implementation, which makes code fail.
5670
5671 2002-06-22  Martin Baulig  <martin@gnome.org>
5672
5673         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5674         the return value of Object.GetType().  [FIXME: we need to do this whenever
5675         we get a type back from the reflection library].
5676
5677 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5678
5679         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5680
5681 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
5682
5683         * attribute.cs: Return null if we can not look up the type.
5684
5685         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5686         the interface types found.
5687
5688         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5689         interface types found.
5690
5691         * typemanager.cs (GetInterfaces): Make this routine returns alll
5692         the interfaces and work around the lame differences between
5693         System.Type and System.Reflection.Emit.TypeBuilder in the results
5694         result for GetInterfaces.
5695         
5696         (ExpandInterfaces): Given an array of interface types, expand and
5697         eliminate repeated ocurrences of an interface.  This expands in
5698         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5699         be IA, IB, IC.
5700         
5701 2002-06-21  Martin Baulig  <martin@gnome.org>
5702
5703         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5704         on System.Enum.
5705
5706 2002-06-21  Martin Baulig  <martin@gnome.org>
5707
5708         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
5709         and called with one of the core types, return the corresponding typebuilder for
5710         that type.
5711
5712         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5713         element type.
5714
5715 2002-06-21  Martin Baulig  <martin@gnome.org>
5716
5717         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5718         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5719         (Expression.ConvertReferenceExplicit): Likewise.
5720
5721         * expression.cs (ElementAccess.DoResolve): Likewise.
5722         (ElementAccess.DoResolveLValue): Likewise.
5723
5724 2002-06-10  Martin Baulig  <martin@gnome.org>
5725
5726         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5727         add the "value" parameter to the parameter list.
5728
5729         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5730         to our caller.
5731
5732 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
5733
5734         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5735         the argument to an int, uint, long or ulong, per the spec.  Also
5736         catch negative constants in array creation.
5737
5738 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5739
5740         * class.cs: do not allow the same interface to appear twice in
5741         the definition list.
5742
5743 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5744
5745         * ecore.cs: don't use ldlen with System.Array.
5746
5747 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5748
5749         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5750
5751 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5752
5753         * modifiers.cs: produce correct field attributes for protected
5754         internal. Easy fix so miguel can work on ther harder stuff:-)
5755
5756 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
5757
5758         * pending.cs: New file.  Move the code from class.cs here.
5759         Support clearning the pending flag for all methods (when not doing
5760         explicit interface implementation).
5761
5762 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5763
5764         * rootcontext.cs: added a couple more types needed to bootstrap.
5765
5766 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
5767
5768         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5769         constructor in the type, instead of any constructor in the type
5770         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
5771         a bug in the Mono runtime when applying the params attribute). 
5772
5773 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
5774         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5775
5776 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
5777
5778         * expression.cs (Unary.ResolveOperator): Use TypeManager
5779         to resolve the type.
5780         
5781 2002-06-13  Ravi Pratap  <ravi@ximian.com>
5782
5783         * cs-parser.jay (enum_member_declaration): Pass in the attributes
5784         attached.
5785
5786         * enum.cs (AddEnumMember): Add support to store the attributes associated 
5787         with each member too.
5788
5789         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5790         field builders too - this takes care of the enum member case.
5791
5792 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
5793
5794         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5795         address-of operator on both value types and pointers.
5796         
5797 2002-06-10  Martin Baulig  <martin@gnome.org>
5798
5799         * interface.cs (Interface.PopulateIndexer): Add the indexer's
5800         PropertyBuilder to the `property_builders' list.
5801
5802         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5803         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5804         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
5805         find any indexers which are inherited from an interface.
5806
5807 2002-06-09  Martin Baulig  <martin@gnome.org>
5808
5809         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5810         the same type as the constant if necessary.  There's also a test-130.cs
5811         for this.
5812
5813         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5814
5815         * typemanager.cs (TypeManager.ChangeType): Previously known as
5816         Enum.ChangeEnumType().
5817
5818 2002-06-09  Martin Baulig  <martin@gnome.org>
5819
5820         * expression.cs (Cast.TryReduce): Added support for consts.
5821
5822 2002-06-08  Ravi Pratap  <ravi@ximian.com>
5823
5824         * class.cs (Accessor): Hold attributes information so we can pass
5825         it along.
5826
5827         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5828         Modify to pass in attributes attached to the methods.
5829
5830         (add_accessor_declaration, remove_accessor_declaration): Ditto.
5831
5832         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5833         to handle the Accessor kind :-)
5834
5835         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5836         
5837 2002-06-08  Martin Baulig  <martin@gnome.org>
5838
5839         * expression.cs (Unary.TryReduceNegative): Added support for
5840         ULongConstants.
5841
5842 2002-06-08  Martin Baulig  <martin@gnome.org>
5843
5844         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5845         name can't be found in the `defined_names' - the caller will do a
5846         MemberLookup in this case and thus find methods in System.Enum
5847         such as Enum.IsDefined().
5848
5849 2002-06-08  Martin Baulig  <martin@gnome.org>
5850
5851         * enum.cs (Enum.ChangeEnumType): This is a custom version of
5852         Convert.ChangeType() which works with TypeBuilder created types.
5853         (Enum.LookupEnumValue, Enum.Define): Use it here.
5854
5855         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5856         `TypeBuilder.BaseType != null' check.
5857         (TypeContainer.FindMembers): Only lookup parent members if we
5858         actually have a parent.
5859         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5860         (ConstructorInitializer.Resolve): Likewise.
5861
5862         * interface.cs (Interface.FindMembers): Added
5863         `TypeBuilder.BaseType != null' check.
5864
5865         * rootcontext.cs (RootContext.ResolveCore): Added
5866         "System.Runtime.CompilerServices.IndexerNameAttribute" to
5867         classes_second_stage.
5868
5869         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5870         debug_type and trace_type when compiling with --nostdlib.       
5871
5872 2002-06-07  Martin Baulig  <martin@gnome.org>
5873
5874         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5875         (AddField): Set it to true when adding a non-static field.
5876         (DefineType): Use `have_nonstatic_fields' to find out whether we
5877         have non-static fields, not `Fields != null'.
5878
5879 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
5880
5881         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5882         dereferencing a null on the static-field code path)
5883
5884 2002-05-30  Martin Baulig  <martin@gnome.org>
5885
5886         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5887         to take command line arguments.  Use reflection to call the new
5888         custom `Initialize' function on the symbol writer and pass it the
5889         command line arguments.
5890
5891         * driver.cs (--debug-args): New command line argument to pass command
5892         line arguments to the symbol writer.
5893
5894 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
5895
5896         * assign.cs (DoResolve): Forgot to do the implicit conversion to
5897         the target type for indexers and properties.  Thanks to Joe for
5898         catching this.
5899
5900 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
5901
5902         * typemanager.cs (MethodFlags): returns the method flags
5903         (Obsolete/ShouldIgnore) that control warning emission and whether
5904         the invocation should be made, or ignored. 
5905
5906         * expression.cs (Invocation.Emit): Remove previous hack, we should
5907         not do this on matching a base type, we should do this based on an attribute
5908
5909         Only emit calls to System.Diagnostics.Debug and
5910         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5911         on the command line.
5912
5913         * rootcontext.cs: Global settings for tracing and debugging.
5914
5915         * cs-tokenizer.cs (define): New utility function to track
5916         defines.   Set the global settings for TRACE and DEBUG if found.
5917
5918 2002-05-25  Ravi Pratap  <ravi@ximian.com>
5919
5920         * interface.cs (Populate*): Pass in the TypeContainer as well as
5921         the DeclSpace as parameters so that we can create EmitContexts and
5922         then use that to apply attributes etc.
5923
5924         (PopulateMethod, PopulateEvent, PopulateProperty)
5925         (PopulateIndexer): Apply attributes everywhere.
5926
5927         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5928         etc.
5929
5930         (ApplyAttributes): Update accordingly.
5931
5932         We now apply interface attributes for all members too.
5933
5934 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
5935
5936         * class.cs (Indexer.Define); Correctly check if we are explicit
5937         implementation (instead of checking the Name for a ".", we
5938         directly look up if the InterfaceType was specified).
5939
5940         Delay the creation of the PropertyBuilder.
5941
5942         Only create the PropertyBuilder if we are not an explicit
5943         interface implementation.   This means that explicit interface
5944         implementation members do not participate in regular function
5945         lookups, and hence fixes another major ambiguity problem in
5946         overload resolution (that was the visible effect).
5947
5948         (DefineMethod): Return whether we are doing an interface
5949         implementation. 
5950         
5951         * typemanager.cs: Temporary hack until we get attributes in
5952         interfaces (Ravi is working on that) and we get IndexerName
5953         support in interfaces.
5954
5955         * interface.cs: Register the indexers as properties.
5956
5957         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5958         warning, I have verified that this is a bug in the .NET runtime
5959         (JavaScript suffers of the same problem).
5960
5961         * typemanager.cs (MemberLookup): When looking up members for
5962         interfaces, the parent of an interface is the implicit
5963         System.Object (so we succeed in searches of Object methods in an
5964         interface method invocation.  Example:  IEnumerable x;  x.ToString
5965         ()) 
5966
5967 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
5968
5969         * class.cs (Event): Events should also register if they do
5970         implement the methods that an interface requires.
5971
5972         * typemanager.cs (MemberLookup); use the new GetInterfaces
5973         method. 
5974
5975         (GetInterfaces): The code used to lookup interfaces for a type is
5976         used in more than one place, factor it here. 
5977
5978         * driver.cs: Track the errors at the bottom of the file, we kept
5979         on going.
5980
5981         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5982         instance if the method we are calling is static!
5983
5984 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
5985
5986         * attribute.cs (ApplyAttributes): Make this function filter out
5987         the IndexerName attribute (as that attribute in reality is never
5988         applied) and return the string constant for the IndexerName
5989         attribute. 
5990
5991         * class.cs (TypeContainer.Emit): Validate that all the indexers
5992         have the same IndexerName attribute, and if so, set the
5993         DefaultName attribute on the class. 
5994
5995         * typemanager.cs: The return value might contain other stuff (not
5996         only methods).  For instance, consider a method with an "Item"
5997         property and an Item method.
5998
5999         * class.cs: If there is a problem with the parameter types,
6000         return. 
6001
6002 2002-05-24  Ravi Pratap  <ravi@ximian.com>
6003
6004         * ecore.cs (ImplicitConversionExists): Wrapper function which also
6005         looks at user defined conversion after making a call to 
6006         StandardConversionExists - we need this for overload resolution.
6007
6008         * expression.cs : Update accordingly the various method calls.
6009
6010         This fixes 2 bugs filed against implicit user defined conversions 
6011
6012 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
6013
6014         * statement.cs: Track the result of the assignment.
6015
6016 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
6017
6018         * expression.cs (MemberAccess): Improved error reporting for
6019         inaccessible members.
6020
6021 2002-05-22  Martin Baulig  <martin@gnome.org>
6022
6023         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
6024         itself with debugging support.
6025
6026 2002-05-22  Martin Baulig  <martin@gnome.org>
6027
6028         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
6029         Removed, this isn't needed anymore.
6030
6031 2002-05-20  Martin Baulig  <martin@gnome.org>
6032
6033         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
6034         be underlying type for an enum.
6035
6036 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
6037
6038         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
6039         that splits out the loading of just the core types.
6040
6041         * rootcontext.cs (ResolveCore): Split the struct resolution in
6042         two, so we can load the enumeration underlying types before any
6043         enums are used.
6044
6045         * expression.cs (Is): Bandaid until we fix properly Switch (see
6046         bug #24985 for details).
6047
6048         * typemanager.cs (ImplementsInterface): The hashtable will contain
6049         a null if there are no interfaces implemented.
6050
6051 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
6052
6053         * cs-parser.jay (indexer_declarator): It is fine to have array
6054         parameters
6055
6056 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6057
6058         * typemanager.cs: (RegisterBuilder): New function used to register
6059         TypeBuilders that implement interfaces.  Since
6060         TypeBuilder.GetInterfaces (as usual) does not work with lame
6061         Reflection.Emit. 
6062         (AddUserType): register interfaces.
6063
6064         (ImplementsInterface): Use the builder_to_ifaces hash if we are
6065         dealing with TypeBuilder.  Also, arrays are showing up as
6066         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
6067         methods can not be invoked on them!
6068
6069         * ecore.cs (ExplicitReferenceConversionExists): Made public.
6070         (ImplicitReferenceConversionExists): Split out from
6071         StandardConversionExists. 
6072
6073         * expression.cs (As): We were only implementing one of the three
6074         cases for the as operator.  We now implement them all.
6075         (Is): Implement the various other cases for Is as well.
6076
6077         * typemanager.cs (CACHE): New define used to control if we want or
6078         not the FindMembers cache.  Seems to have a negative impact on
6079         performance currently
6080
6081         (MemberLookup): Nested types have full acess to
6082         enclosing type members
6083
6084         Remove code that coped with instance/static returns for events, we
6085         now catch this in RealFindMembers.
6086
6087         (RealFindMembers): only perform static lookup if the instance
6088         lookup did not return a type or an event.  
6089
6090 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6091
6092         * assign.cs (CompoundAssign): We pass more semantic information
6093         now to Compound Assignments than we did before: now we have all
6094         the information at hand, and now we resolve the target *before* we
6095         do the expression expansion, which allows the "CacheValue" method
6096         to have the effect we intended (before, a [x] += 1 would generate
6097         two differen ArrayAccess expressions from the ElementAccess,
6098         during the resolution process).
6099
6100         (CompoundAssign.DoResolve): Resolve target and original_source here.
6101
6102 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
6103
6104         * expression.cs (ArrayAccess): dropped debugging information. 
6105
6106         * typemanager.cs: Small bug fix: I was always returning i_members,
6107         instead of one of i_members or s_members (depending on which had
6108         the content).
6109
6110         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
6111         method is invoked before any code generation takes place, and it
6112         is a mechanism to inform that the expression will be invoked more
6113         than once, and that the method should use temporary values to
6114         avoid having side effects
6115
6116         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6117         
6118         * ecore.cs (Expression.CacheTemporaries): Provide empty default
6119         implementation.
6120
6121         * expression.cs (Indirection, ArrayAccess): Add support for
6122         CacheTemporaries in these two bad boys. 
6123
6124         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6125         ldobj or ldind_ref.  
6126         (StoreFromPtr): Handle stobj as well.
6127
6128         * expression.cs (UnaryMutator): Share more code.
6129         
6130         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6131         down: I was not tracking the Filter function as well, which
6132         was affecting the results of the cache.
6133
6134 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
6135
6136         * attribute.cs: Remove the hack to handle the CharSet property on
6137         StructLayouts. 
6138
6139 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
6140
6141         * attribute.cs (DoResolve): More uglyness, we now only try to
6142         resolve the attribute partially, to extract the CharSet
6143         information (only if we are a StructLayout attribute).  Otherwise 
6144
6145         (GetExtraTypeInfo): Add some code to conditionally kill in the
6146         future this.   I am more and more convinced that the .NET
6147         framework has special code to handle the attribute setting on
6148         certain elements.
6149
6150         * expression.cs (IsParamsMethodApplicable): Revert my previous
6151         foreach change here, it was wrong.
6152
6153 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
6154
6155         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6156         (pp_expr): do not abort on unknown input, just return.
6157         (eval): abort if there are pending chars.
6158
6159         * attribute.cs (Attribute.Resolve): Positional parameters are
6160         optional.  Deal with that case.
6161
6162         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6163         the Ansi/Unicode/Auto information for the type.
6164
6165         (TypeContainer.DefineType): instantiate the EmitContext here, as
6166         we will be using it during the type definition (to resolve
6167         attributes) and during the emit phase.
6168
6169         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6170         to pull type information out of the attributes
6171
6172         (Attribute.Resolve): track the constructor builder, and allow for
6173         multiple invocations (structs and classes will use this).
6174
6175         * ecore.cs (MemberLookupFinal): new version with all the
6176         parameters customizable.
6177
6178         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6179         constructors.  Return if the result value is null (as the error
6180         would have been flagged already by MemberLookupFinal)
6181
6182         Do not allow instances of abstract classes or interfaces to be
6183         created.
6184         
6185         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6186         We have to compare the assembly property here when dealing with
6187         FamANDAssem and Assembly access modifiers, because we might be
6188         creating an assembly from *modules* (that means that we are not
6189         getting TypeBuilders for types defined in other modules that are
6190         part of this assembly).
6191
6192         (Method.Emit): If the method is marked abstract and has a body,
6193         emit an error. 
6194
6195         (TypeContainer.DefineMembers): If both the defined member and the
6196         parent name match are methods, then do not emit any warnings: let
6197         the Method.Define routine take care of flagging warnings.  But if
6198         there is a mismatch (method overrides something else, or method is
6199         overriwritten by something, then emit warning).
6200
6201         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6202         set to null, this means `do not check for the return type on the
6203         signature'. 
6204
6205         (Method.Define): set the return type for the method signature to
6206         null, so that we get methods with the same name and parameters and
6207         different return types.  This is used to flag warning 114 (you are
6208         hiding a method, and you probably want to use the new/override
6209         keywords instead).
6210
6211         * typemanager.cs (MemberLookup): Implemented proper access
6212         control, closing a long standing set of bug reports.  The problem
6213         was that the Framework only has two bits: Public and NonPublic,
6214         and NonPublic includes private and protected methods, but we need
6215         to enforce the FamANDAssem, FamOrAssem and Family. 
6216
6217 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
6218
6219         * statement.cs (GotoCase): Return true: Ammounts to giving up
6220         knowledge on whether we return or not, and letting the other case
6221         be responsible for it.
6222
6223 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
6224
6225         * driver.cs: Do not load directories for each file processed, only
6226         do it if there is a pattern.
6227
6228         * ecore.cs: Report readonly assigns here as well, as we might have
6229         been resolved only by MemberAccess.
6230
6231         (SimpleName.SimpleNameResolve): Also be useful for LValue
6232         resolution.   We need this to propagate assign to local readonly variables
6233
6234         * typemanager.cs: Use a ptrhashtable for the criteria, because we
6235         do not want to reuse potential criteria memory.
6236
6237         * class.cs (MyEventBuilder): Set reflected_type;
6238
6239         * ecore.cs (Constantify): Added support for constifying bools.
6240
6241         (RootContext.LookupType): Added a cache for values looked up in
6242         the declaration space.
6243
6244         * typemanager.cs (FindMembers): Now is a front-end to
6245         RealFindMembers, and provides a two-level hashtable-based cache to
6246         the request.  
6247
6248         15% performance improvement: from 22.5 to 19.2 seconds.
6249
6250         * expression.cs (IsParamsMethodApplicable): use foreach.
6251         (Invocation.DoResolve): ditto.
6252         (New.DoResolve): ditto.
6253         (ArrayCreation.DoResolve): ditto.
6254
6255         * ecore.cs (FindMostEncompassingType): use foreach.
6256
6257         * delegate.cs (NewDelegate.DoResolve): Use foreach
6258
6259         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6260         (RemoveMethods): use foreach.
6261
6262         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6263         nested foreach statements instead of for, and also break out of
6264         the inner loop once a match is found.
6265         
6266         (Invocation.OverloadResolve): Use foreach, simplify the code. 
6267
6268 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
6269
6270         * cfold.cs (BinaryFold): During an enumeration evaluation context,
6271         we actually unwrap the expression to allow for extra information
6272         to be extracted. 
6273
6274         * expression.cs: Use Shr_Un on unsigned operations. 
6275
6276 2002-05-08  Ravi Pratap  <ravi@ximian.com>
6277
6278         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
6279         applicable operators was not being considered correctly. This closes
6280         the bug Miguel reported.
6281
6282 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6283
6284         * attribute.cs: check that the type derives from System.Attribute
6285         and report the correct error in that case (moved the duplicate code to
6286         its own method, too).
6287
6288 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6289
6290         * attribute.cs: lookup attribute type name as the spec says: first the
6291         bare attribute name and then name + "Attribute" (nant compiles with
6292         mcs after this fix).
6293
6294 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
6295
6296         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
6297         Because of the way we parse things, we should try to see if a
6298         UIntConstant can fit in an integer.
6299
6300 2002-05-07  Ravi Pratap  <ravi@ximian.com>
6301
6302         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6303         when we are in an explicit context.
6304
6305         (ConvertReferenceExplicit): When converting from Iface type S to Class
6306         T make sure the rules are implemented as an OR.
6307
6308         * parameter.cs (ParameterType): Make it a property for now although the
6309         purpose really isn't anything immediate.
6310         
6311         * expression.cs (Is*Applicable): Do better checking on the parameter type
6312         of a ref/out parameter. The ones from the system assemblies are already 
6313         marked with the correct type so we don't need to do any correction.
6314
6315         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
6316         the object type is standard too so include that.
6317
6318 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6319
6320         * ecore.cs (StandardConversionExists): Augment with missing code:
6321         deal with IntConstant, LongConstants and Enumerations.
6322
6323         * assign.cs: Report the error, instead of failing silently
6324
6325         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6326         typecontainer that they are declared, because the
6327         typecontainer/namespace will have the list of using clauses that
6328         need to be applied.
6329
6330         Assembly Attributes were escaping the normal registration
6331         mechanism. 
6332
6333         (EmitCode): Apply attributes within an EmitContext that represents
6334         the container they were declared on.
6335         
6336         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
6337
6338 2002-05-06  Ravi Pratap  <ravi@ximian.com>
6339
6340         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6341         Revamp completely - make much cleaner as we now operate only
6342         on a set of Types.
6343
6344         (FindMostSpecificSource, FindMostSpecificTarget): New methods
6345         to implement the logic detailed in the spec more correctly.
6346
6347         (UserDefinedConversion): Update accordingly.
6348
6349 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6350
6351         * statement.cs: Return flow analysis information up.
6352
6353         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6354         and the default.
6355
6356         (token): Do not consume an extra character before calling
6357         decimal_digits.
6358
6359 2002-05-06  Piers Haken <piersh@friskit.com>
6360
6361         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6362
6363 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6364
6365         * class.cs (Constructor.Emit): Set the IsStatic flag in the
6366         EmitContext during the instance constructor initializer
6367         resolution, to stop access to instance variables.
6368
6369         This is mandated by the spec, last paragraph of the `constructor
6370         initializers' section. 
6371
6372 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
6373
6374         * cs-parser.jay, class.cs (Accessor): new class used to represent
6375         an accessor (get or set).  In the past we used `null' to represent
6376         a missing accessor.  But this is ambiguous because there was no
6377         way to tell in abstract indexers/properties if one of them was
6378         specified.
6379
6380         Now there is a way of addressing that.
6381
6382         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6383         instead of FindMembers.
6384
6385         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6386         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6387
6388         * attribute.cs: Treat indexers and properties as the same in terms
6389         of applying attributes
6390
6391         * ecore.cs (FindMostEncompassedType): Use statically initialized
6392         EmptyExpressions()s like we do elsewhere to avoid creating useless
6393         objects (and we take this out of the tight loop).
6394
6395         (GetConversionOperators): Move the code to extract the actual
6396         operators to a separate routine to clean things up.
6397
6398 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
6399
6400         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6401         events are always registered FieldBuilders.
6402         
6403         * class.cs (FieldBase): New class shared by Fields 
6404
6405         * delegate.cs: If we are a toplevel delegate, use our full name.
6406         If we are a nested delegate, then only use our tail name.
6407
6408 2002-05-02  Ravi Pratap  <ravi@ximian.com>
6409
6410         * expression.cs (IsApplicable): Ensure that we add the "&" to
6411         ref/out types before comparing it with the type of the argument.
6412
6413         (IsParamsMethodApplicable): Ditto.
6414
6415         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
6416         silly me ;-)
6417
6418         * delegate.cs : Handle the case when we have more than one applicable
6419         method. Flag an error only when we finish checking all.
6420
6421 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
6422
6423         * expression.cs: Add support for boolean static initializers.
6424
6425 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
6426
6427         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6428
6429         * parameter.cs (ComputeParameterTypes,
6430         ComputeAndDefineParameterTypes): Better error handling: now we
6431         clear the `types' cache if we fail during any of the type lookups.
6432         We also return the status code correctly to our caller
6433
6434         * delegate.cs: If we fail to define a delegate, abort the extra
6435         steps. 
6436
6437         * expression.cs (Binary.ResolveOperator): for
6438         operator==(object,object) and operator !=(object, object) we also
6439         have to verify that there is an implicit conversion from one to
6440         the other.
6441
6442         (ArrayAccess.DoResolve): Array Access can operate on
6443         non-variables. 
6444
6445 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
6446
6447         * assign.cs (CompoundAssign): A new class used as a "flag" that
6448         the assignment actually is happening as part of a compound
6449         assignment operator.
6450
6451         During compound assignment, a few new rules exist to enable things
6452         like:
6453
6454         byte b |= 1 + 2
6455
6456         From the spec:
6457         
6458         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6459         to the type of x) if y is implicitly convertible to the type of x,
6460         and the operator is a builtin operator and the return type of the
6461         operator is explicitly convertible to the type of x. 
6462
6463         * rootcontext.cs: Reset warning level to 2.  4 catches various
6464         "interesting" features in mcs, we must clean this up at some
6465         point, but currently am trying to kill other bugs ;-)
6466
6467         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6468         in container classes as well.  
6469
6470         * expression.cs (Binary.ResolveOperator): Handle string case
6471         before anything else (as operator overloading does emit an error
6472         before doing anything else).
6473
6474         This code could go away when we move to a table driven model, but
6475         i could not come up with a good plan last night.
6476         
6477 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
6478
6479         * typemanager.cs (CSharpName): reimplementation using regex.
6480         * class.cs: added null check for fields in Emit
6481         * rootcontext.cs: set warninglevel to 4
6482
6483 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
6484
6485         * typemanager.cs (CSharpName): reimplemented with Lupus
6486         suggestion.
6487
6488 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
6489
6490         * statement.cs (If): correclty implement Resolve, because we were
6491         not catching sem errors in there.  The same process is needed
6492         everywhere else. 
6493         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6494         
6495
6496         (Statement.Warning_DeadCodeFound): Factorize code.
6497         (While): Report dead code here too.
6498
6499         (Statement): Added Resolve virtual method to allow
6500         for resolution split from the emit code.
6501
6502 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6503
6504         * statement.cs (EmitBoolExpression): No longer try to resolve the
6505         expression here.    
6506         (MakeBoolean): New utility function that resolve, implicitly
6507         converts to boolean and tags the expression. 
6508         
6509
6510         (If, Do): Implement dead code elimination.
6511         (While): Implement loop inversion
6512
6513         (Do, While, For, If): Resolve the expression prior to calling our
6514         code generation.
6515
6516 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
6517
6518         * class.cs:
6519           - added method Report28 (warning: program has more than one entry point)
6520           - added method IsEntryPoint, implements paragraph 10.1 of the spec
6521           - modified method Method.Define, the part at the end of the method
6522
6523         * rootcontext.cs: added static public Location EntryPointLocation;
6524           
6525         * ../errors/cs0028.cs : Add test case for the above warning.              
6526
6527         * typemanager.cs:
6528           - modified method CSharpName to allow arrays of primitive type to
6529             be printed nicely (e.g. instead of System.Int32[][] it now prints
6530             int[][])
6531           - added method CSharpSignature: returns the signature of a method
6532             in string format to be used in reporting errors, warnings, etc.
6533
6534         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6535         with String.Empty.
6536         
6537 2002-04-26  Ravi Pratap  <ravi@ximian.com>
6538
6539         * delegate.cs (Define): Fix extremely silly bug where I was
6540         setting the type of the 'object' parameter of the BeginInvoke
6541         method to System.IAsyncResult instead of System.Object ;-)
6542
6543 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6544
6545         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6546         here. 
6547
6548         (Constructor.Emit): return if we fail to initialize the
6549         constructor.  Another door closed!  
6550
6551         * expression.cs (New.DoResolve): Improve error message (from -6 to
6552         1501).  Use DeclaredOnly lookup to find the exact constructor.
6553
6554         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6555         loop.  This is useful.
6556
6557         * cs-parser.jay: Adjust the default parameters so that destructors
6558         have the proper signature.
6559
6560 2002-04-26  Martin Baulig  <martin@gnome.org>
6561
6562         * driver.cs (LoadAssembly): If `assembly' contains any characters
6563         which are only valid in path names and not in assembly names
6564         (currently slash, backslash and point), use Assembly.LoadFrom ()
6565         instead of Assembly.Load () on the `assembly' (before iteration
6566         over the link_paths).
6567
6568 2002-04-26  Martin Baulig  <martin@gnome.org>
6569
6570         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6571
6572 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
6573
6574         * class.cs (Property): use the new typemanager.MemberLookup
6575
6576         (TypeContainer.MemberLookup): Implement using the
6577         TypeManager.MemberLookup now. 
6578         
6579         * typemanager.cs: Make MemberLookup a function of the TypeManager,
6580         and return MemberInfos, so that these can be used without an
6581         EmitContext (what we had before).
6582
6583 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
6584
6585         * expression.cs: Fix the case where the argument to params if the
6586         type of the params.  I omitted handling this before.   Fixed
6587
6588 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6589
6590         * driver.cs: Call BootCorlib_PopulateCoreType
6591
6592         * class.cs (Property.CheckBase): Check for properties only, not
6593         for all members. 
6594
6595         * interface.cs: Temporary hack: try/catch around the
6596         CustomAttributeBuilder, because I am getting an exception that I
6597         do not understand.
6598
6599         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6600         types whose definitions are required to be there (attributes are
6601         defined before standard types).
6602
6603         Compute definitions as we boot the various types, as they are used
6604         immediately (value_type class will need object_type, but if we do
6605         not initialize object_type, we will pass a null, which will let
6606         the runtime pick the System.Object from the existing corlib, which
6607         is not what we want).
6608
6609 2002-04-22  Patrik Torstensson <totte@labs2.com>
6610
6611         * cs-tokenizer.cs: fixed a number of trim() issues.
6612
6613 2002-04-22  Ravi Pratap  <ravi@ximian.com>
6614
6615         * expression.cs (Argument.Type): Ensure that we return the correct
6616         type when we have out or ref parameters [in which case we 
6617         append a "&"].
6618         
6619 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6620
6621         * class.cs (Property, Indexer): Allow extern modifier in there. 
6622
6623         * typemanager.cs (InitBaseTypes): Initializes object_type and
6624         value_type, since those will be used early on during the bootstrap
6625         process to compile corlib.
6626
6627         (InitCoreTypes): Move code from here to InitBaseTypes.
6628
6629 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
6630
6631         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6632         single-dimension arrays as using the ldlen opcode.  
6633
6634         Daniel Lewis discovered this optimization.  
6635
6636         * typemanager.cs: Add signature for System.Array::get_Length
6637
6638 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6639
6640         * statement.cs: report the error when the foreach does not apply to an
6641         array nor a collection.
6642
6643 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
6644
6645         * expression.cs: Add implicit conversions to the operator ~.
6646
6647         * constant.cs (DecimalConstant.Emit): Emit decimal value.
6648
6649         * typemanager.cs: Locate the decimal constructor.
6650
6651 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6652
6653         * attribute.cs: use the new property of TypeOf.
6654         * expression.cs: added 'get' property around typearg.
6655
6656         These changes fix a build breaker reported by NickD. Is this the
6657         correct way to fix?  If not, please, revert my changes and make it
6658         work :-).
6659
6660 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
6661
6662         * attribute.cs: Add support for typeof in attribute invocations.
6663         I am not sure that this is right though.
6664
6665 2002-04-14  Duncan Mak  <duncan@ximian.com>
6666
6667         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6668         Binary.Operator.Division case.
6669
6670 2002-04-13  Ravi Pratap  <ravi@ximian.com>
6671
6672         * class.cs (DefineType): Ensure that we do a proper check on
6673         attribute types and also register it with the TypeManager.
6674
6675         (TypeContainer.Targets): The default for attribute types is
6676         AttributeTargets.All.
6677         
6678         * attribute.cs (ApplyAttributes): Registering the attribute type
6679         is done elsewhere, not when we discover we have a Usage attribute.
6680
6681 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6682
6683         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6684         and get rid of is_delegate parameter.
6685
6686         * everywhere : update.
6687         
6688 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6689
6690         * cs-parser.jay (compilation_unit): Revamp completely to use
6691         some new ideas that I got from Rhys' grammar to solve the problems
6692         with assembly level attributes.
6693
6694         (outer_declaration): New grammar production.
6695
6696         (attribute_sections): Add.
6697
6698         (opt_attributes): Base on attribute_sections
6699
6700         (namespace_declaration): Allow opt_attributes to tackle the case
6701         when we have assembly level attributes - we are clever in this
6702         regard now ;-)
6703
6704         * attribute.cs (ApplyAttributes): Do not worry about assembly 
6705         attributes in the non-global context.
6706
6707         * rootcontext.cs (AddGlobalAttributes): Go back to using this
6708         instead of SetGlobalAttributes.
6709
6710         * class.cs, rootcontext.cs : Ensure we define and generate 
6711         attribute types before anything else.
6712
6713         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6714         and flag the new error -20 for the case when the attribute type
6715         does not have valid targets specified. csc does not catch this.
6716
6717         * ../errors/errors.txt : update for error # -20
6718
6719 2002-04-11  Ravi Pratap  <ravi@ximian.com>
6720
6721         * support.cs (InternalParameters.ParameterModifier): Do some null
6722         checking and return sane values.
6723
6724         * class.cs (Method.Define): If we are a PInvoke method, ensure
6725         that we are static and extern. Report error # 601
6726
6727         * ../errors/cs0601.cs : Add test case for the above error.
6728
6729 2002-04-07  Ravi Pratap  <ravi@ximian.com>
6730
6731         * rootcontext.cs (attribute_types): We need to keep type of
6732         all attribute types separately and emit code for them first.
6733
6734         (RegisterAttribute) : Implement.
6735
6736         * class.cs (DefineType): Check if the current Type is a custom
6737         attribute type and register it accordingly.
6738
6739         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6740         adding the first attribute twice and rename to
6741
6742         (SetGlobalAttributes): this.
6743
6744         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6745         lookups.
6746
6747         * attribute.cs (ApplyAttributes): Take an additional argument telling us
6748         if we are processing global arguments. Hmm, I am unsure of this.
6749
6750 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6751
6752         * expression.cs: added static array of strings to avoid calling
6753         Enum.ToString () for Operator in Binary. Significant recover of
6754         performance.
6755
6756 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
6757
6758         * class.cs (FindMembers): Allow the Builders of the various
6759         members to be null.  If they are skip them.  This only happens
6760         during the PInvoke declaration.
6761
6762 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
6763
6764         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6765         failure, so we do not keep going afterwards.
6766
6767         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6768         wanted to pass `false' as the `is_delegate' argument.  If this is
6769         the case, why not use delegate_type == null to mean `is_delegate =
6770         false' and anything else as is_delegate = true.
6771
6772 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
6773
6774         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6775         code for the section, not the beginning of the tests.
6776
6777 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
6778
6779         * cfold.cs: Handle operator + (Enum x, Underlying x) 
6780
6781         * expression.cs (Binary): same.  Warn about errors where we have
6782         Enum/Enum in operator + as well.
6783
6784 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
6785
6786         * statement.cs:
6787                 - added support for switch(bool)
6788                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6789                 - add TableSwitchEmit() to handle table-based switch statements
6790
6791 2002-04-05  Ravi Pratap  <ravi@ximian.com>
6792
6793         * expression.cs (Invocation.OverloadResolve): Factor out code which
6794         does parameter compatibility checking with arguments so that we can 
6795         re-use the code even from Delegate.VerifyApplicability
6796
6797         (VerifyArgumentsCompat): Move above code here.
6798
6799         * delegate.cs (VerifyApplicability): Get rid of duplicate code
6800         and instead make a call to the above method.
6801
6802 2002-03-31  Ravi Pratap  <ravi@ximian.com>
6803
6804         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6805         We use it to keep track of classes which are attribute types.
6806
6807 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
6808
6809         * delegate.cs (Delegate.Define): Correctly define the types in the
6810         presence of fixed and array parameters.
6811
6812         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6813         doing FindMembers.
6814
6815         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6816         include NonPublic after the first iteration.
6817
6818         * class.cs (Indexer.CheckBase): Only check if both parents are
6819         non-null. 
6820         
6821         * cs-parser.jay (accessor_body): If empty, set to null.
6822
6823         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6824         same code path here to resolve constants names that we did have in
6825         MemberAccess.DoResolve.  There is too much code duplicated here.
6826
6827 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
6828
6829         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6830
6831         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6832         to MakeUnionSet.
6833
6834         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6835         tokens, numbers and strings.
6836
6837         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6838         parenthesis.
6839
6840         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6841         asyncronous parameters and the regular parameters.  
6842
6843         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6844         specify the target directory.
6845
6846         * expression.cs: (This.DoResolve): Simplify
6847         (As.Emit): Optimize, do not generate IsInst if the expression is
6848         always of the given type.
6849
6850         (Is.DoResolve): Bug fix, we were reporting both always/never for
6851         the is expression.
6852
6853         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6854         creating too many unnecessary arrays.
6855
6856 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
6857
6858         * class.cs (EmitFieldInitializer): Use Assign expression to assign
6859         fields instead of rolling our own initializer.   Takes care of all
6860         implicit conversions, and drops unnecessary static checks/argument.
6861
6862 2002-03-31  Dick Porter  <dick@ximian.com>
6863
6864         * driver.cs: use the GetDirectories() return values properly, and
6865         use "/" as path separator.
6866
6867 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
6868
6869         * expression.cs (Unary): Optimize - - expr into expr.
6870         (Binary): Optimize a + (-b) into a -b.
6871
6872         * codegen.cs (CodeGen): Made all methods static.
6873
6874 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
6875
6876         * rootcontext.cs: 
6877
6878         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6879         TypeBuilder property.
6880
6881         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6882         instead. 
6883
6884         * tree.cs: Removed the various RecordXXXX, and replaced with a
6885         single RecordDecl.  Removed all the accessor methods, and just
6886         left a single access point Type 
6887
6888         * enum.cs: Rename DefineEnum to DefineType.
6889
6890         * decl.cs: New abstract method `DefineType' used to unify the
6891         Defines for Enumerations, Interfaces, TypeContainers and
6892         Delegates.
6893
6894         (FindType): Moved LookupInterfaceOrClass here.  Moved the
6895         LookupBaseClasses method that used to live in class.cs and
6896         interface.cs here, and renamed to FindType.
6897         
6898         * delegate.cs: Implement DefineType.  Take advantage of the
6899         refactored pattern for locating the parent builder without taking
6900         the parent_builder argument (which we know does not work if we are
6901         nested, and triggering a toplevel definition).
6902
6903 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6904
6905         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6906         accessibility of a member has changed during override and report
6907         an error if so.
6908
6909         * class.cs (Method.Define, Property.Define): Only complain on
6910         overrides if the method is private, any other accessibility is
6911         fine (and since we just checked the permission is the same, we are
6912         good to go).
6913
6914         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6915         and elif are processed always.  The other pre-processing
6916         directives are only processed if we are "taking" the path
6917
6918 2002-03-29  Martin Baulig  <martin@gnome.org>
6919
6920         * class.cs (Method.Emit): Only emit symbolic debugging info if the
6921         current location is not Null.
6922
6923         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6924         a separate method so we can profile it.
6925
6926         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6927         `span.Seconds' are just seconds, but no minutes or hours.
6928         (MainDriver): Profile the CodeGen.SaveSymbols calls.
6929
6930 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6931
6932         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6933         Remove the gratuitous set of Final:
6934
6935                                 // If an interface implementation, then we can set Final.
6936                                 if (((flags & MethodAttributes.Abstract) == 0) &&
6937                                     implementing.DeclaringType.IsInterface)
6938                                         flags |= MethodAttributes.Final;
6939
6940         I do not know what I was smoking when I used that.
6941         
6942
6943         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6944         step into fixing the name resolution issues for delegates and
6945         unifying the toplevel name resolution.
6946
6947 2002-03-28  Martin Baulig  <martin@gnome.org>
6948
6949         * class.cs (Method.Emit): If we have a symbol writer, call its
6950         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6951         tell it about the current method.
6952
6953         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6954         writer that we're going to emit the first byte of IL code for a new
6955         statement (a new source line).
6956         (EmitContext.EmitTopBlock): If we have a symbol writer, call
6957         EmitContext.Mark() before emitting any code.
6958
6959         * location.cs (SymbolDocument): Return null when we're Null.
6960
6961         * statement.cs (Statement): Moved the `Location loc' variable here.
6962         (Statement.EmitBoolExpression): If we have a symbol writer, call
6963         ec.Mark() before emitting any code to tell it that we're at the
6964         beginning of a new statement.
6965         (StatementExpression): Added `Location' argument to the constructor.
6966         (Block): Added public readonly variable `StartLocation' and public
6967         variable `EndLocation'.  The latter is to be set using SetEndLocation().
6968         (Block): Added constructor which takes a start and end location.
6969         (Block.SetEndLocation): New method. This sets the end location.
6970         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6971         local variables we create.
6972         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6973         each statement and do also mark the begin and end of the block.
6974
6975         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6976         tell it the current lexer.Location, use Location.Null for the end of the
6977         block.
6978         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6979         current block, set its end location using SetEndLocation().
6980         (statement_expression): StatementExpression constructor now takes the
6981         lexer.Location as additional argument.
6982         (for_statement, declare_local_variables): Likewise.
6983         (declare_local_variables): When creating a new implicit block, use the
6984         new Block constructor and pass it the lexer.Location.
6985
6986 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6987
6988         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6989         members also on the parent interfaces recursively.
6990
6991 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
6992
6993         * report.cs: Use new formats, since Gonzalo finished the missing
6994         bits. 
6995
6996         * expression.cs (Binary.ResolveOperator): added missing operator|
6997         operator& and operator^ for bool/bool.
6998
6999         * cs-parser.jay: CheckDef now takes a Location argument that is
7000         used to report errors more precisly (instead of reporting the end
7001         of a definition, we try to track something which is a lot closer
7002         to the source of the problem).
7003
7004         * cs-tokenizer.cs: Track global token use, so we can properly flag
7005         the use of #define/#undef after the first token has been seen.
7006
7007         Also, rename the reportXXXX to Error_DescriptiveName
7008
7009         * decl.cs (DeclSpace.IsTopLevel): Move property here from
7010         TypeContainer, so that Enum and Interface can use this too.
7011
7012         * class.cs (TypeContainer.LookupInterfaceOrClass,
7013         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
7014         `builder' argument.  Typically this was used to pass the parent
7015         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
7016         the definition).  
7017
7018         The problem is that a nested class could trigger the definition of
7019         a toplevel class, and the builder would be obviously wrong in that
7020         case. 
7021
7022         So we drop this argument, and we compute dynamically the
7023         TypeBuilder/ModuleBuilder (the correct information was available
7024         to us anyways from DeclSpace.Parent)
7025
7026         * interface.cs (Interface.DefineInterface): Drop builder
7027         parameter cleanup like class.cs
7028
7029         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
7030         like class.cs
7031
7032         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
7033         values. 
7034
7035         (Try.Emit): Propagate the returns value from the statement.
7036
7037         (Return.Emit): Even if we are leavning 
7038
7039         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
7040
7041         * modifiers.cs: Fix the computation of MethodAttributes flags.
7042
7043 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
7044
7045         * driver.cs: allow compilation of files that start with '/'.
7046         Add a default case when checking the argument of --target.
7047
7048 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
7049
7050         * interface.cs: Implement the same search algorithm for types in
7051         the interface code.
7052
7053         * delegate.cs: Do not allow multiple definition.
7054
7055         * Recovered ChangeLog that got accidentally amputated
7056
7057         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
7058
7059         * rootcontext.cs: Load manually enum to allow core classes to
7060         contain enumerations.
7061
7062         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
7063         Update to new static methods in TypeManager.
7064
7065         * typemanager.cs (GetMethod, GetConstructor): Use our
7066         implementation of FindMembers to find the members, since during
7067         corlib compilation, the types are TypeBuilders and GetMethod and
7068         GetConstructor do not work.
7069
7070         Make all methods in TypeManager static.
7071
7072         (InitCodeHelpers): Split the functionality from
7073         the InitCodeTypes function.
7074
7075         * driver.cs: Call InitCodeHelpers after we have populated the
7076         types. 
7077
7078         * cs-parser.jay (delegate_declaration): we did not used to compute
7079         the delegate name correctly for void delegates.
7080
7081 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
7082
7083         * rootcontext.cs (RootContext): Init the interface_resolve_order
7084         and type_container_resolve_order always.
7085
7086         (ResolveCore, BootstrapCorlib_ResolveClass,
7087         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
7088         compiler when compiling with --nostdlib
7089
7090         * class.cs (TypeContainer.DefineType): Check that our parent is
7091         not null.  This test is most important when we are bootstraping
7092         the core types.
7093
7094         * codegen.cs: Split out the symbol writing code.
7095
7096 2002-03-25  Martin Baulig  <martin@gnome.org>
7097
7098         * driver.cs (-g): Made -g an alias for --debug.
7099
7100 2002-03-24  Martin Baulig  <martin@gnome.org>
7101
7102         * codegen.cs (SymbolWriter): New public variable. Returns the
7103         current symbol writer.
7104         (CodeGen): Added `bool want_debugging_support' argument to the
7105          constructor. If true, tell the ModuleBuild that we want debugging
7106         support and ask it for the ISymbolWriter.
7107         (Save): If we have a symbol writer, call it's Close() method after
7108         saving the assembly.
7109
7110         * driver.c (--debug): New command line argument to create a
7111         debugger information file.
7112
7113         * location.cs (SymbolDocument): New public property. Returns an
7114         ISymbolDocumentWriter object for the current source file or null
7115         if we don't have a symbol writer.
7116
7117 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
7118
7119         * driver.cs (LoadAssembly): Correctly return when all the paths
7120         have been tried and not before.
7121
7122         * statement.cs (Switch.Emit): return the actual coverage for this
7123         statement (returns/not-returns)
7124
7125         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7126         switch of the statement if we are the last switch section.  That
7127         kills two problems: try/catch problems (we used to emit an empty
7128         nop at the end) and switch statements where all branches would
7129         return. 
7130
7131 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
7132
7133         * driver.cs: Add default assemblies (the equivalent to the
7134         Microsoft CSC.RSP file)
7135
7136         * cs-tokenizer.cs: When updating `cols and setting it to zero,
7137         also update tokens_seen and set it to false.
7138
7139         * driver.cs: Implement --recurse for Mike.
7140
7141         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7142         correctly splitting out the paths.
7143
7144 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
7145
7146         * interface.cs (Interface.PopulateProperty): Instead of using
7147         `parent' as the declaration space for the set parameters, use
7148         `this' 
7149
7150         * support.cs (InternalParameters): InternalParameters constructor
7151         takes a DeclSpace instead of a TypeContainer.
7152
7153         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7154         types are being initialized, load the address of it before calling
7155         the function.  
7156
7157         (New): Provide a mechanism to disable the generation of local
7158         value type temporaries when the caller will be providing us with
7159         an address to store it.
7160
7161         (ArrayCreation.EmitDynamicInitializers): Use it.
7162
7163 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
7164
7165         * expression.cs (Invocation.EmitArguments): Only probe for array
7166         property if there is more than one argument.  Sorry about that.
7167
7168         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7169         empty param arrays.
7170         
7171         * class.cs (Method.LabelParameters): Fix incorrect code path that
7172         prevented the `ParamArrayAttribute' from being applied to the
7173         params attribute.
7174
7175 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
7176
7177         * support.cs (ReflectionParameters): Correctly compute whether the
7178         last argument is a params array.  Fixes the problem with
7179         string.Split ('a')
7180
7181         * typemanager.cs: Make the assemblies array always be non-null
7182         (empty, but non-null)
7183
7184         * tree.cs (RecordDecl): New function that abstracts the recording
7185         of names.  This reports error 101, and provides a pointer to the
7186         previous declaration.  Fixes a crash in the compiler.
7187
7188         * cs-parser.jay (constructor_declaration): Update to new grammar,
7189         and provide a constructor_body that can be empty.
7190
7191 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
7192
7193         * driver.cs: Add support for --resources.
7194
7195         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7196         Make all types for the various array helper methods be integer.
7197
7198         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7199         CheckState to ConvCast.
7200
7201         (ConvCast): Now it takes a `checked' state argument, to avoid
7202         depending on the emit context for the conversion, and just using
7203         the resolve time setting.
7204
7205         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7206         instead of Invocation.EmitArguments.  We do not emit the original
7207         arguments, instead we emit those which have been converted to
7208         unsigned int expressions.
7209
7210         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
7211
7212         * codegen.cs: ditto.
7213
7214         * expression.cs (LocalVariableReference): Drop the use of the
7215         Store function that depended on the variable index.
7216
7217         * statement.cs (VariableInfo): Drop the `Idx' property from this
7218         class, as this is not taking into account the indexes for
7219         temporaries tat we generate during the execution, getting the
7220         indexes wrong.
7221
7222         * class.cs: First emit class initializers, then call the parent
7223         constructor. 
7224
7225         * expression.cs (Binary): Fix opcode emision.
7226         (UnaryMutator.EmitCode): Support checked code generation
7227
7228         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
7229         matches for events for both the Static and Instance scans,
7230         pointing to the same element.   Fix that.
7231
7232 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
7233
7234         * rootcontext.cs (ResolveTree): Always set the
7235         interface_resolve_order, because nested interfaces will be calling
7236         into us.
7237
7238         * class.cs (GetInterfaceOrClass): Track the same resolution
7239         process used by TypeManager.LookupType.  This fixes the nested
7240         type lookups in class declarations (separate path from
7241         LookupType). 
7242
7243         (TypeContainer.DefineType): Also define nested interfaces.
7244         (TypeContainer.RegisterOrder): New public function used to
7245         register the order in which child interfaces need to be closed.
7246
7247         Nested interfaces need to be closed after their parents have been
7248         created. 
7249         
7250         * interface.cs (InterfaceAttr): Put all the logic for computing
7251         the interface attribute here. 
7252
7253         (DefineInterface): Register our interface order with the
7254         RootContext or with the TypeContainer depending on the case.
7255
7256 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7257
7258         * cs-parser.jay: rework foreach statement to work with the new
7259         changes to the policy on SimpleNames.
7260         
7261         * report.cs: support Stacktrace on warnings as well.
7262
7263         * makefile: drop --unsafe and /unsafe from the compile.
7264
7265 2002-03-13  Ravi Pratap  <ravi@ximian.com>
7266
7267         * ecore.cs (StandardConversionExists): Modify to take an Expression
7268         as the first parameter. Ensure we do null -> reference type conversion
7269         checking.
7270
7271         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7272         temporary Expression objects.
7273
7274 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7275
7276         * interface.cs: workaround bug in method overloading resolution
7277         (there is already a bugzilla bug for it).
7278
7279 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7280
7281         We could also solve this problem by having a separate path for
7282         performing type lookups, instead of DoResolve, we could have a
7283         ResolveType entry point, and only participating pieces of the
7284         production (simplename, deref, array) would implement this. 
7285         
7286         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7287         signal SimpleName to only resolve type names and not attempt to
7288         resolve anything else.
7289
7290         * expression.cs (Cast): Set the flag.
7291
7292         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7293
7294         * class.cs: Only report 108 if there is no `new' modifier.
7295
7296         * cs-parser.jay: rework foreach statement to work with the new
7297         changes to the policy on SimpleNames.
7298         
7299         * report.cs: support Stacktrace on warnings as well.
7300
7301         * makefile: drop --unsafe and /unsafe from the compile.
7302
7303 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
7304
7305         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7306         lookups here, instead of doing that at parse time.  This means
7307         that our grammar will not introduce `LocalVariableReferences' as
7308         expressions at this point.  That solves the problem of code like
7309         this:
7310
7311         class X {
7312            static void Main ()
7313            { int X = 1;
7314             { X x = null }}}
7315
7316         This is only half the fix.  The full fix requires parameters to
7317         also be handled in this way.
7318
7319         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7320         makes the use more obvious of the DeclSpace.  The
7321         ec.TypeContainer.TypeBuilder is now only used to pull the
7322         TypeBuilder for it.
7323
7324         My theory is that I can get rid of the TypeBuilder completely from
7325         the EmitContext, and have typecasts where it is used (from
7326         DeclSpace to where it matters).  
7327
7328         The only pending problem is that the code that implements Aliases
7329         is on TypeContainer, and probably should go in DeclSpace.
7330
7331         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7332         lookups here, instead of doing that at parse time.  This means
7333         that our grammar will not introduce `LocalVariableReferences' as
7334         expressions at this point.  That solves the problem of code like
7335         this:
7336
7337         class X {
7338            static void Main ()
7339            { int X = 1;
7340             { X x = null }}}
7341
7342         This is only half the fix.  The full fix requires parameters to
7343         also be handled in this way.
7344
7345         * class.cs (Property.DefineMethod): When implementing an interface
7346         method, set newslot, when implementing an abstract method, do not
7347         set the flag (before we tried never setting it, or always setting
7348         it, which is the difference).
7349         (Indexer.DefineMethod): same.
7350         (Method.DefineMethod): same.
7351
7352         * ecore.cs: Only set the status used flag if we get back a Field.
7353
7354         * attribute.cs: Temporary hack, so Paolo can keep working.
7355
7356 2002-03-08  Ravi Pratap  <ravi@ximian.com>
7357
7358         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7359         the unmanaged type in the case we have a MarshalAs attribute.
7360
7361         (Resolve): Handle the case when we are parsing the special MarshalAs
7362         attribute [we need to store the unmanaged type to use later]
7363         
7364         * typemanager.cs (marshal_as_attr_type): Built in type for the 
7365         MarshalAs Attribute.
7366
7367         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
7368         on parameters and accordingly set the marshalling info.
7369         
7370 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
7371
7372         * class.cs: Optimizing slightly by removing redundant code after
7373         we switched to the `NoTypes' return value.
7374         (Property.DefineMethod): use NoTypes here too.
7375
7376         This fixes the bug I introduced in my last batch of changes.
7377
7378 2002-03-05  Ravi Pratap  <ravi@ximian.com>
7379
7380         * tree.cs (RecordEnum): Add. We now keep track of enums too.
7381
7382         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7383         Enums since those are types too. 
7384
7385         * cs-parser.jay (enum_declaration): Record enums as we parse them.
7386         
7387         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
7388         thanks to a call during the lookup process.
7389
7390 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
7391
7392         * statement.cs (Foreach): Lots of work to accomodate a particular
7393         kind of foreach statement that I had not kept in mind.  It is
7394         possible to have foreachs on classes that provide a GetEnumerator
7395         method that return objects that implement the "pattern" for using
7396         a foreach, there is no need to support GetEnumerator
7397         specifically. 
7398
7399         This is needed to compile nant.
7400
7401         * decl.cs: Only report 114 if the member is not `Finalize' and if
7402         the warning level is at least 2.
7403
7404         * class.cs: Moved the compare function from Method to
7405         MethodSignature. 
7406
7407         (MethodSignature.InheritableMemberSignatureCompare): Add new
7408         filter function that is used to extract inheritable methods from a
7409         class. 
7410
7411         (Method.Define): Use the new `inheritable_method_signature_filter'
7412         delegate
7413
7414         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7415         command. 
7416
7417 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
7418
7419         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7420
7421         * cs-parser.jay: Add opt_semicolon to the interface declaration.
7422
7423         * expression.cs: Pass location information to
7424         ConvertImplicitStandard. 
7425
7426         * class.cs: Added debugging code to track return values from
7427         interfaces. 
7428
7429 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
7430
7431         * expression.cs (Is.DoResolve): If either side of the `is' is an
7432         interface, do not flag the warning.
7433
7434         * ecore.cs (ImplicitReferenceConversion): We need a separate test
7435         for interfaces
7436
7437         * report.cs: Allow for --fatal to be used with --probe.
7438         
7439         * typemanager.cs (NoTypes): Move the definition for the empty Type
7440         array here. 
7441
7442         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7443         properties. 
7444         (TypeContainer.DefineProxy): New function used to proxy to parent
7445         implementations when implementing interfaces.
7446         (TypeContainer.ParentImplements): used to lookup if our parent
7447         implements a public function that is required by an interface.
7448         (TypeContainer.VerifyPendingMethods): Hook this up.
7449
7450         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7451         `modules' and `assemblies' arraylists into arrays.  We only grow
7452         these are the very early start up of the program, so this improves
7453         the speedof LookupType (nicely measured).
7454
7455         * expression.cs (MakeByteBlob): Replaced unsafe code with
7456         BitConverter, as suggested by Paolo.
7457
7458         * cfold.cs (ConstantFold.Binary): Special case: perform constant
7459         folding of string concatenation, but if either side is a string,
7460         and the other is not, then return null, and let the runtime use
7461         the concatenation on the string plus the object (using
7462         `Object.ToString'). 
7463
7464 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
7465
7466         Constant Folding has been implemented now.
7467         
7468         * expression.cs (Unary.Reduce): Do not throw an exception, catch
7469         the error instead on types that are not supported in one's
7470         complement. 
7471
7472         * constant.cs (Constant and all children): New set of functions to
7473         perform implict and explicit conversions.
7474         
7475         * ecore.cs (EnumConstant): Implement the new functions to perform
7476         conversion by proxying to the child expression.
7477
7478         * codegen.cs: (ConstantCheckState): Constant evaluation has its
7479         own separate setting that can not be turned off from the command
7480         line using --unchecked or --checked and is only controlled using
7481         the checked/unchecked statements and expressions.  This setting is
7482         used by the constant folder to flag errors.
7483
7484         * expression.cs (CheckedExpr, UncheckedExpr): Set the
7485         ConstantCheckState as well.   
7486
7487         During Resolve, they also have to flag the state, because the
7488         constant folder runs completely in the Resolve phase.
7489
7490         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7491         well.
7492
7493 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7494
7495         * cfold.cs: New file, this file contains the constant folder.
7496         
7497         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7498         argument to track whether we are using the resulting address to
7499         load or store a value and provide better error messages. 
7500
7501         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7502         new AddressOf arguments.
7503
7504         * statement.cs (Foreach.EmitCollectionForeach): Update
7505
7506         * expression.cs (Argument.Emit): Call AddressOf with proper
7507         arguments to track usage.
7508
7509         (New.DoEmit): Call AddressOf with new arguments.
7510
7511         (Unary.Emit): Adjust AddressOf call.
7512
7513 2002-03-01  Ravi Pratap  <ravi@ximian.com>
7514
7515         * cs-parser.jay (member_access): Change the case for pre-defined types
7516         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
7517         this suggestion.
7518
7519         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7520         a method body.
7521
7522         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7523         essentially like methods and apply attributes like MethodImplOptions to them too.
7524
7525         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7526         not being null.
7527
7528         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7529         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7530         is the DeclSpace.
7531
7532         * Update code everywhere accordingly.
7533
7534         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7535
7536         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7537
7538 2002-02-28  Ravi Pratap  <ravi@ximian.com>
7539
7540         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7541         try performing lookups against those instead of jumping straight into using
7542         the 'using' clauses.
7543
7544         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7545
7546         (LookupType): Perform lookups in implicit parents too.
7547
7548         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7549         sequence as RootContext.LookupType. 
7550
7551         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
7552         the various cases of namespace lookups into this method.
7553
7554 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7555
7556         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7557         in positional arguments)
7558
7559         * class.cs (Operator): Update the AllowedModifiers to contain
7560         extern. 
7561
7562         * cs-parser.jay: Update operator declaration to allow for the
7563         operator body to be empty.
7564
7565         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7566         values. 
7567
7568 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
7569
7570         * class.cs (Method.Emit): Label parameters.
7571
7572         * driver.cs: Return 1 or 0 as the program exit code.
7573
7574 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
7575
7576         * expression.cs: Special case the `null' object when trying to
7577         auto-compute the type, as anything can be explicitly converted to
7578         that. 
7579
7580         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7581         spotting this Paolo.
7582
7583         (Expression.ImplicitNumericConversion): Perform comparissions of
7584         the type using the underlying type in the case of an enumeration
7585         rather than using the enumeration type for the compare.
7586
7587         Cope with the underlying == type case, which is not possible to
7588         catch before. 
7589
7590         (Expression.ConvertNumericExplicit): Perform comparissions of
7591         the type using the underlying type in the case of an enumeration
7592         rather than using the enumeration type for the compare.
7593
7594         * driver.cs: If the user does not supply an extension, assume .exe
7595
7596         * cs-parser.jay (if_statement): Rewrote so that we can track the
7597         location for the if statement.
7598
7599         * expression.cs (Binary.ConstantFold): Only concat strings when
7600         the operation is "+", not everything ;-)
7601
7602         * statement.cs (Statement.EmitBoolExpression): Take a location
7603         argument. 
7604         (If, While, Do): Track location.
7605
7606         * expression.cs (Binary.ResolveOperator): In the object + string
7607         case, I was missing a call to ConvertImplicit
7608
7609 2002-02-25  Ravi Pratap  <ravi@ximian.com>
7610
7611         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7612         Location arguments. Ensure we use RootContext.LookupType to do our work
7613         and not try to do a direct Type.GetType and ModuleBuilder.GetType
7614
7615         * interface.cs (PopulateMethod): Handle the type of the parameter being
7616         null gracefully.
7617
7618         * expression.cs (Invocation.BetterFunction): Handle the case when we 
7619         have a params method with no fixed arguments and a call is made with no
7620         arguments.
7621
7622 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
7623
7624         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7625         the verbatim-string-literal
7626
7627         * support.cs (InternalParameters.ParameterModifier): handle null
7628         fixed parameters.
7629         (InternalParameters.ParameterType): ditto.
7630
7631         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7632         duplicating the name of the variable parameter.
7633         (GetParameterByName): Fix bug where we were not looking up array
7634         paramters if they were the only present (thanks Paolo!).
7635         (GetParameterInfo): We only have an empty set of types if both
7636         fixed and array are set to null.
7637         (GetParameterInfo-idx): Handle FixedParameter == null
7638
7639         * cs-parser.jay: Handle the case where there is no catch
7640         statements (missing null test).
7641
7642 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
7643
7644         * driver.cs (MainDriver): Be conservative on our command line
7645         handling.
7646
7647         Catch DirectoryNotFoundException when calling GetFiles.
7648         
7649         (SplitPathAndPattern): Used to split the input specification into
7650         a path and a pattern that we can feed to Directory.GetFiles.
7651
7652 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
7653
7654         * statement.cs (Fixed): Implement the last case of the Fixed
7655         statement (string handling).
7656
7657         * expression.cs (StringPtr): New class used to return a char * to
7658         a string;  Used by the Fixed statement.
7659
7660         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
7661
7662         * expression.cs (Binary.ResolveOperator): Remove redundant
7663         MemberLookup pn parent type.
7664         Optimize union call, we do not need a union if the types are the same.
7665         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7666         type.
7667
7668         Specialize the use of MemberLookup everywhere, instead of using
7669         the default settings. 
7670
7671         (StackAlloc): Implement stackalloc keyword.
7672
7673         * cs-parser.jay: Add rule to parse stackalloc.
7674         
7675         * driver.cs: Handle /h, /help, /?
7676
7677         * expression.cs (MakeByteBlob): Removed the hacks we had in place
7678         before we supported unsafe code.
7679         
7680         * makefile: add --unsafe to the self compilation of mcs.
7681
7682 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
7683
7684         * expression.cs (PointerArithmetic): New class that is used to
7685         perform pointer arithmetic.
7686         (Binary.Resolve): Handle pointer arithmetic
7687         Handle pointer comparission.
7688         (ArrayPtr): Utility expression class that is used to take the
7689         address of an array.
7690
7691         (ElementAccess): Implement array access for pointers
7692         
7693         * statement.cs (Fixed): Implement fixed statement for arrays, we
7694         are missing one more case before we are done.
7695
7696         * expression.cs (Indirection): Implement EmitAssign and set the
7697         ExprClass to Variable.  This allows pointer dereferences to be
7698         treated as variables, and to have values assigned to them.
7699         
7700         * ecore.cs (Expression.StoreFromPtr): New utility function to
7701         store values dereferencing.
7702
7703 2002-02-20  Ravi Pratap  <ravi@ximian.com>
7704
7705         * expression.cs (Binary.ResolveOperator): Ensure that we are
7706         not trying to operate on a void type - this fixes the reported
7707         bug.
7708
7709         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7710         the parent implementation is sealed.
7711
7712         * ../errors/cs0239.cs : Add.
7713
7714         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7715
7716         * typemanager.cs (unverifiable_code_type): Corresponds to 
7717         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7718         which have unsafe code in them.
7719
7720         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
7721         unsafe context.
7722
7723 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
7724
7725         * cs-tokenizer.cs: Add support for @"litreal strings"
7726
7727         Make tokenizer accept pre-processor directives
7728         on any column (remove the old C-like limitation). 
7729
7730         * rootcontext.cs (EmitCode): Emit any global attributes.
7731         (AddGlobalAttributes): Used to keep track of assembly attributes. 
7732
7733         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7734
7735         * cs-parser.jay: Add support for global attributes.  
7736
7737 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
7738
7739         * expression.cs (Indirection): New helper class.  Unary will
7740         create Indirection classes to be able to implement the
7741         IMemoryLocation interface on it.
7742
7743 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
7744
7745         * cs-parser.jay (fixed_statement): reference the right statement.
7746
7747         * statement.cs (Fixed.Emit): Finish implementing the fixed
7748         statement for the &x case.
7749
7750 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
7751
7752         * class.cs (Property.Define, Method.Define): Remove newslot when
7753         `implementing'.  
7754
7755         * modifiers.cs: My use of NewSlot when `Abstract' was set was
7756         wrong.  NewSlot should only be used if the `new' keyword is present.
7757
7758         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7759         locating our system dir.  Sorry about this.
7760
7761 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7762
7763         * driver.cs (GetSystemDir): Compute correctly the location of our
7764         system assemblies.  I was using the compiler directory instead of
7765         the library directory.
7766
7767 2002-02-13  Ravi Pratap  <ravi@ximian.com>
7768
7769         * expression.cs (BetterFunction): Put back in what Miguel commented out
7770         since it is the correct fix. The problem is elsewhere ;-)
7771
7772         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7773         parameters of the parms method are themselves compatible or not !
7774
7775         (StandardConversionExists): Fix very dangerous bug where we were forgetting
7776         to check that a class implements an interface before saying that an implicit
7777         conversion was allowed. Use ImplementsInterface to do the checking.
7778
7779 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7780
7781         * class.cs (Method.Define): Track whether we are an explicit
7782         implementation or not.  And only call DefineMethodOverride if we
7783         are an explicit implementation.
7784
7785         (Property.DefineMethod): Ditto.
7786
7787 2002-02-11  Ravi Pratap  <ravi@ximian.com>
7788
7789         * expression.cs (BetterFunction): Catch hideous bug which was
7790          preventing us from detecting ambiguous calls due to implicit casts i.e
7791         cs0121.
7792
7793 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
7794
7795         * support.cs (Pair): Remove un-needed method.  I figured why I was
7796         getting the error in cs-parser.jay, the variable in a foreach loop
7797         is readonly, and the compiler does not really treat this as a variable.
7798
7799         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
7800         instead of EQUALS in grammar.  
7801
7802         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7803
7804         * expression.cs (Unary.DoResolve): Check whether the argument is
7805         managed or not.
7806
7807 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
7808
7809         * support.cs: Api for Pair to set a value.  Despite the fact that
7810         the variables are public the MS C# compiler refuses to compile
7811         code that accesses the field if the variable is part of a foreach
7812         statement. 
7813
7814         * statement.cs (Fixed): Begin implementation of the fixed
7815         statement.
7816
7817         (Block.AddVariable): Return the VariableInfo on success and null
7818         on failure instead of true/false. 
7819
7820         * cs-parser.jay (foreach): Catch errors on variables already
7821         defined (we were ignoring this value before) and properly unwind
7822         the block hierarchy
7823
7824         (fixed_statement): grammar for the fixed statement.
7825
7826 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
7827
7828         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7829         pointer types to be incretemented.
7830
7831         (SizeOf): Implement.
7832
7833         * cs-parser.jay (pointer_member_access): Implement
7834         expr->IDENTIFIER production.
7835
7836         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7837         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7838         on safe contexts.
7839
7840         (Unary): Implement indirection.
7841
7842         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7843         use in non-unsafe context).
7844
7845         (SimpleName.DoResolve): Check for pointers in field access on safe
7846         contexts. 
7847
7848         (Expression.LoadFromPtr): Factor the load-indirect code in this
7849         function.  This was duplicated in UnboxCast and ParameterReference
7850
7851 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
7852
7853         * expression.cs (ComposedCast): report an error if a pointer cast
7854         is used in a safe region.
7855
7856         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7857         pointer type casts in unsafe context.
7858
7859         * codegen.cs (EmitContext): Set up IsUnsafe.
7860
7861         * cs-parser.jay (non_expression_type): Add productions for pointer
7862         casts. 
7863
7864         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7865         code.  We should not use force into static mode if the method is
7866         not virtual.  Fixes bug in MIS
7867
7868         * statement.cs (Do.Emit, While.Emit, For.Emit,
7869         Statement.EmitBoolExpression): Add support to Do and While to
7870         propagate infinite loop as `I do return' semantics.
7871
7872         Improve the For case to also test for boolean constants.
7873
7874         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7875         to the list of attributes we can add.
7876
7877         Remove `EmitContext' argument.
7878
7879         * class.cs (Method.Define): Apply parameter attributes.
7880         (Constructor.Define): Apply parameter attributes.
7881         (MethodCore.LabelParameters): Move here the core of labeling
7882         parameters. 
7883
7884         * support.cs (ReflectionParameters.ParameterModifier,
7885         InternalParameters.ParameterModifier): Use IsByRef on the type and
7886         only return the OUT bit for these parameters instead of in/out/ref
7887         flags.
7888
7889         This is because I miss-understood things.  The ParameterInfo.IsIn
7890         and IsOut represent whether the parameter has the [In] and [Out]
7891         attributes set.  
7892
7893 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
7894
7895         * ecore.cs (FieldExpr.Emit): Release temporaries.
7896
7897         * assign.cs (LocalTemporary.Release): new function.
7898
7899         * codegen.cs (EmitContext.GetTemporaryStorage,
7900         EmitContext.FreeTemporaryStorage): Rework the way we deal with
7901         temporary storage.  Now we can "put back" localbuilders when we
7902         are done with them
7903
7904 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
7905
7906         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7907         need to make a copy of the variable to generate verifiable code.
7908
7909 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
7910
7911         * driver.cs: Compute dynamically the system directory.
7912
7913         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7914         Slower, but more generally useful.  Used by the abstract
7915         registering implementation. 
7916
7917         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7918         the rules for the special rule on Type/instances.  First check if
7919         we have the same name, and if so, try that special static path
7920         rather than the instance path.
7921         
7922 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
7923
7924         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7925         for, while and if.
7926
7927         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7928         Enum, ValueType, Delegate or Array for non-corlib compiles.
7929
7930         * cs-tokenizer.cs: Catch long identifiers (645)
7931
7932         * typemanager.cs (IndexerPropetyName): Ravi never tested this
7933         piece of code.
7934
7935         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7936         fix, we were returning too early, so we were not registering
7937         pending methods from abstract classes.
7938
7939         Do not register pending methods if the class is abstract.
7940
7941         * expression.cs (Conditional.DoResolve): Report circular implicit
7942         conversions when we neecd to compute it for conditional
7943         expressions. 
7944
7945         (Is.DoResolve): If the expression is always of the provided type,
7946         flag warning 183.  If the expression can not ever be of the
7947         provided type flag warning 184.
7948
7949         * class.cs: Catch 169 as well.
7950
7951         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7952         read. 
7953
7954 2002-01-18  Nick Drochak  <ndrochak@gol.com>
7955
7956         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
7957
7958 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
7959
7960         * interface.cs: (PopulateMethod): Check for pointers being defined
7961         only if the unsafe context is active.
7962         (PopulateProperty): ditto.
7963         (PopulateIndexer): ditto.
7964
7965         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7966         specified.  If pointers are present, make sure that they are
7967         present in an unsafe context.
7968         (Constructor, Constructor.Define): ditto.
7969         (Field, Field.Define): ditto.
7970         (Property, Property.Define): ditto.
7971         (Event, Event.Define): ditto.
7972
7973         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7974         hashtable if there are classes or structs defined.
7975
7976         * expression.cs (LocalVariableReference.DoResolve): Simplify this
7977         code, as the constant resolution moved.
7978
7979         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7980         the metadata, so we can flag error 133. 
7981
7982         * decl.cs (MemberCore.UnsafeOK): New function to test that a
7983         pointer is being declared in an unsafe context.
7984
7985 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
7986
7987         * modifiers.cs (Modifiers.Check): Require a Location argument.
7988         Report error 227 for Unsafe use.
7989
7990         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7991
7992         * statement.cs (For.Emit): If the test is null, then report that
7993         we do `return', as we wont reach anything afterwards.
7994
7995         (Switch.SwitchGoverningType): Track the expression that matched
7996         the conversion.
7997
7998         * driver.cs: Allow negative numbers as an error code to flag.
7999
8000         * cs-parser.jay: Handle 1551.
8001
8002         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
8003
8004 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8005
8006         * cs-parser.jay: Report 1518 (type declaration can only contain
8007         class, struct, interface, enum or delegate)
8008
8009         (switch_label): Report 1523 (keywords `case' or `default' must
8010         preced code)
8011
8012         (opt_switch_sections): Report 1522 (empty switch)
8013
8014         * driver.cs: Report 1515 (response file specified multiple times)
8015         Report 1516 (Source file specified multiple times).
8016
8017         * expression.cs (Argument.Resolve): Signal 1510
8018
8019         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
8020         access not allowed in static code)
8021
8022 2002-01-11  Ravi Pratap  <ravi@ximian.com>
8023
8024         * typemanager.cs (IsPointerType): Utility method which we are going
8025         to need a lot.
8026
8027         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
8028         the object type, so we take care of that.
8029
8030         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
8031         
8032         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
8033         added to non-params parameters :-)
8034
8035         * typemanager.cs (CSharpName): Include 'void' type too. 
8036
8037         (void_ptr_type): Include in the set of core types.
8038
8039         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
8040         duplicating code.
8041
8042         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
8043         an unsafe context.
8044
8045         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
8046         completely forgotten about it.
8047
8048 2002-01-10  Ravi Pratap  <ravi@ximian.com>
8049
8050         * cs-parser.jay (pointer_type): Add. This begins our implementation
8051         of parsing rules for unsafe code.
8052
8053         (unsafe_statement): Implement.
8054
8055         (embedded_statement): Modify to include the above.
8056
8057         * statement.cs (Unsafe): Implement new class for unsafe blocks.
8058
8059         * codegen.cs (EmitContext.InUnsafe): Add. This determines
8060         if the current context is an unsafe one.
8061
8062         * cs-parser.jay (local_variable_pointer_type): Since local variable types
8063         are handled differently, we need separate rules for them.
8064
8065         (local_variable_declaration): Update to use local_variable_pointer_type
8066         to allow variable declarations of unmanaged pointer types.
8067
8068         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
8069         in unsafe contexts.
8070
8071         * ../errors/cs0214.cs : Add.
8072
8073 2002-01-16  Nick Drochak  <ndrochak@gol.com>
8074
8075         * makefile: remove 'response' file when cleaning.
8076
8077 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8078
8079         * cs-parser.jay: Report 1524.
8080
8081 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
8082
8083         * typemanager.cs (RegisterMethod): drop checking if we have
8084         registered this from here
8085
8086 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
8087
8088         * class.cs (Method.EmitDestructor): Implement calling our base
8089         destructor. 
8090
8091         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
8092         value of InFinally.
8093
8094         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
8095         this routine and will wrap the call in a try/catch block.  Deal
8096         with the case.
8097
8098 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
8099
8100         * ecore.cs (Expression.MemberLookup): instead of taking a
8101         parameter `same_type' that was used to tell whether we could
8102         access private members we compute our containing type from the
8103         EmitContext.
8104
8105         (FieldExpr): Added partial support for volatile fields.  This does
8106         not work for volatile fields exposed from assemblies, as I can not
8107         figure out how to extract the modreq from it.
8108
8109         Updated all the source files to use this.
8110
8111         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
8112         because it is referenced by MemberLookup very often. 
8113
8114 2002-01-09  Ravi Pratap  <ravi@ximian.com>
8115
8116         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8117         TypeBuilder.GetCustomAttributes to retrieve what we need.
8118
8119         Get rid of redundant default_member_attr_type as this is the same as
8120         default_member_type which already exists.
8121
8122         * interface.cs, attribute.cs : Update accordingly.
8123         
8124 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
8125
8126         * typemanager.cs: Enable IndexerPropertyName again.  It does not
8127         work for TYpeBuilders though.  Ravi, can you please fix this?
8128
8129         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8130
8131         * expression.cs (Argument.Emit): Handle the case of ref objects
8132         being passed to ref functions;  
8133
8134         (ParameterReference.EmitLoad): Loads the content of the pointer
8135         without dereferencing.
8136
8137 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8138
8139         * cs-tokenizer.cs: Implemented the pre-processing expressions.
8140
8141 2002-01-08  Ravi Pratap  <ravi@ximian.com>
8142
8143         * class.cs (Indexer.DefineMethod): Incorporate the interface
8144         type in the name of the method if we are doing explicit interface
8145         implementation.
8146
8147         * expression.cs (ConversionExists): Remove as it is completely obsolete.
8148
8149         (BetterConversion): Fix extremely trivial bug where we were referring to
8150         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8151         again !
8152
8153         * ../errors/bug16.cs : Add although we have fixed it.
8154
8155 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8156
8157         * expression.cs (BaseIndexer): Begin implementation.
8158
8159         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8160
8161         * cs-parser.jay (indexer_declarator): Use qualified_identifier
8162         production directly to remove a shift/reduce, and implement
8163         explicit interface implementation.
8164
8165         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8166         after a floating point suffix.
8167
8168         * expression.cs (DoNumericPromotions): Improved the conversion for
8169         uint/uint.  If we have a constant, we avoid doing a typecast to a
8170         larger type.
8171
8172         * class.cs (Indexer): Implement explicit interface implementation
8173         for indexers.
8174         
8175 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8176
8177         * class.cs: make the default instance constructor public and hidebysig.
8178
8179 2001-01-03  Ravi Pratap  <ravi@ximian.com>
8180
8181         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8182         so we can call it from elsewhere.
8183
8184         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8185         we emit it internally if the class has a defined indexer; otherwise the user
8186         emits it by decorating the class definition with the DefaultMemberAttribute.
8187
8188         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8189         attribute is not used on a type which defines an indexer.
8190
8191         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8192         character when we skip whitespace.
8193
8194         * ../errors/cs0646.cs : Add.
8195
8196 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
8197
8198         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8199         again. 
8200
8201         * makefile: Add practical target `mcs3.exe' which builds the third
8202         generation compiler. 
8203
8204         * expression.cs (New): Fix structures constructor calling.
8205
8206         * class.cs (Property, Method, Indexer): Emit Final flag on the
8207         method if we are an interface implementation and we are not
8208         abstract. 
8209
8210         * ecore.cs (PropertyExpr): New public field `IsBase', tells
8211         whether this property is referencing a `base' method.
8212
8213         * expression.cs (Invocation.EmitCall): take an extra argument:
8214         is_base, this is used to determine whether the `call' or
8215         `callvirt' opcode should be used.
8216
8217         
8218         * delegate.cs: update EmitCall.
8219
8220         * class.cs (Method.Define): Set NewSlot for the cases where we are
8221         not implementing an interface method.
8222
8223         (Property.Define): ditto.
8224
8225 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
8226
8227         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
8228         'r'.  Allows mcs to parse itself fully.
8229
8230 2002-01-02  Ravi Pratap  <ravi@ximian.com>
8231
8232         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8233         of the number of initializers that require the InitializeArray method.
8234
8235         (CheckIndices): Store the Expression in all cases - not the plain value. Also
8236         update the above field where necessary.
8237
8238         (MakeByteBlob): Update accordingly.
8239
8240         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
8241         greater than 2.
8242
8243         (EmitDynamicInitializers): Update in accordance with the new optimization.
8244
8245         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8246         same OpCode applies.
8247
8248         * cs-parser.jay : Fix some glaring errors I introduced.
8249
8250 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
8251
8252         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8253         so that we can check for name clashes there too.
8254
8255         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8256         for interface indexers.
8257
8258         * interfaces.cs (Define): Emit the default member attribute.
8259
8260         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8261         variable was being referred to while setting the value ;-)
8262
8263 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
8264
8265         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8266         byte-by-byte information when we know the data is zero.
8267
8268         Make the block always a multiple of 4, because
8269         DefineInitializedData has a bug.
8270
8271         * assign.cs: Fix, we should assign from the temporary, not from
8272         the source. 
8273
8274         * expression.cs (MakeByteBlob): Fix my incorrect code.
8275
8276 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
8277
8278         * typemanager.cs (EnumToUnderlying): This function is used to get
8279         the underlying type from an enumeration, because it does not
8280         always work. 
8281
8282         * constant.cs: Use the I4_S form for values between -128 and 127.
8283
8284         * statement.cs (Block.LookupLabel): Looks up a label.
8285         (Block): Drop support for labeled blocks.
8286
8287         (LabeledStatement): New kind of statement that represents a label
8288         only.
8289
8290         (Goto): Finally implement this bad boy.
8291         
8292         * cs-parser.jay: Update to reflect new mechanism to implement
8293         labels.
8294
8295 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
8296
8297         * codegen.cs (EmitContext.This): a codegen property that keeps the
8298         a single instance of this instead of creating many different this
8299         instances. 
8300
8301         * delegate.cs (Delegate.DoResolve): Update to use the property;
8302
8303         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8304
8305         * expression.cs (BaseAccess.DoResolve): Ditto.
8306
8307 2001-12-29  Ravi Pratap  <ravi@ximian.com>
8308
8309         * typemanager.cs (methodimpl_attr_type): Add to hold the type
8310         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8311
8312         (InitCoreTypes): Update accordingly.
8313
8314         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8315         so we can quickly store the state.
8316
8317         (ApplyAttributes): Set the correct implementation flags
8318         for InternalCall methods.
8319
8320 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
8321
8322         * expression.cs (EmitCall): if a method is not virtual, then do
8323         not use callvirt on it.
8324
8325         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8326         user defined stuff) requires the use of stobj, which takes an
8327         address on the stack instead of an array and an index.  So emit
8328         the Ldelema operation for it.
8329
8330         (EmitStoreOpcode): Use stobj for valuetypes.
8331
8332         (UnaryMutator.EmitCode): Use the right 1 value depending on
8333         whether we are dealing with int64/uint64, float or doubles.
8334
8335         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8336         constructors that I implemented last night.
8337
8338         (Constructor.IsDefault): Fix to work properly for static
8339         constructors.
8340
8341         * cs-parser.jay (CheckDef): report method signature errors.
8342         Update error number 103 to be 132.
8343
8344         * decl.cs: New AdditionResult enumeration value: MethodExists.
8345         Although we do this check for methods later on in the semantic
8346         analysis, catching repeated default constructors is so easy that
8347         we catch these here. 
8348         
8349         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8350         promotions code.
8351
8352         (ParameterReference.EmitAssign, Emit): handle
8353         bools as bytes.
8354
8355         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8356         (ArrayAccess.EmitStoreOpcode): ditto.
8357
8358         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8359
8360         * expression.cs (MakeByteBlob): Complete all the missing types
8361         (uint, short, ushort, byte, sbyte)
8362
8363         * class.cs: Only init instance field initializers on instance
8364         constructors. 
8365
8366         Rename `constructors' to instance_constructors. 
8367
8368         (TypeContainer.AddConstructor): Only add constructors to the list
8369         if it is not static.
8370
8371         Make sure that we handle default_static_constructor independently
8372         everywhere where we handle instance_constructors
8373
8374 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
8375
8376         * class.cs: Do not lookup or create a base initializer for a
8377         static constructor.
8378
8379         (ConstructorInitializer.Resolve): use the proper type to lookup
8380         for constructors.
8381
8382         * cs-parser.jay: Report error 1585 (modifiers between type and name).
8383
8384         * enum.cs, interface.cs: Remove CloseType, this is taken care by
8385         in DeclSpace. 
8386
8387         * decl.cs: CloseType is now an virtual method, the default
8388         implementation just closes this type.
8389         
8390 2001-12-28  Ravi Pratap  <ravi@ximian.com>
8391
8392         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8393         to PreserveSig by default. Also emit HideBySig on such methods.
8394
8395         Basically, set the defaults to standard values.
8396
8397         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8398         argument, if candidate is better, it can't be worse than the best !
8399
8400         (Invocation): Re-write bits to differentiate between methods being
8401         applicable in their expanded form and their normal form - for params
8402         methods of course.
8403
8404         Get rid of use_standard everywhere as only standard conversions are allowed
8405         in overload resolution. 
8406
8407         More spec conformance.
8408         
8409 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8410
8411         * driver.cs: Add --timestamp, to see where the compiler spends
8412         most of its time.
8413
8414         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8415         `this' in static code.
8416
8417         (SimpleName.DoResolve): Implement in terms of a helper function
8418         that allows static-references to be passed upstream to
8419         MemberAccess.
8420
8421         (Expression.ResolveWithSimpleName): Resolve specially simple
8422         names when called by MemberAccess to implement the special
8423         semantics. 
8424
8425         (Expression.ImplicitReferenceConversion): Handle conversions from
8426         Null to reference types before others, as Null's type is
8427         System.Object. 
8428
8429         * expression.cs (Invocation.EmitCall): Handle the special case of
8430         calling methods declared on a reference type from a ValueType
8431         (Base classes System.Object and System.Enum)
8432
8433         (MemberAccess.Resolve): Only perform lookups on Enumerations if
8434         the left hand side is a TypeExpr, not on every enumeration. 
8435
8436         (Binary.Resolve): If types are reference types, then do a cast to
8437         object on operators != and == of both arguments.
8438         
8439         * typemanager.cs (FindMembers): Extract instance and static
8440         members if requested.
8441
8442         * interface.cs (PopulateProperty): Use void_type instead of null
8443         as the return type for the setter method.
8444
8445         (PopulateIndexer): ditto.
8446
8447 2001-12-27  Ravi Pratap  <ravi@ximian.com>
8448
8449         * support.cs (ReflectionParameters): Fix minor bug where we
8450         were examining the wrong parameter for the ParamArray attribute.
8451
8452         Cope with requests for the type of the parameter at position
8453         greater than the params parameter's. We now return the element
8454         type of the params array as that makes more sense.
8455
8456         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
8457         accordingly as we no longer have to extract the element type
8458         ourselves.
8459
8460         (Invocation.OverloadResolve): Update.
8461
8462 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8463
8464         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8465         against IEnumerator, test whether the return value is a descendant
8466         of the IEnumerator interface.
8467
8468         * class.cs (Indexer.Define): Use an auxiliary method to implement
8469         the other bits of the method definition.  Begin support for
8470         explicit interface implementation.
8471
8472         (Property.DefineMethod): Use TypeManager.void_type instead of null
8473         for an empty return value.
8474
8475 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
8476
8477         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8478         dealing with a FieldExpr which is composed of a FieldBuilder, in
8479         the code path we did extract the constant, but we should have
8480         obtained the underlying value to be able to cast it (otherwise we
8481         end up in an infinite loop, this is what Ravi was running into).
8482
8483         (ArrayCreation.UpdateIndices): Arrays might be empty.
8484
8485         (MemberAccess.ResolveMemberAccess): Add support for section
8486         14.5.4.1 that deals with the special case of E.I when E is a type
8487         and something else, that I can be a reference to a static member.
8488
8489         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8490         handle a particular array type to create byte blobs, it is just
8491         something we dont generate byteblobs for.
8492
8493         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8494         arguments. 
8495
8496         * location.cs (Push): remove the key from the hashtable that we
8497         are about to add.   This happens for empty files.
8498
8499         * driver.cs: Dispose files after we have parsed them.
8500
8501         (tokenize): new function that only runs the tokenizer on its
8502         input, for speed testing.
8503
8504 2001-12-26  Ravi Pratap  <ravi@ximian.com>
8505
8506         * class.cs (Event.Define): Define the private field only if there
8507         are no accessors defined.
8508
8509         * expression.cs (ResolveMemberAccess): If there is no associated
8510         field with the event, that means we have an event defined with its
8511         own accessors and we should flag error cs0070 since transforming
8512         ourselves into a field is not valid in that case.
8513
8514         * ecore.cs (SimpleName.DoResolve): Same as above.
8515
8516         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8517         and charset to sane values.
8518
8519 2001-12-25  Ravi Pratap  <ravi@ximian.com>
8520
8521         * assign.cs (DoResolve): Perform check on events only if they 
8522         are being accessed outside the declaring type.
8523
8524         * cs-parser.jay (event_declarations): Update rules to correctly
8525         set the type of the implicit parameter etc.
8526
8527         (add_accessor, remove_accessor): Set current local parameters.
8528
8529         * expression.cs (Binary): For delegate addition and subtraction,
8530         cast the return value from the method into the appropriate delegate
8531         type.
8532
8533 2001-12-24  Ravi Pratap  <ravi@ximian.com>
8534
8535         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8536         of these as the workaround is unnecessary.
8537
8538         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8539         delegate data - none of that is needed at all.
8540
8541         Re-write bits to extract the instance expression and the delegate method
8542         correctly.
8543
8544         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
8545         on delegates too.
8546
8547         * attribute.cs (ApplyAttributes): New method to take care of common tasks
8548         of attaching attributes instead of duplicating code everywhere.
8549
8550         * everywhere : Update code to do attribute emission using the above method.
8551
8552 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8553
8554         * expression.cs (IsParamsMethodApplicable): if there are not
8555         parameters, return immediately.
8556
8557         * ecore.cs: The 0 literal can be implicity converted to an enum
8558         type. 
8559
8560         (SimpleName.DoResolve): First lookup the type, then lookup the
8561         members. 
8562
8563         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8564         want to get its address.  If the InstanceExpression is not
8565         addressable, store the result in a temporary variable, then get
8566         the address of it.
8567
8568         * codegen.cs: Only display 219 errors on warning level or above. 
8569
8570         * expression.cs (ArrayAccess): Make it implement the
8571         IMemoryLocation interface.
8572
8573         (Binary.DoResolve): handle the operator == (object a, object b)
8574         and operator != (object a, object b) without incurring into a
8575         BoxedCast (because 5 != o should never be performed).
8576
8577         Handle binary enumerator operators.
8578
8579         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8580         value type, otherwise use Ldelem_ref.
8581
8582         Use precomputed names;
8583
8584         (AddressOf): Implement address of
8585
8586         * cs-parser.jay (labeled_statement): Fix recursive block
8587         addition by reworking the production.
8588
8589         * expression.cs (New.DoEmit): New has a special case:
8590                 
8591                  If we are dealing with a ValueType, we have a few
8592                  situations to deal with:
8593                 
8594                     * The target of New is a ValueType variable, that is
8595                       easy, we just pass this as the variable reference
8596                 
8597                     * The target of New is being passed as an argument,
8598                       to a boxing operation or a function that takes a
8599                       ValueType.
8600                 
8601                       In this case, we need to create a temporary variable
8602                       that is the argument of New.
8603
8604
8605 2001-12-23  Ravi Pratap  <ravi@ximian.com>
8606
8607         * rootcontext.cs (LookupType): Check that current_type is not null before
8608         going about looking at nested types.
8609
8610         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8611         not implement the IAssignMethod interface any more.
8612
8613         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8614         where we tranform them into FieldExprs if they are being resolved from within
8615         the declaring type.
8616
8617         * ecore.cs (SimpleName.DoResolve): Do the same here.
8618
8619         * assign.cs (DoResolve, Emit): Clean up code considerably. 
8620
8621         * ../errors/bug10.cs : Add.
8622
8623         * ../errors/cs0070.cs : Add.
8624
8625         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8626
8627         * assign.cs : Get rid of EventIsLocal everywhere.
8628         
8629 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8630
8631         * ecore.cs (ConvertIntLiteral): finished the implementation.
8632
8633         * statement.cs (SwitchLabel): Convert the value we are using as a
8634         key before looking up the table.
8635
8636 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8637
8638         * codegen.cs (EmitTopBlock): Require a Location argument now.
8639
8640         * cs-parser.jay (constructor_declarator): We need to setup
8641         current_local_parameters before we parse the
8642         opt_constructor_initializer, to allow the variables to be bound
8643         to the constructor arguments.
8644
8645         * rootcontext.cs (LookupType): First lookup nested classes in our
8646         class and our parents before we go looking outside our class.
8647
8648         * expression.cs (ConstantFold): Extract/debox the values at the
8649         beginnning. 
8650
8651         * rootcontext.cs (EmitCode): Resolve the constants first before we
8652         resolve the types.  This is not really needed, but it helps debugging.
8653
8654         * statement.cs: report location.
8655         
8656         * cs-parser.jay: pass location to throw statement.
8657
8658         * driver.cs: Small bug fix.
8659
8660         * report.cs: Updated format to be 4-zero filled digits.
8661
8662 2001-12-22  Ravi Pratap  <ravi@ximian.com>
8663
8664         * expression.cs (CheckIndices): Fix minor bug where the wrong
8665         variable was being referred to ;-)
8666
8667         (DoEmit): Do not call EmitStaticInitializers when the 
8668         underlying type is System.Object.
8669
8670 2001-12-21  Ravi Pratap  <ravi@ximian.com>
8671
8672         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8673         and do the usual workaround for SRE.
8674
8675         * class.cs (MyEventBuilder.EventType): New member to get at the type
8676         of the event, quickly.
8677
8678         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8679
8680         * assign.cs (Assign.DoResolve): Handle the case when the target
8681         is an EventExpr and perform the necessary checks.
8682
8683         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8684         interface.
8685
8686         (SimpleName.MemberStaticCheck): Include check for EventExpr.
8687
8688         (EventExpr): Set the type in the constructor itself since we 
8689         are meant to be born fully resolved.
8690
8691         (EventExpr.Define): Revert code I wrote earlier.
8692                 
8693         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8694         instance expression is null. The instance expression is a This in that case
8695         or a null, depending on whether it is a static method or not.
8696
8697         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8698         refers to more than one method.
8699
8700         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8701         and accordingly flag errors.
8702
8703 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8704
8705         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8706
8707 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8708
8709         * location.cs (ToString): Provide useful rutine.
8710
8711 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8712
8713         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8714         objects, return the actual integral boxed.
8715
8716         * statement.cs (SwitchLabel): define an ILLabel for each
8717         SwitchLabel. 
8718         
8719         (Switch.CheckSwitch): If the value is a Literal, extract
8720         the underlying literal.
8721         
8722         Also in the unused hashtable we had, add the SwitchLabel so we can
8723         quickly look this value up.
8724
8725         * constant.cs: Implement a bunch of new constants.  Rewrite
8726         Literal based on this.  Made changes everywhere to adapt to this.
8727         
8728         * expression.cs (Expression.MakeByteBlob): Optimize routine by
8729         dereferencing array only once, and also copes with enumrations.
8730
8731         bytes are two bytes wide, not one.
8732
8733         (Cast): Perform constant conversions.
8734         
8735         * ecore.cs (TryImplicitIntConversion): Return literals instead of
8736         wrappers to the literals here.
8737
8738         * expression.cs (DoNumericPromotions): long literals can converted
8739         to ulong implicity (this is taken care of elsewhere, but I was
8740         missing this spot).
8741
8742         * ecore.cs (Expression.Literalize): Make the return type Literal,
8743         to improve type checking.
8744
8745         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8746
8747 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8748
8749         * literal.cs: Revert code from ravi that checked the bounds.  The
8750         bounds are sane by the definition of the type itself. 
8751
8752         * typemanager.cs: Fix implementation of ImplementsInterface.  We
8753         need to actually look up in our parent hierarchy for interfaces
8754         implemented. 
8755
8756         * const.cs: Use the underlying type for enumerations
8757
8758         * delegate.cs: Compute the basename for the delegate creation,
8759         that should fix the delegate test case, and restore the correct
8760         Type Lookup semantics in rootcontext
8761
8762         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
8763         referencing a nested type with the Reflection API is using the "+"
8764         sign. 
8765
8766         * cs-parser.jay: Do not require EOF token at the end.
8767
8768 2001-12-20  Ravi Pratap  <ravi@ximian.com>
8769
8770         * rootcontext.cs (LookupType): Concatenate type names with
8771         a '.' instead of a '+' The test suite passes again.
8772
8773         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8774         field of the enumeration.
8775
8776         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8777         the case when the member is an EventExpr.
8778
8779         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8780         static has an associated instance expression.
8781
8782         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8783
8784         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8785
8786         * class.cs (Event.Define): Register event and perform appropriate checks
8787         for error #111.
8788
8789         We define the Add and Remove methods even if the use provides none because
8790         in that case, we provide default implementations ourselves.
8791
8792         Define a private field of the type of the event. This is done by the CSC compiler
8793         and we should be doing it too ;-)
8794
8795         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8796         More methods we use in code we generate.
8797
8798         (multicast_delegate_type, delegate_type): Two separate types since the distinction
8799         is important.
8800
8801         (InitCoreTypes): Update accordingly for the above.
8802
8803         * class.cs (Event.Emit): Generate code for default accessors that we provide
8804
8805         (EmitDefaultMethod): Do the job in the above.
8806
8807         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
8808         appropriate place.
8809
8810 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8811
8812         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8813         builders even if we were missing one.
8814
8815         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8816         pass the Basename as our class name instead of the Name.  The
8817         basename will be correctly composed for us.
8818
8819         * parameter.cs (Paramters): Now takes a Location argument.
8820
8821         * decl.cs (DeclSpace.LookupType): Removed convenience function and
8822         make all the code call directly LookupType in RootContext and take
8823         this chance to pass the Location information everywhere.
8824
8825         * Everywhere: pass Location information.
8826
8827 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
8828
8829         * class.cs (Constructor.Define): Updated way of detecting the
8830         length of the parameters.
8831
8832         (TypeContainer.DefineType): Use basename as the type name for
8833         nested types.
8834
8835         (TypeContainer.Define): Do not recursively define types here, as
8836         definition is taken care in order by the RootContext.
8837
8838         * tree.cs: Keep track of namespaces in a per-file basis.
8839
8840         * parameter.cs (Parameter.ComputeSignature): Update to use
8841         DeclSpace. 
8842
8843         (Parameters.GetSignature): ditto.
8844
8845         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8846         instead of a TypeContainer.
8847
8848         (Interface.SemanticAnalysis): Use `this' instead of our parent to
8849         resolve names.  Because we need to be resolve in our context, not
8850         our parents.
8851         
8852         * driver.cs: Implement response files.
8853
8854         * class.cs (TypeContainer.DefineType): If we are defined, do not
8855         redefine ourselves.
8856         
8857         (Event.Emit): Emit the code for add/remove handlers.
8858         (Event.Define): Save the MethodBuilders for add/remove.
8859
8860         * typemanager.cs: Use pair here too.
8861
8862         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8863         DictionaryEntry requires the first argument to be non-null.  
8864         
8865         (enum_declaration): Compute full name for registering the
8866         enumeration.
8867         
8868         (delegate_declaration): Instead of using
8869         formal_parameter_list, use opt_formal_parameter_list as the list
8870         can be empty.
8871
8872         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8873         (EventParsing): New property that controls whether `add' and
8874         `remove' are returned as tokens or identifiers (for events);
8875
8876 2001-12-19  Ravi Pratap  <ravi@ximian.com>
8877
8878         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8879         use MyEventBuilder only and let it wrap the real builder for us.
8880
8881         (MyEventBuilder): Revamp constructor etc.
8882
8883         Implement all operations that we perform on EventBuilder in precisely the same
8884         way here too.
8885
8886         (FindMembers): Update to use the EventBuilder member.
8887
8888         (Event.Emit): Update accordingly.
8889
8890 2001-12-18  Ravi Pratap  <ravi@ximian.com>
8891
8892         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8893         by calling the appropriate methods.
8894
8895         (GetCustomAttributes): Make stubs as they cannot possibly do anything
8896         useful.
8897
8898         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8899
8900 2001-12-17  Ravi Pratap  <ravi@ximian.com>
8901
8902         * delegate.cs (Delegate.Populate): Check that the return type
8903         and various parameters types are indeed accessible.
8904
8905         * class.cs (Constructor.Define): Same here.
8906
8907         (Field.Define): Ditto.
8908
8909         (Event.Define): Ditto.
8910
8911         (Operator.Define): Check that the underlying Method defined itself
8912         correctly - so it's MethodBuilder should not be null.
8913
8914         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8915         expression happens to be null.
8916
8917         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8918         members but as of now we don't seem to be able to do anything really useful with it.
8919
8920         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8921         not the EventBuilder.
8922
8923 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
8924
8925         * cs-tokenizer.cs: Add support for defines.
8926         Add support for #if, #elif, #else, #endif
8927         
8928         (eval_var): evaluates a variable.
8929         (eval): stubbed for evaluating functions.
8930
8931         * cs-parser.jay: Pass the defines information
8932
8933         * driver.cs: Add --define command line option.
8934
8935         * decl.cs: Move MemberCore here.
8936
8937         Make it the base class for DeclSpace.  This allows us to catch and
8938         report 108 and 109 for everything now.
8939
8940         * class.cs (TypeContainer.Define): Extract all the members
8941         before populating and emit the warning 108 (new keyword required
8942         to override) instead of having each member implement this.
8943
8944         (MemberCore.Define): New abstract method, we will be using this in
8945         the warning reporting engine in Populate.
8946         
8947         (Operator.Define): Adjust to new MemberCore protocol. 
8948
8949         * const.cs (Const): This does not derive from Expression, it is a
8950         temporary object we use to create fields, it is a MemberCore. 
8951
8952         * class.cs (Method.Define): Allow the entry point to be in a
8953         specific class.
8954
8955         * driver.cs: Rewrite the argument handler to clean it up a bit.
8956
8957         * rootcontext.cs: Made it just an auxiliary namespace feature by
8958         making everything static.
8959
8960         * driver.cs: Adapt code to use RootContext type name instead of
8961         instance variable.
8962
8963         * delegate.cs: Remove RootContext argument.
8964
8965         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8966         argument. 
8967
8968         * class.cs (Event.Define): The lookup can fail.
8969         
8970         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
8971
8972         * expression.cs: Resolve the this instance before invoking the code.
8973
8974 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
8975
8976         * cs-parser.jay: Add a production in element_access that allows
8977         the thing to become a "type" reference.  This way we can parse
8978         things like "(string [])" as a type.
8979
8980         Note that this still does not handle the more complex rules of
8981         casts. 
8982         
8983
8984         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
8985
8986         * ecore.cs: (CopyNewMethods): new utility function used to
8987         assemble the list of methods from running FindMembers.
8988
8989         (MemberLookup): Rework FindMembers so that 
8990
8991 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
8992
8993         * class.cs (TypeContainer): Remove Delegates who fail to be
8994         defined.
8995
8996         * delegate.cs (Populate): Verify that we dont get null return
8997         values.   TODO: Check for AsAccessible.
8998
8999         * cs-parser.jay: Use basename to emit error 574 (destructor should
9000         have the same name as container class), not the full name.
9001
9002         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
9003         possible representation.  
9004
9005         Also implements integer type suffixes U and L.
9006
9007 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
9008
9009         * expression.cs (ArrayCreation.DoResolve): We need to do the
9010         argument resolution *always*.
9011
9012         * decl.cs: Make this hold the namespace.  Hold the root context as
9013         well.
9014         (LookupType): Move here.
9015
9016         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
9017
9018         * location.cs (Row, Name): Fixed the code, it was always returning
9019         references to the first file.
9020
9021         * interface.cs: Register properties defined through interfaces.
9022
9023         * driver.cs: Add support for globbing on the command line
9024
9025         * class.cs (Field): Make it derive from MemberCore as well.
9026         (Event): ditto.
9027
9028 2001-12-15  Ravi Pratap  <ravi@ximian.com>
9029
9030         * class.cs (Event::Define): Check that the type of the event is a delegate
9031         type else flag error #66.
9032
9033         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
9034         same.
9035
9036         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
9037         values of EntryPoint, CharSet etc etc.
9038
9039         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
9040
9041         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
9042         be null and we should ignore this. I am not sure if this is really clean. Apparently,
9043         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
9044         which needs this to do its work.
9045
9046         * ../errors/cs0066.cs : Add.
9047
9048 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
9049
9050         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
9051         helper functions.
9052
9053         * class.cs: (MethodSignature.MethodSignature): Removed hack that
9054         clears out the parameters field.
9055         (MemberSignatureCompare): Cleanup
9056
9057         (MemberCore): New base class used to share code between MethodCore
9058         and Property.
9059
9060         (RegisterRequiredImplementations) BindingFlags.Public requires
9061         either BindingFlags.Instace or Static.  Use instance here.
9062
9063         (Property): Refactored code to cope better with the full spec.
9064
9065         * parameter.cs (GetParameterInfo): Return an empty array instead
9066         of null on error.
9067
9068         * class.cs (Property): Abstract or extern properties have no bodies.
9069
9070         * parameter.cs (GetParameterInfo): return a zero-sized array.
9071
9072         * class.cs (TypeContainer.MethodModifiersValid): Move all the
9073         method modifier validation to the typecontainer so we can reuse
9074         this on properties.
9075
9076         (MethodCore.ParameterTypes): return an empty sized array of types.
9077
9078         (Property.Define): Test property modifier validity.
9079
9080         Add tests for sealed/override too.
9081
9082         (Method.Emit): abstract or extern methods have no bodies.
9083
9084 2001-12-14  Ravi Pratap  <ravi@ximian.com>
9085
9086         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
9087         thing.
9088
9089         (Method::Define, ::Emit): Modify accordingly.
9090
9091         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
9092
9093         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
9094
9095         * makefile: Pass in /unsafe.
9096
9097 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
9098
9099         * class.cs (MakeKey): Kill routine.
9100         
9101         * class.cs (TypeContainer.Define): Correctly define explicit
9102         method implementations (they require the full interface name plus
9103         the method name).
9104
9105         * typemanager.cs: Deply the PtrHashtable here and stop using the
9106         lame keys.  Things work so much better.
9107
9108         This of course broke everyone who depended on `RegisterMethod' to
9109         do the `test for existance' test.  This has to be done elsewhere.
9110
9111         * support.cs (PtrHashtable): A hashtable that avoid comparing with
9112         the object stupid Equals method (because, that like fails all over
9113         the place).  We still do not use it.
9114
9115         * class.cs (TypeContainer.SetRequiredInterface,
9116         TypeContainer.RequireMethods): Killed these two routines and moved
9117         all the functionality to RegisterRequiredImplementations.
9118
9119         (TypeContainer.RegisterRequiredImplementations): This routine now
9120         registers all the implementations required in an array for the
9121         interfaces and abstract methods.  We use an array of structures
9122         which can be computed ahead of time to reduce memory usage and we
9123         also assume that lookups are cheap as most classes will not
9124         implement too many interfaces.
9125
9126         We also avoid creating too many MethodSignatures.
9127
9128         (TypeContainer.IsInterfaceMethod): Update and optionally does not
9129         clear the "pending" bit if we find that there are problems with
9130         the declaration.
9131
9132         (TypeContainer.VerifyPendingMethods): Update to report errors of
9133         methods that look like implementations but are not.
9134
9135         (TypeContainer.Define): Add support for explicit interface method
9136         implementation. 
9137         
9138 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
9139
9140         * typemanager.cs: Keep track of the parameters here instead of
9141         being a feature of the TypeContainer.
9142
9143         * class.cs: Drop the registration of parameters here, as
9144         InterfaceMethods are also interface declarations.
9145
9146         * delegate.cs: Register methods with the TypeManager not only with
9147         the TypeContainer.  This code was buggy.
9148
9149         * interface.cs: Full registation here.
9150
9151 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
9152
9153         * expression.cs: Remove reducer for binary expressions, it can not
9154         be done this way.
9155
9156         * const.cs: Put here the code that used to go into constant.cs
9157
9158         * constant.cs: Put here the code for constants, this is a new base
9159         class for Literals.
9160
9161         * literal.cs: Make Literal derive from Constant.
9162
9163 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
9164
9165         * statement.cs (Return.Emit): Report error 157 if the user
9166         attempts to return from a finally block.
9167
9168         (Return.Emit): Instead of emitting a return, jump to the end of
9169         the function.
9170
9171         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9172         LocalBuilder to store the result of the function.  ReturnLabel is
9173         the target where we jump.
9174         
9175
9176 2001-12-09  Radek Doulik  <rodo@ximian.com>
9177
9178         * cs-parser.jay: remember alias in current namespace
9179
9180         * ecore.cs (SimpleName::DoResolve): use aliases for types or
9181         namespaces
9182
9183         * class.cs (LookupAlias): lookup alias in my_namespace
9184
9185         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9186         aliases hashtable
9187         (LookupAlias): lookup alias in this and if needed in parent
9188         namespaces
9189
9190 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
9191
9192         * support.cs: 
9193
9194         * rootcontext.cs: (ModuleBuilder) Made static, first step into
9195         making things static.  I need this to avoid passing the
9196         TypeContainer when calling ParameterType.
9197
9198         * support.cs (InternalParameters.ParameterType): Remove ugly hack
9199         that did string manipulation to compute the type and then call
9200         GetType.  Use Parameter.ParameterType instead.
9201
9202         * cs-tokenizer.cs: Consume the suffix for floating values.
9203
9204         * expression.cs (ParameterReference): figure out whether this is a
9205         reference parameter or not.  Kill an extra variable by computing
9206         the arg_idx during emission.
9207
9208         * parameter.cs (Parameters.GetParameterInfo): New overloaded
9209         function that returns whether a parameter is an out/ref value or not.
9210
9211         (Parameter.ParameterType): The type of the parameter (base,
9212         without ref/out applied).
9213         
9214         (Parameter.Resolve): Perform resolution here.
9215         (Parameter.ExternalType): The full type (with ref/out applied).
9216
9217         * statement.cs (Using.Emit, Using.EmitExpression): Implement
9218         support for expressions on the using statement.
9219
9220 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
9221
9222         * statement.cs (Using.EmitLocalVariableDecls): Split the
9223         localvariable handling of the using statement.
9224
9225         (Block.EmitMeta): Keep track of variable count across blocks.  We
9226         were reusing slots on separate branches of blocks.
9227
9228         (Try.Emit): Emit the general code block, we were not emitting it. 
9229
9230         Check the type of the declaration to be an IDisposable or
9231         something that can be implicity converted to it. 
9232
9233         Emit conversions if required.
9234
9235         * ecore.cs (EmptyExpression): New utility class.
9236         (Expression.ImplicitConversionExists): New utility function.
9237
9238 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
9239
9240         * statement.cs (Using): Implement.
9241
9242         * expression.cs (LocalVariableReference): Support read only variables.
9243
9244         * statement.cs: Remove the explicit emit for the Leave opcode.
9245         (VariableInfo): Add a readonly field.
9246
9247 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
9248
9249         * ecore.cs (ConvCast): new class used to encapsulate the various
9250         explicit integer conversions that works in both checked and
9251         unchecked contexts.
9252
9253         (Expression.ConvertNumericExplicit): Use new ConvCast class to
9254         properly generate the overflow opcodes.
9255
9256 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9257
9258         * statement.cs: The correct type for the EmptyExpression is the
9259         element_type, not the variable type.  Ravi pointed this out.
9260
9261 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9262
9263         * class.cs (Method::Define): Handle PInvoke methods specially
9264         by using DefinePInvokeMethod instead of the usual one.
9265
9266         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9267         above to do the task of extracting information and defining the method.
9268         
9269 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9270
9271         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9272         of the condition for string type.
9273
9274         (Emit): Move that here. 
9275
9276         (ArrayCreation::CheckIndices): Keep string literals in their expression
9277         form.
9278
9279         (EmitDynamicInitializers): Handle strings appropriately.
9280
9281 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9282
9283         * codegen.cs (EmitContext): Replace multiple variables with a
9284         single pointer to the current Switch statement.
9285
9286         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9287         EmitContext.
9288
9289 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9290
9291         * statement.cs 
9292
9293         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9294         default'.
9295         
9296         (Foreach.Emit): Foreach on arrays was not setting
9297         up the loop variables (for break/continue).
9298
9299         (GotoCase): Semi-implented.
9300         
9301 2001-12-03  Ravi Pratap  <ravi@ximian.com>
9302
9303         * attribute.cs (CheckAttribute): Handle system attributes by using
9304         Attribute.GetAttributes to examine information we need.
9305
9306         (GetValidPlaces): Same here.
9307
9308         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9309
9310         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9311
9312         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9313
9314         (Method::Define): Set appropriate flags if we have a DllImport attribute.
9315
9316         (Method::Emit): Handle the case when we are a PInvoke method.
9317
9318 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9319
9320         * expression.cs: Use ResolveWithSimpleName on compound names.
9321
9322 2001-12-02  Ravi Pratap  <ravi@ximian.com>
9323
9324         * constant.cs (EmitConstant): Make sure we resolve the associated expression
9325         before trying to reduce it.
9326
9327         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9328
9329         * constant.cs (LookupConstantValue): Implement.
9330
9331         (EmitConstant): Use the above in emitting the constant.
9332
9333         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9334         that are user-defined by doing a LookupConstantValue on them.
9335
9336         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9337         too, like above.
9338
9339 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
9340
9341         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9342
9343         (BaseAccess.DoResolve): Implement.
9344
9345         (MemberAccess.DoResolve): Split this routine into a
9346         ResolveMemberAccess routine that can be used independently
9347
9348 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
9349
9350         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9351         As that share bits of the implementation.  Is returns a boolean,
9352         while As returns the Type that is being probed.
9353
9354 2001-12-01  Ravi Pratap  <ravi@ximian.com>
9355
9356         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9357         instead of a Literal - much easier.
9358
9359         (EnumInTransit): Remove - utterly useless :-)
9360
9361         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9362
9363         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9364
9365         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9366         chain when we have no associated expression.
9367
9368 2001-11-30  Ravi Pratap  <ravi@ximian.com>
9369
9370         * constant.cs (Define): Use Location while reporting the errror.
9371
9372         Also emit a warning when 'new' is used and there is no inherited
9373         member to hide.
9374
9375         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
9376         populated.
9377
9378         (LookupEnumValue): Implement to lookup an enum member's value and define it
9379         if necessary.
9380
9381         (Populate): Re-write accordingly to use the above routine.
9382
9383 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
9384
9385         * expression.cs (This): Fix prototype for DoResolveLValue to
9386         override the base class DoResolveLValue.
9387
9388         * cs-parser.cs: Report errors cs574 and cs575 (destructor
9389         declarations) 
9390
9391         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9392         (we need to load the address of the field here).  This fixes
9393         test-22. 
9394         
9395         (FieldExpr.DoResolveLValue): Call the DoResolve
9396         function to initialize the Instance expression.
9397         
9398         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9399         correctly the GetEnumerator operation on a value type.
9400
9401         * cs-parser.jay: Add more simple parsing error catches.
9402
9403         * statement.cs (Switch): Add support for string switches.
9404         Handle null specially.
9405
9406         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
9407
9408 2001-11-28  Ravi Pratap  <ravi@ximian.com>
9409
9410         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9411
9412         (declare_local_constant): New helper function.
9413
9414         * statement.cs (AddConstant): Keep a separate record of constants
9415
9416         (IsConstant): Implement to determine if a variable is a constant.
9417
9418         (GetConstantExpression): Implement.
9419
9420         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9421
9422         * statement.cs (IsVariableDefined): Re-write.
9423
9424 2001-11-27  Ravi Pratap  <ravi@ximian.com>
9425
9426         * class.cs (TypeContainer::FindMembers): Look for constants
9427         in the case when we are looking for MemberTypes.Field
9428
9429         * expression.cs (MemberAccess::DoResolve): Check that in the
9430         case we are a FieldExpr and a Literal, we are not being accessed
9431         by an instance reference.
9432
9433         * cs-parser.jay (local_constant_declaration): Implement.
9434
9435         (declaration_statement): Implement for constant declarations.
9436
9437 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
9438
9439         * statement.cs (Switch): Catch double defaults.
9440
9441         (Switch): More work on the switch() statement
9442         implementation.  It works for integral values now, need to finish
9443         string support.
9444
9445
9446 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9447
9448         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9449         integer literals into other integer literals.  To be used by
9450         switch. 
9451
9452 2001-11-24  Ravi Pratap  <ravi@ximian.com>
9453
9454         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9455         some memory.
9456
9457         (EmitDynamicInitializers): Cope with the above since we extract data
9458         directly from ArrayData now.
9459
9460         (ExpectInitializers): Keep track of whether initializers are mandatory
9461         or not.
9462
9463         (Bounds): Make it a hashtable to prevent the same dimension being 
9464         recorded for every element in that dimension.
9465
9466         (EmitDynamicInitializers): Fix bug which prevented the Set array method
9467         from being found.
9468
9469         Also fix bug which was causing the indices to be emitted in the reverse
9470         order.
9471
9472 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9473
9474         * expression.cs (ArrayCreation): Implement the bits that Ravi left
9475         unfinished.  They do not work, because the underlying code is
9476         sloppy.
9477
9478 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9479
9480         * cs-parser.jay: Remove bogus fixme.
9481
9482         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9483         on Switch statement.
9484         
9485 2001-11-23  Ravi Pratap  <ravi@ximian.com>
9486
9487         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9488         the same. 
9489         
9490         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9491         parameter. Apparently, any expression is allowed. 
9492
9493         (ValidateInitializers): Update accordingly.
9494
9495         (CheckIndices): Fix some tricky bugs thanks to recursion.
9496
9497         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
9498         I was being completely brain-dead.
9499
9500         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9501         and re-write acordingly.
9502
9503         (DelegateInvocation): Re-write accordingly.
9504
9505         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9506
9507         (MakeByteBlob): Handle types more correctly.
9508
9509         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9510         initialization from expressions but it is incomplete because I am a complete
9511         Dodo :-|
9512
9513 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9514
9515         * statement.cs (If.Emit): Fix a bug that generated incorrect code
9516         on If.  Basically, we have to return `true' (ie, we do return to
9517         our caller) only if both branches of the if return.
9518
9519         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9520         short-circuit operators, handle them as short circuit operators. 
9521
9522         (Cast.DoResolve): Resolve type.
9523         (Cast.Cast): Take an expression as the target type.
9524
9525         * cs-parser.jay (cast_expression): Remove old hack that only
9526         allowed a limited set of types to be handled.  Now we take a
9527         unary_expression and we resolve to a type during semantic
9528         analysis.
9529
9530         Use the grammar productions from Rhys to handle casts (this is
9531         not complete like Rhys syntax yet, we fail to handle that corner
9532         case that C# has regarding (-x), but we will get there.
9533         
9534 2001-11-22  Ravi Pratap  <ravi@ximian.com>
9535
9536         * class.cs (EmitFieldInitializer): Take care of the case when we have a
9537         field which is an array type.
9538
9539         * cs-parser.jay (declare_local_variables): Support array initialization too.
9540
9541         * typemanager.cs (MakeKey): Implement.
9542
9543         (everywhere): Use the above appropriately.
9544
9545         * cs-parser.jay (for_statement): Update for array initialization while
9546         declaring variables.
9547
9548         * ecore.cs : The error message was correct, it's the variable's names that
9549         were misleading ;-) Make the code more readable.
9550
9551         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9552         the correct type etc.
9553
9554         (ConvertExplicit): Handle Enum types by examining the underlying type.
9555
9556 2001-11-21  Ravi Pratap  <ravi@ximian.com>
9557
9558         * parameter.cs (GetCallingConvention): Always return
9559         CallingConventions.Standard for now.
9560
9561 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9562
9563         * expression.cs (Binary.ResolveOperator): Update the values of `l'
9564         and `r' after calling DoNumericPromotions.
9565
9566         * ecore.cs: Fix error message (the types were in the wrong order).
9567
9568         * statement.cs (Foreach.ProbeCollectionType): Need to pass
9569         BindingFlags.Instance as well 
9570
9571         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9572         implicit int literal conversion in an empty cast so that we
9573         propagate the right type upstream.
9574
9575         (UnboxCast): new class used to unbox value types.
9576         (Expression.ConvertExplicit): Add explicit type conversions done
9577         by unboxing.
9578
9579         (Expression.ImplicitNumericConversion): Oops, forgot to test for
9580         the target type before applying the implicit LongLiterals to ULong
9581         literal cast.
9582
9583 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
9584
9585         * cs-parser.jay (for_statement): Reworked the way For works: now
9586         we declare manually any variables that are introduced in
9587         for_initializer to solve the problem of having out-of-band code
9588         emition (that is what got for broken).
9589
9590         (declaration_statement): Perform the actual variable declaration
9591         that used to be done in local_variable_declaration here.
9592
9593         (local_variable_declaration): Do not declare anything, just pass
9594         the information on a DictionaryEntry
9595
9596 2001-11-20  Ravi Pratap  <ravi@ximian.com>
9597
9598         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9599         re-write of the logic to now make it recursive.
9600
9601         (UpdateIndices): Re-write accordingly.
9602
9603         Store element data in a separate ArrayData list in the above methods.
9604
9605         (MakeByteBlob): Implement to dump the array data into a byte array.
9606
9607 2001-11-19  Ravi Pratap  <ravi@ximian.com>
9608
9609         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9610         into CheckIndices.
9611
9612         * constant.cs (Define): Implement.
9613
9614         (EmitConstant): Re-write fully.
9615
9616         Pass in location info.
9617
9618         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9619         respectively.
9620
9621         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9622         DictionaryEntry since we need location info too.
9623
9624         (constant_declaration): Update accordingly.
9625
9626         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9627         code into another method : UpdateIndices.
9628
9629 2001-11-18  Ravi Pratap  <ravi@ximian.com>
9630
9631         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9632         some type checking etc.
9633
9634 2001-11-17  Ravi Pratap  <ravi@ximian.com>
9635
9636         * expression.cs (ArrayCreation::ValidateInitializers): Implement
9637         bits to provide dimension info if the user skips doing that.
9638
9639         Update second constructor to store the rank correctly.
9640
9641 2001-11-16  Ravi Pratap  <ravi@ximian.com>
9642
9643         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9644         and try to implement.
9645
9646         * ../errors/cs0150.cs : Add.
9647
9648         * ../errors/cs0178.cs : Add.
9649
9650 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
9651
9652         * statement.cs: Implement foreach on multi-dimensional arrays. 
9653
9654         * parameter.cs (Parameters.GetParameterByName): Also lookup the
9655         name of the params argument.
9656
9657         * expression.cs: Use EmitStoreOpcode to get the right opcode while
9658         initializing the array.
9659
9660         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9661         we can use this elsewhere.
9662
9663         * statement.cs: Finish implementation of foreach for single
9664         dimension arrays.
9665
9666         * cs-parser.jay: Use an out-of-band stack to pass information
9667         around, I wonder why I need this.
9668
9669         foreach_block: Make the new foreach_block the current_block.
9670
9671         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9672         function used to return a static Parameters structure.  Used for
9673         empty parameters, as those are created very frequently.
9674
9675         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9676
9677 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9678
9679         * interface.cs : Default modifier is private, not public. The
9680         make verify test passes again.
9681
9682 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9683
9684         * support.cs (ReflectionParameters): Fix logic to determine
9685         whether the last parameter is a params one. Test 9 passes again.
9686
9687         * delegate.cs (Populate): Register the builders we define with
9688         RegisterParameterForBuilder. Test 19 passes again.
9689
9690         * cs-parser.jay (property_declaration): Reference $6 instead
9691         of $$ to get at the location.
9692
9693         (indexer_declaration): Similar stuff.
9694
9695         (attribute): Ditto.
9696
9697         * class.cs (Property): Register parameters for the Get and Set methods
9698         if they exist. Test 23 passes again.
9699
9700         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9701         call to EmitArguments as we are sure there aren't any params arguments. 
9702         Test 32 passes again.
9703
9704         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9705         IndexOutOfRangeException. 
9706
9707         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9708         Test 33 now passes again.
9709         
9710 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
9711
9712         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9713         broke a bunch of things.  Will have to come up with a better way
9714         of tracking locations.
9715
9716         * statement.cs: Implemented foreach for single dimension arrays.
9717
9718 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9719
9720         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9721         an error.  This removes the lookup from the critical path.
9722
9723         * cs-parser.jay: Removed use of temporary_loc, which is completely
9724         broken. 
9725
9726 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
9727
9728         * support.cs (ReflectionParameters.ParameterModifier): Report
9729         whether the argument is a PARAMS argument or not.
9730
9731         * class.cs: Set the attribute `ParamArrayAttribute' on the
9732         parameter argument.
9733
9734         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9735         and cons_param_array_attribute (ConstructorInfo for
9736         ParamArrayAttribute)., 
9737
9738         * codegen.cs: Emit the return using the `Return' statement, that
9739         way we can report the error correctly for missing return values. 
9740
9741         * class.cs (Method.Emit): Clean up.
9742
9743         * expression.cs (Argument.Resolve): Take another argument: the
9744         location where this argument is used.  Notice that this is not
9745         part of the "Argument" class as to reduce the size of the
9746         structure (we know the approximate location anyways).
9747
9748         Test if the argument is a variable-reference, if not, then
9749         complain with a 206.
9750
9751         (Argument.Emit): Emit addresses of variables.
9752
9753         (Argument.FullDesc): Simplify.
9754
9755         (Invocation.DoResolve): Update for Argument.Resolve.
9756
9757         (ElementAccess.DoResolve): ditto.
9758
9759         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9760         method should be virtual, as this method is always virtual.
9761
9762         (NewDelegate.DoResolve): Update for Argument.Resolve.
9763
9764         * class.cs (ConstructorInitializer.DoResolve): ditto.
9765         
9766         * attribute.cs (Attribute.Resolve): ditto.
9767
9768 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
9769
9770         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9771
9772         * expression.cs (ParameterReference): Drop IStackStorage and implement
9773         IAssignMethod instead. 
9774
9775         (LocalVariableReference): ditto.
9776         
9777         * ecore.cs (FieldExpr): Drop IStackStorage and implement
9778         IAssignMethod instead. 
9779
9780 2001-11-13  Miguel de Icaza <miguel@ximian.com>
9781
9782         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9783         enumerations that are used in heavily used structures derive from
9784         byte in a laughable and pathetic attempt to reduce memory usage.
9785         This is the kind of pre-optimzations that you should not do at
9786         home without adult supervision.
9787
9788         * expression.cs (UnaryMutator): New class, used to handle ++ and
9789         -- separatedly from the other unary operators.  Cleans up the
9790         code, and kills the ExpressionStatement dependency in Unary.
9791
9792         (Unary): Removed `method' and `Arguments' from this class, making
9793         it smaller, and moving it all to SimpleCall, so I can reuse this
9794         code in other locations and avoid creating a lot of transient data
9795         strucutres when not required.
9796
9797         * cs-parser.jay: Adjust for new changes.
9798
9799 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
9800
9801         * enum.cs (Enum.Populate): If there is a failure during
9802         definition, return
9803
9804         * cs-parser.jay (opt_enum_base): we used to catch type errors
9805         here, but this is really incorrect.  The type error should be
9806         catched during semantic analysis.
9807
9808 2001-12-11  Ravi Pratap  <ravi@ximian.com>
9809
9810         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9811         current_local_parameters as expected since I, in my stupidity, had forgotten
9812         to do this :-)
9813
9814         * attribute.cs (GetValidPlaces): Fix stupid bug.
9815
9816         * class.cs (Method::Emit): Perform check on applicability of attributes.
9817
9818         (Constructor::Emit): Ditto.
9819
9820         (Field::Emit): Ditto.
9821
9822         (Field.Location): Store location information.
9823
9824         (Property, Event, Indexer, Operator): Ditto.
9825
9826         * cs-parser.jay (field_declaration): Pass in location for each field.
9827
9828         * ../errors/cs0592.cs : Add.
9829
9830 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9831
9832         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9833
9834         (InitCoreTypes): Update accordingly.
9835
9836         (RegisterAttrType, LookupAttr): Implement.
9837
9838         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9839         info about the same.
9840
9841         (Resolve): Update to populate the above as necessary.
9842
9843         (Error592): Helper.
9844
9845         (GetValidPlaces): Helper to the above.
9846
9847         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9848
9849         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9850
9851 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9852
9853         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9854
9855         * ../errors/cs0617.cs : Add.
9856
9857 2001-11-11  Ravi Pratap  <ravi@ximian.com>
9858
9859         * enum.cs (Emit): Rename to Populate to be more consistent with what
9860         we expect it to do and when exactly it is called.
9861
9862         * class.cs, rootcontext.cs : Update accordingly.
9863
9864         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9865         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9866
9867         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9868
9869         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9870         of a fieldinfo using the above, when dealing with a FieldBuilder.
9871
9872 2001-11-10  Ravi Pratap  <ravi@ximian.com>
9873
9874         * ../errors/cs0031.cs : Add.
9875
9876         * ../errors/cs1008.cs : Add.
9877
9878         * ../errrors/cs0543.cs : Add.
9879
9880         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9881         enum type.
9882
9883         (FindMembers): Implement.
9884
9885         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9886         enums and delegates too.
9887
9888         (enum_types): Rename to builder_to_enum.
9889
9890         (delegate_types): Rename to builder_to_delegate.
9891
9892         * delegate.cs (FindMembers): Implement.
9893
9894 2001-11-09  Ravi Pratap  <ravi@ximian.com>
9895
9896         * typemanager.cs (IsEnumType): Implement.
9897
9898         * enum.cs (Emit): Re-write parts to account for the underlying type
9899         better and perform checking etc.
9900
9901         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9902         of the underlying type.
9903
9904         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9905         value
9906
9907         * enum.cs (error31): Helper to report error #31.
9908
9909         * cs-parser.jay (enum_declaration): Store location of each member too.
9910
9911         * enum.cs (member_to_location): New hashtable. 
9912
9913         (AddEnumMember): Update location hashtable.
9914
9915         (Emit): Use the location of each member while reporting errors.
9916
9917 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9918
9919         * cs-parser.jay: A for_initializer if is a
9920         local_variable_declaration really ammount to have an implicit
9921         block with the variable declaration and no initializer for for.
9922
9923         * statement.cs (For.Emit): Cope with null initializers.
9924
9925         This fixes the infinite loop on for initializers.
9926
9927 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
9928
9929         * enum.cs: More cleanup.
9930
9931         * ecore.cs: Remove dead code.
9932
9933         * class.cs (Property.Emit): More simplification.
9934         (Event.Emit): ditto.
9935
9936         Reworked to have less levels of indentation.
9937         
9938 2001-11-08  Ravi Pratap  <ravi@ximian.com>
9939
9940         * class.cs (Property): Emit attributes.
9941
9942         (Field): Ditto.
9943         
9944         (Event): Ditto.
9945
9946         (Indexer): Ditto.
9947
9948         (Operator): Ditto.
9949
9950         * enum.cs (Emit): Ditto.
9951
9952         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9953         Enums too.
9954
9955         * class.cs (Field, Event, etc.): Move attribute generation into the
9956         Emit method everywhere.
9957
9958         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9959         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9960         as we had no way of defining nested enums !
9961
9962         * rootcontext.cs : Adjust code accordingly.
9963
9964         * typemanager.cs (AddEnumType): To keep track of enum types separately.
9965
9966 2001-11-07  Ravi Pratap  <ravi@ximian.com>
9967
9968         * expression.cs (EvalConstantExpression): Move into ecore.cs
9969         
9970         * enum.cs (Enum): Rename some members and make them public and readonly
9971         according to our convention.
9972
9973         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9974         nothing else.
9975
9976         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9977
9978         (Enum::Emit): Write a simple version for now which doesn't try to compute
9979         expressions. I shall modify this to be more robust in just a while.
9980
9981         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9982
9983         (TypeContainer::CloseType): Create the Enum types too.
9984
9985         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9986
9987         * expression.cs (EvalConstantExpression): Get rid of completely.
9988
9989         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9990         user-defined values and other cases.
9991
9992         (IsValidEnumLiteral): Helper function.
9993
9994         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
9995         out there in the case we had a literal FieldExpr.
9996
9997         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9998
9999         (Literalize): Revamp a bit to take two arguments.
10000         
10001         (EnumLiteral): New class which derives from Literal to wrap enum literals.
10002         
10003 2001-11-06  Ravi Pratap  <ravi@ximian.com>
10004
10005         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
10006
10007         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
10008
10009         (Resolve): Use the above to ensure we have proper initializers.
10010
10011 2001-11-05  Ravi Pratap  <ravi@ximian.com>
10012
10013         * expression.cs (Expression::EvalConstantExpression): New method to 
10014         evaluate constant expressions.
10015
10016         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
10017
10018 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
10019
10020         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
10021         in an array.
10022
10023         (Binary.ResolveOperator): Handle operator != (object a, object b)
10024         and operator == (object a, object b);
10025
10026         (Binary.DoNumericPromotions): Indicate whether the numeric
10027         promotion was possible.
10028
10029         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
10030         Implement.  
10031
10032         Made the ArrayAccess implement interface IAssignMethod instead of
10033         IStackStore as the order in which arguments are passed reflects
10034         this.
10035
10036         * assign.cs: Instead of using expr.ExprClass to select the way of
10037         assinging, probe for the IStackStore/IAssignMethod interfaces.
10038
10039         * typemanager.cs: Load InitializeArray definition.
10040
10041         * rootcontext.cs (RootContext.MakeStaticData): Used to define
10042         static data that can be used to initialize arrays. 
10043
10044 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
10045
10046         * expression.cs: Handle operator== and operator!= for booleans.
10047
10048         (Conditioal.Reduce): Implement reducer for the ?: operator.
10049
10050         (Conditional.Resolve): Implement dead code elimination.
10051
10052         (Binary.Resolve): Catch string literals and return a new
10053         concatenated string.
10054
10055         (Unary.Reduce): Implement reduction of unary expressions.
10056
10057         * ecore.cs: Split out the expression core handling here.
10058
10059         (Expression.Reduce): New method used to perform constant folding
10060         and CSE.  This is needed to support constant-expressions. 
10061         
10062         * statement.cs (Statement.EmitBoolExpression): Pass true and false
10063         targets, and optimize for !x.
10064
10065 2001-11-04  Ravi Pratap  <ravi@ximian.com>
10066
10067         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
10068         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
10069         set custom atttributes.
10070
10071         * literal.cs (Literal::GetValue): New abstract method to return the actual
10072         value of the literal, cast as an object.
10073
10074         (*Literal): Implement GetValue method.
10075
10076         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
10077         expressions to the arraylist but objects of type Argument.
10078
10079         * class.cs (TypeContainer::Emit): Emit our attributes too.
10080
10081         (Method::Emit, Constructor::Emit): Ditto.
10082
10083         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
10084         to be ignoring earlier.
10085
10086 2001-11-03  Ravi Pratap  <ravi@ximian.com>
10087
10088         * attribute.cs (AttributeSection::Define): Implement to do the business
10089         of constructing a CustomAttributeBuilder.
10090
10091         (Attribute): New trivial class. Increases readability of code.  
10092
10093         * cs-parser.jay : Update accordingly.
10094
10095         (positional_argument_list, named_argument_list, named_argument): New rules
10096
10097         (attribute_arguments): Use the above so that we are more correct.
10098         
10099 2001-11-02  Ravi Pratap  <ravi@ximian.com>
10100         
10101         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
10102         to perform all checks for a method with a params parameter.
10103
10104         (Invocation::OverloadResolve): Update to use the above method and therefore
10105         cope correctly with params method invocations.
10106
10107         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
10108         params too.
10109
10110         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
10111         constructors in our parent too because we can't afford to miss out on 
10112         protected ones ;-)
10113
10114         * attribute.cs (AttributeSection): New name for the class Attribute
10115
10116         Other trivial changes to improve readability.
10117
10118         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10119         use the new class names.
10120         
10121 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10122
10123         * class.cs (Method::Define): Complete definition for params types too
10124
10125         (Indexer::Define): Ditto.
10126
10127         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10128         Cope everywhere with a request for info about the array parameter.
10129
10130 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10131
10132         * tree.cs (RecordNamespace): Fix up to check for the correct key.
10133
10134         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
10135         local_variable_type to extract the string corresponding to the type.
10136
10137         (local_variable_type): Fixup the action to use the new helper method.
10138
10139         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
10140         go.
10141
10142         * expression.cs : Clean out code which uses the above.
10143
10144 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10145         
10146         * typemanager.cs (RegisterMethod): Check if we already have an existing key
10147         and bale out if necessary by returning a false.
10148
10149         (RegisterProperty): Ditto.
10150
10151         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10152         and print out appropriate error messages.
10153
10154         * interface.cs (everywhere): Ditto.
10155
10156         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10157         location to constructor.
10158
10159         * class.cs (Property, Event, Indexer): Update accordingly.
10160
10161         * ../errors/cs111.cs : Added.
10162
10163         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10164         of a method, as laid down by the spec.
10165
10166         (Invocation::OverloadResolve): Use the above method.
10167
10168 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10169
10170         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10171         now take a TypeContainer and a Parameters object.
10172
10173         (ParameterData): Modify return type of ParameterModifier method to be 
10174         Parameter.Modifier and not a string.
10175
10176         (ReflectionParameters, InternalParameters): Update accordingly.
10177
10178         * expression.cs (Argument::GetParameterModifier): Same here.
10179
10180         * support.cs (InternalParameters::ParameterType): Find a better way of determining
10181         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10182         symbol in it at all so maybe this is only for now.
10183
10184 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10185
10186         * support.cs (InternalParameters): Constructor now takes an extra argument 
10187         which is the actual Parameters class.
10188
10189         (ParameterDesc): Update to provide info on ref/out modifiers.
10190
10191         * class.cs (everywhere): Update call to InternalParameters to pass in
10192         the second argument too.
10193
10194         * support.cs (ParameterData): Add ParameterModifier, which is a method 
10195         to return the modifier info [ref/out etc]
10196
10197         (InternalParameters, ReflectionParameters): Implement the above.
10198
10199         * expression.cs (Argument::ParameterModifier): Similar function to return
10200         info about the argument's modifiers.
10201
10202         (Invocation::OverloadResolve): Update to take into account matching modifiers 
10203         too.
10204
10205         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10206         a new SetFormalParameters object which we pass to InternalParameters.
10207
10208 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10209
10210         * expression.cs (NewArray): Merge into the ArrayCreation class.
10211
10212 2001-10-29  Ravi Pratap  <ravi@ximian.com>
10213
10214         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
10215         NewUserdefinedArray into one as there wasn't much of a use in having
10216         two separate ones.
10217
10218         * expression.cs (Argument): Change field's name to ArgType from Type.
10219
10220         (Type): New readonly property which returns the proper type, taking into 
10221         account ref/out modifiers.
10222
10223         (everywhere): Adjust code accordingly for the above.
10224
10225         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
10226         whether we are emitting for a ref or out parameter.
10227
10228         * expression.cs (Argument::Emit): Use the above field to set the state.
10229
10230         (LocalVariableReference::Emit): Update to honour the flag and emit the
10231         right stuff.
10232
10233         * parameter.cs (Attributes): Set the correct flags for ref parameters.
10234
10235         * expression.cs (Argument::FullDesc): New function to provide a full desc.
10236
10237         * support.cs (ParameterData): Add method ParameterDesc to the interface.
10238
10239         (ReflectionParameters, InternalParameters): Implement the above method.
10240
10241         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10242         reporting errors.
10243
10244         (Invocation::FullMethodDesc): Ditto. 
10245
10246 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
10247
10248         * cs-parser.jay: Add extra production for the second form of array
10249         creation. 
10250
10251         * expression.cs (ArrayCreation): Update to reflect the above
10252         change. 
10253
10254         * Small changes to prepare for Array initialization.
10255
10256 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
10257
10258         * typemanager.cs (ImplementsInterface): interface might be null;
10259         Deal with this problem;
10260
10261         Also, we do store negative hits on the cache (null values), so use
10262         this instead of calling t.GetInterfaces on the type everytime.
10263
10264 2001-10-28  Ravi Pratap  <ravi@ximian.com>
10265
10266         * typemanager.cs (IsBuiltinType): New method to help determine the same.
10267
10268         * expression.cs (New::DoResolve): Get rid of array creation code and instead
10269         split functionality out into different classes.
10270
10271         (New::FormArrayType): Move into NewBuiltinArray.
10272
10273         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10274         quite useless.
10275
10276         (NewBuiltinArray): New class to handle creation of built-in arrays.
10277
10278         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10279         account creation of one-dimensional arrays.
10280
10281         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10282
10283         (NewUserdefinedArray::DoResolve): Implement.
10284
10285         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10286
10287         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10288         we maintain inside the TypeManager. This is necessary to perform lookups on the
10289         module builder.
10290
10291         (LookupType): Update to perform GetType on the module builders too.     
10292
10293         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10294
10295         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10296
10297 2001-10-23  Ravi Pratap  <ravi@ximian.com>
10298
10299         * expression.cs (New::DoResolve): Implement guts of array creation.
10300
10301         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10302         
10303 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
10304
10305         * expression.cs: Fix bug I introduced lsat night that broke
10306         Delegates. 
10307
10308         (Expression.Resolve): Report a 246 error (can not resolve name)
10309         if we find a SimpleName in the stream.
10310         
10311         (Expression.ResolveLValue): Ditto.
10312         
10313         (Expression.ResolveWithSimpleName): This function is a variant of
10314         ResolveName, this one allows SimpleNames to be returned without a
10315         warning.  The only consumer of SimpleNames is MemberAccess
10316
10317 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
10318
10319         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10320         might arrive here.  I have my doubts that this is correct.
10321
10322         * statement.cs (Lock): Implement lock statement.
10323
10324         * cs-parser.jay: Small fixes to support `lock' and `using'
10325
10326         * cs-tokenizer.cs: Remove extra space
10327
10328         * driver.cs: New flag --checked, allows to turn on integer math
10329         checking. 
10330
10331         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10332         Threading.Monitor.Exit 
10333         
10334 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
10335
10336         * expression.cs (IndexerAccess::DoResolveLValue): Set the
10337         Expression Class to be IndexerAccess.
10338
10339         Notice that Indexer::DoResolve sets the eclass to Value.
10340
10341 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
10342
10343         * class.cs (TypeContainer::Emit): Emit code for indexers.
10344
10345         * assign.cs (IAssignMethod): New interface implemented by Indexers
10346         and Properties for handling assignment.
10347
10348         (Assign::Emit): Simplify and reuse code. 
10349         
10350         * expression.cs (IndexerAccess, PropertyExpr): Implement
10351         IAssignMethod, clean up old code. 
10352
10353 2001-10-22  Ravi Pratap  <ravi@ximian.com>
10354
10355         * typemanager.cs (ImplementsInterface): New method to determine if a type
10356         implements a given interface. Provides a nice cache too.
10357
10358         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10359         method.
10360
10361         (ConvertReferenceExplicit): Ditto.
10362
10363         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
10364         various methods, with correct names etc.
10365
10366         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
10367         Operator.UnaryNegation.
10368
10369         * cs-parser.jay (operator_declarator): Be a little clever in the case where
10370         we have a unary plus or minus operator.
10371
10372         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
10373         UnaryMinus.
10374
10375         * everywhere : update accordingly.
10376
10377         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10378         respectively.
10379
10380         * class.cs (Method::Define): For the case where we are implementing a method
10381         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
10382         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10383         
10384 2001-10-21  Ravi Pratap  <ravi@ximian.com>
10385
10386         * interface.cs (FindMembers): Implement to work around S.R.E
10387         lameness.
10388
10389         * typemanager.cs (IsInterfaceType): Implement.
10390
10391         (FindMembers): Update to handle interface types too.
10392
10393         * expression.cs (ImplicitReferenceConversion): Re-write bits which
10394         use IsAssignableFrom as that is not correct - it doesn't work.
10395
10396         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10397         and accordingly override EmitStatement.
10398
10399         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10400         using the correct logic :-)
10401
10402 2001-10-19  Ravi Pratap  <ravi@ximian.com>
10403
10404         * ../errors/cs-11.cs : Add to demonstrate error -11 
10405
10406 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
10407
10408         * assign.cs (Assign::Resolve): Resolve right hand side first, and
10409         then pass this as a hint to ResolveLValue.
10410         
10411         * expression.cs (FieldExpr): Add Location information
10412
10413         (FieldExpr::LValueResolve): Report assignment to readonly
10414         variable. 
10415         
10416         (Expression::ExprClassFromMemberInfo): Pass location information.
10417
10418         (Expression::ResolveLValue): Add new method that resolves an
10419         LValue. 
10420
10421         (Expression::DoResolveLValue): Default invocation calls
10422         DoResolve. 
10423
10424         (Indexers): New class used to keep track of indexers in a given
10425         Type. 
10426
10427         (IStackStore): Renamed from LValue, as it did not really describe
10428         what this did.  Also ResolveLValue is gone from this interface and
10429         now is part of Expression.
10430
10431         (ElementAccess): Depending on the element access type
10432         
10433         * typemanager.cs: Add `indexer_name_type' as a Core type
10434         (System.Runtime.CompilerServices.IndexerNameAttribute)
10435
10436         * statement.cs (Goto): Take a location.
10437         
10438 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10439
10440         * delegate.cs (Delegate::VerifyDelegate): New method to verify
10441         if two delegates are compatible.
10442
10443         (NewDelegate::DoResolve): Update to take care of the case when
10444         we instantiate a delegate from another delegate.
10445
10446         * typemanager.cs (FindMembers): Don't even try to look up members
10447         of Delegate types for now.
10448
10449 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10450
10451         * delegate.cs (NewDelegate): New class to take care of delegate
10452         instantiation.
10453
10454         * expression.cs (New): Split the delegate related code out into 
10455         the NewDelegate class.
10456
10457         * delegate.cs (DelegateInvocation): New class to handle delegate 
10458         invocation.
10459
10460         * expression.cs (Invocation): Split out delegate related code into
10461         the DelegateInvocation class.
10462
10463 2001-10-17  Ravi Pratap  <ravi@ximian.com>
10464
10465         * expression.cs (New::DoResolve): Implement delegate creation fully
10466         and according to the spec.
10467
10468         (New::DoEmit): Update to handle delegates differently.
10469
10470         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10471         because of which we were printing out arguments in reverse order !
10472
10473         * delegate.cs (VerifyMethod): Implement to check if the given method
10474         matches the delegate.
10475
10476         (FullDelegateDesc): Implement.
10477
10478         (VerifyApplicability): Implement.
10479
10480         * expression.cs (Invocation::DoResolve): Update to accordingly handle
10481         delegate invocations too.
10482
10483         (Invocation::Emit): Ditto.
10484
10485         * ../errors/cs1593.cs : Added.
10486
10487         * ../errors/cs1594.cs : Added.
10488
10489         * delegate.cs (InstanceExpression, TargetMethod): New properties.
10490
10491 2001-10-16  Ravi Pratap  <ravi@ximian.com>
10492
10493         * typemanager.cs (intptr_type): Core type for System.IntPtr
10494
10495         (InitCoreTypes): Update for the same.
10496
10497         (iasyncresult_type, asynccallback_type): Ditto.
10498
10499         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10500         correct.
10501
10502         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10503         too.
10504
10505         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10506         the builders for the 4 members of a delegate type :-)
10507
10508         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10509         type.
10510
10511         * expression.cs (New::DoResolve): Implement guts for delegate creation.
10512
10513         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10514
10515 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
10516
10517         * statement.cs (Break::Emit): Implement.   
10518         (Continue::Emit): Implement.
10519
10520         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10521         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10522         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10523         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
10524         end loop
10525         
10526         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10527         properties that track the label for the current loop (begin of the
10528         loop and end of the loop).
10529
10530 2001-10-15  Ravi Pratap  <ravi@ximian.com>
10531
10532         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10533         use of emitting anything at all.
10534
10535         * class.cs, rootcontext.cs : Get rid of calls to the same.
10536
10537         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10538
10539         (Populate): Define the constructor correctly and set the implementation
10540         attributes.
10541
10542         * typemanager.cs (delegate_types): New hashtable to hold delegates that
10543         have been defined.
10544
10545         (AddDelegateType): Implement.
10546
10547         (IsDelegateType): Implement helper method.
10548
10549         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10550
10551         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10552         and accordingly handle it.
10553
10554         * delegate.cs (Populate): Take TypeContainer argument.
10555         Implement bits to define the Invoke method. However, I still haven't figured out
10556         how to take care of the native int bit :-(
10557
10558         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
10559         Qualify the name of the delegate, not its return type !
10560
10561         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10562         conversion.
10563
10564         (StandardConversionExists): Checking for array types turns out to be recursive.
10565
10566         (ConvertReferenceExplicit): Implement array conversion.
10567
10568         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10569         
10570 2001-10-12  Ravi Pratap  <ravi@ximian.com>
10571
10572         * cs-parser.jay (delegate_declaration): Store the fully qualified
10573         name as it is a type declaration.
10574
10575         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
10576         readonly.
10577
10578         (DefineDelegate): Renamed from Define. Does the same thing essentially,
10579         as TypeContainer::DefineType.
10580
10581         (Populate): Method in which all the definition of the various methods (Invoke)
10582         etc is done.
10583
10584         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10585         see.
10586         
10587         (CloseDelegate): Finally creates the delegate.
10588
10589         * class.cs (TypeContainer::DefineType): Update to define delegates.
10590         (Populate, Emit and CloseType): Do the same thing here too.
10591
10592         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10593         delegates in all these operations.
10594
10595 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
10596
10597         * expression.cs: LocalTemporary: a new expression used to
10598         reference a temporary that has been created.
10599
10600         * assign.cs: Handle PropertyAccess back here, so that we can
10601         provide the proper semantic access to properties.
10602
10603         * expression.cs (Expression::ConvertReferenceExplicit): Implement
10604         a few more explicit conversions. 
10605
10606         * modifiers.cs: `NEW' modifier maps to HideBySig.
10607
10608         * expression.cs (PropertyExpr): Make this into an
10609         ExpressionStatement, and support the EmitStatement code path. 
10610
10611         Perform get/set error checking, clean up the interface.
10612
10613         * assign.cs: recognize PropertyExprs as targets, and if so, turn
10614         them into toplevel access objects.
10615
10616 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
10617
10618         * expression.cs: PropertyExpr::PropertyExpr: use work around the
10619         SRE.
10620
10621         * typemanager.cs: Keep track here of our PropertyBuilders again to
10622         work around lameness in SRE.
10623
10624 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
10625
10626         * expression.cs (LValue::LValueResolve): New method in the
10627         interface, used to perform a second resolution pass for LValues. 
10628         
10629         (This::DoResolve): Catch the use of this in static methods.
10630
10631         (This::LValueResolve): Implement.
10632
10633         (This::Store): Remove warning, assigning to `this' in structures
10634         is 
10635
10636         (Invocation::Emit): Deal with invocation of
10637         methods on value types.  We need to pass the address to structure
10638         methods rather than the object itself.  (The equivalent code to
10639         emit "this" for structures leaves the entire structure on the
10640         stack instead of a pointer to it). 
10641
10642         (ParameterReference::DoResolve): Compute the real index for the
10643         argument based on whether the method takes or not a `this' pointer
10644         (ie, the method is static).
10645
10646         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10647         value types returned from functions when we need to invoke a
10648         method on the sturcture.
10649         
10650
10651 2001-10-11  Ravi Pratap  <ravi@ximian.com>
10652
10653         * class.cs (TypeContainer::DefineType): Method to actually do the business of
10654         defining the type in the Modulebuilder or Typebuilder. This is to take
10655         care of nested types which need to be defined on the TypeBuilder using
10656         DefineNestedMethod.
10657
10658         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
10659         methods in RootContext, only ported to be part of TypeContainer.
10660
10661         (TypeContainer::GetInterfaceOrClass): Ditto.
10662
10663         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10664
10665         * interface.cs (Interface::DefineInterface): New method. Does exactly
10666         what RootContext.CreateInterface did earlier, only it takes care of nested types 
10667         too.
10668
10669         (Interface::GetInterfaces): Move from RootContext here and port.
10670
10671         (Interface::GetInterfaceByName): Same here.
10672
10673         * rootcontext.cs (ResolveTree): Re-write.
10674
10675         (PopulateTypes): Re-write.
10676
10677         * class.cs (TypeContainer::Populate): Populate nested types too.
10678         (TypeContainer::Emit): Emit nested members too.
10679
10680         * typemanager.cs (AddUserType): Do not make use of the FullName property,
10681         instead just use the name argument passed in as it is already fully
10682         qualified.
10683
10684         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10685         to TypeContainer mapping to see if a type is user-defined.
10686
10687         * class.cs (TypeContainer::CloseType): Implement. 
10688
10689         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10690         the default constructor.
10691         
10692         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10693         twice.
10694
10695         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10696
10697         * interface.cs (CloseType): Create the type here.
10698         
10699         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10700         the hierarchy.
10701
10702         Remove all the methods which are now in TypeContainer.
10703
10704 2001-10-10  Ravi Pratap  <ravi@ximian.com>
10705
10706         * delegate.cs (Define): Re-write bits to define the delegate
10707         correctly.
10708
10709 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
10710
10711         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10712
10713         * expression.cs (ImplicitReferenceConversion): handle null as well
10714         as a source to convert to any reference type.
10715
10716         * statement.cs (Return): Perform any implicit conversions to
10717         expected return type.  
10718
10719         Validate use of return statement.  
10720
10721         * codegen.cs (EmitContext): Pass the expected return type here.
10722
10723         * class.cs (Method, Constructor, Property): Pass expected return
10724         type to EmitContext.
10725
10726 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
10727
10728         * expression.cs: Make DoResolve take an EmitContext instead of a
10729         TypeContainer.
10730
10731         Replaced `l' and `location' for `loc', for consistency.
10732         
10733         (Error, Warning): Remove unneeded Tc argument.
10734
10735         * assign.cs, literal.cs, constant.cs: Update to new calling
10736         convention. 
10737         
10738         * codegen.cs: EmitContext now contains a flag indicating whether
10739         code is being generated in a static method or not.
10740
10741         * cs-parser.jay: DecomposeQI, new function that replaces the old
10742         QualifiedIdentifier.  Now we always decompose the assembled
10743         strings from qualified_identifier productions into a group of
10744         memberaccesses.
10745
10746 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
10747
10748         * rootcontext.cs: Deal with field-less struct types correctly now
10749         by passing the size option to Define Type.
10750
10751         * class.cs: Removed hack that created one static field. 
10752
10753 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10754
10755         * statement.cs: Moved most of the code generation here. 
10756
10757 2001-10-09  Ravi Pratap  <ravi@ximian.com>
10758
10759         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10760         seem very right.
10761
10762         (ElementAccess): Remove useless bits for now - keep checks as the spec
10763         says.
10764
10765 2001-10-08  Ravi Pratap  <ravi@ximian.com>
10766
10767         * expression.cs (ElementAccess::DoResolve): Remove my crap code
10768         and start performing checks according to the spec.
10769
10770 2001-10-07  Ravi Pratap  <ravi@ximian.com>
10771
10772         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10773         rank_specifiers instead.
10774
10775         (rank_specifiers): Change the order in which the rank specifiers are stored
10776
10777         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10778
10779         * expression.cs (ElementAccess): Implement the LValue interface too.
10780         
10781 2001-10-06  Ravi Pratap  <ravi@ximian.com>
10782         
10783         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10784         except that user defined conversions are not included.
10785
10786         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
10787         perform the conversion of the return type, if necessary.
10788
10789         (New::DoResolve): Check whether we are creating an array or an object
10790         and accordingly do the needful.
10791
10792         (New::Emit): Same here.
10793
10794         (New::DoResolve): Implement guts of array creation.
10795
10796         (New::FormLookupType): Helper function.
10797
10798 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10799
10800         * codegen.cs: Removed most of the code generation here, and move the
10801         corresponding code generation bits to the statement classes. 
10802
10803         Added support for try/catch/finalize and throw.
10804         
10805         * cs-parser.jay: Added support for try/catch/finalize.
10806
10807         * class.cs: Catch static methods having the flags override,
10808         virtual or abstract.
10809
10810         * expression.cs (UserCast): This user cast was not really doing
10811         what it was supposed to do.  Which is to be born in fully resolved
10812         state.  Parts of the resolution were being performed at Emit time! 
10813
10814         Fixed this code.
10815
10816 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10817
10818         * expression.cs: Implicity convert the result from UserCast.
10819
10820 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10821
10822         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10823         prevented it from working correctly. 
10824
10825         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10826         merely ConvertImplicit.
10827
10828 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10829
10830         * typemanager.cs: Make the LookupTypeContainer function static,
10831         and not per-instance.  
10832
10833         * class.cs: Make static FindMembers (the one that takes a Type
10834         argument). 
10835
10836         * codegen.cs: Add EmitForeach here.
10837
10838         * cs-parser.jay: Make foreach a toplevel object instead of the
10839         inline expansion, as we need to perform semantic analysis on it. 
10840
10841 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10842
10843         * expression.cs (Expression::ImplicitUserConversion): Rename to
10844         UserDefinedConversion.
10845
10846         (Expression::UserDefinedConversion): Take an extra argument specifying 
10847         whether we look for explicit user conversions too.
10848
10849         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10850
10851         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10852
10853         (ExplicitUserConversion): Make it a call to UserDefinedConversion
10854         with the appropriate arguments.
10855
10856         * cs-parser.jay (cast_expression): Record location too.
10857
10858         * expression.cs (Cast): Record location info.
10859
10860         (Expression::ConvertExplicit): Take location argument.
10861
10862         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10863         to determine if we are doing explicit conversions.
10864
10865         (UserCast::Emit): Update accordingly.
10866
10867         (Expression::ConvertExplicit): Report an error if everything fails.
10868
10869         * ../errors/cs0030.cs : Add.
10870
10871 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
10872
10873         * modifiers.cs: If the ABSTRACT keyword is present, also set the
10874         virtual and newslot bits. 
10875
10876         * class.cs (TypeContainer::RegisterRequiredImplementations):
10877         Record methods we need.
10878
10879         (TypeContainer::MakeKey): Helper function to make keys for
10880         MethodBases, since the Methodbase key is useless.
10881
10882         (TypeContainer::Populate): Call RegisterRequiredImplementations
10883         before defining the methods.   
10884
10885         Create a mapping for method_builders_to_methods ahead of time
10886         instead of inside a tight loop.
10887
10888         (::RequireMethods):  Accept an object as the data to set into the
10889         hashtable so we can report interface vs abstract method mismatch.
10890
10891 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10892
10893         * report.cs: Make all of it static.
10894
10895         * rootcontext.cs: Drop object_type and value_type computations, as
10896         we have those in the TypeManager anyways.
10897
10898         Drop report instance variable too, now it is a global.
10899
10900         * driver.cs: Use try/catch on command line handling.
10901
10902         Add --probe option to debug the error reporting system with a test
10903         suite. 
10904
10905         * report.cs: Add support for exiting program when a probe
10906         condition is reached.
10907
10908 2001-10-03  Ravi Pratap  <ravi@ximian.com>
10909
10910         * expression.cs (Binary::DoNumericPromotions): Fix the case when
10911         we do a forcible conversion regardless of type, to check if 
10912         ForceConversion returns a null.
10913
10914         (Binary::error19): Use location to report error.
10915
10916         (Unary::error23): Use location here too.
10917
10918         * ../errors/cs0019.cs : Check in.
10919
10920         * ../errors/cs0023.cs : Check in.
10921
10922         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10923         case of a non-null MethodInfo object with a length of 0 !
10924
10925         (Binary::ResolveOperator): Flag error if overload resolution fails to find
10926         an applicable member - according to the spec :-)
10927         Also fix logic to find members in base types.
10928
10929         (Unary::ResolveOperator): Same here.
10930
10931         (Unary::report23): Change name to error23 and make first argument a TypeContainer
10932         as I was getting thoroughly confused between this and error19 :-)
10933         
10934         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10935         (::FindMostEncompassedType): Implement.
10936         (::FindMostEncompassingType): Implement.
10937         (::StandardConversionExists): Implement.
10938
10939         (UserImplicitCast): Re-vamp. We now need info about most specific
10940         source and target types so that we can do the necessary conversions.
10941
10942         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10943         mathematical union with no duplicates.
10944
10945 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10946
10947         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10948         in order from base classes to child classes, so that we can in
10949         child classes look up in our parent for method names and
10950         attributes (required for handling abstract, virtual, new, override
10951         constructs: we need to instrospect our base class, and if we dont
10952         populate the classes in order, the introspection might be
10953         incorrect.  For example, a method could query its parent before
10954         the parent has any methods and would determine that the parent has
10955         no abstract methods (while it could have had them)).
10956
10957         (RootContext::CreateType): Record the order in which we define the
10958         classes.
10959
10960 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
10961
10962         * class.cs (TypeContainer::Populate): Also method definitions can
10963         fail now, keep track of this.
10964
10965         (TypeContainer::FindMembers): Implement support for
10966         DeclaredOnly/noDeclaredOnly flag.
10967
10968         (Constructor::Emit) Return the ConstructorBuilder.
10969
10970         (Method::Emit) Return the MethodBuilder. 
10971         Check for abstract or virtual methods to be public.
10972
10973         * rootcontext.cs (RootContext::CreateType): Register all the
10974         abstract methods required for the class to be complete and the
10975         interface methods that must be implemented. 
10976
10977         * cs-parser.jay: Report error 501 (method requires body if it is
10978         not marked abstract or extern).
10979
10980         * expression.cs (TypeOf::Emit): Implement.
10981
10982         * typemanager.cs: runtime_handle_type, new global type.
10983
10984         * class.cs (Property::Emit): Generate code for properties.
10985
10986 2001-10-02  Ravi Pratap  <ravi@ximian.com>
10987
10988         * expression.cs (Unary::ResolveOperator): Find operators on base type
10989         too - we now conform exactly to the spec.
10990
10991         (Binary::ResolveOperator): Same here.
10992
10993         * class.cs (Operator::Define): Fix minor quirk in the tests.
10994
10995         * ../errors/cs0215.cs : Added.
10996
10997         * ../errors/cs0556.cs : Added.
10998
10999         * ../errors/cs0555.cs : Added.
11000
11001 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11002
11003         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
11004         single integer which is really efficient
11005
11006 2001-10-01  Ravi Pratap  <ravi@ximian.com>
11007
11008         *  expression.cs (Expression::ImplicitUserConversion): Use location
11009         even in the case when we are examining True operators.
11010  
11011         * class.cs (Operator::Define): Perform extensive checks to conform
11012         with the rules for operator overloading in the spec.
11013
11014         * expression.cs (Expression::ImplicitReferenceConversion): Implement
11015         some of the other conversions mentioned in the spec.
11016
11017         * typemanager.cs (array_type): New static member for the System.Array built-in
11018         type.
11019
11020         (cloneable_interface): For System.ICloneable interface.
11021
11022         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
11023         we start resolving the tree and populating types.
11024
11025         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
11026  
11027 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11028
11029         * expression.cs (Expression::ExprClassFromMemberInfo,
11030         Expression::Literalize): Create literal expressions from
11031         FieldInfos which are literals.
11032
11033         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
11034         type casts, because they were wrong.  The test suite in tests
11035         caught these ones.
11036
11037         (ImplicitNumericConversion): ushort to ulong requires a widening
11038         cast. 
11039
11040         Int32 constant to long requires widening cast as well.
11041
11042         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
11043         for integers because the type on the stack is not i4.
11044
11045 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
11046
11047         * expression.cs (report118): require location argument. 
11048
11049         * parameter.cs: Do not dereference potential null value.
11050
11051         * class.cs: Catch methods that lack the `new' keyword when
11052         overriding a name.  Report warnings when `new' is used without
11053         anything being there to override.
11054
11055         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
11056
11057         * class.cs: Only add constructor to hashtable if it is non-null
11058         (as now constructors can fail on define).
11059
11060         (TypeManager, Class, Struct): Take location arguments.
11061
11062         Catch field instance initialization in structs as errors.
11063
11064         accepting_filter: a new filter for FindMembers that is static so
11065         that we dont create an instance per invocation.
11066
11067         (Constructor::Define): Catch errors where a struct constructor is
11068         parameterless 
11069
11070         * cs-parser.jay: Pass location information for various new
11071         constructs. 
11072         
11073         * delegate.cs (Delegate): take a location argument.
11074
11075         * driver.cs: Do not call EmitCode if there were problesm in the
11076         Definition of the types, as many Builders wont be there. 
11077
11078         * decl.cs (Decl::Decl): Require a location argument.
11079
11080         * cs-tokenizer.cs: Handle properly hex constants that can not fit
11081         into integers, and find the most appropiate integer for it.
11082
11083         * literal.cs: Implement ULongLiteral.
11084
11085         * rootcontext.cs: Provide better information about the location of
11086         failure when CreateType fails.
11087         
11088 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
11089
11090         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
11091         as well.
11092
11093         * expression.cs (Binary::CheckShiftArguments): Add missing type
11094         computation.
11095         (Binary::ResolveOperator): Add type to the logical and and logical
11096         or, Bitwise And/Or and Exclusive Or code paths, it was missing
11097         before.
11098
11099         (Binary::DoNumericPromotions): In the case where either argument
11100         is ulong (and most signed types combined with ulong cause an
11101         error) perform implicit integer constant conversions as well.
11102
11103 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11104
11105         * expression.cs (UserImplicitCast): Method should always be
11106         non-null. 
11107         (Invocation::BetterConversion): Simplified test for IntLiteral.
11108
11109         (Expression::ImplicitNumericConversion): Split this routine out.
11110         Put the code that performs implicit constant integer conversions
11111         here. 
11112
11113         (Expression::Resolve): Become a wrapper around DoResolve so we can
11114         check eclass and type being set after resolve.
11115
11116         (Invocation::Badness): Remove this dead function
11117
11118         (Binary::ResolveOperator): Do not compute the expensive argumnets
11119         unless we have a union for it.
11120
11121         (Probe::Emit): Is needs to do an isinst and then
11122         compare against null.
11123
11124         (::CanConvert): Added Location argument.  If the Location argument
11125         is null (Location.Null), then we do not report errors.  This is
11126         used by the `probe' mechanism of the Explicit conversion.  We do
11127         not want to generate an error for something that the user
11128         explicitly requested to be casted.  But the pipeline for an
11129         explicit cast first tests for potential implicit casts.
11130
11131         So for now, if the Location is null, it means `Probe only' to
11132         avoid adding another argument.   Might have to revise this
11133         strategy later.
11134
11135         (ClassCast): New class used to type cast objects into arbitrary
11136         classes (used in Explicit Reference Conversions).
11137
11138         Implement `as' as well.
11139
11140         Reverted all the patches from Ravi below: they were broken:
11141
11142                 * The use of `level' as a mechanism to stop recursive
11143                   invocations is wrong.  That was there just to catch the
11144                   bug with a strack trace but not as a way of addressing
11145                   the problem.
11146
11147                   To fix the problem we have to *understand* what is going
11148                   on and the interactions and come up with a plan, not
11149                   just get things going.
11150
11151                 * The use of the type conversion cache that I proposed
11152                   last night had an open topic: How does this work across
11153                   protection domains.  A user defined conversion might not
11154                   be public in the location where we are applying the
11155                   conversion, a different conversion might be selected
11156                   (ie, private A->B (better) but public B->A (worse),
11157                   inside A, A->B applies, but outside it, B->A will
11158                   apply).
11159
11160                 * On top of that (ie, even if the above is solved),
11161                   conversions in a cache need to be abstract.  Ie, `To
11162                   convert from an Int to a Short use an OpcodeCast', not
11163                   `To convert from an Int to a Short use the OpcodeCast on
11164                   the variable 5' (which is what this patch was doing).
11165         
11166 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11167
11168         * expression.cs (Invocation::ConversionExists): Re-write to use
11169         the conversion cache
11170         
11171         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11172         cache all conversions done, not just user-defined ones.
11173
11174         (Invocation::BetterConversion): The real culprit. Use ConversionExists
11175         to determine if a conversion exists instead of acutually trying to 
11176         perform the conversion. It's faster too.
11177
11178         (Expression::ConvertExplicit): Modify to use ConversionExists to check
11179         and only then attempt the implicit conversion.
11180
11181 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11182
11183         * expression.cs (ConvertImplicit): Use a cache for conversions
11184         already found. Check level of recursion and bail out if necessary.
11185         
11186 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11187
11188         * typemanager.cs (string_concat_string_string, string_concat_object_object):
11189         Export standard methods that we expect for string operations.
11190         
11191         * statement.cs (Block::UsageWarning): Track usage of variables and
11192         report the errors for not used variables.
11193
11194         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11195         operator. 
11196
11197 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11198
11199         * codegen.cs: remove unnneded code 
11200
11201         * expression.cs: Removed BuiltinTypeAccess class
11202
11203         Fix the order in which implicit conversions are
11204         done.  
11205
11206         The previous fixed dropped support for boxed conversions (adding a
11207         test to the test suite now)
11208
11209         (UserImplicitCast::CanConvert): Remove test for source being null,
11210         that code is broken.  We should not feed a null to begin with, if
11211         we do, then we should track the bug where the problem originates
11212         and not try to cover it up here.
11213
11214         Return a resolved expression of type UserImplicitCast on success
11215         rather than true/false.  Ravi: this is what I was talking about,
11216         the pattern is to use a static method as a "constructor" for
11217         objects. 
11218
11219         Also, do not create arguments until the very last minute,
11220         otherwise we always create the arguments even for lookups that
11221         will never be performed. 
11222
11223         (UserImplicitCast::Resolve): Eliminate, objects of type
11224         UserImplicitCast are born in a fully resolved state. 
11225         
11226         * typemanager.cs (InitCoreTypes): Init also value_type
11227         (System.ValueType). 
11228
11229         * expression.cs (Cast::Resolve): First resolve the child expression.
11230
11231         (LValue): Add new method AddressOf to be used by
11232         the `&' operator.  
11233
11234         Change the argument of Store to take an EmitContext instead of an
11235         ILGenerator, because things like FieldExpr need to be able to call
11236         their children expression to generate the instance code. 
11237
11238         (Expression::Error, Expression::Warning): Sugar functions for
11239         reporting errors.
11240
11241         (Expression::MemberLookup): Accept a TypeContainer instead of a
11242         Report as the first argument.
11243
11244         (Expression::ResolvePrimary): Killed.  I still want to improve
11245         this as currently the code is just not right.
11246
11247         (Expression::ResolveMemberAccess): Simplify, but it is still
11248         wrong. 
11249
11250         (Unary::Resolve): Catch errors in AddressOf operators.
11251
11252         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11253         index to a byte for the short-version, or the compiler will choose
11254         the wrong Emit call, which generates the wrong data.
11255
11256         (ParameterReference::Emit, ::Store): same.
11257
11258         (FieldExpr::AddressOf): Implement.
11259         
11260         * typemanager.cs: TypeManager: made public variable instead of
11261         property.
11262         
11263         * driver.cs: document --fatal.
11264
11265         * report.cs (ErrorMessage, WarningMessage): new names for the old
11266         Error and Warning classes.
11267
11268         * cs-parser.jay (member_access): Turn built-in access to types
11269         into a normal simplename
11270
11271 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11272
11273         * expression.cs (Invocation::BetterConversion): Fix to cope
11274         with q being null, since this was introducing a bug.
11275
11276         * expression.cs (ConvertImplicit): Do built-in conversions first.
11277
11278 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11279
11280         * expression.cs (UserImplicitCast::Resolve): Fix bug.
11281
11282 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11283
11284         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11285         I had introduced long ago (what's new ?).
11286
11287         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
11288         the work of all the checking. 
11289         (ConvertImplicit): Call CanConvert and only then create object if necessary.
11290         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11291
11292         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11293         that is the right way. 
11294
11295         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
11296         overloading resolution. Use everywhere instead of cutting and pasting code.
11297
11298         (Binary::ResolveOperator): Use MakeUnionSet.
11299
11300         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
11301         we have to convert to bool types. Not complete yet.
11302         
11303 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11304
11305         * typemanager.cs (TypeManager::CSharpName): support ushort.
11306
11307         * expression.cs (Expression::TryImplicitIntConversion): Attempts
11308         to provide an expression that performsn an implicit constant int
11309         conversion (section 6.1.6).
11310         (Expression::ConvertImplicitRequired): Reworked to include
11311         implicit constant expression conversions.
11312
11313         (Expression::ConvertNumericExplicit): Finished.
11314
11315         (Invocation::Emit): If InstanceExpression is null, then it means
11316         that we perform a call on this.
11317         
11318 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11319
11320         * expression.cs (Unary::Emit): Remove some dead code.
11321         (Probe): Implement Resolve and Emit for `is'.
11322         (Expression::ConvertImplicitRequired): Attempt to do constant
11323         expression conversions here.  Maybe should be moved to
11324         ConvertImplicit, but I am not sure.
11325         (Expression::ImplicitLongConstantConversionPossible,
11326         Expression::ImplicitIntConstantConversionPossible): New functions
11327         that tell whether is it possible to apply an implicit constant
11328         expression conversion.
11329
11330         (ConvertNumericExplicit): Started work on explicit numeric
11331         conversions.
11332
11333         * cs-parser.jay: Update operator constants.
11334
11335         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11336         (Parameters::GetSignature): Hook up VerifyArgs here.
11337         (Parameters::VerifyArgs): Verifies that no two arguments have the
11338         same name. 
11339
11340         * class.cs (Operator): Update the operator names to reflect the
11341         ones that the spec expects (as we are just stringizing the
11342         operator names).
11343         
11344         * expression.cs (Unary::ResolveOperator): Fix bug: Use
11345         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11346         previous usage did only work for our methods.
11347         (Expression::ConvertImplicit): Handle decimal implicit numeric
11348         conversions as well.
11349         (Expression::InternalTypeConstructor): Used to invoke constructors
11350         on internal types for default promotions.
11351
11352         (Unary::Emit): Implement special handling for the pre/post
11353         increment/decrement for overloaded operators, as they need to have
11354         the same semantics as the other operators.
11355
11356         (Binary::ResolveOperator): ditto.
11357         (Invocation::ConversionExists): ditto.
11358         (UserImplicitCast::Resolve): ditto.
11359         
11360 2001-09-26  Ravi Pratap  <ravi@ximian.com>
11361
11362         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11363         operator, return after emitting body. Regression tests pass again !
11364
11365         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11366         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11367         (Invocation::OverloadResolve): Ditto.
11368         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11369
11370         * everywhere : update calls to the above methods accordingly.
11371
11372 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11373
11374         * assign.cs (Assign): Make it inherit from ExpressionStatement.
11375
11376         * expression.cs (ExpressionStatement): New base class used for
11377         expressions that can appear in statements, so that we can provide
11378         an alternate path to generate expression that do not leave a value
11379         on the stack.
11380
11381         (Expression::Emit, and all the derivatives): We no longer return
11382         whether a value is left on the stack or not.  Every expression
11383         after being emitted leaves a single value on the stack.
11384
11385         * codegen.cs (EmitContext::EmitStatementExpression): Use the
11386         facilties of ExpressionStatement if possible.
11387
11388         * cs-parser.jay: Update statement_expression.
11389
11390 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
11391
11392         * driver.cs: Change the wording of message
11393
11394 2001-09-25  Ravi Pratap  <ravi@ximian.com>
11395
11396         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
11397         the type of the expression to the return type of the method if
11398         we have an overloaded operator match ! The regression tests pass again !
11399         (Unary::ResolveOperator): Ditto.
11400
11401         * expression.cs (Invocation::ConversionExists): Correct the member lookup
11402         to find "op_Implicit", not "implicit" ;-)
11403         (UserImplicitCast): New class to take care of user-defined implicit conversions.
11404         (ConvertImplicit, ForceConversion): Take TypeContainer argument
11405
11406         * everywhere : Correct calls to the above accordingly.
11407
11408         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11409         (ConvertImplicit): Do user-defined conversion if it exists.
11410
11411 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
11412
11413         * assign.cs: track location.
11414         (Resolve): Use implicit conversions on assignment.
11415
11416         * literal.cs: Oops.  Not good, Emit of short access values should
11417         pass (Bytes) or the wrong argument will be selected.
11418
11419         * expression.cs (Unary::Emit): Emit code for -expr.
11420         
11421         (Unary::ResolveOperator): Handle `Substract' for non-constants
11422         (substract from zero from the non-constants).
11423         Deal with Doubles as well. 
11424         
11425         (Expression::ConvertImplicitRequired): New routine that reports an
11426         error if no implicit conversion exists. 
11427
11428         (Invocation::OverloadResolve): Store the converted implicit
11429         expressions if we make them
11430         
11431 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11432
11433         * class.cs (ConstructorInitializer): Take a Location argument.
11434         (ConstructorBaseInitializer): Same here.
11435         (ConstructorThisInitializer): Same here.
11436
11437         * cs-parser.jay : Update all calls accordingly.
11438
11439         * expression.cs (Unary, Binary, New): Take location argument.
11440         Update accordingly everywhere.
11441
11442         * cs-parser.jay : Update all calls to the above to take a location
11443         argument.
11444
11445         * class.cs : Ditto.
11446
11447 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11448
11449         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11450         (Invocation::BetterConversion): Same here
11451         (Invocation::ConversionExists): Ditto.
11452
11453         (Invocation::ConversionExists): Implement.
11454
11455 2001-09-22  Ravi Pratap  <ravi@ximian.com>
11456
11457         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11458         Also take an additional TypeContainer argument.
11459
11460         * All over : Pass in TypeContainer as argument to OverloadResolve.
11461
11462         * typemanager.cs (CSharpName): Update to check for the string type and return
11463         that too.
11464
11465         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11466         a given method.
11467         
11468 2001-09-21  Ravi Pratap  <ravi@ximian.com>
11469
11470         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11471         (Invocation::BetterFunction): Implement.
11472         (Invocation::BetterConversion): Implement.
11473         (Invocation::ConversionExists): Skeleton, no implementation yet.
11474
11475         Okay, things work fine !
11476
11477 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
11478
11479         * typemanager.cs: declare and load enum_type, delegate_type and
11480         void_type. 
11481
11482         * expression.cs (Expression::Emit): Now emit returns a value that
11483         tells whether a value is left on the stack or not.  This strategy
11484         might be reveted tomorrow with a mechanism that would address
11485         multiple assignments.
11486         (Expression::report118): Utility routine to report mismatches on
11487         the ExprClass.
11488
11489         (Unary::Report23): Report impossible type/operator combination
11490         utility function.
11491
11492         (Unary::IsIncrementableNumber): Whether the type can be
11493         incremented or decremented with add.
11494         (Unary::ResolveOperator): Also allow enumerations to be bitwise
11495         complemented. 
11496         (Unary::ResolveOperator): Implement ++, !, ~,
11497
11498         (Invocation::Emit): Deal with new Emit convetion.
11499         
11500         * All Expression derivatives: Updated their Emit method to return
11501         whether they leave values on the stack or not.
11502         
11503         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11504         stack for expressions that are statements. 
11505
11506 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11507
11508         * expression.cs (LValue): New interface.  Must be implemented by
11509         LValue objects.
11510         (LocalVariableReference, ParameterReference, FieldExpr): Implement
11511         LValue interface.
11512         
11513         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11514         interface for generating code, simplifies the code.
11515
11516 2001-09-20  Ravi Pratap  <ravi@ximian.com>
11517
11518         * expression.cs (everywhere): Comment out return statements in ::Resolve
11519         methods to avoid the warnings.
11520
11521 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11522
11523         * driver.cs (parse): Report error 2001 if we can not open the
11524         source file.
11525
11526         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11527         not resolve it.
11528
11529         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11530         object. 
11531
11532         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11533         otherwise nested blocks end up with the same index.
11534
11535         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11536
11537         * expression.cs:  Instead of having FIXMEs in the Resolve
11538         functions, throw exceptions so it is obvious that we are facing a
11539         bug. 
11540
11541         * cs-parser.jay (invocation_expression): Pass Location information.
11542
11543         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11544         Use a basename for those routines because .NET does not like paths
11545         on them. 
11546
11547         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11548         already defined.
11549
11550 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
11551
11552         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11553         are loading the correct data types (throws an exception if not).
11554         (TypeManager::InitCoreTypes): Use CoreLookupType
11555
11556         * expression.cs (Unary::ResolveOperator): return the child
11557         expression for expressions which are just +expr.
11558         (Unary::ResolveOperator): Return negative literals for -LITERAL
11559         expressions (otherwise they are Unary {Literal}).
11560         (Invocation::Badness): Take into account `Implicit constant
11561         expression conversions'.
11562
11563         * literal.cs (LongLiteral): Implement long literal class.
11564         (IntLiteral): export the `Value' of the intliteral. 
11565
11566 2001-09-19  Ravi Pratap  <ravi@ximian.com>
11567
11568         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11569
11570         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
11571         instead of 'Operator'
11572
11573         * expression.cs (Binary::ResolveOperator): Update accordingly.
11574         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11575         and 'Minus'
11576
11577         * cs-parser.jay (unary_expression): Update to use the new names.
11578
11579         * gen-treedump.cs (GetUnary): Same here.
11580
11581         * expression.cs (Unary::Resolve): Implement.
11582         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
11583         operators are found instead of making noise ;-)
11584         (Unary::ResolveOperator): New method to do precisely the same thing which
11585         Binary::ResolveOperator does for Binary expressions.
11586         (Unary.method, .Arguments): Add.
11587         (Unary::OperName): Implement.   
11588         (Unary::ForceConversion): Copy and Paste !
11589
11590         * class.cs (Operator::Define): Fix a small bug for the case when we have 
11591         a unary operator.
11592
11593         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11594         for the inbuilt operators. Only overloading works for now ;-)
11595
11596 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
11597
11598         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11599         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11600
11601         * expression.cs (This::Emit): Implement. 
11602         (This::Resolve): Implement.
11603         (TypeOf:Resolve): Implement.
11604         (Expression::ResolveSimpleName): Add an implicit this to instance
11605         field references. 
11606         (MemberAccess::Resolve): Deal with Parameters and Fields. 
11607         Bind instance variable to Field expressions.
11608         (FieldExpr::Instance): New field used to track the expression that
11609         represents the object instance.
11610         (FieldExpr::Resolve): Track potential errors from MemberLookup not
11611         binding 
11612         (FieldExpr::Emit): Implement.
11613
11614         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11615         the last instruction contains a return opcode to avoid generating
11616         the last `ret' instruction (this generates correct code, and it is
11617         nice to pass the peverify output).
11618
11619         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11620         initializer for static and instance variables.
11621         (Constructor::Emit): Allow initializer to be null in the case of
11622         static constructors.  Only emit initializer for instance
11623         constructors. 
11624
11625         (TypeContainer::FindMembers): Return a null array if there are no
11626         matches.
11627
11628         Also fix the code for the MemberTypes.Method branch, as it was not
11629         scanning that for operators (or tried to access null variables before).
11630
11631         * assign.cs (Assign::Emit): Handle instance and static fields. 
11632
11633         * TODO: Updated.
11634
11635         * driver.cs: Stop compilation if there are parse errors.
11636
11637         * cs-parser.jay (constructor_declaration): Provide default base
11638         initializer for non-static constructors.
11639         (constructor_declarator): Do not provide a default base
11640         initializers if none was specified.
11641         Catch the fact that constructors should not have parameters.
11642
11643         * class.cs: Do not emit parent class initializers for static
11644         constructors, that should be flagged as an error.
11645
11646 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11647
11648         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11649         Move back code into TypeContainer::Populate.
11650
11651 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11652
11653         * class.cs (TypeContainer::AddConstructor): Fix the check to
11654         compare against Name, not Basename. 
11655         (Operator::OpType): Change Plus and Minus to Add and Subtract.
11656
11657         * cs-parser.jay : Update accordingly.
11658
11659         * class.cs (TypeContainer::FindMembers): For the case where we are searching
11660         for methods, don't forget to look into the operators too.
11661         (RegisterMethodBuilder): Helper method to take care of this for
11662         methods, constructors and operators.
11663         (Operator::Define): Completely revamp.
11664         (Operator.OperatorMethod, MethodName): New fields.
11665         (TypeContainer::Populate): Move the registering of builders into
11666         RegisterMethodBuilder.
11667         (Operator::Emit): Re-write.
11668
11669         * expression.cs (Binary::Emit): Comment out code path to emit method
11670         invocation stuff for the case when we have a user defined operator. I am
11671         just not able to get it right !
11672         
11673 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11674
11675         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11676         argument. 
11677
11678         (Expression::MemberLookup): Provide a version that allows to
11679         specify the MemberTypes and BindingFlags. 
11680
11681         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11682         so it was not fetching variable information from outer blocks.
11683
11684         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11685         Beforefieldinit as it was buggy.
11686
11687         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11688         that Ravi put here.  
11689
11690         * class.cs (Constructor::Emit): Only emit if block is not null.
11691         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11692         deal with this by semantically definining it as if the user had
11693         done it.
11694
11695         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11696         constructors as we now "emit" them at a higher level.
11697
11698         (TypeContainer::DefineDefaultConstructor): Used to define the
11699         default constructors if none was provided.
11700
11701         (ConstructorInitializer): Add methods Resolve and Emit. 
11702         
11703         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11704
11705 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11706
11707         * class.cs (TypeContainer::EmitDefaultConstructor): Register
11708         the default constructor builder with our hashtable for methodbuilders
11709         to methodcores.
11710
11711         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11712         and argument_count is 0 in which case we have a match.
11713         (Binary::ResolveOperator): More null checking and miscellaneous coding
11714         style cleanup.
11715
11716 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11717
11718         * rootcontext.cs (IsNameSpace): Compare against null.
11719
11720         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11721
11722         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11723         and Unary::Operator.
11724
11725         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11726         accordingly.
11727
11728         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11729         we have overloaded operators.
11730         (Binary::ResolveOperator): Implement the part which does the operator overload
11731         resolution.
11732
11733         * class.cs (Operator::Emit): Implement.
11734         (TypeContainer::Emit): Emit the operators we have too.
11735
11736         * expression.cs (Binary::Emit): Update to emit the appropriate code for
11737         the case when we have a user-defined operator.
11738         
11739 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11740
11741         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11742
11743 2001-09-16  Ravi Pratap  <ravi@ximian.com>
11744
11745         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11746         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11747         (Constructor::Emit): Implement.
11748         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11749         if we have no work to do. 
11750         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
11751         Emit method.
11752
11753         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11754         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11755
11756         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11757         of parent.parent.
11758
11759 2001-09-15  Ravi Pratap  <ravi@ximian.com>
11760
11761         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11762         in the source.
11763         (Tree::RecordNamespace): Method to do what the name says ;-)
11764         (Tree::Namespaces): Property to get at the namespaces hashtable.
11765
11766         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
11767         keep track.
11768
11769         * rootcontext.cs (IsNamespace): Fixed it :-)
11770
11771 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11772
11773         * class.cs (TypeContainer::FindMembers): Add support for
11774         constructors. 
11775         (MethodCore): New class that encapsulates both the shared aspects
11776         of a Constructor and a Method.  
11777         (Method, Constructor): Factored pieces into MethodCore.
11778
11779         * driver.cs: Added --fatal which makes errors throw exceptions.
11780         Load System assembly as well as part of the standard library.
11781
11782         * report.cs: Allow throwing exceptions on errors for debugging.
11783
11784         * modifiers.cs: Do not use `parent', instead use the real type
11785         container to evaluate permission settings.
11786
11787         * class.cs: Put Ravi's patch back in.  He is right, and we will
11788         have to cope with the
11789
11790 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11791
11792         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11793         FamORAssem, not FamANDAssem.
11794         
11795 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11796
11797         * driver.cs: Added --parse option that only parses its input files
11798         and terminates.
11799
11800         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
11801         incorrect.  IsTopLevel is not used to tell whether an object is
11802         root_types or not (that can be achieved by testing this ==
11803         root_types).  But to see if this is a top-level *class* (not
11804         necessarly our "toplevel" container). 
11805
11806 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11807
11808         * enum.cs (Enum::Define): Modify to call the Lookup method on the
11809         parent instead of a direct call to GetType.
11810
11811 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11812
11813         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11814         Modifiers.TypeAttr. This should just be a call to that method.
11815
11816         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11817         object so that we can determine if we are top-level or not.
11818
11819         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
11820         TypeContainer too.
11821
11822         * enum.cs (Enum::Define): Ditto.
11823
11824         * modifiers.cs (FieldAttr): Re-write.
11825
11826         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11827         (TypeContainer::HaveStaticConstructor): New property to provide access
11828         to precisely that info.
11829
11830         * modifiers.cs (MethodAttr): Re-write.
11831         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11832
11833         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11834         of top-level types as claimed.
11835         
11836 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11837
11838         * expression.cs (MemberLookup): Fruitless attempt to lookup
11839         constructors.  Maybe I need to emit default constructors?  That
11840         might be it (currently .NET emits this for me automatically).
11841         (Invocation::OverloadResolve): Cope with Arguments == null.
11842         (Invocation::EmitArguments): new function, shared by the new
11843         constructor and us.
11844         (Invocation::Emit): Handle static and instance methods.  Emit
11845         proper call instruction for virtual or non-virtual invocations.
11846         (New::Emit): Implement.
11847         (New::Resolve): Implement.
11848         (MemberAccess:Resolve): Implement.
11849         (MethodGroupExpr::InstanceExpression): used conforming to the spec
11850         to track instances.
11851         (FieldExpr::Resolve): Set type.
11852
11853         * support.cs: Handle empty arguments.
11854                 
11855         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11856         SimpleLookup): Auxiliary routines to help parse a qualifier
11857         identifier.  
11858
11859         Update qualifier_identifier rule.
11860
11861         * codegen.cs: Removed debugging messages.
11862
11863         * class.cs: Make this a global thing, this acts just as a "key" to
11864         objects that we might have around.
11865
11866         (Populate): Only initialize method_builders_to_methods once.
11867
11868         * expression.cs (PropertyExpr): Initialize type from the
11869         PropertyType. 
11870
11871         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11872         Resolve pattern.  Attempt to implicitly convert value to boolean.
11873         Emit code.
11874
11875         * expression.cs: Set the type for the int32/int32 argument case.
11876         (Binary::ResolveOperator): Set the return type to boolean for
11877         comparission operators
11878
11879         * typemanager.cs: Remove debugging print code.
11880
11881         (Invocation::Resolve): resolve type.
11882
11883         * class.cs: Allocate a MemberInfo of the correct size, as the code
11884         elsewhere depends on the test to reflect the correct contents.
11885
11886         (Method::) Keep track of parameters, due to System.Reflection holes
11887
11888         (TypeContainer::Populate): Keep track of MethodBuilders to Method
11889         mapping here.
11890
11891         (TypeContainer::FindMembers): Use ArrayList and then copy an array
11892         of the exact size and return that.
11893
11894         (Class::LookupMethodByBuilder): New function that maps
11895         MethodBuilders to its methods.  Required to locate the information
11896         on methods because System.Reflection bit us again.
11897
11898         * support.cs: New file, contains an interface ParameterData and
11899         two implementations: ReflectionParameters and InternalParameters
11900         used to access Parameter information.  We will need to grow this
11901         as required.
11902
11903         * expression.cs (Invocation::GetParameterData): implement a cache
11904         and a wrapper around the ParameterData creation for methods. 
11905         (Invocation::OverloadResolve): Use new code.
11906
11907 2001-09-13  Ravi Pratap  <ravi@ximian.com>
11908
11909         * class.cs (TypeContainer::EmitField): Remove and move into 
11910         (Field::Define): here and modify accordingly.
11911         (Field.FieldBuilder): New member.
11912         (TypeContainer::Populate): Update accordingly.
11913         (TypeContainer::FindMembers): Implement.
11914
11915 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11916
11917         * statement.cs: (VariableInfo::VariableType): New field to be
11918         initialized with the full type once it is resolved. 
11919
11920 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
11921
11922         * parameter.cs (GetParameterInfo): Use a type cache to compute
11923         things only once, and to reuse this information
11924
11925         * expression.cs (LocalVariableReference::Emit): Implement.
11926         (OpcodeCast::Emit): fix.
11927
11928         (ParameterReference::Resolve): Implement.
11929         (ParameterReference::Emit): Implement.
11930
11931         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11932         that are expressions need to stay as Expressions.
11933
11934         * typemanager.cs (CSharpName): Returns the C# name of a type if
11935         possible. 
11936
11937         * expression.cs (Expression::ConvertImplicit): New function that
11938         implements implicit type conversions.
11939
11940         (Expression::ImplicitReferenceConversion): Implements implicit
11941         reference conversions.
11942
11943         (EmptyCast): New type for transparent casts.
11944
11945         (OpcodeCast): New type for casts of types that are performed with
11946         a sequence of bytecodes.
11947         
11948         (BoxedCast): New type used for casting value types into reference
11949         types.  Emits a box opcode.
11950
11951         (Binary::DoNumericPromotions): Implements numeric promotions of
11952         and computation of the Binary::Type.
11953
11954         (Binary::EmitBranchable): Optimization.
11955
11956         (Binary::Emit): Implement code emission for expressions.
11957         
11958         * typemanager.cs (TypeManager): Added two new core types: sbyte
11959         and byte.
11960
11961 2001-09-12  Ravi Pratap  <ravi@ximian.com>
11962
11963         * class.cs (TypeContainer::FindMembers): Method which does exactly
11964         what Type.FindMembers does, only we don't have to use reflection. No
11965         implementation yet.
11966
11967         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11968         typecontainer objects as we need to get at them.
11969         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11970
11971         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11972         typecontainer object.
11973
11974         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11975         of just a Report object.
11976
11977 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11978
11979         * class.cs (Event::Define): Go back to using the prefixes "add_" and
11980         "remove_"
11981         (TypeContainer::Populate): Now define the delegates of the type too.
11982         (TypeContainer.Delegates): Property to access the list of delegates defined
11983         in the type.
11984
11985         * delegates.cs (Delegate::Define): Implement partially.
11986
11987         * modifiers.cs (TypeAttr): Handle more flags.
11988
11989 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11990
11991         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11992         and not <=
11993         (Operator::Define): Re-write logic to get types by using the LookupType method
11994         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11995         (Indexer::Define): Ditto.
11996         (Event::Define): Ditto.
11997         (Property::Define): Ditto.
11998         
11999 2001-09-10  Ravi Pratap  <ravi@ximian.com>
12000
12001         * class.cs (TypeContainer::Populate): Now define operators too. 
12002         (TypeContainer.Operators): New property to access the list of operators
12003         in a type.
12004         (Operator.OperatorMethodBuilder): New member to hold the method builder
12005         for the operator we are defining.
12006         (Operator::Define): Implement.
12007
12008 2001-09-10  Ravi Pratap  <ravi@ximian.com>
12009
12010         * class.cs (Event::Define): Make the prefixes of the accessor methods
12011         addOn_ and removeOn_ 
12012
12013         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
12014         of the location being passed in too. Ideally, this should go later since all
12015         error reporting should be done through the Report object.
12016
12017         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
12018         (Populate): Iterate thru the indexers we have and define them too.
12019         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
12020         for the get and set accessors.
12021         (Indexer::Define): Implement.
12022         
12023 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
12024
12025         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
12026         my previous implementation, did not work.
12027
12028         * typemanager.cs: Add a couple of missing types (the longs).
12029
12030         * literal.cs: Use TypeManager.bool_type instead of getting it.
12031
12032         * expression.cs (EventExpr): New kind of expressions.
12033         (Expressio::ExprClassFromMemberInfo): finish
12034
12035 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
12036
12037         * assign.cs: Emit stores to static fields differently.
12038
12039 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12040
12041         * Merge in changes and adjust code to tackle conflicts. Backed out my
12042         code in Assign::Resolve ;-) 
12043
12044 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12045
12046         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
12047         instead Report.Error and also pass in the location.
12048         (CSharpParser::Lexer): New readonly property to return the reference
12049         to the Tokenizer object.
12050         (declare_local_variables): Use Report.Error with location instead of plain 
12051         old error.
12052         (CheckDef): Ditto.
12053
12054         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
12055         (Operator.CheckBinaryOperator): Ditto.
12056
12057         * cs-parser.jay (operator_declarator): Update accordingly.
12058
12059         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
12060         (CheckBinaryOperator): Same here.
12061
12062         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
12063         on the name without any prefixes of namespace names etc. This is because we
12064         already might have something already fully qualified like 
12065         'System.Console.WriteLine'
12066
12067         * assign.cs (Resolve): Begin implementation. Stuck ;-)
12068
12069 2001-09-07  Ravi Pratap  <ravi@ximian.com>
12070
12071         * cs-tokenizer.cs (location): Return a string which also contains
12072         the file name.
12073
12074         * expression.cs (ElementAccess): New class for expressions of the
12075         type 'element access.'
12076         (BaseAccess): New class for expressions of the type 'base access.'
12077         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
12078         respectively.
12079         
12080         * cs-parser.jay (element_access): Implement action.
12081         (base_access): Implement actions.
12082         (checked_expression, unchecked_expression): Implement.
12083
12084         * cs-parser.jay (local_variable_type): Correct and implement.
12085         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
12086
12087         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
12088
12089         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
12090         name and the specifiers.
12091
12092         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
12093         
12094         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
12095         making them all public ;-)
12096
12097         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
12098         class anyways.
12099         
12100 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
12101
12102         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
12103         PropertyExprs.
12104         (FieldExpr, PropertyExprs): New resolved expressions.
12105         (SimpleName::MemberStaticCheck): Perform static checks for access
12106         to non-static fields on static methods. Maybe this should be
12107         generalized for MemberAccesses. 
12108         (SimpleName::ResolveSimpleName): More work on simple name
12109         resolution. 
12110
12111         * cs-parser.jay (primary_expression/qualified_identifier): track
12112         the parameter index.
12113
12114         * codegen.cs (CodeGen::Save): Catch save exception, report error.
12115         (EmitContext::EmitBoolExpression): Chain to expression generation
12116         instead of temporary hack.
12117         (::EmitStatementExpression): Put generic expression code generation.
12118
12119         * assign.cs (Assign::Emit): Implement variable assignments to
12120         local variables, parameters and fields.
12121
12122 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
12123
12124         * statement.cs (Block::GetVariableInfo): New method, returns the
12125         VariableInfo for a variable name in a block.
12126         (Block::GetVariableType): Implement in terms of GetVariableInfo
12127
12128         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12129         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12130
12131 2001-09-06  Ravi Pratap  <ravi@ximian.com>
12132
12133         * cs-parser.jay (operator_declaration): Continue on my quest : update
12134         to take attributes argument.
12135         (event_declaration): Ditto.
12136         (enum_declaration): Ditto.
12137         (indexer_declaration): Ditto.
12138         
12139         * class.cs (Operator::Operator): Update constructor accordingly.
12140         (Event::Event): Ditto.
12141
12142         * delegate.cs (Delegate::Delegate): Same here.
12143
12144         * enum.cs (Enum::Enum): Same here.
12145         
12146 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12147
12148         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12149
12150         * ../tests/cs0658.cs : New file to demonstrate error 0658.
12151
12152         * attribute.cs (Attributes): New class to encapsulate all attributes which were
12153         being passed around as an arraylist.
12154         (Attributes::AddAttribute): Method to add attribute sections.
12155
12156         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12157         (struct_declaration): Update accordingly.
12158         (constant_declaration): Update.
12159         (field_declaration): Update.
12160         (method_header): Update.
12161         (fixed_parameter): Update.
12162         (parameter_array): Ditto.
12163         (property_declaration): Ditto.
12164         (destructor_declaration): Ditto.
12165         
12166         * class.cs (Struct::Struct): Update constructors accordingly.
12167         (Class::Class): Ditto.
12168         (Field::Field): Ditto.
12169         (Method::Method): Ditto.
12170         (Property::Property): Ditto.
12171         (TypeContainer::OptAttribute): update property's return type.
12172         
12173         * interface.cs (Interface.opt_attributes): New member.
12174         (Interface::Interface): Update to take the extra Attributes argument.
12175
12176         * parameter.cs (Parameter::Parameter): Ditto.
12177
12178         * constant.cs (Constant::Constant): Ditto.
12179
12180         * interface.cs (InterfaceMemberBase): New OptAttributes field.
12181         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
12182         the attributes as a parameter.
12183         (InterfaceProperty): Update constructor call.
12184         (InterfaceEvent): Ditto.
12185         (InterfaceMethod): Ditto.
12186         (InterfaceIndexer): Ditto.
12187
12188         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
12189         pass the attributes too.
12190         (interface_event_declaration): Ditto.
12191         (interface_property_declaration): Ditto.
12192         (interface_method_declaration): Ditto.
12193         (interface_declaration): Ditto.
12194
12195 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
12196
12197         * class.cs (Method::Define): Track the "static Main" definition to
12198         create an entry point. 
12199
12200         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12201         EntryPoint if we find it. 
12202
12203         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12204         (EmitContext::ig): Make this variable public.
12205
12206         * driver.cs: Make the default output file be the first file name
12207         with the .exe extension.  
12208
12209         Detect empty compilations
12210
12211         Handle various kinds of output targets.  Handle --target and
12212         rename -t to --dumper.
12213
12214         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
12215         methods inherited from Expression return now an Expression.  This
12216         will is used during the tree rewriting as we resolve them during
12217         semantic analysis.
12218
12219         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
12220         the spec.  Missing entirely is the information about
12221         accessability of elements of it.
12222
12223         (Expression::ExprClassFromMemberInfo): New constructor for
12224         Expressions that creates a fully initialized Expression based on
12225         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
12226         a Type.
12227
12228         (Invocation::Resolve): Begin implementing resolution of invocations.
12229         
12230         * literal.cs (StringLiteral):  Implement Emit.
12231
12232 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12233
12234         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12235         member.
12236         
12237 2001-09-04  Ravi Pratap  <ravi@ximian.com>
12238
12239         * cs-parser.jay (attribute_arguments): Implement actions.
12240         (attribute): Fix bug in production. Implement action.
12241         (attribute_list): Implement.
12242         (attribute_target): Implement.
12243         (attribute_target_specifier, opt_target_specifier): Implement
12244         (CheckAttributeTarget): New method to check if the attribute target
12245         is valid.
12246         (attribute_section): Implement.
12247         (opt_attributes): Implement.
12248
12249         * attribute.cs : New file to handle attributes.
12250         (Attribute): Class to hold attribute info.
12251
12252         * cs-parser.jay (opt_attribute_target_specifier): Remove production
12253         (attribute_section): Modify production to use 2 different rules to 
12254         achieve the same thing. 1 s/r conflict down !
12255         Clean out commented, useless, non-reducing dimension_separator rules.
12256         
12257         * class.cs (TypeContainer.attributes): New member to hold list
12258         of attributes for a type.
12259         (Struct::Struct): Modify to take one more argument, the attribute list.
12260         (Class::Class): Ditto.
12261         (Field::Field): Ditto.
12262         (Method::Method): Ditto.
12263         (Property::Property): Ditto.
12264         
12265         * cs-parser.jay (struct_declaration): Update constructor call to
12266         pass in the attributes too.
12267         (class_declaration): Ditto.
12268         (constant_declaration): Ditto.
12269         (field_declaration): Ditto.
12270         (method_header): Ditto.
12271         (fixed_parameter): Ditto.
12272         (parameter_array): Ditto.
12273         (property_declaration): Ditto.
12274
12275         * constant.cs (Constant::Constant): Update constructor similarly.
12276         Use System.Collections.
12277
12278         * parameter.cs (Parameter::Parameter): Update as above.
12279
12280 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12281
12282         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12283         (TypeContainer.delegates): New member to hold list of delegates.
12284
12285         * cs-parser.jay (delegate_declaration): Implement the action correctly 
12286         this time as I seem to be on crack ;-)
12287
12288 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
12289
12290         * rootcontext.cs (RootContext::IsNamespace): new function, used to
12291         tell whether an identifier represents a namespace.
12292
12293         * expression.cs (NamespaceExpr): A namespace expression, used only
12294         temporarly during expression resolution.
12295         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12296         utility functions to resolve names on expressions.
12297
12298 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
12299
12300         * codegen.cs: Add hook for StatementExpressions. 
12301
12302         * class.cs: Fix inverted test for static flag in methods.
12303
12304 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12305
12306         * class.cs (Operator::CheckUnaryOperator): Correct error number used
12307         to make it coincide with MS' number.
12308         (Operator::CheckBinaryOperator): Ditto.
12309
12310         * ../errors/errors.txt : Remove error numbers added earlier.
12311
12312         * ../errors/cs1019.cs : Test case for error # 1019
12313
12314         * ../errros/cs1020.cs : Test case for error # 1020
12315
12316         * cs-parser.jay : Clean out commented cruft.
12317         (dimension_separators, dimension_separator): Comment out. Ostensibly not
12318         used anywhere - non-reducing rule.
12319         (namespace_declarations): Non-reducing rule - comment out.
12320
12321         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12322         with TypeContainer::AddEnum.
12323
12324         * delegate.cs : New file for delegate handling classes.
12325         (Delegate): Class for declaring delegates.
12326
12327         * makefile : Update.
12328
12329         * cs-parser.jay (delegate_declaration): Implement.
12330
12331 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
12332
12333         * class.cs (Event::Define): Implement.
12334         (Event.EventBuilder): New member.
12335
12336         * class.cs (TypeContainer::Populate): Update to define all enums and events
12337         we have.
12338         (Events): New property for the events arraylist we hold. Shouldn't we move to using
12339         readonly fields for all these cases ?
12340
12341 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12342
12343         * class.cs (Property): Revamp to use the convention of making fields readonly.
12344         Accordingly modify code elsewhere.
12345
12346         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12347         the Define method of the Property class.
12348
12349         * class.cs : Clean up applied patch and update references to variables etc. Fix 
12350         trivial bug.
12351         (TypeContainer::Populate): Update to define all the properties we have. Also
12352         define all enumerations.
12353
12354         * enum.cs (Define): Implement.
12355         
12356 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12357
12358         * cs-parser.jay (overloadable_operator): The semantic value is an
12359         enum of the Operator class.
12360         (operator_declarator): Implement actions.
12361         (operator_declaration): Implement.
12362
12363         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12364         validity of definitions.
12365         (Operator::CheckBinaryOperator): Static method to check for binary operators
12366         (TypeContainer::AddOperator): New method to add an operator to a type.
12367
12368         * cs-parser.jay (indexer_declaration): Added line to actually call the
12369         AddIndexer method so it gets added ;-)
12370
12371         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
12372         already taken care of by the MS compiler ?  
12373
12374 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12375
12376         * class.cs (Operator): New class for operator declarations.
12377         (Operator::OpType): Enum for the various operators.
12378
12379 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12380
12381         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12382         ostensibly handle this in semantic analysis.
12383
12384         * cs-parser.jay (general_catch_clause): Comment out
12385         (specific_catch_clauses, specific_catch_clause): Ditto.
12386         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12387         (catch_args, opt_catch_args): New productions.
12388         (catch_clause): Rewrite to use the new productions above
12389         (catch_clauses): Modify accordingly.
12390         (opt_catch_clauses): New production to use in try_statement
12391         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12392         and re-write the code in the actions to extract the specific and
12393         general catch clauses by being a little smart ;-)
12394
12395         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12396         Hooray, try and catch statements parse fine !
12397         
12398 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12399
12400         * statement.cs (Block::GetVariableType): Fix logic to extract the type
12401         string from the hashtable of variables.
12402
12403         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12404         I end up making that mistake ;-)
12405         (catch_clauses): Fixed gross error which made Key and Value of the 
12406         DictionaryEntry the same : $1 !!
12407
12408 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12409
12410         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12411
12412         * cs-parser.jay (event_declaration): Correct to remove the semicolon
12413         when the add and remove accessors are specified. 
12414
12415 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12416
12417         * cs-parser.jay (IndexerDeclaration): New helper class to hold
12418         information about indexer_declarator.
12419         (indexer_declarator): Implement actions.
12420         (parsing_indexer): New local boolean used to keep track of whether
12421         we are parsing indexers or properties. This is necessary because 
12422         implicit_parameters come into picture even for the get accessor in the 
12423         case of an indexer.
12424         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12425
12426         * class.cs (Indexer): New class for indexer declarations.
12427         (TypeContainer::AddIndexer): New method to add an indexer to a type.
12428         (TypeContainer::indexers): New member to hold list of indexers for the
12429         type.
12430
12431 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12432
12433         * cs-parser.jay (add_accessor_declaration): Implement action.
12434         (remove_accessor_declaration): Implement action.
12435         (event_accessors_declaration): Implement
12436         (variable_declarators): swap statements for first rule - trivial.
12437
12438         * class.cs (Event): New class to hold information about event
12439         declarations.
12440         (TypeContainer::AddEvent): New method to add an event to a type
12441         (TypeContainer::events): New member to hold list of events.
12442
12443         * cs-parser.jay (event_declaration): Implement actions.
12444
12445 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12446
12447         * cs-parser.jay (dim_separators): Implement. Make it a string
12448         concatenating all the commas together, just as they appear.
12449         (opt_dim_separators): Modify accordingly
12450         (rank_specifiers): Update accordingly. Basically do the same
12451         thing - instead, collect the brackets here.
12452         (opt_rank_sepcifiers): Modify accordingly.
12453         (array_type): Modify to actually return the complete type string
12454         instead of ignoring the rank_specifiers.
12455         (expression_list): Implement to collect the expressions
12456         (variable_initializer): Implement. We make it a list of expressions
12457         essentially so that we can handle the array_initializer case neatly too.
12458         (variable_initializer_list): Implement.
12459         (array_initializer): Make it a list of variable_initializers
12460         (opt_array_initializer): Modify accordingly.
12461
12462         * expression.cs (New::NType): Add enumeration to help us
12463         keep track of whether we have an object/delegate creation
12464         or an array creation.
12465         (New:NewType, New::Rank, New::Indices, New::Initializers): New
12466         members to hold data about array creation.
12467         (New:New): Modify to update NewType
12468         (New:New): New Overloaded contructor for the array creation
12469         case.
12470
12471         * cs-parser.jay (array_creation_expression): Implement to call
12472         the overloaded New constructor.
12473         
12474 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
12475
12476         * class.cs (TypeContainer::Constructors): Return member
12477         constructors instead of returning null.
12478
12479 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
12480
12481         * typemanager.cs (InitCoreTypes): Initialize the various core
12482         types after we have populated the type manager with the user
12483         defined types (this distinction will be important later while
12484         compiling corlib.dll)
12485
12486         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12487         on Expression Classification.  Now all expressions have a method
12488         `Resolve' and a method `Emit'.
12489
12490         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12491         generation from working.     Also add some temporary debugging
12492         code. 
12493         
12494 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
12495
12496         * codegen.cs: Lots of code generation pieces.  This is only the
12497         beginning, will continue tomorrow with more touches of polish.  We
12498         handle the fundamentals of if, while, do, for, return.  Others are
12499         trickier and I need to start working on invocations soon.
12500         
12501         * gen-treedump.cs: Bug fix, use s.Increment here instead of
12502         s.InitStatement. 
12503
12504         * codegen.cs (EmitContext): New struct, used during code
12505         emission to keep a context.   Most of the code generation will be
12506         here. 
12507
12508         * cs-parser.jay: Add embedded blocks to the list of statements of
12509         this block.  So code generation proceeds in a top down fashion.
12510
12511 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
12512
12513         * statement.cs: Add support for multiple child blocks.
12514
12515 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
12516
12517         * codegen.cs (EmitCode): New function, will emit the code for a
12518         Block of code given a TypeContainer and its ILGenerator. 
12519
12520         * statement.cs (Block): Standard public readonly optimization.
12521         (Block::Block constructors): Link children. 
12522         (Block::Child): Child Linker.
12523         (Block::EmitVariables): Emits IL variable declarations.
12524
12525         * class.cs: Drop support for MethodGroups here, delay until
12526         Semantic Analysis.
12527         (Method::): Applied the same simplification that I did before, and
12528         move from Properties to public readonly fields.
12529         (Method::ParameterTypes): Returns the parameter types for the
12530         function, and implements a cache that will be useful later when I
12531         do error checking and the semantic analysis on the methods is
12532         performed.
12533         (Constructor::GetCallingConvention): Renamed from CallingConvetion
12534         and made a method, optional argument tells whether this is a class
12535         or a structure to apply the `has-this' bit.
12536         (Method::GetCallingConvention): Implement, returns the calling
12537         convention. 
12538         (Method::Define): Defines the type, a second pass is performed
12539         later to populate the methods.
12540
12541         (Constructor::ParameterTypes): implement a cache similar to the
12542         one on Method::ParameterTypes, useful later when we do semantic
12543         analysis. 
12544
12545         (TypeContainer::EmitMethod):  New method.  Emits methods.
12546
12547         * expression.cs: Removed MethodGroup class from here.
12548         
12549         * parameter.cs (Parameters::GetCallingConvention): new method.
12550
12551 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
12552
12553         * class.cs (TypeContainer::Populate): Drop RootContext from the
12554         argument. 
12555
12556         (Constructor::CallingConvention): Returns the calling convention.
12557         (Constructor::ParameterTypes): Returns the constructor parameter
12558         types. 
12559         
12560         (TypeContainer::AddConstructor): Keep track of default constructor
12561         and the default static constructor.
12562
12563         (Constructor::) Another class that starts using `public readonly'
12564         instead of properties. 
12565
12566         (Constructor::IsDefault): Whether this is a default constructor. 
12567
12568         (Field::) use readonly public fields instead of properties also.
12569
12570         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12571         track of static constructors;  If none is used, turn on
12572         BeforeFieldInit in the TypeAttributes. 
12573
12574         * cs-parser.jay (opt_argument_list): now the return can be null
12575         for the cases where there are no arguments. 
12576
12577         (constructor_declarator): If there is no implicit `base' or
12578         `this', then invoke the default parent constructor. 
12579         
12580         * modifiers.cs (MethodAttr): New static function maps a set of
12581         modifiers flags into a MethodAttributes enum
12582         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
12583         MethodAttr, TypeAttr to represent the various mappings where the
12584         modifiers are used.
12585         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
12586
12587 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
12588
12589         * parameter.cs (GetParameterInfo): Fix bug where there would be no
12590         method arguments.
12591
12592         * interface.cs (PopulateIndexer): Implemented the code generator
12593         for interface indexers.
12594
12595 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
12596
12597         * interface.cs (InterfaceMemberBase): Now we track the new status
12598         here.  
12599
12600         (PopulateProperty): Implement property population.  Woohoo!  Got
12601         Methods and Properties going today. 
12602
12603         Removed all the properties for interfaces, and replaced them with
12604         `public readonly' fields. 
12605
12606 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
12607
12608         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12609         initialize their hashtables/arraylists only when they are needed
12610         instead of doing this always.
12611
12612         * parameter.cs: Handle refs and out parameters.
12613
12614         * cs-parser.jay: Use an ArrayList to construct the arguments
12615         instead of the ParameterCollection, and then cast that to a
12616         Parameter[] array.
12617
12618         * parameter.cs: Drop the use of ParameterCollection and use
12619         instead arrays of Parameters.
12620
12621         (GetParameterInfo): Use the Type, not the Name when resolving
12622         types. 
12623
12624 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
12625
12626         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12627         and instead use public readonly fields.
12628
12629         * class.cs: Put back walking code for type containers.
12630
12631 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
12632
12633         * class.cs (MakeConstant): Code to define constants.
12634
12635         * rootcontext.cs (LookupType): New function.  Used to locate types 
12636
12637         
12638 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
12639
12640         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
12641         this System.Reflection code is.  Kudos to Microsoft
12642         
12643         * typemanager.cs: Implement a type cache and avoid loading all
12644         types at boot time.  Wrap in LookupType the internals.  This made
12645         the compiler so much faster.  Wow.  I rule!
12646         
12647         * driver.cs: Make sure we always load mscorlib first (for
12648         debugging purposes, nothing really important).
12649
12650         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
12651         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
12652
12653         * rootcontext.cs: Lookup types on their namespace;  Lookup types
12654         on namespaces that have been imported using the `using' keyword.
12655
12656         * class.cs (TypeContainer::TypeAttr): Virtualize.
12657         (Class::TypeAttr): Return attributes suitable for this bad boy.
12658         (Struct::TypeAttr): ditto.
12659         Handle nested classes.
12660         (TypeContainer::) Remove all the type visiting code, it is now
12661         replaced with the rootcontext.cs code
12662
12663         * rootcontext.cs (GetClassBases): Added support for structs. 
12664
12665 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
12666
12667         * interface.cs, statement.cs, class.cs, parameter.cs,
12668         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12669         Drop use of TypeRefs, and use strings instead.
12670
12671 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
12672
12673         * rootcontext.cs: 
12674
12675         * class.cs (Struct::Struct): set the SEALED flags after
12676         checking the modifiers.
12677         (TypeContainer::TypeAttr): new property, returns the
12678         TypeAttributes for a class.  
12679
12680         * cs-parser.jay (type_list): Oops, list production was creating a
12681         new list of base types.
12682
12683         * rootcontext.cs (StdLib): New property.
12684         (GetInterfaceTypeByName): returns an interface by type name, and
12685         encapsulates error handling here.
12686         (GetInterfaces): simplified.
12687         (ResolveTree): Encapsulated all the tree resolution here.
12688         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12689         types. 
12690         
12691         * driver.cs: Add support for --nostdlib, to avoid loading the
12692         default assemblies.
12693         (Main): Do not put tree resolution here. 
12694
12695         * rootcontext.cs: Beginning of the class resolution.
12696
12697 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
12698
12699         * rootcontext.cs: Provide better error reporting. 
12700
12701         * cs-parser.jay (interface_base): set our $$ to be interfaces.
12702
12703         * rootcontext.cs (CreateInterface): Handle the case where there
12704         are no parent interfaces.
12705         
12706         (CloseTypes): Routine to flush types at the end.
12707         (CreateInterface): Track types.
12708         (GetInterfaces): Returns an array of Types from the list of
12709         defined interfaces.
12710
12711         * typemanager.c (AddUserType): Mechanism to track user types (puts
12712         the type on the global type hash, and allows us to close it at the
12713         end). 
12714         
12715 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
12716
12717         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12718         RecordInterface instead.
12719
12720         * cs-parser.jay: Updated to reflect changes above.
12721
12722         * decl.cs (Definition): Keep track of the TypeBuilder type that
12723         represents this type here.  Not sure we will use it in the long
12724         run, but wont hurt for now.
12725
12726         * driver.cs: Smaller changes to accomodate the new code.
12727
12728         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12729         when done. 
12730
12731         * rootcontext.cs (CreateInterface):  New method, used to create
12732         the System.TypeBuilder type for interfaces.
12733         (ResolveInterfaces): new entry point to resolve the interface
12734         hierarchy. 
12735         (CodeGen): Property, used to keep track of the code generator.
12736
12737 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
12738
12739         * cs-parser.jay: Add a second production for delegate_declaration
12740         with `VOID'.
12741
12742         (enum_body): Put an opt_comma here instead of putting it on
12743         enum_body or enum_member_declarations so we can handle trailing
12744         commas on enumeration members.  Gets rid of a shift/reduce.
12745         
12746         (type_list): Need a COMMA in the middle.
12747
12748         (indexer_declaration): Tell tokenizer to recognize get/set
12749
12750         * Remove old targets.
12751
12752         * Re-add the parser target.
12753
12754 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12755
12756         * cs-parser.jay: Add precendence rules for a number of operators
12757         ot reduce the number of shift/reduce conflicts in the grammar.
12758         
12759 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
12760
12761         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12762         and put it here.
12763
12764         Get rid of old crufty code.
12765
12766         * rootcontext.cs: Use this to keep track of the parsed
12767         representation and the defined types available to the program. 
12768
12769         * gen-treedump.cs: adjust for new convention.
12770
12771         * type.cs: Split out the type manager, and the assembly builder
12772         from here. 
12773
12774         * typemanager.cs: the type manager will live here now.
12775
12776         * cil-codegen.cs: And the code generator here. 
12777
12778 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
12779
12780         * makefile: Fixed up for easy making.
12781
12782 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12783
12784         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12785         the 
12786
12787         (unary_expression): Expand pre_increment_expression and
12788         post_decrement_expression to reduce a shift/reduce.
12789
12790 2001-07-11  Simon Cozens
12791
12792         * cs-tokenizer.cs: Hex numbers should begin with a 0.
12793
12794         Improve allow_keyword_as_indent name.
12795
12796 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
12797
12798         * Adjustments for Beta2. 
12799
12800 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
12801
12802         * decl.cs: Added `Define' abstract method.
12803         (InTransit): new property, used to catch recursive definitions. 
12804
12805         * interface.cs: Implement `Define'. 
12806
12807         * modifiers.cs: Map Modifiers.constants to
12808         System.Reflection.TypeAttribute flags.
12809
12810         * class.cs: Keep track of types and user-defined types.
12811         (BuilderInit): New method for creating an assembly
12812         (ResolveType): New function to launch the resolution process, only
12813         used by interfaces for now.
12814
12815         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12816         that are inserted into the name space. 
12817
12818 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
12819
12820         * ARGH.  I have screwed up my tree so many times due to the use of
12821         rsync rather than using CVS.  Going to fix this at once. 
12822
12823         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
12824         load types.
12825
12826 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
12827
12828         * Experiment successful: Use System.Type rather that our own
12829         version of Type.  
12830
12831 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
12832
12833         * cs-parser.jay: Removed nsAliases from here.
12834
12835         Use new namespaces, handle `using XXX;' 
12836
12837         * namespace.cs: Reimplemented namespace handling, use a recursive
12838         definition of the class.  Now we can keep track of using clauses
12839         and catch invalid using clauses.
12840
12841 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
12842
12843         * gen-treedump.cs: Adapted for all the renaming.
12844
12845         * expression.cs (Expression): this class now has a Type property
12846         which returns an expression Type.
12847
12848         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12849         `Type', as this has a different meaning now in the base
12850
12851 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
12852
12853         * interface.cs, class.cs: Removed from all the sources the
12854         references to signature computation, as we can not do method
12855         signature computation during the parsing time, as we are not
12856         trying to solve at that point distinguishing:
12857
12858         class X {
12859                 void a (Blah x) {}
12860                 void a (NS.Blah x) {}
12861         }
12862
12863         Which depending on the context might be valid or not, as we do not
12864         know if Blah is the same thing as NS.Blah at that point.
12865
12866         * Redid everything so the code uses TypeRefs now instead of
12867         Types.  TypeRefs are just temporary type placeholders, that need
12868         to be resolved.  They initially have a pointer to a string and the
12869         current scope in which they are used.  This is used later by the
12870         compiler to resolve the reference to an actual Type. 
12871
12872         * DeclSpace is no longer a CIR.Type, and neither are
12873         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
12874         are all DeclSpaces, but no Types. 
12875
12876         * type.cs (TypeRefManager): This implements the TypeRef manager,
12877         which keeps track of all the types that need to be resolved after
12878         the parsing has finished. 
12879
12880 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
12881
12882         * ARGH.  We are going to have to store `foreach' as a class rather
12883         than resolving it, as we need to verify error 1579 after name
12884         resolution.   *OR* we could keep a flag that says `This request to
12885         IEnumerator comes from a foreach statement' which we can then use
12886         to generate the error.
12887
12888 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
12889
12890         * class.cs (TypeContainer.AddMethod): we now add methods to the
12891         MethodGroup instead of the method hashtable.  
12892
12893         * expression.cs: Add MethodGroup abstraction, which gets us one
12894         step closer to the specification in the way we handle method
12895         declarations.  
12896
12897         * cs-parser.jay (primary_expression): qualified_identifier now
12898         tried to match up an identifier to a local variable reference or
12899         to a parameter reference.
12900
12901         current_local_parameters is now a parser global variable that
12902         points to the current parameters for the block, used during name
12903         lookup.
12904
12905         (property_declaration): Now creates an implicit `value' argument to
12906         the set accessor.
12907
12908 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
12909
12910         * parameter.cs: Do not use `param' arguments as part of the
12911         signature, per the spec.
12912
12913 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
12914
12915         * decl.cs: Base class for classes, structs and interfaces.  This
12916         is the "Declaration Space" 
12917
12918         * cs-parser.jay: Use CheckDef for checking declaration errors
12919         instead of having one on each function.
12920
12921         * class.cs: Factor out some code for handling error handling in
12922         accordance to the "Declarations" section in the "Basic Concepts"
12923         chapter in the ECMA C# spec.
12924
12925         * interface.cs: Make all interface member classes derive from
12926         InterfaceMemberBase.
12927
12928 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
12929
12930         * Many things: all interfaces are parsed and generated in
12931         gen-treedump.  Support for member variables, constructors,
12932         destructors, properties, constants is there.
12933
12934         Beginning of the IL backend, but very little done, just there for
12935         testing purposes. 
12936
12937 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
12938
12939         * cs-parser.jay: Fix labeled statement.
12940
12941         * cs-tokenizer.cs (escape): Escape " and ' always.
12942         ref_line, ref_name: keep track of the line/filename as instructed
12943         by #line by the compiler.
12944         Parse #line.
12945
12946 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
12947
12948         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12949         to match the values in System.CodeDOM.
12950
12951         Divid renamed to Divide.
12952
12953         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12954         statements. 
12955         (Statements.set): remove.
12956
12957         * System.CodeDOM/CodeCatchClause.cs: always have a valid
12958         statements. 
12959
12960         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12961         falseStatements always have valid values. 
12962
12963         * cs-parser.jay: Use System.CodeDOM now.
12964