2003-11-12 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
2
3         * convert.cs (ImplicitReferenceConversion): We were missing a case
4         (System.Enum are not value types or class types, so we need to
5         classify them separatedly).
6
7         * driver.cs: We do not support error 2007.
8
9 2003-11-12 Jackson Harper <jackson@ximian.com>
10
11         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
12         system directory. Also use the full file name so users can
13         libraries names mscorlib-o-tron.dll in a non system dir.
14         
15 2003-11-10  Martin Baulig  <martin@ximian.com>
16
17         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
18         (TypeManager.InitCoreTypes): Initialize them here, but instead of
19         calling `ResolveType()' on them, directly assign their `Type'.
20
21 2003-11-08  Martin Baulig  <martin@ximian.com>
22
23         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
24         return value and the `out parent' parameter.
25         (TypeContainer.DefineType): Moved the CS0644 check into
26         GetClassBases().  Don't pass the interface types to the
27         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
28         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
29
30         * ecore.cs (TypeExpr.IsAttribute): New property.
31         (TypeExpr.GetInterfaces): New method.
32
33         * interface.cs (Interface.GetInterfaceTypeByName): Return a
34         TypeExpr instead of a Type.
35         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
36         (Interface.DefineType): Don't pass the interface types to the
37         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
38         them later and then call `TypeBulider.AddInterfaceImplementation()'.
39
40         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
41         instead of a `Type[]'.
42         (TypeManager.RegisterBuilder): Likewise.
43         (TypeManager.AddUserInterface): Likewise.
44         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
45         `Type[]' and also return a `TypeExpr[]'.
46         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
47
48 2003-11-08  Martin Baulig  <martin@ximian.com>
49
50         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
51         Expression.     
52
53 2003-11-08  Martin Baulig  <martin@ximian.com>
54
55         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
56         TypeManager.ResolveExpressionTypes().
57
58         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
59         instead of an Expression.
60         (TypeExpr): This is now an abstract base class for `TypeExpression'.
61         (TypeExpression): New public class; formerly known as `TypeExpr'.
62
63         * expression.cs (ComposedCast): Derive from TypeExpr.
64
65         * typemanager.cs (TypeManager.system_*_expr): These are now
66         TypExpr's instead of Expression's.
67         (TypeManager.ResolveExpressionTypes): New public static function;
68         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
69         of them.        
70
71 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
72
73         * expression.cs (New.DoResolve): Do not dereference value that
74         might be a null return.
75
76         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
77         sure that the constant value has the right type.  Fixes an
78         unreported bug, similar to 50425.
79
80         * const.cs (Const.LookupConstantValue): Call
81         ImplicitStandardConversionExists before doing a conversion to
82         avoid havng the TypeManager.ChangeType do conversions.
83
84         Reduced the number of casts used
85
86         (Const.ChangeType): New routine to enable reuse of the constant
87         type changing code from statement.
88
89         * typemanager.cs (ChangeType): Move common initialization to
90         static global variables.
91
92         Fixes #50425.
93
94         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
95         every value type to go through, even if it was void.  Fix that. 
96
97         * cs-tokenizer.cs: Use is_identifier_start_character on the start
98         character of the define, and the is_identifier_part_character for
99         the rest of the string.
100
101 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
102
103         * expression.cs (UnaryMutator.EmitCode): When I updated
104         LocalVariableReference.DoResolve, I overdid it, and dropped an
105         optimization done on local variable references.
106
107 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
108
109         * ecore.cs: Convert the return from Ldlen into an int.
110
111 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
112
113         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
114         the accessibility, this is a special case for toplevel non-public
115         classes (internal for instance).
116
117 2003-10-20  Nick Drochak <ndrochak@gol.com>
118
119         * ecore.cs: Fix typo and build.  Needed another right paren.
120
121 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
122
123         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
124         `internal' case regular and protected, but not allowing protected
125         to be evaluated later.  Bug 49840
126
127 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
128
129         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
130         to kb.Nlast, and not the kb.nFirst to isolate the switch
131         statement.
132
133         Extract the underlying type, so enumerations of long/ulong are
134         treated like long/ulong.
135
136 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
137
138         * expression.cs (New): Overload the meaning of RequestedType to
139         track the possible creation of the NewDelegate type, since
140         DoResolve is invoked more than once for new constructors on field
141         initialization.
142
143         See bugs: #48800 and #37014
144
145         * cs-parser.jay (declare_local_constants): Take an arraylist
146         instead of a single constant.
147
148         (local_constant_declaration): It should take a
149         constant_declarators, not a constant_declarator.  Fixes 49487
150
151         * convert.cs: Fix error report.
152
153 2003-10-13 Jackson Harper <jackson@ximian.com>
154
155         * typemanager.cs (TypeToCoreType): Add float and double this fixes
156         bug #49611
157         
158 2003-10-09  Martin Baulig  <martin@ximian.com>
159
160         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
161         to the .ctor.
162         (MethodCore.DoDefineParameters): Removed the TypeContainer
163         argument; use the DeclSpace which was passed to the .ctor instead.
164         (MethodCore.CheckParameter): Take a DeclSpace instead of a
165         TypeContainer; we only need a DeclSpace here.
166
167 2003-10-09  Martin Baulig  <martin@ximian.com>
168
169         * class.cs (MethodData): Added additional `DeclSpace ds' argument
170         to the .ctor.
171         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
172         EmitContext's .ctor.    
173
174 2003-10-09  Martin Baulig  <martin@ximian.com>
175
176         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
177         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
178         AsAccessible(), moved them as well.
179
180         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
181
182 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
183
184         * cs-parser.jay : Renamed yyName to yyNames related to jay.
185
186 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
187
188         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
189         generation for >=, as spotted by Paolo, bug 48679.  
190         Patch from David Waite.
191
192         * cs-tokenizer.cs: Add handling for #pragma.
193
194         * cs-parser.jay: Allow for both yield and yield return in the
195         syntax.  The anti-cobolization of C# fight will go on!
196
197         * class.cs (TypeBuilder.DefineType): Catch error condition here
198         (Parent.DefineType erroring out and returning null).
199
200         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
201         coping with enumerations variables, we were mistakenly processing
202         them as a regular value type instead of built-in types.  Fixes the
203         bug #48063
204
205         * typemanager.cs (IsBuiltinOrEnum): New method.
206
207 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
208
209         * cs-parser.jay: Upgrade: yield now needs the return clause.
210
211 2003-09-19  Martin Baulig  <martin@ximian.com>
212
213         * decl.cs (MemberCache.SetupCacheForInterface): Take a
214         `MemberCache parent' argument.  Normally, an interface doesn't
215         have a parent type except System.Object, but we use this in gmcs
216         for generic type parameters.
217
218 2003-09-18  Martin Baulig  <martin@ximian.com>
219
220         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
221         on `type.IsInterface'; don't check whether the type has a parent
222         to determine whether it's an interface.
223
224 2003-09-15  Martin Baulig  <martin@ximian.com>
225
226         * class.cs (TypeContainer.DefineType): Added an error flag to
227         avoid reporting duplicate CS0146's ("class definition is
228         circular.").
229
230         * driver.cs (Driver.MainDriver): Abort if
231         RootContext.ResolveTree() reported any errors.
232
233 2003-09-07  Martin Baulig  <martin@ximian.com>
234
235         * report.cs (Error, Warning): Added overloaded versions which take
236         a `params object[] args' and call String.Format().
237
238 2003-09-07  Martin Baulig  <martin@ximian.com>
239
240         * decl.cs (DeclSpace..ctor): Don't call
241         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
242         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
243         (DeclSpace.RecordDecl): New method.
244
245         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
246
247 2003-09-02  Ravi Pratap  <ravi@ximian.com>
248
249         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
250         value attributes to be applied to ParameterBuilders.
251
252         * class.cs (MethodCore.LabelParameters): Make static and more
253         generic so that it can be used from other places - like interface
254         methods, for instance.
255
256         * interface.cs (Interface.Emit): Call LabelParameters before
257         emitting attributes on the InterfaceMethod.
258
259 2003-08-26  Martin Baulig  <martin@ximian.com>
260
261         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
262         resolving aliases; fixes #47927.
263
264 2003-08-26  Martin Baulig  <martin@ximian.com>
265
266         * statement.cs (Using.DoResolve): This is internally emitting a
267         try/finally clause, so we need to set ec.NeedExplicitReturn if we
268         do not always return.  Fixes #47681.
269
270 2003-08-26  Martin Baulig  <martin@ximian.com>
271
272         * decl.cs (MemberCore): Moved WarningNotHiding(),
273         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
274         into MemberBase.
275         (AdditionResult): Make this nested in DeclSpace.
276         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
277         argument; call NamespaceEntry.Define() unless we're nested in a
278         class or struct.
279
280         * namespace.cs (Namespace.DefineName): New public function.  This
281         is called from DeclSpace's .ctor to add 
282         (Namespace.Lookup): Include DeclSpaces in the lookup.
283
284         * class.cs (Operator): Derive from MemberBase, not MemberCore.
285
286         * const.cs (Const): Derive from MemberBase, not MemberCore.     
287
288 2003-08-25  Martin Baulig  <martin@ximian.com>
289
290         * convert.cs (Convert.ExplicitReferenceConversion): When
291         converting from an interface type to a class, unbox if the target
292         type is a struct type.  Fixes #47822.
293
294 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
295
296         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
297         #47854.
298
299 2003-08-22  Martin Baulig  <martin@ximian.com>
300
301         * class.cs (TypeManager.DefineType): When defining a nested type,
302         call DefineType() on our parent; fixes #47801.
303
304 2003-08-22  Martin Baulig  <martin@ximian.com>
305
306         * class.cs (MethodData.Define): While checking if a method is an
307         interface implementation, improve the test a bit more to fix #47654.
308
309 2003-08-22  Martin Baulig  <martin@ximian.com>
310
311         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
312         correctly; fixes #47722.
313
314 2003-08-22  Martin Baulig  <martin@ximian.com>
315
316         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
317         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
318
319         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
320
321 2003-08-22  Martin Baulig  <martin@ximian.com>
322
323         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
324         can only be assigned in static constructors.  Fixes #47161.
325
326 2003-08-22  Martin Baulig  <martin@ximian.com>
327
328         Rewrote and improved the flow analysis code.
329
330         * flowbranching.cs (FlowBranching): Make this class abstract.
331         (FlowBranching.CreateBranching): New static function to create a
332         new flow branching.
333         (FlowBranchingBlock, FlowBranchingException): New classes.
334         (FlowBranching.UsageVector.Type): New public readonly field.
335         (FlowBranching.UsageVector.Breaks): Removed the setter.
336         (FlowBranching.UsageVector.Returns): Removed the setter.
337         (FlowBranching.UsageVector): Added Break(), Return(),
338         NeverReachable() and Throw() methods to modify the reachability.
339         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
340         done by FlowBranching.Merge().
341         (FlowBranching.UsageVector.MergeChild): New method; merges the
342         merge result into the current vector.
343         (FlowBranching.Merge): New abstract method to merge a branching.
344
345 2003-08-12  Martin Baulig  <martin@ximian.com>
346
347         * expression.cs (Indirection.CacheTemporaries): Create the
348         LocalTemporary with the pointer type, not its element type.
349
350 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
351
352         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
353         token was a keyword or not.
354
355         Add `error' options where an IDENTIFIER was expected;  Provide
356         CheckToken and CheckIdentifierToken convenience error reporting
357         functions. 
358
359         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
360
361         * decl.cs: Rename `NamespaceEntry Namespace' public field into
362         NameSpaceEntry NameSpaceEntry.
363
364         (LookupInterfaceOrClass): Avoid creating a full qualified name
365         from namespace and name: avoid doing lookups when we know the
366         namespace is non-existant.   Use new Tree.LookupByNamespace which
367         looks up DeclSpaces based on their namespace, name pair.
368
369         * driver.cs: Provide a new `parser verbose' to display the
370         exception thrown during parsing.  This is turned off by default
371         now, so the output of a failure from mcs is more graceful.
372
373         * namespace.cs: Track all the namespaces defined in a hashtable
374         for quick lookup.
375         
376         (IsNamespace): New method
377
378 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
379
380         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
381         we know that we need to concatenate (full typename can never be
382         null). 
383
384         * class.cs: ditto.
385
386         * statement.cs: Use a bitfield;  Do not initialize to null things
387         which are done by the constructor by default.
388
389         * cs-parser.jay: bug fix, parameter was 4, not 3.
390
391         * expression.cs: Just use the property;
392
393         * statement.cs: No need for GetVariableInfo method.
394
395 2003-08-08  Martin Baulig  <martin@ximian.com>
396
397         * flowanalysis.cs (FlowReturns): This is now nested in the
398         `FlowBranching' class.
399         (MyBitVector): Moved this here from statement.cs.
400         (FlowBranching.SiblingType): New enum type.
401         (FlowBranching.CreateSibling): Added `SiblingType' argument.
402
403 2003-08-07  Martin Baulig  <martin@ximian.com>
404
405         * flowanalysis.cs (FlowBranchingType): This is now nested in the
406         `FlowBranching' class and called `BranchingType'.
407
408 2003-08-07  Martin Baulig  <martin@ximian.com>
409
410         * flowanalysis.cs: Moved all the control flow analysis code into
411         its own file.
412
413 2003-08-07  Martin Baulig  <martin@ximian.com>
414
415         * assign.cs (Assign.DoResolve): `target' must either be an
416         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
417         #37319.
418
419 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
420
421         * expression.cs (BinaryMethod): This kind of expression is created by the
422         Binary class if it determines that the operator has to be handled
423         by a method.
424
425         (BinaryDelegate): This kind of expression is created if we are
426         dealing with a + or - operator on delegates.
427
428         (Binary): remove method, argumetns, and DelegateOperator: when
429         dealing with methods, 
430         
431         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
432
433         * statement.cs (Block): use bitfields for the three extra booleans
434         we had in use.   Remove unused topblock parameter.
435
436         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
437
438         * assign.cs: Drop extra unneeded tests.
439
440 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
441
442         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
443
444         * statement.cs (Foreach): Use VariableStorage instead of
445         LocalBuilders.   
446
447         * codegen.cs (VariableStorage): New class used by clients that
448         require a variable stored: locals or fields for variables that
449         need to live across yield.
450
451         Maybe provide a convenience api for EmitThis+EmitLoad?
452
453         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
454         these bad boys.
455
456 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
457
458         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
459         RemapParameterLValue): New methods that are used to turn a
460         precomputed FieldInfo into an expression like this:
461
462                 instance.FieldInfo
463
464         The idea is to use this instead of making LocalVariableReference
465         have more than one meaning.
466
467         * cs-parser.jay: Add error production to BASE.
468
469         * ecore.cs: Deal with TypeManager.GetField returning null, which
470         is now a valid return value.
471
472         (FieldExprNoAddress): New expression for Fields whose address can
473         not be taken.
474
475         * expression.cs (LocalVariableReference): During the resolve
476         phases, create new expressions if we are in a remapping context.
477         Remove code that dealt with remapping here.
478
479         (ParameterReference): same.
480
481         (ProxyInstance): New expression, like the `This' expression, but
482         it is born fully resolved.  We know what we are doing, so remove
483         the errors that are targeted to user-provided uses of `this'.
484
485         * statement.cs (Foreach): our variable is now stored as an
486         Expression;  During resolution, follow the protocol, dont just
487         assume it will return this.
488         
489 2003-08-06  Martin Baulig  <martin@ximian.com>
490
491         * support.cs (SeekableStreamReader.cs): New public class.
492
493         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
494         SeekableStreamReader instead of the normal StreamReader.
495
496 2003-08-04  Martin Baulig  <martin@ximian.com>
497
498         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
499         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
500         deambiguate casts and delegate invocations.
501         (parenthesized_expression): Use the new tokens to ensure this is
502         not a cast of method invocation.
503
504         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
505         when reading a `)' and Deambiguate_CloseParens () was previously
506         called.
507
508         * expression.cs (ParenthesizedExpression): New class.  This is
509         just used for the CS0075 test.
510         (Binary.DoResolve): Check for CS0075.   
511
512 2003-07-29  Ravi Pratap  <ravi@ximian.com>
513
514         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
515         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
516         reference comparison.
517
518         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
519         examine the ReturnType for equality - this is necessary in the
520         cases of implicit and explicit operators whose signature also
521         includes the return type.
522
523 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
524
525         * namespace.cs: Cache the result of the namespace computation,
526         instead of computing it every time.
527
528 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
529
530         * decl.cs: Use a global arraylist that we reuse over invocations
531         to avoid excesive memory consumption.  Reduces memory usage on an
532         mcs compile by one meg (45 average).
533
534         * typemanager.cs (LookupTypeReflection): In .NET pointers are
535         private, work around that.
536
537 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
538
539         * literal.cs (IntLiteral): Define Zero and One static literals. 
540
541         * cs-parser.jay (integer_literal): use static literals to reduce
542         memory usage for the most used literals (0, 1 and -1).  211kb
543         reduced in memory usage.
544
545         Replace all calls to `new ArrayList' with `new
546         ArrayList(4)' which is a good average number for most allocations,
547         and also requires only 16 bytes of memory for its buffer by
548         default. 
549
550         This reduced MCS memory usage in seven megabytes for the RSS after
551         bootstrapping.
552
553 2003-07-28  Ravi Pratap  <ravi@ximian.com>
554
555         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
556         handle params methods the correct way by forming only one
557         applicable set with params and normal methods in them. Earlier we
558         were looking at params methods only if we found no normal methods
559         which was not the correct thing to do.
560
561         (Invocation.BetterFunction): Take separate arguments indicating
562         when candidate and the best method are params methods in their
563         expanded form.
564
565         This fixes bugs #43367 and #46199.
566
567         * attribute.cs: Documentation updates.
568
569         (CheckAttribute): Rename to CheckAttributeTarget.
570         (GetValidPlaces): Rename to GetValidTargets.
571
572         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
573         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
574
575         Fixes bug #44468.
576
577 2003-07-28  Martin Baulig  <martin@ximian.com>
578
579         * class.cs (TypeContainer.DefineMembers): Use the base type's full
580         name when looking up the base class of a nested class.  Fixes #46977.
581
582 2003-07-26  Martin Baulig  <martin@ximian.com>
583
584         * expression.cs (Indexers.Indexer): New nested struct; contains
585         getter, setter and the indexer's type.
586         (Indexers.Properties): This is now an ArrayList of
587         Indexers.Indexer's.
588         (IndexerAccess.DoResolveLValue): Correctly set the type if the
589         indexer doesn't have any getters.
590
591         * assign.cs (Assign.DoResolve): Also do the implicit conversions
592         for embedded property and indexer assignments.
593
594 2003-07-26  Martin Baulig  <martin@ximian.com>
595
596         * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
597         preprocessor directive is not the first non-whitespace character
598         on a line.
599
600 2003-07-26  Martin Baulig  <martin@ximian.com>
601
602         * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
603         namespace parsing, follow the spec more closely.
604
605         * rootcontext.cs (RootContext.NamespaceLookup): Use the new
606         NamespaceEntry.Lookup().
607
608 2003-07-25  Martin Baulig  <martin@ximian.com>
609
610         * MethodCore.cs (OverridesSomething): New public field; it's set
611         from TypeContainer.DefineMembers if this method overrides
612         something (which doesn't need to be a method).  Fix #39462.
613
614 2003-07-25  Ravi Pratap  <ravi@ximian.com>
615
616         * typemanager.cs (GetMembers): Ensure that the list of members is
617         reversed. This keeps things in sync.
618
619         * attribute.cs (Attribute.CheckAttribute): Break as soon as we
620         find an AttributeUsage attribute.
621
622         * expression.cs (Invocation.OverloadResolve): Perform the check
623         which disallows Invoke to be directly called on a Delegate.
624
625         (Error_InvokeOnDelegate): Report error cs1533.
626         
627 2003-07-25  Martin Baulig  <martin@ximian.com>
628
629         * expression.cs (Indexers.GetIndexersForType): Only look in the
630         interface hierarchy if the requested type is already an
631         interface.  Fixes #46788 while keeping #46502 fixed.
632
633 2003-07-25  Martin Baulig  <martin@ximian.com>
634
635         * class.cs (TypeContainer.DefineMembers): Check whether all
636         readonly fields have been assigned and report warning CS0649 if
637         not.
638
639         * statement.cs (LocalInfo.IsFixed): Always return true if this is
640         a valuetype.
641
642 2003-07-24  Ravi Pratap  <ravi@ximian.com>
643
644         * decl.cs (MemberCache.AddMethods): Reverse the order of the array
645         returned from GetMethods to make things consistent with the
646         assumptions MCS makes about ordering of methods.
647
648         This should comprehensively fix bug #45127 and it does :-)
649
650         * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
651         ordering is actually reverse.
652
653         * Clean up some debug messages I left lying around.
654
655         * interface.cs (Populate*): Get rid of code which emits attributes
656         since the stage in which we emit attributes is the 'Emit' stage,
657         not the define stage.
658
659         (Emit): Move attribute emission for interface members here.
660         
661 2003-07-22  Ravi Pratap  <ravi@ximian.com>
662
663         * expression.cs (Invocation.OverloadResolve): Follow the spec more
664         closely: we eliminate methods in base types when we have an
665         applicable method in a top-level type.
666
667         Please see section 14.5.5.1 for an exact description of what goes
668         on. 
669
670         This fixes bug #45127 and a host of other related to corlib compilation.
671
672         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
673         array is the method corresponding to the top-level type (this is
674         because of the changes made to icall.c) so we change this
675         accordingly.
676
677         (MethodGroupExpr.Name): This too.
678
679         * typemanager.cs (GetElementType): New method which does the right
680         thing when compiling corlib. 
681
682         * everywhere: Make use of the above in the relevant places.
683
684 2003-07-22  Martin Baulig  <martin@ximian.com>
685
686         * cs-parser.jay (invocation_expression): Moved
687         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
688         `cast_expression', but create a InvocationOrCast which later
689         resolves to either an Invocation or a Cast.
690
691         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
692         method; call this before EmitStatement() to make sure that this
693         expression can be used as a statement.
694
695         * expression.cs (InvocationOrCast): New class; resolves to either
696         an Invocation or a Cast.
697
698         * statement.cs (StatementExpression): Call ResolveStatement() on
699         the ExpressionStatement before emitting it.
700
701 2003-07-21  Martin Baulig  <martin@ximian.com>
702
703         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
704         `ref' and `out' attributes match; fixes #46220.
705         (MemberAccess.ResolveMemberAccess): You can't reference a type
706         through an expression; fixes #33180.
707         (Indexers.GetIndexersForType): Don't return the indexers from
708         interfaces the class implements; fixes #46502.
709
710 2003-07-21  Martin Baulig  <martin@ximian.com>
711
712         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
713         CS0661 checks; fixes bug #30442.
714
715 2003-07-21  Martin Baulig  <martin@ximian.com>
716
717         * decl.cs (AdditionResult): Added `Error'.
718
719         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
720
721         * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
722         makes cs0031.cs actually work.
723
724 2003-07-20  Martin Baulig  <martin@ximian.com>
725
726         * namespace.cs: Fixed that bug which caused a crash when compiling
727         the debugger's GUI.
728
729 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
730
731         * typemanager.cs (LookupTypeReflection): Never expose types which
732         are NotPublic, NestedPrivate, NestedAssembly, or
733         NestedFamANDAssem.  We used to return these, and later do a check
734         that would report a meaningful error, but the problem is that we
735         would not get the real match, if there was a name override.
736
737 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
738
739         * namespace.cs (Namespace, Name): Do not compute the namespace
740         name dynamically, compute it in the constructor.  This reduced
741         memory usage by 1697 KB.
742
743         * driver.cs: Use --pause to pause at the end.
744
745 2003-07-17  Peter Williams  <peter@newton.cx>
746
747         * Makefile: Change the name of the test target so that it doesn't
748         conflict with the recursive test target.
749
750 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
751
752         * expression.cs (LocalVariableReference.Emit, EmitAssign,
753         AddressOf): Do not use EmitThis, that was wrong, use the actual
754         this pointer.
755
756 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
757
758         * class.cs (MethodData.Define): While checking if a method is an
759         interface implementation, improve the test: If we are not public
760         (use new test here: use the computed MethodAttributes directly,
761         instead of the parsed modifier flags) check if the `implementing'
762         method comes from an interface or not.
763
764         * pending.cs (VerifyPendingMethods): Slightly better error
765         message.
766
767         * makefile: add test target that does the mcs bootstrap.
768
769 2003-07-16  Ravi Pratap  <ravi@ximian.com>
770
771         * interface.cs (Define): Do nothing here since there are no
772         members to populate etc. Move the attribute emission out of here
773         since this was just totally the wrong place to put it. Attribute
774         application happens during the 'Emit' phase, not in the 'Define'
775         phase.
776
777         (Emit): Add this method and move the attribute emission here
778
779         * rootcontext.cs (EmitCode): Call the Emit method on interface
780         types too.
781
782 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
783
784         * expression.cs (OverloadResolve): Report error only if Location
785         is not 'Null' which means that there was a probe going on.
786
787 2003-07-14  Martin Baulig  <martin@ximian.com>
788
789         * expression.cs (ConditionalLogicalOperator): New public class to
790         implement user defined conditional logical operators.
791         This is section 14.11.2 in the spec and bug #40505.
792
793 2003-07-14  Martin Baulig  <martin@ximian.com>
794
795         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
796
797 2003-07-14  Martin Baulig  <martin@ximian.com>
798
799         * codegen.cs (EmitContext.InFixedInitializer): New public field.
800
801         * ecore.cs (IVariable.VerifyFixed): New interface method.
802
803         * expression.cs (Unary.ResolveOperator): When resolving the `&'
804         operator, check whether the variable is actually fixed.  Fixes bug
805         #36055.  Set a variable definitely assigned when taking its
806         address as required by the spec.
807
808         * statement.cs (LocalInfo.IsFixed): New field.
809         (LocalInfo.MakePinned): Set `IsFixed' to true.
810
811 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
812
813         * attribute.cs (Attribute.Resolve): While doing a Member lookup
814         for .ctors, ensure that we only ask for members declared in the
815         attribute type (BindingFlags.DeclaredOnly).
816
817         Fixes bug #43632.
818
819         * expression.cs (Error_WrongNumArguments): Report error 1501
820         correctly the way CSC does.
821
822 2003-07-13  Martin Baulig  <martin@ximian.com>
823
824         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
825         lookup on the fully qualified name, to make things like "X.X" work
826         where "X.X" is a fully qualified type name, but we also have a
827         namespace "X" in the using list.  Fixes #41975.
828
829 2003-07-13  Martin Baulig  <martin@ximian.com>
830
831         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
832         function. If we're a CompoundAssign, we need to create an embedded
833         CompoundAssign, not an embedded Assign.
834         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
835         Fixes #45854.
836
837 2003-07-13  Martin Baulig  <martin@ximian.com>
838
839         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
840         work to fix bug #46088.
841
842 2003-07-13  Ravi Pratap <ravi@ximian.com>
843
844         * class.cs (Operator.Emit): Do not emit attributes here - it is
845         taken care of by the Method class that we delegate too. This takes
846         care of bug #45876.
847         
848 2003-07-10  Martin Baulig  <martin@ximian.com>
849
850         * expression.cs (TypeOfVoid): New class.
851         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
852
853 2003-07-10  Martin Baulig  <martin@ximian.com>
854
855         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
856         bug #35957.
857
858 2003-07-10  Martin Baulig  <martin@ximian.com>
859
860         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
861         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
862
863         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
864
865         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
866
867 2003-07-10  Martin Baulig  <martin@ximian.com>
868
869         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
870         of decimal.  Fixes #42850.
871
872         NOTE: I also fixed the created byte blob, but this doesn't work on
873         the MS runtime and csc never produces any byte blobs for decimal
874         arrays.
875
876 2003-07-10  Martin Baulig  <martin@ximian.com>
877
878         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
879         structs; fixes #32068.
880         (Block.AddChildVariableNames): Fixed #44302.
881
882 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
883
884         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
885         
886 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
887
888         * attribute.cs: And this test is onger needed.
889
890 2003-07-08  Martin Baulig  <martin@ximian.com>
891
892         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
893         inaccessible types.  Fixes #36313.
894
895         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
896
897         * namespace.cs (NamespaceEntry): Create implicit entries for all
898         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
899         implicit entries for N1.N2 and N1.
900
901 2003-07-08  Martin Baulig  <martin@ximian.com>
902
903         Rewrote the handling of namespaces to fix a lot of the issues
904         wrt. `using' aliases etc.
905
906         * namespace.cs (Namespace): Splitted this class into a
907         per-assembly `Namespace' and a per-file `NamespaceEntry'.
908
909         * typemanager.cs (TypeManager.IsNamespace): Removed.
910         (TypeManager.ComputeNamespaces): Only compute namespaces from
911         loaded assemblies here, not the namespaces from the assembly we're
912         currently compiling.
913
914 2003-07-08  Martin Baulig  <martin@ximian.com>
915
916         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
917
918 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
919
920         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
921         already fixed it.  
922
923         I thought about the memory savings here, but LookupTypeReflection
924         is used under already very constrained scenarios.  Compiling
925         corlib or mcs only exposes one hit, so it would not really reduce
926         any memory consumption.
927
928 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
929
930         * typemanager.cs: fixes bug #45889 by only adding public types from
931         other assemblies to the list of known types.
932
933 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
934
935         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
936         on the type we resolved.
937
938 2003-07-05  Martin Baulig  <martin@ximian.com>
939
940         * pending.cs (PendingImplementation.ParentImplements): Don't
941         create the proxy if the parent is abstract.
942
943         * class.cs (TypeContainer.DefineIndexers): Process explicit
944         interface implementations first.  Fixes #37714.
945
946 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
947
948         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
949         defined recursively;  but since we modify the input parameters
950         (left is set to `this' temporarily), we reset this value if the
951         left_is_explicit is false, which gives the original semantics to
952         the code.  
953
954         * literal.cs (NullPointer): new class used to represent a null
955         literal in a pointer context.
956
957         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
958         type is a pointer, use a NullPointer object instead of a
959         NullLiteral.   Closes 43687
960
961         (ExplicitConversion): Convert pointer values using
962         the conv opcode to the proper type.
963
964         * ecore.cs (New): change ValueTypeVariable property into a method,
965         that returns whether the valuetype is suitable for being used.
966
967         * expression.cs (Binary.DoNumericPromotions): Only return if we
968         the int constant was a valid uint, and we can return both left and
969         right as uints.  If not, we continue processing, to trigger the
970         type conversion.  This fixes 39018.
971
972         * statement.cs (Block.EmitMeta): During constant resolution, set
973         the CurrentBlock property on the emitcontext, so that we resolve
974         constants propertly.
975
976 2003-07-02  Martin Baulig  <martin@ximian.com>
977
978         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
979         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
980
981         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
982         than emitting it here.
983
984         * statement.cs: Fixed some more flow analysis bugs.
985
986 2003-07-02  Martin Baulig  <martin@ximian.com>
987
988         * class.cs (MethodData.Define): When implementing interface
989         methods, set Final unless we're Virtual.
990
991         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
992         check work for interface methods.
993
994 2003-07-01  Martin Baulig  <martin@ximian.com>
995
996         * ecore.cs (EmitContext.This): Replaced this property with a
997         GetThis() method which takes a Location argument.  This ensures
998         that we get the correct error location for a CS0188.
999
1000 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
1001
1002         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1003         ImplicitStandardConversion.
1004
1005         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1006
1007 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
1008
1009         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1010         optimization.
1011
1012 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
1013
1014         * class.cs (Constructor.Define): Turn off initlocals for unsafe
1015         constructors.
1016
1017         (MethodData.Define): Turn off initlocals for unsafe methods.
1018
1019 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
1020
1021         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1022         complete;  Fixes #37521.
1023
1024         * delegate.cs: Use Modifiers.TypeAttr to compute the
1025         TypeAttributes, instead of rolling our own.  This makes the flags
1026         correct for the delegates.
1027
1028 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
1029
1030         * class.cs (Constructor.Define): Set the private flag for static
1031         constructors as well.
1032
1033         * cs-parser.jay (statement_expression): Set the return value to
1034         null, to avoid a crash when we catch an error.
1035
1036 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
1037
1038         * cs-parser.jay: Applied patch from Jackson that adds support for
1039         extern and unsafe modifiers to destructor declarations.
1040
1041         * expression.cs: Report error 21 if the user is trying to index a
1042         System.Array.
1043
1044         * driver.cs: Add an error message, suggested by the bug report.
1045
1046         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1047         if we do not have a ": this ()" constructor initializer.  Fixes 45149
1048
1049 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
1050
1051         * namespace.cs: Add some information to reduce FAQs.
1052
1053 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
1054
1055         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1056         underlying enumeration types.  Fixes #43915.
1057
1058         * expression.cs: Treat ushort/short as legal values to be used in
1059         bitwise operations.
1060
1061 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1062
1063         * delegate.cs: transfer custom attributes for paramenters from
1064         the delegate declaration to Invoke and BeginInvoke.
1065
1066 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1067
1068         * attribute.cs: handle custom marshalers and emit marshal info
1069         for fields, too.
1070
1071 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
1072
1073         * makefile.gnu: Added anonymous.cs to the compiler sources.
1074
1075 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
1076
1077         * iterators.cs: Change the name of the proxy class to include two
1078         underscores.
1079
1080         * cs-parser.jay: Update grammar to include anonymous methods.
1081         
1082         * anonymous.cs: new file.
1083
1084 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
1085
1086         * class.cs (Field.Define): Add missing test for pointers and
1087         safety. 
1088
1089 2003-05-27  Ravi Pratap  <ravi@ximian.com>
1090
1091         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
1092         we use the stobj opcode.
1093
1094         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
1095         since it wasn't the correct fix. 
1096
1097         It still is puzzling that we are required to use stobj for IntPtr
1098         which seems to be a ValueType.
1099
1100 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
1101
1102         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
1103         during regular simple name resolution.   Now, the trick is that
1104         instead of returning for processing the simplename, we do a
1105         TypeManager.LookupType (ie, a rooted lookup as opposed to a
1106         contextual lookup type).   If a match is found, return that, if
1107         not, return for further composition.
1108
1109         This fixes long-standing 30485.
1110
1111         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1112         using the address to initialize an object, do an Stobj instead of
1113         using the regular Stelem.
1114
1115         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1116         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1117         Because if we are a BaseIndexerAccess that value will be true.
1118         Fixes 43643.
1119
1120         * statement.cs (GotoCase.Resolve): Return after reporting an
1121         error, do not attempt to continue. 
1122
1123         * expression.cs (PointerArithmetic.Emit): If our operand is a
1124         long, convert our constants to match the operand before
1125         multiplying.  Convert to I type before adding.   Fixes 43670.
1126         
1127 2003-05-14  Ravi Pratap  <ravi@ximian.com>
1128
1129         * enum.cs (ImplicitConversionExists) : Rename to
1130         ImplicitEnumConversionExists to remove ambiguity. 
1131
1132         * ecore.cs (NullCast): New type of cast expression class which
1133         basically is very similar to EmptyCast with the difference being
1134         it still is a constant since it is used only to cast a null to
1135         something else
1136         (eg. (string) null)
1137
1138         * convert.cs (ImplicitReferenceConversion): When casting a null
1139         literal, we return a NullCast.
1140
1141         * literal.cs (NullLiteralTyped): Remove - I don't see why this
1142         should be around anymore.
1143
1144         The renaming (reported was slightly wrong). Corrections:
1145
1146         ConvertImplicitStandard -> ImplicitConversionStandard
1147         ConvertExplicitStandard -> ExplicitConversionStandard
1148
1149         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1150         before passing them in !
1151
1152         * convert.cs (ImplicitConversionStandard): When comparing for
1153         equal expr and target types, ensure that expr is not a
1154         NullLiteral.
1155
1156         In general, we must not be checking (expr_type ==
1157         target_type) in the top level conversion methods
1158         (ImplicitConversion, ExplicitConversion etc). This checking is
1159         done in the methods that they delegate to.
1160
1161 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
1162
1163         * convert.cs: Move Error_CannotConvertType,
1164         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1165         ImplicitNumericConversion, ImplicitConversionExists,
1166         ImplicitUserConversionExists, StandardConversionExists,
1167         FindMostEncompassedType, FindMostSpecificSource,
1168         FindMostSpecificTarget, ImplicitUserConversion,
1169         ExplicitUserConversion, GetConversionOperators,
1170         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1171         TryImplicitIntConversion, Error_CannotConvertImplicit,
1172         ConvertImplicitRequired, ConvertNumericExplicit,
1173         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1174         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1175         its own file.
1176
1177         Perform the following renames:
1178         
1179         StandardConversionExists -> ImplicitStandardConversionExists
1180         ConvertImplicit -> ImplicitConversion
1181         ConvertImplicitStandard -> ImplicitStandardConversion
1182         TryImplicitIntConversion -> ImplicitIntConversion
1183         ConvertImplicitRequired -> ImplicitConversionRequired
1184         ConvertNumericExplicit -> ExplicitNumericConversion
1185         ConvertReferenceExplicit -> ExplicitReferenceConversion
1186         ConvertExplicit -> ExplicitConversion
1187         ConvertExplicitStandard -> ExplicitStandardConversion
1188
1189 2003-05-19  Martin Baulig  <martin@ximian.com>
1190
1191         * statement.cs (TypeInfo.StructInfo): Made this type protected.
1192         (TypeInfo): Added support for structs having structs as fields.
1193
1194         * ecore.cs (FieldExpr): Implement IVariable.
1195         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1196         VariableInfo for the field.
1197
1198 2003-05-18  Martin Baulig  <martin@ximian.com>
1199
1200         * expression.cs (This.DoResolve): Report a CS0027 if we're
1201         emitting a field initializer.
1202
1203 2003-05-18  Martin Baulig  <martin@ximian.com>
1204
1205         * expression.cs (This.ResolveBase): New public function.
1206         (This.DoResolve): Check for CS0188.
1207
1208         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1209         This.Resolve().
1210
1211         * ecore.cs (MethodGroupExpr.DoResolve): Set the
1212         `instance_expression' to null if we don't have any non-static
1213         methods.
1214
1215 2003-05-18  Martin Baulig  <martin@ximian.com>
1216
1217         Reworked the way how local variables and parameters are handled by
1218         the flow analysis code.
1219
1220         * statement.cs (TypeInfo, VariableMap): New public classes.
1221         (VariableInfo): New public class.  This is now responsible for
1222         checking whether a variable has been assigned.  It is used for
1223         parameters and local variables.
1224         (Block.EmitMeta): Take the InternalParameters as argument; compute
1225         the layout of the flow vectors here.
1226         (Block.LocalMap, Block.ParameterMap): New public properties.
1227         (FlowBranching): The .ctor doesn't get the InternalParameters
1228         anymore since Block.EmitMeta() now computes the layout of the flow
1229         vector.
1230         (MyStructInfo): This class is now known as `StructInfo' and nested
1231         in `TypeInfo'; we don't access this directly anymore.
1232
1233         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1234         property and removed IsAssigned(), IsFieldAssigned(),
1235         SetAssigned() and SetFieldAssigned(); we now call them on the
1236         VariableInfo so we don't need to duplicate this code everywhere.
1237
1238         * expression.cs (ParameterReference): Added `Block block' argument
1239         to the .ctor.
1240         (LocalVariableReference, ParameterReference, This): The new
1241         VariableInfo class is now responsible for all the definite
1242         assignment stuff.
1243
1244         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1245         IsParameterAssigned, SetParameterAssigned): Removed.
1246
1247 2003-05-18  Martin Baulig  <martin@ximian.com>
1248
1249         * typemanager.cs (InitCoreTypes): Try calling
1250         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1251         the 3-args-version.  Corlib now also needs our `void_type'.
1252         (GetMethod): Added overloaded version which takes an optional
1253         `bool report_errors' to allow lookups of optional methods.
1254
1255 2003-05-12  Martin Baulig  <martin@ximian.com>
1256
1257         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1258         only used for locals and not for parameters.
1259
1260 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
1261
1262         * support.cs (InternalParameters.ParameterType): Return the
1263         ExternalType of the parameter.
1264
1265         * parameter.cs (Parameter.ExternalType): drop the two arguments,
1266         they were unused.
1267
1268 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
1269
1270         * class.cs (MethodData.Define): Do not set the `newslot' on
1271         interface members, if they are also flagged as "override".
1272
1273         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1274         better code for ++i and i++.  This only works for static fields
1275         and local variables.
1276
1277         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1278         want to pull the DeclSpace out of the builder_to_declspace instead
1279         of the TypeBuilder (like in TypeContainer.FindMembers).
1280
1281         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1282         instead of LookupTypeContainer.  Fixes the crash on .NET for
1283         looking up interface members.
1284
1285         * const.cs: Create our own emit context during the Definition
1286         stage, so that constants are evaluated in the proper context, when
1287         a recursive definition happens.
1288
1289 2003-05-11  Martin Baulig  <martin@ximian.com>
1290
1291         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
1292         new block for a switch section.
1293         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1294         the adding/lookup in the switch block.  Fixes #39828.
1295
1296 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
1297
1298         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1299         functionality: I needed to convert the data after I had performed
1300         the add/sub operation into the operands type size.
1301
1302         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1303         pass the type for the box operation, otherwise the resulting
1304         object would have been of type object.
1305
1306         (BoxedCast): Add constructor to specify the type to box as.
1307
1308 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
1309
1310         * iterators.cs: I was reusing the `count' variable inadvertently,
1311         take steps to not allow this to happen.
1312
1313 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
1314
1315         * attribute.cs (Attribute.Resolve): Params attributes are encoded
1316         by creating an array at the point where the params starts and
1317         putting all those arguments there, then adjusting the size of the
1318         array.
1319
1320 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
1321
1322         * expression.cs (New.AddressOf): Implement interface
1323         IMemoryLocation.  This is used when the `new' operator is used in
1324         the context of an invocation to a method on a value type.
1325
1326         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1327         example. 
1328
1329         * namespace.cs: Also check the using aliases here.
1330
1331         * driver.cs: Move the test for using validity after the types have
1332         been entered, so we do a single pass that also includes the using
1333         aliases. 
1334
1335         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1336         in the regular case.   CreateSiblingForFinally is doing extra
1337         error checking.
1338
1339         * attribute.cs (GetAttributeArgumentExpression): Store the result
1340         on an out value, and use the return value to indicate failure
1341         instead of using null (which is a valid return for Constant.GetValue).
1342
1343         * statement.cs: Perform the analysis flow for the increment
1344         portion after the statement, because this will be the real flow of
1345         execution.  Fixes #42385
1346
1347         * codegen.cs (EmitContext.EmitArgument,
1348         EmitContext.EmitStoreArgument): New helper functions when the
1349         RemapToProxy flag is set.
1350
1351         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1352         function.
1353
1354         Add support for remapping parameters. 
1355
1356         * iterators.cs: Propagate parameter values;  Store parameter
1357         values in the proxy classes.
1358         
1359 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
1360
1361         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
1362         need a proxy reference;  I do not know what I was thinking
1363
1364         * cs-parser.jay (constructor_initializer): catch another error,
1365         and display nice message.
1366         
1367         (field_declaration): catch void field declaration
1368         to flag a better error. 
1369
1370         * class.cs (MemberBase.CheckBase): Report an error instead of a
1371         warning if a new protected member is declared in a struct. 
1372         (Field.Define): catch the error of readonly/volatile.
1373
1374         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1375
1376         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
1377         volatile variable is taken
1378
1379 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
1380
1381         * statement.cs (Fixed.Resolve): Report an error if we are not in
1382         an unsafe context.
1383
1384 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
1385
1386         * typemanager.cs: reuse the code that handles type clashes for
1387         delegates and enumerations.
1388
1389         * class.cs (Report28): Always report.
1390
1391         * expression.cs (EncodeAsAttribute): Allow nulls here.
1392
1393 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
1394
1395         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1396         the functionality for testing whether an expression is valid for
1397         an attribute here.  Also handle the case of arrays of elements
1398         being stored. 
1399
1400         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1401         encoding a linear array into an array of objects that are suitable
1402         to be passed to an CustomAttributeBuilder.
1403
1404         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1405
1406         * ecore.cs: (FieldExpr): Handle field remapping here.
1407
1408         * iteratators.cs: Pass the instance variable (if the method is an
1409         instance method) to the constructors, so we can access the field
1410         variables on the class.
1411
1412         TODO: Test this with structs.  I think the THIS variable on
1413         structs might have to be a pointer, and not a refenrece
1414
1415 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
1416
1417         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1418         local variables to fields in a proxy class.
1419
1420         * iterators.cs (PopulateProxy): Rename our internal fields to
1421         <XXX>.  
1422         Create a <THIS> field if we are an instance method, so we can
1423         reference our parent container variables.
1424         (MapVariable): Called back from the EmitContext code to enter a
1425         new variable to field mapping into the proxy class (we just create
1426         a FieldBuilder).
1427
1428         * expression.cs
1429         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1430         for using the remapped locals to fields.
1431
1432         I placed the code here, because that gives the same semantics to
1433         local variables, and only changes the Emit code.
1434
1435         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1436         statements inside iterators.
1437         (VariableInfo): Add a FieldBuilder for the cases when we are
1438         remapping local variables to fields in a proxy class
1439
1440         * ecore.cs (SimpleNameResolve): Avoid testing two times for
1441         current_block != null.
1442
1443         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1444         not cope with strings, as it has been moved to the
1445         TableSwitchEmit.  Fixed bug in switch generation.
1446
1447         * expression.cs (New.DoResolve): Provide more context for the user
1448         when reporting an error.
1449
1450         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1451         pointers. 
1452
1453         * expression.cs (MemberAccess.DoResolve): When we get a type back,
1454         check the permissions for it.  Note than in a type-resolution
1455         context the check was already present in DeclSpace.ResolveType,
1456         but was missing from the MemberAccess.
1457
1458         (ArrayCreation.CheckIndices): warn if the user has
1459         more nested levels of expressions, but there are no more
1460         dimensions specified.  Avoids crash on bug 41906.
1461
1462 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
1463
1464         * statement.cs (Block): replace Implicit bool, for a generic
1465         flags.   
1466         New flag: `Unchecked'.  This is used during the EmitMeta phase
1467         (which is out-of-line with the regular Resolve/Emit process for a
1468         statement, as this is done ahead of time, but still gets a chance
1469         to call constant resolve).
1470         
1471         (Block.Flags): new enum for adding a new flag.
1472
1473         (Block.EmitMeta): track the state of unchecked.
1474         
1475         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1476         to enable constant resolution to work there as well.
1477
1478 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
1479
1480         * typemanager.cs (ienumerable_type): Also look up
1481         System.Collections.IEnumerable. 
1482
1483 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
1484
1485         TODO: Test more than one conditional per method.
1486         
1487         * class.cs (Indexer.Define): Report the location where the user is
1488         referencing the unsupported feature.
1489
1490         (MethodData): Overload the use of `conditionals' to
1491         minimize the creation of needless ArrayLists.   This saves roughly
1492         212kb on my machine.
1493
1494         (Method): Implement the new IIteratorContainer interface.
1495         (Method.SetYields): Implement the method by setting the ModFlags
1496         to contain METHOD_YIELDS.
1497         
1498         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1499         which just got set to null.
1500
1501         * iterators.cs: New file.
1502
1503         (Yield, YieldBreak): New statements.
1504
1505         * statement.cs (Return.Resolve): Flag an error if we are used in
1506         an iterator method.
1507
1508         * codegen.cs (InIterator): New flag set if the code is being
1509         compiled in an iterator method.
1510
1511         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
1512         internal modifier, and we just use it to avoid adding extra
1513         fields, as this is seldom used.  
1514
1515         * cs-parser.jay: Add yield_statement (yield and yield break).
1516
1517         * driver.cs: New flag -v2 to turn on version 2 features. 
1518
1519         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1520         hashtable when v2 is enabled.
1521
1522 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
1523
1524         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1525         there is already a namespace defined with this name.
1526
1527         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1528         people upgraded their corlibs.
1529
1530         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1531         always use fully qualified types, no need to use the compiler
1532         front end.
1533
1534         (TypeManager.IsNamespace): Use binarysearch.
1535         
1536         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1537         AddDelegate): I did not quite use the new IsValid API properly: I
1538         have to pass the short-name and the fullname.  I was passing only
1539         the basename instead of the fullname sometimes. 
1540
1541         (TypeContainer.DefineType): call NamespaceClash.
1542
1543         * interface.cs (Interface.DefineType): use NamespaceClash before
1544         defining the type.
1545
1546         * delegate.cs (Delegate.DefineType): use NamespaceClash before
1547         defining the type.
1548
1549         * enum.cs: (Enum.DefineType): use NamespaceClash before
1550         defining the type.
1551
1552         * typemanager.cs (: 3-line patch that gives us some tasty 11%
1553         speed increase.  First, use the negative_hits cache when we get a
1554         negative.  Second, add the type with its full original name
1555         instead of the new . and + encoded name (reflection uses + to
1556         separate type from a nested type).  Use LookupTypeReflection
1557         directly which bypasses the type->name hashtable (that we already
1558         know does not contain the type.
1559         
1560         * decl.cs (DeclSpace.ResolveTypeExpr): track the
1561         location/container type. 
1562
1563         * driver.cs: When passing utf8, use directly the UTF8Encoding.
1564
1565 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
1566
1567         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1568
1569         * delegate.cs (NewDelegate.Resolve): Test whether an instance
1570         method is being referenced in the method group from a static
1571         context, and report error 120 if so.
1572
1573         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1574         Error118. 
1575
1576         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1577         is created, we create the A namespace).
1578
1579         * cs-parser.jay: A namespace also introduces a DeclarationFound.
1580         Fixes #41591
1581
1582 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
1583
1584         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1585         invocation to ModuleBuilder.GetType with the same values will
1586         return a new type instance, so we need to cache its return
1587         values. 
1588
1589         * expression.cs (Binary.ResolveOperator): Only allow the compare
1590         operators on enums if they are of the same type.
1591
1592         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1593         types of ValueType on their own case.  Before we were giving them
1594         the same treatment as objects.
1595
1596         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1597         fullname.  Short name is used to compare against container name.
1598         Fullname is used to check against defined namespace names.
1599         
1600         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1601         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1602
1603         (Method.CheckBase): Call parent.
1604         (MemberBase.CheckBase): Check for protected members on sealed
1605         classes.
1606         (PropertyBase.CheckBase): Call parent.
1607         (Field.Define): Call parent.
1608
1609         * report.cs: Negative error codes are now mapped to 8000 - code,
1610         so that the display is render more nicely.
1611
1612         * typemanager.cs: Do not use try/catch, instead report a regular
1613         error. 
1614
1615         (GetPointerType, GetReferenceType): These methods provide
1616         mechanisms to obtain the T* and T& from a T.  We had the code
1617         previously scattered around the code base, and it also used
1618         TypeManager.LookupType that would go through plenty of caches.
1619         This one goes directly to the type source.
1620
1621         In some places we did the Type.GetType followed by
1622         ModuleBuilder.GetType, but not in others, so this unifies the
1623         processing as well.
1624
1625         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1626         statements now that we have namespace information.
1627
1628         * typemanager.cs (IsNamespace): New method, returns whether the
1629         string presented is a namespace or not.
1630
1631         (ComputeNamespaces): New public entry point, computes the list of
1632         available namespaces, using the GetNamespaces API call in Mono, or
1633         the slower version in MS.NET.   
1634
1635         Now before we start the semantic analysis phase, we have a
1636         complete list of namespaces including everything that the user has
1637         provided.
1638
1639         Deleted old code to cache namespaces in .nsc files.
1640
1641 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
1642
1643         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1644         class/struct location definition Location for the implicit
1645         constructor location.
1646
1647         (Operator.Define): Use the location of the operator for the
1648         implicit Method definition.
1649
1650         (Constructor.Emit): use the constructor location for the implicit
1651         base initializer constructor.
1652
1653         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
1654         and the Expression class now contains two new methods:
1655
1656         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
1657         isolate type lookup from the rest of the resolution process.
1658
1659         Since we use Expressions to hold type definitions due to the way
1660         we parse the input we have historically overloaded Resolve to
1661         perform the Type lookups if a special flag is passed.  Now this is
1662         eliminated and two methods take their place. 
1663         
1664         The differences in the two methods between xStep and xTerminal is
1665         that xStep is involved in our current lookup system that uses
1666         SimpleNames to compose a name, while xTerminal is used just to
1667         catch the case where the simplename lookup failed.
1668         
1669 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
1670
1671         * expression.cs (ResolveMemberAccess): Remove redundant code.
1672         TypeExpr expressions are always born fully resolved.
1673
1674         * interface.cs (PopulateMethod): Do not lookup the types twice.
1675         We were doing it once during SemanticAnalysis and once during
1676         PopulateMethod.
1677
1678         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1679         in local variable type definitions, were being returned as a
1680         SimpleName (we decomposed everything into a string), that is
1681         because primary_expression was being used instead of a type in the
1682         grammar (reduce/reduce conflicts).
1683
1684         The part that was wrong is that we converted the expression into a
1685         string (an oversimplification in one hand, compounded with primary
1686         expressions doing string concatenation).
1687
1688         So things like:
1689
1690         A.B.C [] x;
1691
1692         Would return "A.B.C[]" as a SimpleName.  This stopped things like
1693         using clauses from working on this particular context.  And a type
1694         was being matched directly against "A.B.C[]".
1695
1696         We now use the correct approach, and allow for ComposedCast to be
1697         part of the unary expression.  So the "A.B.C []" become a composed
1698         cast of "A.B.C" (as a nested group of MemberAccess with a
1699         SimpleName at the end) plus the rank composition "[]". 
1700
1701         Also fixes 35567
1702         
1703 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
1704
1705         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1706         for the access level checking.
1707
1708         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
1709         `TypeContainer container', because I kept getting confused when I
1710         was debugging this code.
1711
1712         * expression.cs (Indexers): Instead of tracking getters/setters,
1713         we now track them in parallel.  We create one arraylist less, but
1714         most importantly it is possible now for the LValue code to find a
1715         matching get for a set.
1716
1717         (IndexerAccess.DoResolveLValue): Update the code.
1718         GetIndexersForType has been modified already to extract all the
1719         indexers from a type.  The code assumed it did not.
1720
1721         Also make the code set the correct return type for the indexer.
1722         This was fixed a long time ago for properties, but was missing for
1723         indexers.  It used to be void_type.
1724
1725         (Binary.Emit): Test first for doubles instead of
1726         floats, as they are more common.
1727
1728         (Binary.EmitBranchable): Use the .un version of the branch opcodes
1729         when dealing with floats and the <=, >= operators.  This fixes bug
1730         #39314 
1731
1732         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1733         to load the array value by emitting a load on the foreach variable
1734         type.  This was incorrect.  
1735
1736         We now emit the code to load an element using the the array
1737         variable type, and then we emit the conversion operator.
1738
1739         Fixed #40176
1740
1741 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
1742
1743         * attribute.cs: Avoid allocation of ArrayLists in the common case.
1744
1745 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
1746
1747         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1748         test for protection before we test for signatures. 
1749
1750         (MethodSignature.ToString): implement.
1751
1752         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1753         to the case where we reduced into a LongConstant.
1754
1755         * decl.cs (CheckAccessLevel): If the type is an array, we can not
1756         depend on whether the information is acurrate, because the
1757         Microsoft runtime will always claim that the array type is public,
1758         regardless of the real state.
1759
1760         If the type is a pointer, another problem happens: the type is
1761         reported as non-public in Microsoft.  
1762
1763         In both cases we have to call CheckAccessLevel recursively with
1764         the underlying type as the argument to be tested.
1765
1766 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
1767
1768         * assign.cs (Assign.Emit): If we are dealing with a compound
1769         assignment expression, we should use the code path that stores the
1770         intermediate result in a temporary value.  This fixes #40903.
1771
1772         *expression.cs (Indirection.ToString): Provide ToString method for
1773         debugging. 
1774         
1775 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
1776
1777         * class.cs: Null out fields holding references to Block objects so
1778         they can be garbage collected.
1779
1780         * expression.cs (OverloadResolve): Remove unused local.
1781
1782 2003-04-07  Martin Baulig  <martin@ximian.com>
1783
1784         * codegen.cs (EmitContext.CurrentFile): New public field.
1785         (EmitContext.Mark): Use the CurrentFile to check whether the
1786         location is in the correct file.
1787         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1788
1789 2003-04-07  Martin Baulig  <martin@ximian.com>
1790
1791         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1792
1793         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1794         location.  [FIXME: The location argument which gets passed to this
1795         method is sometimes wrong!]
1796
1797 2003-04-07  Nick Drochak <ndrochak@gol.com>
1798
1799         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1800
1801 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
1802
1803         * expression.cs (Indirection.EmitAssign): We were using the
1804         temporary, but returning immediately instead of continuing the
1805         EmitAssing flow.
1806
1807 2003-04-06  Martin Baulig  <martin@ximian.com>
1808
1809         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1810         if it's a nested child, but also deriving from the outer class.
1811         See test 190.cs.
1812
1813         * typemanager.cs (IsNestedChildOf): Make this work if it's a
1814         nested child, but also deriving from the outer class.  See
1815         test-190.cs.
1816         (FilterWithClosure): We may access private members of the outer
1817         class if we're a nested child and deriving from the outer class.
1818         (RealMemberLookup): Only set `closure_private_ok' if the
1819         `original_bf' contained BindingFlags.NonPublic.
1820
1821 2003-04-05  Martin Baulig  <martin@ximian.com>
1822
1823         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
1824
1825 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
1826
1827         * class.cs (Event.Define): Do not allow abstract events to have
1828         initializers. 
1829
1830 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
1831
1832         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1833         block in event declarations.
1834
1835         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1836         value type, get its address.
1837
1838         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1839         leaving a class on the stack instead of a boolean value (int
1840         0/1).  Change the code so we compare against null, and then the
1841         result against zero.
1842
1843         * class.cs (TypeContainer.GetClassBases): We were checking for the
1844         parent class being sealed too late.
1845
1846         * expression.cs (Binary.Emit): For <= and >= when dealing with
1847         floating point values, use cgt.un and clt.un instead of cgt and
1848         clt alone.
1849
1850 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
1851
1852         * statement.cs: Apply the same optimization as MS: skip the 
1853         GetEnumerator returning an IEnumerator, and use the one returning a 
1854         CharEnumerator instead. This allows us to avoid the try-finally block 
1855         and the boxing.
1856
1857 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
1858
1859         * cs-parser.jay: Attributes cannot be applied to
1860                          namespaces. Fixes #40473
1861
1862 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1863
1864         * class.cs:
1865         (Add*): check if the name is valid using the full name for constants,
1866         fields, properties and events.
1867
1868 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
1869
1870         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1871         char constants to be part of the enumeration.
1872
1873         * expression.cs (Conditional.DoResolve): Add support for operator
1874         true. Implements the missing functionality from 14.12
1875
1876         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1877         operator true/false as required by the spec.
1878
1879         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1880         implicit conversion to boolean.
1881
1882         * statement.cs (Statement.ResolveBoolean): A boolean expression is
1883         also one where the type implements `operator true'. 
1884
1885         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
1886         get an expression that will invoke operator true based on an
1887         expression.  
1888
1889         (GetConversionOperators): Removed the hack that called op_True
1890         here.  
1891
1892         (Expression.ResolveBoolean): Move this from Statement.
1893
1894 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
1895
1896         * ecore.cs (FieldExpr): do not allow initialization of initonly
1897         fields on derived classes
1898
1899 2003-03-13  Martin Baulig  <martin@ximian.com>
1900
1901         * statement.cs (Block.Emit): Call ig.BeginScope() and
1902         ig.EndScope() when compiling with debugging info; call
1903         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
1904
1905 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
1906
1907         * expression.cs (Indexers): Do not construct immediately, allow
1908         for new members to be appended as we go.  Fixes 38143
1909
1910 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1911
1912         * expression.cs: save/restore context when resolving an unchecked
1913         expression.
1914
1915 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
1916
1917         * cfold.cs: Catch division by zero in modulus operator during
1918         constant folding.
1919
1920 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
1921
1922         * interface.cs (Interface.DefineMembers): Avoid defining members
1923         twice. 
1924
1925 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
1926
1927         * driver.cs: handle the +/- options for -noconfig
1928
1929         * statement.cs (Unckeched.Resolve): Also track the state of
1930         unchecked in the Resolve phase.
1931
1932 2003-02-27  Martin Baulig  <martin@ximian.com>
1933
1934         * ecore.cs (Expression.MemberLookup): Don't create a
1935         MethodGroupExpr for something which is not a method.  Fixes #38291.
1936
1937 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
1938
1939         * class.cs (MemberBase.CheckParameters): Also check that the type
1940         is unmanaged if it is a pointer.
1941
1942         * expression.cs (SizeOf.Resolve): Add location information.
1943
1944         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
1945         a managed type is declared.
1946
1947         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
1948         parameter modifiers as well.  Fixes bug 38606
1949
1950         * class.cs: Very sad.  Am backing out the speed up changes
1951         introduced by the ArrayList -> Array in the TypeContainer, as they
1952         were not actually that much faster, and introduced a bug (no error
1953         reports on duplicated methods).
1954
1955         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
1956         source first, this will guarantee that we have a valid expression
1957         before calling in lower levels functions that will require a
1958         resolved object.  Then use this original_source in the
1959         target.ResolveLValue instead of the original source that was
1960         passed to us.
1961
1962         Another change.  Use target.Resolve instead of LValueResolve.
1963         Although we are resolving for LValues, we will let the Assign code
1964         take care of that (it will be called again from Resolve).  This
1965         basically allows code like this:
1966
1967         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
1968         class Y { void A (X x) { x [0] += o; }
1969
1970         The problem was that the indexer was trying to resolve for
1971         set_Item (idx, object o) and never finding one.  The real set_Item
1972         was set_Item (idx, X).  By delaying the process we get the right
1973         semantics. 
1974
1975         Fixes bug 36505
1976         
1977 2003-02-23  Martin Baulig  <martin@ximian.com>
1978
1979         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
1980         while calling DoEmit ().
1981
1982         * codegen.cs (EmitContext.Mark): Don't mark locations in other
1983         source files; if you use the #line directive inside a method, the
1984         compiler stops emitting line numbers for the debugger until it
1985         reaches the end of the method or another #line directive which
1986         restores the original file.
1987
1988 2003-02-23  Martin Baulig  <martin@ximian.com>
1989
1990         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
1991
1992 2003-02-23  Martin Baulig  <martin@ximian.com>
1993
1994         * statement.cs (Block.AddChildVariableNames): We need to call this
1995         recursively, not just for our immediate children.
1996
1997 2003-02-23  Martin Baulig  <martin@ximian.com>
1998
1999         * class.cs (Event.Define): Always make the field private, like csc does.
2000
2001         * typemanager.cs (TypeManager.RealMemberLookup): Make events
2002         actually work, fixes bug #37521.
2003
2004 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
2005
2006         * delegate.cs: When creating the various temporary "Parameters"
2007         classes, make sure that we call the ComputeAndDefineParameterTypes
2008         on those new parameters (just like we do with the formal ones), to
2009         allow them to be resolved in the context of the DeclSpace.
2010
2011         This fixes the bug that Dick observed in Bugzilla #38530.
2012
2013 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
2014
2015         * expression.cs (ResolveMemberAccess): When resolving a constant,
2016         do not attempt to pull a constant if the value was not able to
2017         generate a valid constant.
2018
2019         * const.cs (LookupConstantValue): Do not report more errors than required.
2020
2021 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2022
2023         * expression.cs: fixes bug #38328.
2024
2025 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2026
2027         * class.cs: Changed all the various members that can be part of a
2028         class from being an ArrayList to be an Array of the right type.
2029         During the DefineType type_list, interface_list, delegate_list and
2030         enum_list are turned into types, interfaces, delegates and enums
2031         arrays.  
2032
2033         And during the member population, indexer_list, event_list,
2034         constant_list, field_list, instance_constructor_list, method_list,
2035         operator_list and property_list are turned into their real arrays.
2036
2037         Although we could probably perform this operation earlier, for
2038         good error reporting we need to keep the lists and remove the
2039         lists for longer than required.
2040
2041         This optimization was triggered by Paolo profiling the compiler
2042         speed on the output of `gen-sample-program.pl' perl script. 
2043
2044         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2045         not crash in methods like MemberLookupFailed that use this field.  
2046
2047         This problem arises when the compiler fails to resolve a type
2048         during interface type definition for example.
2049
2050 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2051
2052         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2053         inherit from System.Object, so we have to stop at null, not only
2054         when reaching System.Object.
2055
2056 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
2057
2058         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2059         DeclaredOnly because the parent indexer might have had a different
2060         name, but did not loop until the top of the hierarchy was reached.
2061
2062         The problem this one fixes is 35492: when a class implemented an
2063         indexer from an interface, we were getting the interface method
2064         (which was abstract) and we were flagging an error (can not invoke
2065         abstract method).
2066
2067         This also keeps bug 33089 functioning, and test-148 functioning.
2068
2069         * typemanager.cs (IsSpecialMethod): The correct way of figuring
2070         out if a method is special is to see if it is declared in a
2071         property or event, or whether it is one of the predefined operator
2072         names.   This should fix correctly #36804.
2073
2074 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
2075
2076         The goal here is to remove the dependency on EmptyCast.Peel ().
2077         Killing it completely.
2078         
2079         The problem is that currently in a number of places where
2080         constants are expected, we have to "probe" for an EmptyCast, and
2081         Peel, which is not the correct thing to do, as this will be
2082         repetitive and will likely lead to errors. 
2083
2084         The idea is to remove any EmptyCasts that are used in casts that
2085         can be reduced to constants, so we only have to cope with
2086         constants. 
2087
2088         This bug hunt was triggered by Bug 37363 and the desire to remove
2089         the duplicate pattern where we were "peeling" emptycasts to check
2090         whether they were constants.  Now constants will always be
2091         constants.
2092         
2093         * ecore.cs: Use an enumconstant here instead of wrapping with
2094         EmptyCast.  
2095
2096         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
2097         throwing me off.  By handling this we can get rid of a few hacks.
2098         
2099         * statement.cs (Switch): Removed Peel() code.
2100
2101 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
2102
2103         * class.cs: Location information for error 508
2104
2105         * expression.cs (New.DoResolve): Add a guard against double
2106         resolution of an expression.  
2107
2108         The New DoResolve might be called twice when initializing field
2109         expressions (see EmitFieldInitializers, the call to
2110         GetInitializerExpression will perform a resolve on the expression,
2111         and later the assign will trigger another resolution
2112
2113         This leads to bugs (#37014)
2114
2115         * delegate.cs: The signature for EndInvoke should contain any ref
2116         or out parameters as well.  We were not doing this in the past. 
2117
2118         * class.cs (Field.Define): Do not overwrite the type definition
2119         inside the `volatile' group.  Turns out that volatile enumerations
2120         were changing the type here to perform a validity test, which
2121         broke conversions. 
2122
2123 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
2124
2125         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2126         and structs, we do not want to load the instance variable
2127
2128         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2129         enum_type has to be handled like an object reference (implicit
2130         conversions exists from this to object), but the regular IsClass
2131         and IsValueType tests will never return true for this one.
2132
2133         Also we use TypeManager.IsValueType instead of type.IsValueType,
2134         just for consistency with the rest of the code (this is only
2135         needed if we ever use the construct exposed by test-180.cs inside
2136         corlib, which we dont today).
2137
2138 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
2139
2140         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2141         just InternalCall.
2142
2143 2003-02-09  Martin Baulig  <martin@ximian.com>
2144
2145         * namespace.cs (Namespace..ctor): Added SourceFile argument.
2146         (Namespace.DefineNamespaces): New static public method; this is
2147         called when we're compiling with debugging to add all namespaces
2148         to the symbol file.
2149
2150         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2151         pass it to the Namespace's .ctor.
2152
2153         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2154         and MethodBase arguments; pass the namespace ID to the symwriter;
2155         pass the MethodBase instead of the token to the symwriter.
2156         (SymbolWriter.DefineNamespace): New method to add a namespace to
2157         the symbol file.
2158
2159 2003-02-09  Martin Baulig  <martin@ximian.com>
2160
2161         * symbolwriter.cs: New file.  This is a wrapper around
2162         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
2163         methods here in near future.
2164
2165 2003-02-09  Martin Baulig  <martin@ximian.com>
2166
2167         * codegen.cs (EmitContext.Mark): Just pass the arguments to
2168         ILGenerator.MarkSequencePoint() which are actually used by the
2169         symbol writer.
2170
2171 2003-02-09  Martin Baulig  <martin@ximian.com>
2172
2173         * location.cs (SourceFile): New public sealed class.  This
2174         contains the name and an index which is used in the location's token.
2175         (Location): Reserve an appropriate number of bits in the token for
2176         the source file instead of walking over that list, this gives us a
2177         really huge performance improvement when compiling with debugging.
2178
2179         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2180         `SourceFile' argument instead of a string.
2181         (Driver.ProcessFile): Add all the files via Location.AddFile(),
2182         but don't parse/tokenize here, we need to generate the list of all
2183         source files before we do that.
2184         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
2185         the files.
2186
2187         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2188         instead of a string.
2189
2190         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2191         of a string.
2192
2193 2003-02-09  Martin Baulig  <martin@ximian.com>
2194
2195         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2196         filename on `#line default'.
2197
2198 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2199
2200         * statement.cs: don't clear the pinned var when the fixed statement
2201         returns from the method (fixes bug#37752).
2202
2203 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2204
2205         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
2206         to IsValueType.
2207
2208 2003-02-07  Martin Baulig  <martin@ximian.com>
2209
2210         * driver.cs: Removed the `--debug-args' command line argument.
2211
2212         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2213         automatically by the AsssemblyBuilder.
2214         (CodeGen.InitializeSymbolWriter): We don't need to call any
2215         initialization function on the symbol writer anymore.  This method
2216         doesn't take any arguments.
2217
2218 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
2219
2220         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2221         from referenced assemblies as well.
2222
2223 2003-02-02  Martin Baulig  <martin@ximian.com>
2224
2225         * class.cs (MethodData.Emit): Generate debugging info for external methods.
2226
2227 2003-02-02  Martin Baulig  <martin@ximian.com>
2228
2229         * class.cs (Constructor.Emit): Open the symbol writer before
2230         emitting the constructor initializer.
2231         (ConstructorInitializer.Emit): Call ec.Mark() to allow
2232         single-stepping through constructor initializers.
2233
2234 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
2235
2236         * class.cs: Handle error 549: do not allow virtual methods in
2237         sealed classes. 
2238
2239 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2240
2241         * decl.cs: Check access levels when resolving types
2242         
2243 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2244
2245         * statement.cs: Add parameters and locals set in catch blocks that might 
2246         return to set vector
2247
2248 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
2249
2250         * class.cs (Operator): Set the SpecialName flags for operators.
2251         
2252         * expression.cs (Invocation.DoResolve): Only block calls to
2253         accessors and operators on SpecialName methods.
2254
2255         (Cast.TryReduce): Handle conversions from char constants.
2256
2257
2258 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2259
2260         * statement.cs: small memory and time optimization in FlowBranching.
2261         
2262 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
2263
2264         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2265         problem that the last fix but in the other sid (Set).
2266
2267         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2268         access when there is no indexer in the hierarchy.
2269         
2270 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2271
2272         * class.cs: Combine some if statements.
2273
2274 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2275
2276         * driver.cs: fixed bug #37187.
2277
2278 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
2279
2280         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2281         any indexer, it's needed to build a list with all the indexers in the
2282         hierarchy (AllGetters), else we have problems. Fixes #35653.
2283
2284 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
2285
2286         * class.cs (MethodData.Define): It is wrong for an interface
2287         implementation to be static in both cases: explicit and implicit.
2288         We were only handling this in one case.
2289
2290         Improve the if situation there to not have negations.
2291         
2292         * class.cs (Field.Define): Turns out that we do not need to check
2293         the unsafe bit on field definition, only on usage.  Remove the test.
2294
2295 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2296
2297         * driver.cs: use assembly.Location instead of Codebase (the latest
2298         patch made mcs fail when using MS assemblies).
2299
2300 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
2301
2302         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2303         get the path to *corlib.dll.
2304
2305 2003-01-21  Nick Drochak <ndrochak@gol.com>
2306
2307         * cs-tokenizer.cs:
2308         * pending.cs:
2309         * typemanager.cs: Remove compiler warnings
2310
2311 2003-01-20  Duncan Mak  <duncan@ximian.com>
2312
2313         * AssemblyInfo.cs: Bump the version number to 0.19.
2314         
2315 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2316
2317         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2318
2319 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
2320
2321         * class.cs (Constructor::Emit): Emit debugging info for constructors.
2322
2323 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
2324
2325         * cs-parser.jay: Small fix: we were not comparing the constructor
2326         name correctly.   Thanks to Zoltan for the initial pointer.
2327
2328 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2329
2330         * cs-tokenizer.cs: Set file name when specified with #line
2331
2332 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
2333
2334         * cs-parser.jay: Only perform the constructor checks here if we
2335         are named like the class;  This will help provider a better
2336         error.  The constructor path is taken when a type definition is
2337         not found, but most likely the user forgot to add the type, so
2338         report that rather than the constructor error.
2339
2340 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2341
2342         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2343         allocations.
2344
2345 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2346
2347         * cs-parser.jay: Add cleanup call.
2348
2349 2003-01-13  Duncan Mak  <duncan@ximian.com>
2350
2351         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2352         consistent with other methods.
2353
2354 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2355
2356         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2357         
2358 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2359
2360         * attribute.cs: only set GuidAttr to true when we have a
2361         GuidAttribute.
2362
2363 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2364
2365         * ecore.cs:
2366         * expression.cs:
2367         * typemanager.cs: fixes to allow mcs compile corlib with the new
2368         Type.IsSubclassOf fix.
2369
2370 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
2371
2372         * expression.cs (LocalVariableReference.DoResolve): Classify a
2373         constant as a value, not as a variable.   Also, set the type for
2374         the variable.
2375
2376         * cs-parser.jay (fixed_statement): take a type instead of a
2377         pointer_type, so we can produce a better error message later.
2378         
2379         * statement.cs (Fixed.Resolve): Flag types that are not pointers
2380         as an error.  
2381         
2382         (For.DoEmit): Make inifinite loops have a
2383         non-conditional branch back.
2384
2385         (Fixed.DoEmit): First populate the pinned variables, then emit the
2386         statement, then clear the variables.  Before I was emitting the
2387         code once for each fixed piece.
2388
2389
2390 2003-01-08  Martin Baulig  <martin@ximian.com>
2391
2392         * statement.cs (FlowBranching.MergeChild): A break in a
2393         SWITCH_SECTION does not leave a loop.  Fixes #36155.
2394
2395 2003-01-08  Martin Baulig  <martin@ximian.com>
2396
2397         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2398         lives in the same number space than `param_map'.  Fixes #36154.
2399
2400 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
2401
2402         * cs-parser.jay (constructor_declaration): Set the
2403         Constructor.ModFlags before probing for it.  This makes the
2404         compiler report 514, 515 and 132 (the code was there, but got
2405         broken). 
2406
2407         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2408         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2409         (GotoCase.Resolve): Set `Returns' to ALWAYS.
2410
2411 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2412
2413         * enum.cs: create the enum static fields using the enum type.
2414
2415 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2416
2417         * class.cs: don't try to create the ParamBuilder for the return
2418         type if it's not needed (and handle it breaking for the ms runtime
2419         anyway).
2420
2421 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2422
2423         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2424
2425 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
2426
2427         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2428         the command.   This showed up while compiling the JANET source
2429         code, which used \r as its only newline separator.
2430
2431 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
2432
2433         * class.cs (Method.Define): If we are an operator (because it
2434         reuses our code), then set the SpecialName and HideBySig.  #36128
2435
2436 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
2437
2438         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2439         exception, report error 120 `object reference required'.
2440
2441         * driver.cs: Add --pause option, used during to measure the size
2442         of the process as it goes with --timestamp.
2443
2444         * expression.cs (Invocation.DoResolve): Do not allow methods with
2445         SpecialName to be invoked.
2446
2447 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
2448
2449         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2450         number before adding it.
2451
2452 2002-12-21  Ravi Pratap  <ravi@ximian.com>
2453
2454         * ecore.cs (StandardImplicitConversion): When in an unsafe
2455         context, we allow conversion between void * to any other pointer
2456         type. This fixes bug #35973.
2457
2458 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2459
2460         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2461         is not thrown when extensionless outputs are used 
2462
2463 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2464
2465         * rootcontext.cs: fixed compilation of corlib.
2466
2467 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
2468
2469         * attribute.cs (Attributes.Contains): Add new method.
2470
2471         * class.cs (MethodCore.LabelParameters): if the parameter is an
2472         `out' parameter, check that no attribute `[In]' has been passed.
2473
2474         * enum.cs: Handle the `value__' name in an enumeration.
2475
2476 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
2477
2478         * decl.cs: Added special case to allow overrides on "protected
2479         internal" methods
2480         
2481 2002-12-18  Ravi Pratap  <ravi@ximian.com>
2482
2483         * attribute.cs (Attributes.AddAttributeSection): Rename to this
2484         since it makes much more sense.
2485
2486         (Attributes.ctor): Don't require a Location parameter.
2487         
2488         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2489
2490         * attribute.cs (ApplyAttributes): Remove extra Location parameters
2491         since we already have that information per attribute.
2492
2493         * everywhere : make appropriate changes.
2494
2495         * class.cs (LabelParameters): Write the code which actually
2496         applies attributes to the return type. We can't do this on the MS
2497         .NET runtime so we flag a warning in the case an exception is
2498         thrown.
2499
2500 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
2501
2502         * const.cs: Handle implicit null conversions here too.
2503
2504 2002-12-17  Ravi Pratap  <ravi@ximian.com>
2505
2506         * class.cs (MethodCore.LabelParameters): Remove the extra
2507         Type [] parameter since it is completely unnecessary. Instead
2508         pass in the method's attributes so that we can extract
2509         the "return" attribute.
2510
2511 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
2512
2513         * cs-parser.jay (parse): Use Report.Error to flag errors instead
2514         of ignoring it and letting the compile continue.
2515
2516         * typemanager.cs (ChangeType): use an extra argument to return an
2517         error condition instead of throwing an exception.
2518
2519 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
2520
2521         * expression.cs (Unary.TryReduce): mimic the code for the regular
2522         code path.  Perform an implicit cast in the cases where we can
2523         implicitly convert to one of the integral types, and then reduce
2524         based on that constant.   This fixes bug #35483.
2525
2526 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2527
2528         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2529
2530 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2531
2532         * namespace.cs: fixed bug #35489.
2533
2534 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
2535
2536         * class.cs: Remove some dead code.
2537
2538         * cs-parser.jay: Estimate the number of methods needed
2539         (RootContext.MethodCount);
2540
2541         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2542         numbers instead of StringBuilders.
2543
2544         * support.cs (PtrHashtable): Add constructor with initial size;
2545         We can now reduce reallocations of the method table.
2546
2547 2002-12-10  Ravi Pratap  <ravi@ximian.com>
2548
2549         * attribute.cs (ApplyAttributes): Keep track of the emitted
2550         attributes on a per-target basis. This fixes bug #35413.
2551
2552 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
2553
2554         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2555         default to the Windows 1252 encoding.
2556
2557         (UnixParseOption): Support version, thanks to Alp for the missing
2558         pointer. 
2559
2560         * AssemblyInfo.cs: Add nice assembly information.
2561
2562         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2563         (bug 35169).
2564
2565         * cs-parser.jay: Allow a trailing comma before the close bracked
2566         in the attribute_section production.
2567
2568         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2569         address of the instance was being taken, I will take this out,
2570         because we take the address of the object immediately here.
2571
2572 2002-12-09  Ravi Pratap  <ravi@ximian.com>
2573
2574         * typemanager.cs (AreMultipleAllowed): Take care of the most
2575         obvious case where attribute type is not in the current assembly -
2576         stupid me ;-)
2577
2578 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
2579
2580         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2581         definitions, instead of doing that afterwards.  
2582
2583         Also we use a nice little hack, depending on the constructor, we
2584         know if we are a "composed" name or a simple name.  Hence, we
2585         avoid the IndexOf test, and we avoid 
2586
2587         * codegen.cs: Add code to assist in a bug reporter to track down
2588         the source of a compiler crash. 
2589
2590 2002-12-07  Ravi Pratap  <ravi@ximian.com>
2591
2592         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2593         types have been emitted for a given element and flag an error
2594         if something which does not have AllowMultiple set is used more
2595         than once.
2596
2597         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2598         attribute types and their corresponding AllowMultiple properties
2599
2600         (AreMultipleAllowed): Check the property for a given type.
2601
2602         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2603         property in the case we have a TypeContainer.
2604
2605         (Attributes.AddAttribute): Detect duplicates and just skip on
2606         adding them. This trivial fix catches a pretty gross error in our
2607         attribute emission - global attributes were being emitted twice!
2608
2609         Bugzilla bug #33187 is now fixed.
2610
2611 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
2612
2613         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2614         instead of pp_and).
2615
2616         * expression.cs (Binary.ResolveOperator): I can only use the
2617         Concat (string, string, string) and Concat (string, string,
2618         string, string) if the child is actually a concatenation of
2619         strings. 
2620
2621 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
2622
2623         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2624         context where we need a 2-character lookahead.
2625
2626         * pending.cs (PendingImplementation): Rework so we can keep track
2627         of interface types all the time, and flag those which were
2628         implemented by parents as optional.
2629
2630 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
2631
2632         * expression.cs (Binary.ResolveOperator): Use
2633         String.Concat(string,string,string) or
2634         String.Concat(string,string,string,string) when possible. 
2635
2636         * typemanager: More helper methods.
2637
2638
2639 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2640
2641         * pending.cs: remove the bogus return from GetMissingInterfaces()
2642         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2643
2644 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2645
2646         * namespace.cs: avoid duplicated 'using xxx' being added to
2647         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2648         when we get more than one 'using' statement for the same namespace.
2649         Report a CS0105 warning for it.
2650
2651 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
2652
2653         * cs-tokenizer.cs (consume_identifier): use read directly, instead
2654         of calling getChar/putback, uses internal knowledge of it.    
2655
2656         (xtoken): Reorder tokenizer so most common patterns are checked
2657         first.  This reduces the compilation time in another 5% (from 8.11s
2658         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2659
2660         The parsing time is 22% of the compilation in mcs, and from that
2661         64% is spent on the tokenization process.  
2662
2663         I tried using a binary search for keywords, but this is slower
2664         than the hashtable.  Another option would be to do a couple of
2665         things:
2666
2667                 * Not use a StringBuilder, instead use an array of chars,
2668                   with a set value.  Notice that this way we could catch
2669                   the 645 error without having to do it *afterwards*.
2670
2671                 * We could write a hand-parser to avoid the hashtable
2672                   compares altogether.
2673
2674         The identifier consumption process takes 37% of the tokenization
2675         time.  Another 15% is spent on is_number.  56% of the time spent
2676         on is_number is spent on Int64.Parse:
2677
2678                 * We could probably choose based on the string length to
2679                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
2680                   computations. 
2681
2682         Another 3% is spend on wrapping `xtoken' in the `token' function.
2683
2684         Handle 0xa0 as whitespace (#34752)
2685         
2686 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
2687
2688         * typemanager.cs (IsCLRType): New routine to tell whether a type
2689         is one of the builtin types.  
2690
2691         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
2692         typecode in more places instead of doing pointer comparissions.
2693         We could leverage some knowledge about the way the typecodes are
2694         laid out.
2695
2696         New code to cache namespaces in assemblies, it is currently not
2697         invoked, to be used soon.
2698
2699         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2700
2701         * expression.cs (Binary.ResolveOperator): specially handle
2702         strings, and do not perform user-defined operator overloading for
2703         built-in types.
2704
2705 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
2706
2707         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2708         internalcall as it is a pretty simple operation;  Avoid whenever
2709         possible to call Char.IsLetter.
2710
2711         (consume_identifier): Cut by half the number of
2712         hashtable calls by merging the is_keyword and GetKeyword behavior.
2713
2714         Do not short-circuit, because if we do, we
2715         report errors (ie, #if false && true would produce an invalid
2716         directive error);
2717         
2718
2719 2002-11-24  Martin Baulig  <martin@ximian.com>
2720
2721         * expression.cs (Cast.TryReduce): If we're in checked syntax,
2722         check constant ranges and report a CS0221.  Fixes #33186.
2723
2724 2002-11-24  Martin Baulig  <martin@ximian.com>
2725
2726         * cs-parser.jay: Make this work for uninitialized variable
2727         declarations in the `for' initializer.  Fixes #32416.
2728
2729 2002-11-24  Martin Baulig  <martin@ximian.com>
2730
2731         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2732         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
2733
2734 2002-11-24  Martin Baulig  <martin@ximian.com>
2735
2736         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2737         argument; if true, we also check for user-defined conversions.
2738         This is only needed if both arguments are of a user-defined type.
2739         Fixes #30443, added test-175.cs.
2740         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2741
2742         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2743
2744 2002-11-24  Martin Baulig  <martin@ximian.com>
2745
2746         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2747         function to get the store opcode.
2748         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2749         only emit the Ldelema if the store opcode is Stobj.  You must run
2750         both test-34 and test-167 to test this.  Fixes #34529.
2751
2752 2002-11-23  Martin Baulig  <martin@ximian.com>
2753
2754         * ecore.cs (Expression.MemberLookup): Added additional
2755         `qualifier_type' argument which is used when we're being called
2756         from MemberAccess.DoResolve() and null if we're called from a
2757         SimpleName lookup.
2758         (Expression.MemberLookupFailed): New method to report errors; this
2759         does the CS1540 check and reports the correct error message.
2760
2761         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2762         argument for the CS1540 check and redone the way how we're dealing
2763         with private members.  See the comment in the source code for details.
2764         (FilterWithClosure): Reverted this back to revision 1.197; renamed
2765         `closure_start_type' to `closure_qualifier_type' and check whether
2766         it's not null.  It was not this filter being broken, it was just
2767         being called with the wrong arguments.
2768
2769         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2770         and pass it the correct `qualifier_type'; this also does the error
2771         handling for us.
2772
2773 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
2774
2775         * expression.cs (Invocation.EmitParams): If the we are dealing
2776         with a non-built-in value type, load its address as well.
2777
2778         (ArrayCreation): Use a a pretty constant instead
2779         of the hardcoded value 2.   Use 6 instead of 2 for the number of
2780         static initializers.  
2781
2782         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2783         because they are not really value types, just glorified integers. 
2784
2785         * driver.cs: Do not append .exe, the CSC compiler does not do it.
2786
2787         * ecore.cs: Remove redundant code for enumerations, make them use
2788         the same code path as everything else, fixes the casting issue
2789         with enumerations in Windows.Forms.
2790
2791         * attribute.cs: Do only cast to string if it is a string, the
2792         validation happens later.
2793
2794         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2795         people upgrade their corlibs.
2796
2797         * ecore.cs: Oops, enumerations were not following the entire code path
2798
2799 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
2800
2801         * typemanager.cs (FilterWithClosure): Commented out the test for
2802         1540 in typemanager.cs, as it has problems when accessing
2803         protected methods from a parent class (see test-174.cs). 
2804
2805         * attribute.cs (Attribute.ValidateGuid): new method.
2806         (Attribute.Resolve): Use above.
2807
2808 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
2809
2810         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2811
2812         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2813         handling for enumerations, as we only needed the TypeContainer
2814         functionality to begin with (this is required for the fix below to
2815         work for enums that reference constants in a container class for
2816         example). 
2817
2818         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2819
2820         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2821         a valid TypeBuilder to perform lookups on.o
2822
2823         * class.cs (InheritableMemberSignatureCompare): Use true in the
2824         call to GetGetMethod and GetSetMethod, because we are comparing
2825         the signature, and we need to get the methods *even* if they are
2826         private. 
2827
2828         (PropertyBase.CheckBase): ditto.
2829
2830         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2831         GotoCase.Resolve): Use Peel on EmpytCasts.
2832
2833         * ecore.cs (EmptyCast): drop child, add Peel method.
2834
2835 2002-11-17  Martin Baulig  <martin@ximian.com>
2836
2837         * ecore.cs (EmptyCast.Child): New public property.
2838
2839         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2840         label resolved to an EmptyCast.  Fixes #34162.
2841         (GotoCase.Resolve): Likewise.
2842         (Block.EmitMeta): Likewise.
2843
2844 2002-11-17  Martin Baulig  <martin@ximian.com>
2845
2846         * expression.cs (Invocation.BetterConversion): Prefer int over
2847         uint; short over ushort; long over ulong for integer literals.
2848         Use ImplicitConversionExists instead of StandardConversionExists
2849         since we also need to check for user-defined implicit conversions.
2850         Fixes #34165.  Added test-173.cs.
2851
2852 2002-11-16  Martin Baulig  <martin@ximian.com>
2853
2854         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2855         with the `true' and `false' literals.  Fixes #33151.
2856
2857 2002-11-16  Martin Baulig  <martin@ximian.com>
2858
2859         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2860         October 22nd; don't do the cs1540 check for static members.
2861
2862         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2863         now using our own filter here and doing the cs1540 check again.
2864
2865 2002-11-16  Martin Baulig  <martin@ximian.com>
2866
2867         * support.cs (InternalParameters): Don't crash if we don't have
2868         any fixed parameters.  Fixes #33532.
2869
2870 2002-11-16  Martin Baulig  <martin@ximian.com>
2871
2872         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2873         when looking up static methods to make this work on Windows.
2874         Fixes #33773.
2875
2876 2002-11-16  Martin Baulig  <martin@ximian.com>
2877
2878         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2879         a setter rather than using PropertyInfo.CanWrite.
2880
2881 2002-11-15  Nick Drochak  <ndrochak@gol.com>
2882
2883         * class.cs: Allow acces to block member by subclasses. Fixes build
2884         breaker.
2885
2886 2002-11-14  Martin Baulig  <martin@ximian.com>
2887
2888         * class.cs (Constructor.Emit): Added the extern/block check.
2889         Fixes bug #33678.
2890
2891 2002-11-14  Martin Baulig  <martin@ximian.com>
2892
2893         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
2894         iteration while looking for indexers, this is needed because the
2895         indexer may have a different name in our base classes.  Fixed the
2896         error reporting (no indexers at all, not get accessor, no
2897         overloaded match).  Fixes bug #33089.
2898         (IndexerAccess.DoResolveLValue): Likewise.
2899
2900 2002-11-14  Martin Baulig  <martin@ximian.com>
2901
2902         * class.cs (PropertyBase.CheckBase): Make this work for multiple
2903         indexers.  Fixes the first part of bug #33089.
2904         (MethodSignature.InheritableMemberSignatureCompare): Added support
2905         for properties.
2906
2907 2002-11-13  Ravi Pratap  <ravi@ximian.com>
2908
2909         * attribute.cs (Attribute.Resolve): Catch the
2910         NullReferenceException and report it since it isn't supposed to
2911         happen. 
2912         
2913 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
2914
2915         * expression.cs (Binary.EmitBranchable): Also handle the cases for
2916         LogicalOr and LogicalAnd that can benefit from recursively
2917         handling EmitBranchable.  The code now should be nice for Paolo.
2918
2919 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
2920
2921         * typemanager.cs (LookupType): Added a negative-hit hashtable for
2922         the Type lookups, as we perform quite a number of lookups on
2923         non-Types.  This can be removed once we can deterministically tell
2924         whether we have a type or a namespace in advance.
2925
2926         But this might require special hacks from our corlib.
2927
2928         * TODO: updated.
2929
2930         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
2931         and double which avoids a conversion from an integer to a double.
2932
2933         * expression.cs: tiny optimization, avoid calling IsConstant,
2934         because it effectively performs the lookup twice.
2935
2936 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
2937
2938         But a bogus return here to keep the semantics of the old code
2939         until the Mono runtime is fixed.
2940         
2941         * pending.cs (GetMissingInterfaces): New method used to remove all
2942         the interfaces that are already implemented by our parent
2943         classes from the list of pending methods. 
2944
2945         * interface.cs: Add checks for calls after ResolveTypeExpr.
2946
2947 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
2948
2949         * class.cs (Class.Emit): Report warning 67: event not used if the
2950         warning level is beyond 3.
2951
2952         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
2953         being a NullLiteral.
2954
2955         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
2956         specifiers. 
2957
2958         * class.cs (TypeContainer.GetClassBases): Cover a missing code
2959         path that might fail if a type can not be resolved.
2960
2961         * expression.cs (Binary.Emit): Emit unsigned versions of the
2962         operators. 
2963
2964         * driver.cs: use error 5.
2965         
2966 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
2967
2968         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
2969
2970 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
2971
2972         * cs-parser.jay (switch_section): A beautiful patch from Martin
2973         Baulig that fixed 33094.
2974
2975 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
2976
2977         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
2978         Check whether the base is abstract and report an error if so.
2979
2980         * expression.cs (IndexerAccess.DoResolveLValue,
2981         IndexerAccess.DoResolve): ditto. 
2982
2983         (Invocation.DoResolve): ditto.
2984         
2985         (Invocation.FullMethodDesc): Improve the report string.
2986
2987         * statement.cs (Block): Eliminate IsVariableDefined as it is
2988         basically just a wrapper for GetVariableInfo.
2989
2990         * ecore.cs (SimpleName): Use new 
2991
2992         * support.cs (ReflectionParamter.ParameterType): We unwrap the
2993         type, as we return the actual parameter ref/unref state on a
2994         different call.
2995
2996 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
2997
2998         * support.cs: Return proper flags REF/OUT fixing the previous
2999         commit.  
3000
3001         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
3002         not used to mean `ref' but `ref or out' in ParameterReference
3003         
3004         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3005         full type signature instead of calling TypeManger.CSharpName
3006         ourselves. 
3007
3008         * support.cs (InternalParameters.ParameterDesc): Do not compare
3009         directly to the modflags, because REF/OUT will actually be bitsets
3010         if set. 
3011
3012         * delegate.cs (VerifyMethod): Check also the modifiers.
3013
3014         * cs-tokenizer.cs: Fix bug where floating point values with an
3015         exponent where a sign was missing was ignored.
3016
3017         * driver.cs: Allow multiple assemblies to be specified in a single
3018         /r: argument
3019
3020 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
3021
3022         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
3023         because identifiers after a parenthesis would end up in this kind
3024         of production, and we needed to desamiguate it for having casts
3025         like:
3026
3027                 (UserDefinedType *) xxx
3028
3029 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
3030
3031         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3032         we should set on the Bindingflags.NonPublic, but not turn on
3033         private_ok.  private_ok controls whether a Private member is
3034         returned (this is chekced on the filter routine), while the
3035         BindingFlags.NonPublic just controls whether private/protected
3036         will be allowed.   This fixes the problem part of the problem of
3037         private properties being allowed to be used in derived classes.
3038
3039         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3040         so we can call the children DoResolveLValue method (this will
3041         properly signal errors on lvalue assignments to base properties)
3042         
3043         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3044         getter are null, and we have a property info, we know that this
3045         happened because the lookup failed, so we report an error 122 for
3046         protection level violation.
3047
3048         We also silently return if setter and getter are null in the
3049         resolve functions, this condition only happens if we have flagged
3050         the error before.  This is the other half of the problem. 
3051
3052         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3053         not have accessibility information, that is why we were returning
3054         true in the filter function in typemanager.cs.
3055
3056         To properly report 122 (property is inaccessible because of its
3057         protection level) correctly, we report this error in ResolveAccess
3058         by failing if both the setter and the getter are lacking (ie, the
3059         lookup failed). 
3060
3061         DoResolve and DoLResolve have been modified to check for both
3062         setter/getter being null and returning silently, the reason being
3063         that I did not want to put the knowledge about this error in upper
3064         layers, like:
3065
3066         int old = Report.Errors;
3067         x = new PropertyExpr (...);
3068         if (old != Report.Errors)
3069                 return null;
3070         else
3071                 return x;
3072
3073         So the property expr is returned, but it is invalid, so the error
3074         will be flagged during the resolve process. 
3075
3076         * class.cs: Remove InheritablePropertySignatureCompare from the
3077         class, as we no longer depend on the property signature to compute
3078         whether it is possible to implement a method or not.
3079
3080         The reason is that calling PropertyInfo.GetGetMethod will return
3081         null (in .NET, in Mono it works, and we should change this), in
3082         cases where the Get Method does not exist in that particular
3083         class.
3084
3085         So this code:
3086
3087         class X { public virtual int A { get { return 1; } } }
3088         class Y : X { }
3089         class Z : Y { public override int A { get { return 2; } } }
3090
3091         Would fail in Z because the parent (Y) would not have the property
3092         defined.  So we avoid this completely now (because the alternative
3093         fix was ugly and slow), and we now depend exclusively on the
3094         method names.
3095
3096         (PropertyBase.CheckBase): Use a method-base mechanism to find our
3097         reference method, instead of using the property.
3098
3099         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
3100         routines are gone now.
3101
3102         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
3103         names, they were incorrectly named.
3104
3105         * cs-tokenizer.cs: Return are more gentle token on failure. 
3106
3107         * pending.cs (PendingImplementation.InterfaceMethod): This routine
3108         had an out-of-sync index variable, which caused it to remove from
3109         the list of pending methods the wrong method sometimes.
3110
3111 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
3112
3113         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
3114         CanWrite, because those refer to this particular instance of the
3115         property, and do not take into account the fact that we can
3116         override single members of a property.
3117
3118         Constructor requires an EmitContext.  The resolution process does
3119         not happen here, but we need to compute the accessors before,
3120         because the resolution does not always happen for properties.
3121         
3122         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3123         subclass, before we did not update this flag, but we did update
3124         bindingflags. 
3125
3126         (GetAccessors): Drop this routine, as it did not work in the
3127         presence of partially overwritten set/get methods. 
3128
3129         Notice that this broke the cs1540 detection, but that will require
3130         more thinking. 
3131         
3132 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3133
3134         * class.cs:
3135         * codegen.cs:
3136         * driver.cs: issue a warning instead of an error if we don't support
3137         debugging for the platform. Also ignore a couple of errors that may
3138         arise when trying to write the symbols. Undo my previous patch.
3139
3140 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3141
3142         * driver.cs: ignore /debug switch except for Unix platforms.
3143
3144 2002-10-23  Nick Drochak  <ndrochak@gol.com>
3145
3146         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3147
3148 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
3149
3150         * driver.cs: Do not make mcs-debug conditional, so we do not break
3151         builds that use it.
3152
3153         * statement.cs (UsageVector.MergeChildren): I would like Martin to
3154         review this patch.  But basically after all the children variables
3155         have been merged, the value of "Breaks" was not being set to
3156         new_breaks for Switch blocks.  I think that it should be set after
3157         it has executed.  Currently I set this to the value of new_breaks,
3158         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3159         conservative, but I do not understand this code very well.
3160
3161         I did not break anything in the build, so that is good ;-)
3162
3163         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3164
3165 2002-10-20  Mark Crichton  <crichton@gimp.org>
3166
3167         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
3168
3169 2002-10-20  Nick Drochak  <ndrochak@gol.com>
3170
3171         * cfold.cs: Fixed compile blocker.
3172
3173 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
3174
3175         * driver.cs: I was chekcing the key, not the file.
3176
3177 2002-10-19  Ravi Pratap  <ravi@ximian.com>
3178
3179         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3180         message that we were generating - we just need to silently return
3181         a null.
3182
3183 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
3184
3185         * class.cs (Event.Define): Change my previous commit, as this
3186         breaks the debugger.  This is a temporary hack, as it seems like
3187         the compiler is generating events incorrectly to begin with.
3188
3189         * expression.cs (Binary.ResolveOperator): Added support for 
3190         "U operator - (E x, E y)"
3191
3192         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3193         y)".
3194
3195         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3196         init-only variables, but this path did not take into account that
3197         there might be also instance readonly variables.  Correct this
3198         problem. 
3199
3200         This fixes bug 32253
3201
3202         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3203         delegates as well.
3204
3205         * driver.cs: Change the extension for modules to `netmodule'
3206
3207         * cs-parser.jay: Improved slightly the location tracking for
3208         the debugger symbols.
3209
3210         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3211         modifiers that were specified instead of the hardcoded value
3212         (FamAndAssem).  This was basically ignoring the static modifier,
3213         and others.  Fixes 32429.
3214
3215         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3216         fixed a bug in the process (32476)
3217
3218         * expression.cs (ArrayAccess.EmitAssign): Patch from
3219         hwang_rob@yahoo.ca that fixes bug 31834.3
3220
3221 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
3222
3223         * driver.cs: Make the module extension .netmodule.
3224
3225 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
3226
3227         * driver.cs: Report an error if the resource file is not found
3228         instead of crashing.
3229
3230         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3231         false, like Emit does.
3232
3233 2002-10-16  Nick Drochak  <ndrochak@gol.com>
3234
3235         * typemanager.cs: Remove unused private member.  Also reported mcs
3236         bug to report this as a warning like csc.
3237
3238 2002-10-15  Martin Baulig  <martin@gnome.org>
3239
3240         * statement.cs (Statement.Emit): Made this a virtual method; emits
3241         the line number info and calls DoEmit().
3242         (Statement.DoEmit): New protected abstract method, formerly knows
3243         as Statement.Emit().
3244
3245         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3246
3247 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
3248
3249         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3250         have fixed a remaining problem: not every AddXXXX was adding a
3251         fully qualified name.  
3252
3253         Now everyone registers a fully qualified name in the DeclSpace as
3254         being defined instead of the partial name.  
3255
3256         Downsides: we are slower than we need to be due to the excess
3257         copies and the names being registered this way.  
3258
3259         The reason for this is that we currently depend (on the corlib
3260         bootstrap for instance) that types are fully qualified, because
3261         we dump all the types in the namespace, and we should really have
3262         types inserted into the proper namespace, so we can only store the
3263         basenames in the defined_names array.
3264
3265 2002-10-10  Martin Baulig  <martin@gnome.org>
3266
3267         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3268         from bug #31834, see the bug report for a testcase which is
3269         miscompiled.
3270
3271 2002-10-10  Martin Baulig  <martin@gnome.org>
3272
3273         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3274         flow analysis code for this.
3275
3276         * statement.cs (Do, While, For): Tell the flow analysis code about
3277         infinite loops.
3278         (FlowBranching.UsageVector): Added support for infinite loops.
3279         (Block.Resolve): Moved the dead code elimination here and use flow
3280         analysis to do it.
3281
3282 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
3283
3284         * class.cs (Field.Define): Catch cycles on struct type
3285         definitions. 
3286
3287         * typemanager.cs (IsUnmanagedtype): Do not recursively check
3288         fields if the fields are static.  We only need to check instance
3289         fields. 
3290
3291         * expression.cs (As.DoResolve): Test for reference type.
3292
3293         * statement.cs (Using.ResolveExpression): Use
3294         ConvertImplicitRequired, not ConvertImplicit which reports an
3295         error on failture
3296         (Using.ResolveLocalVariableDecls): ditto.
3297
3298         * expression.cs (Binary.ResolveOperator): Report errors in a few
3299         places where we had to.
3300
3301         * typemanager.cs (IsUnmanagedtype): Finish implementation.
3302
3303 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
3304
3305         * expression.cs: Use StoreFromPtr instead of extracting the type
3306         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
3307
3308         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3309         an enumeration value to a System.Enum, but System.Enum is not a
3310         value type, but an class type, so we need to box.
3311
3312         (Expression.ConvertExplicit): One codepath could return
3313         errors but not flag them.  Fix this.  Fixes #31853
3314
3315         * parameter.cs (Resolve): Do not allow void as a parameter type.
3316
3317 2002-10-06  Martin Baulig  <martin@gnome.org>
3318
3319         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3320         if it's a class type and not a struct.  Fixes #31815.
3321
3322 2002-10-06  Martin Baulig  <martin@gnome.org>
3323
3324         * statement.cs: Reworked the flow analysis code a bit to make it
3325         usable for dead code elimination.
3326
3327 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3328
3329         * cs-parser.jay: allow empty source files. Fixes bug #31781.
3330
3331 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3332
3333         * expression.cs (ComposedCast.DoResolveType): A quick workaround
3334         to fix the test 165, will investigate deeper.
3335
3336 2002-10-04  Martin Baulig  <martin@gnome.org>
3337
3338         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3339         finally blocks actually work.
3340         (Try.Resolve): We don't need to create a sibling for `finally' if
3341         there is no finally block.
3342
3343 2002-10-04  Martin Baulig  <martin@gnome.org>
3344
3345         * class.cs (Constructor.Define): The default accessibility for a
3346         non-default constructor is private, not public.
3347
3348 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3349
3350         * class.cs (Constructor): Make AllowedModifiers public, add
3351         EXTERN.
3352
3353         * cs-parser.jay: Perform the modifiers test here, as the
3354         constructor for the Constructor class usually receives a zero
3355         because of the way we create it (first we create, later we
3356         customize, and we were never checking the modifiers).
3357
3358         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3359         is a version of LookupTypeReflection that includes the type-name
3360         cache.  This can be used as a fast path for functions that know
3361         the fully qualified name and are only calling into *.GetType() to
3362         obtain a composed type.
3363
3364         This is also used by TypeManager.LookupType during its type
3365         composition.
3366
3367         (LookupType): We now also track the real type name, as sometimes
3368         we can get a quey for the real type name from things like
3369         ComposedCast.  This fixes bug 31422.
3370         
3371         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3372         complete type fullname, it does not have to go through the type
3373         resolution system to obtain the composed version of the type (for
3374         obtaining arrays or pointers).
3375         
3376         (Conditional.Emit): Use the EmitBoolExpression to
3377         generate nicer code, as requested by Paolo.
3378
3379         (ArrayCreation.CheckIndices): Use the patch from
3380         hwang_rob@yahoo.ca to validate the array initializers. 
3381
3382 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
3383
3384         * class.cs (ConstructorInitializer.Emit): simplify code by using
3385         Invocation.EmitCall, and at the same time, fix the bugs in calling
3386         parent constructors that took variable arguments. 
3387
3388         * ecore.cs (Expression.ConvertNumericExplicit,
3389         Expression.ImplicitNumericConversion): Remove the code that
3390         manually wrapped decimal (InternalTypeConstructor call is now gone
3391         as well).
3392
3393         * expression.cs (Cast.TryReduce): Also handle decimal types when
3394         trying to perform a constant fold on the type.
3395
3396         * typemanager.cs (IsUnmanagedtype): Partially implemented.
3397
3398         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3399         that only turned off an error report, and did nothing else. 
3400
3401 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
3402
3403         * driver.cs: Handle and ignore /fullpaths
3404
3405 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
3406
3407         * expression.cs (Binary.ResolveOperator): Catch the case where
3408         DoNumericPromotions returns true, 
3409
3410         (Binary.DoNumericPromotions): Simplify the code, and the tests.
3411
3412 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
3413
3414         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3415         report error 70.
3416
3417 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
3418
3419         * ecore.cs (ConvertNumericExplicit): It is not enough that the
3420         conversion exists, but it is also required that the conversion be
3421         performed.  This manifested in "(Type64Enum) 2".  
3422
3423         * class.cs (TypeManager.AddMethod): The fix is not to change
3424         AddEnum, because that one was using a fully qualified name (every
3425         DeclSpace derivative does), but to change the AddMethod routine
3426         that was using an un-namespaced name.  This now correctly reports
3427         the duplicated name.
3428
3429         Revert patch until I can properly fix it.  The issue
3430         is that we have a shared Type space across all namespaces
3431         currently, which is wrong.
3432
3433         Options include making the Namespace a DeclSpace, and merge
3434         current_namespace/current_container in the parser.
3435
3436 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
3437
3438         * cs-parser.jay: Improve error reporting when we get a different
3439         kind of expression in local_variable_type and
3440         local_variable_pointer_type. 
3441
3442         Propagate this to avoid missleading errors being reported.
3443
3444         * ecore.cs (ImplicitReferenceConversion): treat
3445         TypeManager.value_type as a target just like object_type.   As
3446         code like this:
3447
3448         ValueType v = 1;
3449
3450         Is valid, and needs to result in the int 1 being boxed before it
3451         is assigned to the value type v.
3452
3453         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3454         to validate the enumeration name.
3455
3456         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3457         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
3458         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3459
3460         * ecore.cs (TryImplicitIntConversion): When doing an
3461         implicit-enumeration-conversion, check if the type is 64-bits and
3462         perform a conversion before passing to EnumConstant.
3463
3464 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
3465
3466         * decl.cs (Error_AmbiguousTypeReference); New routine used to
3467         report ambiguous type references.  Unlike the MS version, we
3468         report what the ambiguity is.   Innovation at work ;-)
3469
3470         (DeclSpace.FindType): Require a location argument to
3471         display when we display an ambiguous error.
3472
3473         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3474
3475         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3476
3477         * expression.cs (EmitDynamicInitializers): Apply patch from
3478         hwang_rob@yahoo.ca that fixes the order in which we emit our
3479         initializers. 
3480
3481 2002-09-21  Martin Baulig  <martin@gnome.org>
3482
3483         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3484         delegate takes no arguments.
3485
3486 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
3487
3488         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3489         from integers.
3490
3491         * expression.cs: Extract the underlying type.
3492
3493         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3494
3495         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3496
3497 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
3498
3499         * class.cs (TypeContainer.DefineType): We can not use the nice
3500         PackingSize with the size set to 1 DefineType method, because it
3501         will not allow us to define the interfaces that the struct
3502         implements.
3503
3504         This completes the fixing of bug 27287
3505
3506         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3507         means also structs.  This fixes part of the problem. 
3508         (Expresion.ImplicitReferenceConversionExists): ditto.
3509
3510         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3511         error if there were no errors reported during the type lookup
3512         process, to avoid duplicates or redundant errors.  Without this
3513         you would get an ambiguous errors plus a type not found.  We have
3514         beaten the user enough with the first error.  
3515
3516         (DeclSparce.FindType): Emit a warning if we have an ambiguous
3517         reference. 
3518
3519         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3520         during the resolution process, stop the lookup, this avoids
3521         repeated error reports (same error twice).
3522
3523         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3524
3525         * typemanager.cs (LookupType): Redo the type lookup code to match
3526         the needs of System.Reflection.  
3527
3528         The issue is that System.Reflection requires references to nested
3529         types to begin with a "+" sign instead of a dot.  So toplevel
3530         types look like: "NameSpace.TopLevelClass", and nested ones look
3531         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3532         levels. 
3533
3534 2002-09-19  Martin Baulig  <martin@gnome.org>
3535
3536         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3537         says that a method always returns or always throws an exception,
3538         don't report the CS0161.
3539
3540         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3541         set `Returns = new_returns'.
3542
3543 2002-09-19  Martin Baulig  <martin@gnome.org>
3544
3545         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3546         to an enum constant, check for a CS0176.
3547
3548 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
3549
3550         * class.cs (TypeContainer.CheckPairedOperators): Now we check
3551         for operators that must be in pairs and report errors.
3552
3553         * ecore.cs (SimpleName.DoResolveType): During the initial type
3554         resolution process, when we define types recursively, we must
3555         check first for types in our current scope before we perform
3556         lookups in the enclosing scopes.
3557
3558         * expression.cs (MakeByteBlob): Handle Decimal blobs.
3559
3560         (Invocation.VerifyArgumentsCompat): Call
3561         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3562         I thought we were supposed to always call this, but there are a
3563         few places in the code where we dont do it.
3564
3565 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
3566
3567         * driver.cs: Add support in -linkres and -resource to specify the
3568         name of the identifier.
3569
3570 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3571
3572         * ecore.cs (StandardConversionExists): Sync with the conversion
3573         code: allow anything-* to void* conversions.
3574
3575         (FindMostSpecificSource): Use an Expression argument
3576         instead of a Type, because we might be handed over a Literal which
3577         gets a few more implicit conversions that plain types do not.  So
3578         this information was being lost.
3579
3580         Also, we drop the temporary type-holder expression when not
3581         required.
3582
3583 2002-09-17  Martin Baulig  <martin@gnome.org>
3584
3585         * class.cs (PropertyBase.CheckBase): Don't check the base class if
3586         this is an explicit interface implementation.
3587
3588 2002-09-17  Martin Baulig  <martin@gnome.org>
3589
3590         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3591         different `IndexerName' attributes.
3592
3593         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3594         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3595         virtual CommonResolve().
3596
3597 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3598
3599         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3600         and convert that to the UnderlyingType.
3601
3602         * statement.cs (Foreach.Resolve): Indexers are just like variables
3603         or PropertyAccesses.
3604
3605         * cs-tokenizer.cs (consume_string): Track line numbers and columns
3606         inside quoted strings, we were not doing this before.
3607
3608 2002-09-16  Martin Baulig  <martin@gnome.org>
3609
3610         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3611         resolve it.  This is needed for the definite assignment check of the
3612         instance expression, fixes bug #29846.
3613         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3614
3615 2002-09-16  Nick Drochak  <ndrochak@gol.com>
3616
3617         * parameter.cs: Fix compile error.  Cannot reference static member
3618         from an instance object.  Is this an mcs bug?
3619
3620 2002-09-14  Martin Baulig  <martin@gnome.org>
3621
3622         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3623         multiple times.  Fixes bug #30295, added test-166.cs.
3624
3625 2002-09-14  Martin Baulig  <martin@gnome.org>
3626
3627         * statement.cs (Block.Emit): Don't emit unreachable code.
3628         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3629         `break' statements.
3630         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3631
3632 2002-09-14  Martin Baulig  <martin@gnome.org>
3633
3634         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3635         is set.
3636
3637 2002-09-14  Martin Baulig  <martin@gnome.org>
3638
3639         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3640         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3641         be false on the ms runtime.
3642
3643 2002-09-13  Martin Baulig  <martin@gnome.org>
3644
3645         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3646         the CS0038 error message.
3647
3648 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
3649
3650         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3651         constant inside, return it.
3652
3653 2002-09-12  Martin Baulig  <martin@gnome.org>
3654
3655         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3656         implicit conversion can be done between enum types.
3657
3658         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3659         check whether an implicit conversion to the current enum's UnderlyingType
3660         exists and report an error if not.
3661
3662         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3663         without debugging support.
3664
3665         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3666         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
3667
3668 2002-09-12  Martin Baulig  <martin@gnome.org>
3669
3670         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3671
3672         * ecore.cs (IMemberExpr.DeclaringType): New property.
3673         (SimpleName.SimpleNameResolve): Check whether we're accessing a
3674         nonstatic member of an outer type (CS0038).
3675
3676 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
3677
3678         * driver.cs: Activate the using-error detector at warning level
3679         4 (at least for MS-compatible APIs).
3680
3681         * namespace.cs (VerifyUsing): Small buglett fix.
3682
3683         * pending.cs (PendingImplementation): pass the container pointer. 
3684
3685         * interface.cs (GetMethods): Allow for recursive definition.  Long
3686         term, I would like to move every type to support recursive
3687         definitions, not the current ordering mechanism that we have right
3688         now.
3689
3690         The situation is this: Attributes are handled before interfaces,
3691         so we can apply attributes to interfaces.  But some attributes
3692         implement interfaces, we will now handle the simple cases
3693         (recursive definitions will just get an error).  
3694
3695         * parameter.cs: Only invalidate types at the end if we fail to
3696         lookup all types.  
3697
3698 2002-09-09  Martin Baulig  <martin@gnome.org>
3699
3700         * ecore.cs (PropertyExpr.Emit): Also check for
3701         TypeManager.system_int_array_get_length so this'll also work when
3702         compiling corlib.  Fixes #30003.
3703
3704 2002-09-09  Martin Baulig  <martin@gnome.org>
3705
3706         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3707         and throw an exception if we can't get the type's size.  Fixed #30040,
3708         added test-165.cs.
3709
3710 2002-09-09  Martin Baulig  <martin@gnome.org>
3711
3712         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3713
3714         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3715         context.  Fixes bug #30027.
3716
3717         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3718         virtual functions.  Fixes bug #30043, added test-164.cs.
3719
3720 2002-09-08  Ravi Pratap  <ravi@ximian.com>
3721
3722         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3723
3724 2002-09-08  Nick Drochak  <ndrochak@gol.com>
3725
3726         * driver.cs: Use an object to get the windows codepage since it's not a
3727         static property.
3728
3729 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
3730
3731         * statement.cs (For.Emit): for infinite loops (test == null)
3732         return whether there is a break inside, not always "true".
3733
3734         * namespace.cs (UsingEntry): New struct to hold the name of the
3735         using definition, the location where it is defined, and whether it
3736         has been used in a successful type lookup.
3737         
3738         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3739         strings.
3740
3741         * decl.cs: ditto.
3742
3743 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3744
3745         * attribute.cs : Fix incorrect code which relied on catching
3746         a NullReferenceException to detect a null being passed in
3747         where an object was expected.
3748
3749 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
3750
3751         * statement.cs (Try): flag the catch variable as assigned
3752
3753         * expression.cs (Cast): Simplified by using ResolveType instead of
3754         manually resolving.
3755
3756         * statement.cs (Catch): Fix bug by using ResolveType.
3757
3758 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3759
3760         * expression.cs (BetterConversion): Special case for when we have
3761         a NullLiteral as the argument and we have to choose between string
3762         and object types - we choose string the way csc does.
3763
3764         * attribute.cs (Attribute.Resolve): Catch the
3765         NullReferenceException and report error #182 since the Mono
3766         runtime no more has the bug and having this exception raised means
3767         we tried to select a constructor which takes an object and is
3768         passed a null.
3769
3770 2002-09-05  Ravi Pratap  <ravi@ximian.com>
3771
3772         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3773         message (1502, 1503) when we can't locate a method after overload
3774         resolution. This is much more informative and closes the bug
3775         Miguel reported.
3776
3777         * interface.cs (PopulateMethod): Return if there are no argument
3778         types. Fixes a NullReferenceException bug.
3779
3780         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3781         expressions too. Previously we were checking only in one place for
3782         positional arguments leaving out named arguments.
3783
3784         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3785         type to the enum type is not allowed. Remove code corresponding to
3786         that.
3787
3788         (ConvertNumericExplicit): Allow explicit conversions from
3789         the underlying type to enum type. This precisely follows the spec
3790         and closes a bug filed by Gonzalo.
3791         
3792 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3793
3794         * compiler.csproj:
3795         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3796
3797 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
3798
3799         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3800         it was important that we stored the right value after the
3801         reduction in `converted'.
3802
3803 2002-09-04  Martin Baulig  <martin@gnome.org>
3804
3805         * location.cs (Location.SymbolDocument): Use full pathnames for the
3806         source files.
3807
3808 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
3809
3810         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3811         of the expression resolve mechanism, because that will catch the
3812         SimpleName error failures.
3813
3814         (Conditional): If we can not resolve the
3815         expression, return, do not crash.
3816
3817 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3818
3819         * cs-tokenizer.cs:
3820         (location): display token name instead of its number.
3821
3822 2002-08-28  Martin Baulig  <martin@gnome.org>
3823
3824         * expression.cs (Binary.ResolveOperator): Don't silently return
3825         but return an error if an operator cannot be applied between two
3826         enum types.
3827
3828 2002-08-28  Martin Baulig  <martin@gnome.org>
3829
3830         * class.cs (Constructor.Define): Set the permission attributes
3831         correctly instead of making all constructors public.
3832
3833 2002-08-28  Martin Baulig  <martin@gnome.org>
3834
3835         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3836         for private members before reporting a CS0103; if we find anything,
3837         it's a CS0122.
3838
3839 2002-08-28  Martin Baulig  <martin@gnome.org>
3840
3841         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3842         to check whether `closure_start_type == closure_invocation_type',
3843         we also need to check whether `m.DeclaringType == closure_invocation_type'
3844         before bypassing the permission checks.  We might be accessing
3845         protected/private members from the base class.
3846         (TypeManager.RealMemberLookup): Only set private_ok if private
3847         members were requested via BindingFlags.NonPublic.
3848
3849         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3850
3851         * expression.cs (MemberAccess.ResolveMemberAccess): Set
3852         MethodGroupExpr.IsExplicitImpl if appropriate.
3853         (Invocation.DoResolve): Don't report the CS0120 for explicit
3854         interface implementations.
3855
3856 2002-08-27  Martin Baulig  <martin@gnome.org>
3857
3858         * expression.cs (Invocation.DoResolve): If this is a static
3859         method and we don't have an InstanceExpression, we must report
3860         a CS0120.
3861
3862 2002-08-25  Martin Baulig  <martin@gnome.org>
3863
3864         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3865         `==' between a valuetype and an object.
3866
3867 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
3868
3869         * ecore.cs (TypeExpr): Provide a ToString method.
3870
3871 2002-08-24  Martin Baulig  <martin@gnome.org>
3872
3873         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3874         now called proggie.dbg and it's a binary file.
3875
3876 2002-08-23  Martin Baulig  <martin@gnome.org>
3877
3878         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3879
3880 2002-08-23  Martin Baulig  <martin@gnome.org>
3881
3882         * struct.cs (MyStructInfo.ctor): Make this work with empty
3883         structs; it's not allowed to use foreach() on null.
3884
3885 2002-08-23  Martin Baulig  <martin@gnome.org>
3886
3887         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
3888         writer the full pathname of the generated assembly.
3889
3890 2002-08-23  Martin Baulig  <martin@gnome.org>
3891
3892         * statements.cs (FlowBranching.UsageVector.MergeChildren):
3893         A `finally' block never returns or breaks; improved handling of
3894         unreachable code.
3895
3896 2002-08-23  Martin Baulig  <martin@gnome.org>
3897
3898         * statement.cs (Throw.Resolve): Allow `throw null'.
3899
3900 2002-08-23  Martin Baulig  <martin@gnome.org>
3901
3902         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
3903         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
3904         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
3905         MemberLookup would return a wrong event if this is an explicit
3906         interface implementation and the class has an event with the same
3907         name.
3908
3909 2002-08-23  Martin Baulig  <martin@gnome.org>
3910
3911         * statement.cs (Block.AddChildVariableNames): New public method.
3912         (Block.AddChildVariableName): Likewise.
3913         (Block.IsVariableNameUsedInChildBlock): Likewise.
3914         (Block.AddVariable): Check whether a variable name has already
3915         been used in a child block.
3916
3917         * cs-parser.jay (declare_local_variables): Mark all variable names
3918         from the current block as being used in a child block in the
3919         implicit block.
3920
3921 2002-08-23  Martin Baulig  <martin@gnome.org>
3922
3923         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
3924         find the symbol writer.
3925
3926         * driver.cs: csc also allows the arguments to /define being
3927         separated by commas, not only by semicolons.
3928
3929 2002-08-23  Martin Baulig  <martin@gnome.org>
3930
3931         * interface.cs (Interface.GetMembers): Added static check for events.
3932
3933 2002-08-15  Martin Baulig  <martin@gnome.org>
3934
3935         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
3936         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
3937
3938         * ecore.cs (Expression.MemberLookup): Added documentation and explained
3939         why the MethodData.EmitDestructor() change was necessary.
3940
3941 2002-08-20  Martin Baulig  <martin@gnome.org>
3942
3943         * class.cs (TypeContainer.FindMembers): Added static check for events.
3944
3945         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
3946
3947         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
3948         use Type.GetEvents(), not Type.FindMembers().
3949
3950 2002-08-20  Martin Baulig  <martin@gnome.org>
3951
3952         * decl.cs (MemberCache): Added a special method cache which will
3953         be used for method-only searched.  This ensures that a method
3954         search will return a MethodInfo with the correct ReflectedType for
3955         inherited methods.      
3956
3957 2002-08-20  Martin Baulig  <martin@gnome.org>
3958
3959         * decl.cs (DeclSpace.FindMembers): Made this public.
3960
3961 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3962
3963         * delegate.cs: fixed build on windows.
3964         [FIXME:  Filed as bug #29150: MCS must report these errors.]
3965
3966 2002-08-19  Ravi Pratap  <ravi@ximian.com>
3967
3968         * ecore.cs (StandardConversionExists): Return a false
3969         if we are trying to convert the void type to anything else
3970         since that is not allowed.
3971
3972         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
3973         we flag error 70 in the event an event is trying to be accessed
3974         directly from outside the declaring type.
3975
3976 2002-08-20  Martin Baulig  <martin@gnome.org>
3977
3978         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
3979         MemberCache from typemanager.cs to decl.cs.
3980
3981 2002-08-19  Martin Baulig  <martin@gnome.org>
3982
3983         * class.cs (TypeContainer): Implement IMemberContainer.
3984         (TypeContainer.DefineMembers): Create the MemberCache.
3985         (TypeContainer.FindMembers): Do better BindingFlags checking; only
3986         return public members if BindingFlags.Public was given, check
3987         whether members are static.
3988
3989 2002-08-16  Martin Baulig  <martin@gnome.org>
3990
3991         * decl.cs (DeclSpace.Define): Splitted this in Define and
3992         DefineMembers.  DefineMembers is called first and initializes the
3993         MemberCache.
3994
3995         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
3996         DefineMembers() on all our DeclSpaces.
3997
3998         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
3999         but call DefineMembers() on all nested interfaces.  We call their
4000         Define() in our new Define() function.
4001
4002         * interface.cs (Interface): Implement IMemberContainer.
4003         (Interface.Define): Moved all code except the attribute stuf to
4004         DefineMembers().
4005         (Interface.DefineMembers): Initialize the member cache.
4006
4007         * typemanager.cs (IMemberFinder): Removed this interface, we don't
4008         need this anymore since we can use MemberCache.FindMembers directly.
4009
4010 2002-08-19  Martin Baulig  <martin@gnome.org>
4011
4012         * typemanager.cs (MemberCache): When creating the cache for an
4013         interface type, add all inherited members.
4014         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4015         to `out bool used_cache' and documented it.
4016         (TypeManager.MemberLookup): If we already used the cache in the first
4017         iteration, we don't need to do the interfaces check.
4018
4019 2002-08-19  Martin Baulig  <martin@gnome.org>
4020
4021         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
4022         here from IMemberFinder and don't implement this interface anymore.
4023         (DeclSpace.MemberCache): Moved here from IMemberFinder.
4024
4025         * typemanager.cs (IMemberFinder): This interface is now only used by
4026         classes which actually support the member cache.
4027         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4028         since we only put DeclSpaces into this Hashtable.
4029         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4030         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4031
4032 2002-08-16  Martin Baulig  <martin@gnome.org>
4033
4034         * typemanager.cs (ICachingMemberFinder): Removed.
4035         (IMemberFinder.MemberCache): New property.
4036         (TypeManager.FindMembers): Merged this with RealFindMembers().
4037         This function will never be called from TypeManager.MemberLookup()
4038         so we can't use the cache here, just the IMemberFinder.
4039         (TypeManager.MemberLookup_FindMembers): Check whether the
4040         IMemberFinder has a MemberCache and call the cache's FindMembers
4041         function.
4042         (MemberCache): Rewrote larger parts of this yet another time and
4043         cleaned it up a bit.
4044
4045 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
4046
4047         * driver.cs (LoadArgs): Support quoting.
4048
4049         (Usage): Show the CSC-like command line arguments.
4050
4051         Improved a few error messages.
4052
4053 2002-08-15  Martin Baulig  <martin@gnome.org>
4054
4055         * typemanager.cs (IMemberContainer.Type): New property.
4056         (IMemberContainer.IsInterface): New property.
4057
4058         The following changes are conditional to BROKEN_RUNTIME, which is
4059         defined at the top of the file.
4060
4061         * typemanager.cs (MemberCache.MemberCache): Don't add the base
4062         class'es members, but add all members from TypeHandle.ObjectType
4063         if we're an interface.
4064         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4065         is the current type.
4066         (MemberCache.CacheEntry.Container): Removed this field.
4067         (TypeHandle.GetMembers): Include inherited members.
4068
4069 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4070
4071         * typemanager.cs: fixed compilation and added a comment on a field that
4072         is never used.
4073
4074 2002-08-15  Martin Baulig  <martin@gnome.org>
4075
4076         * class.cs (ConstructorInitializer.Resolve): In the
4077         Expression.MemberLookup call, use the queried_type as
4078         invocation_type.
4079
4080         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4081         declared' attribute, it's always true.
4082         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4083         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4084         temporary wrapper for FindMembers which tells MemberLookup whether
4085         members from the base classes are included in the return value.
4086         This will go away soon.
4087         (TypeManager.MemberLookup): Use this temporary hack here; once the
4088         new MemberCache is completed, we don't need to do the DeclaredOnly
4089         looping here anymore since the MemberCache will take care of this.
4090         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4091         (MemberCache): When creating the MemberCache for a class, get
4092         members from the current class and all its base classes.
4093         (MemberCache.CacheEntry.Container): New field.  This is a
4094         temporary hack until the Mono runtime is fixed to distinguish
4095         between ReflectedType and DeclaringType.  It allows us to use MCS
4096         with both the MS runtime and the unfixed Mono runtime without
4097         problems and without accecting performance.
4098         (MemberCache.SearchMembers): The DeclaredOnly looping from
4099         TypeManager.MemberLookup is now done here.      
4100
4101 2002-08-14  Martin Baulig  <martin@gnome.org>
4102
4103         * statement.cs (MyStructInfo.MyStructInfo): Don't call
4104         Type.GetFields on dynamic types but get the fields from the
4105         corresponding TypeContainer.
4106         (MyStructInfo.GetStructInfo): Added check for enum types.
4107
4108         * typemanager.cs (MemberList.IsSynchronized): Implemented.
4109         (MemberList.SyncRoot): Implemented.
4110         (TypeManager.FilterWithClosure): No need to check permissions if
4111         closure_start_type == closure_invocation_type, don't crash if
4112         closure_invocation_type is null.
4113
4114 2002-08-13  Martin Baulig  <martin@gnome.org>
4115
4116         Rewrote TypeContainer.FindMembers to use a member cache.  This
4117         gives us a speed increase of about 35% for the self-hosting MCS
4118         build and of about 15-20% for the class libs (both on GNU/Linux).
4119
4120         * report.cs (Timer): New class to get enhanced profiling.  This
4121         whole class is "TIMER" conditional since it remarkably slows down
4122         compilation speed.
4123
4124         * class.cs (MemberList): New class.  This is an IList wrapper
4125         which we're now using instead of passing MemberInfo[]'s around to
4126         avoid copying this array unnecessarily.
4127         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4128         (ICachingMemberFinder, IMemberContainer): New interface.
4129         (TypeManager.FilterWithClosure): If `criteria' is null, the name
4130         has already been checked, otherwise use it for the name comparision.
4131         (TypeManager.FindMembers): Renamed to RealMemberFinder and
4132         provided wrapper which tries to use ICachingMemberFinder.FindMembers
4133         if possible.  Returns a MemberList, not a MemberInfo [].
4134         (TypeHandle): New class, implements IMemberContainer.  We create
4135         one instance of this class per type, it contains a MemberCache
4136         which is used to do the member lookups.
4137         (MemberCache): New class.  Each instance of this class contains
4138         all members of a type and a name-based hash table.
4139         (MemberCache.FindMembers): This is our new member lookup
4140         function.  First, it looks up all members of the requested name in
4141         the hash table.  Then, it walks this list and sorts out all
4142         applicable members and returns them.
4143
4144 2002-08-13  Martin Baulig  <martin@gnome.org>
4145
4146         In addition to a nice code cleanup, this gives us a performance
4147         increase of about 1.4% on GNU/Linux - not much, but it's already
4148         half a second for the self-hosting MCS compilation.
4149
4150         * typemanager.cs (IMemberFinder): New interface.  It is used by
4151         TypeManager.FindMembers to call FindMembers on a TypeContainer,
4152         Enum, Delegate or Interface.
4153         (TypeManager.finder_to_member_finder): New PtrHashtable.
4154         (TypeManager.finder_to_container): Removed.
4155         (TypeManager.finder_to_delegate): Removed.
4156         (TypeManager.finder_to_interface): Removed.
4157         (TypeManager.finder_to_enum): Removed.
4158
4159         * interface.cs (Interface): Implement IMemberFinder.
4160
4161         * delegate.cs (Delegate): Implement IMemberFinder.
4162
4163         * enum.cs (Enum): Implement IMemberFinder.
4164
4165         * class.cs (TypeContainer): Implement IMemberFinder.
4166
4167 2002-08-12  Martin Baulig  <martin@gnome.org>
4168
4169         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4170
4171 2002-08-12  Martin Baulig  <martin@gnome.org>
4172
4173         * ecore.cs (ITypeExpression): New interface for expressions which
4174         resolve to a type.
4175         (TypeExpression): Renamed to TypeLookupExpression.
4176         (Expression.DoResolve): If we're doing a types-only lookup, the
4177         expression must implement the ITypeExpression interface and we
4178         call DoResolveType() on it.
4179         (SimpleName): Implement the new ITypeExpression interface.
4180         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4181         hack, the situation that we're only looking up types can't happen
4182         anymore when this method is called.  Moved the type lookup code to
4183         DoResolveType() and call it.
4184         (SimpleName.DoResolveType): This ITypeExpression interface method
4185         is now doing the types-only lookup.
4186         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4187         (ResolveFlags): Added MaskExprClass.
4188
4189         * expression.cs (MemberAccess): Implement the ITypeExpression
4190         interface.
4191         (MemberAccess.DoResolve): Added support for a types-only lookup
4192         when we're called via ITypeExpression.DoResolveType().
4193         (ComposedCast): Implement the ITypeExpression interface.
4194
4195         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
4196         Expression.Resolve() with ResolveFlags.Type instead.
4197
4198 2002-08-12  Martin Baulig  <martin@gnome.org>
4199
4200         * interface.cs (Interface.Define): Apply attributes.
4201
4202         * attribute.cs (Attribute.ApplyAttributes): Added support for
4203         interface attributes.
4204
4205 2002-08-11  Martin Baulig  <martin@gnome.org>
4206
4207         * statement.cs (Block.Emit): Only check the "this" variable if we
4208         do not always throw an exception.
4209
4210         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4211         whether the property has a set accessor.
4212
4213 2002-08-11  Martin Baulig  <martin@gnome.org>
4214
4215         Added control flow analysis support for structs.
4216
4217         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4218         with control flow analysis turned off.
4219         (IVariable): New interface.
4220         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4221         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4222         (FieldExpr.DoResolve): Resolve the instance expression with flow
4223         analysis turned off and do the definite assignment check after the
4224         resolving when we know what the expression will resolve to.
4225
4226         * expression.cs (LocalVariableReference, ParameterReference):
4227         Implement the new IVariable interface, only call the flow analysis
4228         code if ec.DoFlowAnalysis is true.
4229         (This): Added constructor which takes a Block argument.  Implement
4230         the new IVariable interface.
4231         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4232         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4233         This does the definite assignment checks for struct members.
4234
4235         * class.cs (Constructor.Emit): If this is a non-static `struct'
4236         constructor which doesn't have any initializer, call
4237         Block.AddThisVariable() to tell the flow analysis code that all
4238         struct elements must be initialized before control returns from
4239         the constructor.
4240
4241         * statement.cs (MyStructInfo): New public class.
4242         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4243         argument to this indexer.  If non-zero, check an individual struct
4244         member, not the whole struct.
4245         (FlowBranching.CheckOutParameters): Check struct members.
4246         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4247         overloaded versions of these methods which take an additional
4248         `int field_idx' argument to check struct members.
4249         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4250         overloaded versions of these methods which take an additional
4251         `string field_name' argument to check struct member.s
4252         (VariableInfo): Implement the IVariable interface.
4253         (VariableInfo.StructInfo): New public property.  Returns the
4254         MyStructInfo instance of the variable if it's a struct or null.
4255         (Block.AddThisVariable): New public method.  This is called from
4256         Constructor.Emit() for non-static `struct' constructor which do
4257         not have any initializer.  It creates a special variable for the
4258         "this" instance variable which will be checked by the flow
4259         analysis code to ensure that all of the struct's fields are
4260         initialized before control returns from the constructor.
4261         (UsageVector): Added support for struct members.  If a
4262         variable/parameter is a struct with N members, we reserve a slot
4263         in the usage vector for each member.  A struct is considered fully
4264         initialized if either the struct itself (slot 0) or all its
4265         members are initialized.
4266
4267 2002-08-08  Martin Baulig  <martin@gnome.org>
4268
4269         * driver.cs (Driver.MainDriver): Only report an error CS5001
4270         if there were no compilation errors.
4271
4272         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4273         `UnsafeContext' property to determine whether the parent is in
4274         unsafe context rather than checking the parent's ModFlags:
4275         classes nested in an unsafe class are unsafe as well.
4276
4277 2002-08-08  Martin Baulig  <martin@gnome.org>
4278
4279         * statement.cs (UsageVector.MergeChildren): Distinguish between
4280         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4281         we return.  Added test17() and test18() to test-154.cs.
4282
4283 2002-08-08  Martin Baulig  <martin@gnome.org>
4284
4285         * typemanager.cs (TypeManager.FilterWithClosure): If we have
4286         Family access, make sure the invoking type isn't a subclass of the
4287         queried type (that'd be a CS1540).
4288
4289         * ecore.cs (Expression.MemberLookup): Added overloaded version of
4290         this method which takes an additional `Type invocation_type'.
4291
4292         * expression.cs (BaseAccess.DoResolve): Use the base type as
4293         invocation and query type.
4294         (MemberAccess.DoResolve): If the lookup failed and we're about to
4295         report a CS0122, try a lookup with the ec.ContainerType - if this
4296         succeeds, we must report a CS1540.
4297
4298 2002-08-08  Martin Baulig  <martin@gnome.org>
4299
4300         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4301         (MethodGroupExpr): Implement the IMemberExpr interface.
4302
4303         * expression (MemberAccess.ResolveMemberAccess): No need to have
4304         any special code for MethodGroupExprs anymore, they're now
4305         IMemberExprs.   
4306
4307 2002-08-08  Martin Baulig  <martin@gnome.org>
4308
4309         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4310         Family, FamANDAssem and FamORAssem permissions.
4311         (TypeManager.IsSubclassOrNestedChildOf): New public method.
4312
4313 2002-08-08  Martin Baulig  <martin@gnome.org>
4314
4315         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4316         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4317         or loop block.
4318
4319 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4320
4321         * driver.cs: implemented /resource option to embed managed resources.
4322
4323 2002-08-07  Martin Baulig  <martin@gnome.org>
4324
4325         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4326         (FieldBase.HasFieldInitializer): New public property.
4327         (FieldBase.GetInitializerExpression): New public method.  Resolves and
4328         returns the field initializer and makes sure it is only resolved once.
4329         (TypeContainer.EmitFieldInitializers): Call
4330         FieldBase.GetInitializerExpression to get the initializer, this ensures
4331         that it isn't resolved multiple times.
4332
4333         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
4334         the resolving process (SimpleName/MemberLookup) that we're currently
4335         emitting a field initializer (which must not access any instance members,
4336         this is an error CS0236).
4337
4338         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4339         argument, if the `IsFieldInitializer' flag is set, we must report and
4340         error CS0236 and not an error CS0120.   
4341
4342 2002-08-07  Martin Baulig  <martin@gnome.org>
4343
4344         * ecore.cs (IMemberExpr): New public interface.
4345         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4346         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4347         if the expression is an IMemberExpr.
4348
4349         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4350         to be null, implicitly default to `this' if we're non-static in
4351         this case.  Simplified the code a lot by using the new IMemberExpr
4352         interface.  Also fixed bug #28176 here.
4353
4354 2002-08-06  Martin Baulig  <martin@gnome.org>
4355
4356         * cs-parser.jay (SimpleLookup): Removed.  We need to create
4357         ParameterReferences during semantic analysis so that we can do a
4358         type-only search when resolving Cast, TypeOf and SizeOf.
4359         (block): Pass the `current_local_parameters' to the Block's
4360         constructor.
4361
4362         * class.cs (ConstructorInitializer): Added `Parameters parameters'
4363         argument to the constructor.
4364         (ConstructorInitializer.Resolve): Create a temporary implicit
4365         block with the parameters.
4366
4367         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4368         references here if we aren't doing a type-only search.
4369
4370         * statement.cs (Block): Added constructor which takes a
4371         `Parameters parameters' argument.
4372         (Block.Parameters): New public property.
4373
4374         * support.cs (InternalParameters.Parameters): Renamed `parameters'
4375         to `Parameters' and made it public readonly.
4376
4377 2002-08-06  Martin Baulig  <martin@gnome.org>
4378
4379         * ecore.cs (Expression.Warning): Made this public as well.
4380
4381         * report.cs (Report.Debug): Print the contents of collections.
4382
4383 2002-08-06  Martin Baulig  <martin@gnome.org>
4384
4385         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
4386         used to tell Resolve() which kinds of expressions it may return.
4387         (Expression.Resolve): Added overloaded version of this method which
4388         takes a `ResolveFlags flags' argument.  This can be used to tell
4389         Resolve() which kinds of expressions it may return.  Reports a
4390         CS0118 on error.
4391         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4392         ResolveFlags.SimpleName.
4393         (Expression.Error118): Added overloaded version of this method which
4394         takes a `ResolveFlags flags' argument.  It uses the flags to determine
4395         which kinds of expressions are allowed.
4396
4397         * expression.cs (Argument.ResolveMethodGroup): New public method.
4398         Resolves an argument, but allows a MethodGroup to be returned.
4399         This is used when invoking a delegate.
4400
4401         * TODO: Updated a bit.
4402
4403 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4404
4405         Fixed compilation with csc.
4406
4407         * ecore.cs: Expression.Error made public. Is this correct? Should
4408         Warning be made public too?
4409
4410         * expression.cs: use ea.Location instead of ea.loc.
4411         [FIXME:  Filed as bug #28607: MCS must report these errors.]
4412
4413 2002-08-06  Martin Baulig  <martin@gnome.org>
4414
4415         * ecore.cs (Expression.loc): Moved the location here instead of
4416         duplicating it in all derived classes.
4417         (Expression.Location): New public property.
4418         (Expression.Error, Expression.Warning): Made them non-static and
4419         removed the location argument.
4420         (Expression.Warning): Added overloaded version which takes an
4421         `int level' argument.
4422         (Expression.Error118): Make this non-static and removed the
4423         expression and location arguments.
4424         (TypeExpr): Added location argument to the constructor.
4425
4426         * expression.cs (StaticCallExpr): Added location argument to
4427         the constructor.
4428         (Indirection, PointerArithmetic): Likewise.
4429         (CheckedExpr, UnCheckedExpr): Likewise.
4430         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4431         (StringPtr): Likewise.
4432
4433
4434 2002-08-05  Martin Baulig  <martin@gnome.org>
4435
4436         * expression.cs (BaseAccess.DoResolve): Actually report errors.
4437
4438         * assign.cs (Assign.DoResolve): Check whether the source
4439         expression is a value or variable.
4440
4441         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4442         while resolving the corresponding blocks.
4443
4444         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4445         an error, don't silently return null.
4446
4447         * statement.cs (Block.AddVariable): Do the error reporting here
4448         and distinguish between CS0128 and CS0136.
4449         (Block.DoResolve): Report all unused labels (warning CS0164).
4450         (LabeledStatement): Pass the location to the constructor.
4451         (LabeledStatement.HasBeenReferenced): New property.
4452         (LabeledStatement.Resolve): Set it to true here.
4453
4454         * statement.cs (Return.Emit): Return success even after reporting
4455         a type mismatch error (CS0126 or CS0127), this is what csc does and
4456         it avoids confusing the users with any consecutive errors.
4457
4458 2002-08-05  Martin Baulig  <martin@gnome.org>
4459
4460         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4461
4462         * const.cs (Const.LookupConstantValue): Catch circular definitions.
4463
4464         * expression.cs (MemberAccess.DoResolve): Silently return if an
4465         error has already been reported.
4466
4467         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4468         error has already been reported.
4469
4470 2002-08-05  Martin Baulig  <martin@gnome.org>
4471
4472         * statement.cs (UsageVector): Only initialize the `parameters'
4473         vector if we actually have any "out" parameters.
4474
4475 2002-08-05  Martin Baulig  <martin@gnome.org>
4476
4477         * expression.cs (Binary.ResolveOperator): When combining delegates,
4478         they must have the same type.
4479
4480 2002-08-05  Martin Baulig  <martin@gnome.org>
4481
4482         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4483         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4484         work with the ms runtime and we also don't need it: if we're a
4485         PropertyBuilder and not in the `indexer_arguments' hash, then we
4486         are a property and not an indexer.
4487
4488         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4489         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4490         since the latter one doesn't work with the ms runtime.
4491
4492 2002-08-03  Martin Baulig  <martin@gnome.org>
4493
4494         Fixed bugs #27998 and #22735.
4495
4496         * class.cs (Method.IsOperator): New public field.
4497         (Method.CheckBase): Report CS0111 if there's already a method
4498         with the same parameters in the current class.  Report CS0508 when
4499         attempting to change the return type of an inherited method.
4500         (MethodData.Emit): Report CS0179 if a method doesn't have a body
4501         and it's not marked abstract or extern.
4502         (PropertyBase): New abstract base class for Property and Indexer.
4503         (PropertyBase.CheckBase): Moved here from Property and made it work
4504         for indexers.
4505         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4506         the same so we can reuse it there.
4507         (Property, Indexer): Derive from PropertyBase.
4508         (MethodSignature.inheritable_property_signature_filter): New delegate
4509         to find properties and indexers.
4510
4511         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4512         argument and improved error reporting.
4513
4514         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4515         EmptyReadOnlyParameters and made it a property.
4516
4517         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4518         version of this method which takes a `PropertyInfo indexer'.
4519         (TypeManager.RegisterIndexer): New method.
4520
4521         * class.cs: Added myself as author of this file :-)
4522
4523 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4524
4525         * class.cs: fixed compilation on windoze.
4526
4527 2002-08-03  Martin Baulig  <martin@gnome.org>
4528
4529         * interface.cs (Interface.GetInterfaceBases): Check whether all
4530         base interfaces are at least as accessible than the current one.
4531
4532         * class.cs (TypeContainer.GetClassBases): Check whether base types
4533         are at least as accessible than the current type.
4534         (TypeContainer.AsAccessible): Implemented and made non-static.
4535         (MemberBase.CheckParameters): Report errors if the accessibility
4536         checks fail.
4537
4538         * delegate.cs (Delegate.Delegate): The default visibility is
4539         internal for top-level types and private for nested types.
4540         (Delegate.Define): Report errors if the accessibility checks fail.
4541
4542         * enum.cs (Enum.Enum): The default visibility is internal for
4543         top-level types and private for nested types.
4544         (Enum.DefineType): Compute the correct visibility.
4545
4546         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4547         function which takes a `bool is_toplevel' instead of a TypeContainer.
4548
4549         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4550         builtin type.
4551
4552 2002-08-02  Martin Baulig  <martin@gnome.org>
4553
4554         * expression.cs (LocalVariableReferenc): Added constructor which
4555         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4556         (LocalVariableReference.IsReadOnly): New property.
4557         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4558         variable is readonly, use our own readonly flag to do this; you can
4559         use the new constructor to get a writable reference to a read-only
4560         variable.
4561
4562         * cs-parser.jay (foreach_statement, using_statement): Get a writable
4563         reference to the local variable.
4564
4565 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
4566
4567         * rootcontext.cs (ResolveCore): Also include System.Exception
4568
4569         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4570         we reach an EmptyStatement.
4571
4572         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4573         is also fine.
4574
4575         * expression.cs (Binary.ResolveOperator): Check error result in
4576         two places.
4577
4578         use brtrue/brfalse directly and avoid compares to null.
4579
4580 2002-08-02  Martin Baulig  <martin@gnome.org>
4581
4582         * class.cs (TypeContainer.Define): Define all nested interfaces here.
4583         Fixes bug #28407, added test-155.cs.
4584
4585 2002-08-01  Martin Baulig  <martin@gnome.org>
4586
4587         * class.cs (Event.EmitDefaultMethod): Make this work with static
4588         events.  Fixes #28311, added verify-3.cs.
4589
4590 2002-08-01  Martin Baulig  <martin@gnome.org>
4591
4592         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4593         `is_disposable' fields.
4594         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4595         `hm.is_disposable' if we're using the collection pattern.
4596         (Foreach.EmitCollectionForeach): Use the correct type for the
4597         enumerator's local variable, only emit the try/finally block if
4598         necessary (fixes #27713).
4599
4600 2002-08-01  Martin Baulig  <martin@gnome.org>
4601
4602         * ecore.cs (Expression.report118): Renamed to Error118 and made
4603         it public static.
4604
4605         * statement.cs (Throw.Resolve): Check whether the expression is of
4606         the correct type (CS0118) and whether the type derives from
4607         System.Exception (CS0155).
4608         (Catch.Resolve): New method.  Do the type lookup here and check
4609         whether it derives from System.Exception (CS0155).
4610         (Catch.CatchType, Catch.IsGeneral): New public properties.
4611
4612         * typemanager.cs (TypeManager.exception_type): Added.
4613
4614 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
4615
4616         * driver.cs: Updated About function.
4617
4618 2002-07-31  Martin Baulig  <martin@gnome.org>
4619
4620         Implemented Control Flow Analysis.
4621
4622         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4623         (EmitContext.CurrentBranching): Added.
4624         (EmitContext.StartFlowBranching): Added.
4625         (EmitContext.EndFlowBranching): Added.
4626         (EmitContext.KillFlowBranching): Added.
4627         (EmitContext.IsVariableAssigned): Added.
4628         (EmitContext.SetVariableAssigned): Added.
4629         (EmitContext.IsParameterAssigned): Added.
4630         (EmitContext.SetParameterAssigned): Added.
4631         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4632         Added control flow analysis stuff here.
4633
4634         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4635         resolve the expression as lvalue.
4636         (LocalVariableReference.DoResolve): Check whether the variable has
4637         already been assigned.
4638         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4639         the parameter as assigned here.
4640         (ParameterReference.DoResolve): Check whether the parameter has already
4641         been assigned.
4642         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4643         expression as lvalue.
4644
4645         * statement.cs (FlowBranching): New class for the flow analysis code.
4646         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4647         (LabeledStatement.IsDefined): New public property.
4648         (LabeledStatement.AddUsageVector): New public method to tell flow
4649         analyis that the label may be reached via a forward jump.
4650         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4651         flow analysis.
4652         (VariableInfo.Number): New public field.  This is used by flow analysis
4653         to number all locals of a block.
4654         (Block.CountVariables): New public property.  This is the number of
4655         local variables in this block (including the locals from all parent
4656         blocks).
4657         (Block.EmitMeta): Number all the variables.
4658
4659         * statement.cs: Added flow analysis support to all classes.
4660
4661 2002-07-31  Martin Baulig  <martin@gnome.org>
4662
4663         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4664         To get debugging messages, compile mcs with /define:MCS_DEBUG and
4665         then use this argument.
4666
4667         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4668
4669         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4670         use this to specify /define options.
4671
4672 2002-07-29  Martin Baulig  <martin@gnome.org>
4673
4674         * statement.cs (Fixed): Moved all code that does variable lookups
4675         and resolvings from Emit to Resolve.
4676
4677         * statement.cs (For): Moved all code that does variable lookups
4678         and resolvings from Emit to Resolve.
4679
4680         * statement.cs (Using): Moved all code that does variable lookups
4681         and resolvings from Emit to Resolve.
4682
4683 2002-07-29  Martin Baulig  <martin@gnome.org>
4684
4685         * attribute.cs (Attribute.Resolve): Explicitly catch a
4686         System.NullReferenceException when creating the
4687         CustromAttributeBuilder and report a different warning message.
4688
4689 2002-07-29  Martin Baulig  <martin@gnome.org>
4690
4691         * support.cs (ParameterData.ParameterName): Added method to
4692         get the name of a parameter.
4693
4694         * typemanager.cs (TypeManager.IsValueType): New public method.
4695
4696 2002-07-29  Martin Baulig  <martin@gnome.org>
4697
4698         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
4699         is a flag which specifies that it's either ref or out.
4700         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4701         the out parameter to `out Parameter.Modifier mod', also set the
4702         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4703
4704         * support.cs (InternalParameters.ParameterModifier): Distinguish
4705         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4706         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4707
4708         * expression.cs (Argument.GetParameterModifier): Distinguish
4709         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4710         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4711
4712 2002-07-29  Martin Baulig  <martin@gnome.org>
4713
4714         * expression.cs (ParameterReference.ParameterReference): Added
4715         `Location loc' argument to the constructor.
4716
4717         * cs-parser.jay: Pass location to ParameterReference.
4718
4719 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
4720
4721         * statement.cs (Try): Initialize the location.
4722
4723         * cs-parser.jay: pass location to Try.
4724
4725         * expression.cs (Unary.Reduce): Change the prototype to return
4726         whether a constant fold could be performed or not.  The result is
4727         returned in an out parameters.  In the case of Indirection and
4728         AddressOf, we want to perform the full tests.
4729
4730 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
4731
4732         * statement.cs (Statement.Emit): Flag dead code.
4733
4734 2002-07-27  Andrew Birkett  <andy@nobugs.org>
4735
4736         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4737
4738 2002-07-27  Martin Baulig  <martin@gnome.org>
4739
4740         * class.cs (MethodData.Define): Put back call to
4741         TypeManager.AddMethod(), accidentally commented this out.
4742
4743         * report.cs (Debug): New public method to print debugging information,
4744         this is `[Conditional ("DEBUG")]'.
4745
4746 2002-07-26  Martin Baulig  <martin@gnome.org>
4747
4748         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4749         (switch_statement): Push the current_block to the switch_stack and
4750         pop it again when we're done with the switch.
4751         (switch_section): The new block is a child of the current_block.
4752         Fixes bug #24007, added test-152.cs.
4753
4754 2002-07-27  Martin Baulig  <martin@gnome.org>
4755
4756         * expression.cs (Invocation.EmitArguments): When calling a varargs
4757         function with only its fixed arguments, we need to pass an empty
4758         array.
4759
4760 2002-07-27  Martin Baulig  <martin@gnome.org>
4761
4762         Mono 0.13 has been released.
4763
4764 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
4765
4766         * driver.cs: Rename --resource to --linkres, because that is what
4767         we do currently, we dont support --resource yet.
4768
4769         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4770
4771 2002-07-25  Martin Baulig  <martin@gnome.org>
4772
4773         * class.cs (MethodData): New public class.  This is a `method builder'
4774         class for a method or one accessor of a Property/Indexer/Event.
4775         (MethodData.GetMethodFlags): Moved here from MemberBase.
4776         (MethodData.ApplyAttributes): Likewise.
4777         (MethodData.ApplyObsoleteAttribute): Likewise.
4778         (MethodData.ApplyConditionalAttribute): Likewise.
4779         (MethodData.ApplyDllImportAttribute): Likewise.
4780         (MethodData.CheckAbstractAndExternal): Likewise.
4781         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4782         (MethodData.Emit): Formerly known as Method.Emit().
4783         (MemberBase): Moved everything which was specific to a single
4784         accessor/method to MethodData.
4785         (Method): Create a new MethodData and call Define() and Emit() on it.
4786         (Property, Indexer, Event): Create a new MethodData objects for each
4787         accessor and call Define() and Emit() on them.
4788
4789 2002-07-25  Martin Baulig  <martin@gnome.org>
4790
4791         Made MethodCore derive from MemberBase to reuse the code from there.
4792         MemberBase now also checks for attributes.
4793
4794         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4795         (MemberBase.GetMethodFlags): Moved here from class Method and marked
4796         as virtual.
4797         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4798         `CallingConventions cc' and `Attributes opt_attrs' arguments.
4799         (MemberBase.ApplyAttributes): New virtual method; applies the
4800         attributes to a method or accessor.
4801         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4802         (MemberBase.ApplyConditionalAttribute): Likewise.
4803         (MemberBase.ApplyDllImportAttribute): Likewise.
4804         (MemberBase.CheckAbstractAndExternal): Likewise.
4805         (MethodCore.ParameterTypes): This is now a property instead of a
4806         method, it's initialized from DoDefineParameters().
4807         (MethodCore.ParameterInfo): Removed the set accessor.
4808         (MethodCore.DoDefineParameters): New protected virtual method to
4809         initialize ParameterTypes and ParameterInfo.
4810         (Method.GetReturnType): We can now simply return the MemberType.
4811         (Method.GetMethodFlags): Override the MemberBase version and add
4812         the conditional flags.
4813         (Method.CheckBase): Moved some code from Define() here, call
4814         DoDefineParameters() here.
4815         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4816         here to avoid some larger code duplication.
4817         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4818         ensure that abstract and external accessors don't declare a body.
4819
4820         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4821         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4822         lookup in the attribute's parent classes, so we need to abort as soon
4823         as we found the first match.
4824         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4825         the attribute has no arguments.
4826
4827         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4828         of a Method.
4829
4830 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4831
4832         * cs-parser.jay: reverted previous patch.
4833
4834 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4835
4836         * cs-parser.jay: fixed bug #22119.
4837
4838 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4839
4840         * attribute.cs: fixed compilation. The error was:
4841         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
4842         be assigned to before control leaves the current method."
4843         [FIXME:  Filed as bug #28186: MCS must report this error.]
4844
4845 2002-07-25  Martin Baulig  <martin@gnome.org>
4846
4847         * attribute.cs (Attribute.Conditional_GetConditionName): New static
4848         method to pull the condition name ouf of a Conditional attribute.
4849         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4850         the obsolete message and error flag out of an Obsolete attribute.
4851
4852         * class.cs (Method.GetMethodFlags): New public method to get the
4853         TypeManager.MethodFlags for this method.
4854         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4855         private methods.
4856         (Method.Define): Get and apply the Obsolete and Conditional attributes;
4857         if we're overriding a virtual function, set the new private variable
4858         `parent_method'; call the new TypeManager.AddMethod().
4859
4860         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
4861         the MethodBuilder and the Method in a PtrHashtable.
4862         (TypeManager.builder_to_method): Added for this purpose.
4863         (TypeManager.MethodFlags): Added IsObsoleteError.
4864         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
4865         Obsolete and Conditional arguments in MethodBuilders.  If we discover
4866         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4867         the message from the attribute.
4868
4869 2002-07-24  Martin Baulig  <martin@gnome.org>
4870
4871         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4872         preprocessor directives, ensure that the argument to #define/#undef is
4873         exactly one identifier and that it's actually an identifier.
4874
4875         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4876         did not work ....
4877
4878 2002-07-24  Martin Baulig  <martin@gnome.org>
4879
4880         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4881         initialize it to TypeManager.object_type in the constructor.
4882         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4883         of the `hm.get_current' method if we're using the collection pattern.
4884         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
4885         for the explicit conversion to make it work when we're using the collection
4886         pattern and the `Current' property has a different return type than `object'.
4887         Fixes #27713.
4888
4889 2002-07-24  Martin Baulig  <martin@gnome.org>
4890
4891         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
4892         does not match, but don't report any errors.  This method is called in
4893         order for all methods in a MethodGroupExpr until a matching method is
4894         found, so we don't want to bail out if the first method doesn't match.
4895         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
4896         matches, report the 123.  Fixes #28070.
4897
4898 2002-07-24  Martin Baulig  <martin@gnome.org>
4899
4900         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
4901         TypeManager.TypeToCoreType() to the top of the method so the
4902         following equality checks will work.  Fixes #28107.
4903
4904 2002-07-24  Martin Baulig  <martin@gnome.org>
4905
4906         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
4907         operand is of type uint, and the other operand is of type sbyte,
4908         short or int, the operands are converted to type long." -
4909         Actually do what this comment already told us.  Fixes bug #28106,
4910         added test-150.cs.
4911
4912 2002-07-24  Martin Baulig  <martin@gnome.org>
4913
4914         * class.cs (MethodBase): New abstract class.  This is now a base
4915         class for Property, Indexer and Event to avoid some code duplication
4916         in their Define() and DefineMethods() methods.
4917         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
4918         generic methods for Define() and DefineMethods().
4919         (FieldBase): Derive from MemberBase, not MemberCore.
4920         (Property): Derive from MemberBase, not MemberCore.
4921         (Property.DefineMethod): Moved all the code from this method to the
4922         new MethodBase.DefineAccessor(), just call it with appropriate
4923         argumetnts.
4924         (Property.Define): Call the new Property.DoDefine(), this does some
4925         sanity checks and we don't need to duplicate the code everywhere.
4926         (Event): Derive from MemberBase, not MemberCore.
4927         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
4928         accessors, this will also make them work with interface events.
4929         (Indexer): Derive from MemberBase, not MemberCore.
4930         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
4931         (Indexer.Define): Use the new MethodBase functions.
4932
4933         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
4934         argument to the constructor.
4935         (Interface.FindMembers): Added support for interface events.
4936         (Interface.PopluateEvent): Implemented.
4937
4938         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
4939
4940 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
4941
4942         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
4943         but this is required to check for a method name being the same as
4944         the containing class.  
4945
4946         Handle this now.
4947
4948 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4949
4950         * interface.cs: initialize variable.
4951
4952 2002-07-23  Martin Baulig  <martin@gnome.org>
4953
4954         Implemented the IndexerName attribute in interfaces.
4955
4956         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
4957         name if this is an explicit interface implementation.
4958         (Indexer.InterfaceIndexerName): New public variable.  If we're
4959         implementing an interface indexer, this is the IndexerName in that
4960         interface.  Otherwise, it's the IndexerName.
4961         (Indexer.DefineMethod): If we're implementing interface indexer,
4962         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
4963         and Pending.ImplementIndexer methods.
4964         (Indexer.Define): Also define the PropertyBuilder if we're
4965         implementing an interface indexer and this is neither an explicit
4966         interface implementation nor do the IndexerName match the one in
4967         the interface.
4968
4969         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
4970         If a method is defined here, then we always need to create a proxy
4971         for it.  This is used when implementing interface indexers.
4972         (Pending.IsInterfaceIndexer): New public method.
4973         (Pending.ImplementIndexer): New public method.
4974         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
4975         This is used when implementing interface indexers to define a proxy
4976         if necessary.
4977         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
4978         define a proxy if necessary.
4979
4980         * interface.cs (Interface.IndexerName): New public variable.
4981         (Interface.PopulateIndexer): Set the IndexerName.
4982         (Interface.DefineIndexers): New private method.  Populate all the
4983         indexers and make sure their IndexerNames match.
4984
4985         * typemanager.cs (IndexerPropertyName): Added support for interface
4986         indexers.
4987
4988 2002-07-22  Martin Baulig  <martin@gnome.org>
4989
4990         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
4991         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
4992         ret if HasReturnLabel.
4993         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
4994         variables.
4995
4996         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
4997         and set the ec.LoopBeginTryCatchLevel.
4998         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
4999         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5000         the current ec.TryCatchLevel, the branch goes out of an exception
5001         block.  In this case, we need to use Leave and not Br.
5002
5003 2002-07-22  Martin Baulig  <martin@gnome.org>
5004
5005         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5006         block unless the block does not always return or it is contained in
5007         another try { ... } catch { ... } block.  Fixes bug #26506.
5008         Added verify-1.cs to the test suite.
5009
5010 2002-07-22  Martin Baulig  <martin@gnome.org>
5011
5012         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5013         then we do not always return.  Fixes bug #24985.
5014
5015 2002-07-22  Martin Baulig  <martin@gnome.org>
5016
5017         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5018         lookup on a per-class level; ie. walk up the class hierarchy until we
5019         found at least one applicable method, then choose the best among them.
5020         Fixes bug #24463 and test-29.cs.
5021
5022 2002-07-22  Martin Baulig  <martin@gnome.org>
5023
5024         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5025         return types of the methods.  The return type is not part of the
5026         signature and we must not check it to make the `new' modifier work.
5027         Fixes bug #27999, also added test-147.cs.
5028         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5029
5030         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5031         on the method's return type.
5032
5033 2002-07-21  Martin Baulig  <martin@gnome.org>
5034
5035         * assign.cs: Make this work if the rightmost source is a constant and
5036         we need to do an implicit type conversion.  Also adding a few more tests
5037         to test-38.cs which should have caught this.
5038
5039         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5040         target in the makefile for this.  The makefile.gnu is primarily intended
5041         for end-users who don't want to debug the compiler.
5042
5043 2002-07-21  Martin Baulig  <martin@gnome.org>
5044
5045         * assign.cs: Improved the Assign class so it can now handle embedded
5046         assignments (X = Y = Z = something).  As a side-effect this'll now also
5047         consume less local variables.  test-38.cs now passes with MCS, added
5048         a few new test cases to that test.
5049
5050 2002-07-20  Martin Baulig  <martin@gnome.org>
5051
5052         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5053         instructions.  Fixes bug #27977, also added test-146.cs.
5054
5055 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5056
5057         * cs-tokenizer.cs: fixed getHex ().
5058
5059 2002-07-19  Martin Baulig  <martin@gnome.org>
5060
5061         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5062         not Type.GetType() to lookup the array type.  This is needed when
5063         we're constructing an array of a user-defined type.
5064         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5065         single-dimensional arrays, but also for single-dimensial arrays of
5066         type decimal.
5067
5068 2002-07-19  Martin Baulig  <martin@gnome.org>
5069
5070         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5071         this function is called, it's not allowed to share LocalBuilders
5072         among ILGenerators.
5073
5074 2002-07-19  Martin Baulig  <martin@gnome.org>
5075
5076         * expression.cs (Argument.Resolve): Report an error 118 when trying
5077         to pass a type as argument.
5078
5079 2002-07-18  Martin Baulig  <martin@gnome.org>
5080
5081         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5082         Conv_R_Un for the signed `long' type.
5083
5084 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
5085
5086         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5087         `expr' for the temporary result, as that will fail if we do
5088         multiple resolves on the same expression.
5089
5090 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
5091
5092         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
5093         ec.TypeContainer for looking up aliases. 
5094
5095         * class.cs (TypeContainer): Remove LookupAlias from here.
5096
5097         * decl.cs (DeclSpace); Move here.
5098
5099 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
5100
5101         * class.cs (FindMembers): Only call filter if the constructor
5102         bulider is not null.
5103
5104         Also handle delegates in `NestedTypes' now.  Now we will perform
5105         type lookups using the standard resolution process.  This also
5106         fixes a bug.
5107
5108         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
5109         This uses Expressions (the limited kind that can be parsed by the
5110         tree) instead of strings.
5111
5112         * expression.cs (ComposedCast.ToString): Implement, used to flag
5113         errors since now we have to render expressions.
5114
5115         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
5116         FormArrayType. 
5117
5118         * ecore.cs (SimpleName.ToString): ditto.
5119
5120         * cs-parser.jay: Instead of using strings to assemble types, use
5121         Expressions to assemble the type (using SimpleName, ComposedCast,
5122         MemberAccess).  This should fix the type lookups in declarations,
5123         because we were using a different code path for this.
5124
5125         * statement.cs (Block.Resolve): Continue processing statements
5126         even when there is an error.
5127
5128 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
5129
5130         * class.cs (Event.Define): Also remove the `remove' method from
5131         the list of pending items.
5132
5133         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5134         generate more compact code. 
5135
5136 2002-07-17  Martin Baulig  <martin@gnome.org>
5137
5138         * const.cs (Const.LookupConstantValue): Add support for constant
5139         `unchecked' and `checked' expressions.
5140         Also adding test case test-140.cs for this.
5141
5142 2002-07-17  Martin Baulig  <martin@gnome.org>
5143
5144         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5145         check whether mi.ReturnType implements the IEnumerator interface; the
5146         `==' and the IsAssignableFrom() will fail in this situation.
5147
5148 2002-07-16  Ravi Pratap  <ravi@ximian.com>
5149
5150         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
5151         here too.
5152
5153 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5154
5155         * expression.cs: fixed bug #27811.
5156
5157 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
5158
5159         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5160         Molaro: when we are a ref, the value already contains a pointer
5161         value, do not take the address of it.
5162
5163 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5164         * removed mb-parser.jay and mb-tokenizer.cs
5165
5166 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5167
5168         * expression.cs: check against the building corlib void type.
5169
5170 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5171
5172         * ecore.cs: fix for valuetype static readonly fields: when 
5173         initializing them, we need their address, not the address of a copy.
5174
5175 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5176
5177         * typemanager.cs: register also enum_type in corlib.
5178
5179 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5180
5181         * class.cs: allow calling this (but not base) initializers in structs.
5182
5183 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5184
5185         * ecore.cs: make sure we compare against the building base types
5186         in GetTypeSize ().
5187
5188 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5189
5190         * typemanager.cs: fix TypeToCoreType() to handle void and object
5191         (corlib gets no more typerefs after this change).
5192
5193 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
5194
5195         * expression.cs (ArrayCreation.EmitArrayArguments): use
5196         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5197
5198         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5199         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
5200         array indexes, the runtime actually forbids them.
5201
5202         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5203         for array arguments here.
5204
5205         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5206         instead of the default for ValueTypes.
5207
5208         (New.DoEmit): Use IsValueType instead of
5209         IsSubclassOf (value_type)
5210         (New.DoResolve): ditto.
5211         (Invocation.EmitCall): ditto.
5212
5213         * assign.cs (Assign): ditto.
5214
5215         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5216         Statements *are* currently doing part of their resolution during
5217         Emit.  
5218
5219         Expressions do always resolve during resolve, but statements are
5220         only required to propagate resolution to their children.
5221
5222 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
5223
5224         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5225
5226         (LoadAssembly): Do not add the dll if it is already specified
5227         
5228         (MainDriver): Add the System directory to the link path at the end,
5229         after all the other -L arguments. 
5230
5231         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5232         wrong opcode for loading bytes and bools (ldelem.i1 instead of
5233         ldelem.u1) and using the opposite for sbytes.
5234
5235         This fixes Digger, and we can finally run it.
5236
5237         * driver.cs (UnixParseOption): Move the option parsing here.  
5238         (CSCParseOption): Implement CSC-like parsing of options.
5239
5240         We now support both modes of operation, the old Unix way, and the
5241         new CSC-like way.  This should help those who wanted to make cross
5242         platform makefiles.
5243
5244         The only thing broken is that /r:, /reference: and /lib: are not
5245         implemented, because I want to make those have the same semantics
5246         as the CSC compiler has, and kill once and for all the confussion
5247         around this.   Will be doing this tomorrow.
5248
5249         * statement.cs (Unsafe.Resolve): The state is checked during
5250         resolve, not emit, so we have to set the flags for IsUnsfe here.
5251
5252 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5253
5254         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5255         not catch the Error_ObjectRefRequired in SimpleName (as it is
5256         possible to have a class/instance variable name that later gets
5257         deambiguated), we have to check this here.      
5258
5259 2002-07-10  Ravi Pratap  <ravi@ximian.com>
5260
5261         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5262         make static and put into Expression.
5263
5264         (Event.Define): Register the private field of the event with the 
5265         TypeManager so that GetFieldFromEvent can get at it.
5266
5267         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5268         keep track of the private field associated with an event which
5269         has no accessors.
5270
5271         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5272         private field.
5273
5274         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5275         
5276 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5277
5278         * expression.cs (Binary.EmitBranchable): this routine emits the
5279         Binary expression in a branchable context.  This basically means:
5280         we need to branch somewhere, not just get the value on the stack.
5281
5282         This works together with Statement.EmitBoolExpression.
5283
5284         * statement.cs (Statement.EmitBoolExpression): Use
5285         EmitBranchable. 
5286
5287 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
5288
5289         * statement.cs (For): Reduce the number of jumps in loops.
5290
5291         (For): Implement loop inversion for the For statement.
5292
5293         (Break): We can be breaking out of a Try/Catch controlled section
5294         (foreach might have an implicit try/catch clause), so we need to
5295         use Leave instead of Br.
5296
5297         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5298         now).  If the instace expression supports IMemoryLocation, we use
5299         the AddressOf method from the IMemoryLocation to extract the
5300         address instead of emitting the instance.
5301
5302         This showed up with `This', as we were emitting the instance
5303         always (Emit) instead of the Address of This.  Particularly
5304         interesting when This is a value type, as we dont want the Emit
5305         effect (which was to load the object).
5306         
5307 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
5308
5309         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5310
5311         * statement.cs (Checked): Set the CheckedState during the resolve
5312         process too, as the ConvCast operations track the checked state on
5313         the resolve process, and not emit.
5314
5315         * cs-parser.jay (namespace_member_declaration): Flag that we have
5316         found a declaration when we do.  This is used to flag error 1529
5317
5318         * driver.cs: Report ok when we display the help only.
5319
5320 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
5321
5322         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5323
5324 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
5325
5326         * cs-tokenizer.cs (define): We also have to track locally the
5327         defines.  AllDefines is just used for the Conditional Attribute,
5328         but we also need the local defines for the current source code. 
5329
5330 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
5331
5332         * statement.cs (While, For, Do): These loops can exit through a
5333         Break statement, use this information to tell whether the
5334         statement is the last piece of code.
5335
5336         (Break): Flag that we break.
5337
5338         * codegen.cs (EmitContexts): New `Breaks' state variable.
5339
5340 2002-07-03  Martin Baulig  <martin@gnome.org>
5341
5342         * class.cs (TypeContainer.MethodModifiersValid): Allow override
5343         modifiers in method declarations in structs.  Otherwise, you won't
5344         be able to override things like Object.Equals().
5345
5346 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5347
5348         * class.cs (Method, Property, Indexer): Do not allow the public
5349         modifier to be used in explicit interface implementations.
5350
5351         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5352         override modifiers in method declarations in structs
5353
5354 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
5355
5356         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5357         integer or real overflow, report an error
5358
5359 2002-07-02  Martin Baulig  <martin@gnome.org>
5360
5361         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5362         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5363         to tell the runtime about our newly created System.Object and
5364         System.ValueType types.
5365
5366 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5367
5368         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5369         struct instead of Ldarg/Starg.
5370
5371 2002-07-02  Martin Baulig  <martin@gnome.org>
5372
5373         * expression.cs (Indirection.Indirection): Call
5374         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5375
5376 2002-07-02  Martin Baulig  <martin@gnome.org>
5377
5378         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5379         ValueType, call TypeManager.TypeToCoreType() on it.
5380         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5381         the OpCodes.Newarr argument.
5382
5383 2002-07-02  Martin Baulig  <martin@gnome.org>
5384
5385         * expression.cs (Invocation.EmitCall): When compiling corlib,
5386         replace all calls to the system's System.Array type to calls to
5387         the newly created one.
5388
5389         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5390         System.Array methods.
5391         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5392         from the system's System.Array type which must be replaced.
5393
5394 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5395
5396         * typemanager.cs: load unverifiable_code_ctor so we can build
5397         corlib using the correct type. Avoid using GetTypeCode() with
5398         TypeBuilders.
5399         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5400         TypeManager.object_type to allow building corlib.
5401
5402 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5403
5404         * ecore.cs: handle System.Enum separately in LoadFromPtr().
5405
5406 2002-07-01  Martin Baulig  <martin@gnome.org>
5407
5408         * class.cs: Make the last change actually work, we need to check
5409         whether `ifaces != null' to avoid a crash.
5410
5411 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5412
5413         * class.cs: when we build structs without fields that implement
5414         interfaces, we need to add the interfaces separately, since there is
5415         no API to both set the size and add the interfaces at type creation
5416         time.
5417
5418 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5419
5420         * expression.cs: the dimension arguments to the array constructors
5421         need to be converted if they are a long.
5422
5423 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5424
5425         * class.cs: don't emit ldarg.0 if there is no parent constructor
5426         (fixes showstopper for corlib).
5427
5428 2002-06-29  Martin Baulig  <martin@gnome.org>
5429
5430         MCS now compiles corlib on GNU/Linux :-)
5431
5432         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5433         ie. check for MethodImplOptions.InternalCall.
5434
5435         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5436         and TypeManager.attribute_type are null, so we must explicitly check
5437         whether parent is not null to find out whether it's an attribute type.
5438         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5439         and SetBuilder, not only if the property is neither abstract nor external.
5440         This is necessary to set the MethodImplOptions on the accessor methods.
5441         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5442         SetBuilder, see Property.Emit().
5443
5444         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5445         populate "System.Object", "System.ValueType" and "System.Attribute" since
5446         they've already been populated from BootCorlib_PopulateCoreTypes().
5447
5448 2002-06-29  Martin Baulig  <martin@gnome.org>
5449
5450         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5451         is the NullLiteral, we also need to make sure that target_type is not
5452         an enum type.   
5453
5454 2002-06-29  Martin Baulig  <martin@gnome.org>
5455
5456         * rootcontext.cs (RootContext.ResolveCore): We must initialize
5457         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5458         before calling BootstrapCorlib_ResolveDelegate ().
5459
5460 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5461
5462         * statement.cs: fixed build-breaker. All tests passed ok.
5463
5464 2002-06-27  Martin Baulig  <martin@gnome.org>
5465
5466         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5467         for System.Decimal when compiling corlib.
5468
5469 2002-06-27  Martin Baulig  <martin@gnome.org>
5470
5471         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5472         switch blocks which contain nothing but a default clause.
5473
5474 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
5475
5476        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5477
5478 2002-06-27  Martin Baulig  <martin@gnome.org>
5479
5480         * ecore.cs (PropertyExpr.PropertyExpr): Call
5481         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5482
5483         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5484         is already a TypeBuilder.
5485
5486 2002-06-27  Martin Baulig  <martin@gnome.org>
5487
5488         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5489         `target_type == TypeManager.array_type', not IsAssignableFrom() in
5490         the "from an array-type to System.Array" case.  This makes it work
5491         when compiling corlib.
5492
5493 2002-06-27  Martin Baulig  <martin@gnome.org>
5494
5495         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5496         non-static PropertyExpr, set its InstanceExpression.  This makes
5497         the `ICollection.Count' property work in System/Array.cs.
5498
5499 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
5500
5501         * driver.cs: Made error handling more consistent.  Errors now
5502         tracked by Report class, so many methods which used to return int
5503         now return void.  Main() now prints success/failure and 
5504         errors/warnings message.
5505
5506         Renamed '--probe' compiler argument to '--expect-error'.  Removed
5507         the magic number return values (123 and 124).  Now, if the
5508         expected error occurs, the compiler exits with success (exit value
5509         0).  If the compilation completes without seeing that particular
5510         error, the compiler exits with failure (exit value 1).  The
5511         makefile in mcs/errors has been changed to handle the new behaviour.
5512
5513         * report.cs: Made 'expected error' number a property and renamed
5514         it from 'Probe' to 'ExpectedError'.
5515
5516         * genericparser.cs: Removed error handling support, since it is
5517         now all done by Report class.
5518
5519         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5520         class, so parse() no longer returns an int.
5521
5522         * namespace.cs: Use Report.Error instead of GenericParser.error
5523
5524 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
5525
5526         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5527         TypeContainer.AddOperator): At the front of the list put the
5528         explicit implementations, so they get resolved/defined first. 
5529
5530 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
5531
5532         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5533         interface type is implemented by this TypeContainer.  Used during
5534         explicit interface implementation.
5535
5536         (Property.Define, Indexer.Define, Method.Define): Validate that
5537         the given interface in the explicit implementation is one of the
5538         base classes for the containing type.
5539
5540         Also if we are explicitly implementing an interface, but there is
5541         no match in the pending implementation table, report an error.
5542
5543         (Property.Define): Only define the property if we are
5544         not explicitly implementing a property from an interface.  Use the
5545         correct name also for those properties (the same CSC uses,
5546         although that is really not needed).
5547         
5548         (Property.Emit): Do not emit attributes for explicitly implemented
5549         properties, as there is no TypeBuilder.
5550
5551         (Indexer.Emit): ditto.
5552
5553         Hiding then means that we do not really *implement* a pending
5554         implementation, which makes code fail.
5555
5556 2002-06-22  Martin Baulig  <martin@gnome.org>
5557
5558         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5559         the return value of Object.GetType().  [FIXME: we need to do this whenever
5560         we get a type back from the reflection library].
5561
5562 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5563
5564         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5565
5566 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
5567
5568         * attribute.cs: Return null if we can not look up the type.
5569
5570         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5571         the interface types found.
5572
5573         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5574         interface types found.
5575
5576         * typemanager.cs (GetInterfaces): Make this routine returns alll
5577         the interfaces and work around the lame differences between
5578         System.Type and System.Reflection.Emit.TypeBuilder in the results
5579         result for GetInterfaces.
5580         
5581         (ExpandInterfaces): Given an array of interface types, expand and
5582         eliminate repeated ocurrences of an interface.  This expands in
5583         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5584         be IA, IB, IC.
5585         
5586 2002-06-21  Martin Baulig  <martin@gnome.org>
5587
5588         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5589         on System.Enum.
5590
5591 2002-06-21  Martin Baulig  <martin@gnome.org>
5592
5593         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
5594         and called with one of the core types, return the corresponding typebuilder for
5595         that type.
5596
5597         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5598         element type.
5599
5600 2002-06-21  Martin Baulig  <martin@gnome.org>
5601
5602         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5603         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5604         (Expression.ConvertReferenceExplicit): Likewise.
5605
5606         * expression.cs (ElementAccess.DoResolve): Likewise.
5607         (ElementAccess.DoResolveLValue): Likewise.
5608
5609 2002-06-10  Martin Baulig  <martin@gnome.org>
5610
5611         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5612         add the "value" parameter to the parameter list.
5613
5614         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5615         to our caller.
5616
5617 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
5618
5619         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5620         the argument to an int, uint, long or ulong, per the spec.  Also
5621         catch negative constants in array creation.
5622
5623 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5624
5625         * class.cs: do not allow the same interface to appear twice in
5626         the definition list.
5627
5628 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5629
5630         * ecore.cs: don't use ldlen with System.Array.
5631
5632 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5633
5634         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5635
5636 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5637
5638         * modifiers.cs: produce correct field attributes for protected
5639         internal. Easy fix so miguel can work on ther harder stuff:-)
5640
5641 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
5642
5643         * pending.cs: New file.  Move the code from class.cs here.
5644         Support clearning the pending flag for all methods (when not doing
5645         explicit interface implementation).
5646
5647 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5648
5649         * rootcontext.cs: added a couple more types needed to bootstrap.
5650
5651 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
5652
5653         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5654         constructor in the type, instead of any constructor in the type
5655         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
5656         a bug in the Mono runtime when applying the params attribute). 
5657
5658 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
5659         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5660
5661 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
5662
5663         * expression.cs (Unary.ResolveOperator): Use TypeManager
5664         to resolve the type.
5665         
5666 2002-06-13  Ravi Pratap  <ravi@ximian.com>
5667
5668         * cs-parser.jay (enum_member_declaration): Pass in the attributes
5669         attached.
5670
5671         * enum.cs (AddEnumMember): Add support to store the attributes associated 
5672         with each member too.
5673
5674         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5675         field builders too - this takes care of the enum member case.
5676
5677 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
5678
5679         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5680         address-of operator on both value types and pointers.
5681         
5682 2002-06-10  Martin Baulig  <martin@gnome.org>
5683
5684         * interface.cs (Interface.PopulateIndexer): Add the indexer's
5685         PropertyBuilder to the `property_builders' list.
5686
5687         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5688         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5689         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
5690         find any indexers which are inherited from an interface.
5691
5692 2002-06-09  Martin Baulig  <martin@gnome.org>
5693
5694         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5695         the same type as the constant if necessary.  There's also a test-130.cs
5696         for this.
5697
5698         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5699
5700         * typemanager.cs (TypeManager.ChangeType): Previously known as
5701         Enum.ChangeEnumType().
5702
5703 2002-06-09  Martin Baulig  <martin@gnome.org>
5704
5705         * expression.cs (Cast.TryReduce): Added support for consts.
5706
5707 2002-06-08  Ravi Pratap  <ravi@ximian.com>
5708
5709         * class.cs (Accessor): Hold attributes information so we can pass
5710         it along.
5711
5712         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5713         Modify to pass in attributes attached to the methods.
5714
5715         (add_accessor_declaration, remove_accessor_declaration): Ditto.
5716
5717         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5718         to handle the Accessor kind :-)
5719
5720         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5721         
5722 2002-06-08  Martin Baulig  <martin@gnome.org>
5723
5724         * expression.cs (Unary.TryReduceNegative): Added support for
5725         ULongConstants.
5726
5727 2002-06-08  Martin Baulig  <martin@gnome.org>
5728
5729         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5730         name can't be found in the `defined_names' - the caller will do a
5731         MemberLookup in this case and thus find methods in System.Enum
5732         such as Enum.IsDefined().
5733
5734 2002-06-08  Martin Baulig  <martin@gnome.org>
5735
5736         * enum.cs (Enum.ChangeEnumType): This is a custom version of
5737         Convert.ChangeType() which works with TypeBuilder created types.
5738         (Enum.LookupEnumValue, Enum.Define): Use it here.
5739
5740         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5741         `TypeBuilder.BaseType != null' check.
5742         (TypeContainer.FindMembers): Only lookup parent members if we
5743         actually have a parent.
5744         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5745         (ConstructorInitializer.Resolve): Likewise.
5746
5747         * interface.cs (Interface.FindMembers): Added
5748         `TypeBuilder.BaseType != null' check.
5749
5750         * rootcontext.cs (RootContext.ResolveCore): Added
5751         "System.Runtime.CompilerServices.IndexerNameAttribute" to
5752         classes_second_stage.
5753
5754         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5755         debug_type and trace_type when compiling with --nostdlib.       
5756
5757 2002-06-07  Martin Baulig  <martin@gnome.org>
5758
5759         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5760         (AddField): Set it to true when adding a non-static field.
5761         (DefineType): Use `have_nonstatic_fields' to find out whether we
5762         have non-static fields, not `Fields != null'.
5763
5764 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
5765
5766         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5767         dereferencing a null on the static-field code path)
5768
5769 2002-05-30  Martin Baulig  <martin@gnome.org>
5770
5771         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5772         to take command line arguments.  Use reflection to call the new
5773         custom `Initialize' function on the symbol writer and pass it the
5774         command line arguments.
5775
5776         * driver.cs (--debug-args): New command line argument to pass command
5777         line arguments to the symbol writer.
5778
5779 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
5780
5781         * assign.cs (DoResolve): Forgot to do the implicit conversion to
5782         the target type for indexers and properties.  Thanks to Joe for
5783         catching this.
5784
5785 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
5786
5787         * typemanager.cs (MethodFlags): returns the method flags
5788         (Obsolete/ShouldIgnore) that control warning emission and whether
5789         the invocation should be made, or ignored. 
5790
5791         * expression.cs (Invocation.Emit): Remove previous hack, we should
5792         not do this on matching a base type, we should do this based on an attribute
5793
5794         Only emit calls to System.Diagnostics.Debug and
5795         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5796         on the command line.
5797
5798         * rootcontext.cs: Global settings for tracing and debugging.
5799
5800         * cs-tokenizer.cs (define): New utility function to track
5801         defines.   Set the global settings for TRACE and DEBUG if found.
5802
5803 2002-05-25  Ravi Pratap  <ravi@ximian.com>
5804
5805         * interface.cs (Populate*): Pass in the TypeContainer as well as
5806         the DeclSpace as parameters so that we can create EmitContexts and
5807         then use that to apply attributes etc.
5808
5809         (PopulateMethod, PopulateEvent, PopulateProperty)
5810         (PopulateIndexer): Apply attributes everywhere.
5811
5812         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5813         etc.
5814
5815         (ApplyAttributes): Update accordingly.
5816
5817         We now apply interface attributes for all members too.
5818
5819 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
5820
5821         * class.cs (Indexer.Define); Correctly check if we are explicit
5822         implementation (instead of checking the Name for a ".", we
5823         directly look up if the InterfaceType was specified).
5824
5825         Delay the creation of the PropertyBuilder.
5826
5827         Only create the PropertyBuilder if we are not an explicit
5828         interface implementation.   This means that explicit interface
5829         implementation members do not participate in regular function
5830         lookups, and hence fixes another major ambiguity problem in
5831         overload resolution (that was the visible effect).
5832
5833         (DefineMethod): Return whether we are doing an interface
5834         implementation. 
5835         
5836         * typemanager.cs: Temporary hack until we get attributes in
5837         interfaces (Ravi is working on that) and we get IndexerName
5838         support in interfaces.
5839
5840         * interface.cs: Register the indexers as properties.
5841
5842         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5843         warning, I have verified that this is a bug in the .NET runtime
5844         (JavaScript suffers of the same problem).
5845
5846         * typemanager.cs (MemberLookup): When looking up members for
5847         interfaces, the parent of an interface is the implicit
5848         System.Object (so we succeed in searches of Object methods in an
5849         interface method invocation.  Example:  IEnumerable x;  x.ToString
5850         ()) 
5851
5852 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
5853
5854         * class.cs (Event): Events should also register if they do
5855         implement the methods that an interface requires.
5856
5857         * typemanager.cs (MemberLookup); use the new GetInterfaces
5858         method. 
5859
5860         (GetInterfaces): The code used to lookup interfaces for a type is
5861         used in more than one place, factor it here. 
5862
5863         * driver.cs: Track the errors at the bottom of the file, we kept
5864         on going.
5865
5866         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5867         instance if the method we are calling is static!
5868
5869 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
5870
5871         * attribute.cs (ApplyAttributes): Make this function filter out
5872         the IndexerName attribute (as that attribute in reality is never
5873         applied) and return the string constant for the IndexerName
5874         attribute. 
5875
5876         * class.cs (TypeContainer.Emit): Validate that all the indexers
5877         have the same IndexerName attribute, and if so, set the
5878         DefaultName attribute on the class. 
5879
5880         * typemanager.cs: The return value might contain other stuff (not
5881         only methods).  For instance, consider a method with an "Item"
5882         property and an Item method.
5883
5884         * class.cs: If there is a problem with the parameter types,
5885         return. 
5886
5887 2002-05-24  Ravi Pratap  <ravi@ximian.com>
5888
5889         * ecore.cs (ImplicitConversionExists): Wrapper function which also
5890         looks at user defined conversion after making a call to 
5891         StandardConversionExists - we need this for overload resolution.
5892
5893         * expression.cs : Update accordingly the various method calls.
5894
5895         This fixes 2 bugs filed against implicit user defined conversions 
5896
5897 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
5898
5899         * statement.cs: Track the result of the assignment.
5900
5901 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
5902
5903         * expression.cs (MemberAccess): Improved error reporting for
5904         inaccessible members.
5905
5906 2002-05-22  Martin Baulig  <martin@gnome.org>
5907
5908         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
5909         itself with debugging support.
5910
5911 2002-05-22  Martin Baulig  <martin@gnome.org>
5912
5913         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
5914         Removed, this isn't needed anymore.
5915
5916 2002-05-20  Martin Baulig  <martin@gnome.org>
5917
5918         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
5919         be underlying type for an enum.
5920
5921 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
5922
5923         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
5924         that splits out the loading of just the core types.
5925
5926         * rootcontext.cs (ResolveCore): Split the struct resolution in
5927         two, so we can load the enumeration underlying types before any
5928         enums are used.
5929
5930         * expression.cs (Is): Bandaid until we fix properly Switch (see
5931         bug #24985 for details).
5932
5933         * typemanager.cs (ImplementsInterface): The hashtable will contain
5934         a null if there are no interfaces implemented.
5935
5936 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
5937
5938         * cs-parser.jay (indexer_declarator): It is fine to have array
5939         parameters
5940
5941 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
5942
5943         * typemanager.cs: (RegisterBuilder): New function used to register
5944         TypeBuilders that implement interfaces.  Since
5945         TypeBuilder.GetInterfaces (as usual) does not work with lame
5946         Reflection.Emit. 
5947         (AddUserType): register interfaces.
5948
5949         (ImplementsInterface): Use the builder_to_ifaces hash if we are
5950         dealing with TypeBuilder.  Also, arrays are showing up as
5951         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
5952         methods can not be invoked on them!
5953
5954         * ecore.cs (ExplicitReferenceConversionExists): Made public.
5955         (ImplicitReferenceConversionExists): Split out from
5956         StandardConversionExists. 
5957
5958         * expression.cs (As): We were only implementing one of the three
5959         cases for the as operator.  We now implement them all.
5960         (Is): Implement the various other cases for Is as well.
5961
5962         * typemanager.cs (CACHE): New define used to control if we want or
5963         not the FindMembers cache.  Seems to have a negative impact on
5964         performance currently
5965
5966         (MemberLookup): Nested types have full acess to
5967         enclosing type members
5968
5969         Remove code that coped with instance/static returns for events, we
5970         now catch this in RealFindMembers.
5971
5972         (RealFindMembers): only perform static lookup if the instance
5973         lookup did not return a type or an event.  
5974
5975 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
5976
5977         * assign.cs (CompoundAssign): We pass more semantic information
5978         now to Compound Assignments than we did before: now we have all
5979         the information at hand, and now we resolve the target *before* we
5980         do the expression expansion, which allows the "CacheValue" method
5981         to have the effect we intended (before, a [x] += 1 would generate
5982         two differen ArrayAccess expressions from the ElementAccess,
5983         during the resolution process).
5984
5985         (CompoundAssign.DoResolve): Resolve target and original_source here.
5986
5987 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
5988
5989         * expression.cs (ArrayAccess): dropped debugging information. 
5990
5991         * typemanager.cs: Small bug fix: I was always returning i_members,
5992         instead of one of i_members or s_members (depending on which had
5993         the content).
5994
5995         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
5996         method is invoked before any code generation takes place, and it
5997         is a mechanism to inform that the expression will be invoked more
5998         than once, and that the method should use temporary values to
5999         avoid having side effects
6000
6001         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6002         
6003         * ecore.cs (Expression.CacheTemporaries): Provide empty default
6004         implementation.
6005
6006         * expression.cs (Indirection, ArrayAccess): Add support for
6007         CacheTemporaries in these two bad boys. 
6008
6009         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6010         ldobj or ldind_ref.  
6011         (StoreFromPtr): Handle stobj as well.
6012
6013         * expression.cs (UnaryMutator): Share more code.
6014         
6015         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6016         down: I was not tracking the Filter function as well, which
6017         was affecting the results of the cache.
6018
6019 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
6020
6021         * attribute.cs: Remove the hack to handle the CharSet property on
6022         StructLayouts. 
6023
6024 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
6025
6026         * attribute.cs (DoResolve): More uglyness, we now only try to
6027         resolve the attribute partially, to extract the CharSet
6028         information (only if we are a StructLayout attribute).  Otherwise 
6029
6030         (GetExtraTypeInfo): Add some code to conditionally kill in the
6031         future this.   I am more and more convinced that the .NET
6032         framework has special code to handle the attribute setting on
6033         certain elements.
6034
6035         * expression.cs (IsParamsMethodApplicable): Revert my previous
6036         foreach change here, it was wrong.
6037
6038 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
6039
6040         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6041         (pp_expr): do not abort on unknown input, just return.
6042         (eval): abort if there are pending chars.
6043
6044         * attribute.cs (Attribute.Resolve): Positional parameters are
6045         optional.  Deal with that case.
6046
6047         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6048         the Ansi/Unicode/Auto information for the type.
6049
6050         (TypeContainer.DefineType): instantiate the EmitContext here, as
6051         we will be using it during the type definition (to resolve
6052         attributes) and during the emit phase.
6053
6054         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6055         to pull type information out of the attributes
6056
6057         (Attribute.Resolve): track the constructor builder, and allow for
6058         multiple invocations (structs and classes will use this).
6059
6060         * ecore.cs (MemberLookupFinal): new version with all the
6061         parameters customizable.
6062
6063         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6064         constructors.  Return if the result value is null (as the error
6065         would have been flagged already by MemberLookupFinal)
6066
6067         Do not allow instances of abstract classes or interfaces to be
6068         created.
6069         
6070         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6071         We have to compare the assembly property here when dealing with
6072         FamANDAssem and Assembly access modifiers, because we might be
6073         creating an assembly from *modules* (that means that we are not
6074         getting TypeBuilders for types defined in other modules that are
6075         part of this assembly).
6076
6077         (Method.Emit): If the method is marked abstract and has a body,
6078         emit an error. 
6079
6080         (TypeContainer.DefineMembers): If both the defined member and the
6081         parent name match are methods, then do not emit any warnings: let
6082         the Method.Define routine take care of flagging warnings.  But if
6083         there is a mismatch (method overrides something else, or method is
6084         overriwritten by something, then emit warning).
6085
6086         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6087         set to null, this means `do not check for the return type on the
6088         signature'. 
6089
6090         (Method.Define): set the return type for the method signature to
6091         null, so that we get methods with the same name and parameters and
6092         different return types.  This is used to flag warning 114 (you are
6093         hiding a method, and you probably want to use the new/override
6094         keywords instead).
6095
6096         * typemanager.cs (MemberLookup): Implemented proper access
6097         control, closing a long standing set of bug reports.  The problem
6098         was that the Framework only has two bits: Public and NonPublic,
6099         and NonPublic includes private and protected methods, but we need
6100         to enforce the FamANDAssem, FamOrAssem and Family. 
6101
6102 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
6103
6104         * statement.cs (GotoCase): Return true: Ammounts to giving up
6105         knowledge on whether we return or not, and letting the other case
6106         be responsible for it.
6107
6108 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
6109
6110         * driver.cs: Do not load directories for each file processed, only
6111         do it if there is a pattern.
6112
6113         * ecore.cs: Report readonly assigns here as well, as we might have
6114         been resolved only by MemberAccess.
6115
6116         (SimpleName.SimpleNameResolve): Also be useful for LValue
6117         resolution.   We need this to propagate assign to local readonly variables
6118
6119         * typemanager.cs: Use a ptrhashtable for the criteria, because we
6120         do not want to reuse potential criteria memory.
6121
6122         * class.cs (MyEventBuilder): Set reflected_type;
6123
6124         * ecore.cs (Constantify): Added support for constifying bools.
6125
6126         (RootContext.LookupType): Added a cache for values looked up in
6127         the declaration space.
6128
6129         * typemanager.cs (FindMembers): Now is a front-end to
6130         RealFindMembers, and provides a two-level hashtable-based cache to
6131         the request.  
6132
6133         15% performance improvement: from 22.5 to 19.2 seconds.
6134
6135         * expression.cs (IsParamsMethodApplicable): use foreach.
6136         (Invocation.DoResolve): ditto.
6137         (New.DoResolve): ditto.
6138         (ArrayCreation.DoResolve): ditto.
6139
6140         * ecore.cs (FindMostEncompassingType): use foreach.
6141
6142         * delegate.cs (NewDelegate.DoResolve): Use foreach
6143
6144         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6145         (RemoveMethods): use foreach.
6146
6147         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6148         nested foreach statements instead of for, and also break out of
6149         the inner loop once a match is found.
6150         
6151         (Invocation.OverloadResolve): Use foreach, simplify the code. 
6152
6153 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
6154
6155         * cfold.cs (BinaryFold): During an enumeration evaluation context,
6156         we actually unwrap the expression to allow for extra information
6157         to be extracted. 
6158
6159         * expression.cs: Use Shr_Un on unsigned operations. 
6160
6161 2002-05-08  Ravi Pratap  <ravi@ximian.com>
6162
6163         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
6164         applicable operators was not being considered correctly. This closes
6165         the bug Miguel reported.
6166
6167 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6168
6169         * attribute.cs: check that the type derives from System.Attribute
6170         and report the correct error in that case (moved the duplicate code to
6171         its own method, too).
6172
6173 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6174
6175         * attribute.cs: lookup attribute type name as the spec says: first the
6176         bare attribute name and then name + "Attribute" (nant compiles with
6177         mcs after this fix).
6178
6179 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
6180
6181         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
6182         Because of the way we parse things, we should try to see if a
6183         UIntConstant can fit in an integer.
6184
6185 2002-05-07  Ravi Pratap  <ravi@ximian.com>
6186
6187         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6188         when we are in an explicit context.
6189
6190         (ConvertReferenceExplicit): When converting from Iface type S to Class
6191         T make sure the rules are implemented as an OR.
6192
6193         * parameter.cs (ParameterType): Make it a property for now although the
6194         purpose really isn't anything immediate.
6195         
6196         * expression.cs (Is*Applicable): Do better checking on the parameter type
6197         of a ref/out parameter. The ones from the system assemblies are already 
6198         marked with the correct type so we don't need to do any correction.
6199
6200         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
6201         the object type is standard too so include that.
6202
6203 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6204
6205         * ecore.cs (StandardConversionExists): Augment with missing code:
6206         deal with IntConstant, LongConstants and Enumerations.
6207
6208         * assign.cs: Report the error, instead of failing silently
6209
6210         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6211         typecontainer that they are declared, because the
6212         typecontainer/namespace will have the list of using clauses that
6213         need to be applied.
6214
6215         Assembly Attributes were escaping the normal registration
6216         mechanism. 
6217
6218         (EmitCode): Apply attributes within an EmitContext that represents
6219         the container they were declared on.
6220         
6221         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
6222
6223 2002-05-06  Ravi Pratap  <ravi@ximian.com>
6224
6225         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6226         Revamp completely - make much cleaner as we now operate only
6227         on a set of Types.
6228
6229         (FindMostSpecificSource, FindMostSpecificTarget): New methods
6230         to implement the logic detailed in the spec more correctly.
6231
6232         (UserDefinedConversion): Update accordingly.
6233
6234 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6235
6236         * statement.cs: Return flow analysis information up.
6237
6238         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6239         and the default.
6240
6241         (token): Do not consume an extra character before calling
6242         decimal_digits.
6243
6244 2002-05-06  Piers Haken <piersh@friskit.com>
6245
6246         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6247
6248 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6249
6250         * class.cs (Constructor.Emit): Set the IsStatic flag in the
6251         EmitContext during the instance constructor initializer
6252         resolution, to stop access to instance variables.
6253
6254         This is mandated by the spec, last paragraph of the `constructor
6255         initializers' section. 
6256
6257 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
6258
6259         * cs-parser.jay, class.cs (Accessor): new class used to represent
6260         an accessor (get or set).  In the past we used `null' to represent
6261         a missing accessor.  But this is ambiguous because there was no
6262         way to tell in abstract indexers/properties if one of them was
6263         specified.
6264
6265         Now there is a way of addressing that.
6266
6267         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6268         instead of FindMembers.
6269
6270         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6271         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6272
6273         * attribute.cs: Treat indexers and properties as the same in terms
6274         of applying attributes
6275
6276         * ecore.cs (FindMostEncompassedType): Use statically initialized
6277         EmptyExpressions()s like we do elsewhere to avoid creating useless
6278         objects (and we take this out of the tight loop).
6279
6280         (GetConversionOperators): Move the code to extract the actual
6281         operators to a separate routine to clean things up.
6282
6283 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
6284
6285         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6286         events are always registered FieldBuilders.
6287         
6288         * class.cs (FieldBase): New class shared by Fields 
6289
6290         * delegate.cs: If we are a toplevel delegate, use our full name.
6291         If we are a nested delegate, then only use our tail name.
6292
6293 2002-05-02  Ravi Pratap  <ravi@ximian.com>
6294
6295         * expression.cs (IsApplicable): Ensure that we add the "&" to
6296         ref/out types before comparing it with the type of the argument.
6297
6298         (IsParamsMethodApplicable): Ditto.
6299
6300         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
6301         silly me ;-)
6302
6303         * delegate.cs : Handle the case when we have more than one applicable
6304         method. Flag an error only when we finish checking all.
6305
6306 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
6307
6308         * expression.cs: Add support for boolean static initializers.
6309
6310 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
6311
6312         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6313
6314         * parameter.cs (ComputeParameterTypes,
6315         ComputeAndDefineParameterTypes): Better error handling: now we
6316         clear the `types' cache if we fail during any of the type lookups.
6317         We also return the status code correctly to our caller
6318
6319         * delegate.cs: If we fail to define a delegate, abort the extra
6320         steps. 
6321
6322         * expression.cs (Binary.ResolveOperator): for
6323         operator==(object,object) and operator !=(object, object) we also
6324         have to verify that there is an implicit conversion from one to
6325         the other.
6326
6327         (ArrayAccess.DoResolve): Array Access can operate on
6328         non-variables. 
6329
6330 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
6331
6332         * assign.cs (CompoundAssign): A new class used as a "flag" that
6333         the assignment actually is happening as part of a compound
6334         assignment operator.
6335
6336         During compound assignment, a few new rules exist to enable things
6337         like:
6338
6339         byte b |= 1 + 2
6340
6341         From the spec:
6342         
6343         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6344         to the type of x) if y is implicitly convertible to the type of x,
6345         and the operator is a builtin operator and the return type of the
6346         operator is explicitly convertible to the type of x. 
6347
6348         * rootcontext.cs: Reset warning level to 2.  4 catches various
6349         "interesting" features in mcs, we must clean this up at some
6350         point, but currently am trying to kill other bugs ;-)
6351
6352         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6353         in container classes as well.  
6354
6355         * expression.cs (Binary.ResolveOperator): Handle string case
6356         before anything else (as operator overloading does emit an error
6357         before doing anything else).
6358
6359         This code could go away when we move to a table driven model, but
6360         i could not come up with a good plan last night.
6361         
6362 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
6363
6364         * typemanager.cs (CSharpName): reimplementation using regex.
6365         * class.cs: added null check for fields in Emit
6366         * rootcontext.cs: set warninglevel to 4
6367
6368 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
6369
6370         * typemanager.cs (CSharpName): reimplemented with Lupus
6371         suggestion.
6372
6373 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
6374
6375         * statement.cs (If): correclty implement Resolve, because we were
6376         not catching sem errors in there.  The same process is needed
6377         everywhere else. 
6378         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6379         
6380
6381         (Statement.Warning_DeadCodeFound): Factorize code.
6382         (While): Report dead code here too.
6383
6384         (Statement): Added Resolve virtual method to allow
6385         for resolution split from the emit code.
6386
6387 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6388
6389         * statement.cs (EmitBoolExpression): No longer try to resolve the
6390         expression here.    
6391         (MakeBoolean): New utility function that resolve, implicitly
6392         converts to boolean and tags the expression. 
6393         
6394
6395         (If, Do): Implement dead code elimination.
6396         (While): Implement loop inversion
6397
6398         (Do, While, For, If): Resolve the expression prior to calling our
6399         code generation.
6400
6401 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
6402
6403         * class.cs:
6404           - added method Report28 (warning: program has more than one entry point)
6405           - added method IsEntryPoint, implements paragraph 10.1 of the spec
6406           - modified method Method.Define, the part at the end of the method
6407
6408         * rootcontext.cs: added static public Location EntryPointLocation;
6409           
6410         * ../errors/cs0028.cs : Add test case for the above warning.              
6411
6412         * typemanager.cs:
6413           - modified method CSharpName to allow arrays of primitive type to
6414             be printed nicely (e.g. instead of System.Int32[][] it now prints
6415             int[][])
6416           - added method CSharpSignature: returns the signature of a method
6417             in string format to be used in reporting errors, warnings, etc.
6418
6419         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6420         with String.Empty.
6421         
6422 2002-04-26  Ravi Pratap  <ravi@ximian.com>
6423
6424         * delegate.cs (Define): Fix extremely silly bug where I was
6425         setting the type of the 'object' parameter of the BeginInvoke
6426         method to System.IAsyncResult instead of System.Object ;-)
6427
6428 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6429
6430         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6431         here. 
6432
6433         (Constructor.Emit): return if we fail to initialize the
6434         constructor.  Another door closed!  
6435
6436         * expression.cs (New.DoResolve): Improve error message (from -6 to
6437         1501).  Use DeclaredOnly lookup to find the exact constructor.
6438
6439         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6440         loop.  This is useful.
6441
6442         * cs-parser.jay: Adjust the default parameters so that destructors
6443         have the proper signature.
6444
6445 2002-04-26  Martin Baulig  <martin@gnome.org>
6446
6447         * driver.cs (LoadAssembly): If `assembly' contains any characters
6448         which are only valid in path names and not in assembly names
6449         (currently slash, backslash and point), use Assembly.LoadFrom ()
6450         instead of Assembly.Load () on the `assembly' (before iteration
6451         over the link_paths).
6452
6453 2002-04-26  Martin Baulig  <martin@gnome.org>
6454
6455         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6456
6457 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
6458
6459         * class.cs (Property): use the new typemanager.MemberLookup
6460
6461         (TypeContainer.MemberLookup): Implement using the
6462         TypeManager.MemberLookup now. 
6463         
6464         * typemanager.cs: Make MemberLookup a function of the TypeManager,
6465         and return MemberInfos, so that these can be used without an
6466         EmitContext (what we had before).
6467
6468 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
6469
6470         * expression.cs: Fix the case where the argument to params if the
6471         type of the params.  I omitted handling this before.   Fixed
6472
6473 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6474
6475         * driver.cs: Call BootCorlib_PopulateCoreType
6476
6477         * class.cs (Property.CheckBase): Check for properties only, not
6478         for all members. 
6479
6480         * interface.cs: Temporary hack: try/catch around the
6481         CustomAttributeBuilder, because I am getting an exception that I
6482         do not understand.
6483
6484         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6485         types whose definitions are required to be there (attributes are
6486         defined before standard types).
6487
6488         Compute definitions as we boot the various types, as they are used
6489         immediately (value_type class will need object_type, but if we do
6490         not initialize object_type, we will pass a null, which will let
6491         the runtime pick the System.Object from the existing corlib, which
6492         is not what we want).
6493
6494 2002-04-22  Patrik Torstensson <totte@labs2.com>
6495
6496         * cs-tokenizer.cs: fixed a number of trim() issues.
6497
6498 2002-04-22  Ravi Pratap  <ravi@ximian.com>
6499
6500         * expression.cs (Argument.Type): Ensure that we return the correct
6501         type when we have out or ref parameters [in which case we 
6502         append a "&"].
6503         
6504 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6505
6506         * class.cs (Property, Indexer): Allow extern modifier in there. 
6507
6508         * typemanager.cs (InitBaseTypes): Initializes object_type and
6509         value_type, since those will be used early on during the bootstrap
6510         process to compile corlib.
6511
6512         (InitCoreTypes): Move code from here to InitBaseTypes.
6513
6514 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
6515
6516         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6517         single-dimension arrays as using the ldlen opcode.  
6518
6519         Daniel Lewis discovered this optimization.  
6520
6521         * typemanager.cs: Add signature for System.Array::get_Length
6522
6523 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6524
6525         * statement.cs: report the error when the foreach does not apply to an
6526         array nor a collection.
6527
6528 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
6529
6530         * expression.cs: Add implicit conversions to the operator ~.
6531
6532         * constant.cs (DecimalConstant.Emit): Emit decimal value.
6533
6534         * typemanager.cs: Locate the decimal constructor.
6535
6536 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6537
6538         * attribute.cs: use the new property of TypeOf.
6539         * expression.cs: added 'get' property around typearg.
6540
6541         These changes fix a build breaker reported by NickD. Is this the
6542         correct way to fix?  If not, please, revert my changes and make it
6543         work :-).
6544
6545 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
6546
6547         * attribute.cs: Add support for typeof in attribute invocations.
6548         I am not sure that this is right though.
6549
6550 2002-04-14  Duncan Mak  <duncan@ximian.com>
6551
6552         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6553         Binary.Operator.Division case.
6554
6555 2002-04-13  Ravi Pratap  <ravi@ximian.com>
6556
6557         * class.cs (DefineType): Ensure that we do a proper check on
6558         attribute types and also register it with the TypeManager.
6559
6560         (TypeContainer.Targets): The default for attribute types is
6561         AttributeTargets.All.
6562         
6563         * attribute.cs (ApplyAttributes): Registering the attribute type
6564         is done elsewhere, not when we discover we have a Usage attribute.
6565
6566 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6567
6568         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6569         and get rid of is_delegate parameter.
6570
6571         * everywhere : update.
6572         
6573 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6574
6575         * cs-parser.jay (compilation_unit): Revamp completely to use
6576         some new ideas that I got from Rhys' grammar to solve the problems
6577         with assembly level attributes.
6578
6579         (outer_declaration): New grammar production.
6580
6581         (attribute_sections): Add.
6582
6583         (opt_attributes): Base on attribute_sections
6584
6585         (namespace_declaration): Allow opt_attributes to tackle the case
6586         when we have assembly level attributes - we are clever in this
6587         regard now ;-)
6588
6589         * attribute.cs (ApplyAttributes): Do not worry about assembly 
6590         attributes in the non-global context.
6591
6592         * rootcontext.cs (AddGlobalAttributes): Go back to using this
6593         instead of SetGlobalAttributes.
6594
6595         * class.cs, rootcontext.cs : Ensure we define and generate 
6596         attribute types before anything else.
6597
6598         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6599         and flag the new error -20 for the case when the attribute type
6600         does not have valid targets specified. csc does not catch this.
6601
6602         * ../errors/errors.txt : update for error # -20
6603
6604 2002-04-11  Ravi Pratap  <ravi@ximian.com>
6605
6606         * support.cs (InternalParameters.ParameterModifier): Do some null
6607         checking and return sane values.
6608
6609         * class.cs (Method.Define): If we are a PInvoke method, ensure
6610         that we are static and extern. Report error # 601
6611
6612         * ../errors/cs0601.cs : Add test case for the above error.
6613
6614 2002-04-07  Ravi Pratap  <ravi@ximian.com>
6615
6616         * rootcontext.cs (attribute_types): We need to keep type of
6617         all attribute types separately and emit code for them first.
6618
6619         (RegisterAttribute) : Implement.
6620
6621         * class.cs (DefineType): Check if the current Type is a custom
6622         attribute type and register it accordingly.
6623
6624         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6625         adding the first attribute twice and rename to
6626
6627         (SetGlobalAttributes): this.
6628
6629         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6630         lookups.
6631
6632         * attribute.cs (ApplyAttributes): Take an additional argument telling us
6633         if we are processing global arguments. Hmm, I am unsure of this.
6634
6635 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6636
6637         * expression.cs: added static array of strings to avoid calling
6638         Enum.ToString () for Operator in Binary. Significant recover of
6639         performance.
6640
6641 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
6642
6643         * class.cs (FindMembers): Allow the Builders of the various
6644         members to be null.  If they are skip them.  This only happens
6645         during the PInvoke declaration.
6646
6647 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
6648
6649         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6650         failure, so we do not keep going afterwards.
6651
6652         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6653         wanted to pass `false' as the `is_delegate' argument.  If this is
6654         the case, why not use delegate_type == null to mean `is_delegate =
6655         false' and anything else as is_delegate = true.
6656
6657 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
6658
6659         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6660         code for the section, not the beginning of the tests.
6661
6662 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
6663
6664         * cfold.cs: Handle operator + (Enum x, Underlying x) 
6665
6666         * expression.cs (Binary): same.  Warn about errors where we have
6667         Enum/Enum in operator + as well.
6668
6669 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
6670
6671         * statement.cs:
6672                 - added support for switch(bool)
6673                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6674                 - add TableSwitchEmit() to handle table-based switch statements
6675
6676 2002-04-05  Ravi Pratap  <ravi@ximian.com>
6677
6678         * expression.cs (Invocation.OverloadResolve): Factor out code which
6679         does parameter compatibility checking with arguments so that we can 
6680         re-use the code even from Delegate.VerifyApplicability
6681
6682         (VerifyArgumentsCompat): Move above code here.
6683
6684         * delegate.cs (VerifyApplicability): Get rid of duplicate code
6685         and instead make a call to the above method.
6686
6687 2002-03-31  Ravi Pratap  <ravi@ximian.com>
6688
6689         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6690         We use it to keep track of classes which are attribute types.
6691
6692 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
6693
6694         * delegate.cs (Delegate.Define): Correctly define the types in the
6695         presence of fixed and array parameters.
6696
6697         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6698         doing FindMembers.
6699
6700         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6701         include NonPublic after the first iteration.
6702
6703         * class.cs (Indexer.CheckBase): Only check if both parents are
6704         non-null. 
6705         
6706         * cs-parser.jay (accessor_body): If empty, set to null.
6707
6708         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6709         same code path here to resolve constants names that we did have in
6710         MemberAccess.DoResolve.  There is too much code duplicated here.
6711
6712 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
6713
6714         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6715
6716         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6717         to MakeUnionSet.
6718
6719         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6720         tokens, numbers and strings.
6721
6722         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6723         parenthesis.
6724
6725         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6726         asyncronous parameters and the regular parameters.  
6727
6728         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6729         specify the target directory.
6730
6731         * expression.cs: (This.DoResolve): Simplify
6732         (As.Emit): Optimize, do not generate IsInst if the expression is
6733         always of the given type.
6734
6735         (Is.DoResolve): Bug fix, we were reporting both always/never for
6736         the is expression.
6737
6738         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6739         creating too many unnecessary arrays.
6740
6741 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
6742
6743         * class.cs (EmitFieldInitializer): Use Assign expression to assign
6744         fields instead of rolling our own initializer.   Takes care of all
6745         implicit conversions, and drops unnecessary static checks/argument.
6746
6747 2002-03-31  Dick Porter  <dick@ximian.com>
6748
6749         * driver.cs: use the GetDirectories() return values properly, and
6750         use "/" as path separator.
6751
6752 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
6753
6754         * expression.cs (Unary): Optimize - - expr into expr.
6755         (Binary): Optimize a + (-b) into a -b.
6756
6757         * codegen.cs (CodeGen): Made all methods static.
6758
6759 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
6760
6761         * rootcontext.cs: 
6762
6763         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6764         TypeBuilder property.
6765
6766         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6767         instead. 
6768
6769         * tree.cs: Removed the various RecordXXXX, and replaced with a
6770         single RecordDecl.  Removed all the accessor methods, and just
6771         left a single access point Type 
6772
6773         * enum.cs: Rename DefineEnum to DefineType.
6774
6775         * decl.cs: New abstract method `DefineType' used to unify the
6776         Defines for Enumerations, Interfaces, TypeContainers and
6777         Delegates.
6778
6779         (FindType): Moved LookupInterfaceOrClass here.  Moved the
6780         LookupBaseClasses method that used to live in class.cs and
6781         interface.cs here, and renamed to FindType.
6782         
6783         * delegate.cs: Implement DefineType.  Take advantage of the
6784         refactored pattern for locating the parent builder without taking
6785         the parent_builder argument (which we know does not work if we are
6786         nested, and triggering a toplevel definition).
6787
6788 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6789
6790         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6791         accessibility of a member has changed during override and report
6792         an error if so.
6793
6794         * class.cs (Method.Define, Property.Define): Only complain on
6795         overrides if the method is private, any other accessibility is
6796         fine (and since we just checked the permission is the same, we are
6797         good to go).
6798
6799         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6800         and elif are processed always.  The other pre-processing
6801         directives are only processed if we are "taking" the path
6802
6803 2002-03-29  Martin Baulig  <martin@gnome.org>
6804
6805         * class.cs (Method.Emit): Only emit symbolic debugging info if the
6806         current location is not Null.
6807
6808         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6809         a separate method so we can profile it.
6810
6811         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6812         `span.Seconds' are just seconds, but no minutes or hours.
6813         (MainDriver): Profile the CodeGen.SaveSymbols calls.
6814
6815 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6816
6817         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6818         Remove the gratuitous set of Final:
6819
6820                                 // If an interface implementation, then we can set Final.
6821                                 if (((flags & MethodAttributes.Abstract) == 0) &&
6822                                     implementing.DeclaringType.IsInterface)
6823                                         flags |= MethodAttributes.Final;
6824
6825         I do not know what I was smoking when I used that.
6826         
6827
6828         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6829         step into fixing the name resolution issues for delegates and
6830         unifying the toplevel name resolution.
6831
6832 2002-03-28  Martin Baulig  <martin@gnome.org>
6833
6834         * class.cs (Method.Emit): If we have a symbol writer, call its
6835         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6836         tell it about the current method.
6837
6838         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6839         writer that we're going to emit the first byte of IL code for a new
6840         statement (a new source line).
6841         (EmitContext.EmitTopBlock): If we have a symbol writer, call
6842         EmitContext.Mark() before emitting any code.
6843
6844         * location.cs (SymbolDocument): Return null when we're Null.
6845
6846         * statement.cs (Statement): Moved the `Location loc' variable here.
6847         (Statement.EmitBoolExpression): If we have a symbol writer, call
6848         ec.Mark() before emitting any code to tell it that we're at the
6849         beginning of a new statement.
6850         (StatementExpression): Added `Location' argument to the constructor.
6851         (Block): Added public readonly variable `StartLocation' and public
6852         variable `EndLocation'.  The latter is to be set using SetEndLocation().
6853         (Block): Added constructor which takes a start and end location.
6854         (Block.SetEndLocation): New method. This sets the end location.
6855         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6856         local variables we create.
6857         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6858         each statement and do also mark the begin and end of the block.
6859
6860         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6861         tell it the current lexer.Location, use Location.Null for the end of the
6862         block.
6863         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6864         current block, set its end location using SetEndLocation().
6865         (statement_expression): StatementExpression constructor now takes the
6866         lexer.Location as additional argument.
6867         (for_statement, declare_local_variables): Likewise.
6868         (declare_local_variables): When creating a new implicit block, use the
6869         new Block constructor and pass it the lexer.Location.
6870
6871 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6872
6873         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6874         members also on the parent interfaces recursively.
6875
6876 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
6877
6878         * report.cs: Use new formats, since Gonzalo finished the missing
6879         bits. 
6880
6881         * expression.cs (Binary.ResolveOperator): added missing operator|
6882         operator& and operator^ for bool/bool.
6883
6884         * cs-parser.jay: CheckDef now takes a Location argument that is
6885         used to report errors more precisly (instead of reporting the end
6886         of a definition, we try to track something which is a lot closer
6887         to the source of the problem).
6888
6889         * cs-tokenizer.cs: Track global token use, so we can properly flag
6890         the use of #define/#undef after the first token has been seen.
6891
6892         Also, rename the reportXXXX to Error_DescriptiveName
6893
6894         * decl.cs (DeclSpace.IsTopLevel): Move property here from
6895         TypeContainer, so that Enum and Interface can use this too.
6896
6897         * class.cs (TypeContainer.LookupInterfaceOrClass,
6898         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
6899         `builder' argument.  Typically this was used to pass the parent
6900         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
6901         the definition).  
6902
6903         The problem is that a nested class could trigger the definition of
6904         a toplevel class, and the builder would be obviously wrong in that
6905         case. 
6906
6907         So we drop this argument, and we compute dynamically the
6908         TypeBuilder/ModuleBuilder (the correct information was available
6909         to us anyways from DeclSpace.Parent)
6910
6911         * interface.cs (Interface.DefineInterface): Drop builder
6912         parameter cleanup like class.cs
6913
6914         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
6915         like class.cs
6916
6917         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
6918         values. 
6919
6920         (Try.Emit): Propagate the returns value from the statement.
6921
6922         (Return.Emit): Even if we are leavning 
6923
6924         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
6925
6926         * modifiers.cs: Fix the computation of MethodAttributes flags.
6927
6928 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
6929
6930         * driver.cs: allow compilation of files that start with '/'.
6931         Add a default case when checking the argument of --target.
6932
6933 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
6934
6935         * interface.cs: Implement the same search algorithm for types in
6936         the interface code.
6937
6938         * delegate.cs: Do not allow multiple definition.
6939
6940         * Recovered ChangeLog that got accidentally amputated
6941
6942         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
6943
6944         * rootcontext.cs: Load manually enum to allow core classes to
6945         contain enumerations.
6946
6947         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
6948         Update to new static methods in TypeManager.
6949
6950         * typemanager.cs (GetMethod, GetConstructor): Use our
6951         implementation of FindMembers to find the members, since during
6952         corlib compilation, the types are TypeBuilders and GetMethod and
6953         GetConstructor do not work.
6954
6955         Make all methods in TypeManager static.
6956
6957         (InitCodeHelpers): Split the functionality from
6958         the InitCodeTypes function.
6959
6960         * driver.cs: Call InitCodeHelpers after we have populated the
6961         types. 
6962
6963         * cs-parser.jay (delegate_declaration): we did not used to compute
6964         the delegate name correctly for void delegates.
6965
6966 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
6967
6968         * rootcontext.cs (RootContext): Init the interface_resolve_order
6969         and type_container_resolve_order always.
6970
6971         (ResolveCore, BootstrapCorlib_ResolveClass,
6972         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
6973         compiler when compiling with --nostdlib
6974
6975         * class.cs (TypeContainer.DefineType): Check that our parent is
6976         not null.  This test is most important when we are bootstraping
6977         the core types.
6978
6979         * codegen.cs: Split out the symbol writing code.
6980
6981 2002-03-25  Martin Baulig  <martin@gnome.org>
6982
6983         * driver.cs (-g): Made -g an alias for --debug.
6984
6985 2002-03-24  Martin Baulig  <martin@gnome.org>
6986
6987         * codegen.cs (SymbolWriter): New public variable. Returns the
6988         current symbol writer.
6989         (CodeGen): Added `bool want_debugging_support' argument to the
6990          constructor. If true, tell the ModuleBuild that we want debugging
6991         support and ask it for the ISymbolWriter.
6992         (Save): If we have a symbol writer, call it's Close() method after
6993         saving the assembly.
6994
6995         * driver.c (--debug): New command line argument to create a
6996         debugger information file.
6997
6998         * location.cs (SymbolDocument): New public property. Returns an
6999         ISymbolDocumentWriter object for the current source file or null
7000         if we don't have a symbol writer.
7001
7002 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
7003
7004         * driver.cs (LoadAssembly): Correctly return when all the paths
7005         have been tried and not before.
7006
7007         * statement.cs (Switch.Emit): return the actual coverage for this
7008         statement (returns/not-returns)
7009
7010         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7011         switch of the statement if we are the last switch section.  That
7012         kills two problems: try/catch problems (we used to emit an empty
7013         nop at the end) and switch statements where all branches would
7014         return. 
7015
7016 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
7017
7018         * driver.cs: Add default assemblies (the equivalent to the
7019         Microsoft CSC.RSP file)
7020
7021         * cs-tokenizer.cs: When updating `cols and setting it to zero,
7022         also update tokens_seen and set it to false.
7023
7024         * driver.cs: Implement --recurse for Mike.
7025
7026         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7027         correctly splitting out the paths.
7028
7029 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
7030
7031         * interface.cs (Interface.PopulateProperty): Instead of using
7032         `parent' as the declaration space for the set parameters, use
7033         `this' 
7034
7035         * support.cs (InternalParameters): InternalParameters constructor
7036         takes a DeclSpace instead of a TypeContainer.
7037
7038         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7039         types are being initialized, load the address of it before calling
7040         the function.  
7041
7042         (New): Provide a mechanism to disable the generation of local
7043         value type temporaries when the caller will be providing us with
7044         an address to store it.
7045
7046         (ArrayCreation.EmitDynamicInitializers): Use it.
7047
7048 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
7049
7050         * expression.cs (Invocation.EmitArguments): Only probe for array
7051         property if there is more than one argument.  Sorry about that.
7052
7053         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7054         empty param arrays.
7055         
7056         * class.cs (Method.LabelParameters): Fix incorrect code path that
7057         prevented the `ParamArrayAttribute' from being applied to the
7058         params attribute.
7059
7060 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
7061
7062         * support.cs (ReflectionParameters): Correctly compute whether the
7063         last argument is a params array.  Fixes the problem with
7064         string.Split ('a')
7065
7066         * typemanager.cs: Make the assemblies array always be non-null
7067         (empty, but non-null)
7068
7069         * tree.cs (RecordDecl): New function that abstracts the recording
7070         of names.  This reports error 101, and provides a pointer to the
7071         previous declaration.  Fixes a crash in the compiler.
7072
7073         * cs-parser.jay (constructor_declaration): Update to new grammar,
7074         and provide a constructor_body that can be empty.
7075
7076 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
7077
7078         * driver.cs: Add support for --resources.
7079
7080         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7081         Make all types for the various array helper methods be integer.
7082
7083         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7084         CheckState to ConvCast.
7085
7086         (ConvCast): Now it takes a `checked' state argument, to avoid
7087         depending on the emit context for the conversion, and just using
7088         the resolve time setting.
7089
7090         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7091         instead of Invocation.EmitArguments.  We do not emit the original
7092         arguments, instead we emit those which have been converted to
7093         unsigned int expressions.
7094
7095         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
7096
7097         * codegen.cs: ditto.
7098
7099         * expression.cs (LocalVariableReference): Drop the use of the
7100         Store function that depended on the variable index.
7101
7102         * statement.cs (VariableInfo): Drop the `Idx' property from this
7103         class, as this is not taking into account the indexes for
7104         temporaries tat we generate during the execution, getting the
7105         indexes wrong.
7106
7107         * class.cs: First emit class initializers, then call the parent
7108         constructor. 
7109
7110         * expression.cs (Binary): Fix opcode emision.
7111         (UnaryMutator.EmitCode): Support checked code generation
7112
7113         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
7114         matches for events for both the Static and Instance scans,
7115         pointing to the same element.   Fix that.
7116
7117 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
7118
7119         * rootcontext.cs (ResolveTree): Always set the
7120         interface_resolve_order, because nested interfaces will be calling
7121         into us.
7122
7123         * class.cs (GetInterfaceOrClass): Track the same resolution
7124         process used by TypeManager.LookupType.  This fixes the nested
7125         type lookups in class declarations (separate path from
7126         LookupType). 
7127
7128         (TypeContainer.DefineType): Also define nested interfaces.
7129         (TypeContainer.RegisterOrder): New public function used to
7130         register the order in which child interfaces need to be closed.
7131
7132         Nested interfaces need to be closed after their parents have been
7133         created. 
7134         
7135         * interface.cs (InterfaceAttr): Put all the logic for computing
7136         the interface attribute here. 
7137
7138         (DefineInterface): Register our interface order with the
7139         RootContext or with the TypeContainer depending on the case.
7140
7141 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7142
7143         * cs-parser.jay: rework foreach statement to work with the new
7144         changes to the policy on SimpleNames.
7145         
7146         * report.cs: support Stacktrace on warnings as well.
7147
7148         * makefile: drop --unsafe and /unsafe from the compile.
7149
7150 2002-03-13  Ravi Pratap  <ravi@ximian.com>
7151
7152         * ecore.cs (StandardConversionExists): Modify to take an Expression
7153         as the first parameter. Ensure we do null -> reference type conversion
7154         checking.
7155
7156         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7157         temporary Expression objects.
7158
7159 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7160
7161         * interface.cs: workaround bug in method overloading resolution
7162         (there is already a bugzilla bug for it).
7163
7164 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7165
7166         We could also solve this problem by having a separate path for
7167         performing type lookups, instead of DoResolve, we could have a
7168         ResolveType entry point, and only participating pieces of the
7169         production (simplename, deref, array) would implement this. 
7170         
7171         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7172         signal SimpleName to only resolve type names and not attempt to
7173         resolve anything else.
7174
7175         * expression.cs (Cast): Set the flag.
7176
7177         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7178
7179         * class.cs: Only report 108 if there is no `new' modifier.
7180
7181         * cs-parser.jay: rework foreach statement to work with the new
7182         changes to the policy on SimpleNames.
7183         
7184         * report.cs: support Stacktrace on warnings as well.
7185
7186         * makefile: drop --unsafe and /unsafe from the compile.
7187
7188 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
7189
7190         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7191         lookups here, instead of doing that at parse time.  This means
7192         that our grammar will not introduce `LocalVariableReferences' as
7193         expressions at this point.  That solves the problem of code like
7194         this:
7195
7196         class X {
7197            static void Main ()
7198            { int X = 1;
7199             { X x = null }}}
7200
7201         This is only half the fix.  The full fix requires parameters to
7202         also be handled in this way.
7203
7204         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7205         makes the use more obvious of the DeclSpace.  The
7206         ec.TypeContainer.TypeBuilder is now only used to pull the
7207         TypeBuilder for it.
7208
7209         My theory is that I can get rid of the TypeBuilder completely from
7210         the EmitContext, and have typecasts where it is used (from
7211         DeclSpace to where it matters).  
7212
7213         The only pending problem is that the code that implements Aliases
7214         is on TypeContainer, and probably should go in DeclSpace.
7215
7216         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7217         lookups here, instead of doing that at parse time.  This means
7218         that our grammar will not introduce `LocalVariableReferences' as
7219         expressions at this point.  That solves the problem of code like
7220         this:
7221
7222         class X {
7223            static void Main ()
7224            { int X = 1;
7225             { X x = null }}}
7226
7227         This is only half the fix.  The full fix requires parameters to
7228         also be handled in this way.
7229
7230         * class.cs (Property.DefineMethod): When implementing an interface
7231         method, set newslot, when implementing an abstract method, do not
7232         set the flag (before we tried never setting it, or always setting
7233         it, which is the difference).
7234         (Indexer.DefineMethod): same.
7235         (Method.DefineMethod): same.
7236
7237         * ecore.cs: Only set the status used flag if we get back a Field.
7238
7239         * attribute.cs: Temporary hack, so Paolo can keep working.
7240
7241 2002-03-08  Ravi Pratap  <ravi@ximian.com>
7242
7243         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7244         the unmanaged type in the case we have a MarshalAs attribute.
7245
7246         (Resolve): Handle the case when we are parsing the special MarshalAs
7247         attribute [we need to store the unmanaged type to use later]
7248         
7249         * typemanager.cs (marshal_as_attr_type): Built in type for the 
7250         MarshalAs Attribute.
7251
7252         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
7253         on parameters and accordingly set the marshalling info.
7254         
7255 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
7256
7257         * class.cs: Optimizing slightly by removing redundant code after
7258         we switched to the `NoTypes' return value.
7259         (Property.DefineMethod): use NoTypes here too.
7260
7261         This fixes the bug I introduced in my last batch of changes.
7262
7263 2002-03-05  Ravi Pratap  <ravi@ximian.com>
7264
7265         * tree.cs (RecordEnum): Add. We now keep track of enums too.
7266
7267         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7268         Enums since those are types too. 
7269
7270         * cs-parser.jay (enum_declaration): Record enums as we parse them.
7271         
7272         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
7273         thanks to a call during the lookup process.
7274
7275 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
7276
7277         * statement.cs (Foreach): Lots of work to accomodate a particular
7278         kind of foreach statement that I had not kept in mind.  It is
7279         possible to have foreachs on classes that provide a GetEnumerator
7280         method that return objects that implement the "pattern" for using
7281         a foreach, there is no need to support GetEnumerator
7282         specifically. 
7283
7284         This is needed to compile nant.
7285
7286         * decl.cs: Only report 114 if the member is not `Finalize' and if
7287         the warning level is at least 2.
7288
7289         * class.cs: Moved the compare function from Method to
7290         MethodSignature. 
7291
7292         (MethodSignature.InheritableMemberSignatureCompare): Add new
7293         filter function that is used to extract inheritable methods from a
7294         class. 
7295
7296         (Method.Define): Use the new `inheritable_method_signature_filter'
7297         delegate
7298
7299         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7300         command. 
7301
7302 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
7303
7304         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7305
7306         * cs-parser.jay: Add opt_semicolon to the interface declaration.
7307
7308         * expression.cs: Pass location information to
7309         ConvertImplicitStandard. 
7310
7311         * class.cs: Added debugging code to track return values from
7312         interfaces. 
7313
7314 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
7315
7316         * expression.cs (Is.DoResolve): If either side of the `is' is an
7317         interface, do not flag the warning.
7318
7319         * ecore.cs (ImplicitReferenceConversion): We need a separate test
7320         for interfaces
7321
7322         * report.cs: Allow for --fatal to be used with --probe.
7323         
7324         * typemanager.cs (NoTypes): Move the definition for the empty Type
7325         array here. 
7326
7327         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7328         properties. 
7329         (TypeContainer.DefineProxy): New function used to proxy to parent
7330         implementations when implementing interfaces.
7331         (TypeContainer.ParentImplements): used to lookup if our parent
7332         implements a public function that is required by an interface.
7333         (TypeContainer.VerifyPendingMethods): Hook this up.
7334
7335         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7336         `modules' and `assemblies' arraylists into arrays.  We only grow
7337         these are the very early start up of the program, so this improves
7338         the speedof LookupType (nicely measured).
7339
7340         * expression.cs (MakeByteBlob): Replaced unsafe code with
7341         BitConverter, as suggested by Paolo.
7342
7343         * cfold.cs (ConstantFold.Binary): Special case: perform constant
7344         folding of string concatenation, but if either side is a string,
7345         and the other is not, then return null, and let the runtime use
7346         the concatenation on the string plus the object (using
7347         `Object.ToString'). 
7348
7349 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
7350
7351         Constant Folding has been implemented now.
7352         
7353         * expression.cs (Unary.Reduce): Do not throw an exception, catch
7354         the error instead on types that are not supported in one's
7355         complement. 
7356
7357         * constant.cs (Constant and all children): New set of functions to
7358         perform implict and explicit conversions.
7359         
7360         * ecore.cs (EnumConstant): Implement the new functions to perform
7361         conversion by proxying to the child expression.
7362
7363         * codegen.cs: (ConstantCheckState): Constant evaluation has its
7364         own separate setting that can not be turned off from the command
7365         line using --unchecked or --checked and is only controlled using
7366         the checked/unchecked statements and expressions.  This setting is
7367         used by the constant folder to flag errors.
7368
7369         * expression.cs (CheckedExpr, UncheckedExpr): Set the
7370         ConstantCheckState as well.   
7371
7372         During Resolve, they also have to flag the state, because the
7373         constant folder runs completely in the Resolve phase.
7374
7375         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7376         well.
7377
7378 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7379
7380         * cfold.cs: New file, this file contains the constant folder.
7381         
7382         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7383         argument to track whether we are using the resulting address to
7384         load or store a value and provide better error messages. 
7385
7386         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7387         new AddressOf arguments.
7388
7389         * statement.cs (Foreach.EmitCollectionForeach): Update
7390
7391         * expression.cs (Argument.Emit): Call AddressOf with proper
7392         arguments to track usage.
7393
7394         (New.DoEmit): Call AddressOf with new arguments.
7395
7396         (Unary.Emit): Adjust AddressOf call.
7397
7398 2002-03-01  Ravi Pratap  <ravi@ximian.com>
7399
7400         * cs-parser.jay (member_access): Change the case for pre-defined types
7401         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
7402         this suggestion.
7403
7404         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7405         a method body.
7406
7407         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7408         essentially like methods and apply attributes like MethodImplOptions to them too.
7409
7410         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7411         not being null.
7412
7413         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7414         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7415         is the DeclSpace.
7416
7417         * Update code everywhere accordingly.
7418
7419         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7420
7421         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7422
7423 2002-02-28  Ravi Pratap  <ravi@ximian.com>
7424
7425         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7426         try performing lookups against those instead of jumping straight into using
7427         the 'using' clauses.
7428
7429         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7430
7431         (LookupType): Perform lookups in implicit parents too.
7432
7433         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7434         sequence as RootContext.LookupType. 
7435
7436         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
7437         the various cases of namespace lookups into this method.
7438
7439 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7440
7441         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7442         in positional arguments)
7443
7444         * class.cs (Operator): Update the AllowedModifiers to contain
7445         extern. 
7446
7447         * cs-parser.jay: Update operator declaration to allow for the
7448         operator body to be empty.
7449
7450         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7451         values. 
7452
7453 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
7454
7455         * class.cs (Method.Emit): Label parameters.
7456
7457         * driver.cs: Return 1 or 0 as the program exit code.
7458
7459 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
7460
7461         * expression.cs: Special case the `null' object when trying to
7462         auto-compute the type, as anything can be explicitly converted to
7463         that. 
7464
7465         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7466         spotting this Paolo.
7467
7468         (Expression.ImplicitNumericConversion): Perform comparissions of
7469         the type using the underlying type in the case of an enumeration
7470         rather than using the enumeration type for the compare.
7471
7472         Cope with the underlying == type case, which is not possible to
7473         catch before. 
7474
7475         (Expression.ConvertNumericExplicit): Perform comparissions of
7476         the type using the underlying type in the case of an enumeration
7477         rather than using the enumeration type for the compare.
7478
7479         * driver.cs: If the user does not supply an extension, assume .exe
7480
7481         * cs-parser.jay (if_statement): Rewrote so that we can track the
7482         location for the if statement.
7483
7484         * expression.cs (Binary.ConstantFold): Only concat strings when
7485         the operation is "+", not everything ;-)
7486
7487         * statement.cs (Statement.EmitBoolExpression): Take a location
7488         argument. 
7489         (If, While, Do): Track location.
7490
7491         * expression.cs (Binary.ResolveOperator): In the object + string
7492         case, I was missing a call to ConvertImplicit
7493
7494 2002-02-25  Ravi Pratap  <ravi@ximian.com>
7495
7496         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7497         Location arguments. Ensure we use RootContext.LookupType to do our work
7498         and not try to do a direct Type.GetType and ModuleBuilder.GetType
7499
7500         * interface.cs (PopulateMethod): Handle the type of the parameter being
7501         null gracefully.
7502
7503         * expression.cs (Invocation.BetterFunction): Handle the case when we 
7504         have a params method with no fixed arguments and a call is made with no
7505         arguments.
7506
7507 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
7508
7509         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7510         the verbatim-string-literal
7511
7512         * support.cs (InternalParameters.ParameterModifier): handle null
7513         fixed parameters.
7514         (InternalParameters.ParameterType): ditto.
7515
7516         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7517         duplicating the name of the variable parameter.
7518         (GetParameterByName): Fix bug where we were not looking up array
7519         paramters if they were the only present (thanks Paolo!).
7520         (GetParameterInfo): We only have an empty set of types if both
7521         fixed and array are set to null.
7522         (GetParameterInfo-idx): Handle FixedParameter == null
7523
7524         * cs-parser.jay: Handle the case where there is no catch
7525         statements (missing null test).
7526
7527 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
7528
7529         * driver.cs (MainDriver): Be conservative on our command line
7530         handling.
7531
7532         Catch DirectoryNotFoundException when calling GetFiles.
7533         
7534         (SplitPathAndPattern): Used to split the input specification into
7535         a path and a pattern that we can feed to Directory.GetFiles.
7536
7537 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
7538
7539         * statement.cs (Fixed): Implement the last case of the Fixed
7540         statement (string handling).
7541
7542         * expression.cs (StringPtr): New class used to return a char * to
7543         a string;  Used by the Fixed statement.
7544
7545         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
7546
7547         * expression.cs (Binary.ResolveOperator): Remove redundant
7548         MemberLookup pn parent type.
7549         Optimize union call, we do not need a union if the types are the same.
7550         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7551         type.
7552
7553         Specialize the use of MemberLookup everywhere, instead of using
7554         the default settings. 
7555
7556         (StackAlloc): Implement stackalloc keyword.
7557
7558         * cs-parser.jay: Add rule to parse stackalloc.
7559         
7560         * driver.cs: Handle /h, /help, /?
7561
7562         * expression.cs (MakeByteBlob): Removed the hacks we had in place
7563         before we supported unsafe code.
7564         
7565         * makefile: add --unsafe to the self compilation of mcs.
7566
7567 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
7568
7569         * expression.cs (PointerArithmetic): New class that is used to
7570         perform pointer arithmetic.
7571         (Binary.Resolve): Handle pointer arithmetic
7572         Handle pointer comparission.
7573         (ArrayPtr): Utility expression class that is used to take the
7574         address of an array.
7575
7576         (ElementAccess): Implement array access for pointers
7577         
7578         * statement.cs (Fixed): Implement fixed statement for arrays, we
7579         are missing one more case before we are done.
7580
7581         * expression.cs (Indirection): Implement EmitAssign and set the
7582         ExprClass to Variable.  This allows pointer dereferences to be
7583         treated as variables, and to have values assigned to them.
7584         
7585         * ecore.cs (Expression.StoreFromPtr): New utility function to
7586         store values dereferencing.
7587
7588 2002-02-20  Ravi Pratap  <ravi@ximian.com>
7589
7590         * expression.cs (Binary.ResolveOperator): Ensure that we are
7591         not trying to operate on a void type - this fixes the reported
7592         bug.
7593
7594         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7595         the parent implementation is sealed.
7596
7597         * ../errors/cs0239.cs : Add.
7598
7599         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7600
7601         * typemanager.cs (unverifiable_code_type): Corresponds to 
7602         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7603         which have unsafe code in them.
7604
7605         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
7606         unsafe context.
7607
7608 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
7609
7610         * cs-tokenizer.cs: Add support for @"litreal strings"
7611
7612         Make tokenizer accept pre-processor directives
7613         on any column (remove the old C-like limitation). 
7614
7615         * rootcontext.cs (EmitCode): Emit any global attributes.
7616         (AddGlobalAttributes): Used to keep track of assembly attributes. 
7617
7618         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7619
7620         * cs-parser.jay: Add support for global attributes.  
7621
7622 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
7623
7624         * expression.cs (Indirection): New helper class.  Unary will
7625         create Indirection classes to be able to implement the
7626         IMemoryLocation interface on it.
7627
7628 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
7629
7630         * cs-parser.jay (fixed_statement): reference the right statement.
7631
7632         * statement.cs (Fixed.Emit): Finish implementing the fixed
7633         statement for the &x case.
7634
7635 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
7636
7637         * class.cs (Property.Define, Method.Define): Remove newslot when
7638         `implementing'.  
7639
7640         * modifiers.cs: My use of NewSlot when `Abstract' was set was
7641         wrong.  NewSlot should only be used if the `new' keyword is present.
7642
7643         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7644         locating our system dir.  Sorry about this.
7645
7646 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7647
7648         * driver.cs (GetSystemDir): Compute correctly the location of our
7649         system assemblies.  I was using the compiler directory instead of
7650         the library directory.
7651
7652 2002-02-13  Ravi Pratap  <ravi@ximian.com>
7653
7654         * expression.cs (BetterFunction): Put back in what Miguel commented out
7655         since it is the correct fix. The problem is elsewhere ;-)
7656
7657         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7658         parameters of the parms method are themselves compatible or not !
7659
7660         (StandardConversionExists): Fix very dangerous bug where we were forgetting
7661         to check that a class implements an interface before saying that an implicit
7662         conversion was allowed. Use ImplementsInterface to do the checking.
7663
7664 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7665
7666         * class.cs (Method.Define): Track whether we are an explicit
7667         implementation or not.  And only call DefineMethodOverride if we
7668         are an explicit implementation.
7669
7670         (Property.DefineMethod): Ditto.
7671
7672 2002-02-11  Ravi Pratap  <ravi@ximian.com>
7673
7674         * expression.cs (BetterFunction): Catch hideous bug which was
7675          preventing us from detecting ambiguous calls due to implicit casts i.e
7676         cs0121.
7677
7678 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
7679
7680         * support.cs (Pair): Remove un-needed method.  I figured why I was
7681         getting the error in cs-parser.jay, the variable in a foreach loop
7682         is readonly, and the compiler does not really treat this as a variable.
7683
7684         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
7685         instead of EQUALS in grammar.  
7686
7687         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7688
7689         * expression.cs (Unary.DoResolve): Check whether the argument is
7690         managed or not.
7691
7692 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
7693
7694         * support.cs: Api for Pair to set a value.  Despite the fact that
7695         the variables are public the MS C# compiler refuses to compile
7696         code that accesses the field if the variable is part of a foreach
7697         statement. 
7698
7699         * statement.cs (Fixed): Begin implementation of the fixed
7700         statement.
7701
7702         (Block.AddVariable): Return the VariableInfo on success and null
7703         on failure instead of true/false. 
7704
7705         * cs-parser.jay (foreach): Catch errors on variables already
7706         defined (we were ignoring this value before) and properly unwind
7707         the block hierarchy
7708
7709         (fixed_statement): grammar for the fixed statement.
7710
7711 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
7712
7713         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7714         pointer types to be incretemented.
7715
7716         (SizeOf): Implement.
7717
7718         * cs-parser.jay (pointer_member_access): Implement
7719         expr->IDENTIFIER production.
7720
7721         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7722         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7723         on safe contexts.
7724
7725         (Unary): Implement indirection.
7726
7727         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7728         use in non-unsafe context).
7729
7730         (SimpleName.DoResolve): Check for pointers in field access on safe
7731         contexts. 
7732
7733         (Expression.LoadFromPtr): Factor the load-indirect code in this
7734         function.  This was duplicated in UnboxCast and ParameterReference
7735
7736 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
7737
7738         * expression.cs (ComposedCast): report an error if a pointer cast
7739         is used in a safe region.
7740
7741         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7742         pointer type casts in unsafe context.
7743
7744         * codegen.cs (EmitContext): Set up IsUnsafe.
7745
7746         * cs-parser.jay (non_expression_type): Add productions for pointer
7747         casts. 
7748
7749         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7750         code.  We should not use force into static mode if the method is
7751         not virtual.  Fixes bug in MIS
7752
7753         * statement.cs (Do.Emit, While.Emit, For.Emit,
7754         Statement.EmitBoolExpression): Add support to Do and While to
7755         propagate infinite loop as `I do return' semantics.
7756
7757         Improve the For case to also test for boolean constants.
7758
7759         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7760         to the list of attributes we can add.
7761
7762         Remove `EmitContext' argument.
7763
7764         * class.cs (Method.Define): Apply parameter attributes.
7765         (Constructor.Define): Apply parameter attributes.
7766         (MethodCore.LabelParameters): Move here the core of labeling
7767         parameters. 
7768
7769         * support.cs (ReflectionParameters.ParameterModifier,
7770         InternalParameters.ParameterModifier): Use IsByRef on the type and
7771         only return the OUT bit for these parameters instead of in/out/ref
7772         flags.
7773
7774         This is because I miss-understood things.  The ParameterInfo.IsIn
7775         and IsOut represent whether the parameter has the [In] and [Out]
7776         attributes set.  
7777
7778 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
7779
7780         * ecore.cs (FieldExpr.Emit): Release temporaries.
7781
7782         * assign.cs (LocalTemporary.Release): new function.
7783
7784         * codegen.cs (EmitContext.GetTemporaryStorage,
7785         EmitContext.FreeTemporaryStorage): Rework the way we deal with
7786         temporary storage.  Now we can "put back" localbuilders when we
7787         are done with them
7788
7789 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
7790
7791         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7792         need to make a copy of the variable to generate verifiable code.
7793
7794 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
7795
7796         * driver.cs: Compute dynamically the system directory.
7797
7798         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7799         Slower, but more generally useful.  Used by the abstract
7800         registering implementation. 
7801
7802         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7803         the rules for the special rule on Type/instances.  First check if
7804         we have the same name, and if so, try that special static path
7805         rather than the instance path.
7806         
7807 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
7808
7809         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7810         for, while and if.
7811
7812         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7813         Enum, ValueType, Delegate or Array for non-corlib compiles.
7814
7815         * cs-tokenizer.cs: Catch long identifiers (645)
7816
7817         * typemanager.cs (IndexerPropetyName): Ravi never tested this
7818         piece of code.
7819
7820         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7821         fix, we were returning too early, so we were not registering
7822         pending methods from abstract classes.
7823
7824         Do not register pending methods if the class is abstract.
7825
7826         * expression.cs (Conditional.DoResolve): Report circular implicit
7827         conversions when we neecd to compute it for conditional
7828         expressions. 
7829
7830         (Is.DoResolve): If the expression is always of the provided type,
7831         flag warning 183.  If the expression can not ever be of the
7832         provided type flag warning 184.
7833
7834         * class.cs: Catch 169 as well.
7835
7836         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7837         read. 
7838
7839 2002-01-18  Nick Drochak  <ndrochak@gol.com>
7840
7841         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
7842
7843 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
7844
7845         * interface.cs: (PopulateMethod): Check for pointers being defined
7846         only if the unsafe context is active.
7847         (PopulateProperty): ditto.
7848         (PopulateIndexer): ditto.
7849
7850         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7851         specified.  If pointers are present, make sure that they are
7852         present in an unsafe context.
7853         (Constructor, Constructor.Define): ditto.
7854         (Field, Field.Define): ditto.
7855         (Property, Property.Define): ditto.
7856         (Event, Event.Define): ditto.
7857
7858         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7859         hashtable if there are classes or structs defined.
7860
7861         * expression.cs (LocalVariableReference.DoResolve): Simplify this
7862         code, as the constant resolution moved.
7863
7864         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7865         the metadata, so we can flag error 133. 
7866
7867         * decl.cs (MemberCore.UnsafeOK): New function to test that a
7868         pointer is being declared in an unsafe context.
7869
7870 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
7871
7872         * modifiers.cs (Modifiers.Check): Require a Location argument.
7873         Report error 227 for Unsafe use.
7874
7875         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7876
7877         * statement.cs (For.Emit): If the test is null, then report that
7878         we do `return', as we wont reach anything afterwards.
7879
7880         (Switch.SwitchGoverningType): Track the expression that matched
7881         the conversion.
7882
7883         * driver.cs: Allow negative numbers as an error code to flag.
7884
7885         * cs-parser.jay: Handle 1551.
7886
7887         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
7888
7889 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
7890
7891         * cs-parser.jay: Report 1518 (type declaration can only contain
7892         class, struct, interface, enum or delegate)
7893
7894         (switch_label): Report 1523 (keywords `case' or `default' must
7895         preced code)
7896
7897         (opt_switch_sections): Report 1522 (empty switch)
7898
7899         * driver.cs: Report 1515 (response file specified multiple times)
7900         Report 1516 (Source file specified multiple times).
7901
7902         * expression.cs (Argument.Resolve): Signal 1510
7903
7904         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
7905         access not allowed in static code)
7906
7907 2002-01-11  Ravi Pratap  <ravi@ximian.com>
7908
7909         * typemanager.cs (IsPointerType): Utility method which we are going
7910         to need a lot.
7911
7912         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
7913         the object type, so we take care of that.
7914
7915         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
7916         
7917         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
7918         added to non-params parameters :-)
7919
7920         * typemanager.cs (CSharpName): Include 'void' type too. 
7921
7922         (void_ptr_type): Include in the set of core types.
7923
7924         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
7925         duplicating code.
7926
7927         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
7928         an unsafe context.
7929
7930         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
7931         completely forgotten about it.
7932
7933 2002-01-10  Ravi Pratap  <ravi@ximian.com>
7934
7935         * cs-parser.jay (pointer_type): Add. This begins our implementation
7936         of parsing rules for unsafe code.
7937
7938         (unsafe_statement): Implement.
7939
7940         (embedded_statement): Modify to include the above.
7941
7942         * statement.cs (Unsafe): Implement new class for unsafe blocks.
7943
7944         * codegen.cs (EmitContext.InUnsafe): Add. This determines
7945         if the current context is an unsafe one.
7946
7947         * cs-parser.jay (local_variable_pointer_type): Since local variable types
7948         are handled differently, we need separate rules for them.
7949
7950         (local_variable_declaration): Update to use local_variable_pointer_type
7951         to allow variable declarations of unmanaged pointer types.
7952
7953         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
7954         in unsafe contexts.
7955
7956         * ../errors/cs0214.cs : Add.
7957
7958 2002-01-16  Nick Drochak  <ndrochak@gol.com>
7959
7960         * makefile: remove 'response' file when cleaning.
7961
7962 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
7963
7964         * cs-parser.jay: Report 1524.
7965
7966 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
7967
7968         * typemanager.cs (RegisterMethod): drop checking if we have
7969         registered this from here
7970
7971 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
7972
7973         * class.cs (Method.EmitDestructor): Implement calling our base
7974         destructor. 
7975
7976         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
7977         value of InFinally.
7978
7979         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
7980         this routine and will wrap the call in a try/catch block.  Deal
7981         with the case.
7982
7983 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
7984
7985         * ecore.cs (Expression.MemberLookup): instead of taking a
7986         parameter `same_type' that was used to tell whether we could
7987         access private members we compute our containing type from the
7988         EmitContext.
7989
7990         (FieldExpr): Added partial support for volatile fields.  This does
7991         not work for volatile fields exposed from assemblies, as I can not
7992         figure out how to extract the modreq from it.
7993
7994         Updated all the source files to use this.
7995
7996         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
7997         because it is referenced by MemberLookup very often. 
7998
7999 2002-01-09  Ravi Pratap  <ravi@ximian.com>
8000
8001         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8002         TypeBuilder.GetCustomAttributes to retrieve what we need.
8003
8004         Get rid of redundant default_member_attr_type as this is the same as
8005         default_member_type which already exists.
8006
8007         * interface.cs, attribute.cs : Update accordingly.
8008         
8009 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
8010
8011         * typemanager.cs: Enable IndexerPropertyName again.  It does not
8012         work for TYpeBuilders though.  Ravi, can you please fix this?
8013
8014         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8015
8016         * expression.cs (Argument.Emit): Handle the case of ref objects
8017         being passed to ref functions;  
8018
8019         (ParameterReference.EmitLoad): Loads the content of the pointer
8020         without dereferencing.
8021
8022 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8023
8024         * cs-tokenizer.cs: Implemented the pre-processing expressions.
8025
8026 2002-01-08  Ravi Pratap  <ravi@ximian.com>
8027
8028         * class.cs (Indexer.DefineMethod): Incorporate the interface
8029         type in the name of the method if we are doing explicit interface
8030         implementation.
8031
8032         * expression.cs (ConversionExists): Remove as it is completely obsolete.
8033
8034         (BetterConversion): Fix extremely trivial bug where we were referring to
8035         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8036         again !
8037
8038         * ../errors/bug16.cs : Add although we have fixed it.
8039
8040 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8041
8042         * expression.cs (BaseIndexer): Begin implementation.
8043
8044         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8045
8046         * cs-parser.jay (indexer_declarator): Use qualified_identifier
8047         production directly to remove a shift/reduce, and implement
8048         explicit interface implementation.
8049
8050         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8051         after a floating point suffix.
8052
8053         * expression.cs (DoNumericPromotions): Improved the conversion for
8054         uint/uint.  If we have a constant, we avoid doing a typecast to a
8055         larger type.
8056
8057         * class.cs (Indexer): Implement explicit interface implementation
8058         for indexers.
8059         
8060 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8061
8062         * class.cs: make the default instance constructor public and hidebysig.
8063
8064 2001-01-03  Ravi Pratap  <ravi@ximian.com>
8065
8066         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8067         so we can call it from elsewhere.
8068
8069         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8070         we emit it internally if the class has a defined indexer; otherwise the user
8071         emits it by decorating the class definition with the DefaultMemberAttribute.
8072
8073         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8074         attribute is not used on a type which defines an indexer.
8075
8076         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8077         character when we skip whitespace.
8078
8079         * ../errors/cs0646.cs : Add.
8080
8081 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
8082
8083         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8084         again. 
8085
8086         * makefile: Add practical target `mcs3.exe' which builds the third
8087         generation compiler. 
8088
8089         * expression.cs (New): Fix structures constructor calling.
8090
8091         * class.cs (Property, Method, Indexer): Emit Final flag on the
8092         method if we are an interface implementation and we are not
8093         abstract. 
8094
8095         * ecore.cs (PropertyExpr): New public field `IsBase', tells
8096         whether this property is referencing a `base' method.
8097
8098         * expression.cs (Invocation.EmitCall): take an extra argument:
8099         is_base, this is used to determine whether the `call' or
8100         `callvirt' opcode should be used.
8101
8102         
8103         * delegate.cs: update EmitCall.
8104
8105         * class.cs (Method.Define): Set NewSlot for the cases where we are
8106         not implementing an interface method.
8107
8108         (Property.Define): ditto.
8109
8110 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
8111
8112         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
8113         'r'.  Allows mcs to parse itself fully.
8114
8115 2002-01-02  Ravi Pratap  <ravi@ximian.com>
8116
8117         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8118         of the number of initializers that require the InitializeArray method.
8119
8120         (CheckIndices): Store the Expression in all cases - not the plain value. Also
8121         update the above field where necessary.
8122
8123         (MakeByteBlob): Update accordingly.
8124
8125         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
8126         greater than 2.
8127
8128         (EmitDynamicInitializers): Update in accordance with the new optimization.
8129
8130         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8131         same OpCode applies.
8132
8133         * cs-parser.jay : Fix some glaring errors I introduced.
8134
8135 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
8136
8137         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8138         so that we can check for name clashes there too.
8139
8140         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8141         for interface indexers.
8142
8143         * interfaces.cs (Define): Emit the default member attribute.
8144
8145         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8146         variable was being referred to while setting the value ;-)
8147
8148 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
8149
8150         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8151         byte-by-byte information when we know the data is zero.
8152
8153         Make the block always a multiple of 4, because
8154         DefineInitializedData has a bug.
8155
8156         * assign.cs: Fix, we should assign from the temporary, not from
8157         the source. 
8158
8159         * expression.cs (MakeByteBlob): Fix my incorrect code.
8160
8161 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
8162
8163         * typemanager.cs (EnumToUnderlying): This function is used to get
8164         the underlying type from an enumeration, because it does not
8165         always work. 
8166
8167         * constant.cs: Use the I4_S form for values between -128 and 127.
8168
8169         * statement.cs (Block.LookupLabel): Looks up a label.
8170         (Block): Drop support for labeled blocks.
8171
8172         (LabeledStatement): New kind of statement that represents a label
8173         only.
8174
8175         (Goto): Finally implement this bad boy.
8176         
8177         * cs-parser.jay: Update to reflect new mechanism to implement
8178         labels.
8179
8180 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
8181
8182         * codegen.cs (EmitContext.This): a codegen property that keeps the
8183         a single instance of this instead of creating many different this
8184         instances. 
8185
8186         * delegate.cs (Delegate.DoResolve): Update to use the property;
8187
8188         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8189
8190         * expression.cs (BaseAccess.DoResolve): Ditto.
8191
8192 2001-12-29  Ravi Pratap  <ravi@ximian.com>
8193
8194         * typemanager.cs (methodimpl_attr_type): Add to hold the type
8195         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8196
8197         (InitCoreTypes): Update accordingly.
8198
8199         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8200         so we can quickly store the state.
8201
8202         (ApplyAttributes): Set the correct implementation flags
8203         for InternalCall methods.
8204
8205 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
8206
8207         * expression.cs (EmitCall): if a method is not virtual, then do
8208         not use callvirt on it.
8209
8210         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8211         user defined stuff) requires the use of stobj, which takes an
8212         address on the stack instead of an array and an index.  So emit
8213         the Ldelema operation for it.
8214
8215         (EmitStoreOpcode): Use stobj for valuetypes.
8216
8217         (UnaryMutator.EmitCode): Use the right 1 value depending on
8218         whether we are dealing with int64/uint64, float or doubles.
8219
8220         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8221         constructors that I implemented last night.
8222
8223         (Constructor.IsDefault): Fix to work properly for static
8224         constructors.
8225
8226         * cs-parser.jay (CheckDef): report method signature errors.
8227         Update error number 103 to be 132.
8228
8229         * decl.cs: New AdditionResult enumeration value: MethodExists.
8230         Although we do this check for methods later on in the semantic
8231         analysis, catching repeated default constructors is so easy that
8232         we catch these here. 
8233         
8234         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8235         promotions code.
8236
8237         (ParameterReference.EmitAssign, Emit): handle
8238         bools as bytes.
8239
8240         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8241         (ArrayAccess.EmitStoreOpcode): ditto.
8242
8243         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8244
8245         * expression.cs (MakeByteBlob): Complete all the missing types
8246         (uint, short, ushort, byte, sbyte)
8247
8248         * class.cs: Only init instance field initializers on instance
8249         constructors. 
8250
8251         Rename `constructors' to instance_constructors. 
8252
8253         (TypeContainer.AddConstructor): Only add constructors to the list
8254         if it is not static.
8255
8256         Make sure that we handle default_static_constructor independently
8257         everywhere where we handle instance_constructors
8258
8259 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
8260
8261         * class.cs: Do not lookup or create a base initializer for a
8262         static constructor.
8263
8264         (ConstructorInitializer.Resolve): use the proper type to lookup
8265         for constructors.
8266
8267         * cs-parser.jay: Report error 1585 (modifiers between type and name).
8268
8269         * enum.cs, interface.cs: Remove CloseType, this is taken care by
8270         in DeclSpace. 
8271
8272         * decl.cs: CloseType is now an virtual method, the default
8273         implementation just closes this type.
8274         
8275 2001-12-28  Ravi Pratap  <ravi@ximian.com>
8276
8277         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8278         to PreserveSig by default. Also emit HideBySig on such methods.
8279
8280         Basically, set the defaults to standard values.
8281
8282         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8283         argument, if candidate is better, it can't be worse than the best !
8284
8285         (Invocation): Re-write bits to differentiate between methods being
8286         applicable in their expanded form and their normal form - for params
8287         methods of course.
8288
8289         Get rid of use_standard everywhere as only standard conversions are allowed
8290         in overload resolution. 
8291
8292         More spec conformance.
8293         
8294 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8295
8296         * driver.cs: Add --timestamp, to see where the compiler spends
8297         most of its time.
8298
8299         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8300         `this' in static code.
8301
8302         (SimpleName.DoResolve): Implement in terms of a helper function
8303         that allows static-references to be passed upstream to
8304         MemberAccess.
8305
8306         (Expression.ResolveWithSimpleName): Resolve specially simple
8307         names when called by MemberAccess to implement the special
8308         semantics. 
8309
8310         (Expression.ImplicitReferenceConversion): Handle conversions from
8311         Null to reference types before others, as Null's type is
8312         System.Object. 
8313
8314         * expression.cs (Invocation.EmitCall): Handle the special case of
8315         calling methods declared on a reference type from a ValueType
8316         (Base classes System.Object and System.Enum)
8317
8318         (MemberAccess.Resolve): Only perform lookups on Enumerations if
8319         the left hand side is a TypeExpr, not on every enumeration. 
8320
8321         (Binary.Resolve): If types are reference types, then do a cast to
8322         object on operators != and == of both arguments.
8323         
8324         * typemanager.cs (FindMembers): Extract instance and static
8325         members if requested.
8326
8327         * interface.cs (PopulateProperty): Use void_type instead of null
8328         as the return type for the setter method.
8329
8330         (PopulateIndexer): ditto.
8331
8332 2001-12-27  Ravi Pratap  <ravi@ximian.com>
8333
8334         * support.cs (ReflectionParameters): Fix minor bug where we
8335         were examining the wrong parameter for the ParamArray attribute.
8336
8337         Cope with requests for the type of the parameter at position
8338         greater than the params parameter's. We now return the element
8339         type of the params array as that makes more sense.
8340
8341         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
8342         accordingly as we no longer have to extract the element type
8343         ourselves.
8344
8345         (Invocation.OverloadResolve): Update.
8346
8347 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8348
8349         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8350         against IEnumerator, test whether the return value is a descendant
8351         of the IEnumerator interface.
8352
8353         * class.cs (Indexer.Define): Use an auxiliary method to implement
8354         the other bits of the method definition.  Begin support for
8355         explicit interface implementation.
8356
8357         (Property.DefineMethod): Use TypeManager.void_type instead of null
8358         for an empty return value.
8359
8360 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
8361
8362         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8363         dealing with a FieldExpr which is composed of a FieldBuilder, in
8364         the code path we did extract the constant, but we should have
8365         obtained the underlying value to be able to cast it (otherwise we
8366         end up in an infinite loop, this is what Ravi was running into).
8367
8368         (ArrayCreation.UpdateIndices): Arrays might be empty.
8369
8370         (MemberAccess.ResolveMemberAccess): Add support for section
8371         14.5.4.1 that deals with the special case of E.I when E is a type
8372         and something else, that I can be a reference to a static member.
8373
8374         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8375         handle a particular array type to create byte blobs, it is just
8376         something we dont generate byteblobs for.
8377
8378         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8379         arguments. 
8380
8381         * location.cs (Push): remove the key from the hashtable that we
8382         are about to add.   This happens for empty files.
8383
8384         * driver.cs: Dispose files after we have parsed them.
8385
8386         (tokenize): new function that only runs the tokenizer on its
8387         input, for speed testing.
8388
8389 2001-12-26  Ravi Pratap  <ravi@ximian.com>
8390
8391         * class.cs (Event.Define): Define the private field only if there
8392         are no accessors defined.
8393
8394         * expression.cs (ResolveMemberAccess): If there is no associated
8395         field with the event, that means we have an event defined with its
8396         own accessors and we should flag error cs0070 since transforming
8397         ourselves into a field is not valid in that case.
8398
8399         * ecore.cs (SimpleName.DoResolve): Same as above.
8400
8401         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8402         and charset to sane values.
8403
8404 2001-12-25  Ravi Pratap  <ravi@ximian.com>
8405
8406         * assign.cs (DoResolve): Perform check on events only if they 
8407         are being accessed outside the declaring type.
8408
8409         * cs-parser.jay (event_declarations): Update rules to correctly
8410         set the type of the implicit parameter etc.
8411
8412         (add_accessor, remove_accessor): Set current local parameters.
8413
8414         * expression.cs (Binary): For delegate addition and subtraction,
8415         cast the return value from the method into the appropriate delegate
8416         type.
8417
8418 2001-12-24  Ravi Pratap  <ravi@ximian.com>
8419
8420         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8421         of these as the workaround is unnecessary.
8422
8423         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8424         delegate data - none of that is needed at all.
8425
8426         Re-write bits to extract the instance expression and the delegate method
8427         correctly.
8428
8429         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
8430         on delegates too.
8431
8432         * attribute.cs (ApplyAttributes): New method to take care of common tasks
8433         of attaching attributes instead of duplicating code everywhere.
8434
8435         * everywhere : Update code to do attribute emission using the above method.
8436
8437 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8438
8439         * expression.cs (IsParamsMethodApplicable): if there are not
8440         parameters, return immediately.
8441
8442         * ecore.cs: The 0 literal can be implicity converted to an enum
8443         type. 
8444
8445         (SimpleName.DoResolve): First lookup the type, then lookup the
8446         members. 
8447
8448         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8449         want to get its address.  If the InstanceExpression is not
8450         addressable, store the result in a temporary variable, then get
8451         the address of it.
8452
8453         * codegen.cs: Only display 219 errors on warning level or above. 
8454
8455         * expression.cs (ArrayAccess): Make it implement the
8456         IMemoryLocation interface.
8457
8458         (Binary.DoResolve): handle the operator == (object a, object b)
8459         and operator != (object a, object b) without incurring into a
8460         BoxedCast (because 5 != o should never be performed).
8461
8462         Handle binary enumerator operators.
8463
8464         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8465         value type, otherwise use Ldelem_ref.
8466
8467         Use precomputed names;
8468
8469         (AddressOf): Implement address of
8470
8471         * cs-parser.jay (labeled_statement): Fix recursive block
8472         addition by reworking the production.
8473
8474         * expression.cs (New.DoEmit): New has a special case:
8475                 
8476                  If we are dealing with a ValueType, we have a few
8477                  situations to deal with:
8478                 
8479                     * The target of New is a ValueType variable, that is
8480                       easy, we just pass this as the variable reference
8481                 
8482                     * The target of New is being passed as an argument,
8483                       to a boxing operation or a function that takes a
8484                       ValueType.
8485                 
8486                       In this case, we need to create a temporary variable
8487                       that is the argument of New.
8488
8489
8490 2001-12-23  Ravi Pratap  <ravi@ximian.com>
8491
8492         * rootcontext.cs (LookupType): Check that current_type is not null before
8493         going about looking at nested types.
8494
8495         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8496         not implement the IAssignMethod interface any more.
8497
8498         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8499         where we tranform them into FieldExprs if they are being resolved from within
8500         the declaring type.
8501
8502         * ecore.cs (SimpleName.DoResolve): Do the same here.
8503
8504         * assign.cs (DoResolve, Emit): Clean up code considerably. 
8505
8506         * ../errors/bug10.cs : Add.
8507
8508         * ../errors/cs0070.cs : Add.
8509
8510         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8511
8512         * assign.cs : Get rid of EventIsLocal everywhere.
8513         
8514 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8515
8516         * ecore.cs (ConvertIntLiteral): finished the implementation.
8517
8518         * statement.cs (SwitchLabel): Convert the value we are using as a
8519         key before looking up the table.
8520
8521 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8522
8523         * codegen.cs (EmitTopBlock): Require a Location argument now.
8524
8525         * cs-parser.jay (constructor_declarator): We need to setup
8526         current_local_parameters before we parse the
8527         opt_constructor_initializer, to allow the variables to be bound
8528         to the constructor arguments.
8529
8530         * rootcontext.cs (LookupType): First lookup nested classes in our
8531         class and our parents before we go looking outside our class.
8532
8533         * expression.cs (ConstantFold): Extract/debox the values at the
8534         beginnning. 
8535
8536         * rootcontext.cs (EmitCode): Resolve the constants first before we
8537         resolve the types.  This is not really needed, but it helps debugging.
8538
8539         * statement.cs: report location.
8540         
8541         * cs-parser.jay: pass location to throw statement.
8542
8543         * driver.cs: Small bug fix.
8544
8545         * report.cs: Updated format to be 4-zero filled digits.
8546
8547 2001-12-22  Ravi Pratap  <ravi@ximian.com>
8548
8549         * expression.cs (CheckIndices): Fix minor bug where the wrong
8550         variable was being referred to ;-)
8551
8552         (DoEmit): Do not call EmitStaticInitializers when the 
8553         underlying type is System.Object.
8554
8555 2001-12-21  Ravi Pratap  <ravi@ximian.com>
8556
8557         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8558         and do the usual workaround for SRE.
8559
8560         * class.cs (MyEventBuilder.EventType): New member to get at the type
8561         of the event, quickly.
8562
8563         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8564
8565         * assign.cs (Assign.DoResolve): Handle the case when the target
8566         is an EventExpr and perform the necessary checks.
8567
8568         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8569         interface.
8570
8571         (SimpleName.MemberStaticCheck): Include check for EventExpr.
8572
8573         (EventExpr): Set the type in the constructor itself since we 
8574         are meant to be born fully resolved.
8575
8576         (EventExpr.Define): Revert code I wrote earlier.
8577                 
8578         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8579         instance expression is null. The instance expression is a This in that case
8580         or a null, depending on whether it is a static method or not.
8581
8582         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8583         refers to more than one method.
8584
8585         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8586         and accordingly flag errors.
8587
8588 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8589
8590         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8591
8592 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8593
8594         * location.cs (ToString): Provide useful rutine.
8595
8596 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8597
8598         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8599         objects, return the actual integral boxed.
8600
8601         * statement.cs (SwitchLabel): define an ILLabel for each
8602         SwitchLabel. 
8603         
8604         (Switch.CheckSwitch): If the value is a Literal, extract
8605         the underlying literal.
8606         
8607         Also in the unused hashtable we had, add the SwitchLabel so we can
8608         quickly look this value up.
8609
8610         * constant.cs: Implement a bunch of new constants.  Rewrite
8611         Literal based on this.  Made changes everywhere to adapt to this.
8612         
8613         * expression.cs (Expression.MakeByteBlob): Optimize routine by
8614         dereferencing array only once, and also copes with enumrations.
8615
8616         bytes are two bytes wide, not one.
8617
8618         (Cast): Perform constant conversions.
8619         
8620         * ecore.cs (TryImplicitIntConversion): Return literals instead of
8621         wrappers to the literals here.
8622
8623         * expression.cs (DoNumericPromotions): long literals can converted
8624         to ulong implicity (this is taken care of elsewhere, but I was
8625         missing this spot).
8626
8627         * ecore.cs (Expression.Literalize): Make the return type Literal,
8628         to improve type checking.
8629
8630         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8631
8632 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8633
8634         * literal.cs: Revert code from ravi that checked the bounds.  The
8635         bounds are sane by the definition of the type itself. 
8636
8637         * typemanager.cs: Fix implementation of ImplementsInterface.  We
8638         need to actually look up in our parent hierarchy for interfaces
8639         implemented. 
8640
8641         * const.cs: Use the underlying type for enumerations
8642
8643         * delegate.cs: Compute the basename for the delegate creation,
8644         that should fix the delegate test case, and restore the correct
8645         Type Lookup semantics in rootcontext
8646
8647         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
8648         referencing a nested type with the Reflection API is using the "+"
8649         sign. 
8650
8651         * cs-parser.jay: Do not require EOF token at the end.
8652
8653 2001-12-20  Ravi Pratap  <ravi@ximian.com>
8654
8655         * rootcontext.cs (LookupType): Concatenate type names with
8656         a '.' instead of a '+' The test suite passes again.
8657
8658         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8659         field of the enumeration.
8660
8661         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8662         the case when the member is an EventExpr.
8663
8664         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8665         static has an associated instance expression.
8666
8667         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8668
8669         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8670
8671         * class.cs (Event.Define): Register event and perform appropriate checks
8672         for error #111.
8673
8674         We define the Add and Remove methods even if the use provides none because
8675         in that case, we provide default implementations ourselves.
8676
8677         Define a private field of the type of the event. This is done by the CSC compiler
8678         and we should be doing it too ;-)
8679
8680         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8681         More methods we use in code we generate.
8682
8683         (multicast_delegate_type, delegate_type): Two separate types since the distinction
8684         is important.
8685
8686         (InitCoreTypes): Update accordingly for the above.
8687
8688         * class.cs (Event.Emit): Generate code for default accessors that we provide
8689
8690         (EmitDefaultMethod): Do the job in the above.
8691
8692         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
8693         appropriate place.
8694
8695 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8696
8697         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8698         builders even if we were missing one.
8699
8700         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8701         pass the Basename as our class name instead of the Name.  The
8702         basename will be correctly composed for us.
8703
8704         * parameter.cs (Paramters): Now takes a Location argument.
8705
8706         * decl.cs (DeclSpace.LookupType): Removed convenience function and
8707         make all the code call directly LookupType in RootContext and take
8708         this chance to pass the Location information everywhere.
8709
8710         * Everywhere: pass Location information.
8711
8712 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
8713
8714         * class.cs (Constructor.Define): Updated way of detecting the
8715         length of the parameters.
8716
8717         (TypeContainer.DefineType): Use basename as the type name for
8718         nested types.
8719
8720         (TypeContainer.Define): Do not recursively define types here, as
8721         definition is taken care in order by the RootContext.
8722
8723         * tree.cs: Keep track of namespaces in a per-file basis.
8724
8725         * parameter.cs (Parameter.ComputeSignature): Update to use
8726         DeclSpace. 
8727
8728         (Parameters.GetSignature): ditto.
8729
8730         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8731         instead of a TypeContainer.
8732
8733         (Interface.SemanticAnalysis): Use `this' instead of our parent to
8734         resolve names.  Because we need to be resolve in our context, not
8735         our parents.
8736         
8737         * driver.cs: Implement response files.
8738
8739         * class.cs (TypeContainer.DefineType): If we are defined, do not
8740         redefine ourselves.
8741         
8742         (Event.Emit): Emit the code for add/remove handlers.
8743         (Event.Define): Save the MethodBuilders for add/remove.
8744
8745         * typemanager.cs: Use pair here too.
8746
8747         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8748         DictionaryEntry requires the first argument to be non-null.  
8749         
8750         (enum_declaration): Compute full name for registering the
8751         enumeration.
8752         
8753         (delegate_declaration): Instead of using
8754         formal_parameter_list, use opt_formal_parameter_list as the list
8755         can be empty.
8756
8757         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8758         (EventParsing): New property that controls whether `add' and
8759         `remove' are returned as tokens or identifiers (for events);
8760
8761 2001-12-19  Ravi Pratap  <ravi@ximian.com>
8762
8763         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8764         use MyEventBuilder only and let it wrap the real builder for us.
8765
8766         (MyEventBuilder): Revamp constructor etc.
8767
8768         Implement all operations that we perform on EventBuilder in precisely the same
8769         way here too.
8770
8771         (FindMembers): Update to use the EventBuilder member.
8772
8773         (Event.Emit): Update accordingly.
8774
8775 2001-12-18  Ravi Pratap  <ravi@ximian.com>
8776
8777         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8778         by calling the appropriate methods.
8779
8780         (GetCustomAttributes): Make stubs as they cannot possibly do anything
8781         useful.
8782
8783         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8784
8785 2001-12-17  Ravi Pratap  <ravi@ximian.com>
8786
8787         * delegate.cs (Delegate.Populate): Check that the return type
8788         and various parameters types are indeed accessible.
8789
8790         * class.cs (Constructor.Define): Same here.
8791
8792         (Field.Define): Ditto.
8793
8794         (Event.Define): Ditto.
8795
8796         (Operator.Define): Check that the underlying Method defined itself
8797         correctly - so it's MethodBuilder should not be null.
8798
8799         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8800         expression happens to be null.
8801
8802         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8803         members but as of now we don't seem to be able to do anything really useful with it.
8804
8805         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8806         not the EventBuilder.
8807
8808 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
8809
8810         * cs-tokenizer.cs: Add support for defines.
8811         Add support for #if, #elif, #else, #endif
8812         
8813         (eval_var): evaluates a variable.
8814         (eval): stubbed for evaluating functions.
8815
8816         * cs-parser.jay: Pass the defines information
8817
8818         * driver.cs: Add --define command line option.
8819
8820         * decl.cs: Move MemberCore here.
8821
8822         Make it the base class for DeclSpace.  This allows us to catch and
8823         report 108 and 109 for everything now.
8824
8825         * class.cs (TypeContainer.Define): Extract all the members
8826         before populating and emit the warning 108 (new keyword required
8827         to override) instead of having each member implement this.
8828
8829         (MemberCore.Define): New abstract method, we will be using this in
8830         the warning reporting engine in Populate.
8831         
8832         (Operator.Define): Adjust to new MemberCore protocol. 
8833
8834         * const.cs (Const): This does not derive from Expression, it is a
8835         temporary object we use to create fields, it is a MemberCore. 
8836
8837         * class.cs (Method.Define): Allow the entry point to be in a
8838         specific class.
8839
8840         * driver.cs: Rewrite the argument handler to clean it up a bit.
8841
8842         * rootcontext.cs: Made it just an auxiliary namespace feature by
8843         making everything static.
8844
8845         * driver.cs: Adapt code to use RootContext type name instead of
8846         instance variable.
8847
8848         * delegate.cs: Remove RootContext argument.
8849
8850         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8851         argument. 
8852
8853         * class.cs (Event.Define): The lookup can fail.
8854         
8855         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
8856
8857         * expression.cs: Resolve the this instance before invoking the code.
8858
8859 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
8860
8861         * cs-parser.jay: Add a production in element_access that allows
8862         the thing to become a "type" reference.  This way we can parse
8863         things like "(string [])" as a type.
8864
8865         Note that this still does not handle the more complex rules of
8866         casts. 
8867         
8868
8869         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
8870
8871         * ecore.cs: (CopyNewMethods): new utility function used to
8872         assemble the list of methods from running FindMembers.
8873
8874         (MemberLookup): Rework FindMembers so that 
8875
8876 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
8877
8878         * class.cs (TypeContainer): Remove Delegates who fail to be
8879         defined.
8880
8881         * delegate.cs (Populate): Verify that we dont get null return
8882         values.   TODO: Check for AsAccessible.
8883
8884         * cs-parser.jay: Use basename to emit error 574 (destructor should
8885         have the same name as container class), not the full name.
8886
8887         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
8888         possible representation.  
8889
8890         Also implements integer type suffixes U and L.
8891
8892 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
8893
8894         * expression.cs (ArrayCreation.DoResolve): We need to do the
8895         argument resolution *always*.
8896
8897         * decl.cs: Make this hold the namespace.  Hold the root context as
8898         well.
8899         (LookupType): Move here.
8900
8901         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
8902
8903         * location.cs (Row, Name): Fixed the code, it was always returning
8904         references to the first file.
8905
8906         * interface.cs: Register properties defined through interfaces.
8907
8908         * driver.cs: Add support for globbing on the command line
8909
8910         * class.cs (Field): Make it derive from MemberCore as well.
8911         (Event): ditto.
8912
8913 2001-12-15  Ravi Pratap  <ravi@ximian.com>
8914
8915         * class.cs (Event::Define): Check that the type of the event is a delegate
8916         type else flag error #66.
8917
8918         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
8919         same.
8920
8921         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
8922         values of EntryPoint, CharSet etc etc.
8923
8924         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
8925
8926         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
8927         be null and we should ignore this. I am not sure if this is really clean. Apparently,
8928         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
8929         which needs this to do its work.
8930
8931         * ../errors/cs0066.cs : Add.
8932
8933 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
8934
8935         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
8936         helper functions.
8937
8938         * class.cs: (MethodSignature.MethodSignature): Removed hack that
8939         clears out the parameters field.
8940         (MemberSignatureCompare): Cleanup
8941
8942         (MemberCore): New base class used to share code between MethodCore
8943         and Property.
8944
8945         (RegisterRequiredImplementations) BindingFlags.Public requires
8946         either BindingFlags.Instace or Static.  Use instance here.
8947
8948         (Property): Refactored code to cope better with the full spec.
8949
8950         * parameter.cs (GetParameterInfo): Return an empty array instead
8951         of null on error.
8952
8953         * class.cs (Property): Abstract or extern properties have no bodies.
8954
8955         * parameter.cs (GetParameterInfo): return a zero-sized array.
8956
8957         * class.cs (TypeContainer.MethodModifiersValid): Move all the
8958         method modifier validation to the typecontainer so we can reuse
8959         this on properties.
8960
8961         (MethodCore.ParameterTypes): return an empty sized array of types.
8962
8963         (Property.Define): Test property modifier validity.
8964
8965         Add tests for sealed/override too.
8966
8967         (Method.Emit): abstract or extern methods have no bodies.
8968
8969 2001-12-14  Ravi Pratap  <ravi@ximian.com>
8970
8971         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
8972         thing.
8973
8974         (Method::Define, ::Emit): Modify accordingly.
8975
8976         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
8977
8978         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
8979
8980         * makefile: Pass in /unsafe.
8981
8982 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
8983
8984         * class.cs (MakeKey): Kill routine.
8985         
8986         * class.cs (TypeContainer.Define): Correctly define explicit
8987         method implementations (they require the full interface name plus
8988         the method name).
8989
8990         * typemanager.cs: Deply the PtrHashtable here and stop using the
8991         lame keys.  Things work so much better.
8992
8993         This of course broke everyone who depended on `RegisterMethod' to
8994         do the `test for existance' test.  This has to be done elsewhere.
8995
8996         * support.cs (PtrHashtable): A hashtable that avoid comparing with
8997         the object stupid Equals method (because, that like fails all over
8998         the place).  We still do not use it.
8999
9000         * class.cs (TypeContainer.SetRequiredInterface,
9001         TypeContainer.RequireMethods): Killed these two routines and moved
9002         all the functionality to RegisterRequiredImplementations.
9003
9004         (TypeContainer.RegisterRequiredImplementations): This routine now
9005         registers all the implementations required in an array for the
9006         interfaces and abstract methods.  We use an array of structures
9007         which can be computed ahead of time to reduce memory usage and we
9008         also assume that lookups are cheap as most classes will not
9009         implement too many interfaces.
9010
9011         We also avoid creating too many MethodSignatures.
9012
9013         (TypeContainer.IsInterfaceMethod): Update and optionally does not
9014         clear the "pending" bit if we find that there are problems with
9015         the declaration.
9016
9017         (TypeContainer.VerifyPendingMethods): Update to report errors of
9018         methods that look like implementations but are not.
9019
9020         (TypeContainer.Define): Add support for explicit interface method
9021         implementation. 
9022         
9023 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
9024
9025         * typemanager.cs: Keep track of the parameters here instead of
9026         being a feature of the TypeContainer.
9027
9028         * class.cs: Drop the registration of parameters here, as
9029         InterfaceMethods are also interface declarations.
9030
9031         * delegate.cs: Register methods with the TypeManager not only with
9032         the TypeContainer.  This code was buggy.
9033
9034         * interface.cs: Full registation here.
9035
9036 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
9037
9038         * expression.cs: Remove reducer for binary expressions, it can not
9039         be done this way.
9040
9041         * const.cs: Put here the code that used to go into constant.cs
9042
9043         * constant.cs: Put here the code for constants, this is a new base
9044         class for Literals.
9045
9046         * literal.cs: Make Literal derive from Constant.
9047
9048 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
9049
9050         * statement.cs (Return.Emit): Report error 157 if the user
9051         attempts to return from a finally block.
9052
9053         (Return.Emit): Instead of emitting a return, jump to the end of
9054         the function.
9055
9056         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9057         LocalBuilder to store the result of the function.  ReturnLabel is
9058         the target where we jump.
9059         
9060
9061 2001-12-09  Radek Doulik  <rodo@ximian.com>
9062
9063         * cs-parser.jay: remember alias in current namespace
9064
9065         * ecore.cs (SimpleName::DoResolve): use aliases for types or
9066         namespaces
9067
9068         * class.cs (LookupAlias): lookup alias in my_namespace
9069
9070         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9071         aliases hashtable
9072         (LookupAlias): lookup alias in this and if needed in parent
9073         namespaces
9074
9075 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
9076
9077         * support.cs: 
9078
9079         * rootcontext.cs: (ModuleBuilder) Made static, first step into
9080         making things static.  I need this to avoid passing the
9081         TypeContainer when calling ParameterType.
9082
9083         * support.cs (InternalParameters.ParameterType): Remove ugly hack
9084         that did string manipulation to compute the type and then call
9085         GetType.  Use Parameter.ParameterType instead.
9086
9087         * cs-tokenizer.cs: Consume the suffix for floating values.
9088
9089         * expression.cs (ParameterReference): figure out whether this is a
9090         reference parameter or not.  Kill an extra variable by computing
9091         the arg_idx during emission.
9092
9093         * parameter.cs (Parameters.GetParameterInfo): New overloaded
9094         function that returns whether a parameter is an out/ref value or not.
9095
9096         (Parameter.ParameterType): The type of the parameter (base,
9097         without ref/out applied).
9098         
9099         (Parameter.Resolve): Perform resolution here.
9100         (Parameter.ExternalType): The full type (with ref/out applied).
9101
9102         * statement.cs (Using.Emit, Using.EmitExpression): Implement
9103         support for expressions on the using statement.
9104
9105 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
9106
9107         * statement.cs (Using.EmitLocalVariableDecls): Split the
9108         localvariable handling of the using statement.
9109
9110         (Block.EmitMeta): Keep track of variable count across blocks.  We
9111         were reusing slots on separate branches of blocks.
9112
9113         (Try.Emit): Emit the general code block, we were not emitting it. 
9114
9115         Check the type of the declaration to be an IDisposable or
9116         something that can be implicity converted to it. 
9117
9118         Emit conversions if required.
9119
9120         * ecore.cs (EmptyExpression): New utility class.
9121         (Expression.ImplicitConversionExists): New utility function.
9122
9123 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
9124
9125         * statement.cs (Using): Implement.
9126
9127         * expression.cs (LocalVariableReference): Support read only variables.
9128
9129         * statement.cs: Remove the explicit emit for the Leave opcode.
9130         (VariableInfo): Add a readonly field.
9131
9132 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
9133
9134         * ecore.cs (ConvCast): new class used to encapsulate the various
9135         explicit integer conversions that works in both checked and
9136         unchecked contexts.
9137
9138         (Expression.ConvertNumericExplicit): Use new ConvCast class to
9139         properly generate the overflow opcodes.
9140
9141 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9142
9143         * statement.cs: The correct type for the EmptyExpression is the
9144         element_type, not the variable type.  Ravi pointed this out.
9145
9146 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9147
9148         * class.cs (Method::Define): Handle PInvoke methods specially
9149         by using DefinePInvokeMethod instead of the usual one.
9150
9151         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9152         above to do the task of extracting information and defining the method.
9153         
9154 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9155
9156         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9157         of the condition for string type.
9158
9159         (Emit): Move that here. 
9160
9161         (ArrayCreation::CheckIndices): Keep string literals in their expression
9162         form.
9163
9164         (EmitDynamicInitializers): Handle strings appropriately.
9165
9166 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9167
9168         * codegen.cs (EmitContext): Replace multiple variables with a
9169         single pointer to the current Switch statement.
9170
9171         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9172         EmitContext.
9173
9174 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9175
9176         * statement.cs 
9177
9178         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9179         default'.
9180         
9181         (Foreach.Emit): Foreach on arrays was not setting
9182         up the loop variables (for break/continue).
9183
9184         (GotoCase): Semi-implented.
9185         
9186 2001-12-03  Ravi Pratap  <ravi@ximian.com>
9187
9188         * attribute.cs (CheckAttribute): Handle system attributes by using
9189         Attribute.GetAttributes to examine information we need.
9190
9191         (GetValidPlaces): Same here.
9192
9193         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9194
9195         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9196
9197         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9198
9199         (Method::Define): Set appropriate flags if we have a DllImport attribute.
9200
9201         (Method::Emit): Handle the case when we are a PInvoke method.
9202
9203 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9204
9205         * expression.cs: Use ResolveWithSimpleName on compound names.
9206
9207 2001-12-02  Ravi Pratap  <ravi@ximian.com>
9208
9209         * constant.cs (EmitConstant): Make sure we resolve the associated expression
9210         before trying to reduce it.
9211
9212         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9213
9214         * constant.cs (LookupConstantValue): Implement.
9215
9216         (EmitConstant): Use the above in emitting the constant.
9217
9218         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9219         that are user-defined by doing a LookupConstantValue on them.
9220
9221         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9222         too, like above.
9223
9224 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
9225
9226         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9227
9228         (BaseAccess.DoResolve): Implement.
9229
9230         (MemberAccess.DoResolve): Split this routine into a
9231         ResolveMemberAccess routine that can be used independently
9232
9233 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
9234
9235         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9236         As that share bits of the implementation.  Is returns a boolean,
9237         while As returns the Type that is being probed.
9238
9239 2001-12-01  Ravi Pratap  <ravi@ximian.com>
9240
9241         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9242         instead of a Literal - much easier.
9243
9244         (EnumInTransit): Remove - utterly useless :-)
9245
9246         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9247
9248         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9249
9250         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9251         chain when we have no associated expression.
9252
9253 2001-11-30  Ravi Pratap  <ravi@ximian.com>
9254
9255         * constant.cs (Define): Use Location while reporting the errror.
9256
9257         Also emit a warning when 'new' is used and there is no inherited
9258         member to hide.
9259
9260         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
9261         populated.
9262
9263         (LookupEnumValue): Implement to lookup an enum member's value and define it
9264         if necessary.
9265
9266         (Populate): Re-write accordingly to use the above routine.
9267
9268 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
9269
9270         * expression.cs (This): Fix prototype for DoResolveLValue to
9271         override the base class DoResolveLValue.
9272
9273         * cs-parser.cs: Report errors cs574 and cs575 (destructor
9274         declarations) 
9275
9276         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9277         (we need to load the address of the field here).  This fixes
9278         test-22. 
9279         
9280         (FieldExpr.DoResolveLValue): Call the DoResolve
9281         function to initialize the Instance expression.
9282         
9283         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9284         correctly the GetEnumerator operation on a value type.
9285
9286         * cs-parser.jay: Add more simple parsing error catches.
9287
9288         * statement.cs (Switch): Add support for string switches.
9289         Handle null specially.
9290
9291         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
9292
9293 2001-11-28  Ravi Pratap  <ravi@ximian.com>
9294
9295         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9296
9297         (declare_local_constant): New helper function.
9298
9299         * statement.cs (AddConstant): Keep a separate record of constants
9300
9301         (IsConstant): Implement to determine if a variable is a constant.
9302
9303         (GetConstantExpression): Implement.
9304
9305         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9306
9307         * statement.cs (IsVariableDefined): Re-write.
9308
9309 2001-11-27  Ravi Pratap  <ravi@ximian.com>
9310
9311         * class.cs (TypeContainer::FindMembers): Look for constants
9312         in the case when we are looking for MemberTypes.Field
9313
9314         * expression.cs (MemberAccess::DoResolve): Check that in the
9315         case we are a FieldExpr and a Literal, we are not being accessed
9316         by an instance reference.
9317
9318         * cs-parser.jay (local_constant_declaration): Implement.
9319
9320         (declaration_statement): Implement for constant declarations.
9321
9322 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
9323
9324         * statement.cs (Switch): Catch double defaults.
9325
9326         (Switch): More work on the switch() statement
9327         implementation.  It works for integral values now, need to finish
9328         string support.
9329
9330
9331 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9332
9333         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9334         integer literals into other integer literals.  To be used by
9335         switch. 
9336
9337 2001-11-24  Ravi Pratap  <ravi@ximian.com>
9338
9339         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9340         some memory.
9341
9342         (EmitDynamicInitializers): Cope with the above since we extract data
9343         directly from ArrayData now.
9344
9345         (ExpectInitializers): Keep track of whether initializers are mandatory
9346         or not.
9347
9348         (Bounds): Make it a hashtable to prevent the same dimension being 
9349         recorded for every element in that dimension.
9350
9351         (EmitDynamicInitializers): Fix bug which prevented the Set array method
9352         from being found.
9353
9354         Also fix bug which was causing the indices to be emitted in the reverse
9355         order.
9356
9357 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9358
9359         * expression.cs (ArrayCreation): Implement the bits that Ravi left
9360         unfinished.  They do not work, because the underlying code is
9361         sloppy.
9362
9363 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9364
9365         * cs-parser.jay: Remove bogus fixme.
9366
9367         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9368         on Switch statement.
9369         
9370 2001-11-23  Ravi Pratap  <ravi@ximian.com>
9371
9372         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9373         the same. 
9374         
9375         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9376         parameter. Apparently, any expression is allowed. 
9377
9378         (ValidateInitializers): Update accordingly.
9379
9380         (CheckIndices): Fix some tricky bugs thanks to recursion.
9381
9382         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
9383         I was being completely brain-dead.
9384
9385         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9386         and re-write acordingly.
9387
9388         (DelegateInvocation): Re-write accordingly.
9389
9390         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9391
9392         (MakeByteBlob): Handle types more correctly.
9393
9394         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9395         initialization from expressions but it is incomplete because I am a complete
9396         Dodo :-|
9397
9398 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9399
9400         * statement.cs (If.Emit): Fix a bug that generated incorrect code
9401         on If.  Basically, we have to return `true' (ie, we do return to
9402         our caller) only if both branches of the if return.
9403
9404         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9405         short-circuit operators, handle them as short circuit operators. 
9406
9407         (Cast.DoResolve): Resolve type.
9408         (Cast.Cast): Take an expression as the target type.
9409
9410         * cs-parser.jay (cast_expression): Remove old hack that only
9411         allowed a limited set of types to be handled.  Now we take a
9412         unary_expression and we resolve to a type during semantic
9413         analysis.
9414
9415         Use the grammar productions from Rhys to handle casts (this is
9416         not complete like Rhys syntax yet, we fail to handle that corner
9417         case that C# has regarding (-x), but we will get there.
9418         
9419 2001-11-22  Ravi Pratap  <ravi@ximian.com>
9420
9421         * class.cs (EmitFieldInitializer): Take care of the case when we have a
9422         field which is an array type.
9423
9424         * cs-parser.jay (declare_local_variables): Support array initialization too.
9425
9426         * typemanager.cs (MakeKey): Implement.
9427
9428         (everywhere): Use the above appropriately.
9429
9430         * cs-parser.jay (for_statement): Update for array initialization while
9431         declaring variables.
9432
9433         * ecore.cs : The error message was correct, it's the variable's names that
9434         were misleading ;-) Make the code more readable.
9435
9436         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9437         the correct type etc.
9438
9439         (ConvertExplicit): Handle Enum types by examining the underlying type.
9440
9441 2001-11-21  Ravi Pratap  <ravi@ximian.com>
9442
9443         * parameter.cs (GetCallingConvention): Always return
9444         CallingConventions.Standard for now.
9445
9446 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9447
9448         * expression.cs (Binary.ResolveOperator): Update the values of `l'
9449         and `r' after calling DoNumericPromotions.
9450
9451         * ecore.cs: Fix error message (the types were in the wrong order).
9452
9453         * statement.cs (Foreach.ProbeCollectionType): Need to pass
9454         BindingFlags.Instance as well 
9455
9456         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9457         implicit int literal conversion in an empty cast so that we
9458         propagate the right type upstream.
9459
9460         (UnboxCast): new class used to unbox value types.
9461         (Expression.ConvertExplicit): Add explicit type conversions done
9462         by unboxing.
9463
9464         (Expression.ImplicitNumericConversion): Oops, forgot to test for
9465         the target type before applying the implicit LongLiterals to ULong
9466         literal cast.
9467
9468 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
9469
9470         * cs-parser.jay (for_statement): Reworked the way For works: now
9471         we declare manually any variables that are introduced in
9472         for_initializer to solve the problem of having out-of-band code
9473         emition (that is what got for broken).
9474
9475         (declaration_statement): Perform the actual variable declaration
9476         that used to be done in local_variable_declaration here.
9477
9478         (local_variable_declaration): Do not declare anything, just pass
9479         the information on a DictionaryEntry
9480
9481 2001-11-20  Ravi Pratap  <ravi@ximian.com>
9482
9483         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9484         re-write of the logic to now make it recursive.
9485
9486         (UpdateIndices): Re-write accordingly.
9487
9488         Store element data in a separate ArrayData list in the above methods.
9489
9490         (MakeByteBlob): Implement to dump the array data into a byte array.
9491
9492 2001-11-19  Ravi Pratap  <ravi@ximian.com>
9493
9494         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9495         into CheckIndices.
9496
9497         * constant.cs (Define): Implement.
9498
9499         (EmitConstant): Re-write fully.
9500
9501         Pass in location info.
9502
9503         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9504         respectively.
9505
9506         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9507         DictionaryEntry since we need location info too.
9508
9509         (constant_declaration): Update accordingly.
9510
9511         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9512         code into another method : UpdateIndices.
9513
9514 2001-11-18  Ravi Pratap  <ravi@ximian.com>
9515
9516         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9517         some type checking etc.
9518
9519 2001-11-17  Ravi Pratap  <ravi@ximian.com>
9520
9521         * expression.cs (ArrayCreation::ValidateInitializers): Implement
9522         bits to provide dimension info if the user skips doing that.
9523
9524         Update second constructor to store the rank correctly.
9525
9526 2001-11-16  Ravi Pratap  <ravi@ximian.com>
9527
9528         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9529         and try to implement.
9530
9531         * ../errors/cs0150.cs : Add.
9532
9533         * ../errors/cs0178.cs : Add.
9534
9535 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
9536
9537         * statement.cs: Implement foreach on multi-dimensional arrays. 
9538
9539         * parameter.cs (Parameters.GetParameterByName): Also lookup the
9540         name of the params argument.
9541
9542         * expression.cs: Use EmitStoreOpcode to get the right opcode while
9543         initializing the array.
9544
9545         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9546         we can use this elsewhere.
9547
9548         * statement.cs: Finish implementation of foreach for single
9549         dimension arrays.
9550
9551         * cs-parser.jay: Use an out-of-band stack to pass information
9552         around, I wonder why I need this.
9553
9554         foreach_block: Make the new foreach_block the current_block.
9555
9556         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9557         function used to return a static Parameters structure.  Used for
9558         empty parameters, as those are created very frequently.
9559
9560         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9561
9562 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9563
9564         * interface.cs : Default modifier is private, not public. The
9565         make verify test passes again.
9566
9567 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9568
9569         * support.cs (ReflectionParameters): Fix logic to determine
9570         whether the last parameter is a params one. Test 9 passes again.
9571
9572         * delegate.cs (Populate): Register the builders we define with
9573         RegisterParameterForBuilder. Test 19 passes again.
9574
9575         * cs-parser.jay (property_declaration): Reference $6 instead
9576         of $$ to get at the location.
9577
9578         (indexer_declaration): Similar stuff.
9579
9580         (attribute): Ditto.
9581
9582         * class.cs (Property): Register parameters for the Get and Set methods
9583         if they exist. Test 23 passes again.
9584
9585         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9586         call to EmitArguments as we are sure there aren't any params arguments. 
9587         Test 32 passes again.
9588
9589         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9590         IndexOutOfRangeException. 
9591
9592         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9593         Test 33 now passes again.
9594         
9595 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
9596
9597         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9598         broke a bunch of things.  Will have to come up with a better way
9599         of tracking locations.
9600
9601         * statement.cs: Implemented foreach for single dimension arrays.
9602
9603 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9604
9605         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9606         an error.  This removes the lookup from the critical path.
9607
9608         * cs-parser.jay: Removed use of temporary_loc, which is completely
9609         broken. 
9610
9611 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
9612
9613         * support.cs (ReflectionParameters.ParameterModifier): Report
9614         whether the argument is a PARAMS argument or not.
9615
9616         * class.cs: Set the attribute `ParamArrayAttribute' on the
9617         parameter argument.
9618
9619         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9620         and cons_param_array_attribute (ConstructorInfo for
9621         ParamArrayAttribute)., 
9622
9623         * codegen.cs: Emit the return using the `Return' statement, that
9624         way we can report the error correctly for missing return values. 
9625
9626         * class.cs (Method.Emit): Clean up.
9627
9628         * expression.cs (Argument.Resolve): Take another argument: the
9629         location where this argument is used.  Notice that this is not
9630         part of the "Argument" class as to reduce the size of the
9631         structure (we know the approximate location anyways).
9632
9633         Test if the argument is a variable-reference, if not, then
9634         complain with a 206.
9635
9636         (Argument.Emit): Emit addresses of variables.
9637
9638         (Argument.FullDesc): Simplify.
9639
9640         (Invocation.DoResolve): Update for Argument.Resolve.
9641
9642         (ElementAccess.DoResolve): ditto.
9643
9644         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9645         method should be virtual, as this method is always virtual.
9646
9647         (NewDelegate.DoResolve): Update for Argument.Resolve.
9648
9649         * class.cs (ConstructorInitializer.DoResolve): ditto.
9650         
9651         * attribute.cs (Attribute.Resolve): ditto.
9652
9653 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
9654
9655         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9656
9657         * expression.cs (ParameterReference): Drop IStackStorage and implement
9658         IAssignMethod instead. 
9659
9660         (LocalVariableReference): ditto.
9661         
9662         * ecore.cs (FieldExpr): Drop IStackStorage and implement
9663         IAssignMethod instead. 
9664
9665 2001-11-13  Miguel de Icaza <miguel@ximian.com>
9666
9667         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9668         enumerations that are used in heavily used structures derive from
9669         byte in a laughable and pathetic attempt to reduce memory usage.
9670         This is the kind of pre-optimzations that you should not do at
9671         home without adult supervision.
9672
9673         * expression.cs (UnaryMutator): New class, used to handle ++ and
9674         -- separatedly from the other unary operators.  Cleans up the
9675         code, and kills the ExpressionStatement dependency in Unary.
9676
9677         (Unary): Removed `method' and `Arguments' from this class, making
9678         it smaller, and moving it all to SimpleCall, so I can reuse this
9679         code in other locations and avoid creating a lot of transient data
9680         strucutres when not required.
9681
9682         * cs-parser.jay: Adjust for new changes.
9683
9684 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
9685
9686         * enum.cs (Enum.Populate): If there is a failure during
9687         definition, return
9688
9689         * cs-parser.jay (opt_enum_base): we used to catch type errors
9690         here, but this is really incorrect.  The type error should be
9691         catched during semantic analysis.
9692
9693 2001-12-11  Ravi Pratap  <ravi@ximian.com>
9694
9695         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9696         current_local_parameters as expected since I, in my stupidity, had forgotten
9697         to do this :-)
9698
9699         * attribute.cs (GetValidPlaces): Fix stupid bug.
9700
9701         * class.cs (Method::Emit): Perform check on applicability of attributes.
9702
9703         (Constructor::Emit): Ditto.
9704
9705         (Field::Emit): Ditto.
9706
9707         (Field.Location): Store location information.
9708
9709         (Property, Event, Indexer, Operator): Ditto.
9710
9711         * cs-parser.jay (field_declaration): Pass in location for each field.
9712
9713         * ../errors/cs0592.cs : Add.
9714
9715 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9716
9717         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9718
9719         (InitCoreTypes): Update accordingly.
9720
9721         (RegisterAttrType, LookupAttr): Implement.
9722
9723         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9724         info about the same.
9725
9726         (Resolve): Update to populate the above as necessary.
9727
9728         (Error592): Helper.
9729
9730         (GetValidPlaces): Helper to the above.
9731
9732         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9733
9734         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9735
9736 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9737
9738         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9739
9740         * ../errors/cs0617.cs : Add.
9741
9742 2001-11-11  Ravi Pratap  <ravi@ximian.com>
9743
9744         * enum.cs (Emit): Rename to Populate to be more consistent with what
9745         we expect it to do and when exactly it is called.
9746
9747         * class.cs, rootcontext.cs : Update accordingly.
9748
9749         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9750         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9751
9752         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9753
9754         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9755         of a fieldinfo using the above, when dealing with a FieldBuilder.
9756
9757 2001-11-10  Ravi Pratap  <ravi@ximian.com>
9758
9759         * ../errors/cs0031.cs : Add.
9760
9761         * ../errors/cs1008.cs : Add.
9762
9763         * ../errrors/cs0543.cs : Add.
9764
9765         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9766         enum type.
9767
9768         (FindMembers): Implement.
9769
9770         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9771         enums and delegates too.
9772
9773         (enum_types): Rename to builder_to_enum.
9774
9775         (delegate_types): Rename to builder_to_delegate.
9776
9777         * delegate.cs (FindMembers): Implement.
9778
9779 2001-11-09  Ravi Pratap  <ravi@ximian.com>
9780
9781         * typemanager.cs (IsEnumType): Implement.
9782
9783         * enum.cs (Emit): Re-write parts to account for the underlying type
9784         better and perform checking etc.
9785
9786         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9787         of the underlying type.
9788
9789         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9790         value
9791
9792         * enum.cs (error31): Helper to report error #31.
9793
9794         * cs-parser.jay (enum_declaration): Store location of each member too.
9795
9796         * enum.cs (member_to_location): New hashtable. 
9797
9798         (AddEnumMember): Update location hashtable.
9799
9800         (Emit): Use the location of each member while reporting errors.
9801
9802 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9803
9804         * cs-parser.jay: A for_initializer if is a
9805         local_variable_declaration really ammount to have an implicit
9806         block with the variable declaration and no initializer for for.
9807
9808         * statement.cs (For.Emit): Cope with null initializers.
9809
9810         This fixes the infinite loop on for initializers.
9811
9812 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
9813
9814         * enum.cs: More cleanup.
9815
9816         * ecore.cs: Remove dead code.
9817
9818         * class.cs (Property.Emit): More simplification.
9819         (Event.Emit): ditto.
9820
9821         Reworked to have less levels of indentation.
9822         
9823 2001-11-08  Ravi Pratap  <ravi@ximian.com>
9824
9825         * class.cs (Property): Emit attributes.
9826
9827         (Field): Ditto.
9828         
9829         (Event): Ditto.
9830
9831         (Indexer): Ditto.
9832
9833         (Operator): Ditto.
9834
9835         * enum.cs (Emit): Ditto.
9836
9837         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9838         Enums too.
9839
9840         * class.cs (Field, Event, etc.): Move attribute generation into the
9841         Emit method everywhere.
9842
9843         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9844         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9845         as we had no way of defining nested enums !
9846
9847         * rootcontext.cs : Adjust code accordingly.
9848
9849         * typemanager.cs (AddEnumType): To keep track of enum types separately.
9850
9851 2001-11-07  Ravi Pratap  <ravi@ximian.com>
9852
9853         * expression.cs (EvalConstantExpression): Move into ecore.cs
9854         
9855         * enum.cs (Enum): Rename some members and make them public and readonly
9856         according to our convention.
9857
9858         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9859         nothing else.
9860
9861         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9862
9863         (Enum::Emit): Write a simple version for now which doesn't try to compute
9864         expressions. I shall modify this to be more robust in just a while.
9865
9866         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9867
9868         (TypeContainer::CloseType): Create the Enum types too.
9869
9870         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9871
9872         * expression.cs (EvalConstantExpression): Get rid of completely.
9873
9874         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9875         user-defined values and other cases.
9876
9877         (IsValidEnumLiteral): Helper function.
9878
9879         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
9880         out there in the case we had a literal FieldExpr.
9881
9882         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9883
9884         (Literalize): Revamp a bit to take two arguments.
9885         
9886         (EnumLiteral): New class which derives from Literal to wrap enum literals.
9887         
9888 2001-11-06  Ravi Pratap  <ravi@ximian.com>
9889
9890         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
9891
9892         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
9893
9894         (Resolve): Use the above to ensure we have proper initializers.
9895
9896 2001-11-05  Ravi Pratap  <ravi@ximian.com>
9897
9898         * expression.cs (Expression::EvalConstantExpression): New method to 
9899         evaluate constant expressions.
9900
9901         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
9902
9903 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
9904
9905         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
9906         in an array.
9907
9908         (Binary.ResolveOperator): Handle operator != (object a, object b)
9909         and operator == (object a, object b);
9910
9911         (Binary.DoNumericPromotions): Indicate whether the numeric
9912         promotion was possible.
9913
9914         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
9915         Implement.  
9916
9917         Made the ArrayAccess implement interface IAssignMethod instead of
9918         IStackStore as the order in which arguments are passed reflects
9919         this.
9920
9921         * assign.cs: Instead of using expr.ExprClass to select the way of
9922         assinging, probe for the IStackStore/IAssignMethod interfaces.
9923
9924         * typemanager.cs: Load InitializeArray definition.
9925
9926         * rootcontext.cs (RootContext.MakeStaticData): Used to define
9927         static data that can be used to initialize arrays. 
9928
9929 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
9930
9931         * expression.cs: Handle operator== and operator!= for booleans.
9932
9933         (Conditioal.Reduce): Implement reducer for the ?: operator.
9934
9935         (Conditional.Resolve): Implement dead code elimination.
9936
9937         (Binary.Resolve): Catch string literals and return a new
9938         concatenated string.
9939
9940         (Unary.Reduce): Implement reduction of unary expressions.
9941
9942         * ecore.cs: Split out the expression core handling here.
9943
9944         (Expression.Reduce): New method used to perform constant folding
9945         and CSE.  This is needed to support constant-expressions. 
9946         
9947         * statement.cs (Statement.EmitBoolExpression): Pass true and false
9948         targets, and optimize for !x.
9949
9950 2001-11-04  Ravi Pratap  <ravi@ximian.com>
9951
9952         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
9953         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
9954         set custom atttributes.
9955
9956         * literal.cs (Literal::GetValue): New abstract method to return the actual
9957         value of the literal, cast as an object.
9958
9959         (*Literal): Implement GetValue method.
9960
9961         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
9962         expressions to the arraylist but objects of type Argument.
9963
9964         * class.cs (TypeContainer::Emit): Emit our attributes too.
9965
9966         (Method::Emit, Constructor::Emit): Ditto.
9967
9968         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
9969         to be ignoring earlier.
9970
9971 2001-11-03  Ravi Pratap  <ravi@ximian.com>
9972
9973         * attribute.cs (AttributeSection::Define): Implement to do the business
9974         of constructing a CustomAttributeBuilder.
9975
9976         (Attribute): New trivial class. Increases readability of code.  
9977
9978         * cs-parser.jay : Update accordingly.
9979
9980         (positional_argument_list, named_argument_list, named_argument): New rules
9981
9982         (attribute_arguments): Use the above so that we are more correct.
9983         
9984 2001-11-02  Ravi Pratap  <ravi@ximian.com>
9985         
9986         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
9987         to perform all checks for a method with a params parameter.
9988
9989         (Invocation::OverloadResolve): Update to use the above method and therefore
9990         cope correctly with params method invocations.
9991
9992         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
9993         params too.
9994
9995         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
9996         constructors in our parent too because we can't afford to miss out on 
9997         protected ones ;-)
9998
9999         * attribute.cs (AttributeSection): New name for the class Attribute
10000
10001         Other trivial changes to improve readability.
10002
10003         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10004         use the new class names.
10005         
10006 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10007
10008         * class.cs (Method::Define): Complete definition for params types too
10009
10010         (Indexer::Define): Ditto.
10011
10012         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10013         Cope everywhere with a request for info about the array parameter.
10014
10015 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10016
10017         * tree.cs (RecordNamespace): Fix up to check for the correct key.
10018
10019         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
10020         local_variable_type to extract the string corresponding to the type.
10021
10022         (local_variable_type): Fixup the action to use the new helper method.
10023
10024         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
10025         go.
10026
10027         * expression.cs : Clean out code which uses the above.
10028
10029 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10030         
10031         * typemanager.cs (RegisterMethod): Check if we already have an existing key
10032         and bale out if necessary by returning a false.
10033
10034         (RegisterProperty): Ditto.
10035
10036         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10037         and print out appropriate error messages.
10038
10039         * interface.cs (everywhere): Ditto.
10040
10041         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10042         location to constructor.
10043
10044         * class.cs (Property, Event, Indexer): Update accordingly.
10045
10046         * ../errors/cs111.cs : Added.
10047
10048         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10049         of a method, as laid down by the spec.
10050
10051         (Invocation::OverloadResolve): Use the above method.
10052
10053 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10054
10055         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10056         now take a TypeContainer and a Parameters object.
10057
10058         (ParameterData): Modify return type of ParameterModifier method to be 
10059         Parameter.Modifier and not a string.
10060
10061         (ReflectionParameters, InternalParameters): Update accordingly.
10062
10063         * expression.cs (Argument::GetParameterModifier): Same here.
10064
10065         * support.cs (InternalParameters::ParameterType): Find a better way of determining
10066         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10067         symbol in it at all so maybe this is only for now.
10068
10069 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10070
10071         * support.cs (InternalParameters): Constructor now takes an extra argument 
10072         which is the actual Parameters class.
10073
10074         (ParameterDesc): Update to provide info on ref/out modifiers.
10075
10076         * class.cs (everywhere): Update call to InternalParameters to pass in
10077         the second argument too.
10078
10079         * support.cs (ParameterData): Add ParameterModifier, which is a method 
10080         to return the modifier info [ref/out etc]
10081
10082         (InternalParameters, ReflectionParameters): Implement the above.
10083
10084         * expression.cs (Argument::ParameterModifier): Similar function to return
10085         info about the argument's modifiers.
10086
10087         (Invocation::OverloadResolve): Update to take into account matching modifiers 
10088         too.
10089
10090         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10091         a new SetFormalParameters object which we pass to InternalParameters.
10092
10093 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10094
10095         * expression.cs (NewArray): Merge into the ArrayCreation class.
10096
10097 2001-10-29  Ravi Pratap  <ravi@ximian.com>
10098
10099         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
10100         NewUserdefinedArray into one as there wasn't much of a use in having
10101         two separate ones.
10102
10103         * expression.cs (Argument): Change field's name to ArgType from Type.
10104
10105         (Type): New readonly property which returns the proper type, taking into 
10106         account ref/out modifiers.
10107
10108         (everywhere): Adjust code accordingly for the above.
10109
10110         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
10111         whether we are emitting for a ref or out parameter.
10112
10113         * expression.cs (Argument::Emit): Use the above field to set the state.
10114
10115         (LocalVariableReference::Emit): Update to honour the flag and emit the
10116         right stuff.
10117
10118         * parameter.cs (Attributes): Set the correct flags for ref parameters.
10119
10120         * expression.cs (Argument::FullDesc): New function to provide a full desc.
10121
10122         * support.cs (ParameterData): Add method ParameterDesc to the interface.
10123
10124         (ReflectionParameters, InternalParameters): Implement the above method.
10125
10126         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10127         reporting errors.
10128
10129         (Invocation::FullMethodDesc): Ditto. 
10130
10131 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
10132
10133         * cs-parser.jay: Add extra production for the second form of array
10134         creation. 
10135
10136         * expression.cs (ArrayCreation): Update to reflect the above
10137         change. 
10138
10139         * Small changes to prepare for Array initialization.
10140
10141 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
10142
10143         * typemanager.cs (ImplementsInterface): interface might be null;
10144         Deal with this problem;
10145
10146         Also, we do store negative hits on the cache (null values), so use
10147         this instead of calling t.GetInterfaces on the type everytime.
10148
10149 2001-10-28  Ravi Pratap  <ravi@ximian.com>
10150
10151         * typemanager.cs (IsBuiltinType): New method to help determine the same.
10152
10153         * expression.cs (New::DoResolve): Get rid of array creation code and instead
10154         split functionality out into different classes.
10155
10156         (New::FormArrayType): Move into NewBuiltinArray.
10157
10158         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10159         quite useless.
10160
10161         (NewBuiltinArray): New class to handle creation of built-in arrays.
10162
10163         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10164         account creation of one-dimensional arrays.
10165
10166         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10167
10168         (NewUserdefinedArray::DoResolve): Implement.
10169
10170         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10171
10172         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10173         we maintain inside the TypeManager. This is necessary to perform lookups on the
10174         module builder.
10175
10176         (LookupType): Update to perform GetType on the module builders too.     
10177
10178         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10179
10180         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10181
10182 2001-10-23  Ravi Pratap  <ravi@ximian.com>
10183
10184         * expression.cs (New::DoResolve): Implement guts of array creation.
10185
10186         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10187         
10188 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
10189
10190         * expression.cs: Fix bug I introduced lsat night that broke
10191         Delegates. 
10192
10193         (Expression.Resolve): Report a 246 error (can not resolve name)
10194         if we find a SimpleName in the stream.
10195         
10196         (Expression.ResolveLValue): Ditto.
10197         
10198         (Expression.ResolveWithSimpleName): This function is a variant of
10199         ResolveName, this one allows SimpleNames to be returned without a
10200         warning.  The only consumer of SimpleNames is MemberAccess
10201
10202 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
10203
10204         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10205         might arrive here.  I have my doubts that this is correct.
10206
10207         * statement.cs (Lock): Implement lock statement.
10208
10209         * cs-parser.jay: Small fixes to support `lock' and `using'
10210
10211         * cs-tokenizer.cs: Remove extra space
10212
10213         * driver.cs: New flag --checked, allows to turn on integer math
10214         checking. 
10215
10216         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10217         Threading.Monitor.Exit 
10218         
10219 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
10220
10221         * expression.cs (IndexerAccess::DoResolveLValue): Set the
10222         Expression Class to be IndexerAccess.
10223
10224         Notice that Indexer::DoResolve sets the eclass to Value.
10225
10226 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
10227
10228         * class.cs (TypeContainer::Emit): Emit code for indexers.
10229
10230         * assign.cs (IAssignMethod): New interface implemented by Indexers
10231         and Properties for handling assignment.
10232
10233         (Assign::Emit): Simplify and reuse code. 
10234         
10235         * expression.cs (IndexerAccess, PropertyExpr): Implement
10236         IAssignMethod, clean up old code. 
10237
10238 2001-10-22  Ravi Pratap  <ravi@ximian.com>
10239
10240         * typemanager.cs (ImplementsInterface): New method to determine if a type
10241         implements a given interface. Provides a nice cache too.
10242
10243         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10244         method.
10245
10246         (ConvertReferenceExplicit): Ditto.
10247
10248         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
10249         various methods, with correct names etc.
10250
10251         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
10252         Operator.UnaryNegation.
10253
10254         * cs-parser.jay (operator_declarator): Be a little clever in the case where
10255         we have a unary plus or minus operator.
10256
10257         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
10258         UnaryMinus.
10259
10260         * everywhere : update accordingly.
10261
10262         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10263         respectively.
10264
10265         * class.cs (Method::Define): For the case where we are implementing a method
10266         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
10267         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10268         
10269 2001-10-21  Ravi Pratap  <ravi@ximian.com>
10270
10271         * interface.cs (FindMembers): Implement to work around S.R.E
10272         lameness.
10273
10274         * typemanager.cs (IsInterfaceType): Implement.
10275
10276         (FindMembers): Update to handle interface types too.
10277
10278         * expression.cs (ImplicitReferenceConversion): Re-write bits which
10279         use IsAssignableFrom as that is not correct - it doesn't work.
10280
10281         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10282         and accordingly override EmitStatement.
10283
10284         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10285         using the correct logic :-)
10286
10287 2001-10-19  Ravi Pratap  <ravi@ximian.com>
10288
10289         * ../errors/cs-11.cs : Add to demonstrate error -11 
10290
10291 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
10292
10293         * assign.cs (Assign::Resolve): Resolve right hand side first, and
10294         then pass this as a hint to ResolveLValue.
10295         
10296         * expression.cs (FieldExpr): Add Location information
10297
10298         (FieldExpr::LValueResolve): Report assignment to readonly
10299         variable. 
10300         
10301         (Expression::ExprClassFromMemberInfo): Pass location information.
10302
10303         (Expression::ResolveLValue): Add new method that resolves an
10304         LValue. 
10305
10306         (Expression::DoResolveLValue): Default invocation calls
10307         DoResolve. 
10308
10309         (Indexers): New class used to keep track of indexers in a given
10310         Type. 
10311
10312         (IStackStore): Renamed from LValue, as it did not really describe
10313         what this did.  Also ResolveLValue is gone from this interface and
10314         now is part of Expression.
10315
10316         (ElementAccess): Depending on the element access type
10317         
10318         * typemanager.cs: Add `indexer_name_type' as a Core type
10319         (System.Runtime.CompilerServices.IndexerNameAttribute)
10320
10321         * statement.cs (Goto): Take a location.
10322         
10323 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10324
10325         * delegate.cs (Delegate::VerifyDelegate): New method to verify
10326         if two delegates are compatible.
10327
10328         (NewDelegate::DoResolve): Update to take care of the case when
10329         we instantiate a delegate from another delegate.
10330
10331         * typemanager.cs (FindMembers): Don't even try to look up members
10332         of Delegate types for now.
10333
10334 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10335
10336         * delegate.cs (NewDelegate): New class to take care of delegate
10337         instantiation.
10338
10339         * expression.cs (New): Split the delegate related code out into 
10340         the NewDelegate class.
10341
10342         * delegate.cs (DelegateInvocation): New class to handle delegate 
10343         invocation.
10344
10345         * expression.cs (Invocation): Split out delegate related code into
10346         the DelegateInvocation class.
10347
10348 2001-10-17  Ravi Pratap  <ravi@ximian.com>
10349
10350         * expression.cs (New::DoResolve): Implement delegate creation fully
10351         and according to the spec.
10352
10353         (New::DoEmit): Update to handle delegates differently.
10354
10355         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10356         because of which we were printing out arguments in reverse order !
10357
10358         * delegate.cs (VerifyMethod): Implement to check if the given method
10359         matches the delegate.
10360
10361         (FullDelegateDesc): Implement.
10362
10363         (VerifyApplicability): Implement.
10364
10365         * expression.cs (Invocation::DoResolve): Update to accordingly handle
10366         delegate invocations too.
10367
10368         (Invocation::Emit): Ditto.
10369
10370         * ../errors/cs1593.cs : Added.
10371
10372         * ../errors/cs1594.cs : Added.
10373
10374         * delegate.cs (InstanceExpression, TargetMethod): New properties.
10375
10376 2001-10-16  Ravi Pratap  <ravi@ximian.com>
10377
10378         * typemanager.cs (intptr_type): Core type for System.IntPtr
10379
10380         (InitCoreTypes): Update for the same.
10381
10382         (iasyncresult_type, asynccallback_type): Ditto.
10383
10384         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10385         correct.
10386
10387         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10388         too.
10389
10390         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10391         the builders for the 4 members of a delegate type :-)
10392
10393         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10394         type.
10395
10396         * expression.cs (New::DoResolve): Implement guts for delegate creation.
10397
10398         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10399
10400 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
10401
10402         * statement.cs (Break::Emit): Implement.   
10403         (Continue::Emit): Implement.
10404
10405         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10406         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10407         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10408         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
10409         end loop
10410         
10411         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10412         properties that track the label for the current loop (begin of the
10413         loop and end of the loop).
10414
10415 2001-10-15  Ravi Pratap  <ravi@ximian.com>
10416
10417         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10418         use of emitting anything at all.
10419
10420         * class.cs, rootcontext.cs : Get rid of calls to the same.
10421
10422         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10423
10424         (Populate): Define the constructor correctly and set the implementation
10425         attributes.
10426
10427         * typemanager.cs (delegate_types): New hashtable to hold delegates that
10428         have been defined.
10429
10430         (AddDelegateType): Implement.
10431
10432         (IsDelegateType): Implement helper method.
10433
10434         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10435
10436         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10437         and accordingly handle it.
10438
10439         * delegate.cs (Populate): Take TypeContainer argument.
10440         Implement bits to define the Invoke method. However, I still haven't figured out
10441         how to take care of the native int bit :-(
10442
10443         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
10444         Qualify the name of the delegate, not its return type !
10445
10446         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10447         conversion.
10448
10449         (StandardConversionExists): Checking for array types turns out to be recursive.
10450
10451         (ConvertReferenceExplicit): Implement array conversion.
10452
10453         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10454         
10455 2001-10-12  Ravi Pratap  <ravi@ximian.com>
10456
10457         * cs-parser.jay (delegate_declaration): Store the fully qualified
10458         name as it is a type declaration.
10459
10460         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
10461         readonly.
10462
10463         (DefineDelegate): Renamed from Define. Does the same thing essentially,
10464         as TypeContainer::DefineType.
10465
10466         (Populate): Method in which all the definition of the various methods (Invoke)
10467         etc is done.
10468
10469         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10470         see.
10471         
10472         (CloseDelegate): Finally creates the delegate.
10473
10474         * class.cs (TypeContainer::DefineType): Update to define delegates.
10475         (Populate, Emit and CloseType): Do the same thing here too.
10476
10477         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10478         delegates in all these operations.
10479
10480 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
10481
10482         * expression.cs: LocalTemporary: a new expression used to
10483         reference a temporary that has been created.
10484
10485         * assign.cs: Handle PropertyAccess back here, so that we can
10486         provide the proper semantic access to properties.
10487
10488         * expression.cs (Expression::ConvertReferenceExplicit): Implement
10489         a few more explicit conversions. 
10490
10491         * modifiers.cs: `NEW' modifier maps to HideBySig.
10492
10493         * expression.cs (PropertyExpr): Make this into an
10494         ExpressionStatement, and support the EmitStatement code path. 
10495
10496         Perform get/set error checking, clean up the interface.
10497
10498         * assign.cs: recognize PropertyExprs as targets, and if so, turn
10499         them into toplevel access objects.
10500
10501 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
10502
10503         * expression.cs: PropertyExpr::PropertyExpr: use work around the
10504         SRE.
10505
10506         * typemanager.cs: Keep track here of our PropertyBuilders again to
10507         work around lameness in SRE.
10508
10509 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
10510
10511         * expression.cs (LValue::LValueResolve): New method in the
10512         interface, used to perform a second resolution pass for LValues. 
10513         
10514         (This::DoResolve): Catch the use of this in static methods.
10515
10516         (This::LValueResolve): Implement.
10517
10518         (This::Store): Remove warning, assigning to `this' in structures
10519         is 
10520
10521         (Invocation::Emit): Deal with invocation of
10522         methods on value types.  We need to pass the address to structure
10523         methods rather than the object itself.  (The equivalent code to
10524         emit "this" for structures leaves the entire structure on the
10525         stack instead of a pointer to it). 
10526
10527         (ParameterReference::DoResolve): Compute the real index for the
10528         argument based on whether the method takes or not a `this' pointer
10529         (ie, the method is static).
10530
10531         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10532         value types returned from functions when we need to invoke a
10533         method on the sturcture.
10534         
10535
10536 2001-10-11  Ravi Pratap  <ravi@ximian.com>
10537
10538         * class.cs (TypeContainer::DefineType): Method to actually do the business of
10539         defining the type in the Modulebuilder or Typebuilder. This is to take
10540         care of nested types which need to be defined on the TypeBuilder using
10541         DefineNestedMethod.
10542
10543         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
10544         methods in RootContext, only ported to be part of TypeContainer.
10545
10546         (TypeContainer::GetInterfaceOrClass): Ditto.
10547
10548         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10549
10550         * interface.cs (Interface::DefineInterface): New method. Does exactly
10551         what RootContext.CreateInterface did earlier, only it takes care of nested types 
10552         too.
10553
10554         (Interface::GetInterfaces): Move from RootContext here and port.
10555
10556         (Interface::GetInterfaceByName): Same here.
10557
10558         * rootcontext.cs (ResolveTree): Re-write.
10559
10560         (PopulateTypes): Re-write.
10561
10562         * class.cs (TypeContainer::Populate): Populate nested types too.
10563         (TypeContainer::Emit): Emit nested members too.
10564
10565         * typemanager.cs (AddUserType): Do not make use of the FullName property,
10566         instead just use the name argument passed in as it is already fully
10567         qualified.
10568
10569         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10570         to TypeContainer mapping to see if a type is user-defined.
10571
10572         * class.cs (TypeContainer::CloseType): Implement. 
10573
10574         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10575         the default constructor.
10576         
10577         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10578         twice.
10579
10580         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10581
10582         * interface.cs (CloseType): Create the type here.
10583         
10584         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10585         the hierarchy.
10586
10587         Remove all the methods which are now in TypeContainer.
10588
10589 2001-10-10  Ravi Pratap  <ravi@ximian.com>
10590
10591         * delegate.cs (Define): Re-write bits to define the delegate
10592         correctly.
10593
10594 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
10595
10596         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10597
10598         * expression.cs (ImplicitReferenceConversion): handle null as well
10599         as a source to convert to any reference type.
10600
10601         * statement.cs (Return): Perform any implicit conversions to
10602         expected return type.  
10603
10604         Validate use of return statement.  
10605
10606         * codegen.cs (EmitContext): Pass the expected return type here.
10607
10608         * class.cs (Method, Constructor, Property): Pass expected return
10609         type to EmitContext.
10610
10611 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
10612
10613         * expression.cs: Make DoResolve take an EmitContext instead of a
10614         TypeContainer.
10615
10616         Replaced `l' and `location' for `loc', for consistency.
10617         
10618         (Error, Warning): Remove unneeded Tc argument.
10619
10620         * assign.cs, literal.cs, constant.cs: Update to new calling
10621         convention. 
10622         
10623         * codegen.cs: EmitContext now contains a flag indicating whether
10624         code is being generated in a static method or not.
10625
10626         * cs-parser.jay: DecomposeQI, new function that replaces the old
10627         QualifiedIdentifier.  Now we always decompose the assembled
10628         strings from qualified_identifier productions into a group of
10629         memberaccesses.
10630
10631 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
10632
10633         * rootcontext.cs: Deal with field-less struct types correctly now
10634         by passing the size option to Define Type.
10635
10636         * class.cs: Removed hack that created one static field. 
10637
10638 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10639
10640         * statement.cs: Moved most of the code generation here. 
10641
10642 2001-10-09  Ravi Pratap  <ravi@ximian.com>
10643
10644         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10645         seem very right.
10646
10647         (ElementAccess): Remove useless bits for now - keep checks as the spec
10648         says.
10649
10650 2001-10-08  Ravi Pratap  <ravi@ximian.com>
10651
10652         * expression.cs (ElementAccess::DoResolve): Remove my crap code
10653         and start performing checks according to the spec.
10654
10655 2001-10-07  Ravi Pratap  <ravi@ximian.com>
10656
10657         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10658         rank_specifiers instead.
10659
10660         (rank_specifiers): Change the order in which the rank specifiers are stored
10661
10662         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10663
10664         * expression.cs (ElementAccess): Implement the LValue interface too.
10665         
10666 2001-10-06  Ravi Pratap  <ravi@ximian.com>
10667         
10668         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10669         except that user defined conversions are not included.
10670
10671         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
10672         perform the conversion of the return type, if necessary.
10673
10674         (New::DoResolve): Check whether we are creating an array or an object
10675         and accordingly do the needful.
10676
10677         (New::Emit): Same here.
10678
10679         (New::DoResolve): Implement guts of array creation.
10680
10681         (New::FormLookupType): Helper function.
10682
10683 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10684
10685         * codegen.cs: Removed most of the code generation here, and move the
10686         corresponding code generation bits to the statement classes. 
10687
10688         Added support for try/catch/finalize and throw.
10689         
10690         * cs-parser.jay: Added support for try/catch/finalize.
10691
10692         * class.cs: Catch static methods having the flags override,
10693         virtual or abstract.
10694
10695         * expression.cs (UserCast): This user cast was not really doing
10696         what it was supposed to do.  Which is to be born in fully resolved
10697         state.  Parts of the resolution were being performed at Emit time! 
10698
10699         Fixed this code.
10700
10701 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10702
10703         * expression.cs: Implicity convert the result from UserCast.
10704
10705 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10706
10707         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10708         prevented it from working correctly. 
10709
10710         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10711         merely ConvertImplicit.
10712
10713 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10714
10715         * typemanager.cs: Make the LookupTypeContainer function static,
10716         and not per-instance.  
10717
10718         * class.cs: Make static FindMembers (the one that takes a Type
10719         argument). 
10720
10721         * codegen.cs: Add EmitForeach here.
10722
10723         * cs-parser.jay: Make foreach a toplevel object instead of the
10724         inline expansion, as we need to perform semantic analysis on it. 
10725
10726 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10727
10728         * expression.cs (Expression::ImplicitUserConversion): Rename to
10729         UserDefinedConversion.
10730
10731         (Expression::UserDefinedConversion): Take an extra argument specifying 
10732         whether we look for explicit user conversions too.
10733
10734         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10735
10736         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10737
10738         (ExplicitUserConversion): Make it a call to UserDefinedConversion
10739         with the appropriate arguments.
10740
10741         * cs-parser.jay (cast_expression): Record location too.
10742
10743         * expression.cs (Cast): Record location info.
10744
10745         (Expression::ConvertExplicit): Take location argument.
10746
10747         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10748         to determine if we are doing explicit conversions.
10749
10750         (UserCast::Emit): Update accordingly.
10751
10752         (Expression::ConvertExplicit): Report an error if everything fails.
10753
10754         * ../errors/cs0030.cs : Add.
10755
10756 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
10757
10758         * modifiers.cs: If the ABSTRACT keyword is present, also set the
10759         virtual and newslot bits. 
10760
10761         * class.cs (TypeContainer::RegisterRequiredImplementations):
10762         Record methods we need.
10763
10764         (TypeContainer::MakeKey): Helper function to make keys for
10765         MethodBases, since the Methodbase key is useless.
10766
10767         (TypeContainer::Populate): Call RegisterRequiredImplementations
10768         before defining the methods.   
10769
10770         Create a mapping for method_builders_to_methods ahead of time
10771         instead of inside a tight loop.
10772
10773         (::RequireMethods):  Accept an object as the data to set into the
10774         hashtable so we can report interface vs abstract method mismatch.
10775
10776 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10777
10778         * report.cs: Make all of it static.
10779
10780         * rootcontext.cs: Drop object_type and value_type computations, as
10781         we have those in the TypeManager anyways.
10782
10783         Drop report instance variable too, now it is a global.
10784
10785         * driver.cs: Use try/catch on command line handling.
10786
10787         Add --probe option to debug the error reporting system with a test
10788         suite. 
10789
10790         * report.cs: Add support for exiting program when a probe
10791         condition is reached.
10792
10793 2001-10-03  Ravi Pratap  <ravi@ximian.com>
10794
10795         * expression.cs (Binary::DoNumericPromotions): Fix the case when
10796         we do a forcible conversion regardless of type, to check if 
10797         ForceConversion returns a null.
10798
10799         (Binary::error19): Use location to report error.
10800
10801         (Unary::error23): Use location here too.
10802
10803         * ../errors/cs0019.cs : Check in.
10804
10805         * ../errors/cs0023.cs : Check in.
10806
10807         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10808         case of a non-null MethodInfo object with a length of 0 !
10809
10810         (Binary::ResolveOperator): Flag error if overload resolution fails to find
10811         an applicable member - according to the spec :-)
10812         Also fix logic to find members in base types.
10813
10814         (Unary::ResolveOperator): Same here.
10815
10816         (Unary::report23): Change name to error23 and make first argument a TypeContainer
10817         as I was getting thoroughly confused between this and error19 :-)
10818         
10819         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10820         (::FindMostEncompassedType): Implement.
10821         (::FindMostEncompassingType): Implement.
10822         (::StandardConversionExists): Implement.
10823
10824         (UserImplicitCast): Re-vamp. We now need info about most specific
10825         source and target types so that we can do the necessary conversions.
10826
10827         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10828         mathematical union with no duplicates.
10829
10830 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10831
10832         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10833         in order from base classes to child classes, so that we can in
10834         child classes look up in our parent for method names and
10835         attributes (required for handling abstract, virtual, new, override
10836         constructs: we need to instrospect our base class, and if we dont
10837         populate the classes in order, the introspection might be
10838         incorrect.  For example, a method could query its parent before
10839         the parent has any methods and would determine that the parent has
10840         no abstract methods (while it could have had them)).
10841
10842         (RootContext::CreateType): Record the order in which we define the
10843         classes.
10844
10845 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
10846
10847         * class.cs (TypeContainer::Populate): Also method definitions can
10848         fail now, keep track of this.
10849
10850         (TypeContainer::FindMembers): Implement support for
10851         DeclaredOnly/noDeclaredOnly flag.
10852
10853         (Constructor::Emit) Return the ConstructorBuilder.
10854
10855         (Method::Emit) Return the MethodBuilder. 
10856         Check for abstract or virtual methods to be public.
10857
10858         * rootcontext.cs (RootContext::CreateType): Register all the
10859         abstract methods required for the class to be complete and the
10860         interface methods that must be implemented. 
10861
10862         * cs-parser.jay: Report error 501 (method requires body if it is
10863         not marked abstract or extern).
10864
10865         * expression.cs (TypeOf::Emit): Implement.
10866
10867         * typemanager.cs: runtime_handle_type, new global type.
10868
10869         * class.cs (Property::Emit): Generate code for properties.
10870
10871 2001-10-02  Ravi Pratap  <ravi@ximian.com>
10872
10873         * expression.cs (Unary::ResolveOperator): Find operators on base type
10874         too - we now conform exactly to the spec.
10875
10876         (Binary::ResolveOperator): Same here.
10877
10878         * class.cs (Operator::Define): Fix minor quirk in the tests.
10879
10880         * ../errors/cs0215.cs : Added.
10881
10882         * ../errors/cs0556.cs : Added.
10883
10884         * ../errors/cs0555.cs : Added.
10885
10886 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
10887
10888         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
10889         single integer which is really efficient
10890
10891 2001-10-01  Ravi Pratap  <ravi@ximian.com>
10892
10893         *  expression.cs (Expression::ImplicitUserConversion): Use location
10894         even in the case when we are examining True operators.
10895  
10896         * class.cs (Operator::Define): Perform extensive checks to conform
10897         with the rules for operator overloading in the spec.
10898
10899         * expression.cs (Expression::ImplicitReferenceConversion): Implement
10900         some of the other conversions mentioned in the spec.
10901
10902         * typemanager.cs (array_type): New static member for the System.Array built-in
10903         type.
10904
10905         (cloneable_interface): For System.ICloneable interface.
10906
10907         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
10908         we start resolving the tree and populating types.
10909
10910         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
10911  
10912 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
10913
10914         * expression.cs (Expression::ExprClassFromMemberInfo,
10915         Expression::Literalize): Create literal expressions from
10916         FieldInfos which are literals.
10917
10918         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
10919         type casts, because they were wrong.  The test suite in tests
10920         caught these ones.
10921
10922         (ImplicitNumericConversion): ushort to ulong requires a widening
10923         cast. 
10924
10925         Int32 constant to long requires widening cast as well.
10926
10927         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
10928         for integers because the type on the stack is not i4.
10929
10930 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
10931
10932         * expression.cs (report118): require location argument. 
10933
10934         * parameter.cs: Do not dereference potential null value.
10935
10936         * class.cs: Catch methods that lack the `new' keyword when
10937         overriding a name.  Report warnings when `new' is used without
10938         anything being there to override.
10939
10940         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
10941
10942         * class.cs: Only add constructor to hashtable if it is non-null
10943         (as now constructors can fail on define).
10944
10945         (TypeManager, Class, Struct): Take location arguments.
10946
10947         Catch field instance initialization in structs as errors.
10948
10949         accepting_filter: a new filter for FindMembers that is static so
10950         that we dont create an instance per invocation.
10951
10952         (Constructor::Define): Catch errors where a struct constructor is
10953         parameterless 
10954
10955         * cs-parser.jay: Pass location information for various new
10956         constructs. 
10957         
10958         * delegate.cs (Delegate): take a location argument.
10959
10960         * driver.cs: Do not call EmitCode if there were problesm in the
10961         Definition of the types, as many Builders wont be there. 
10962
10963         * decl.cs (Decl::Decl): Require a location argument.
10964
10965         * cs-tokenizer.cs: Handle properly hex constants that can not fit
10966         into integers, and find the most appropiate integer for it.
10967
10968         * literal.cs: Implement ULongLiteral.
10969
10970         * rootcontext.cs: Provide better information about the location of
10971         failure when CreateType fails.
10972         
10973 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
10974
10975         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
10976         as well.
10977
10978         * expression.cs (Binary::CheckShiftArguments): Add missing type
10979         computation.
10980         (Binary::ResolveOperator): Add type to the logical and and logical
10981         or, Bitwise And/Or and Exclusive Or code paths, it was missing
10982         before.
10983
10984         (Binary::DoNumericPromotions): In the case where either argument
10985         is ulong (and most signed types combined with ulong cause an
10986         error) perform implicit integer constant conversions as well.
10987
10988 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
10989
10990         * expression.cs (UserImplicitCast): Method should always be
10991         non-null. 
10992         (Invocation::BetterConversion): Simplified test for IntLiteral.
10993
10994         (Expression::ImplicitNumericConversion): Split this routine out.
10995         Put the code that performs implicit constant integer conversions
10996         here. 
10997
10998         (Expression::Resolve): Become a wrapper around DoResolve so we can
10999         check eclass and type being set after resolve.
11000
11001         (Invocation::Badness): Remove this dead function
11002
11003         (Binary::ResolveOperator): Do not compute the expensive argumnets
11004         unless we have a union for it.
11005
11006         (Probe::Emit): Is needs to do an isinst and then
11007         compare against null.
11008
11009         (::CanConvert): Added Location argument.  If the Location argument
11010         is null (Location.Null), then we do not report errors.  This is
11011         used by the `probe' mechanism of the Explicit conversion.  We do
11012         not want to generate an error for something that the user
11013         explicitly requested to be casted.  But the pipeline for an
11014         explicit cast first tests for potential implicit casts.
11015
11016         So for now, if the Location is null, it means `Probe only' to
11017         avoid adding another argument.   Might have to revise this
11018         strategy later.
11019
11020         (ClassCast): New class used to type cast objects into arbitrary
11021         classes (used in Explicit Reference Conversions).
11022
11023         Implement `as' as well.
11024
11025         Reverted all the patches from Ravi below: they were broken:
11026
11027                 * The use of `level' as a mechanism to stop recursive
11028                   invocations is wrong.  That was there just to catch the
11029                   bug with a strack trace but not as a way of addressing
11030                   the problem.
11031
11032                   To fix the problem we have to *understand* what is going
11033                   on and the interactions and come up with a plan, not
11034                   just get things going.
11035
11036                 * The use of the type conversion cache that I proposed
11037                   last night had an open topic: How does this work across
11038                   protection domains.  A user defined conversion might not
11039                   be public in the location where we are applying the
11040                   conversion, a different conversion might be selected
11041                   (ie, private A->B (better) but public B->A (worse),
11042                   inside A, A->B applies, but outside it, B->A will
11043                   apply).
11044
11045                 * On top of that (ie, even if the above is solved),
11046                   conversions in a cache need to be abstract.  Ie, `To
11047                   convert from an Int to a Short use an OpcodeCast', not
11048                   `To convert from an Int to a Short use the OpcodeCast on
11049                   the variable 5' (which is what this patch was doing).
11050         
11051 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11052
11053         * expression.cs (Invocation::ConversionExists): Re-write to use
11054         the conversion cache
11055         
11056         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11057         cache all conversions done, not just user-defined ones.
11058
11059         (Invocation::BetterConversion): The real culprit. Use ConversionExists
11060         to determine if a conversion exists instead of acutually trying to 
11061         perform the conversion. It's faster too.
11062
11063         (Expression::ConvertExplicit): Modify to use ConversionExists to check
11064         and only then attempt the implicit conversion.
11065
11066 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11067
11068         * expression.cs (ConvertImplicit): Use a cache for conversions
11069         already found. Check level of recursion and bail out if necessary.
11070         
11071 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11072
11073         * typemanager.cs (string_concat_string_string, string_concat_object_object):
11074         Export standard methods that we expect for string operations.
11075         
11076         * statement.cs (Block::UsageWarning): Track usage of variables and
11077         report the errors for not used variables.
11078
11079         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11080         operator. 
11081
11082 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11083
11084         * codegen.cs: remove unnneded code 
11085
11086         * expression.cs: Removed BuiltinTypeAccess class
11087
11088         Fix the order in which implicit conversions are
11089         done.  
11090
11091         The previous fixed dropped support for boxed conversions (adding a
11092         test to the test suite now)
11093
11094         (UserImplicitCast::CanConvert): Remove test for source being null,
11095         that code is broken.  We should not feed a null to begin with, if
11096         we do, then we should track the bug where the problem originates
11097         and not try to cover it up here.
11098
11099         Return a resolved expression of type UserImplicitCast on success
11100         rather than true/false.  Ravi: this is what I was talking about,
11101         the pattern is to use a static method as a "constructor" for
11102         objects. 
11103
11104         Also, do not create arguments until the very last minute,
11105         otherwise we always create the arguments even for lookups that
11106         will never be performed. 
11107
11108         (UserImplicitCast::Resolve): Eliminate, objects of type
11109         UserImplicitCast are born in a fully resolved state. 
11110         
11111         * typemanager.cs (InitCoreTypes): Init also value_type
11112         (System.ValueType). 
11113
11114         * expression.cs (Cast::Resolve): First resolve the child expression.
11115
11116         (LValue): Add new method AddressOf to be used by
11117         the `&' operator.  
11118
11119         Change the argument of Store to take an EmitContext instead of an
11120         ILGenerator, because things like FieldExpr need to be able to call
11121         their children expression to generate the instance code. 
11122
11123         (Expression::Error, Expression::Warning): Sugar functions for
11124         reporting errors.
11125
11126         (Expression::MemberLookup): Accept a TypeContainer instead of a
11127         Report as the first argument.
11128
11129         (Expression::ResolvePrimary): Killed.  I still want to improve
11130         this as currently the code is just not right.
11131
11132         (Expression::ResolveMemberAccess): Simplify, but it is still
11133         wrong. 
11134
11135         (Unary::Resolve): Catch errors in AddressOf operators.
11136
11137         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11138         index to a byte for the short-version, or the compiler will choose
11139         the wrong Emit call, which generates the wrong data.
11140
11141         (ParameterReference::Emit, ::Store): same.
11142
11143         (FieldExpr::AddressOf): Implement.
11144         
11145         * typemanager.cs: TypeManager: made public variable instead of
11146         property.
11147         
11148         * driver.cs: document --fatal.
11149
11150         * report.cs (ErrorMessage, WarningMessage): new names for the old
11151         Error and Warning classes.
11152
11153         * cs-parser.jay (member_access): Turn built-in access to types
11154         into a normal simplename
11155
11156 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11157
11158         * expression.cs (Invocation::BetterConversion): Fix to cope
11159         with q being null, since this was introducing a bug.
11160
11161         * expression.cs (ConvertImplicit): Do built-in conversions first.
11162
11163 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11164
11165         * expression.cs (UserImplicitCast::Resolve): Fix bug.
11166
11167 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11168
11169         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11170         I had introduced long ago (what's new ?).
11171
11172         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
11173         the work of all the checking. 
11174         (ConvertImplicit): Call CanConvert and only then create object if necessary.
11175         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11176
11177         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11178         that is the right way. 
11179
11180         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
11181         overloading resolution. Use everywhere instead of cutting and pasting code.
11182
11183         (Binary::ResolveOperator): Use MakeUnionSet.
11184
11185         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
11186         we have to convert to bool types. Not complete yet.
11187         
11188 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11189
11190         * typemanager.cs (TypeManager::CSharpName): support ushort.
11191
11192         * expression.cs (Expression::TryImplicitIntConversion): Attempts
11193         to provide an expression that performsn an implicit constant int
11194         conversion (section 6.1.6).
11195         (Expression::ConvertImplicitRequired): Reworked to include
11196         implicit constant expression conversions.
11197
11198         (Expression::ConvertNumericExplicit): Finished.
11199
11200         (Invocation::Emit): If InstanceExpression is null, then it means
11201         that we perform a call on this.
11202         
11203 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11204
11205         * expression.cs (Unary::Emit): Remove some dead code.
11206         (Probe): Implement Resolve and Emit for `is'.
11207         (Expression::ConvertImplicitRequired): Attempt to do constant
11208         expression conversions here.  Maybe should be moved to
11209         ConvertImplicit, but I am not sure.
11210         (Expression::ImplicitLongConstantConversionPossible,
11211         Expression::ImplicitIntConstantConversionPossible): New functions
11212         that tell whether is it possible to apply an implicit constant
11213         expression conversion.
11214
11215         (ConvertNumericExplicit): Started work on explicit numeric
11216         conversions.
11217
11218         * cs-parser.jay: Update operator constants.
11219
11220         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11221         (Parameters::GetSignature): Hook up VerifyArgs here.
11222         (Parameters::VerifyArgs): Verifies that no two arguments have the
11223         same name. 
11224
11225         * class.cs (Operator): Update the operator names to reflect the
11226         ones that the spec expects (as we are just stringizing the
11227         operator names).
11228         
11229         * expression.cs (Unary::ResolveOperator): Fix bug: Use
11230         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11231         previous usage did only work for our methods.
11232         (Expression::ConvertImplicit): Handle decimal implicit numeric
11233         conversions as well.
11234         (Expression::InternalTypeConstructor): Used to invoke constructors
11235         on internal types for default promotions.
11236
11237         (Unary::Emit): Implement special handling for the pre/post
11238         increment/decrement for overloaded operators, as they need to have
11239         the same semantics as the other operators.
11240
11241         (Binary::ResolveOperator): ditto.
11242         (Invocation::ConversionExists): ditto.
11243         (UserImplicitCast::Resolve): ditto.
11244         
11245 2001-09-26  Ravi Pratap  <ravi@ximian.com>
11246
11247         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11248         operator, return after emitting body. Regression tests pass again !
11249
11250         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11251         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11252         (Invocation::OverloadResolve): Ditto.
11253         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11254
11255         * everywhere : update calls to the above methods accordingly.
11256
11257 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11258
11259         * assign.cs (Assign): Make it inherit from ExpressionStatement.
11260
11261         * expression.cs (ExpressionStatement): New base class used for
11262         expressions that can appear in statements, so that we can provide
11263         an alternate path to generate expression that do not leave a value
11264         on the stack.
11265
11266         (Expression::Emit, and all the derivatives): We no longer return
11267         whether a value is left on the stack or not.  Every expression
11268         after being emitted leaves a single value on the stack.
11269
11270         * codegen.cs (EmitContext::EmitStatementExpression): Use the
11271         facilties of ExpressionStatement if possible.
11272
11273         * cs-parser.jay: Update statement_expression.
11274
11275 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
11276
11277         * driver.cs: Change the wording of message
11278
11279 2001-09-25  Ravi Pratap  <ravi@ximian.com>
11280
11281         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
11282         the type of the expression to the return type of the method if
11283         we have an overloaded operator match ! The regression tests pass again !
11284         (Unary::ResolveOperator): Ditto.
11285
11286         * expression.cs (Invocation::ConversionExists): Correct the member lookup
11287         to find "op_Implicit", not "implicit" ;-)
11288         (UserImplicitCast): New class to take care of user-defined implicit conversions.
11289         (ConvertImplicit, ForceConversion): Take TypeContainer argument
11290
11291         * everywhere : Correct calls to the above accordingly.
11292
11293         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11294         (ConvertImplicit): Do user-defined conversion if it exists.
11295
11296 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
11297
11298         * assign.cs: track location.
11299         (Resolve): Use implicit conversions on assignment.
11300
11301         * literal.cs: Oops.  Not good, Emit of short access values should
11302         pass (Bytes) or the wrong argument will be selected.
11303
11304         * expression.cs (Unary::Emit): Emit code for -expr.
11305         
11306         (Unary::ResolveOperator): Handle `Substract' for non-constants
11307         (substract from zero from the non-constants).
11308         Deal with Doubles as well. 
11309         
11310         (Expression::ConvertImplicitRequired): New routine that reports an
11311         error if no implicit conversion exists. 
11312
11313         (Invocation::OverloadResolve): Store the converted implicit
11314         expressions if we make them
11315         
11316 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11317
11318         * class.cs (ConstructorInitializer): Take a Location argument.
11319         (ConstructorBaseInitializer): Same here.
11320         (ConstructorThisInitializer): Same here.
11321
11322         * cs-parser.jay : Update all calls accordingly.
11323
11324         * expression.cs (Unary, Binary, New): Take location argument.
11325         Update accordingly everywhere.
11326
11327         * cs-parser.jay : Update all calls to the above to take a location
11328         argument.
11329
11330         * class.cs : Ditto.
11331
11332 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11333
11334         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11335         (Invocation::BetterConversion): Same here
11336         (Invocation::ConversionExists): Ditto.
11337
11338         (Invocation::ConversionExists): Implement.
11339
11340 2001-09-22  Ravi Pratap  <ravi@ximian.com>
11341
11342         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11343         Also take an additional TypeContainer argument.
11344
11345         * All over : Pass in TypeContainer as argument to OverloadResolve.
11346
11347         * typemanager.cs (CSharpName): Update to check for the string type and return
11348         that too.
11349
11350         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11351         a given method.
11352         
11353 2001-09-21  Ravi Pratap  <ravi@ximian.com>
11354
11355         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11356         (Invocation::BetterFunction): Implement.
11357         (Invocation::BetterConversion): Implement.
11358         (Invocation::ConversionExists): Skeleton, no implementation yet.
11359
11360         Okay, things work fine !
11361
11362 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
11363
11364         * typemanager.cs: declare and load enum_type, delegate_type and
11365         void_type. 
11366
11367         * expression.cs (Expression::Emit): Now emit returns a value that
11368         tells whether a value is left on the stack or not.  This strategy
11369         might be reveted tomorrow with a mechanism that would address
11370         multiple assignments.
11371         (Expression::report118): Utility routine to report mismatches on
11372         the ExprClass.
11373
11374         (Unary::Report23): Report impossible type/operator combination
11375         utility function.
11376
11377         (Unary::IsIncrementableNumber): Whether the type can be
11378         incremented or decremented with add.
11379         (Unary::ResolveOperator): Also allow enumerations to be bitwise
11380         complemented. 
11381         (Unary::ResolveOperator): Implement ++, !, ~,
11382
11383         (Invocation::Emit): Deal with new Emit convetion.
11384         
11385         * All Expression derivatives: Updated their Emit method to return
11386         whether they leave values on the stack or not.
11387         
11388         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11389         stack for expressions that are statements. 
11390
11391 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11392
11393         * expression.cs (LValue): New interface.  Must be implemented by
11394         LValue objects.
11395         (LocalVariableReference, ParameterReference, FieldExpr): Implement
11396         LValue interface.
11397         
11398         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11399         interface for generating code, simplifies the code.
11400
11401 2001-09-20  Ravi Pratap  <ravi@ximian.com>
11402
11403         * expression.cs (everywhere): Comment out return statements in ::Resolve
11404         methods to avoid the warnings.
11405
11406 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11407
11408         * driver.cs (parse): Report error 2001 if we can not open the
11409         source file.
11410
11411         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11412         not resolve it.
11413
11414         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11415         object. 
11416
11417         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11418         otherwise nested blocks end up with the same index.
11419
11420         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11421
11422         * expression.cs:  Instead of having FIXMEs in the Resolve
11423         functions, throw exceptions so it is obvious that we are facing a
11424         bug. 
11425
11426         * cs-parser.jay (invocation_expression): Pass Location information.
11427
11428         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11429         Use a basename for those routines because .NET does not like paths
11430         on them. 
11431
11432         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11433         already defined.
11434
11435 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
11436
11437         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11438         are loading the correct data types (throws an exception if not).
11439         (TypeManager::InitCoreTypes): Use CoreLookupType
11440
11441         * expression.cs (Unary::ResolveOperator): return the child
11442         expression for expressions which are just +expr.
11443         (Unary::ResolveOperator): Return negative literals for -LITERAL
11444         expressions (otherwise they are Unary {Literal}).
11445         (Invocation::Badness): Take into account `Implicit constant
11446         expression conversions'.
11447
11448         * literal.cs (LongLiteral): Implement long literal class.
11449         (IntLiteral): export the `Value' of the intliteral. 
11450
11451 2001-09-19  Ravi Pratap  <ravi@ximian.com>
11452
11453         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11454
11455         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
11456         instead of 'Operator'
11457
11458         * expression.cs (Binary::ResolveOperator): Update accordingly.
11459         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11460         and 'Minus'
11461
11462         * cs-parser.jay (unary_expression): Update to use the new names.
11463
11464         * gen-treedump.cs (GetUnary): Same here.
11465
11466         * expression.cs (Unary::Resolve): Implement.
11467         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
11468         operators are found instead of making noise ;-)
11469         (Unary::ResolveOperator): New method to do precisely the same thing which
11470         Binary::ResolveOperator does for Binary expressions.
11471         (Unary.method, .Arguments): Add.
11472         (Unary::OperName): Implement.   
11473         (Unary::ForceConversion): Copy and Paste !
11474
11475         * class.cs (Operator::Define): Fix a small bug for the case when we have 
11476         a unary operator.
11477
11478         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11479         for the inbuilt operators. Only overloading works for now ;-)
11480
11481 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
11482
11483         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11484         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11485
11486         * expression.cs (This::Emit): Implement. 
11487         (This::Resolve): Implement.
11488         (TypeOf:Resolve): Implement.
11489         (Expression::ResolveSimpleName): Add an implicit this to instance
11490         field references. 
11491         (MemberAccess::Resolve): Deal with Parameters and Fields. 
11492         Bind instance variable to Field expressions.
11493         (FieldExpr::Instance): New field used to track the expression that
11494         represents the object instance.
11495         (FieldExpr::Resolve): Track potential errors from MemberLookup not
11496         binding 
11497         (FieldExpr::Emit): Implement.
11498
11499         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11500         the last instruction contains a return opcode to avoid generating
11501         the last `ret' instruction (this generates correct code, and it is
11502         nice to pass the peverify output).
11503
11504         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11505         initializer for static and instance variables.
11506         (Constructor::Emit): Allow initializer to be null in the case of
11507         static constructors.  Only emit initializer for instance
11508         constructors. 
11509
11510         (TypeContainer::FindMembers): Return a null array if there are no
11511         matches.
11512
11513         Also fix the code for the MemberTypes.Method branch, as it was not
11514         scanning that for operators (or tried to access null variables before).
11515
11516         * assign.cs (Assign::Emit): Handle instance and static fields. 
11517
11518         * TODO: Updated.
11519
11520         * driver.cs: Stop compilation if there are parse errors.
11521
11522         * cs-parser.jay (constructor_declaration): Provide default base
11523         initializer for non-static constructors.
11524         (constructor_declarator): Do not provide a default base
11525         initializers if none was specified.
11526         Catch the fact that constructors should not have parameters.
11527
11528         * class.cs: Do not emit parent class initializers for static
11529         constructors, that should be flagged as an error.
11530
11531 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11532
11533         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11534         Move back code into TypeContainer::Populate.
11535
11536 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11537
11538         * class.cs (TypeContainer::AddConstructor): Fix the check to
11539         compare against Name, not Basename. 
11540         (Operator::OpType): Change Plus and Minus to Add and Subtract.
11541
11542         * cs-parser.jay : Update accordingly.
11543
11544         * class.cs (TypeContainer::FindMembers): For the case where we are searching
11545         for methods, don't forget to look into the operators too.
11546         (RegisterMethodBuilder): Helper method to take care of this for
11547         methods, constructors and operators.
11548         (Operator::Define): Completely revamp.
11549         (Operator.OperatorMethod, MethodName): New fields.
11550         (TypeContainer::Populate): Move the registering of builders into
11551         RegisterMethodBuilder.
11552         (Operator::Emit): Re-write.
11553
11554         * expression.cs (Binary::Emit): Comment out code path to emit method
11555         invocation stuff for the case when we have a user defined operator. I am
11556         just not able to get it right !
11557         
11558 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11559
11560         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11561         argument. 
11562
11563         (Expression::MemberLookup): Provide a version that allows to
11564         specify the MemberTypes and BindingFlags. 
11565
11566         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11567         so it was not fetching variable information from outer blocks.
11568
11569         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11570         Beforefieldinit as it was buggy.
11571
11572         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11573         that Ravi put here.  
11574
11575         * class.cs (Constructor::Emit): Only emit if block is not null.
11576         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11577         deal with this by semantically definining it as if the user had
11578         done it.
11579
11580         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11581         constructors as we now "emit" them at a higher level.
11582
11583         (TypeContainer::DefineDefaultConstructor): Used to define the
11584         default constructors if none was provided.
11585
11586         (ConstructorInitializer): Add methods Resolve and Emit. 
11587         
11588         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11589
11590 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11591
11592         * class.cs (TypeContainer::EmitDefaultConstructor): Register
11593         the default constructor builder with our hashtable for methodbuilders
11594         to methodcores.
11595
11596         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11597         and argument_count is 0 in which case we have a match.
11598         (Binary::ResolveOperator): More null checking and miscellaneous coding
11599         style cleanup.
11600
11601 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11602
11603         * rootcontext.cs (IsNameSpace): Compare against null.
11604
11605         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11606
11607         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11608         and Unary::Operator.
11609
11610         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11611         accordingly.
11612
11613         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11614         we have overloaded operators.
11615         (Binary::ResolveOperator): Implement the part which does the operator overload
11616         resolution.
11617
11618         * class.cs (Operator::Emit): Implement.
11619         (TypeContainer::Emit): Emit the operators we have too.
11620
11621         * expression.cs (Binary::Emit): Update to emit the appropriate code for
11622         the case when we have a user-defined operator.
11623         
11624 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11625
11626         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11627
11628 2001-09-16  Ravi Pratap  <ravi@ximian.com>
11629
11630         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11631         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11632         (Constructor::Emit): Implement.
11633         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11634         if we have no work to do. 
11635         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
11636         Emit method.
11637
11638         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11639         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11640
11641         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11642         of parent.parent.
11643
11644 2001-09-15  Ravi Pratap  <ravi@ximian.com>
11645
11646         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11647         in the source.
11648         (Tree::RecordNamespace): Method to do what the name says ;-)
11649         (Tree::Namespaces): Property to get at the namespaces hashtable.
11650
11651         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
11652         keep track.
11653
11654         * rootcontext.cs (IsNamespace): Fixed it :-)
11655
11656 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11657
11658         * class.cs (TypeContainer::FindMembers): Add support for
11659         constructors. 
11660         (MethodCore): New class that encapsulates both the shared aspects
11661         of a Constructor and a Method.  
11662         (Method, Constructor): Factored pieces into MethodCore.
11663
11664         * driver.cs: Added --fatal which makes errors throw exceptions.
11665         Load System assembly as well as part of the standard library.
11666
11667         * report.cs: Allow throwing exceptions on errors for debugging.
11668
11669         * modifiers.cs: Do not use `parent', instead use the real type
11670         container to evaluate permission settings.
11671
11672         * class.cs: Put Ravi's patch back in.  He is right, and we will
11673         have to cope with the
11674
11675 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11676
11677         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11678         FamORAssem, not FamANDAssem.
11679         
11680 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11681
11682         * driver.cs: Added --parse option that only parses its input files
11683         and terminates.
11684
11685         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
11686         incorrect.  IsTopLevel is not used to tell whether an object is
11687         root_types or not (that can be achieved by testing this ==
11688         root_types).  But to see if this is a top-level *class* (not
11689         necessarly our "toplevel" container). 
11690
11691 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11692
11693         * enum.cs (Enum::Define): Modify to call the Lookup method on the
11694         parent instead of a direct call to GetType.
11695
11696 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11697
11698         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11699         Modifiers.TypeAttr. This should just be a call to that method.
11700
11701         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11702         object so that we can determine if we are top-level or not.
11703
11704         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
11705         TypeContainer too.
11706
11707         * enum.cs (Enum::Define): Ditto.
11708
11709         * modifiers.cs (FieldAttr): Re-write.
11710
11711         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11712         (TypeContainer::HaveStaticConstructor): New property to provide access
11713         to precisely that info.
11714
11715         * modifiers.cs (MethodAttr): Re-write.
11716         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11717
11718         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11719         of top-level types as claimed.
11720         
11721 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11722
11723         * expression.cs (MemberLookup): Fruitless attempt to lookup
11724         constructors.  Maybe I need to emit default constructors?  That
11725         might be it (currently .NET emits this for me automatically).
11726         (Invocation::OverloadResolve): Cope with Arguments == null.
11727         (Invocation::EmitArguments): new function, shared by the new
11728         constructor and us.
11729         (Invocation::Emit): Handle static and instance methods.  Emit
11730         proper call instruction for virtual or non-virtual invocations.
11731         (New::Emit): Implement.
11732         (New::Resolve): Implement.
11733         (MemberAccess:Resolve): Implement.
11734         (MethodGroupExpr::InstanceExpression): used conforming to the spec
11735         to track instances.
11736         (FieldExpr::Resolve): Set type.
11737
11738         * support.cs: Handle empty arguments.
11739                 
11740         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11741         SimpleLookup): Auxiliary routines to help parse a qualifier
11742         identifier.  
11743
11744         Update qualifier_identifier rule.
11745
11746         * codegen.cs: Removed debugging messages.
11747
11748         * class.cs: Make this a global thing, this acts just as a "key" to
11749         objects that we might have around.
11750
11751         (Populate): Only initialize method_builders_to_methods once.
11752
11753         * expression.cs (PropertyExpr): Initialize type from the
11754         PropertyType. 
11755
11756         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11757         Resolve pattern.  Attempt to implicitly convert value to boolean.
11758         Emit code.
11759
11760         * expression.cs: Set the type for the int32/int32 argument case.
11761         (Binary::ResolveOperator): Set the return type to boolean for
11762         comparission operators
11763
11764         * typemanager.cs: Remove debugging print code.
11765
11766         (Invocation::Resolve): resolve type.
11767
11768         * class.cs: Allocate a MemberInfo of the correct size, as the code
11769         elsewhere depends on the test to reflect the correct contents.
11770
11771         (Method::) Keep track of parameters, due to System.Reflection holes
11772
11773         (TypeContainer::Populate): Keep track of MethodBuilders to Method
11774         mapping here.
11775
11776         (TypeContainer::FindMembers): Use ArrayList and then copy an array
11777         of the exact size and return that.
11778
11779         (Class::LookupMethodByBuilder): New function that maps
11780         MethodBuilders to its methods.  Required to locate the information
11781         on methods because System.Reflection bit us again.
11782
11783         * support.cs: New file, contains an interface ParameterData and
11784         two implementations: ReflectionParameters and InternalParameters
11785         used to access Parameter information.  We will need to grow this
11786         as required.
11787
11788         * expression.cs (Invocation::GetParameterData): implement a cache
11789         and a wrapper around the ParameterData creation for methods. 
11790         (Invocation::OverloadResolve): Use new code.
11791
11792 2001-09-13  Ravi Pratap  <ravi@ximian.com>
11793
11794         * class.cs (TypeContainer::EmitField): Remove and move into 
11795         (Field::Define): here and modify accordingly.
11796         (Field.FieldBuilder): New member.
11797         (TypeContainer::Populate): Update accordingly.
11798         (TypeContainer::FindMembers): Implement.
11799
11800 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11801
11802         * statement.cs: (VariableInfo::VariableType): New field to be
11803         initialized with the full type once it is resolved. 
11804
11805 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
11806
11807         * parameter.cs (GetParameterInfo): Use a type cache to compute
11808         things only once, and to reuse this information
11809
11810         * expression.cs (LocalVariableReference::Emit): Implement.
11811         (OpcodeCast::Emit): fix.
11812
11813         (ParameterReference::Resolve): Implement.
11814         (ParameterReference::Emit): Implement.
11815
11816         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11817         that are expressions need to stay as Expressions.
11818
11819         * typemanager.cs (CSharpName): Returns the C# name of a type if
11820         possible. 
11821
11822         * expression.cs (Expression::ConvertImplicit): New function that
11823         implements implicit type conversions.
11824
11825         (Expression::ImplicitReferenceConversion): Implements implicit
11826         reference conversions.
11827
11828         (EmptyCast): New type for transparent casts.
11829
11830         (OpcodeCast): New type for casts of types that are performed with
11831         a sequence of bytecodes.
11832         
11833         (BoxedCast): New type used for casting value types into reference
11834         types.  Emits a box opcode.
11835
11836         (Binary::DoNumericPromotions): Implements numeric promotions of
11837         and computation of the Binary::Type.
11838
11839         (Binary::EmitBranchable): Optimization.
11840
11841         (Binary::Emit): Implement code emission for expressions.
11842         
11843         * typemanager.cs (TypeManager): Added two new core types: sbyte
11844         and byte.
11845
11846 2001-09-12  Ravi Pratap  <ravi@ximian.com>
11847
11848         * class.cs (TypeContainer::FindMembers): Method which does exactly
11849         what Type.FindMembers does, only we don't have to use reflection. No
11850         implementation yet.
11851
11852         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11853         typecontainer objects as we need to get at them.
11854         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11855
11856         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11857         typecontainer object.
11858
11859         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11860         of just a Report object.
11861
11862 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11863
11864         * class.cs (Event::Define): Go back to using the prefixes "add_" and
11865         "remove_"
11866         (TypeContainer::Populate): Now define the delegates of the type too.
11867         (TypeContainer.Delegates): Property to access the list of delegates defined
11868         in the type.
11869
11870         * delegates.cs (Delegate::Define): Implement partially.
11871
11872         * modifiers.cs (TypeAttr): Handle more flags.
11873
11874 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11875
11876         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11877         and not <=
11878         (Operator::Define): Re-write logic to get types by using the LookupType method
11879         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11880         (Indexer::Define): Ditto.
11881         (Event::Define): Ditto.
11882         (Property::Define): Ditto.
11883         
11884 2001-09-10  Ravi Pratap  <ravi@ximian.com>
11885
11886         * class.cs (TypeContainer::Populate): Now define operators too. 
11887         (TypeContainer.Operators): New property to access the list of operators
11888         in a type.
11889         (Operator.OperatorMethodBuilder): New member to hold the method builder
11890         for the operator we are defining.
11891         (Operator::Define): Implement.
11892
11893 2001-09-10  Ravi Pratap  <ravi@ximian.com>
11894
11895         * class.cs (Event::Define): Make the prefixes of the accessor methods
11896         addOn_ and removeOn_ 
11897
11898         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
11899         of the location being passed in too. Ideally, this should go later since all
11900         error reporting should be done through the Report object.
11901
11902         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
11903         (Populate): Iterate thru the indexers we have and define them too.
11904         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
11905         for the get and set accessors.
11906         (Indexer::Define): Implement.
11907         
11908 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
11909
11910         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
11911         my previous implementation, did not work.
11912
11913         * typemanager.cs: Add a couple of missing types (the longs).
11914
11915         * literal.cs: Use TypeManager.bool_type instead of getting it.
11916
11917         * expression.cs (EventExpr): New kind of expressions.
11918         (Expressio::ExprClassFromMemberInfo): finish
11919
11920 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
11921
11922         * assign.cs: Emit stores to static fields differently.
11923
11924 2001-09-08  Ravi Pratap  <ravi@ximian.com>
11925
11926         * Merge in changes and adjust code to tackle conflicts. Backed out my
11927         code in Assign::Resolve ;-) 
11928
11929 2001-09-08  Ravi Pratap  <ravi@ximian.com>
11930
11931         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
11932         instead Report.Error and also pass in the location.
11933         (CSharpParser::Lexer): New readonly property to return the reference
11934         to the Tokenizer object.
11935         (declare_local_variables): Use Report.Error with location instead of plain 
11936         old error.
11937         (CheckDef): Ditto.
11938
11939         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
11940         (Operator.CheckBinaryOperator): Ditto.
11941
11942         * cs-parser.jay (operator_declarator): Update accordingly.
11943
11944         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
11945         (CheckBinaryOperator): Same here.
11946
11947         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
11948         on the name without any prefixes of namespace names etc. This is because we
11949         already might have something already fully qualified like 
11950         'System.Console.WriteLine'
11951
11952         * assign.cs (Resolve): Begin implementation. Stuck ;-)
11953
11954 2001-09-07  Ravi Pratap  <ravi@ximian.com>
11955
11956         * cs-tokenizer.cs (location): Return a string which also contains
11957         the file name.
11958
11959         * expression.cs (ElementAccess): New class for expressions of the
11960         type 'element access.'
11961         (BaseAccess): New class for expressions of the type 'base access.'
11962         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
11963         respectively.
11964         
11965         * cs-parser.jay (element_access): Implement action.
11966         (base_access): Implement actions.
11967         (checked_expression, unchecked_expression): Implement.
11968
11969         * cs-parser.jay (local_variable_type): Correct and implement.
11970         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
11971
11972         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
11973
11974         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
11975         name and the specifiers.
11976
11977         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
11978         
11979         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
11980         making them all public ;-)
11981
11982         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
11983         class anyways.
11984         
11985 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
11986
11987         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
11988         PropertyExprs.
11989         (FieldExpr, PropertyExprs): New resolved expressions.
11990         (SimpleName::MemberStaticCheck): Perform static checks for access
11991         to non-static fields on static methods. Maybe this should be
11992         generalized for MemberAccesses. 
11993         (SimpleName::ResolveSimpleName): More work on simple name
11994         resolution. 
11995
11996         * cs-parser.jay (primary_expression/qualified_identifier): track
11997         the parameter index.
11998
11999         * codegen.cs (CodeGen::Save): Catch save exception, report error.
12000         (EmitContext::EmitBoolExpression): Chain to expression generation
12001         instead of temporary hack.
12002         (::EmitStatementExpression): Put generic expression code generation.
12003
12004         * assign.cs (Assign::Emit): Implement variable assignments to
12005         local variables, parameters and fields.
12006
12007 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
12008
12009         * statement.cs (Block::GetVariableInfo): New method, returns the
12010         VariableInfo for a variable name in a block.
12011         (Block::GetVariableType): Implement in terms of GetVariableInfo
12012
12013         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12014         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12015
12016 2001-09-06  Ravi Pratap  <ravi@ximian.com>
12017
12018         * cs-parser.jay (operator_declaration): Continue on my quest : update
12019         to take attributes argument.
12020         (event_declaration): Ditto.
12021         (enum_declaration): Ditto.
12022         (indexer_declaration): Ditto.
12023         
12024         * class.cs (Operator::Operator): Update constructor accordingly.
12025         (Event::Event): Ditto.
12026
12027         * delegate.cs (Delegate::Delegate): Same here.
12028
12029         * enum.cs (Enum::Enum): Same here.
12030         
12031 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12032
12033         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12034
12035         * ../tests/cs0658.cs : New file to demonstrate error 0658.
12036
12037         * attribute.cs (Attributes): New class to encapsulate all attributes which were
12038         being passed around as an arraylist.
12039         (Attributes::AddAttribute): Method to add attribute sections.
12040
12041         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12042         (struct_declaration): Update accordingly.
12043         (constant_declaration): Update.
12044         (field_declaration): Update.
12045         (method_header): Update.
12046         (fixed_parameter): Update.
12047         (parameter_array): Ditto.
12048         (property_declaration): Ditto.
12049         (destructor_declaration): Ditto.
12050         
12051         * class.cs (Struct::Struct): Update constructors accordingly.
12052         (Class::Class): Ditto.
12053         (Field::Field): Ditto.
12054         (Method::Method): Ditto.
12055         (Property::Property): Ditto.
12056         (TypeContainer::OptAttribute): update property's return type.
12057         
12058         * interface.cs (Interface.opt_attributes): New member.
12059         (Interface::Interface): Update to take the extra Attributes argument.
12060
12061         * parameter.cs (Parameter::Parameter): Ditto.
12062
12063         * constant.cs (Constant::Constant): Ditto.
12064
12065         * interface.cs (InterfaceMemberBase): New OptAttributes field.
12066         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
12067         the attributes as a parameter.
12068         (InterfaceProperty): Update constructor call.
12069         (InterfaceEvent): Ditto.
12070         (InterfaceMethod): Ditto.
12071         (InterfaceIndexer): Ditto.
12072
12073         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
12074         pass the attributes too.
12075         (interface_event_declaration): Ditto.
12076         (interface_property_declaration): Ditto.
12077         (interface_method_declaration): Ditto.
12078         (interface_declaration): Ditto.
12079
12080 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
12081
12082         * class.cs (Method::Define): Track the "static Main" definition to
12083         create an entry point. 
12084
12085         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12086         EntryPoint if we find it. 
12087
12088         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12089         (EmitContext::ig): Make this variable public.
12090
12091         * driver.cs: Make the default output file be the first file name
12092         with the .exe extension.  
12093
12094         Detect empty compilations
12095
12096         Handle various kinds of output targets.  Handle --target and
12097         rename -t to --dumper.
12098
12099         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
12100         methods inherited from Expression return now an Expression.  This
12101         will is used during the tree rewriting as we resolve them during
12102         semantic analysis.
12103
12104         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
12105         the spec.  Missing entirely is the information about
12106         accessability of elements of it.
12107
12108         (Expression::ExprClassFromMemberInfo): New constructor for
12109         Expressions that creates a fully initialized Expression based on
12110         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
12111         a Type.
12112
12113         (Invocation::Resolve): Begin implementing resolution of invocations.
12114         
12115         * literal.cs (StringLiteral):  Implement Emit.
12116
12117 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12118
12119         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12120         member.
12121         
12122 2001-09-04  Ravi Pratap  <ravi@ximian.com>
12123
12124         * cs-parser.jay (attribute_arguments): Implement actions.
12125         (attribute): Fix bug in production. Implement action.
12126         (attribute_list): Implement.
12127         (attribute_target): Implement.
12128         (attribute_target_specifier, opt_target_specifier): Implement
12129         (CheckAttributeTarget): New method to check if the attribute target
12130         is valid.
12131         (attribute_section): Implement.
12132         (opt_attributes): Implement.
12133
12134         * attribute.cs : New file to handle attributes.
12135         (Attribute): Class to hold attribute info.
12136
12137         * cs-parser.jay (opt_attribute_target_specifier): Remove production
12138         (attribute_section): Modify production to use 2 different rules to 
12139         achieve the same thing. 1 s/r conflict down !
12140         Clean out commented, useless, non-reducing dimension_separator rules.
12141         
12142         * class.cs (TypeContainer.attributes): New member to hold list
12143         of attributes for a type.
12144         (Struct::Struct): Modify to take one more argument, the attribute list.
12145         (Class::Class): Ditto.
12146         (Field::Field): Ditto.
12147         (Method::Method): Ditto.
12148         (Property::Property): Ditto.
12149         
12150         * cs-parser.jay (struct_declaration): Update constructor call to
12151         pass in the attributes too.
12152         (class_declaration): Ditto.
12153         (constant_declaration): Ditto.
12154         (field_declaration): Ditto.
12155         (method_header): Ditto.
12156         (fixed_parameter): Ditto.
12157         (parameter_array): Ditto.
12158         (property_declaration): Ditto.
12159
12160         * constant.cs (Constant::Constant): Update constructor similarly.
12161         Use System.Collections.
12162
12163         * parameter.cs (Parameter::Parameter): Update as above.
12164
12165 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12166
12167         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12168         (TypeContainer.delegates): New member to hold list of delegates.
12169
12170         * cs-parser.jay (delegate_declaration): Implement the action correctly 
12171         this time as I seem to be on crack ;-)
12172
12173 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
12174
12175         * rootcontext.cs (RootContext::IsNamespace): new function, used to
12176         tell whether an identifier represents a namespace.
12177
12178         * expression.cs (NamespaceExpr): A namespace expression, used only
12179         temporarly during expression resolution.
12180         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12181         utility functions to resolve names on expressions.
12182
12183 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
12184
12185         * codegen.cs: Add hook for StatementExpressions. 
12186
12187         * class.cs: Fix inverted test for static flag in methods.
12188
12189 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12190
12191         * class.cs (Operator::CheckUnaryOperator): Correct error number used
12192         to make it coincide with MS' number.
12193         (Operator::CheckBinaryOperator): Ditto.
12194
12195         * ../errors/errors.txt : Remove error numbers added earlier.
12196
12197         * ../errors/cs1019.cs : Test case for error # 1019
12198
12199         * ../errros/cs1020.cs : Test case for error # 1020
12200
12201         * cs-parser.jay : Clean out commented cruft.
12202         (dimension_separators, dimension_separator): Comment out. Ostensibly not
12203         used anywhere - non-reducing rule.
12204         (namespace_declarations): Non-reducing rule - comment out.
12205
12206         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12207         with TypeContainer::AddEnum.
12208
12209         * delegate.cs : New file for delegate handling classes.
12210         (Delegate): Class for declaring delegates.
12211
12212         * makefile : Update.
12213
12214         * cs-parser.jay (delegate_declaration): Implement.
12215
12216 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
12217
12218         * class.cs (Event::Define): Implement.
12219         (Event.EventBuilder): New member.
12220
12221         * class.cs (TypeContainer::Populate): Update to define all enums and events
12222         we have.
12223         (Events): New property for the events arraylist we hold. Shouldn't we move to using
12224         readonly fields for all these cases ?
12225
12226 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12227
12228         * class.cs (Property): Revamp to use the convention of making fields readonly.
12229         Accordingly modify code elsewhere.
12230
12231         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12232         the Define method of the Property class.
12233
12234         * class.cs : Clean up applied patch and update references to variables etc. Fix 
12235         trivial bug.
12236         (TypeContainer::Populate): Update to define all the properties we have. Also
12237         define all enumerations.
12238
12239         * enum.cs (Define): Implement.
12240         
12241 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12242
12243         * cs-parser.jay (overloadable_operator): The semantic value is an
12244         enum of the Operator class.
12245         (operator_declarator): Implement actions.
12246         (operator_declaration): Implement.
12247
12248         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12249         validity of definitions.
12250         (Operator::CheckBinaryOperator): Static method to check for binary operators
12251         (TypeContainer::AddOperator): New method to add an operator to a type.
12252
12253         * cs-parser.jay (indexer_declaration): Added line to actually call the
12254         AddIndexer method so it gets added ;-)
12255
12256         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
12257         already taken care of by the MS compiler ?  
12258
12259 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12260
12261         * class.cs (Operator): New class for operator declarations.
12262         (Operator::OpType): Enum for the various operators.
12263
12264 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12265
12266         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12267         ostensibly handle this in semantic analysis.
12268
12269         * cs-parser.jay (general_catch_clause): Comment out
12270         (specific_catch_clauses, specific_catch_clause): Ditto.
12271         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12272         (catch_args, opt_catch_args): New productions.
12273         (catch_clause): Rewrite to use the new productions above
12274         (catch_clauses): Modify accordingly.
12275         (opt_catch_clauses): New production to use in try_statement
12276         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12277         and re-write the code in the actions to extract the specific and
12278         general catch clauses by being a little smart ;-)
12279
12280         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12281         Hooray, try and catch statements parse fine !
12282         
12283 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12284
12285         * statement.cs (Block::GetVariableType): Fix logic to extract the type
12286         string from the hashtable of variables.
12287
12288         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12289         I end up making that mistake ;-)
12290         (catch_clauses): Fixed gross error which made Key and Value of the 
12291         DictionaryEntry the same : $1 !!
12292
12293 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12294
12295         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12296
12297         * cs-parser.jay (event_declaration): Correct to remove the semicolon
12298         when the add and remove accessors are specified. 
12299
12300 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12301
12302         * cs-parser.jay (IndexerDeclaration): New helper class to hold
12303         information about indexer_declarator.
12304         (indexer_declarator): Implement actions.
12305         (parsing_indexer): New local boolean used to keep track of whether
12306         we are parsing indexers or properties. This is necessary because 
12307         implicit_parameters come into picture even for the get accessor in the 
12308         case of an indexer.
12309         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12310
12311         * class.cs (Indexer): New class for indexer declarations.
12312         (TypeContainer::AddIndexer): New method to add an indexer to a type.
12313         (TypeContainer::indexers): New member to hold list of indexers for the
12314         type.
12315
12316 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12317
12318         * cs-parser.jay (add_accessor_declaration): Implement action.
12319         (remove_accessor_declaration): Implement action.
12320         (event_accessors_declaration): Implement
12321         (variable_declarators): swap statements for first rule - trivial.
12322
12323         * class.cs (Event): New class to hold information about event
12324         declarations.
12325         (TypeContainer::AddEvent): New method to add an event to a type
12326         (TypeContainer::events): New member to hold list of events.
12327
12328         * cs-parser.jay (event_declaration): Implement actions.
12329
12330 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12331
12332         * cs-parser.jay (dim_separators): Implement. Make it a string
12333         concatenating all the commas together, just as they appear.
12334         (opt_dim_separators): Modify accordingly
12335         (rank_specifiers): Update accordingly. Basically do the same
12336         thing - instead, collect the brackets here.
12337         (opt_rank_sepcifiers): Modify accordingly.
12338         (array_type): Modify to actually return the complete type string
12339         instead of ignoring the rank_specifiers.
12340         (expression_list): Implement to collect the expressions
12341         (variable_initializer): Implement. We make it a list of expressions
12342         essentially so that we can handle the array_initializer case neatly too.
12343         (variable_initializer_list): Implement.
12344         (array_initializer): Make it a list of variable_initializers
12345         (opt_array_initializer): Modify accordingly.
12346
12347         * expression.cs (New::NType): Add enumeration to help us
12348         keep track of whether we have an object/delegate creation
12349         or an array creation.
12350         (New:NewType, New::Rank, New::Indices, New::Initializers): New
12351         members to hold data about array creation.
12352         (New:New): Modify to update NewType
12353         (New:New): New Overloaded contructor for the array creation
12354         case.
12355
12356         * cs-parser.jay (array_creation_expression): Implement to call
12357         the overloaded New constructor.
12358         
12359 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
12360
12361         * class.cs (TypeContainer::Constructors): Return member
12362         constructors instead of returning null.
12363
12364 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
12365
12366         * typemanager.cs (InitCoreTypes): Initialize the various core
12367         types after we have populated the type manager with the user
12368         defined types (this distinction will be important later while
12369         compiling corlib.dll)
12370
12371         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12372         on Expression Classification.  Now all expressions have a method
12373         `Resolve' and a method `Emit'.
12374
12375         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12376         generation from working.     Also add some temporary debugging
12377         code. 
12378         
12379 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
12380
12381         * codegen.cs: Lots of code generation pieces.  This is only the
12382         beginning, will continue tomorrow with more touches of polish.  We
12383         handle the fundamentals of if, while, do, for, return.  Others are
12384         trickier and I need to start working on invocations soon.
12385         
12386         * gen-treedump.cs: Bug fix, use s.Increment here instead of
12387         s.InitStatement. 
12388
12389         * codegen.cs (EmitContext): New struct, used during code
12390         emission to keep a context.   Most of the code generation will be
12391         here. 
12392
12393         * cs-parser.jay: Add embedded blocks to the list of statements of
12394         this block.  So code generation proceeds in a top down fashion.
12395
12396 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
12397
12398         * statement.cs: Add support for multiple child blocks.
12399
12400 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
12401
12402         * codegen.cs (EmitCode): New function, will emit the code for a
12403         Block of code given a TypeContainer and its ILGenerator. 
12404
12405         * statement.cs (Block): Standard public readonly optimization.
12406         (Block::Block constructors): Link children. 
12407         (Block::Child): Child Linker.
12408         (Block::EmitVariables): Emits IL variable declarations.
12409
12410         * class.cs: Drop support for MethodGroups here, delay until
12411         Semantic Analysis.
12412         (Method::): Applied the same simplification that I did before, and
12413         move from Properties to public readonly fields.
12414         (Method::ParameterTypes): Returns the parameter types for the
12415         function, and implements a cache that will be useful later when I
12416         do error checking and the semantic analysis on the methods is
12417         performed.
12418         (Constructor::GetCallingConvention): Renamed from CallingConvetion
12419         and made a method, optional argument tells whether this is a class
12420         or a structure to apply the `has-this' bit.
12421         (Method::GetCallingConvention): Implement, returns the calling
12422         convention. 
12423         (Method::Define): Defines the type, a second pass is performed
12424         later to populate the methods.
12425
12426         (Constructor::ParameterTypes): implement a cache similar to the
12427         one on Method::ParameterTypes, useful later when we do semantic
12428         analysis. 
12429
12430         (TypeContainer::EmitMethod):  New method.  Emits methods.
12431
12432         * expression.cs: Removed MethodGroup class from here.
12433         
12434         * parameter.cs (Parameters::GetCallingConvention): new method.
12435
12436 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
12437
12438         * class.cs (TypeContainer::Populate): Drop RootContext from the
12439         argument. 
12440
12441         (Constructor::CallingConvention): Returns the calling convention.
12442         (Constructor::ParameterTypes): Returns the constructor parameter
12443         types. 
12444         
12445         (TypeContainer::AddConstructor): Keep track of default constructor
12446         and the default static constructor.
12447
12448         (Constructor::) Another class that starts using `public readonly'
12449         instead of properties. 
12450
12451         (Constructor::IsDefault): Whether this is a default constructor. 
12452
12453         (Field::) use readonly public fields instead of properties also.
12454
12455         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12456         track of static constructors;  If none is used, turn on
12457         BeforeFieldInit in the TypeAttributes. 
12458
12459         * cs-parser.jay (opt_argument_list): now the return can be null
12460         for the cases where there are no arguments. 
12461
12462         (constructor_declarator): If there is no implicit `base' or
12463         `this', then invoke the default parent constructor. 
12464         
12465         * modifiers.cs (MethodAttr): New static function maps a set of
12466         modifiers flags into a MethodAttributes enum
12467         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
12468         MethodAttr, TypeAttr to represent the various mappings where the
12469         modifiers are used.
12470         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
12471
12472 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
12473
12474         * parameter.cs (GetParameterInfo): Fix bug where there would be no
12475         method arguments.
12476
12477         * interface.cs (PopulateIndexer): Implemented the code generator
12478         for interface indexers.
12479
12480 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
12481
12482         * interface.cs (InterfaceMemberBase): Now we track the new status
12483         here.  
12484
12485         (PopulateProperty): Implement property population.  Woohoo!  Got
12486         Methods and Properties going today. 
12487
12488         Removed all the properties for interfaces, and replaced them with
12489         `public readonly' fields. 
12490
12491 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
12492
12493         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12494         initialize their hashtables/arraylists only when they are needed
12495         instead of doing this always.
12496
12497         * parameter.cs: Handle refs and out parameters.
12498
12499         * cs-parser.jay: Use an ArrayList to construct the arguments
12500         instead of the ParameterCollection, and then cast that to a
12501         Parameter[] array.
12502
12503         * parameter.cs: Drop the use of ParameterCollection and use
12504         instead arrays of Parameters.
12505
12506         (GetParameterInfo): Use the Type, not the Name when resolving
12507         types. 
12508
12509 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
12510
12511         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12512         and instead use public readonly fields.
12513
12514         * class.cs: Put back walking code for type containers.
12515
12516 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
12517
12518         * class.cs (MakeConstant): Code to define constants.
12519
12520         * rootcontext.cs (LookupType): New function.  Used to locate types 
12521
12522         
12523 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
12524
12525         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
12526         this System.Reflection code is.  Kudos to Microsoft
12527         
12528         * typemanager.cs: Implement a type cache and avoid loading all
12529         types at boot time.  Wrap in LookupType the internals.  This made
12530         the compiler so much faster.  Wow.  I rule!
12531         
12532         * driver.cs: Make sure we always load mscorlib first (for
12533         debugging purposes, nothing really important).
12534
12535         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
12536         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
12537
12538         * rootcontext.cs: Lookup types on their namespace;  Lookup types
12539         on namespaces that have been imported using the `using' keyword.
12540
12541         * class.cs (TypeContainer::TypeAttr): Virtualize.
12542         (Class::TypeAttr): Return attributes suitable for this bad boy.
12543         (Struct::TypeAttr): ditto.
12544         Handle nested classes.
12545         (TypeContainer::) Remove all the type visiting code, it is now
12546         replaced with the rootcontext.cs code
12547
12548         * rootcontext.cs (GetClassBases): Added support for structs. 
12549
12550 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
12551
12552         * interface.cs, statement.cs, class.cs, parameter.cs,
12553         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12554         Drop use of TypeRefs, and use strings instead.
12555
12556 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
12557
12558         * rootcontext.cs: 
12559
12560         * class.cs (Struct::Struct): set the SEALED flags after
12561         checking the modifiers.
12562         (TypeContainer::TypeAttr): new property, returns the
12563         TypeAttributes for a class.  
12564
12565         * cs-parser.jay (type_list): Oops, list production was creating a
12566         new list of base types.
12567
12568         * rootcontext.cs (StdLib): New property.
12569         (GetInterfaceTypeByName): returns an interface by type name, and
12570         encapsulates error handling here.
12571         (GetInterfaces): simplified.
12572         (ResolveTree): Encapsulated all the tree resolution here.
12573         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12574         types. 
12575         
12576         * driver.cs: Add support for --nostdlib, to avoid loading the
12577         default assemblies.
12578         (Main): Do not put tree resolution here. 
12579
12580         * rootcontext.cs: Beginning of the class resolution.
12581
12582 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
12583
12584         * rootcontext.cs: Provide better error reporting. 
12585
12586         * cs-parser.jay (interface_base): set our $$ to be interfaces.
12587
12588         * rootcontext.cs (CreateInterface): Handle the case where there
12589         are no parent interfaces.
12590         
12591         (CloseTypes): Routine to flush types at the end.
12592         (CreateInterface): Track types.
12593         (GetInterfaces): Returns an array of Types from the list of
12594         defined interfaces.
12595
12596         * typemanager.c (AddUserType): Mechanism to track user types (puts
12597         the type on the global type hash, and allows us to close it at the
12598         end). 
12599         
12600 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
12601
12602         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12603         RecordInterface instead.
12604
12605         * cs-parser.jay: Updated to reflect changes above.
12606
12607         * decl.cs (Definition): Keep track of the TypeBuilder type that
12608         represents this type here.  Not sure we will use it in the long
12609         run, but wont hurt for now.
12610
12611         * driver.cs: Smaller changes to accomodate the new code.
12612
12613         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12614         when done. 
12615
12616         * rootcontext.cs (CreateInterface):  New method, used to create
12617         the System.TypeBuilder type for interfaces.
12618         (ResolveInterfaces): new entry point to resolve the interface
12619         hierarchy. 
12620         (CodeGen): Property, used to keep track of the code generator.
12621
12622 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
12623
12624         * cs-parser.jay: Add a second production for delegate_declaration
12625         with `VOID'.
12626
12627         (enum_body): Put an opt_comma here instead of putting it on
12628         enum_body or enum_member_declarations so we can handle trailing
12629         commas on enumeration members.  Gets rid of a shift/reduce.
12630         
12631         (type_list): Need a COMMA in the middle.
12632
12633         (indexer_declaration): Tell tokenizer to recognize get/set
12634
12635         * Remove old targets.
12636
12637         * Re-add the parser target.
12638
12639 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12640
12641         * cs-parser.jay: Add precendence rules for a number of operators
12642         ot reduce the number of shift/reduce conflicts in the grammar.
12643         
12644 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
12645
12646         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12647         and put it here.
12648
12649         Get rid of old crufty code.
12650
12651         * rootcontext.cs: Use this to keep track of the parsed
12652         representation and the defined types available to the program. 
12653
12654         * gen-treedump.cs: adjust for new convention.
12655
12656         * type.cs: Split out the type manager, and the assembly builder
12657         from here. 
12658
12659         * typemanager.cs: the type manager will live here now.
12660
12661         * cil-codegen.cs: And the code generator here. 
12662
12663 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
12664
12665         * makefile: Fixed up for easy making.
12666
12667 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12668
12669         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12670         the 
12671
12672         (unary_expression): Expand pre_increment_expression and
12673         post_decrement_expression to reduce a shift/reduce.
12674
12675 2001-07-11  Simon Cozens
12676
12677         * cs-tokenizer.cs: Hex numbers should begin with a 0.
12678
12679         Improve allow_keyword_as_indent name.
12680
12681 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
12682
12683         * Adjustments for Beta2. 
12684
12685 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
12686
12687         * decl.cs: Added `Define' abstract method.
12688         (InTransit): new property, used to catch recursive definitions. 
12689
12690         * interface.cs: Implement `Define'. 
12691
12692         * modifiers.cs: Map Modifiers.constants to
12693         System.Reflection.TypeAttribute flags.
12694
12695         * class.cs: Keep track of types and user-defined types.
12696         (BuilderInit): New method for creating an assembly
12697         (ResolveType): New function to launch the resolution process, only
12698         used by interfaces for now.
12699
12700         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12701         that are inserted into the name space. 
12702
12703 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
12704
12705         * ARGH.  I have screwed up my tree so many times due to the use of
12706         rsync rather than using CVS.  Going to fix this at once. 
12707
12708         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
12709         load types.
12710
12711 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
12712
12713         * Experiment successful: Use System.Type rather that our own
12714         version of Type.  
12715
12716 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
12717
12718         * cs-parser.jay: Removed nsAliases from here.
12719
12720         Use new namespaces, handle `using XXX;' 
12721
12722         * namespace.cs: Reimplemented namespace handling, use a recursive
12723         definition of the class.  Now we can keep track of using clauses
12724         and catch invalid using clauses.
12725
12726 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
12727
12728         * gen-treedump.cs: Adapted for all the renaming.
12729
12730         * expression.cs (Expression): this class now has a Type property
12731         which returns an expression Type.
12732
12733         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12734         `Type', as this has a different meaning now in the base
12735
12736 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
12737
12738         * interface.cs, class.cs: Removed from all the sources the
12739         references to signature computation, as we can not do method
12740         signature computation during the parsing time, as we are not
12741         trying to solve at that point distinguishing:
12742
12743         class X {
12744                 void a (Blah x) {}
12745                 void a (NS.Blah x) {}
12746         }
12747
12748         Which depending on the context might be valid or not, as we do not
12749         know if Blah is the same thing as NS.Blah at that point.
12750
12751         * Redid everything so the code uses TypeRefs now instead of
12752         Types.  TypeRefs are just temporary type placeholders, that need
12753         to be resolved.  They initially have a pointer to a string and the
12754         current scope in which they are used.  This is used later by the
12755         compiler to resolve the reference to an actual Type. 
12756
12757         * DeclSpace is no longer a CIR.Type, and neither are
12758         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
12759         are all DeclSpaces, but no Types. 
12760
12761         * type.cs (TypeRefManager): This implements the TypeRef manager,
12762         which keeps track of all the types that need to be resolved after
12763         the parsing has finished. 
12764
12765 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
12766
12767         * ARGH.  We are going to have to store `foreach' as a class rather
12768         than resolving it, as we need to verify error 1579 after name
12769         resolution.   *OR* we could keep a flag that says `This request to
12770         IEnumerator comes from a foreach statement' which we can then use
12771         to generate the error.
12772
12773 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
12774
12775         * class.cs (TypeContainer.AddMethod): we now add methods to the
12776         MethodGroup instead of the method hashtable.  
12777
12778         * expression.cs: Add MethodGroup abstraction, which gets us one
12779         step closer to the specification in the way we handle method
12780         declarations.  
12781
12782         * cs-parser.jay (primary_expression): qualified_identifier now
12783         tried to match up an identifier to a local variable reference or
12784         to a parameter reference.
12785
12786         current_local_parameters is now a parser global variable that
12787         points to the current parameters for the block, used during name
12788         lookup.
12789
12790         (property_declaration): Now creates an implicit `value' argument to
12791         the set accessor.
12792
12793 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
12794
12795         * parameter.cs: Do not use `param' arguments as part of the
12796         signature, per the spec.
12797
12798 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
12799
12800         * decl.cs: Base class for classes, structs and interfaces.  This
12801         is the "Declaration Space" 
12802
12803         * cs-parser.jay: Use CheckDef for checking declaration errors
12804         instead of having one on each function.
12805
12806         * class.cs: Factor out some code for handling error handling in
12807         accordance to the "Declarations" section in the "Basic Concepts"
12808         chapter in the ECMA C# spec.
12809
12810         * interface.cs: Make all interface member classes derive from
12811         InterfaceMemberBase.
12812
12813 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
12814
12815         * Many things: all interfaces are parsed and generated in
12816         gen-treedump.  Support for member variables, constructors,
12817         destructors, properties, constants is there.
12818
12819         Beginning of the IL backend, but very little done, just there for
12820         testing purposes. 
12821
12822 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
12823
12824         * cs-parser.jay: Fix labeled statement.
12825
12826         * cs-tokenizer.cs (escape): Escape " and ' always.
12827         ref_line, ref_name: keep track of the line/filename as instructed
12828         by #line by the compiler.
12829         Parse #line.
12830
12831 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
12832
12833         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12834         to match the values in System.CodeDOM.
12835
12836         Divid renamed to Divide.
12837
12838         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12839         statements. 
12840         (Statements.set): remove.
12841
12842         * System.CodeDOM/CodeCatchClause.cs: always have a valid
12843         statements. 
12844
12845         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12846         falseStatements always have valid values. 
12847
12848         * cs-parser.jay: Use System.CodeDOM now.
12849