2003-11-04 cesar lopez nataren <cesar@ciencias.unam.mx>
[mono.git] / mcs / gmcs / ChangeLog
1 2003-11-03  Martin Baulig  <martin@ximian.com>
2
3         * expression.cs (ArrayAccess.GetStoreOpcode): Added
4         `out bool has_type_arg'; if set, we need to pass the type to
5         ig.Emit().
6         (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
7         Stelem_Any/Ldelem_Any for generic parameters.   
8
9 2003-11-02  Martin Baulig  <martin@ximian.com>
10
11         * expression.cs (Invocation.EmitCall): Use
12         `TypeManager.IsValueType()' to check whether it's a value type.
13         Don't set `struct_call' when calling a method on a type parameter.
14
15 2003-11-02  Martin Baulig  <martin@ximian.com>
16
17         * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
18         and removed the TypeBuilder argument.
19
20         * typemanager.cs (TypeManager.IsValueType): Return
21         `t.IsGenericParameter || t.IsValueType'.
22
23 2003-10-25  Martin Baulig  <martin@ximian.com>
24
25         * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
26         call ConstructedType.Resolve() on it.
27
28         * generic.cs (ConstructedType.Resolve): Set `type' on success.
29
30 2003-10-25  Martin Baulig  <martin@ximian.com>
31
32         * class.cs (TypeContainer.GetClassBases): Changed
33         `out Type parent' into `out TypeExpr parent'.  Moved CS0644 and
34         CS8214 reporting here.
35         (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
36         instead of a `Type' for our parent.  In case of a recursive
37         declaration (see tests/gen-23.cs for an example), our parent is a
38         ConstructedType and it doesn't have its type set.  So, first
39         create our own TypeBuilder, then call constructed.Resolve() to get
40         the parent's type and finally TypeBuilder.SetParent() it.
41
42         * ecore.cs (TypeExpr.Name): New public virtual property.
43
44         * generic.cs
45         (ConstructedType): We're now a TypeExpr and not just an Expression.
46         (ConstructedType.ResolveAsTypeStep): Don't resolve our type
47         arguments here; this is done later.
48         (ConstructedType.Resolve): New public method to resolve the type
49         arguments and bind them.
50
51 2003-10-21  Martin Baulig  <martin@ximian.com>
52
53         * convert.cs: Use `TypeManager.IsValueType' instead of
54         'type.IsValueType' everywhere.
55
56         * typemanager.cs (TypeManager.IsValueType): Return true for type
57         parameters.  The reason for this is that we need to box a type
58         parameter when converting it to a reference type.
59
60         * cs-parser.jay: Added support for default value expressions.
61
62         * generics.cs (DefaultValueExpression): New public class.       
63
64 2003-10-17  Martin Baulig  <martin@ximian.com>
65
66         * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
67         TypeContainer so we can also use this for Interfaces.
68         (TypeParameter.Resolve): Likewise.
69
70         * interface.cs (Interface.DefineType): Added support for generic
71         interfaces.
72
73         * cs-parser.jay: Added support for generic structs and interfaces.
74
75 2003-10-17  Martin Baulig  <martin@ximian.com>
76
77         * generic.cs (GenericMemberAccess.DoResolve): We can now actually
78         call generic methods :-)
79
80 2003-10-16  Martin Baulig  <martin@ximian.com>
81
82         * cs-parser.jay (namespace_or_type_name): Only create a
83         GenericMemberAccess if we actually have type arguments.
84
85 2003-10-13  Martin Baulig  <martin@ximian.com>
86
87         * class.cs (Method.Define): If we're a generic method, call
88         TypeBuilder.DefineGenericMethod () before resolving
89         the parameters.
90         (MethodData): Added .ctor which takes an additional MethodBuilder
91         argument; this is used for generic methods.
92         (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
93         we already have a MethodBuilder.
94
95 2003-10-10  Martin Baulig  <martin@ximian.com>
96
97         * class.cs (Method): Added .ctor which takes a `GenericMethod'
98         instead of a `DeclSpace'.  This is used for generic methods.
99
100         * cs-parser.jay (method_header): Added support for generic
101         methods; create a `GenericMethod' instance and pass it to the
102         `Method's .ctor; it'll be used as the `DeclSpace' to lookup
103         parameters and locals.
104
105         * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
106         since we already have the location.  Check whether we're a generic
107         type declaration or a generic method and create the correct type
108         parameter.
109
110         * generic.cs (TypeParameter.DefineMethod): New public method.
111         (GenericMethod): New public class; derives from DeclSpace and is
112         used for generic methods.       
113
114 2003-10-09  Martin Baulig  <martin@ximian.com>
115
116         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
117         to the .ctor.
118         (MethodCore.DoDefineParameters): Removed the TypeContainer
119         argument; use the DeclSpace which was passed to the .ctor instead.
120         (MethodCore.CheckParameter): Take a DeclSpace instead of a
121         TypeContainer; we only need a DeclSpace here.
122
123 2003-10-09  Martin Baulig  <martin@ximian.com>
124
125         * class.cs (MethodData): Added additional `DeclSpace ds' argument
126         to the .ctor.
127         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
128         EmitContext's .ctor.    
129
130 2003-10-09  Martin Baulig  <martin@ximian.com>
131
132         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
133         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
134         AsAccessible(), moved them as well.
135
136         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
137
138 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
139
140         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
141         generation for >=, as spotted by Paolo, bug 48679.  
142         Patch from David Waite.
143
144         * cs-tokenizer.cs: Add handling for #pragma.
145
146         * cs-parser.jay: Allow for both yield and yield return in the
147         syntax.  The anti-cobolization of C# fight will go on!
148
149         * class.cs (TypeBuilder.DefineType): Catch error condition here
150         (Parent.DefineType erroring out and returning null).
151
152         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
153         coping with enumerations variables, we were mistakenly processing
154         them as a regular value type instead of built-in types.  Fixes the
155         bug #48063
156
157         * typemanager.cs (IsBuiltinOrEnum): New method.
158
159 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
160
161         * cs-parser.jay: Upgrade: yield now needs the return clause.
162
163 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
164
165         * cs-parser.jay : Renamed yyName to yyNames related to jay.
166
167 2003-09-29  Martin Baulig  <martin@ximian.com>
168
169         * typemanager.cs (TypeManager.GetMethodFlags): Added support for
170         inflated generic methods.
171
172         * generics.cs (ConstructedType): Distinguish between open and
173         closed constructed types; correctly resolve the arguments.
174
175 2003-09-22  Martin Baulig  <martin@ximian.com>
176
177         * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
178         all type arguments meet their constraints.
179
180 2003-09-19  Martin Baulig  <martin@ximian.com>
181
182         * decl.cs (MemberCache.SetupCacheForInterface): Take a
183         `MemberCache parent' argument.  Normally, an interface doesn't
184         have a parent type except System.Object, but we use this in gmcs
185         for generic type parameters.
186
187 2003-09-18  Martin Baulig  <martin@ximian.com>
188
189         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
190         on `type.IsInterface'; don't check whether the type has a parent
191         to determine whether it's an interface.
192
193 2003-09-17  Martin Baulig  <martin@ximian.com>
194
195         * generic.cs (ConstructedType.ToString): Always use `name' as the
196         type name.
197
198 2003-09-15  Martin Baulig  <martin@ximian.com>
199
200         * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
201
202         * generic.cs (Constraints.Resolve): New public method; this is
203         called to resolve the constraint types and to check whether all
204         the constraints are correct.
205         (Constraints.Types): New public property.
206         (TypeParameter.Resolve): New public method; resolves all the
207         type's constraints.
208
209         * class.cs (TypeContainer.DefineType): Call
210         TypeParameter.Resolve() before actually defining the type.
211
212 2003-09-15  Martin Baulig  <martin@ximian.com>
213
214         * class.cs (TypeContainer.DefineType): Added an error flag to
215         avoid reporting duplicate CS0146's ("class definition is
216         circular.").
217
218         * driver.cs (Driver.MainDriver): Abort if
219         RootContext.ResolveTree() reported any errors.
220
221 2003-09-07  Martin Baulig  <martin@ximian.com>
222
223         * report.cs (Error, Warning): Added overloaded versions which take
224         a `params object[] args' and call String.Format().
225
226 2003-09-07  Martin Baulig  <martin@ximian.com>
227
228         * decl.cs (DeclSpace..ctor): Don't call
229         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
230         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
231         (DeclSpace.RecordDecl): New method.
232
233         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
234
235 2003-09-02  Ravi Pratap  <ravi@ximian.com>
236
237         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
238         value attributes to be applied to ParameterBuilders.
239
240         * class.cs (MethodCore.LabelParameters): Make static and more
241         generic so that it can be used from other places - like interface
242         methods, for instance.
243
244         * interface.cs (Interface.Emit): Call LabelParameters before
245         emitting attributes on the InterfaceMethod.
246
247 2003-09-07  Martin Baulig  <martin@ximian.com>
248
249         * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
250         if the number of type parameters doesn't match.
251
252 2003-09-04  Martin Baulig  <martin@ximian.com>
253
254         * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
255         for arrays of generic type params (ie. `!0[]').
256
257 2003-09-04  Martin Baulig  <martin@ximian.com>
258
259         * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
260         for the moment.
261
262 2003-09-04  Martin Baulig  <martin@ximian.com>
263
264         * decl.cs (DeclSpace.LookupGeneric): New method.
265         (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
266         moment.
267
268         * generic.cs (TypeParameterExpr): Take a TypeParameter as
269         argument, not just a string.
270         (TypeParameter.Define): New public method; this is called to
271         actually define the generic parameter; after this, you can use the
272         new `Type' property to get the type.
273
274 2003-09-04  Martin Baulig  <martin@ximian.com>
275
276         * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
277         is now an ArrayList; initialize the result of the `TypeParameters'
278         property here.
279         (DeclSpace.GetGenericData): Removed.
280         (DeclSpace.LookupGeneric): Temporarily removed; we need to
281         implement this in a different way.
282         (DeclSpace.GetTypeParameters): Removed; there's now a
283         `TypeParameters' property.
284         (DeclSpace.TypeParameters): New public property.
285
286         * generic.cs (Constraints): Make this class public.
287         (TypeParameter): New public class.
288
289 2003-09-04  Martin Baulig  <martin@ximian.com>
290
291         * decl.cs (DeclSpace.GetTypeParameters): New method to return the
292         generic parameters.
293
294         * class.cs (TypeContainer.DefineType): Call
295         TypeBuilder.DefineGenericParameter () on all generic parameters if
296         this is a generic type.
297
298 2003-08-28  Martin Baulig  <martin@ximian.com>
299
300         * sample-stack.il: Compile this with ilasm: "ilasm /dll
301         sample-stack.il".
302
303         * sample-hello.cs: Compile this with gmcs: "gmcs
304         /r:sample-stack.dll sample-hello.cs".
305
306 2003-08-28  Martin Baulig  <martin@ximian.com>
307
308         * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
309         the parameters to the generic type.
310
311 2003-08-28  Martin Baulig  <martin@ximian.com>
312
313         * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
314
315 2003-08-28  Martin Baulig  <martin@ximian.com>
316
317         * cs-parser.jay (opt_type_argument_list): Use
318         `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
319         (primary_expression): Replace `qualified_identifier' with `type_name'.
320         (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
321
322         * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
323         parser to check whether it is syntactically a type parameter list;
324         return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
325         this case.
326
327 2003-08-26  Martin Baulig  <martin@ximian.com>
328
329         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
330         resolving aliases; fixes #47927.
331
332 2003-08-26  Martin Baulig  <martin@ximian.com>
333
334         * statement.cs (Using.DoResolve): This is internally emitting a
335         try/finally clause, so we need to set ec.NeedExplicitReturn if we
336         do not always return.  Fixes #47681.
337
338 2003-08-26  Martin Baulig  <martin@ximian.com>
339
340         * decl.cs (MemberCore): Moved WarningNotHiding(),
341         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
342         into MemberBase.
343         (AdditionResult): Make this nested in DeclSpace.
344         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
345         argument; call NamespaceEntry.Define() unless we're nested in a
346         class or struct.
347
348         * namespace.cs (Namespace.DefineName): New public function.  This
349         is called from DeclSpace's .ctor to add 
350         (Namespace.Lookup): Include DeclSpaces in the lookup.
351
352         * class.cs (Operator): Derive from MemberBase, not MemberCore.
353
354         * const.cs (Const): Derive from MemberBase, not MemberCore.     
355
356 2003-08-25  Martin Baulig  <martin@ximian.com>
357
358         * convert.cs (Convert.ExplicitReferenceConversion): When
359         converting from an interface type to a class, unbox if the target
360         type is a struct type.  Fixes #47822.
361
362 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
363
364         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
365         #47854.
366
367 2003-08-22  Martin Baulig  <martin@ximian.com>
368
369         * class.cs (TypeManager.DefineType): When defining a nested type,
370         call DefineType() on our parent; fixes #47801.
371
372 2003-08-22  Martin Baulig  <martin@ximian.com>
373
374         * class.cs (MethodData.Define): While checking if a method is an
375         interface implementation, improve the test a bit more to fix #47654.
376
377 2003-08-22  Martin Baulig  <martin@ximian.com>
378
379         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
380         correctly; fixes #47722.
381
382 2003-08-22  Martin Baulig  <martin@ximian.com>
383
384         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
385         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
386
387         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
388
389 2003-08-22  Martin Baulig  <martin@ximian.com>
390
391         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
392         can only be assigned in static constructors.  Fixes #47161.
393
394 2003-08-22  Martin Baulig  <martin@ximian.com>
395
396         Rewrote and improved the flow analysis code.
397
398         * flowbranching.cs (FlowBranching): Make this class abstract.
399         (FlowBranching.CreateBranching): New static function to create a
400         new flow branching.
401         (FlowBranchingBlock, FlowBranchingException): New classes.
402         (FlowBranching.UsageVector.Type): New public readonly field.
403         (FlowBranching.UsageVector.Breaks): Removed the setter.
404         (FlowBranching.UsageVector.Returns): Removed the setter.
405         (FlowBranching.UsageVector): Added Break(), Return(),
406         NeverReachable() and Throw() methods to modify the reachability.
407         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
408         done by FlowBranching.Merge().
409         (FlowBranching.UsageVector.MergeChild): New method; merges the
410         merge result into the current vector.
411         (FlowBranching.Merge): New abstract method to merge a branching.
412
413 2003-08-12  Martin Baulig  <martin@ximian.com>
414
415         * expression.cs (Indirection.CacheTemporaries): Create the
416         LocalTemporary with the pointer type, not its element type.
417
418 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
419
420         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
421         token was a keyword or not.
422
423         Add `error' options where an IDENTIFIER was expected;  Provide
424         CheckToken and CheckIdentifierToken convenience error reporting
425         functions. 
426
427         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
428
429         * decl.cs: Rename `NamespaceEntry Namespace' public field into
430         NameSpaceEntry NameSpaceEntry.
431
432         (LookupInterfaceOrClass): Avoid creating a full qualified name
433         from namespace and name: avoid doing lookups when we know the
434         namespace is non-existant.   Use new Tree.LookupByNamespace which
435         looks up DeclSpaces based on their namespace, name pair.
436
437         * driver.cs: Provide a new `parser verbose' to display the
438         exception thrown during parsing.  This is turned off by default
439         now, so the output of a failure from mcs is more graceful.
440
441         * namespace.cs: Track all the namespaces defined in a hashtable
442         for quick lookup.
443         
444         (IsNamespace): New method
445
446 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
447
448         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
449         we know that we need to concatenate (full typename can never be
450         null). 
451
452         * class.cs: ditto.
453
454         * statement.cs: Use a bitfield;  Do not initialize to null things
455         which are done by the constructor by default.
456
457         * cs-parser.jay: bug fix, parameter was 4, not 3.
458
459         * expression.cs: Just use the property;
460
461         * statement.cs: No need for GetVariableInfo method.
462
463 2003-08-08  Martin Baulig  <martin@ximian.com>
464
465         * flowanalysis.cs (FlowReturns): This is now nested in the
466         `FlowBranching' class.
467         (MyBitVector): Moved this here from statement.cs.
468         (FlowBranching.SiblingType): New enum type.
469         (FlowBranching.CreateSibling): Added `SiblingType' argument.
470
471 2003-08-07  Martin Baulig  <martin@ximian.com>
472
473         * flowanalysis.cs (FlowBranchingType): This is now nested in the
474         `FlowBranching' class and called `BranchingType'.
475
476 2003-08-07  Martin Baulig  <martin@ximian.com>
477
478         * flowanalysis.cs: Moved all the control flow analysis code into
479         its own file.
480
481 2003-08-07  Martin Baulig  <martin@ximian.com>
482
483         * assign.cs (Assign.DoResolve): `target' must either be an
484         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
485         #37319.
486
487 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
488
489         * expression.cs (BinaryMethod): This kind of expression is created by the
490         Binary class if it determines that the operator has to be handled
491         by a method.
492
493         (BinaryDelegate): This kind of expression is created if we are
494         dealing with a + or - operator on delegates.
495
496         (Binary): remove method, argumetns, and DelegateOperator: when
497         dealing with methods, 
498         
499         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
500
501         * statement.cs (Block): use bitfields for the three extra booleans
502         we had in use.   Remove unused topblock parameter.
503
504         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
505
506         * assign.cs: Drop extra unneeded tests.
507
508 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
509
510         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
511
512         * statement.cs (Foreach): Use VariableStorage instead of
513         LocalBuilders.   
514
515         * codegen.cs (VariableStorage): New class used by clients that
516         require a variable stored: locals or fields for variables that
517         need to live across yield.
518
519         Maybe provide a convenience api for EmitThis+EmitLoad?
520
521         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
522         these bad boys.
523
524 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
525
526         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
527         RemapParameterLValue): New methods that are used to turn a
528         precomputed FieldInfo into an expression like this:
529
530                 instance.FieldInfo
531
532         The idea is to use this instead of making LocalVariableReference
533         have more than one meaning.
534
535         * cs-parser.jay: Add error production to BASE.
536
537         * ecore.cs: Deal with TypeManager.GetField returning null, which
538         is now a valid return value.
539
540         (FieldExprNoAddress): New expression for Fields whose address can
541         not be taken.
542
543         * expression.cs (LocalVariableReference): During the resolve
544         phases, create new expressions if we are in a remapping context.
545         Remove code that dealt with remapping here.
546
547         (ParameterReference): same.
548
549         (ProxyInstance): New expression, like the `This' expression, but
550         it is born fully resolved.  We know what we are doing, so remove
551         the errors that are targeted to user-provided uses of `this'.
552
553         * statement.cs (Foreach): our variable is now stored as an
554         Expression;  During resolution, follow the protocol, dont just
555         assume it will return this.
556         
557 2003-08-06  Martin Baulig  <martin@ximian.com>
558
559         * support.cs (SeekableStreamReader.cs): New public class.
560
561         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
562         SeekableStreamReader instead of the normal StreamReader.
563
564 2003-08-04  Martin Baulig  <martin@ximian.com>
565
566         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
567         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
568         deambiguate casts and delegate invocations.
569         (parenthesized_expression): Use the new tokens to ensure this is
570         not a cast of method invocation.
571
572         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
573         when reading a `)' and Deambiguate_CloseParens () was previously
574         called.
575
576         * expression.cs (ParenthesizedExpression): New class.  This is
577         just used for the CS0075 test.
578         (Binary.DoResolve): Check for CS0075.   
579
580 2003-07-29  Ravi Pratap  <ravi@ximian.com>
581
582         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
583         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
584         reference comparison.
585
586         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
587         examine the ReturnType for equality - this is necessary in the
588         cases of implicit and explicit operators whose signature also
589         includes the return type.
590
591 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
592
593         * namespace.cs: Cache the result of the namespace computation,
594         instead of computing it every time.
595
596 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
597
598         * decl.cs: Use a global arraylist that we reuse over invocations
599         to avoid excesive memory consumption.  Reduces memory usage on an
600         mcs compile by one meg (45 average).
601
602         * typemanager.cs (LookupTypeReflection): In .NET pointers are
603         private, work around that.
604
605 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
606
607         * literal.cs (IntLiteral): Define Zero and One static literals. 
608
609         * cs-parser.jay (integer_literal): use static literals to reduce
610         memory usage for the most used literals (0, 1 and -1).  211kb
611         reduced in memory usage.
612
613         Replace all calls to `new ArrayList' with `new
614         ArrayList(4)' which is a good average number for most allocations,
615         and also requires only 16 bytes of memory for its buffer by
616         default. 
617
618         This reduced MCS memory usage in seven megabytes for the RSS after
619         bootstrapping.
620
621 2003-07-28  Ravi Pratap  <ravi@ximian.com>
622
623         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
624         handle params methods the correct way by forming only one
625         applicable set with params and normal methods in them. Earlier we
626         were looking at params methods only if we found no normal methods
627         which was not the correct thing to do.
628
629         (Invocation.BetterFunction): Take separate arguments indicating
630         when candidate and the best method are params methods in their
631         expanded form.
632
633         This fixes bugs #43367 and #46199.
634
635         * attribute.cs: Documentation updates.
636
637         (CheckAttribute): Rename to CheckAttributeTarget.
638         (GetValidPlaces): Rename to GetValidTargets.
639
640         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
641         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
642
643         Fixes bug #44468.
644
645 2003-07-28  Miguel de Icaza  <miguel@ximian.com>
646
647         * codegen.cs: Compute IsGeneric correctly.
648
649         * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
650         resolution. 
651
652         Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
653         OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN.  There were too many
654         regressions, and I was chasing more bugs than I required.
655
656         * interface.cs: Use expressions for base type names (like classes
657         and structs have been doing for a while now), and resolve that.
658         This patch should probably go into head as well.
659
660         This makes it one less user of FindType.
661
662 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
663
664         This compiler can not self host currently.  Need to fix that.
665         
666         * Makefile: compile to `gmcs.exe'
667
668         * driver.cs: Turn on v2 by default on gmcs.
669
670         * generic.cs (ConstructedType): Does no longer take a container
671         type argument;  That will be taken care of later.
672
673         (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
674         Use SimpleName to resolve for now, so we can continue the work on
675         the parser, until we get Type.GetType that understands generics.
676
677         (ConstructedType.ToString): Implement
678
679         (TypeArguments.Resolve): Resolve the child expressions as types. 
680         
681         * cs-parser.jay: Rename interface_constraints to
682         type_parameter_constraints
683
684         (namespace_or_type_name): Only use constructed types for the basic
685         construction, we will deal with identifier<...> later.
686
687         (type/type_name): No longer call DecomposeQI, as
688         namespace_or_type_name is always decoded now.
689         
690 2003-07-22  Ravi Pratap  <ravi@ximian.com>
691
692         * expression.cs (Invocation.OverloadResolve): Follow the spec more
693         closely: we eliminate methods in base types when we have an
694         applicable method in a top-level type.
695
696         Please see section 14.5.5.1 for an exact description of what goes
697         on. 
698
699         This fixes bug #45127 and a host of other related to corlib compilation.
700
701         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
702         array is the method corresponding to the top-level type (this is
703         because of the changes made to icall.c) so we change this
704         accordingly.
705
706         (MethodGroupExpr.Name): This too.
707
708         * typemanager.cs (GetElementType): New method which does the right
709         thing when compiling corlib. 
710
711         * everywhere: Make use of the above in the relevant places.
712
713 2003-07-22  Martin Baulig  <martin@ximian.com>
714
715         * cs-parser.jay (invocation_expression): Moved
716         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
717         `cast_expression', but create a InvocationOrCast which later
718         resolves to either an Invocation or a Cast.
719
720         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
721         method; call this before EmitStatement() to make sure that this
722         expression can be used as a statement.
723
724         * expression.cs (InvocationOrCast): New class; resolves to either
725         an Invocation or a Cast.
726
727         * statement.cs (StatementExpression): Call ResolveStatement() on
728         the ExpressionStatement before emitting it.
729
730 2003-07-21  Martin Baulig  <martin@ximian.com>
731
732         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
733         `ref' and `out' attributes match; fixes #46220.
734         (MemberAccess.ResolveMemberAccess): You can't reference a type
735         through an expression; fixes #33180.
736         (Indexers.GetIndexersForType): Don't return the indexers from
737         interfaces the class implements; fixes #46502.
738
739 2003-07-21  Martin Baulig  <martin@ximian.com>
740
741         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
742         CS0661 checks; fixes bug #30442.
743
744 2003-07-21  Martin Baulig  <martin@ximian.com>
745
746         * decl.cs (AdditionResult): Added `Error'.
747
748         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
749
750         * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
751         cs0031.cs actually work.
752
753  2003-07-20  Miguel de Icaza  <miguel@ximian.com>
754  
755         * cs-parser.jay (namespace_name): do not use
756         namespace_or_type_name, use qualified_identifier, because
757         namespace_or_type_name will soon return a composed expression
758         instead of a string.
759  
760         (namespace_or_type_name): Instead of returning a string, now this
761         production returns an expression.
762  
763         * codegen.cs (EmitContext): Setup IsGeneric property based on
764         whether our DeclSpace is generic, our the method is generic.
765  
766         * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
767         the method is generic.
768  
769         * cs-parser.jay (type_arguments, opt_type_argument_list,
770         type_parameters, type_parameter_list, opt_type_parameter_list,
771         type_parameter,, opt_type_parameter_constraints_clauses,
772         type_parameter_constraints_clauses,
773         type_parameter_constraint_clause, type_parameter_constraint,
774         interface_constraints): Add new production
775  
776         * decl.cs (DeclSpace): IsGeneric, flag to track whether this
777         DeclSpace is generic or not.
778  
779         (DeclSpace.SetParameterInfo): New routine, used to set the
780         parameter info for a type.
781  
782         (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
783         returns a GenericTypeExpr
784  
785         * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
786         generic, lookup the generic argument.
787  
788         * attribute.cs: Do not allow TypeParameterExpressions in
789         Attributes.
790  
791         * class.cs: Do not allow the Main method to be defined in a
792         Generic container.
793  
794         * expression.cs (SizeOf): Do not allow generic types to be used as
795         arguments to sizeof.
796  
797         * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
798         it: whether a type is generic or not.  Only works for types we are
799         currently building for now.
800         
801 2003-07-20  Martin Baulig  <martin@ximian.com>
802
803         * namespace.cs: Fixed that bug which caused a crash when compiling
804         the debugger's GUI.
805
806 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
807
808         * typemanager.cs (LookupTypeReflection): Never expose types which
809         are NotPublic, NestedPrivate, NestedAssembly, or
810         NestedFamANDAssem.  We used to return these, and later do a check
811         that would report a meaningful error, but the problem is that we
812         would not get the real match, if there was a name override.
813
814 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
815
816         * namespace.cs (Namespace, Name): Do not compute the namespace
817         name dynamically, compute it in the constructor.  This reduced
818         memory usage by 1697 KB.
819
820         * driver.cs: Use --pause to pause at the end.
821
822 2003-07-17  Peter Williams  <peter@newton.cx>
823
824         * Makefile: Change the name of the test target so that it doesn't
825         conflict with the recursive test target.
826
827 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
828
829         * expression.cs (LocalVariableReference.Emit, EmitAssign,
830         AddressOf): Do not use EmitThis, that was wrong, use the actual
831         this pointer.
832
833 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
834
835         * class.cs (MethodData.Define): While checking if a method is an
836         interface implementation, improve the test: If we are not public
837         (use new test here: use the computed MethodAttributes directly,
838         instead of the parsed modifier flags) check if the `implementing'
839         method comes from an interface or not.
840
841         * pending.cs (VerifyPendingMethods): Slightly better error
842         message.
843
844         * makefile: add test target that does the mcs bootstrap.
845
846 2003-07-16  Ravi Pratap  <ravi@ximian.com>
847
848         * interface.cs (Define): Do nothing here since there are no
849         members to populate etc. Move the attribute emission out of here
850         since this was just totally the wrong place to put it. Attribute
851         application happens during the 'Emit' phase, not in the 'Define'
852         phase.
853
854         (Emit): Add this method and move the attribute emission here
855
856         * rootcontext.cs (EmitCode): Call the Emit method on interface
857         types too.
858
859 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
860
861         * expression.cs (OverloadResolve): Report error only if Location
862         is not 'Null' which means that there was a probe going on.
863
864 2003-07-14  Martin Baulig  <martin@ximian.com>
865
866         * expression.cs (ConditionalLogicalOperator): New public class to
867         implement user defined conditional logical operators.
868         This is section 14.11.2 in the spec and bug #40505.
869
870 2003-07-14  Martin Baulig  <martin@ximian.com>
871
872         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
873
874 2003-07-14  Martin Baulig  <martin@ximian.com>
875
876         * codegen.cs (EmitContext.InFixedInitializer): New public field.
877
878         * ecore.cs (IVariable.VerifyFixed): New interface method.
879
880         * expression.cs (Unary.ResolveOperator): When resolving the `&'
881         operator, check whether the variable is actually fixed.  Fixes bug
882         #36055.  Set a variable definitely assigned when taking its
883         address as required by the spec.
884
885         * statement.cs (LocalInfo.IsFixed): New field.
886         (LocalInfo.MakePinned): Set `IsFixed' to true.
887
888 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
889
890         * attribute.cs (Attribute.Resolve): While doing a Member lookup
891         for .ctors, ensure that we only ask for members declared in the
892         attribute type (BindingFlags.DeclaredOnly).
893
894         Fixes bug #43632.
895
896         * expression.cs (Error_WrongNumArguments): Report error 1501
897         correctly the way CSC does.
898
899 2003-07-13  Martin Baulig  <martin@ximian.com>
900
901         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
902         lookup on the fully qualified name, to make things like "X.X" work
903         where "X.X" is a fully qualified type name, but we also have a
904         namespace "X" in the using list.  Fixes #41975.
905
906 2003-07-13  Martin Baulig  <martin@ximian.com>
907
908         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
909         function. If we're a CompoundAssign, we need to create an embedded
910         CompoundAssign, not an embedded Assign.
911         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
912         Fixes #45854.
913
914 2003-07-13  Martin Baulig  <martin@ximian.com>
915
916         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
917         work to fix bug #46088.
918
919 2003-07-13  Ravi Pratap <ravi@ximian.com>
920
921         * class.cs (Operator.Emit): Do not emit attributes here - it is
922         taken care of by the Method class that we delegate too. This takes
923         care of bug #45876.
924         
925 2003-07-10  Martin Baulig  <martin@ximian.com>
926
927         * expression.cs (TypeOfVoid): New class.
928         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
929
930 2003-07-10  Martin Baulig  <martin@ximian.com>
931
932         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
933         bug #35957.
934
935 2003-07-10  Martin Baulig  <martin@ximian.com>
936
937         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
938         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
939
940         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
941
942         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
943
944 2003-07-10  Martin Baulig  <martin@ximian.com>
945
946         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
947         of decimal.  Fixes #42850.
948
949         NOTE: I also fixed the created byte blob, but this doesn't work on
950         the MS runtime and csc never produces any byte blobs for decimal
951         arrays.
952
953 2003-07-10  Martin Baulig  <martin@ximian.com>
954
955         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
956         structs; fixes #32068.
957         (Block.AddChildVariableNames): Fixed #44302.
958
959 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
960
961         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
962         
963 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
964
965         * attribute.cs: And this test is onger needed.
966
967 2003-07-08  Martin Baulig  <martin@ximian.com>
968
969         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
970         inaccessible types.  Fixes #36313.
971
972         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
973
974         * namespace.cs (NamespaceEntry): Create implicit entries for all
975         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
976         implicit entries for N1.N2 and N1.
977
978 2003-07-08  Martin Baulig  <martin@ximian.com>
979
980         Rewrote the handling of namespaces to fix a lot of the issues
981         wrt. `using' aliases etc.
982
983         * namespace.cs (Namespace): Splitted this class into a
984         per-assembly `Namespace' and a per-file `NamespaceEntry'.
985
986         * typemanager.cs (TypeManager.IsNamespace): Removed.
987         (TypeManager.ComputeNamespaces): Only compute namespaces from
988         loaded assemblies here, not the namespaces from the assembly we're
989         currently compiling.
990
991 2003-07-08  Martin Baulig  <martin@ximian.com>
992
993         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
994
995 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
996
997         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
998         already fixed it.  
999
1000         I thought about the memory savings here, but LookupTypeReflection
1001         is used under already very constrained scenarios.  Compiling
1002         corlib or mcs only exposes one hit, so it would not really reduce
1003         any memory consumption.
1004
1005 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1006
1007         * typemanager.cs: fixes bug #45889 by only adding public types from
1008         other assemblies to the list of known types.
1009
1010 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1011
1012         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
1013         on the type we resolved.
1014
1015 2003-07-05  Martin Baulig  <martin@ximian.com>
1016
1017         * pending.cs (PendingImplementation.ParentImplements): Don't
1018         create the proxy if the parent is abstract.
1019
1020         * class.cs (TypeContainer.DefineIndexers): Process explicit
1021         interface implementations first.  Fixes #37714.
1022
1023 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
1024
1025         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
1026         defined recursively;  but since we modify the input parameters
1027         (left is set to `this' temporarily), we reset this value if the
1028         left_is_explicit is false, which gives the original semantics to
1029         the code.  
1030
1031         * literal.cs (NullPointer): new class used to represent a null
1032         literal in a pointer context.
1033
1034         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
1035         type is a pointer, use a NullPointer object instead of a
1036         NullLiteral.   Closes 43687
1037
1038         (ExplicitConversion): Convert pointer values using
1039         the conv opcode to the proper type.
1040
1041         * ecore.cs (New): change ValueTypeVariable property into a method,
1042         that returns whether the valuetype is suitable for being used.
1043
1044         * expression.cs (Binary.DoNumericPromotions): Only return if we
1045         the int constant was a valid uint, and we can return both left and
1046         right as uints.  If not, we continue processing, to trigger the
1047         type conversion.  This fixes 39018.
1048
1049         * statement.cs (Block.EmitMeta): During constant resolution, set
1050         the CurrentBlock property on the emitcontext, so that we resolve
1051         constants propertly.
1052
1053 2003-07-02  Martin Baulig  <martin@ximian.com>
1054
1055         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
1056         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
1057
1058         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
1059         than emitting it here.
1060
1061         * statement.cs: Fixed some more flow analysis bugs.
1062
1063 2003-07-02  Martin Baulig  <martin@ximian.com>
1064
1065         * class.cs (MethodData.Define): When implementing interface
1066         methods, set Final unless we're Virtual.
1067
1068         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
1069         check work for interface methods.
1070
1071 2003-07-01  Martin Baulig  <martin@ximian.com>
1072
1073         * ecore.cs (EmitContext.This): Replaced this property with a
1074         GetThis() method which takes a Location argument.  This ensures
1075         that we get the correct error location for a CS0188.
1076
1077 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
1078
1079         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1080         ImplicitStandardConversion.
1081
1082         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1083
1084 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
1085
1086         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1087         optimization.
1088
1089 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
1090
1091         * class.cs (Constructor.Define): Turn off initlocals for unsafe
1092         constructors.
1093
1094         (MethodData.Define): Turn off initlocals for unsafe methods.
1095
1096 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
1097
1098         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1099         complete;  Fixes #37521.
1100
1101         * delegate.cs: Use Modifiers.TypeAttr to compute the
1102         TypeAttributes, instead of rolling our own.  This makes the flags
1103         correct for the delegates.
1104
1105 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
1106
1107         * class.cs (Constructor.Define): Set the private flag for static
1108         constructors as well.
1109
1110         * cs-parser.jay (statement_expression): Set the return value to
1111         null, to avoid a crash when we catch an error.
1112
1113 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
1114
1115         * cs-parser.jay: Applied patch from Jackson that adds support for
1116         extern and unsafe modifiers to destructor declarations.
1117
1118         * expression.cs: Report error 21 if the user is trying to index a
1119         System.Array.
1120
1121         * driver.cs: Add an error message, suggested by the bug report.
1122
1123         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1124         if we do not have a ": this ()" constructor initializer.  Fixes 45149
1125
1126 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
1127
1128         * namespace.cs: Add some information to reduce FAQs.
1129
1130 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
1131
1132         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1133         underlying enumeration types.  Fixes #43915.
1134
1135         * expression.cs: Treat ushort/short as legal values to be used in
1136         bitwise operations.
1137
1138 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1139
1140         * delegate.cs: transfer custom attributes for paramenters from
1141         the delegate declaration to Invoke and BeginInvoke.
1142
1143 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1144
1145         * attribute.cs: handle custom marshalers and emit marshal info
1146         for fields, too.
1147
1148 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
1149
1150         * makefile.gnu: Added anonymous.cs to the compiler sources.
1151
1152 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
1153
1154         * iterators.cs: Change the name of the proxy class to include two
1155         underscores.
1156
1157         * cs-parser.jay: Update grammar to include anonymous methods.
1158         
1159         * anonymous.cs: new file.
1160
1161 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
1162
1163         * class.cs (Field.Define): Add missing test for pointers and
1164         safety. 
1165
1166 2003-05-27  Ravi Pratap  <ravi@ximian.com>
1167
1168         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
1169         we use the stobj opcode.
1170
1171         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
1172         since it wasn't the correct fix. 
1173
1174         It still is puzzling that we are required to use stobj for IntPtr
1175         which seems to be a ValueType.
1176
1177 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
1178
1179         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
1180         during regular simple name resolution.   Now, the trick is that
1181         instead of returning for processing the simplename, we do a
1182         TypeManager.LookupType (ie, a rooted lookup as opposed to a
1183         contextual lookup type).   If a match is found, return that, if
1184         not, return for further composition.
1185
1186         This fixes long-standing 30485.
1187
1188         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1189         using the address to initialize an object, do an Stobj instead of
1190         using the regular Stelem.
1191
1192         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1193         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1194         Because if we are a BaseIndexerAccess that value will be true.
1195         Fixes 43643.
1196
1197         * statement.cs (GotoCase.Resolve): Return after reporting an
1198         error, do not attempt to continue. 
1199
1200         * expression.cs (PointerArithmetic.Emit): If our operand is a
1201         long, convert our constants to match the operand before
1202         multiplying.  Convert to I type before adding.   Fixes 43670.
1203         
1204 2003-05-14  Ravi Pratap  <ravi@ximian.com>
1205
1206         * enum.cs (ImplicitConversionExists) : Rename to
1207         ImplicitEnumConversionExists to remove ambiguity. 
1208
1209         * ecore.cs (NullCast): New type of cast expression class which
1210         basically is very similar to EmptyCast with the difference being
1211         it still is a constant since it is used only to cast a null to
1212         something else
1213         (eg. (string) null)
1214
1215         * convert.cs (ImplicitReferenceConversion): When casting a null
1216         literal, we return a NullCast.
1217
1218         * literal.cs (NullLiteralTyped): Remove - I don't see why this
1219         should be around anymore.
1220
1221         The renaming (reported was slightly wrong). Corrections:
1222
1223         ConvertImplicitStandard -> ImplicitConversionStandard
1224         ConvertExplicitStandard -> ExplicitConversionStandard
1225
1226         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1227         before passing them in !
1228
1229         * convert.cs (ImplicitConversionStandard): When comparing for
1230         equal expr and target types, ensure that expr is not a
1231         NullLiteral.
1232
1233         In general, we must not be checking (expr_type ==
1234         target_type) in the top level conversion methods
1235         (ImplicitConversion, ExplicitConversion etc). This checking is
1236         done in the methods that they delegate to.
1237
1238 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
1239
1240         * convert.cs: Move Error_CannotConvertType,
1241         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1242         ImplicitNumericConversion, ImplicitConversionExists,
1243         ImplicitUserConversionExists, StandardConversionExists,
1244         FindMostEncompassedType, FindMostSpecificSource,
1245         FindMostSpecificTarget, ImplicitUserConversion,
1246         ExplicitUserConversion, GetConversionOperators,
1247         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1248         TryImplicitIntConversion, Error_CannotConvertImplicit,
1249         ConvertImplicitRequired, ConvertNumericExplicit,
1250         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1251         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1252         its own file.
1253
1254         Perform the following renames:
1255         
1256         StandardConversionExists -> ImplicitStandardConversionExists
1257         ConvertImplicit -> ImplicitConversion
1258         ConvertImplicitStandard -> ImplicitStandardConversion
1259         TryImplicitIntConversion -> ImplicitIntConversion
1260         ConvertImplicitRequired -> ImplicitConversionRequired
1261         ConvertNumericExplicit -> ExplicitNumericConversion
1262         ConvertReferenceExplicit -> ExplicitReferenceConversion
1263         ConvertExplicit -> ExplicitConversion
1264         ConvertExplicitStandard -> ExplicitStandardConversion
1265
1266 2003-05-19  Martin Baulig  <martin@ximian.com>
1267
1268         * statement.cs (TypeInfo.StructInfo): Made this type protected.
1269         (TypeInfo): Added support for structs having structs as fields.
1270
1271         * ecore.cs (FieldExpr): Implement IVariable.
1272         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1273         VariableInfo for the field.
1274
1275 2003-05-18  Martin Baulig  <martin@ximian.com>
1276
1277         * expression.cs (This.DoResolve): Report a CS0027 if we're
1278         emitting a field initializer.
1279
1280 2003-05-18  Martin Baulig  <martin@ximian.com>
1281
1282         * expression.cs (This.ResolveBase): New public function.
1283         (This.DoResolve): Check for CS0188.
1284
1285         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1286         This.Resolve().
1287
1288         * ecore.cs (MethodGroupExpr.DoResolve): Set the
1289         `instance_expression' to null if we don't have any non-static
1290         methods.
1291
1292 2003-05-18  Martin Baulig  <martin@ximian.com>
1293
1294         Reworked the way how local variables and parameters are handled by
1295         the flow analysis code.
1296
1297         * statement.cs (TypeInfo, VariableMap): New public classes.
1298         (VariableInfo): New public class.  This is now responsible for
1299         checking whether a variable has been assigned.  It is used for
1300         parameters and local variables.
1301         (Block.EmitMeta): Take the InternalParameters as argument; compute
1302         the layout of the flow vectors here.
1303         (Block.LocalMap, Block.ParameterMap): New public properties.
1304         (FlowBranching): The .ctor doesn't get the InternalParameters
1305         anymore since Block.EmitMeta() now computes the layout of the flow
1306         vector.
1307         (MyStructInfo): This class is now known as `StructInfo' and nested
1308         in `TypeInfo'; we don't access this directly anymore.
1309
1310         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1311         property and removed IsAssigned(), IsFieldAssigned(),
1312         SetAssigned() and SetFieldAssigned(); we now call them on the
1313         VariableInfo so we don't need to duplicate this code everywhere.
1314
1315         * expression.cs (ParameterReference): Added `Block block' argument
1316         to the .ctor.
1317         (LocalVariableReference, ParameterReference, This): The new
1318         VariableInfo class is now responsible for all the definite
1319         assignment stuff.
1320
1321         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1322         IsParameterAssigned, SetParameterAssigned): Removed.
1323
1324 2003-05-18  Martin Baulig  <martin@ximian.com>
1325
1326         * typemanager.cs (InitCoreTypes): Try calling
1327         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1328         the 3-args-version.  Corlib now also needs our `void_type'.
1329         (GetMethod): Added overloaded version which takes an optional
1330         `bool report_errors' to allow lookups of optional methods.
1331
1332 2003-05-12  Martin Baulig  <martin@ximian.com>
1333
1334         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1335         only used for locals and not for parameters.
1336
1337 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
1338
1339         * support.cs (InternalParameters.ParameterType): Return the
1340         ExternalType of the parameter.
1341
1342         * parameter.cs (Parameter.ExternalType): drop the two arguments,
1343         they were unused.
1344
1345 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
1346
1347         * class.cs (MethodData.Define): Do not set the `newslot' on
1348         interface members, if they are also flagged as "override".
1349
1350         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1351         better code for ++i and i++.  This only works for static fields
1352         and local variables.
1353
1354         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1355         want to pull the DeclSpace out of the builder_to_declspace instead
1356         of the TypeBuilder (like in TypeContainer.FindMembers).
1357
1358         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1359         instead of LookupTypeContainer.  Fixes the crash on .NET for
1360         looking up interface members.
1361
1362         * const.cs: Create our own emit context during the Definition
1363         stage, so that constants are evaluated in the proper context, when
1364         a recursive definition happens.
1365
1366 2003-05-11  Martin Baulig  <martin@ximian.com>
1367
1368         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
1369         new block for a switch section.
1370         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1371         the adding/lookup in the switch block.  Fixes #39828.
1372
1373 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
1374
1375         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1376         functionality: I needed to convert the data after I had performed
1377         the add/sub operation into the operands type size.
1378
1379         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1380         pass the type for the box operation, otherwise the resulting
1381         object would have been of type object.
1382
1383         (BoxedCast): Add constructor to specify the type to box as.
1384
1385 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
1386
1387         * iterators.cs: I was reusing the `count' variable inadvertently,
1388         take steps to not allow this to happen.
1389
1390 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
1391
1392         * attribute.cs (Attribute.Resolve): Params attributes are encoded
1393         by creating an array at the point where the params starts and
1394         putting all those arguments there, then adjusting the size of the
1395         array.
1396
1397 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
1398
1399         * expression.cs (New.AddressOf): Implement interface
1400         IMemoryLocation.  This is used when the `new' operator is used in
1401         the context of an invocation to a method on a value type.
1402
1403         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1404         example. 
1405
1406         * namespace.cs: Also check the using aliases here.
1407
1408         * driver.cs: Move the test for using validity after the types have
1409         been entered, so we do a single pass that also includes the using
1410         aliases. 
1411
1412         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1413         in the regular case.   CreateSiblingForFinally is doing extra
1414         error checking.
1415
1416         * attribute.cs (GetAttributeArgumentExpression): Store the result
1417         on an out value, and use the return value to indicate failure
1418         instead of using null (which is a valid return for Constant.GetValue).
1419
1420         * statement.cs: Perform the analysis flow for the increment
1421         portion after the statement, because this will be the real flow of
1422         execution.  Fixes #42385
1423
1424         * codegen.cs (EmitContext.EmitArgument,
1425         EmitContext.EmitStoreArgument): New helper functions when the
1426         RemapToProxy flag is set.
1427
1428         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1429         function.
1430
1431         Add support for remapping parameters. 
1432
1433         * iterators.cs: Propagate parameter values;  Store parameter
1434         values in the proxy classes.
1435         
1436 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
1437
1438         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
1439         need a proxy reference;  I do not know what I was thinking
1440
1441         * cs-parser.jay (constructor_initializer): catch another error,
1442         and display nice message.
1443         
1444         (field_declaration): catch void field declaration
1445         to flag a better error. 
1446
1447         * class.cs (MemberBase.CheckBase): Report an error instead of a
1448         warning if a new protected member is declared in a struct. 
1449         (Field.Define): catch the error of readonly/volatile.
1450
1451         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1452
1453         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
1454         volatile variable is taken
1455
1456 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
1457
1458         * statement.cs (Fixed.Resolve): Report an error if we are not in
1459         an unsafe context.
1460
1461 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
1462
1463         * typemanager.cs: reuse the code that handles type clashes for
1464         delegates and enumerations.
1465
1466         * class.cs (Report28): Always report.
1467
1468         * expression.cs (EncodeAsAttribute): Allow nulls here.
1469
1470 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
1471
1472         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1473         the functionality for testing whether an expression is valid for
1474         an attribute here.  Also handle the case of arrays of elements
1475         being stored. 
1476
1477         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1478         encoding a linear array into an array of objects that are suitable
1479         to be passed to an CustomAttributeBuilder.
1480
1481         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1482
1483         * ecore.cs: (FieldExpr): Handle field remapping here.
1484
1485         * iteratators.cs: Pass the instance variable (if the method is an
1486         instance method) to the constructors, so we can access the field
1487         variables on the class.
1488
1489         TODO: Test this with structs.  I think the THIS variable on
1490         structs might have to be a pointer, and not a refenrece
1491
1492 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
1493
1494         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1495         local variables to fields in a proxy class.
1496
1497         * iterators.cs (PopulateProxy): Rename our internal fields to
1498         <XXX>.  
1499         Create a <THIS> field if we are an instance method, so we can
1500         reference our parent container variables.
1501         (MapVariable): Called back from the EmitContext code to enter a
1502         new variable to field mapping into the proxy class (we just create
1503         a FieldBuilder).
1504
1505         * expression.cs
1506         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1507         for using the remapped locals to fields.
1508
1509         I placed the code here, because that gives the same semantics to
1510         local variables, and only changes the Emit code.
1511
1512         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1513         statements inside iterators.
1514         (VariableInfo): Add a FieldBuilder for the cases when we are
1515         remapping local variables to fields in a proxy class
1516
1517         * ecore.cs (SimpleNameResolve): Avoid testing two times for
1518         current_block != null.
1519
1520         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1521         not cope with strings, as it has been moved to the
1522         TableSwitchEmit.  Fixed bug in switch generation.
1523
1524         * expression.cs (New.DoResolve): Provide more context for the user
1525         when reporting an error.
1526
1527         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1528         pointers. 
1529
1530         * expression.cs (MemberAccess.DoResolve): When we get a type back,
1531         check the permissions for it.  Note than in a type-resolution
1532         context the check was already present in DeclSpace.ResolveType,
1533         but was missing from the MemberAccess.
1534
1535         (ArrayCreation.CheckIndices): warn if the user has
1536         more nested levels of expressions, but there are no more
1537         dimensions specified.  Avoids crash on bug 41906.
1538
1539 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
1540
1541         * statement.cs (Block): replace Implicit bool, for a generic
1542         flags.   
1543         New flag: `Unchecked'.  This is used during the EmitMeta phase
1544         (which is out-of-line with the regular Resolve/Emit process for a
1545         statement, as this is done ahead of time, but still gets a chance
1546         to call constant resolve).
1547         
1548         (Block.Flags): new enum for adding a new flag.
1549
1550         (Block.EmitMeta): track the state of unchecked.
1551         
1552         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1553         to enable constant resolution to work there as well.
1554
1555 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
1556
1557         * typemanager.cs (ienumerable_type): Also look up
1558         System.Collections.IEnumerable. 
1559
1560 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
1561
1562         TODO: Test more than one conditional per method.
1563         
1564         * class.cs (Indexer.Define): Report the location where the user is
1565         referencing the unsupported feature.
1566
1567         (MethodData): Overload the use of `conditionals' to
1568         minimize the creation of needless ArrayLists.   This saves roughly
1569         212kb on my machine.
1570
1571         (Method): Implement the new IIteratorContainer interface.
1572         (Method.SetYields): Implement the method by setting the ModFlags
1573         to contain METHOD_YIELDS.
1574         
1575         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1576         which just got set to null.
1577
1578         * iterators.cs: New file.
1579
1580         (Yield, YieldBreak): New statements.
1581
1582         * statement.cs (Return.Resolve): Flag an error if we are used in
1583         an iterator method.
1584
1585         * codegen.cs (InIterator): New flag set if the code is being
1586         compiled in an iterator method.
1587
1588         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
1589         internal modifier, and we just use it to avoid adding extra
1590         fields, as this is seldom used.  
1591
1592         * cs-parser.jay: Add yield_statement (yield and yield break).
1593
1594         * driver.cs: New flag -v2 to turn on version 2 features. 
1595
1596         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1597         hashtable when v2 is enabled.
1598
1599 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
1600
1601         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1602         there is already a namespace defined with this name.
1603
1604         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1605         people upgraded their corlibs.
1606
1607         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1608         always use fully qualified types, no need to use the compiler
1609         front end.
1610
1611         (TypeManager.IsNamespace): Use binarysearch.
1612         
1613         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1614         AddDelegate): I did not quite use the new IsValid API properly: I
1615         have to pass the short-name and the fullname.  I was passing only
1616         the basename instead of the fullname sometimes. 
1617
1618         (TypeContainer.DefineType): call NamespaceClash.
1619
1620         * interface.cs (Interface.DefineType): use NamespaceClash before
1621         defining the type.
1622
1623         * delegate.cs (Delegate.DefineType): use NamespaceClash before
1624         defining the type.
1625
1626         * enum.cs: (Enum.DefineType): use NamespaceClash before
1627         defining the type.
1628
1629         * typemanager.cs (: 3-line patch that gives us some tasty 11%
1630         speed increase.  First, use the negative_hits cache when we get a
1631         negative.  Second, add the type with its full original name
1632         instead of the new . and + encoded name (reflection uses + to
1633         separate type from a nested type).  Use LookupTypeReflection
1634         directly which bypasses the type->name hashtable (that we already
1635         know does not contain the type.
1636         
1637         * decl.cs (DeclSpace.ResolveTypeExpr): track the
1638         location/container type. 
1639
1640         * driver.cs: When passing utf8, use directly the UTF8Encoding.
1641
1642 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
1643
1644         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1645
1646         * delegate.cs (NewDelegate.Resolve): Test whether an instance
1647         method is being referenced in the method group from a static
1648         context, and report error 120 if so.
1649
1650         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1651         Error118. 
1652
1653         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1654         is created, we create the A namespace).
1655
1656         * cs-parser.jay: A namespace also introduces a DeclarationFound.
1657         Fixes #41591
1658
1659 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
1660
1661         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1662         invocation to ModuleBuilder.GetType with the same values will
1663         return a new type instance, so we need to cache its return
1664         values. 
1665
1666         * expression.cs (Binary.ResolveOperator): Only allow the compare
1667         operators on enums if they are of the same type.
1668
1669         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1670         types of ValueType on their own case.  Before we were giving them
1671         the same treatment as objects.
1672
1673         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1674         fullname.  Short name is used to compare against container name.
1675         Fullname is used to check against defined namespace names.
1676         
1677         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1678         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1679
1680         (Method.CheckBase): Call parent.
1681         (MemberBase.CheckBase): Check for protected members on sealed
1682         classes.
1683         (PropertyBase.CheckBase): Call parent.
1684         (Field.Define): Call parent.
1685
1686         * report.cs: Negative error codes are now mapped to 8000 - code,
1687         so that the display is render more nicely.
1688
1689         * typemanager.cs: Do not use try/catch, instead report a regular
1690         error. 
1691
1692         (GetPointerType, GetReferenceType): These methods provide
1693         mechanisms to obtain the T* and T& from a T.  We had the code
1694         previously scattered around the code base, and it also used
1695         TypeManager.LookupType that would go through plenty of caches.
1696         This one goes directly to the type source.
1697
1698         In some places we did the Type.GetType followed by
1699         ModuleBuilder.GetType, but not in others, so this unifies the
1700         processing as well.
1701
1702         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1703         statements now that we have namespace information.
1704
1705         * typemanager.cs (IsNamespace): New method, returns whether the
1706         string presented is a namespace or not.
1707
1708         (ComputeNamespaces): New public entry point, computes the list of
1709         available namespaces, using the GetNamespaces API call in Mono, or
1710         the slower version in MS.NET.   
1711
1712         Now before we start the semantic analysis phase, we have a
1713         complete list of namespaces including everything that the user has
1714         provided.
1715
1716         Deleted old code to cache namespaces in .nsc files.
1717
1718 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
1719
1720         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1721         class/struct location definition Location for the implicit
1722         constructor location.
1723
1724         (Operator.Define): Use the location of the operator for the
1725         implicit Method definition.
1726
1727         (Constructor.Emit): use the constructor location for the implicit
1728         base initializer constructor.
1729
1730         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
1731         and the Expression class now contains two new methods:
1732
1733         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
1734         isolate type lookup from the rest of the resolution process.
1735
1736         Since we use Expressions to hold type definitions due to the way
1737         we parse the input we have historically overloaded Resolve to
1738         perform the Type lookups if a special flag is passed.  Now this is
1739         eliminated and two methods take their place. 
1740         
1741         The differences in the two methods between xStep and xTerminal is
1742         that xStep is involved in our current lookup system that uses
1743         SimpleNames to compose a name, while xTerminal is used just to
1744         catch the case where the simplename lookup failed.
1745         
1746 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
1747
1748         * expression.cs (ResolveMemberAccess): Remove redundant code.
1749         TypeExpr expressions are always born fully resolved.
1750
1751         * interface.cs (PopulateMethod): Do not lookup the types twice.
1752         We were doing it once during SemanticAnalysis and once during
1753         PopulateMethod.
1754
1755         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1756         in local variable type definitions, were being returned as a
1757         SimpleName (we decomposed everything into a string), that is
1758         because primary_expression was being used instead of a type in the
1759         grammar (reduce/reduce conflicts).
1760
1761         The part that was wrong is that we converted the expression into a
1762         string (an oversimplification in one hand, compounded with primary
1763         expressions doing string concatenation).
1764
1765         So things like:
1766
1767         A.B.C [] x;
1768
1769         Would return "A.B.C[]" as a SimpleName.  This stopped things like
1770         using clauses from working on this particular context.  And a type
1771         was being matched directly against "A.B.C[]".
1772
1773         We now use the correct approach, and allow for ComposedCast to be
1774         part of the unary expression.  So the "A.B.C []" become a composed
1775         cast of "A.B.C" (as a nested group of MemberAccess with a
1776         SimpleName at the end) plus the rank composition "[]". 
1777
1778         Also fixes 35567
1779         
1780 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
1781
1782         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1783         for the access level checking.
1784
1785         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
1786         `TypeContainer container', because I kept getting confused when I
1787         was debugging this code.
1788
1789         * expression.cs (Indexers): Instead of tracking getters/setters,
1790         we now track them in parallel.  We create one arraylist less, but
1791         most importantly it is possible now for the LValue code to find a
1792         matching get for a set.
1793
1794         (IndexerAccess.DoResolveLValue): Update the code.
1795         GetIndexersForType has been modified already to extract all the
1796         indexers from a type.  The code assumed it did not.
1797
1798         Also make the code set the correct return type for the indexer.
1799         This was fixed a long time ago for properties, but was missing for
1800         indexers.  It used to be void_type.
1801
1802         (Binary.Emit): Test first for doubles instead of
1803         floats, as they are more common.
1804
1805         (Binary.EmitBranchable): Use the .un version of the branch opcodes
1806         when dealing with floats and the <=, >= operators.  This fixes bug
1807         #39314 
1808
1809         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1810         to load the array value by emitting a load on the foreach variable
1811         type.  This was incorrect.  
1812
1813         We now emit the code to load an element using the the array
1814         variable type, and then we emit the conversion operator.
1815
1816         Fixed #40176
1817
1818 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
1819
1820         * attribute.cs: Avoid allocation of ArrayLists in the common case.
1821
1822 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
1823
1824         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1825         test for protection before we test for signatures. 
1826
1827         (MethodSignature.ToString): implement.
1828
1829         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1830         to the case where we reduced into a LongConstant.
1831
1832         * decl.cs (CheckAccessLevel): If the type is an array, we can not
1833         depend on whether the information is acurrate, because the
1834         Microsoft runtime will always claim that the array type is public,
1835         regardless of the real state.
1836
1837         If the type is a pointer, another problem happens: the type is
1838         reported as non-public in Microsoft.  
1839
1840         In both cases we have to call CheckAccessLevel recursively with
1841         the underlying type as the argument to be tested.
1842
1843 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
1844
1845         * assign.cs (Assign.Emit): If we are dealing with a compound
1846         assignment expression, we should use the code path that stores the
1847         intermediate result in a temporary value.  This fixes #40903.
1848
1849         *expression.cs (Indirection.ToString): Provide ToString method for
1850         debugging. 
1851         
1852 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
1853
1854         * class.cs: Null out fields holding references to Block objects so
1855         they can be garbage collected.
1856
1857         * expression.cs (OverloadResolve): Remove unused local.
1858
1859 2003-04-07  Martin Baulig  <martin@ximian.com>
1860
1861         * codegen.cs (EmitContext.CurrentFile): New public field.
1862         (EmitContext.Mark): Use the CurrentFile to check whether the
1863         location is in the correct file.
1864         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1865
1866 2003-04-07  Martin Baulig  <martin@ximian.com>
1867
1868         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1869
1870         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1871         location.  [FIXME: The location argument which gets passed to this
1872         method is sometimes wrong!]
1873
1874 2003-04-07  Nick Drochak <ndrochak@gol.com>
1875
1876         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1877
1878 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
1879
1880         * expression.cs (Indirection.EmitAssign): We were using the
1881         temporary, but returning immediately instead of continuing the
1882         EmitAssing flow.
1883
1884 2003-04-06  Martin Baulig  <martin@ximian.com>
1885
1886         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1887         if it's a nested child, but also deriving from the outer class.
1888         See test 190.cs.
1889
1890         * typemanager.cs (IsNestedChildOf): Make this work if it's a
1891         nested child, but also deriving from the outer class.  See
1892         test-190.cs.
1893         (FilterWithClosure): We may access private members of the outer
1894         class if we're a nested child and deriving from the outer class.
1895         (RealMemberLookup): Only set `closure_private_ok' if the
1896         `original_bf' contained BindingFlags.NonPublic.
1897
1898 2003-04-05  Martin Baulig  <martin@ximian.com>
1899
1900         * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
1901         probe if its a type parameter, and if so, flag an error.
1902
1903         * decl.cs: Move here the SetParameterInfo code from class.cs.
1904         Handle IsGeneric here.
1905
1906         Handle a variety of errors in the parameter info definition.
1907
1908         * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
1909         type parameters here.
1910
1911         * cs-parser.jay (class_declaration): report errors for parameters
1912         here as well.
1913
1914 2003-01-21  Miguel de Icaza  <miguel@ximian.com>
1915
1916         * generic.cs: New file, contains support code for generics.
1917
1918         * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
1919         OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
1920
1921         Update parser for the above removals.
1922
1923         * cs-tokenizer.cs: Do not handle <<= or >>= specially.  This is
1924         now taken care of in the parser.
1925
1926 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
1927
1928         * class.cs (Event.Define): Do not allow abstract events to have
1929         initializers. 
1930
1931 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
1932
1933         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1934         block in event declarations.
1935
1936         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1937         value type, get its address.
1938
1939         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1940         leaving a class on the stack instead of a boolean value (int
1941         0/1).  Change the code so we compare against null, and then the
1942         result against zero.
1943
1944         * class.cs (TypeContainer.GetClassBases): We were checking for the
1945         parent class being sealed too late.
1946
1947         * expression.cs (Binary.Emit): For <= and >= when dealing with
1948         floating point values, use cgt.un and clt.un instead of cgt and
1949         clt alone.
1950
1951 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
1952
1953         * statement.cs: Apply the same optimization as MS: skip the 
1954         GetEnumerator returning an IEnumerator, and use the one returning a 
1955         CharEnumerator instead. This allows us to avoid the try-finally block 
1956         and the boxing.
1957
1958 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
1959
1960         * cs-parser.jay: Attributes cannot be applied to
1961                          namespaces. Fixes #40473
1962
1963 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1964
1965         * class.cs:
1966         (Add*): check if the name is valid using the full name for constants,
1967         fields, properties and events.
1968
1969 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
1970
1971         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1972         char constants to be part of the enumeration.
1973
1974         * expression.cs (Conditional.DoResolve): Add support for operator
1975         true. Implements the missing functionality from 14.12
1976
1977         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1978         operator true/false as required by the spec.
1979
1980         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1981         implicit conversion to boolean.
1982
1983         * statement.cs (Statement.ResolveBoolean): A boolean expression is
1984         also one where the type implements `operator true'. 
1985
1986         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
1987         get an expression that will invoke operator true based on an
1988         expression.  
1989
1990         (GetConversionOperators): Removed the hack that called op_True
1991         here.  
1992
1993         (Expression.ResolveBoolean): Move this from Statement.
1994
1995 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
1996
1997         * ecore.cs (FieldExpr): do not allow initialization of initonly
1998         fields on derived classes
1999
2000 2003-03-13  Martin Baulig  <martin@ximian.com>
2001
2002         * statement.cs (Block.Emit): Call ig.BeginScope() and
2003         ig.EndScope() when compiling with debugging info; call
2004         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
2005
2006 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
2007
2008         * expression.cs (Indexers): Do not construct immediately, allow
2009         for new members to be appended as we go.  Fixes 38143
2010
2011 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2012
2013         * expression.cs: save/restore context when resolving an unchecked
2014         expression.
2015
2016 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
2017
2018         * cfold.cs: Catch division by zero in modulus operator during
2019         constant folding.
2020
2021 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
2022
2023         * interface.cs (Interface.DefineMembers): Avoid defining members
2024         twice. 
2025
2026 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
2027
2028         * driver.cs: handle the +/- options for -noconfig
2029
2030         * statement.cs (Unckeched.Resolve): Also track the state of
2031         unchecked in the Resolve phase.
2032
2033 2003-02-27  Martin Baulig  <martin@ximian.com>
2034
2035         * ecore.cs (Expression.MemberLookup): Don't create a
2036         MethodGroupExpr for something which is not a method.  Fixes #38291.
2037
2038 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
2039
2040         * class.cs (MemberBase.CheckParameters): Also check that the type
2041         is unmanaged if it is a pointer.
2042
2043         * expression.cs (SizeOf.Resolve): Add location information.
2044
2045         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
2046         a managed type is declared.
2047
2048         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
2049         parameter modifiers as well.  Fixes bug 38606
2050
2051         * class.cs: Very sad.  Am backing out the speed up changes
2052         introduced by the ArrayList -> Array in the TypeContainer, as they
2053         were not actually that much faster, and introduced a bug (no error
2054         reports on duplicated methods).
2055
2056         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
2057         source first, this will guarantee that we have a valid expression
2058         before calling in lower levels functions that will require a
2059         resolved object.  Then use this original_source in the
2060         target.ResolveLValue instead of the original source that was
2061         passed to us.
2062
2063         Another change.  Use target.Resolve instead of LValueResolve.
2064         Although we are resolving for LValues, we will let the Assign code
2065         take care of that (it will be called again from Resolve).  This
2066         basically allows code like this:
2067
2068         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
2069         class Y { void A (X x) { x [0] += o; }
2070
2071         The problem was that the indexer was trying to resolve for
2072         set_Item (idx, object o) and never finding one.  The real set_Item
2073         was set_Item (idx, X).  By delaying the process we get the right
2074         semantics. 
2075
2076         Fixes bug 36505
2077         
2078 2003-02-23  Martin Baulig  <martin@ximian.com>
2079
2080         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
2081         while calling DoEmit ().
2082
2083         * codegen.cs (EmitContext.Mark): Don't mark locations in other
2084         source files; if you use the #line directive inside a method, the
2085         compiler stops emitting line numbers for the debugger until it
2086         reaches the end of the method or another #line directive which
2087         restores the original file.
2088
2089 2003-02-23  Martin Baulig  <martin@ximian.com>
2090
2091         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
2092
2093 2003-02-23  Martin Baulig  <martin@ximian.com>
2094
2095         * statement.cs (Block.AddChildVariableNames): We need to call this
2096         recursively, not just for our immediate children.
2097
2098 2003-02-23  Martin Baulig  <martin@ximian.com>
2099
2100         * class.cs (Event.Define): Always make the field private, like csc does.
2101
2102         * typemanager.cs (TypeManager.RealMemberLookup): Make events
2103         actually work, fixes bug #37521.
2104
2105 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
2106
2107         * delegate.cs: When creating the various temporary "Parameters"
2108         classes, make sure that we call the ComputeAndDefineParameterTypes
2109         on those new parameters (just like we do with the formal ones), to
2110         allow them to be resolved in the context of the DeclSpace.
2111
2112         This fixes the bug that Dick observed in Bugzilla #38530.
2113
2114 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
2115
2116         * expression.cs (ResolveMemberAccess): When resolving a constant,
2117         do not attempt to pull a constant if the value was not able to
2118         generate a valid constant.
2119
2120         * const.cs (LookupConstantValue): Do not report more errors than required.
2121
2122 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2123
2124         * expression.cs: fixes bug #38328.
2125
2126 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2127
2128         * class.cs: Changed all the various members that can be part of a
2129         class from being an ArrayList to be an Array of the right type.
2130         During the DefineType type_list, interface_list, delegate_list and
2131         enum_list are turned into types, interfaces, delegates and enums
2132         arrays.  
2133
2134         And during the member population, indexer_list, event_list,
2135         constant_list, field_list, instance_constructor_list, method_list,
2136         operator_list and property_list are turned into their real arrays.
2137
2138         Although we could probably perform this operation earlier, for
2139         good error reporting we need to keep the lists and remove the
2140         lists for longer than required.
2141
2142         This optimization was triggered by Paolo profiling the compiler
2143         speed on the output of `gen-sample-program.pl' perl script. 
2144
2145         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2146         not crash in methods like MemberLookupFailed that use this field.  
2147
2148         This problem arises when the compiler fails to resolve a type
2149         during interface type definition for example.
2150
2151 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2152
2153         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2154         inherit from System.Object, so we have to stop at null, not only
2155         when reaching System.Object.
2156
2157 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
2158
2159         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2160         DeclaredOnly because the parent indexer might have had a different
2161         name, but did not loop until the top of the hierarchy was reached.
2162
2163         The problem this one fixes is 35492: when a class implemented an
2164         indexer from an interface, we were getting the interface method
2165         (which was abstract) and we were flagging an error (can not invoke
2166         abstract method).
2167
2168         This also keeps bug 33089 functioning, and test-148 functioning.
2169
2170         * typemanager.cs (IsSpecialMethod): The correct way of figuring
2171         out if a method is special is to see if it is declared in a
2172         property or event, or whether it is one of the predefined operator
2173         names.   This should fix correctly #36804.
2174
2175 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
2176
2177         The goal here is to remove the dependency on EmptyCast.Peel ().
2178         Killing it completely.
2179         
2180         The problem is that currently in a number of places where
2181         constants are expected, we have to "probe" for an EmptyCast, and
2182         Peel, which is not the correct thing to do, as this will be
2183         repetitive and will likely lead to errors. 
2184
2185         The idea is to remove any EmptyCasts that are used in casts that
2186         can be reduced to constants, so we only have to cope with
2187         constants. 
2188
2189         This bug hunt was triggered by Bug 37363 and the desire to remove
2190         the duplicate pattern where we were "peeling" emptycasts to check
2191         whether they were constants.  Now constants will always be
2192         constants.
2193         
2194         * ecore.cs: Use an enumconstant here instead of wrapping with
2195         EmptyCast.  
2196
2197         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
2198         throwing me off.  By handling this we can get rid of a few hacks.
2199         
2200         * statement.cs (Switch): Removed Peel() code.
2201
2202 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
2203
2204         * class.cs: Location information for error 508
2205
2206         * expression.cs (New.DoResolve): Add a guard against double
2207         resolution of an expression.  
2208
2209         The New DoResolve might be called twice when initializing field
2210         expressions (see EmitFieldInitializers, the call to
2211         GetInitializerExpression will perform a resolve on the expression,
2212         and later the assign will trigger another resolution
2213
2214         This leads to bugs (#37014)
2215
2216         * delegate.cs: The signature for EndInvoke should contain any ref
2217         or out parameters as well.  We were not doing this in the past. 
2218
2219         * class.cs (Field.Define): Do not overwrite the type definition
2220         inside the `volatile' group.  Turns out that volatile enumerations
2221         were changing the type here to perform a validity test, which
2222         broke conversions. 
2223
2224 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
2225
2226         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2227         and structs, we do not want to load the instance variable
2228
2229         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2230         enum_type has to be handled like an object reference (implicit
2231         conversions exists from this to object), but the regular IsClass
2232         and IsValueType tests will never return true for this one.
2233
2234         Also we use TypeManager.IsValueType instead of type.IsValueType,
2235         just for consistency with the rest of the code (this is only
2236         needed if we ever use the construct exposed by test-180.cs inside
2237         corlib, which we dont today).
2238
2239 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
2240
2241         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2242         just InternalCall.
2243
2244 2003-02-09  Martin Baulig  <martin@ximian.com>
2245
2246         * namespace.cs (Namespace..ctor): Added SourceFile argument.
2247         (Namespace.DefineNamespaces): New static public method; this is
2248         called when we're compiling with debugging to add all namespaces
2249         to the symbol file.
2250
2251         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2252         pass it to the Namespace's .ctor.
2253
2254         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2255         and MethodBase arguments; pass the namespace ID to the symwriter;
2256         pass the MethodBase instead of the token to the symwriter.
2257         (SymbolWriter.DefineNamespace): New method to add a namespace to
2258         the symbol file.
2259
2260 2003-02-09  Martin Baulig  <martin@ximian.com>
2261
2262         * symbolwriter.cs: New file.  This is a wrapper around
2263         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
2264         methods here in near future.
2265
2266 2003-02-09  Martin Baulig  <martin@ximian.com>
2267
2268         * codegen.cs (EmitContext.Mark): Just pass the arguments to
2269         ILGenerator.MarkSequencePoint() which are actually used by the
2270         symbol writer.
2271
2272 2003-02-09  Martin Baulig  <martin@ximian.com>
2273
2274         * location.cs (SourceFile): New public sealed class.  This
2275         contains the name and an index which is used in the location's token.
2276         (Location): Reserve an appropriate number of bits in the token for
2277         the source file instead of walking over that list, this gives us a
2278         really huge performance improvement when compiling with debugging.
2279
2280         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2281         `SourceFile' argument instead of a string.
2282         (Driver.ProcessFile): Add all the files via Location.AddFile(),
2283         but don't parse/tokenize here, we need to generate the list of all
2284         source files before we do that.
2285         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
2286         the files.
2287
2288         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2289         instead of a string.
2290
2291         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2292         of a string.
2293
2294 2003-02-09  Martin Baulig  <martin@ximian.com>
2295
2296         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2297         filename on `#line default'.
2298
2299 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2300
2301         * statement.cs: don't clear the pinned var when the fixed statement
2302         returns from the method (fixes bug#37752).
2303
2304 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2305
2306         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
2307         to IsValueType.
2308
2309 2003-02-07  Martin Baulig  <martin@ximian.com>
2310
2311         * driver.cs: Removed the `--debug-args' command line argument.
2312
2313         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2314         automatically by the AsssemblyBuilder.
2315         (CodeGen.InitializeSymbolWriter): We don't need to call any
2316         initialization function on the symbol writer anymore.  This method
2317         doesn't take any arguments.
2318
2319 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
2320
2321         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2322         from referenced assemblies as well.
2323
2324 2003-02-02  Martin Baulig  <martin@ximian.com>
2325
2326         * class.cs (MethodData.Emit): Generate debugging info for external methods.
2327
2328 2003-02-02  Martin Baulig  <martin@ximian.com>
2329
2330         * class.cs (Constructor.Emit): Open the symbol writer before
2331         emitting the constructor initializer.
2332         (ConstructorInitializer.Emit): Call ec.Mark() to allow
2333         single-stepping through constructor initializers.
2334
2335 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
2336
2337         * class.cs: Handle error 549: do not allow virtual methods in
2338         sealed classes. 
2339
2340 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2341
2342         * decl.cs: Check access levels when resolving types
2343         
2344 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2345
2346         * statement.cs: Add parameters and locals set in catch blocks that might 
2347         return to set vector
2348
2349 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
2350
2351         * class.cs (Operator): Set the SpecialName flags for operators.
2352         
2353         * expression.cs (Invocation.DoResolve): Only block calls to
2354         accessors and operators on SpecialName methods.
2355
2356         (Cast.TryReduce): Handle conversions from char constants.
2357
2358
2359 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2360
2361         * statement.cs: small memory and time optimization in FlowBranching.
2362         
2363 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
2364
2365         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2366         problem that the last fix but in the other sid (Set).
2367
2368         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2369         access when there is no indexer in the hierarchy.
2370         
2371 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2372
2373         * class.cs: Combine some if statements.
2374
2375 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2376
2377         * driver.cs: fixed bug #37187.
2378
2379 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
2380
2381         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2382         any indexer, it's needed to build a list with all the indexers in the
2383         hierarchy (AllGetters), else we have problems. Fixes #35653.
2384
2385 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
2386
2387         * class.cs (MethodData.Define): It is wrong for an interface
2388         implementation to be static in both cases: explicit and implicit.
2389         We were only handling this in one case.
2390
2391         Improve the if situation there to not have negations.
2392         
2393         * class.cs (Field.Define): Turns out that we do not need to check
2394         the unsafe bit on field definition, only on usage.  Remove the test.
2395
2396 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2397
2398         * driver.cs: use assembly.Location instead of Codebase (the latest
2399         patch made mcs fail when using MS assemblies).
2400
2401 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
2402
2403         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2404         get the path to *corlib.dll.
2405
2406 2003-01-21  Nick Drochak <ndrochak@gol.com>
2407
2408         * cs-tokenizer.cs:
2409         * pending.cs:
2410         * typemanager.cs: Remove compiler warnings
2411
2412 2003-01-20  Duncan Mak  <duncan@ximian.com>
2413
2414         * AssemblyInfo.cs: Bump the version number to 0.19.
2415         
2416 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2417
2418         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2419
2420 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
2421
2422         * class.cs (Constructor::Emit): Emit debugging info for constructors.
2423
2424 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
2425
2426         * cs-parser.jay: Small fix: we were not comparing the constructor
2427         name correctly.   Thanks to Zoltan for the initial pointer.
2428
2429 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2430
2431         * cs-tokenizer.cs: Set file name when specified with #line
2432
2433 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
2434
2435         * cs-parser.jay: Only perform the constructor checks here if we
2436         are named like the class;  This will help provider a better
2437         error.  The constructor path is taken when a type definition is
2438         not found, but most likely the user forgot to add the type, so
2439         report that rather than the constructor error.
2440
2441 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2442
2443         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2444         allocations.
2445
2446 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2447
2448         * cs-parser.jay: Add cleanup call.
2449
2450 2003-01-13  Duncan Mak  <duncan@ximian.com>
2451
2452         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2453         consistent with other methods.
2454
2455 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2456
2457         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2458         
2459 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2460
2461         * attribute.cs: only set GuidAttr to true when we have a
2462         GuidAttribute.
2463
2464 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2465
2466         * ecore.cs:
2467         * expression.cs:
2468         * typemanager.cs: fixes to allow mcs compile corlib with the new
2469         Type.IsSubclassOf fix.
2470
2471 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
2472
2473         * expression.cs (LocalVariableReference.DoResolve): Classify a
2474         constant as a value, not as a variable.   Also, set the type for
2475         the variable.
2476
2477         * cs-parser.jay (fixed_statement): take a type instead of a
2478         pointer_type, so we can produce a better error message later.
2479         
2480         * statement.cs (Fixed.Resolve): Flag types that are not pointers
2481         as an error.  
2482         
2483         (For.DoEmit): Make inifinite loops have a
2484         non-conditional branch back.
2485
2486         (Fixed.DoEmit): First populate the pinned variables, then emit the
2487         statement, then clear the variables.  Before I was emitting the
2488         code once for each fixed piece.
2489
2490
2491 2003-01-08  Martin Baulig  <martin@ximian.com>
2492
2493         * statement.cs (FlowBranching.MergeChild): A break in a
2494         SWITCH_SECTION does not leave a loop.  Fixes #36155.
2495
2496 2003-01-08  Martin Baulig  <martin@ximian.com>
2497
2498         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2499         lives in the same number space than `param_map'.  Fixes #36154.
2500
2501 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
2502
2503         * cs-parser.jay (constructor_declaration): Set the
2504         Constructor.ModFlags before probing for it.  This makes the
2505         compiler report 514, 515 and 132 (the code was there, but got
2506         broken). 
2507
2508         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2509         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2510         (GotoCase.Resolve): Set `Returns' to ALWAYS.
2511
2512 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2513
2514         * enum.cs: create the enum static fields using the enum type.
2515
2516 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2517
2518         * class.cs: don't try to create the ParamBuilder for the return
2519         type if it's not needed (and handle it breaking for the ms runtime
2520         anyway).
2521
2522 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2523
2524         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2525
2526 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
2527
2528         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2529         the command.   This showed up while compiling the JANET source
2530         code, which used \r as its only newline separator.
2531
2532 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
2533
2534         * class.cs (Method.Define): If we are an operator (because it
2535         reuses our code), then set the SpecialName and HideBySig.  #36128
2536
2537 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
2538
2539         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2540         exception, report error 120 `object reference required'.
2541
2542         * driver.cs: Add --pause option, used during to measure the size
2543         of the process as it goes with --timestamp.
2544
2545         * expression.cs (Invocation.DoResolve): Do not allow methods with
2546         SpecialName to be invoked.
2547
2548 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
2549
2550         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2551         number before adding it.
2552
2553 2002-12-21  Ravi Pratap  <ravi@ximian.com>
2554
2555         * ecore.cs (StandardImplicitConversion): When in an unsafe
2556         context, we allow conversion between void * to any other pointer
2557         type. This fixes bug #35973.
2558
2559 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2560
2561         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2562         is not thrown when extensionless outputs are used 
2563
2564 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2565
2566         * rootcontext.cs: fixed compilation of corlib.
2567
2568 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
2569
2570         * attribute.cs (Attributes.Contains): Add new method.
2571
2572         * class.cs (MethodCore.LabelParameters): if the parameter is an
2573         `out' parameter, check that no attribute `[In]' has been passed.
2574
2575         * enum.cs: Handle the `value__' name in an enumeration.
2576
2577 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
2578
2579         * decl.cs: Added special case to allow overrides on "protected
2580         internal" methods
2581         
2582 2002-12-18  Ravi Pratap  <ravi@ximian.com>
2583
2584         * attribute.cs (Attributes.AddAttributeSection): Rename to this
2585         since it makes much more sense.
2586
2587         (Attributes.ctor): Don't require a Location parameter.
2588         
2589         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2590
2591         * attribute.cs (ApplyAttributes): Remove extra Location parameters
2592         since we already have that information per attribute.
2593
2594         * everywhere : make appropriate changes.
2595
2596         * class.cs (LabelParameters): Write the code which actually
2597         applies attributes to the return type. We can't do this on the MS
2598         .NET runtime so we flag a warning in the case an exception is
2599         thrown.
2600
2601 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
2602
2603         * const.cs: Handle implicit null conversions here too.
2604
2605 2002-12-17  Ravi Pratap  <ravi@ximian.com>
2606
2607         * class.cs (MethodCore.LabelParameters): Remove the extra
2608         Type [] parameter since it is completely unnecessary. Instead
2609         pass in the method's attributes so that we can extract
2610         the "return" attribute.
2611
2612 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
2613
2614         * cs-parser.jay (parse): Use Report.Error to flag errors instead
2615         of ignoring it and letting the compile continue.
2616
2617         * typemanager.cs (ChangeType): use an extra argument to return an
2618         error condition instead of throwing an exception.
2619
2620 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
2621
2622         * expression.cs (Unary.TryReduce): mimic the code for the regular
2623         code path.  Perform an implicit cast in the cases where we can
2624         implicitly convert to one of the integral types, and then reduce
2625         based on that constant.   This fixes bug #35483.
2626
2627 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2628
2629         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2630
2631 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2632
2633         * namespace.cs: fixed bug #35489.
2634
2635 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
2636
2637         * class.cs: Remove some dead code.
2638
2639         * cs-parser.jay: Estimate the number of methods needed
2640         (RootContext.MethodCount);
2641
2642         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2643         numbers instead of StringBuilders.
2644
2645         * support.cs (PtrHashtable): Add constructor with initial size;
2646         We can now reduce reallocations of the method table.
2647
2648 2002-12-10  Ravi Pratap  <ravi@ximian.com>
2649
2650         * attribute.cs (ApplyAttributes): Keep track of the emitted
2651         attributes on a per-target basis. This fixes bug #35413.
2652
2653 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
2654
2655         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2656         default to the Windows 1252 encoding.
2657
2658         (UnixParseOption): Support version, thanks to Alp for the missing
2659         pointer. 
2660
2661         * AssemblyInfo.cs: Add nice assembly information.
2662
2663         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2664         (bug 35169).
2665
2666         * cs-parser.jay: Allow a trailing comma before the close bracked
2667         in the attribute_section production.
2668
2669         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2670         address of the instance was being taken, I will take this out,
2671         because we take the address of the object immediately here.
2672
2673 2002-12-09  Ravi Pratap  <ravi@ximian.com>
2674
2675         * typemanager.cs (AreMultipleAllowed): Take care of the most
2676         obvious case where attribute type is not in the current assembly -
2677         stupid me ;-)
2678
2679 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
2680
2681         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2682         definitions, instead of doing that afterwards.  
2683
2684         Also we use a nice little hack, depending on the constructor, we
2685         know if we are a "composed" name or a simple name.  Hence, we
2686         avoid the IndexOf test, and we avoid 
2687
2688         * codegen.cs: Add code to assist in a bug reporter to track down
2689         the source of a compiler crash. 
2690
2691 2002-12-07  Ravi Pratap  <ravi@ximian.com>
2692
2693         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2694         types have been emitted for a given element and flag an error
2695         if something which does not have AllowMultiple set is used more
2696         than once.
2697
2698         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2699         attribute types and their corresponding AllowMultiple properties
2700
2701         (AreMultipleAllowed): Check the property for a given type.
2702
2703         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2704         property in the case we have a TypeContainer.
2705
2706         (Attributes.AddAttribute): Detect duplicates and just skip on
2707         adding them. This trivial fix catches a pretty gross error in our
2708         attribute emission - global attributes were being emitted twice!
2709
2710         Bugzilla bug #33187 is now fixed.
2711
2712 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
2713
2714         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2715         instead of pp_and).
2716
2717         * expression.cs (Binary.ResolveOperator): I can only use the
2718         Concat (string, string, string) and Concat (string, string,
2719         string, string) if the child is actually a concatenation of
2720         strings. 
2721
2722 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
2723
2724         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2725         context where we need a 2-character lookahead.
2726
2727         * pending.cs (PendingImplementation): Rework so we can keep track
2728         of interface types all the time, and flag those which were
2729         implemented by parents as optional.
2730
2731 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
2732
2733         * expression.cs (Binary.ResolveOperator): Use
2734         String.Concat(string,string,string) or
2735         String.Concat(string,string,string,string) when possible. 
2736
2737         * typemanager: More helper methods.
2738
2739
2740 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2741
2742         * pending.cs: remove the bogus return from GetMissingInterfaces()
2743         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2744
2745 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2746
2747         * namespace.cs: avoid duplicated 'using xxx' being added to
2748         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2749         when we get more than one 'using' statement for the same namespace.
2750         Report a CS0105 warning for it.
2751
2752 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
2753
2754         * cs-tokenizer.cs (consume_identifier): use read directly, instead
2755         of calling getChar/putback, uses internal knowledge of it.    
2756
2757         (xtoken): Reorder tokenizer so most common patterns are checked
2758         first.  This reduces the compilation time in another 5% (from 8.11s
2759         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2760
2761         The parsing time is 22% of the compilation in mcs, and from that
2762         64% is spent on the tokenization process.  
2763
2764         I tried using a binary search for keywords, but this is slower
2765         than the hashtable.  Another option would be to do a couple of
2766         things:
2767
2768                 * Not use a StringBuilder, instead use an array of chars,
2769                   with a set value.  Notice that this way we could catch
2770                   the 645 error without having to do it *afterwards*.
2771
2772                 * We could write a hand-parser to avoid the hashtable
2773                   compares altogether.
2774
2775         The identifier consumption process takes 37% of the tokenization
2776         time.  Another 15% is spent on is_number.  56% of the time spent
2777         on is_number is spent on Int64.Parse:
2778
2779                 * We could probably choose based on the string length to
2780                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
2781                   computations. 
2782
2783         Another 3% is spend on wrapping `xtoken' in the `token' function.
2784
2785         Handle 0xa0 as whitespace (#34752)
2786         
2787 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
2788
2789         * typemanager.cs (IsCLRType): New routine to tell whether a type
2790         is one of the builtin types.  
2791
2792         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
2793         typecode in more places instead of doing pointer comparissions.
2794         We could leverage some knowledge about the way the typecodes are
2795         laid out.
2796
2797         New code to cache namespaces in assemblies, it is currently not
2798         invoked, to be used soon.
2799
2800         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2801
2802         * expression.cs (Binary.ResolveOperator): specially handle
2803         strings, and do not perform user-defined operator overloading for
2804         built-in types.
2805
2806 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
2807
2808         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2809         internalcall as it is a pretty simple operation;  Avoid whenever
2810         possible to call Char.IsLetter.
2811
2812         (consume_identifier): Cut by half the number of
2813         hashtable calls by merging the is_keyword and GetKeyword behavior.
2814
2815         Do not short-circuit, because if we do, we
2816         report errors (ie, #if false && true would produce an invalid
2817         directive error);
2818         
2819
2820 2002-11-24  Martin Baulig  <martin@ximian.com>
2821
2822         * expression.cs (Cast.TryReduce): If we're in checked syntax,
2823         check constant ranges and report a CS0221.  Fixes #33186.
2824
2825 2002-11-24  Martin Baulig  <martin@ximian.com>
2826
2827         * cs-parser.jay: Make this work for uninitialized variable
2828         declarations in the `for' initializer.  Fixes #32416.
2829
2830 2002-11-24  Martin Baulig  <martin@ximian.com>
2831
2832         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2833         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
2834
2835 2002-11-24  Martin Baulig  <martin@ximian.com>
2836
2837         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2838         argument; if true, we also check for user-defined conversions.
2839         This is only needed if both arguments are of a user-defined type.
2840         Fixes #30443, added test-175.cs.
2841         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2842
2843         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2844
2845 2002-11-24  Martin Baulig  <martin@ximian.com>
2846
2847         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2848         function to get the store opcode.
2849         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2850         only emit the Ldelema if the store opcode is Stobj.  You must run
2851         both test-34 and test-167 to test this.  Fixes #34529.
2852
2853 2002-11-23  Martin Baulig  <martin@ximian.com>
2854
2855         * ecore.cs (Expression.MemberLookup): Added additional
2856         `qualifier_type' argument which is used when we're being called
2857         from MemberAccess.DoResolve() and null if we're called from a
2858         SimpleName lookup.
2859         (Expression.MemberLookupFailed): New method to report errors; this
2860         does the CS1540 check and reports the correct error message.
2861
2862         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2863         argument for the CS1540 check and redone the way how we're dealing
2864         with private members.  See the comment in the source code for details.
2865         (FilterWithClosure): Reverted this back to revision 1.197; renamed
2866         `closure_start_type' to `closure_qualifier_type' and check whether
2867         it's not null.  It was not this filter being broken, it was just
2868         being called with the wrong arguments.
2869
2870         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2871         and pass it the correct `qualifier_type'; this also does the error
2872         handling for us.
2873
2874 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
2875
2876         * expression.cs (Invocation.EmitParams): If the we are dealing
2877         with a non-built-in value type, load its address as well.
2878
2879         (ArrayCreation): Use a a pretty constant instead
2880         of the hardcoded value 2.   Use 6 instead of 2 for the number of
2881         static initializers.  
2882
2883         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2884         because they are not really value types, just glorified integers. 
2885
2886         * driver.cs: Do not append .exe, the CSC compiler does not do it.
2887
2888         * ecore.cs: Remove redundant code for enumerations, make them use
2889         the same code path as everything else, fixes the casting issue
2890         with enumerations in Windows.Forms.
2891
2892         * attribute.cs: Do only cast to string if it is a string, the
2893         validation happens later.
2894
2895         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2896         people upgrade their corlibs.
2897
2898         * ecore.cs: Oops, enumerations were not following the entire code path
2899
2900 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
2901
2902         * typemanager.cs (FilterWithClosure): Commented out the test for
2903         1540 in typemanager.cs, as it has problems when accessing
2904         protected methods from a parent class (see test-174.cs). 
2905
2906         * attribute.cs (Attribute.ValidateGuid): new method.
2907         (Attribute.Resolve): Use above.
2908
2909 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
2910
2911         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2912
2913         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2914         handling for enumerations, as we only needed the TypeContainer
2915         functionality to begin with (this is required for the fix below to
2916         work for enums that reference constants in a container class for
2917         example). 
2918
2919         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2920
2921         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2922         a valid TypeBuilder to perform lookups on.o
2923
2924         * class.cs (InheritableMemberSignatureCompare): Use true in the
2925         call to GetGetMethod and GetSetMethod, because we are comparing
2926         the signature, and we need to get the methods *even* if they are
2927         private. 
2928
2929         (PropertyBase.CheckBase): ditto.
2930
2931         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2932         GotoCase.Resolve): Use Peel on EmpytCasts.
2933
2934         * ecore.cs (EmptyCast): drop child, add Peel method.
2935
2936 2002-11-17  Martin Baulig  <martin@ximian.com>
2937
2938         * ecore.cs (EmptyCast.Child): New public property.
2939
2940         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2941         label resolved to an EmptyCast.  Fixes #34162.
2942         (GotoCase.Resolve): Likewise.
2943         (Block.EmitMeta): Likewise.
2944
2945 2002-11-17  Martin Baulig  <martin@ximian.com>
2946
2947         * expression.cs (Invocation.BetterConversion): Prefer int over
2948         uint; short over ushort; long over ulong for integer literals.
2949         Use ImplicitConversionExists instead of StandardConversionExists
2950         since we also need to check for user-defined implicit conversions.
2951         Fixes #34165.  Added test-173.cs.
2952
2953 2002-11-16  Martin Baulig  <martin@ximian.com>
2954
2955         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2956         with the `true' and `false' literals.  Fixes #33151.
2957
2958 2002-11-16  Martin Baulig  <martin@ximian.com>
2959
2960         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2961         October 22nd; don't do the cs1540 check for static members.
2962
2963         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2964         now using our own filter here and doing the cs1540 check again.
2965
2966 2002-11-16  Martin Baulig  <martin@ximian.com>
2967
2968         * support.cs (InternalParameters): Don't crash if we don't have
2969         any fixed parameters.  Fixes #33532.
2970
2971 2002-11-16  Martin Baulig  <martin@ximian.com>
2972
2973         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2974         when looking up static methods to make this work on Windows.
2975         Fixes #33773.
2976
2977 2002-11-16  Martin Baulig  <martin@ximian.com>
2978
2979         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2980         a setter rather than using PropertyInfo.CanWrite.
2981
2982 2002-11-15  Nick Drochak  <ndrochak@gol.com>
2983
2984         * class.cs: Allow acces to block member by subclasses. Fixes build
2985         breaker.
2986
2987 2002-11-14  Martin Baulig  <martin@ximian.com>
2988
2989         * class.cs (Constructor.Emit): Added the extern/block check.
2990         Fixes bug #33678.
2991
2992 2002-11-14  Martin Baulig  <martin@ximian.com>
2993
2994         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
2995         iteration while looking for indexers, this is needed because the
2996         indexer may have a different name in our base classes.  Fixed the
2997         error reporting (no indexers at all, not get accessor, no
2998         overloaded match).  Fixes bug #33089.
2999         (IndexerAccess.DoResolveLValue): Likewise.
3000
3001 2002-11-14  Martin Baulig  <martin@ximian.com>
3002
3003         * class.cs (PropertyBase.CheckBase): Make this work for multiple
3004         indexers.  Fixes the first part of bug #33089.
3005         (MethodSignature.InheritableMemberSignatureCompare): Added support
3006         for properties.
3007
3008 2002-11-13  Ravi Pratap  <ravi@ximian.com>
3009
3010         * attribute.cs (Attribute.Resolve): Catch the
3011         NullReferenceException and report it since it isn't supposed to
3012         happen. 
3013         
3014 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
3015
3016         * expression.cs (Binary.EmitBranchable): Also handle the cases for
3017         LogicalOr and LogicalAnd that can benefit from recursively
3018         handling EmitBranchable.  The code now should be nice for Paolo.
3019
3020 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
3021
3022         * typemanager.cs (LookupType): Added a negative-hit hashtable for
3023         the Type lookups, as we perform quite a number of lookups on
3024         non-Types.  This can be removed once we can deterministically tell
3025         whether we have a type or a namespace in advance.
3026
3027         But this might require special hacks from our corlib.
3028
3029         * TODO: updated.
3030
3031         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
3032         and double which avoids a conversion from an integer to a double.
3033
3034         * expression.cs: tiny optimization, avoid calling IsConstant,
3035         because it effectively performs the lookup twice.
3036
3037 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
3038
3039         But a bogus return here to keep the semantics of the old code
3040         until the Mono runtime is fixed.
3041         
3042         * pending.cs (GetMissingInterfaces): New method used to remove all
3043         the interfaces that are already implemented by our parent
3044         classes from the list of pending methods. 
3045
3046         * interface.cs: Add checks for calls after ResolveTypeExpr.
3047
3048 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
3049
3050         * class.cs (Class.Emit): Report warning 67: event not used if the
3051         warning level is beyond 3.
3052
3053         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
3054         being a NullLiteral.
3055
3056         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
3057         specifiers. 
3058
3059         * class.cs (TypeContainer.GetClassBases): Cover a missing code
3060         path that might fail if a type can not be resolved.
3061
3062         * expression.cs (Binary.Emit): Emit unsigned versions of the
3063         operators. 
3064
3065         * driver.cs: use error 5.
3066         
3067 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
3068
3069         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
3070
3071 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
3072
3073         * cs-parser.jay (switch_section): A beautiful patch from Martin
3074         Baulig that fixed 33094.
3075
3076 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
3077
3078         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
3079         Check whether the base is abstract and report an error if so.
3080
3081         * expression.cs (IndexerAccess.DoResolveLValue,
3082         IndexerAccess.DoResolve): ditto. 
3083
3084         (Invocation.DoResolve): ditto.
3085         
3086         (Invocation.FullMethodDesc): Improve the report string.
3087
3088         * statement.cs (Block): Eliminate IsVariableDefined as it is
3089         basically just a wrapper for GetVariableInfo.
3090
3091         * ecore.cs (SimpleName): Use new 
3092
3093         * support.cs (ReflectionParamter.ParameterType): We unwrap the
3094         type, as we return the actual parameter ref/unref state on a
3095         different call.
3096
3097 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
3098
3099         * support.cs: Return proper flags REF/OUT fixing the previous
3100         commit.  
3101
3102         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
3103         not used to mean `ref' but `ref or out' in ParameterReference
3104         
3105         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3106         full type signature instead of calling TypeManger.CSharpName
3107         ourselves. 
3108
3109         * support.cs (InternalParameters.ParameterDesc): Do not compare
3110         directly to the modflags, because REF/OUT will actually be bitsets
3111         if set. 
3112
3113         * delegate.cs (VerifyMethod): Check also the modifiers.
3114
3115         * cs-tokenizer.cs: Fix bug where floating point values with an
3116         exponent where a sign was missing was ignored.
3117
3118         * driver.cs: Allow multiple assemblies to be specified in a single
3119         /r: argument
3120
3121 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
3122
3123         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
3124         because identifiers after a parenthesis would end up in this kind
3125         of production, and we needed to desamiguate it for having casts
3126         like:
3127
3128                 (UserDefinedType *) xxx
3129
3130 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
3131
3132         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3133         we should set on the Bindingflags.NonPublic, but not turn on
3134         private_ok.  private_ok controls whether a Private member is
3135         returned (this is chekced on the filter routine), while the
3136         BindingFlags.NonPublic just controls whether private/protected
3137         will be allowed.   This fixes the problem part of the problem of
3138         private properties being allowed to be used in derived classes.
3139
3140         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3141         so we can call the children DoResolveLValue method (this will
3142         properly signal errors on lvalue assignments to base properties)
3143         
3144         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3145         getter are null, and we have a property info, we know that this
3146         happened because the lookup failed, so we report an error 122 for
3147         protection level violation.
3148
3149         We also silently return if setter and getter are null in the
3150         resolve functions, this condition only happens if we have flagged
3151         the error before.  This is the other half of the problem. 
3152
3153         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3154         not have accessibility information, that is why we were returning
3155         true in the filter function in typemanager.cs.
3156
3157         To properly report 122 (property is inaccessible because of its
3158         protection level) correctly, we report this error in ResolveAccess
3159         by failing if both the setter and the getter are lacking (ie, the
3160         lookup failed). 
3161
3162         DoResolve and DoLResolve have been modified to check for both
3163         setter/getter being null and returning silently, the reason being
3164         that I did not want to put the knowledge about this error in upper
3165         layers, like:
3166
3167         int old = Report.Errors;
3168         x = new PropertyExpr (...);
3169         if (old != Report.Errors)
3170                 return null;
3171         else
3172                 return x;
3173
3174         So the property expr is returned, but it is invalid, so the error
3175         will be flagged during the resolve process. 
3176
3177         * class.cs: Remove InheritablePropertySignatureCompare from the
3178         class, as we no longer depend on the property signature to compute
3179         whether it is possible to implement a method or not.
3180
3181         The reason is that calling PropertyInfo.GetGetMethod will return
3182         null (in .NET, in Mono it works, and we should change this), in
3183         cases where the Get Method does not exist in that particular
3184         class.
3185
3186         So this code:
3187
3188         class X { public virtual int A { get { return 1; } } }
3189         class Y : X { }
3190         class Z : Y { public override int A { get { return 2; } } }
3191
3192         Would fail in Z because the parent (Y) would not have the property
3193         defined.  So we avoid this completely now (because the alternative
3194         fix was ugly and slow), and we now depend exclusively on the
3195         method names.
3196
3197         (PropertyBase.CheckBase): Use a method-base mechanism to find our
3198         reference method, instead of using the property.
3199
3200         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
3201         routines are gone now.
3202
3203         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
3204         names, they were incorrectly named.
3205
3206         * cs-tokenizer.cs: Return are more gentle token on failure. 
3207
3208         * pending.cs (PendingImplementation.InterfaceMethod): This routine
3209         had an out-of-sync index variable, which caused it to remove from
3210         the list of pending methods the wrong method sometimes.
3211
3212 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
3213
3214         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
3215         CanWrite, because those refer to this particular instance of the
3216         property, and do not take into account the fact that we can
3217         override single members of a property.
3218
3219         Constructor requires an EmitContext.  The resolution process does
3220         not happen here, but we need to compute the accessors before,
3221         because the resolution does not always happen for properties.
3222         
3223         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3224         subclass, before we did not update this flag, but we did update
3225         bindingflags. 
3226
3227         (GetAccessors): Drop this routine, as it did not work in the
3228         presence of partially overwritten set/get methods. 
3229
3230         Notice that this broke the cs1540 detection, but that will require
3231         more thinking. 
3232         
3233 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3234
3235         * class.cs:
3236         * codegen.cs:
3237         * driver.cs: issue a warning instead of an error if we don't support
3238         debugging for the platform. Also ignore a couple of errors that may
3239         arise when trying to write the symbols. Undo my previous patch.
3240
3241 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3242
3243         * driver.cs: ignore /debug switch except for Unix platforms.
3244
3245 2002-10-23  Nick Drochak  <ndrochak@gol.com>
3246
3247         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3248
3249 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
3250
3251         * driver.cs: Do not make mcs-debug conditional, so we do not break
3252         builds that use it.
3253
3254         * statement.cs (UsageVector.MergeChildren): I would like Martin to
3255         review this patch.  But basically after all the children variables
3256         have been merged, the value of "Breaks" was not being set to
3257         new_breaks for Switch blocks.  I think that it should be set after
3258         it has executed.  Currently I set this to the value of new_breaks,
3259         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3260         conservative, but I do not understand this code very well.
3261
3262         I did not break anything in the build, so that is good ;-)
3263
3264         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3265
3266 2002-10-20  Mark Crichton  <crichton@gimp.org>
3267
3268         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
3269
3270 2002-10-20  Nick Drochak  <ndrochak@gol.com>
3271
3272         * cfold.cs: Fixed compile blocker.
3273
3274 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
3275
3276         * driver.cs: I was chekcing the key, not the file.
3277
3278 2002-10-19  Ravi Pratap  <ravi@ximian.com>
3279
3280         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3281         message that we were generating - we just need to silently return
3282         a null.
3283
3284 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
3285
3286         * class.cs (Event.Define): Change my previous commit, as this
3287         breaks the debugger.  This is a temporary hack, as it seems like
3288         the compiler is generating events incorrectly to begin with.
3289
3290         * expression.cs (Binary.ResolveOperator): Added support for 
3291         "U operator - (E x, E y)"
3292
3293         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3294         y)".
3295
3296         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3297         init-only variables, but this path did not take into account that
3298         there might be also instance readonly variables.  Correct this
3299         problem. 
3300
3301         This fixes bug 32253
3302
3303         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3304         delegates as well.
3305
3306         * driver.cs: Change the extension for modules to `netmodule'
3307
3308         * cs-parser.jay: Improved slightly the location tracking for
3309         the debugger symbols.
3310
3311         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3312         modifiers that were specified instead of the hardcoded value
3313         (FamAndAssem).  This was basically ignoring the static modifier,
3314         and others.  Fixes 32429.
3315
3316         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3317         fixed a bug in the process (32476)
3318
3319         * expression.cs (ArrayAccess.EmitAssign): Patch from
3320         hwang_rob@yahoo.ca that fixes bug 31834.3
3321
3322 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
3323
3324         * driver.cs: Make the module extension .netmodule.
3325
3326 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
3327
3328         * driver.cs: Report an error if the resource file is not found
3329         instead of crashing.
3330
3331         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3332         false, like Emit does.
3333
3334 2002-10-16  Nick Drochak  <ndrochak@gol.com>
3335
3336         * typemanager.cs: Remove unused private member.  Also reported mcs
3337         bug to report this as a warning like csc.
3338
3339 2002-10-15  Martin Baulig  <martin@gnome.org>
3340
3341         * statement.cs (Statement.Emit): Made this a virtual method; emits
3342         the line number info and calls DoEmit().
3343         (Statement.DoEmit): New protected abstract method, formerly knows
3344         as Statement.Emit().
3345
3346         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3347
3348 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
3349
3350         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3351         have fixed a remaining problem: not every AddXXXX was adding a
3352         fully qualified name.  
3353
3354         Now everyone registers a fully qualified name in the DeclSpace as
3355         being defined instead of the partial name.  
3356
3357         Downsides: we are slower than we need to be due to the excess
3358         copies and the names being registered this way.  
3359
3360         The reason for this is that we currently depend (on the corlib
3361         bootstrap for instance) that types are fully qualified, because
3362         we dump all the types in the namespace, and we should really have
3363         types inserted into the proper namespace, so we can only store the
3364         basenames in the defined_names array.
3365
3366 2002-10-10  Martin Baulig  <martin@gnome.org>
3367
3368         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3369         from bug #31834, see the bug report for a testcase which is
3370         miscompiled.
3371
3372 2002-10-10  Martin Baulig  <martin@gnome.org>
3373
3374         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3375         flow analysis code for this.
3376
3377         * statement.cs (Do, While, For): Tell the flow analysis code about
3378         infinite loops.
3379         (FlowBranching.UsageVector): Added support for infinite loops.
3380         (Block.Resolve): Moved the dead code elimination here and use flow
3381         analysis to do it.
3382
3383 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
3384
3385         * class.cs (Field.Define): Catch cycles on struct type
3386         definitions. 
3387
3388         * typemanager.cs (IsUnmanagedtype): Do not recursively check
3389         fields if the fields are static.  We only need to check instance
3390         fields. 
3391
3392         * expression.cs (As.DoResolve): Test for reference type.
3393
3394         * statement.cs (Using.ResolveExpression): Use
3395         ConvertImplicitRequired, not ConvertImplicit which reports an
3396         error on failture
3397         (Using.ResolveLocalVariableDecls): ditto.
3398
3399         * expression.cs (Binary.ResolveOperator): Report errors in a few
3400         places where we had to.
3401
3402         * typemanager.cs (IsUnmanagedtype): Finish implementation.
3403
3404 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
3405
3406         * expression.cs: Use StoreFromPtr instead of extracting the type
3407         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
3408
3409         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3410         an enumeration value to a System.Enum, but System.Enum is not a
3411         value type, but an class type, so we need to box.
3412
3413         (Expression.ConvertExplicit): One codepath could return
3414         errors but not flag them.  Fix this.  Fixes #31853
3415
3416         * parameter.cs (Resolve): Do not allow void as a parameter type.
3417
3418 2002-10-06  Martin Baulig  <martin@gnome.org>
3419
3420         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3421         if it's a class type and not a struct.  Fixes #31815.
3422
3423 2002-10-06  Martin Baulig  <martin@gnome.org>
3424
3425         * statement.cs: Reworked the flow analysis code a bit to make it
3426         usable for dead code elimination.
3427
3428 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3429
3430         * cs-parser.jay: allow empty source files. Fixes bug #31781.
3431
3432 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3433
3434         * expression.cs (ComposedCast.DoResolveType): A quick workaround
3435         to fix the test 165, will investigate deeper.
3436
3437 2002-10-04  Martin Baulig  <martin@gnome.org>
3438
3439         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3440         finally blocks actually work.
3441         (Try.Resolve): We don't need to create a sibling for `finally' if
3442         there is no finally block.
3443
3444 2002-10-04  Martin Baulig  <martin@gnome.org>
3445
3446         * class.cs (Constructor.Define): The default accessibility for a
3447         non-default constructor is private, not public.
3448
3449 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3450
3451         * class.cs (Constructor): Make AllowedModifiers public, add
3452         EXTERN.
3453
3454         * cs-parser.jay: Perform the modifiers test here, as the
3455         constructor for the Constructor class usually receives a zero
3456         because of the way we create it (first we create, later we
3457         customize, and we were never checking the modifiers).
3458
3459         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3460         is a version of LookupTypeReflection that includes the type-name
3461         cache.  This can be used as a fast path for functions that know
3462         the fully qualified name and are only calling into *.GetType() to
3463         obtain a composed type.
3464
3465         This is also used by TypeManager.LookupType during its type
3466         composition.
3467
3468         (LookupType): We now also track the real type name, as sometimes
3469         we can get a quey for the real type name from things like
3470         ComposedCast.  This fixes bug 31422.
3471         
3472         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3473         complete type fullname, it does not have to go through the type
3474         resolution system to obtain the composed version of the type (for
3475         obtaining arrays or pointers).
3476         
3477         (Conditional.Emit): Use the EmitBoolExpression to
3478         generate nicer code, as requested by Paolo.
3479
3480         (ArrayCreation.CheckIndices): Use the patch from
3481         hwang_rob@yahoo.ca to validate the array initializers. 
3482
3483 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
3484
3485         * class.cs (ConstructorInitializer.Emit): simplify code by using
3486         Invocation.EmitCall, and at the same time, fix the bugs in calling
3487         parent constructors that took variable arguments. 
3488
3489         * ecore.cs (Expression.ConvertNumericExplicit,
3490         Expression.ImplicitNumericConversion): Remove the code that
3491         manually wrapped decimal (InternalTypeConstructor call is now gone
3492         as well).
3493
3494         * expression.cs (Cast.TryReduce): Also handle decimal types when
3495         trying to perform a constant fold on the type.
3496
3497         * typemanager.cs (IsUnmanagedtype): Partially implemented.
3498
3499         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3500         that only turned off an error report, and did nothing else. 
3501
3502 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
3503
3504         * driver.cs: Handle and ignore /fullpaths
3505
3506 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
3507
3508         * expression.cs (Binary.ResolveOperator): Catch the case where
3509         DoNumericPromotions returns true, 
3510
3511         (Binary.DoNumericPromotions): Simplify the code, and the tests.
3512
3513 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
3514
3515         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3516         report error 70.
3517
3518 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
3519
3520         * ecore.cs (ConvertNumericExplicit): It is not enough that the
3521         conversion exists, but it is also required that the conversion be
3522         performed.  This manifested in "(Type64Enum) 2".  
3523
3524         * class.cs (TypeManager.AddMethod): The fix is not to change
3525         AddEnum, because that one was using a fully qualified name (every
3526         DeclSpace derivative does), but to change the AddMethod routine
3527         that was using an un-namespaced name.  This now correctly reports
3528         the duplicated name.
3529
3530         Revert patch until I can properly fix it.  The issue
3531         is that we have a shared Type space across all namespaces
3532         currently, which is wrong.
3533
3534         Options include making the Namespace a DeclSpace, and merge
3535         current_namespace/current_container in the parser.
3536
3537 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
3538
3539         * cs-parser.jay: Improve error reporting when we get a different
3540         kind of expression in local_variable_type and
3541         local_variable_pointer_type. 
3542
3543         Propagate this to avoid missleading errors being reported.
3544
3545         * ecore.cs (ImplicitReferenceConversion): treat
3546         TypeManager.value_type as a target just like object_type.   As
3547         code like this:
3548
3549         ValueType v = 1;
3550
3551         Is valid, and needs to result in the int 1 being boxed before it
3552         is assigned to the value type v.
3553
3554         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3555         to validate the enumeration name.
3556
3557         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3558         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
3559         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3560
3561         * ecore.cs (TryImplicitIntConversion): When doing an
3562         implicit-enumeration-conversion, check if the type is 64-bits and
3563         perform a conversion before passing to EnumConstant.
3564
3565 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
3566
3567         * decl.cs (Error_AmbiguousTypeReference); New routine used to
3568         report ambiguous type references.  Unlike the MS version, we
3569         report what the ambiguity is.   Innovation at work ;-)
3570
3571         (DeclSpace.FindType): Require a location argument to
3572         display when we display an ambiguous error.
3573
3574         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3575
3576         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3577
3578         * expression.cs (EmitDynamicInitializers): Apply patch from
3579         hwang_rob@yahoo.ca that fixes the order in which we emit our
3580         initializers. 
3581
3582 2002-09-21  Martin Baulig  <martin@gnome.org>
3583
3584         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3585         delegate takes no arguments.
3586
3587 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
3588
3589         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3590         from integers.
3591
3592         * expression.cs: Extract the underlying type.
3593
3594         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3595
3596         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3597
3598 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
3599
3600         * class.cs (TypeContainer.DefineType): We can not use the nice
3601         PackingSize with the size set to 1 DefineType method, because it
3602         will not allow us to define the interfaces that the struct
3603         implements.
3604
3605         This completes the fixing of bug 27287
3606
3607         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3608         means also structs.  This fixes part of the problem. 
3609         (Expresion.ImplicitReferenceConversionExists): ditto.
3610
3611         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3612         error if there were no errors reported during the type lookup
3613         process, to avoid duplicates or redundant errors.  Without this
3614         you would get an ambiguous errors plus a type not found.  We have
3615         beaten the user enough with the first error.  
3616
3617         (DeclSparce.FindType): Emit a warning if we have an ambiguous
3618         reference. 
3619
3620         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3621         during the resolution process, stop the lookup, this avoids
3622         repeated error reports (same error twice).
3623
3624         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3625
3626         * typemanager.cs (LookupType): Redo the type lookup code to match
3627         the needs of System.Reflection.  
3628
3629         The issue is that System.Reflection requires references to nested
3630         types to begin with a "+" sign instead of a dot.  So toplevel
3631         types look like: "NameSpace.TopLevelClass", and nested ones look
3632         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3633         levels. 
3634
3635 2002-09-19  Martin Baulig  <martin@gnome.org>
3636
3637         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3638         says that a method always returns or always throws an exception,
3639         don't report the CS0161.
3640
3641         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3642         set `Returns = new_returns'.
3643
3644 2002-09-19  Martin Baulig  <martin@gnome.org>
3645
3646         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3647         to an enum constant, check for a CS0176.
3648
3649 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
3650
3651         * class.cs (TypeContainer.CheckPairedOperators): Now we check
3652         for operators that must be in pairs and report errors.
3653
3654         * ecore.cs (SimpleName.DoResolveType): During the initial type
3655         resolution process, when we define types recursively, we must
3656         check first for types in our current scope before we perform
3657         lookups in the enclosing scopes.
3658
3659         * expression.cs (MakeByteBlob): Handle Decimal blobs.
3660
3661         (Invocation.VerifyArgumentsCompat): Call
3662         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3663         I thought we were supposed to always call this, but there are a
3664         few places in the code where we dont do it.
3665
3666 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
3667
3668         * driver.cs: Add support in -linkres and -resource to specify the
3669         name of the identifier.
3670
3671 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3672
3673         * ecore.cs (StandardConversionExists): Sync with the conversion
3674         code: allow anything-* to void* conversions.
3675
3676         (FindMostSpecificSource): Use an Expression argument
3677         instead of a Type, because we might be handed over a Literal which
3678         gets a few more implicit conversions that plain types do not.  So
3679         this information was being lost.
3680
3681         Also, we drop the temporary type-holder expression when not
3682         required.
3683
3684 2002-09-17  Martin Baulig  <martin@gnome.org>
3685
3686         * class.cs (PropertyBase.CheckBase): Don't check the base class if
3687         this is an explicit interface implementation.
3688
3689 2002-09-17  Martin Baulig  <martin@gnome.org>
3690
3691         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3692         different `IndexerName' attributes.
3693
3694         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3695         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3696         virtual CommonResolve().
3697
3698 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3699
3700         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3701         and convert that to the UnderlyingType.
3702
3703         * statement.cs (Foreach.Resolve): Indexers are just like variables
3704         or PropertyAccesses.
3705
3706         * cs-tokenizer.cs (consume_string): Track line numbers and columns
3707         inside quoted strings, we were not doing this before.
3708
3709 2002-09-16  Martin Baulig  <martin@gnome.org>
3710
3711         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3712         resolve it.  This is needed for the definite assignment check of the
3713         instance expression, fixes bug #29846.
3714         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3715
3716 2002-09-16  Nick Drochak  <ndrochak@gol.com>
3717
3718         * parameter.cs: Fix compile error.  Cannot reference static member
3719         from an instance object.  Is this an mcs bug?
3720
3721 2002-09-14  Martin Baulig  <martin@gnome.org>
3722
3723         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3724         multiple times.  Fixes bug #30295, added test-166.cs.
3725
3726 2002-09-14  Martin Baulig  <martin@gnome.org>
3727
3728         * statement.cs (Block.Emit): Don't emit unreachable code.
3729         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3730         `break' statements.
3731         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3732
3733 2002-09-14  Martin Baulig  <martin@gnome.org>
3734
3735         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3736         is set.
3737
3738 2002-09-14  Martin Baulig  <martin@gnome.org>
3739
3740         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3741         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3742         be false on the ms runtime.
3743
3744 2002-09-13  Martin Baulig  <martin@gnome.org>
3745
3746         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3747         the CS0038 error message.
3748
3749 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
3750
3751         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3752         constant inside, return it.
3753
3754 2002-09-12  Martin Baulig  <martin@gnome.org>
3755
3756         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3757         implicit conversion can be done between enum types.
3758
3759         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3760         check whether an implicit conversion to the current enum's UnderlyingType
3761         exists and report an error if not.
3762
3763         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3764         without debugging support.
3765
3766         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3767         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
3768
3769 2002-09-12  Martin Baulig  <martin@gnome.org>
3770
3771         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3772
3773         * ecore.cs (IMemberExpr.DeclaringType): New property.
3774         (SimpleName.SimpleNameResolve): Check whether we're accessing a
3775         nonstatic member of an outer type (CS0038).
3776
3777 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
3778
3779         * driver.cs: Activate the using-error detector at warning level
3780         4 (at least for MS-compatible APIs).
3781
3782         * namespace.cs (VerifyUsing): Small buglett fix.
3783
3784         * pending.cs (PendingImplementation): pass the container pointer. 
3785
3786         * interface.cs (GetMethods): Allow for recursive definition.  Long
3787         term, I would like to move every type to support recursive
3788         definitions, not the current ordering mechanism that we have right
3789         now.
3790
3791         The situation is this: Attributes are handled before interfaces,
3792         so we can apply attributes to interfaces.  But some attributes
3793         implement interfaces, we will now handle the simple cases
3794         (recursive definitions will just get an error).  
3795
3796         * parameter.cs: Only invalidate types at the end if we fail to
3797         lookup all types.  
3798
3799 2002-09-09  Martin Baulig  <martin@gnome.org>
3800
3801         * ecore.cs (PropertyExpr.Emit): Also check for
3802         TypeManager.system_int_array_get_length so this'll also work when
3803         compiling corlib.  Fixes #30003.
3804
3805 2002-09-09  Martin Baulig  <martin@gnome.org>
3806
3807         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3808         and throw an exception if we can't get the type's size.  Fixed #30040,
3809         added test-165.cs.
3810
3811 2002-09-09  Martin Baulig  <martin@gnome.org>
3812
3813         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3814
3815         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3816         context.  Fixes bug #30027.
3817
3818         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3819         virtual functions.  Fixes bug #30043, added test-164.cs.
3820
3821 2002-09-08  Ravi Pratap  <ravi@ximian.com>
3822
3823         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3824
3825 2002-09-08  Nick Drochak  <ndrochak@gol.com>
3826
3827         * driver.cs: Use an object to get the windows codepage since it's not a
3828         static property.
3829
3830 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
3831
3832         * statement.cs (For.Emit): for infinite loops (test == null)
3833         return whether there is a break inside, not always "true".
3834
3835         * namespace.cs (UsingEntry): New struct to hold the name of the
3836         using definition, the location where it is defined, and whether it
3837         has been used in a successful type lookup.
3838         
3839         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3840         strings.
3841
3842         * decl.cs: ditto.
3843
3844 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3845
3846         * attribute.cs : Fix incorrect code which relied on catching
3847         a NullReferenceException to detect a null being passed in
3848         where an object was expected.
3849
3850 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
3851
3852         * statement.cs (Try): flag the catch variable as assigned
3853
3854         * expression.cs (Cast): Simplified by using ResolveType instead of
3855         manually resolving.
3856
3857         * statement.cs (Catch): Fix bug by using ResolveType.
3858
3859 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3860
3861         * expression.cs (BetterConversion): Special case for when we have
3862         a NullLiteral as the argument and we have to choose between string
3863         and object types - we choose string the way csc does.
3864
3865         * attribute.cs (Attribute.Resolve): Catch the
3866         NullReferenceException and report error #182 since the Mono
3867         runtime no more has the bug and having this exception raised means
3868         we tried to select a constructor which takes an object and is
3869         passed a null.
3870
3871 2002-09-05  Ravi Pratap  <ravi@ximian.com>
3872
3873         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3874         message (1502, 1503) when we can't locate a method after overload
3875         resolution. This is much more informative and closes the bug
3876         Miguel reported.
3877
3878         * interface.cs (PopulateMethod): Return if there are no argument
3879         types. Fixes a NullReferenceException bug.
3880
3881         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3882         expressions too. Previously we were checking only in one place for
3883         positional arguments leaving out named arguments.
3884
3885         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3886         type to the enum type is not allowed. Remove code corresponding to
3887         that.
3888
3889         (ConvertNumericExplicit): Allow explicit conversions from
3890         the underlying type to enum type. This precisely follows the spec
3891         and closes a bug filed by Gonzalo.
3892         
3893 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3894
3895         * compiler.csproj:
3896         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3897
3898 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
3899
3900         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3901         it was important that we stored the right value after the
3902         reduction in `converted'.
3903
3904 2002-09-04  Martin Baulig  <martin@gnome.org>
3905
3906         * location.cs (Location.SymbolDocument): Use full pathnames for the
3907         source files.
3908
3909 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
3910
3911         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3912         of the expression resolve mechanism, because that will catch the
3913         SimpleName error failures.
3914
3915         (Conditional): If we can not resolve the
3916         expression, return, do not crash.
3917
3918 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3919
3920         * cs-tokenizer.cs:
3921         (location): display token name instead of its number.
3922
3923 2002-08-28  Martin Baulig  <martin@gnome.org>
3924
3925         * expression.cs (Binary.ResolveOperator): Don't silently return
3926         but return an error if an operator cannot be applied between two
3927         enum types.
3928
3929 2002-08-28  Martin Baulig  <martin@gnome.org>
3930
3931         * class.cs (Constructor.Define): Set the permission attributes
3932         correctly instead of making all constructors public.
3933
3934 2002-08-28  Martin Baulig  <martin@gnome.org>
3935
3936         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3937         for private members before reporting a CS0103; if we find anything,
3938         it's a CS0122.
3939
3940 2002-08-28  Martin Baulig  <martin@gnome.org>
3941
3942         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3943         to check whether `closure_start_type == closure_invocation_type',
3944         we also need to check whether `m.DeclaringType == closure_invocation_type'
3945         before bypassing the permission checks.  We might be accessing
3946         protected/private members from the base class.
3947         (TypeManager.RealMemberLookup): Only set private_ok if private
3948         members were requested via BindingFlags.NonPublic.
3949
3950         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3951
3952         * expression.cs (MemberAccess.ResolveMemberAccess): Set
3953         MethodGroupExpr.IsExplicitImpl if appropriate.
3954         (Invocation.DoResolve): Don't report the CS0120 for explicit
3955         interface implementations.
3956
3957 2002-08-27  Martin Baulig  <martin@gnome.org>
3958
3959         * expression.cs (Invocation.DoResolve): If this is a static
3960         method and we don't have an InstanceExpression, we must report
3961         a CS0120.
3962
3963 2002-08-25  Martin Baulig  <martin@gnome.org>
3964
3965         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3966         `==' between a valuetype and an object.
3967
3968 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
3969
3970         * ecore.cs (TypeExpr): Provide a ToString method.
3971
3972 2002-08-24  Martin Baulig  <martin@gnome.org>
3973
3974         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3975         now called proggie.dbg and it's a binary file.
3976
3977 2002-08-23  Martin Baulig  <martin@gnome.org>
3978
3979         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3980
3981 2002-08-23  Martin Baulig  <martin@gnome.org>
3982
3983         * struct.cs (MyStructInfo.ctor): Make this work with empty
3984         structs; it's not allowed to use foreach() on null.
3985
3986 2002-08-23  Martin Baulig  <martin@gnome.org>
3987
3988         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
3989         writer the full pathname of the generated assembly.
3990
3991 2002-08-23  Martin Baulig  <martin@gnome.org>
3992
3993         * statements.cs (FlowBranching.UsageVector.MergeChildren):
3994         A `finally' block never returns or breaks; improved handling of
3995         unreachable code.
3996
3997 2002-08-23  Martin Baulig  <martin@gnome.org>
3998
3999         * statement.cs (Throw.Resolve): Allow `throw null'.
4000
4001 2002-08-23  Martin Baulig  <martin@gnome.org>
4002
4003         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
4004         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
4005         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
4006         MemberLookup would return a wrong event if this is an explicit
4007         interface implementation and the class has an event with the same
4008         name.
4009
4010 2002-08-23  Martin Baulig  <martin@gnome.org>
4011
4012         * statement.cs (Block.AddChildVariableNames): New public method.
4013         (Block.AddChildVariableName): Likewise.
4014         (Block.IsVariableNameUsedInChildBlock): Likewise.
4015         (Block.AddVariable): Check whether a variable name has already
4016         been used in a child block.
4017
4018         * cs-parser.jay (declare_local_variables): Mark all variable names
4019         from the current block as being used in a child block in the
4020         implicit block.
4021
4022 2002-08-23  Martin Baulig  <martin@gnome.org>
4023
4024         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
4025         find the symbol writer.
4026
4027         * driver.cs: csc also allows the arguments to /define being
4028         separated by commas, not only by semicolons.
4029
4030 2002-08-23  Martin Baulig  <martin@gnome.org>
4031
4032         * interface.cs (Interface.GetMembers): Added static check for events.
4033
4034 2002-08-15  Martin Baulig  <martin@gnome.org>
4035
4036         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
4037         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
4038
4039         * ecore.cs (Expression.MemberLookup): Added documentation and explained
4040         why the MethodData.EmitDestructor() change was necessary.
4041
4042 2002-08-20  Martin Baulig  <martin@gnome.org>
4043
4044         * class.cs (TypeContainer.FindMembers): Added static check for events.
4045
4046         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
4047
4048         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
4049         use Type.GetEvents(), not Type.FindMembers().
4050
4051 2002-08-20  Martin Baulig  <martin@gnome.org>
4052
4053         * decl.cs (MemberCache): Added a special method cache which will
4054         be used for method-only searched.  This ensures that a method
4055         search will return a MethodInfo with the correct ReflectedType for
4056         inherited methods.      
4057
4058 2002-08-20  Martin Baulig  <martin@gnome.org>
4059
4060         * decl.cs (DeclSpace.FindMembers): Made this public.
4061
4062 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4063
4064         * delegate.cs: fixed build on windows.
4065         [FIXME:  Filed as bug #29150: MCS must report these errors.]
4066
4067 2002-08-19  Ravi Pratap  <ravi@ximian.com>
4068
4069         * ecore.cs (StandardConversionExists): Return a false
4070         if we are trying to convert the void type to anything else
4071         since that is not allowed.
4072
4073         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
4074         we flag error 70 in the event an event is trying to be accessed
4075         directly from outside the declaring type.
4076
4077 2002-08-20  Martin Baulig  <martin@gnome.org>
4078
4079         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
4080         MemberCache from typemanager.cs to decl.cs.
4081
4082 2002-08-19  Martin Baulig  <martin@gnome.org>
4083
4084         * class.cs (TypeContainer): Implement IMemberContainer.
4085         (TypeContainer.DefineMembers): Create the MemberCache.
4086         (TypeContainer.FindMembers): Do better BindingFlags checking; only
4087         return public members if BindingFlags.Public was given, check
4088         whether members are static.
4089
4090 2002-08-16  Martin Baulig  <martin@gnome.org>
4091
4092         * decl.cs (DeclSpace.Define): Splitted this in Define and
4093         DefineMembers.  DefineMembers is called first and initializes the
4094         MemberCache.
4095
4096         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
4097         DefineMembers() on all our DeclSpaces.
4098
4099         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
4100         but call DefineMembers() on all nested interfaces.  We call their
4101         Define() in our new Define() function.
4102
4103         * interface.cs (Interface): Implement IMemberContainer.
4104         (Interface.Define): Moved all code except the attribute stuf to
4105         DefineMembers().
4106         (Interface.DefineMembers): Initialize the member cache.
4107
4108         * typemanager.cs (IMemberFinder): Removed this interface, we don't
4109         need this anymore since we can use MemberCache.FindMembers directly.
4110
4111 2002-08-19  Martin Baulig  <martin@gnome.org>
4112
4113         * typemanager.cs (MemberCache): When creating the cache for an
4114         interface type, add all inherited members.
4115         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4116         to `out bool used_cache' and documented it.
4117         (TypeManager.MemberLookup): If we already used the cache in the first
4118         iteration, we don't need to do the interfaces check.
4119
4120 2002-08-19  Martin Baulig  <martin@gnome.org>
4121
4122         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
4123         here from IMemberFinder and don't implement this interface anymore.
4124         (DeclSpace.MemberCache): Moved here from IMemberFinder.
4125
4126         * typemanager.cs (IMemberFinder): This interface is now only used by
4127         classes which actually support the member cache.
4128         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4129         since we only put DeclSpaces into this Hashtable.
4130         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4131         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4132
4133 2002-08-16  Martin Baulig  <martin@gnome.org>
4134
4135         * typemanager.cs (ICachingMemberFinder): Removed.
4136         (IMemberFinder.MemberCache): New property.
4137         (TypeManager.FindMembers): Merged this with RealFindMembers().
4138         This function will never be called from TypeManager.MemberLookup()
4139         so we can't use the cache here, just the IMemberFinder.
4140         (TypeManager.MemberLookup_FindMembers): Check whether the
4141         IMemberFinder has a MemberCache and call the cache's FindMembers
4142         function.
4143         (MemberCache): Rewrote larger parts of this yet another time and
4144         cleaned it up a bit.
4145
4146 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
4147
4148         * driver.cs (LoadArgs): Support quoting.
4149
4150         (Usage): Show the CSC-like command line arguments.
4151
4152         Improved a few error messages.
4153
4154 2002-08-15  Martin Baulig  <martin@gnome.org>
4155
4156         * typemanager.cs (IMemberContainer.Type): New property.
4157         (IMemberContainer.IsInterface): New property.
4158
4159         The following changes are conditional to BROKEN_RUNTIME, which is
4160         defined at the top of the file.
4161
4162         * typemanager.cs (MemberCache.MemberCache): Don't add the base
4163         class'es members, but add all members from TypeHandle.ObjectType
4164         if we're an interface.
4165         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4166         is the current type.
4167         (MemberCache.CacheEntry.Container): Removed this field.
4168         (TypeHandle.GetMembers): Include inherited members.
4169
4170 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4171
4172         * typemanager.cs: fixed compilation and added a comment on a field that
4173         is never used.
4174
4175 2002-08-15  Martin Baulig  <martin@gnome.org>
4176
4177         * class.cs (ConstructorInitializer.Resolve): In the
4178         Expression.MemberLookup call, use the queried_type as
4179         invocation_type.
4180
4181         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4182         declared' attribute, it's always true.
4183         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4184         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4185         temporary wrapper for FindMembers which tells MemberLookup whether
4186         members from the base classes are included in the return value.
4187         This will go away soon.
4188         (TypeManager.MemberLookup): Use this temporary hack here; once the
4189         new MemberCache is completed, we don't need to do the DeclaredOnly
4190         looping here anymore since the MemberCache will take care of this.
4191         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4192         (MemberCache): When creating the MemberCache for a class, get
4193         members from the current class and all its base classes.
4194         (MemberCache.CacheEntry.Container): New field.  This is a
4195         temporary hack until the Mono runtime is fixed to distinguish
4196         between ReflectedType and DeclaringType.  It allows us to use MCS
4197         with both the MS runtime and the unfixed Mono runtime without
4198         problems and without accecting performance.
4199         (MemberCache.SearchMembers): The DeclaredOnly looping from
4200         TypeManager.MemberLookup is now done here.      
4201
4202 2002-08-14  Martin Baulig  <martin@gnome.org>
4203
4204         * statement.cs (MyStructInfo.MyStructInfo): Don't call
4205         Type.GetFields on dynamic types but get the fields from the
4206         corresponding TypeContainer.
4207         (MyStructInfo.GetStructInfo): Added check for enum types.
4208
4209         * typemanager.cs (MemberList.IsSynchronized): Implemented.
4210         (MemberList.SyncRoot): Implemented.
4211         (TypeManager.FilterWithClosure): No need to check permissions if
4212         closure_start_type == closure_invocation_type, don't crash if
4213         closure_invocation_type is null.
4214
4215 2002-08-13  Martin Baulig  <martin@gnome.org>
4216
4217         Rewrote TypeContainer.FindMembers to use a member cache.  This
4218         gives us a speed increase of about 35% for the self-hosting MCS
4219         build and of about 15-20% for the class libs (both on GNU/Linux).
4220
4221         * report.cs (Timer): New class to get enhanced profiling.  This
4222         whole class is "TIMER" conditional since it remarkably slows down
4223         compilation speed.
4224
4225         * class.cs (MemberList): New class.  This is an IList wrapper
4226         which we're now using instead of passing MemberInfo[]'s around to
4227         avoid copying this array unnecessarily.
4228         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4229         (ICachingMemberFinder, IMemberContainer): New interface.
4230         (TypeManager.FilterWithClosure): If `criteria' is null, the name
4231         has already been checked, otherwise use it for the name comparision.
4232         (TypeManager.FindMembers): Renamed to RealMemberFinder and
4233         provided wrapper which tries to use ICachingMemberFinder.FindMembers
4234         if possible.  Returns a MemberList, not a MemberInfo [].
4235         (TypeHandle): New class, implements IMemberContainer.  We create
4236         one instance of this class per type, it contains a MemberCache
4237         which is used to do the member lookups.
4238         (MemberCache): New class.  Each instance of this class contains
4239         all members of a type and a name-based hash table.
4240         (MemberCache.FindMembers): This is our new member lookup
4241         function.  First, it looks up all members of the requested name in
4242         the hash table.  Then, it walks this list and sorts out all
4243         applicable members and returns them.
4244
4245 2002-08-13  Martin Baulig  <martin@gnome.org>
4246
4247         In addition to a nice code cleanup, this gives us a performance
4248         increase of about 1.4% on GNU/Linux - not much, but it's already
4249         half a second for the self-hosting MCS compilation.
4250
4251         * typemanager.cs (IMemberFinder): New interface.  It is used by
4252         TypeManager.FindMembers to call FindMembers on a TypeContainer,
4253         Enum, Delegate or Interface.
4254         (TypeManager.finder_to_member_finder): New PtrHashtable.
4255         (TypeManager.finder_to_container): Removed.
4256         (TypeManager.finder_to_delegate): Removed.
4257         (TypeManager.finder_to_interface): Removed.
4258         (TypeManager.finder_to_enum): Removed.
4259
4260         * interface.cs (Interface): Implement IMemberFinder.
4261
4262         * delegate.cs (Delegate): Implement IMemberFinder.
4263
4264         * enum.cs (Enum): Implement IMemberFinder.
4265
4266         * class.cs (TypeContainer): Implement IMemberFinder.
4267
4268 2002-08-12  Martin Baulig  <martin@gnome.org>
4269
4270         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4271
4272 2002-08-12  Martin Baulig  <martin@gnome.org>
4273
4274         * ecore.cs (ITypeExpression): New interface for expressions which
4275         resolve to a type.
4276         (TypeExpression): Renamed to TypeLookupExpression.
4277         (Expression.DoResolve): If we're doing a types-only lookup, the
4278         expression must implement the ITypeExpression interface and we
4279         call DoResolveType() on it.
4280         (SimpleName): Implement the new ITypeExpression interface.
4281         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4282         hack, the situation that we're only looking up types can't happen
4283         anymore when this method is called.  Moved the type lookup code to
4284         DoResolveType() and call it.
4285         (SimpleName.DoResolveType): This ITypeExpression interface method
4286         is now doing the types-only lookup.
4287         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4288         (ResolveFlags): Added MaskExprClass.
4289
4290         * expression.cs (MemberAccess): Implement the ITypeExpression
4291         interface.
4292         (MemberAccess.DoResolve): Added support for a types-only lookup
4293         when we're called via ITypeExpression.DoResolveType().
4294         (ComposedCast): Implement the ITypeExpression interface.
4295
4296         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
4297         Expression.Resolve() with ResolveFlags.Type instead.
4298
4299 2002-08-12  Martin Baulig  <martin@gnome.org>
4300
4301         * interface.cs (Interface.Define): Apply attributes.
4302
4303         * attribute.cs (Attribute.ApplyAttributes): Added support for
4304         interface attributes.
4305
4306 2002-08-11  Martin Baulig  <martin@gnome.org>
4307
4308         * statement.cs (Block.Emit): Only check the "this" variable if we
4309         do not always throw an exception.
4310
4311         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4312         whether the property has a set accessor.
4313
4314 2002-08-11  Martin Baulig  <martin@gnome.org>
4315
4316         Added control flow analysis support for structs.
4317
4318         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4319         with control flow analysis turned off.
4320         (IVariable): New interface.
4321         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4322         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4323         (FieldExpr.DoResolve): Resolve the instance expression with flow
4324         analysis turned off and do the definite assignment check after the
4325         resolving when we know what the expression will resolve to.
4326
4327         * expression.cs (LocalVariableReference, ParameterReference):
4328         Implement the new IVariable interface, only call the flow analysis
4329         code if ec.DoFlowAnalysis is true.
4330         (This): Added constructor which takes a Block argument.  Implement
4331         the new IVariable interface.
4332         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4333         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4334         This does the definite assignment checks for struct members.
4335
4336         * class.cs (Constructor.Emit): If this is a non-static `struct'
4337         constructor which doesn't have any initializer, call
4338         Block.AddThisVariable() to tell the flow analysis code that all
4339         struct elements must be initialized before control returns from
4340         the constructor.
4341
4342         * statement.cs (MyStructInfo): New public class.
4343         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4344         argument to this indexer.  If non-zero, check an individual struct
4345         member, not the whole struct.
4346         (FlowBranching.CheckOutParameters): Check struct members.
4347         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4348         overloaded versions of these methods which take an additional
4349         `int field_idx' argument to check struct members.
4350         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4351         overloaded versions of these methods which take an additional
4352         `string field_name' argument to check struct member.s
4353         (VariableInfo): Implement the IVariable interface.
4354         (VariableInfo.StructInfo): New public property.  Returns the
4355         MyStructInfo instance of the variable if it's a struct or null.
4356         (Block.AddThisVariable): New public method.  This is called from
4357         Constructor.Emit() for non-static `struct' constructor which do
4358         not have any initializer.  It creates a special variable for the
4359         "this" instance variable which will be checked by the flow
4360         analysis code to ensure that all of the struct's fields are
4361         initialized before control returns from the constructor.
4362         (UsageVector): Added support for struct members.  If a
4363         variable/parameter is a struct with N members, we reserve a slot
4364         in the usage vector for each member.  A struct is considered fully
4365         initialized if either the struct itself (slot 0) or all its
4366         members are initialized.
4367
4368 2002-08-08  Martin Baulig  <martin@gnome.org>
4369
4370         * driver.cs (Driver.MainDriver): Only report an error CS5001
4371         if there were no compilation errors.
4372
4373         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4374         `UnsafeContext' property to determine whether the parent is in
4375         unsafe context rather than checking the parent's ModFlags:
4376         classes nested in an unsafe class are unsafe as well.
4377
4378 2002-08-08  Martin Baulig  <martin@gnome.org>
4379
4380         * statement.cs (UsageVector.MergeChildren): Distinguish between
4381         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4382         we return.  Added test17() and test18() to test-154.cs.
4383
4384 2002-08-08  Martin Baulig  <martin@gnome.org>
4385
4386         * typemanager.cs (TypeManager.FilterWithClosure): If we have
4387         Family access, make sure the invoking type isn't a subclass of the
4388         queried type (that'd be a CS1540).
4389
4390         * ecore.cs (Expression.MemberLookup): Added overloaded version of
4391         this method which takes an additional `Type invocation_type'.
4392
4393         * expression.cs (BaseAccess.DoResolve): Use the base type as
4394         invocation and query type.
4395         (MemberAccess.DoResolve): If the lookup failed and we're about to
4396         report a CS0122, try a lookup with the ec.ContainerType - if this
4397         succeeds, we must report a CS1540.
4398
4399 2002-08-08  Martin Baulig  <martin@gnome.org>
4400
4401         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4402         (MethodGroupExpr): Implement the IMemberExpr interface.
4403
4404         * expression (MemberAccess.ResolveMemberAccess): No need to have
4405         any special code for MethodGroupExprs anymore, they're now
4406         IMemberExprs.   
4407
4408 2002-08-08  Martin Baulig  <martin@gnome.org>
4409
4410         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4411         Family, FamANDAssem and FamORAssem permissions.
4412         (TypeManager.IsSubclassOrNestedChildOf): New public method.
4413
4414 2002-08-08  Martin Baulig  <martin@gnome.org>
4415
4416         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4417         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4418         or loop block.
4419
4420 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4421
4422         * driver.cs: implemented /resource option to embed managed resources.
4423
4424 2002-08-07  Martin Baulig  <martin@gnome.org>
4425
4426         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4427         (FieldBase.HasFieldInitializer): New public property.
4428         (FieldBase.GetInitializerExpression): New public method.  Resolves and
4429         returns the field initializer and makes sure it is only resolved once.
4430         (TypeContainer.EmitFieldInitializers): Call
4431         FieldBase.GetInitializerExpression to get the initializer, this ensures
4432         that it isn't resolved multiple times.
4433
4434         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
4435         the resolving process (SimpleName/MemberLookup) that we're currently
4436         emitting a field initializer (which must not access any instance members,
4437         this is an error CS0236).
4438
4439         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4440         argument, if the `IsFieldInitializer' flag is set, we must report and
4441         error CS0236 and not an error CS0120.   
4442
4443 2002-08-07  Martin Baulig  <martin@gnome.org>
4444
4445         * ecore.cs (IMemberExpr): New public interface.
4446         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4447         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4448         if the expression is an IMemberExpr.
4449
4450         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4451         to be null, implicitly default to `this' if we're non-static in
4452         this case.  Simplified the code a lot by using the new IMemberExpr
4453         interface.  Also fixed bug #28176 here.
4454
4455 2002-08-06  Martin Baulig  <martin@gnome.org>
4456
4457         * cs-parser.jay (SimpleLookup): Removed.  We need to create
4458         ParameterReferences during semantic analysis so that we can do a
4459         type-only search when resolving Cast, TypeOf and SizeOf.
4460         (block): Pass the `current_local_parameters' to the Block's
4461         constructor.
4462
4463         * class.cs (ConstructorInitializer): Added `Parameters parameters'
4464         argument to the constructor.
4465         (ConstructorInitializer.Resolve): Create a temporary implicit
4466         block with the parameters.
4467
4468         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4469         references here if we aren't doing a type-only search.
4470
4471         * statement.cs (Block): Added constructor which takes a
4472         `Parameters parameters' argument.
4473         (Block.Parameters): New public property.
4474
4475         * support.cs (InternalParameters.Parameters): Renamed `parameters'
4476         to `Parameters' and made it public readonly.
4477
4478 2002-08-06  Martin Baulig  <martin@gnome.org>
4479
4480         * ecore.cs (Expression.Warning): Made this public as well.
4481
4482         * report.cs (Report.Debug): Print the contents of collections.
4483
4484 2002-08-06  Martin Baulig  <martin@gnome.org>
4485
4486         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
4487         used to tell Resolve() which kinds of expressions it may return.
4488         (Expression.Resolve): Added overloaded version of this method which
4489         takes a `ResolveFlags flags' argument.  This can be used to tell
4490         Resolve() which kinds of expressions it may return.  Reports a
4491         CS0118 on error.
4492         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4493         ResolveFlags.SimpleName.
4494         (Expression.Error118): Added overloaded version of this method which
4495         takes a `ResolveFlags flags' argument.  It uses the flags to determine
4496         which kinds of expressions are allowed.
4497
4498         * expression.cs (Argument.ResolveMethodGroup): New public method.
4499         Resolves an argument, but allows a MethodGroup to be returned.
4500         This is used when invoking a delegate.
4501
4502         * TODO: Updated a bit.
4503
4504 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4505
4506         Fixed compilation with csc.
4507
4508         * ecore.cs: Expression.Error made public. Is this correct? Should
4509         Warning be made public too?
4510
4511         * expression.cs: use ea.Location instead of ea.loc.
4512         [FIXME:  Filed as bug #28607: MCS must report these errors.]
4513
4514 2002-08-06  Martin Baulig  <martin@gnome.org>
4515
4516         * ecore.cs (Expression.loc): Moved the location here instead of
4517         duplicating it in all derived classes.
4518         (Expression.Location): New public property.
4519         (Expression.Error, Expression.Warning): Made them non-static and
4520         removed the location argument.
4521         (Expression.Warning): Added overloaded version which takes an
4522         `int level' argument.
4523         (Expression.Error118): Make this non-static and removed the
4524         expression and location arguments.
4525         (TypeExpr): Added location argument to the constructor.
4526
4527         * expression.cs (StaticCallExpr): Added location argument to
4528         the constructor.
4529         (Indirection, PointerArithmetic): Likewise.
4530         (CheckedExpr, UnCheckedExpr): Likewise.
4531         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4532         (StringPtr): Likewise.
4533
4534
4535 2002-08-05  Martin Baulig  <martin@gnome.org>
4536
4537         * expression.cs (BaseAccess.DoResolve): Actually report errors.
4538
4539         * assign.cs (Assign.DoResolve): Check whether the source
4540         expression is a value or variable.
4541
4542         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4543         while resolving the corresponding blocks.
4544
4545         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4546         an error, don't silently return null.
4547
4548         * statement.cs (Block.AddVariable): Do the error reporting here
4549         and distinguish between CS0128 and CS0136.
4550         (Block.DoResolve): Report all unused labels (warning CS0164).
4551         (LabeledStatement): Pass the location to the constructor.
4552         (LabeledStatement.HasBeenReferenced): New property.
4553         (LabeledStatement.Resolve): Set it to true here.
4554
4555         * statement.cs (Return.Emit): Return success even after reporting
4556         a type mismatch error (CS0126 or CS0127), this is what csc does and
4557         it avoids confusing the users with any consecutive errors.
4558
4559 2002-08-05  Martin Baulig  <martin@gnome.org>
4560
4561         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4562
4563         * const.cs (Const.LookupConstantValue): Catch circular definitions.
4564
4565         * expression.cs (MemberAccess.DoResolve): Silently return if an
4566         error has already been reported.
4567
4568         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4569         error has already been reported.
4570
4571 2002-08-05  Martin Baulig  <martin@gnome.org>
4572
4573         * statement.cs (UsageVector): Only initialize the `parameters'
4574         vector if we actually have any "out" parameters.
4575
4576 2002-08-05  Martin Baulig  <martin@gnome.org>
4577
4578         * expression.cs (Binary.ResolveOperator): When combining delegates,
4579         they must have the same type.
4580
4581 2002-08-05  Martin Baulig  <martin@gnome.org>
4582
4583         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4584         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4585         work with the ms runtime and we also don't need it: if we're a
4586         PropertyBuilder and not in the `indexer_arguments' hash, then we
4587         are a property and not an indexer.
4588
4589         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4590         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4591         since the latter one doesn't work with the ms runtime.
4592
4593 2002-08-03  Martin Baulig  <martin@gnome.org>
4594
4595         Fixed bugs #27998 and #22735.
4596
4597         * class.cs (Method.IsOperator): New public field.
4598         (Method.CheckBase): Report CS0111 if there's already a method
4599         with the same parameters in the current class.  Report CS0508 when
4600         attempting to change the return type of an inherited method.
4601         (MethodData.Emit): Report CS0179 if a method doesn't have a body
4602         and it's not marked abstract or extern.
4603         (PropertyBase): New abstract base class for Property and Indexer.
4604         (PropertyBase.CheckBase): Moved here from Property and made it work
4605         for indexers.
4606         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4607         the same so we can reuse it there.
4608         (Property, Indexer): Derive from PropertyBase.
4609         (MethodSignature.inheritable_property_signature_filter): New delegate
4610         to find properties and indexers.
4611
4612         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4613         argument and improved error reporting.
4614
4615         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4616         EmptyReadOnlyParameters and made it a property.
4617
4618         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4619         version of this method which takes a `PropertyInfo indexer'.
4620         (TypeManager.RegisterIndexer): New method.
4621
4622         * class.cs: Added myself as author of this file :-)
4623
4624 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4625
4626         * class.cs: fixed compilation on windoze.
4627
4628 2002-08-03  Martin Baulig  <martin@gnome.org>
4629
4630         * interface.cs (Interface.GetInterfaceBases): Check whether all
4631         base interfaces are at least as accessible than the current one.
4632
4633         * class.cs (TypeContainer.GetClassBases): Check whether base types
4634         are at least as accessible than the current type.
4635         (TypeContainer.AsAccessible): Implemented and made non-static.
4636         (MemberBase.CheckParameters): Report errors if the accessibility
4637         checks fail.
4638
4639         * delegate.cs (Delegate.Delegate): The default visibility is
4640         internal for top-level types and private for nested types.
4641         (Delegate.Define): Report errors if the accessibility checks fail.
4642
4643         * enum.cs (Enum.Enum): The default visibility is internal for
4644         top-level types and private for nested types.
4645         (Enum.DefineType): Compute the correct visibility.
4646
4647         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4648         function which takes a `bool is_toplevel' instead of a TypeContainer.
4649
4650         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4651         builtin type.
4652
4653 2002-08-02  Martin Baulig  <martin@gnome.org>
4654
4655         * expression.cs (LocalVariableReferenc): Added constructor which
4656         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4657         (LocalVariableReference.IsReadOnly): New property.
4658         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4659         variable is readonly, use our own readonly flag to do this; you can
4660         use the new constructor to get a writable reference to a read-only
4661         variable.
4662
4663         * cs-parser.jay (foreach_statement, using_statement): Get a writable
4664         reference to the local variable.
4665
4666 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
4667
4668         * rootcontext.cs (ResolveCore): Also include System.Exception
4669
4670         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4671         we reach an EmptyStatement.
4672
4673         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4674         is also fine.
4675
4676         * expression.cs (Binary.ResolveOperator): Check error result in
4677         two places.
4678
4679         use brtrue/brfalse directly and avoid compares to null.
4680
4681 2002-08-02  Martin Baulig  <martin@gnome.org>
4682
4683         * class.cs (TypeContainer.Define): Define all nested interfaces here.
4684         Fixes bug #28407, added test-155.cs.
4685
4686 2002-08-01  Martin Baulig  <martin@gnome.org>
4687
4688         * class.cs (Event.EmitDefaultMethod): Make this work with static
4689         events.  Fixes #28311, added verify-3.cs.
4690
4691 2002-08-01  Martin Baulig  <martin@gnome.org>
4692
4693         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4694         `is_disposable' fields.
4695         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4696         `hm.is_disposable' if we're using the collection pattern.
4697         (Foreach.EmitCollectionForeach): Use the correct type for the
4698         enumerator's local variable, only emit the try/finally block if
4699         necessary (fixes #27713).
4700
4701 2002-08-01  Martin Baulig  <martin@gnome.org>
4702
4703         * ecore.cs (Expression.report118): Renamed to Error118 and made
4704         it public static.
4705
4706         * statement.cs (Throw.Resolve): Check whether the expression is of
4707         the correct type (CS0118) and whether the type derives from
4708         System.Exception (CS0155).
4709         (Catch.Resolve): New method.  Do the type lookup here and check
4710         whether it derives from System.Exception (CS0155).
4711         (Catch.CatchType, Catch.IsGeneral): New public properties.
4712
4713         * typemanager.cs (TypeManager.exception_type): Added.
4714
4715 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
4716
4717         * driver.cs: Updated About function.
4718
4719 2002-07-31  Martin Baulig  <martin@gnome.org>
4720
4721         Implemented Control Flow Analysis.
4722
4723         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4724         (EmitContext.CurrentBranching): Added.
4725         (EmitContext.StartFlowBranching): Added.
4726         (EmitContext.EndFlowBranching): Added.
4727         (EmitContext.KillFlowBranching): Added.
4728         (EmitContext.IsVariableAssigned): Added.
4729         (EmitContext.SetVariableAssigned): Added.
4730         (EmitContext.IsParameterAssigned): Added.
4731         (EmitContext.SetParameterAssigned): Added.
4732         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4733         Added control flow analysis stuff here.
4734
4735         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4736         resolve the expression as lvalue.
4737         (LocalVariableReference.DoResolve): Check whether the variable has
4738         already been assigned.
4739         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4740         the parameter as assigned here.
4741         (ParameterReference.DoResolve): Check whether the parameter has already
4742         been assigned.
4743         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4744         expression as lvalue.
4745
4746         * statement.cs (FlowBranching): New class for the flow analysis code.
4747         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4748         (LabeledStatement.IsDefined): New public property.
4749         (LabeledStatement.AddUsageVector): New public method to tell flow
4750         analyis that the label may be reached via a forward jump.
4751         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4752         flow analysis.
4753         (VariableInfo.Number): New public field.  This is used by flow analysis
4754         to number all locals of a block.
4755         (Block.CountVariables): New public property.  This is the number of
4756         local variables in this block (including the locals from all parent
4757         blocks).
4758         (Block.EmitMeta): Number all the variables.
4759
4760         * statement.cs: Added flow analysis support to all classes.
4761
4762 2002-07-31  Martin Baulig  <martin@gnome.org>
4763
4764         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4765         To get debugging messages, compile mcs with /define:MCS_DEBUG and
4766         then use this argument.
4767
4768         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4769
4770         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4771         use this to specify /define options.
4772
4773 2002-07-29  Martin Baulig  <martin@gnome.org>
4774
4775         * statement.cs (Fixed): Moved all code that does variable lookups
4776         and resolvings from Emit to Resolve.
4777
4778         * statement.cs (For): Moved all code that does variable lookups
4779         and resolvings from Emit to Resolve.
4780
4781         * statement.cs (Using): Moved all code that does variable lookups
4782         and resolvings from Emit to Resolve.
4783
4784 2002-07-29  Martin Baulig  <martin@gnome.org>
4785
4786         * attribute.cs (Attribute.Resolve): Explicitly catch a
4787         System.NullReferenceException when creating the
4788         CustromAttributeBuilder and report a different warning message.
4789
4790 2002-07-29  Martin Baulig  <martin@gnome.org>
4791
4792         * support.cs (ParameterData.ParameterName): Added method to
4793         get the name of a parameter.
4794
4795         * typemanager.cs (TypeManager.IsValueType): New public method.
4796
4797 2002-07-29  Martin Baulig  <martin@gnome.org>
4798
4799         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
4800         is a flag which specifies that it's either ref or out.
4801         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4802         the out parameter to `out Parameter.Modifier mod', also set the
4803         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4804
4805         * support.cs (InternalParameters.ParameterModifier): Distinguish
4806         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4807         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4808
4809         * expression.cs (Argument.GetParameterModifier): Distinguish
4810         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4811         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4812
4813 2002-07-29  Martin Baulig  <martin@gnome.org>
4814
4815         * expression.cs (ParameterReference.ParameterReference): Added
4816         `Location loc' argument to the constructor.
4817
4818         * cs-parser.jay: Pass location to ParameterReference.
4819
4820 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
4821
4822         * statement.cs (Try): Initialize the location.
4823
4824         * cs-parser.jay: pass location to Try.
4825
4826         * expression.cs (Unary.Reduce): Change the prototype to return
4827         whether a constant fold could be performed or not.  The result is
4828         returned in an out parameters.  In the case of Indirection and
4829         AddressOf, we want to perform the full tests.
4830
4831 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
4832
4833         * statement.cs (Statement.Emit): Flag dead code.
4834
4835 2002-07-27  Andrew Birkett  <andy@nobugs.org>
4836
4837         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4838
4839 2002-07-27  Martin Baulig  <martin@gnome.org>
4840
4841         * class.cs (MethodData.Define): Put back call to
4842         TypeManager.AddMethod(), accidentally commented this out.
4843
4844         * report.cs (Debug): New public method to print debugging information,
4845         this is `[Conditional ("DEBUG")]'.
4846
4847 2002-07-26  Martin Baulig  <martin@gnome.org>
4848
4849         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4850         (switch_statement): Push the current_block to the switch_stack and
4851         pop it again when we're done with the switch.
4852         (switch_section): The new block is a child of the current_block.
4853         Fixes bug #24007, added test-152.cs.
4854
4855 2002-07-27  Martin Baulig  <martin@gnome.org>
4856
4857         * expression.cs (Invocation.EmitArguments): When calling a varargs
4858         function with only its fixed arguments, we need to pass an empty
4859         array.
4860
4861 2002-07-27  Martin Baulig  <martin@gnome.org>
4862
4863         Mono 0.13 has been released.
4864
4865 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
4866
4867         * driver.cs: Rename --resource to --linkres, because that is what
4868         we do currently, we dont support --resource yet.
4869
4870         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4871
4872 2002-07-25  Martin Baulig  <martin@gnome.org>
4873
4874         * class.cs (MethodData): New public class.  This is a `method builder'
4875         class for a method or one accessor of a Property/Indexer/Event.
4876         (MethodData.GetMethodFlags): Moved here from MemberBase.
4877         (MethodData.ApplyAttributes): Likewise.
4878         (MethodData.ApplyObsoleteAttribute): Likewise.
4879         (MethodData.ApplyConditionalAttribute): Likewise.
4880         (MethodData.ApplyDllImportAttribute): Likewise.
4881         (MethodData.CheckAbstractAndExternal): Likewise.
4882         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4883         (MethodData.Emit): Formerly known as Method.Emit().
4884         (MemberBase): Moved everything which was specific to a single
4885         accessor/method to MethodData.
4886         (Method): Create a new MethodData and call Define() and Emit() on it.
4887         (Property, Indexer, Event): Create a new MethodData objects for each
4888         accessor and call Define() and Emit() on them.
4889
4890 2002-07-25  Martin Baulig  <martin@gnome.org>
4891
4892         Made MethodCore derive from MemberBase to reuse the code from there.
4893         MemberBase now also checks for attributes.
4894
4895         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4896         (MemberBase.GetMethodFlags): Moved here from class Method and marked
4897         as virtual.
4898         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4899         `CallingConventions cc' and `Attributes opt_attrs' arguments.
4900         (MemberBase.ApplyAttributes): New virtual method; applies the
4901         attributes to a method or accessor.
4902         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4903         (MemberBase.ApplyConditionalAttribute): Likewise.
4904         (MemberBase.ApplyDllImportAttribute): Likewise.
4905         (MemberBase.CheckAbstractAndExternal): Likewise.
4906         (MethodCore.ParameterTypes): This is now a property instead of a
4907         method, it's initialized from DoDefineParameters().
4908         (MethodCore.ParameterInfo): Removed the set accessor.
4909         (MethodCore.DoDefineParameters): New protected virtual method to
4910         initialize ParameterTypes and ParameterInfo.
4911         (Method.GetReturnType): We can now simply return the MemberType.
4912         (Method.GetMethodFlags): Override the MemberBase version and add
4913         the conditional flags.
4914         (Method.CheckBase): Moved some code from Define() here, call
4915         DoDefineParameters() here.
4916         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4917         here to avoid some larger code duplication.
4918         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4919         ensure that abstract and external accessors don't declare a body.
4920
4921         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4922         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4923         lookup in the attribute's parent classes, so we need to abort as soon
4924         as we found the first match.
4925         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4926         the attribute has no arguments.
4927
4928         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4929         of a Method.
4930
4931 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4932
4933         * cs-parser.jay: reverted previous patch.
4934
4935 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4936
4937         * cs-parser.jay: fixed bug #22119.
4938
4939 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4940
4941         * attribute.cs: fixed compilation. The error was:
4942         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
4943         be assigned to before control leaves the current method."
4944         [FIXME:  Filed as bug #28186: MCS must report this error.]
4945
4946 2002-07-25  Martin Baulig  <martin@gnome.org>
4947
4948         * attribute.cs (Attribute.Conditional_GetConditionName): New static
4949         method to pull the condition name ouf of a Conditional attribute.
4950         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4951         the obsolete message and error flag out of an Obsolete attribute.
4952
4953         * class.cs (Method.GetMethodFlags): New public method to get the
4954         TypeManager.MethodFlags for this method.
4955         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4956         private methods.
4957         (Method.Define): Get and apply the Obsolete and Conditional attributes;
4958         if we're overriding a virtual function, set the new private variable
4959         `parent_method'; call the new TypeManager.AddMethod().
4960
4961         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
4962         the MethodBuilder and the Method in a PtrHashtable.
4963         (TypeManager.builder_to_method): Added for this purpose.
4964         (TypeManager.MethodFlags): Added IsObsoleteError.
4965         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
4966         Obsolete and Conditional arguments in MethodBuilders.  If we discover
4967         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4968         the message from the attribute.
4969
4970 2002-07-24  Martin Baulig  <martin@gnome.org>
4971
4972         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4973         preprocessor directives, ensure that the argument to #define/#undef is
4974         exactly one identifier and that it's actually an identifier.
4975
4976         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4977         did not work ....
4978
4979 2002-07-24  Martin Baulig  <martin@gnome.org>
4980
4981         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4982         initialize it to TypeManager.object_type in the constructor.
4983         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4984         of the `hm.get_current' method if we're using the collection pattern.
4985         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
4986         for the explicit conversion to make it work when we're using the collection
4987         pattern and the `Current' property has a different return type than `object'.
4988         Fixes #27713.
4989
4990 2002-07-24  Martin Baulig  <martin@gnome.org>
4991
4992         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
4993         does not match, but don't report any errors.  This method is called in
4994         order for all methods in a MethodGroupExpr until a matching method is
4995         found, so we don't want to bail out if the first method doesn't match.
4996         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
4997         matches, report the 123.  Fixes #28070.
4998
4999 2002-07-24  Martin Baulig  <martin@gnome.org>
5000
5001         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
5002         TypeManager.TypeToCoreType() to the top of the method so the
5003         following equality checks will work.  Fixes #28107.
5004
5005 2002-07-24  Martin Baulig  <martin@gnome.org>
5006
5007         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
5008         operand is of type uint, and the other operand is of type sbyte,
5009         short or int, the operands are converted to type long." -
5010         Actually do what this comment already told us.  Fixes bug #28106,
5011         added test-150.cs.
5012
5013 2002-07-24  Martin Baulig  <martin@gnome.org>
5014
5015         * class.cs (MethodBase): New abstract class.  This is now a base
5016         class for Property, Indexer and Event to avoid some code duplication
5017         in their Define() and DefineMethods() methods.
5018         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
5019         generic methods for Define() and DefineMethods().
5020         (FieldBase): Derive from MemberBase, not MemberCore.
5021         (Property): Derive from MemberBase, not MemberCore.
5022         (Property.DefineMethod): Moved all the code from this method to the
5023         new MethodBase.DefineAccessor(), just call it with appropriate
5024         argumetnts.
5025         (Property.Define): Call the new Property.DoDefine(), this does some
5026         sanity checks and we don't need to duplicate the code everywhere.
5027         (Event): Derive from MemberBase, not MemberCore.
5028         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
5029         accessors, this will also make them work with interface events.
5030         (Indexer): Derive from MemberBase, not MemberCore.
5031         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
5032         (Indexer.Define): Use the new MethodBase functions.
5033
5034         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
5035         argument to the constructor.
5036         (Interface.FindMembers): Added support for interface events.
5037         (Interface.PopluateEvent): Implemented.
5038
5039         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
5040
5041 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
5042
5043         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
5044         but this is required to check for a method name being the same as
5045         the containing class.  
5046
5047         Handle this now.
5048
5049 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5050
5051         * interface.cs: initialize variable.
5052
5053 2002-07-23  Martin Baulig  <martin@gnome.org>
5054
5055         Implemented the IndexerName attribute in interfaces.
5056
5057         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
5058         name if this is an explicit interface implementation.
5059         (Indexer.InterfaceIndexerName): New public variable.  If we're
5060         implementing an interface indexer, this is the IndexerName in that
5061         interface.  Otherwise, it's the IndexerName.
5062         (Indexer.DefineMethod): If we're implementing interface indexer,
5063         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
5064         and Pending.ImplementIndexer methods.
5065         (Indexer.Define): Also define the PropertyBuilder if we're
5066         implementing an interface indexer and this is neither an explicit
5067         interface implementation nor do the IndexerName match the one in
5068         the interface.
5069
5070         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
5071         If a method is defined here, then we always need to create a proxy
5072         for it.  This is used when implementing interface indexers.
5073         (Pending.IsInterfaceIndexer): New public method.
5074         (Pending.ImplementIndexer): New public method.
5075         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
5076         This is used when implementing interface indexers to define a proxy
5077         if necessary.
5078         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
5079         define a proxy if necessary.
5080
5081         * interface.cs (Interface.IndexerName): New public variable.
5082         (Interface.PopulateIndexer): Set the IndexerName.
5083         (Interface.DefineIndexers): New private method.  Populate all the
5084         indexers and make sure their IndexerNames match.
5085
5086         * typemanager.cs (IndexerPropertyName): Added support for interface
5087         indexers.
5088
5089 2002-07-22  Martin Baulig  <martin@gnome.org>
5090
5091         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
5092         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
5093         ret if HasReturnLabel.
5094         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
5095         variables.
5096
5097         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
5098         and set the ec.LoopBeginTryCatchLevel.
5099         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
5100         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5101         the current ec.TryCatchLevel, the branch goes out of an exception
5102         block.  In this case, we need to use Leave and not Br.
5103
5104 2002-07-22  Martin Baulig  <martin@gnome.org>
5105
5106         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5107         block unless the block does not always return or it is contained in
5108         another try { ... } catch { ... } block.  Fixes bug #26506.
5109         Added verify-1.cs to the test suite.
5110
5111 2002-07-22  Martin Baulig  <martin@gnome.org>
5112
5113         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5114         then we do not always return.  Fixes bug #24985.
5115
5116 2002-07-22  Martin Baulig  <martin@gnome.org>
5117
5118         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5119         lookup on a per-class level; ie. walk up the class hierarchy until we
5120         found at least one applicable method, then choose the best among them.
5121         Fixes bug #24463 and test-29.cs.
5122
5123 2002-07-22  Martin Baulig  <martin@gnome.org>
5124
5125         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5126         return types of the methods.  The return type is not part of the
5127         signature and we must not check it to make the `new' modifier work.
5128         Fixes bug #27999, also added test-147.cs.
5129         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5130
5131         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5132         on the method's return type.
5133
5134 2002-07-21  Martin Baulig  <martin@gnome.org>
5135
5136         * assign.cs: Make this work if the rightmost source is a constant and
5137         we need to do an implicit type conversion.  Also adding a few more tests
5138         to test-38.cs which should have caught this.
5139
5140         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5141         target in the makefile for this.  The makefile.gnu is primarily intended
5142         for end-users who don't want to debug the compiler.
5143
5144 2002-07-21  Martin Baulig  <martin@gnome.org>
5145
5146         * assign.cs: Improved the Assign class so it can now handle embedded
5147         assignments (X = Y = Z = something).  As a side-effect this'll now also
5148         consume less local variables.  test-38.cs now passes with MCS, added
5149         a few new test cases to that test.
5150
5151 2002-07-20  Martin Baulig  <martin@gnome.org>
5152
5153         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5154         instructions.  Fixes bug #27977, also added test-146.cs.
5155
5156 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5157
5158         * cs-tokenizer.cs: fixed getHex ().
5159
5160 2002-07-19  Martin Baulig  <martin@gnome.org>
5161
5162         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5163         not Type.GetType() to lookup the array type.  This is needed when
5164         we're constructing an array of a user-defined type.
5165         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5166         single-dimensional arrays, but also for single-dimensial arrays of
5167         type decimal.
5168
5169 2002-07-19  Martin Baulig  <martin@gnome.org>
5170
5171         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5172         this function is called, it's not allowed to share LocalBuilders
5173         among ILGenerators.
5174
5175 2002-07-19  Martin Baulig  <martin@gnome.org>
5176
5177         * expression.cs (Argument.Resolve): Report an error 118 when trying
5178         to pass a type as argument.
5179
5180 2002-07-18  Martin Baulig  <martin@gnome.org>
5181
5182         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5183         Conv_R_Un for the signed `long' type.
5184
5185 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
5186
5187         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5188         `expr' for the temporary result, as that will fail if we do
5189         multiple resolves on the same expression.
5190
5191 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
5192
5193         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
5194         ec.TypeContainer for looking up aliases. 
5195
5196         * class.cs (TypeContainer): Remove LookupAlias from here.
5197
5198         * decl.cs (DeclSpace); Move here.
5199
5200 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
5201
5202         * class.cs (FindMembers): Only call filter if the constructor
5203         bulider is not null.
5204
5205         Also handle delegates in `NestedTypes' now.  Now we will perform
5206         type lookups using the standard resolution process.  This also
5207         fixes a bug.
5208
5209         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
5210         This uses Expressions (the limited kind that can be parsed by the
5211         tree) instead of strings.
5212
5213         * expression.cs (ComposedCast.ToString): Implement, used to flag
5214         errors since now we have to render expressions.
5215
5216         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
5217         FormArrayType. 
5218
5219         * ecore.cs (SimpleName.ToString): ditto.
5220
5221         * cs-parser.jay: Instead of using strings to assemble types, use
5222         Expressions to assemble the type (using SimpleName, ComposedCast,
5223         MemberAccess).  This should fix the type lookups in declarations,
5224         because we were using a different code path for this.
5225
5226         * statement.cs (Block.Resolve): Continue processing statements
5227         even when there is an error.
5228
5229 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
5230
5231         * class.cs (Event.Define): Also remove the `remove' method from
5232         the list of pending items.
5233
5234         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5235         generate more compact code. 
5236
5237 2002-07-17  Martin Baulig  <martin@gnome.org>
5238
5239         * const.cs (Const.LookupConstantValue): Add support for constant
5240         `unchecked' and `checked' expressions.
5241         Also adding test case test-140.cs for this.
5242
5243 2002-07-17  Martin Baulig  <martin@gnome.org>
5244
5245         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5246         check whether mi.ReturnType implements the IEnumerator interface; the
5247         `==' and the IsAssignableFrom() will fail in this situation.
5248
5249 2002-07-16  Ravi Pratap  <ravi@ximian.com>
5250
5251         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
5252         here too.
5253
5254 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5255
5256         * expression.cs: fixed bug #27811.
5257
5258 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
5259
5260         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5261         Molaro: when we are a ref, the value already contains a pointer
5262         value, do not take the address of it.
5263
5264 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5265         * removed mb-parser.jay and mb-tokenizer.cs
5266
5267 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5268
5269         * expression.cs: check against the building corlib void type.
5270
5271 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5272
5273         * ecore.cs: fix for valuetype static readonly fields: when 
5274         initializing them, we need their address, not the address of a copy.
5275
5276 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5277
5278         * typemanager.cs: register also enum_type in corlib.
5279
5280 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5281
5282         * class.cs: allow calling this (but not base) initializers in structs.
5283
5284 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5285
5286         * ecore.cs: make sure we compare against the building base types
5287         in GetTypeSize ().
5288
5289 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5290
5291         * typemanager.cs: fix TypeToCoreType() to handle void and object
5292         (corlib gets no more typerefs after this change).
5293
5294 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
5295
5296         * expression.cs (ArrayCreation.EmitArrayArguments): use
5297         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5298
5299         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5300         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
5301         array indexes, the runtime actually forbids them.
5302
5303         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5304         for array arguments here.
5305
5306         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5307         instead of the default for ValueTypes.
5308
5309         (New.DoEmit): Use IsValueType instead of
5310         IsSubclassOf (value_type)
5311         (New.DoResolve): ditto.
5312         (Invocation.EmitCall): ditto.
5313
5314         * assign.cs (Assign): ditto.
5315
5316         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5317         Statements *are* currently doing part of their resolution during
5318         Emit.  
5319
5320         Expressions do always resolve during resolve, but statements are
5321         only required to propagate resolution to their children.
5322
5323 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
5324
5325         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5326
5327         (LoadAssembly): Do not add the dll if it is already specified
5328         
5329         (MainDriver): Add the System directory to the link path at the end,
5330         after all the other -L arguments. 
5331
5332         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5333         wrong opcode for loading bytes and bools (ldelem.i1 instead of
5334         ldelem.u1) and using the opposite for sbytes.
5335
5336         This fixes Digger, and we can finally run it.
5337
5338         * driver.cs (UnixParseOption): Move the option parsing here.  
5339         (CSCParseOption): Implement CSC-like parsing of options.
5340
5341         We now support both modes of operation, the old Unix way, and the
5342         new CSC-like way.  This should help those who wanted to make cross
5343         platform makefiles.
5344
5345         The only thing broken is that /r:, /reference: and /lib: are not
5346         implemented, because I want to make those have the same semantics
5347         as the CSC compiler has, and kill once and for all the confussion
5348         around this.   Will be doing this tomorrow.
5349
5350         * statement.cs (Unsafe.Resolve): The state is checked during
5351         resolve, not emit, so we have to set the flags for IsUnsfe here.
5352
5353 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5354
5355         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5356         not catch the Error_ObjectRefRequired in SimpleName (as it is
5357         possible to have a class/instance variable name that later gets
5358         deambiguated), we have to check this here.      
5359
5360 2002-07-10  Ravi Pratap  <ravi@ximian.com>
5361
5362         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5363         make static and put into Expression.
5364
5365         (Event.Define): Register the private field of the event with the 
5366         TypeManager so that GetFieldFromEvent can get at it.
5367
5368         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5369         keep track of the private field associated with an event which
5370         has no accessors.
5371
5372         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5373         private field.
5374
5375         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5376         
5377 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5378
5379         * expression.cs (Binary.EmitBranchable): this routine emits the
5380         Binary expression in a branchable context.  This basically means:
5381         we need to branch somewhere, not just get the value on the stack.
5382
5383         This works together with Statement.EmitBoolExpression.
5384
5385         * statement.cs (Statement.EmitBoolExpression): Use
5386         EmitBranchable. 
5387
5388 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
5389
5390         * statement.cs (For): Reduce the number of jumps in loops.
5391
5392         (For): Implement loop inversion for the For statement.
5393
5394         (Break): We can be breaking out of a Try/Catch controlled section
5395         (foreach might have an implicit try/catch clause), so we need to
5396         use Leave instead of Br.
5397
5398         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5399         now).  If the instace expression supports IMemoryLocation, we use
5400         the AddressOf method from the IMemoryLocation to extract the
5401         address instead of emitting the instance.
5402
5403         This showed up with `This', as we were emitting the instance
5404         always (Emit) instead of the Address of This.  Particularly
5405         interesting when This is a value type, as we dont want the Emit
5406         effect (which was to load the object).
5407         
5408 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
5409
5410         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5411
5412         * statement.cs (Checked): Set the CheckedState during the resolve
5413         process too, as the ConvCast operations track the checked state on
5414         the resolve process, and not emit.
5415
5416         * cs-parser.jay (namespace_member_declaration): Flag that we have
5417         found a declaration when we do.  This is used to flag error 1529
5418
5419         * driver.cs: Report ok when we display the help only.
5420
5421 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
5422
5423         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5424
5425 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
5426
5427         * cs-tokenizer.cs (define): We also have to track locally the
5428         defines.  AllDefines is just used for the Conditional Attribute,
5429         but we also need the local defines for the current source code. 
5430
5431 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
5432
5433         * statement.cs (While, For, Do): These loops can exit through a
5434         Break statement, use this information to tell whether the
5435         statement is the last piece of code.
5436
5437         (Break): Flag that we break.
5438
5439         * codegen.cs (EmitContexts): New `Breaks' state variable.
5440
5441 2002-07-03  Martin Baulig  <martin@gnome.org>
5442
5443         * class.cs (TypeContainer.MethodModifiersValid): Allow override
5444         modifiers in method declarations in structs.  Otherwise, you won't
5445         be able to override things like Object.Equals().
5446
5447 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5448
5449         * class.cs (Method, Property, Indexer): Do not allow the public
5450         modifier to be used in explicit interface implementations.
5451
5452         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5453         override modifiers in method declarations in structs
5454
5455 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
5456
5457         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5458         integer or real overflow, report an error
5459
5460 2002-07-02  Martin Baulig  <martin@gnome.org>
5461
5462         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5463         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5464         to tell the runtime about our newly created System.Object and
5465         System.ValueType types.
5466
5467 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5468
5469         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5470         struct instead of Ldarg/Starg.
5471
5472 2002-07-02  Martin Baulig  <martin@gnome.org>
5473
5474         * expression.cs (Indirection.Indirection): Call
5475         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5476
5477 2002-07-02  Martin Baulig  <martin@gnome.org>
5478
5479         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5480         ValueType, call TypeManager.TypeToCoreType() on it.
5481         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5482         the OpCodes.Newarr argument.
5483
5484 2002-07-02  Martin Baulig  <martin@gnome.org>
5485
5486         * expression.cs (Invocation.EmitCall): When compiling corlib,
5487         replace all calls to the system's System.Array type to calls to
5488         the newly created one.
5489
5490         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5491         System.Array methods.
5492         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5493         from the system's System.Array type which must be replaced.
5494
5495 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5496
5497         * typemanager.cs: load unverifiable_code_ctor so we can build
5498         corlib using the correct type. Avoid using GetTypeCode() with
5499         TypeBuilders.
5500         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5501         TypeManager.object_type to allow building corlib.
5502
5503 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5504
5505         * ecore.cs: handle System.Enum separately in LoadFromPtr().
5506
5507 2002-07-01  Martin Baulig  <martin@gnome.org>
5508
5509         * class.cs: Make the last change actually work, we need to check
5510         whether `ifaces != null' to avoid a crash.
5511
5512 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5513
5514         * class.cs: when we build structs without fields that implement
5515         interfaces, we need to add the interfaces separately, since there is
5516         no API to both set the size and add the interfaces at type creation
5517         time.
5518
5519 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5520
5521         * expression.cs: the dimension arguments to the array constructors
5522         need to be converted if they are a long.
5523
5524 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5525
5526         * class.cs: don't emit ldarg.0 if there is no parent constructor
5527         (fixes showstopper for corlib).
5528
5529 2002-06-29  Martin Baulig  <martin@gnome.org>
5530
5531         MCS now compiles corlib on GNU/Linux :-)
5532
5533         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5534         ie. check for MethodImplOptions.InternalCall.
5535
5536         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5537         and TypeManager.attribute_type are null, so we must explicitly check
5538         whether parent is not null to find out whether it's an attribute type.
5539         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5540         and SetBuilder, not only if the property is neither abstract nor external.
5541         This is necessary to set the MethodImplOptions on the accessor methods.
5542         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5543         SetBuilder, see Property.Emit().
5544
5545         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5546         populate "System.Object", "System.ValueType" and "System.Attribute" since
5547         they've already been populated from BootCorlib_PopulateCoreTypes().
5548
5549 2002-06-29  Martin Baulig  <martin@gnome.org>
5550
5551         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5552         is the NullLiteral, we also need to make sure that target_type is not
5553         an enum type.   
5554
5555 2002-06-29  Martin Baulig  <martin@gnome.org>
5556
5557         * rootcontext.cs (RootContext.ResolveCore): We must initialize
5558         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5559         before calling BootstrapCorlib_ResolveDelegate ().
5560
5561 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5562
5563         * statement.cs: fixed build-breaker. All tests passed ok.
5564
5565 2002-06-27  Martin Baulig  <martin@gnome.org>
5566
5567         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5568         for System.Decimal when compiling corlib.
5569
5570 2002-06-27  Martin Baulig  <martin@gnome.org>
5571
5572         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5573         switch blocks which contain nothing but a default clause.
5574
5575 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
5576
5577        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5578
5579 2002-06-27  Martin Baulig  <martin@gnome.org>
5580
5581         * ecore.cs (PropertyExpr.PropertyExpr): Call
5582         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5583
5584         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5585         is already a TypeBuilder.
5586
5587 2002-06-27  Martin Baulig  <martin@gnome.org>
5588
5589         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5590         `target_type == TypeManager.array_type', not IsAssignableFrom() in
5591         the "from an array-type to System.Array" case.  This makes it work
5592         when compiling corlib.
5593
5594 2002-06-27  Martin Baulig  <martin@gnome.org>
5595
5596         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5597         non-static PropertyExpr, set its InstanceExpression.  This makes
5598         the `ICollection.Count' property work in System/Array.cs.
5599
5600 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
5601
5602         * driver.cs: Made error handling more consistent.  Errors now
5603         tracked by Report class, so many methods which used to return int
5604         now return void.  Main() now prints success/failure and 
5605         errors/warnings message.
5606
5607         Renamed '--probe' compiler argument to '--expect-error'.  Removed
5608         the magic number return values (123 and 124).  Now, if the
5609         expected error occurs, the compiler exits with success (exit value
5610         0).  If the compilation completes without seeing that particular
5611         error, the compiler exits with failure (exit value 1).  The
5612         makefile in mcs/errors has been changed to handle the new behaviour.
5613
5614         * report.cs: Made 'expected error' number a property and renamed
5615         it from 'Probe' to 'ExpectedError'.
5616
5617         * genericparser.cs: Removed error handling support, since it is
5618         now all done by Report class.
5619
5620         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5621         class, so parse() no longer returns an int.
5622
5623         * namespace.cs: Use Report.Error instead of GenericParser.error
5624
5625 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
5626
5627         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5628         TypeContainer.AddOperator): At the front of the list put the
5629         explicit implementations, so they get resolved/defined first. 
5630
5631 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
5632
5633         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5634         interface type is implemented by this TypeContainer.  Used during
5635         explicit interface implementation.
5636
5637         (Property.Define, Indexer.Define, Method.Define): Validate that
5638         the given interface in the explicit implementation is one of the
5639         base classes for the containing type.
5640
5641         Also if we are explicitly implementing an interface, but there is
5642         no match in the pending implementation table, report an error.
5643
5644         (Property.Define): Only define the property if we are
5645         not explicitly implementing a property from an interface.  Use the
5646         correct name also for those properties (the same CSC uses,
5647         although that is really not needed).
5648         
5649         (Property.Emit): Do not emit attributes for explicitly implemented
5650         properties, as there is no TypeBuilder.
5651
5652         (Indexer.Emit): ditto.
5653
5654         Hiding then means that we do not really *implement* a pending
5655         implementation, which makes code fail.
5656
5657 2002-06-22  Martin Baulig  <martin@gnome.org>
5658
5659         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5660         the return value of Object.GetType().  [FIXME: we need to do this whenever
5661         we get a type back from the reflection library].
5662
5663 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5664
5665         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5666
5667 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
5668
5669         * attribute.cs: Return null if we can not look up the type.
5670
5671         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5672         the interface types found.
5673
5674         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5675         interface types found.
5676
5677         * typemanager.cs (GetInterfaces): Make this routine returns alll
5678         the interfaces and work around the lame differences between
5679         System.Type and System.Reflection.Emit.TypeBuilder in the results
5680         result for GetInterfaces.
5681         
5682         (ExpandInterfaces): Given an array of interface types, expand and
5683         eliminate repeated ocurrences of an interface.  This expands in
5684         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5685         be IA, IB, IC.
5686         
5687 2002-06-21  Martin Baulig  <martin@gnome.org>
5688
5689         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5690         on System.Enum.
5691
5692 2002-06-21  Martin Baulig  <martin@gnome.org>
5693
5694         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
5695         and called with one of the core types, return the corresponding typebuilder for
5696         that type.
5697
5698         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5699         element type.
5700
5701 2002-06-21  Martin Baulig  <martin@gnome.org>
5702
5703         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5704         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5705         (Expression.ConvertReferenceExplicit): Likewise.
5706
5707         * expression.cs (ElementAccess.DoResolve): Likewise.
5708         (ElementAccess.DoResolveLValue): Likewise.
5709
5710 2002-06-10  Martin Baulig  <martin@gnome.org>
5711
5712         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5713         add the "value" parameter to the parameter list.
5714
5715         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5716         to our caller.
5717
5718 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
5719
5720         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5721         the argument to an int, uint, long or ulong, per the spec.  Also
5722         catch negative constants in array creation.
5723
5724 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5725
5726         * class.cs: do not allow the same interface to appear twice in
5727         the definition list.
5728
5729 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5730
5731         * ecore.cs: don't use ldlen with System.Array.
5732
5733 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5734
5735         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5736
5737 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5738
5739         * modifiers.cs: produce correct field attributes for protected
5740         internal. Easy fix so miguel can work on ther harder stuff:-)
5741
5742 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
5743
5744         * pending.cs: New file.  Move the code from class.cs here.
5745         Support clearning the pending flag for all methods (when not doing
5746         explicit interface implementation).
5747
5748 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5749
5750         * rootcontext.cs: added a couple more types needed to bootstrap.
5751
5752 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
5753
5754         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5755         constructor in the type, instead of any constructor in the type
5756         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
5757         a bug in the Mono runtime when applying the params attribute). 
5758
5759 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
5760         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5761
5762 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
5763
5764         * expression.cs (Unary.ResolveOperator): Use TypeManager
5765         to resolve the type.
5766         
5767 2002-06-13  Ravi Pratap  <ravi@ximian.com>
5768
5769         * cs-parser.jay (enum_member_declaration): Pass in the attributes
5770         attached.
5771
5772         * enum.cs (AddEnumMember): Add support to store the attributes associated 
5773         with each member too.
5774
5775         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5776         field builders too - this takes care of the enum member case.
5777
5778 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
5779
5780         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5781         address-of operator on both value types and pointers.
5782         
5783 2002-06-10  Martin Baulig  <martin@gnome.org>
5784
5785         * interface.cs (Interface.PopulateIndexer): Add the indexer's
5786         PropertyBuilder to the `property_builders' list.
5787
5788         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5789         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5790         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
5791         find any indexers which are inherited from an interface.
5792
5793 2002-06-09  Martin Baulig  <martin@gnome.org>
5794
5795         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5796         the same type as the constant if necessary.  There's also a test-130.cs
5797         for this.
5798
5799         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5800
5801         * typemanager.cs (TypeManager.ChangeType): Previously known as
5802         Enum.ChangeEnumType().
5803
5804 2002-06-09  Martin Baulig  <martin@gnome.org>
5805
5806         * expression.cs (Cast.TryReduce): Added support for consts.
5807
5808 2002-06-08  Ravi Pratap  <ravi@ximian.com>
5809
5810         * class.cs (Accessor): Hold attributes information so we can pass
5811         it along.
5812
5813         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5814         Modify to pass in attributes attached to the methods.
5815
5816         (add_accessor_declaration, remove_accessor_declaration): Ditto.
5817
5818         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5819         to handle the Accessor kind :-)
5820
5821         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5822         
5823 2002-06-08  Martin Baulig  <martin@gnome.org>
5824
5825         * expression.cs (Unary.TryReduceNegative): Added support for
5826         ULongConstants.
5827
5828 2002-06-08  Martin Baulig  <martin@gnome.org>
5829
5830         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5831         name can't be found in the `defined_names' - the caller will do a
5832         MemberLookup in this case and thus find methods in System.Enum
5833         such as Enum.IsDefined().
5834
5835 2002-06-08  Martin Baulig  <martin@gnome.org>
5836
5837         * enum.cs (Enum.ChangeEnumType): This is a custom version of
5838         Convert.ChangeType() which works with TypeBuilder created types.
5839         (Enum.LookupEnumValue, Enum.Define): Use it here.
5840
5841         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5842         `TypeBuilder.BaseType != null' check.
5843         (TypeContainer.FindMembers): Only lookup parent members if we
5844         actually have a parent.
5845         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5846         (ConstructorInitializer.Resolve): Likewise.
5847
5848         * interface.cs (Interface.FindMembers): Added
5849         `TypeBuilder.BaseType != null' check.
5850
5851         * rootcontext.cs (RootContext.ResolveCore): Added
5852         "System.Runtime.CompilerServices.IndexerNameAttribute" to
5853         classes_second_stage.
5854
5855         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5856         debug_type and trace_type when compiling with --nostdlib.       
5857
5858 2002-06-07  Martin Baulig  <martin@gnome.org>
5859
5860         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5861         (AddField): Set it to true when adding a non-static field.
5862         (DefineType): Use `have_nonstatic_fields' to find out whether we
5863         have non-static fields, not `Fields != null'.
5864
5865 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
5866
5867         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5868         dereferencing a null on the static-field code path)
5869
5870 2002-05-30  Martin Baulig  <martin@gnome.org>
5871
5872         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5873         to take command line arguments.  Use reflection to call the new
5874         custom `Initialize' function on the symbol writer and pass it the
5875         command line arguments.
5876
5877         * driver.cs (--debug-args): New command line argument to pass command
5878         line arguments to the symbol writer.
5879
5880 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
5881
5882         * assign.cs (DoResolve): Forgot to do the implicit conversion to
5883         the target type for indexers and properties.  Thanks to Joe for
5884         catching this.
5885
5886 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
5887
5888         * typemanager.cs (MethodFlags): returns the method flags
5889         (Obsolete/ShouldIgnore) that control warning emission and whether
5890         the invocation should be made, or ignored. 
5891
5892         * expression.cs (Invocation.Emit): Remove previous hack, we should
5893         not do this on matching a base type, we should do this based on an attribute
5894
5895         Only emit calls to System.Diagnostics.Debug and
5896         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5897         on the command line.
5898
5899         * rootcontext.cs: Global settings for tracing and debugging.
5900
5901         * cs-tokenizer.cs (define): New utility function to track
5902         defines.   Set the global settings for TRACE and DEBUG if found.
5903
5904 2002-05-25  Ravi Pratap  <ravi@ximian.com>
5905
5906         * interface.cs (Populate*): Pass in the TypeContainer as well as
5907         the DeclSpace as parameters so that we can create EmitContexts and
5908         then use that to apply attributes etc.
5909
5910         (PopulateMethod, PopulateEvent, PopulateProperty)
5911         (PopulateIndexer): Apply attributes everywhere.
5912
5913         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5914         etc.
5915
5916         (ApplyAttributes): Update accordingly.
5917
5918         We now apply interface attributes for all members too.
5919
5920 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
5921
5922         * class.cs (Indexer.Define); Correctly check if we are explicit
5923         implementation (instead of checking the Name for a ".", we
5924         directly look up if the InterfaceType was specified).
5925
5926         Delay the creation of the PropertyBuilder.
5927
5928         Only create the PropertyBuilder if we are not an explicit
5929         interface implementation.   This means that explicit interface
5930         implementation members do not participate in regular function
5931         lookups, and hence fixes another major ambiguity problem in
5932         overload resolution (that was the visible effect).
5933
5934         (DefineMethod): Return whether we are doing an interface
5935         implementation. 
5936         
5937         * typemanager.cs: Temporary hack until we get attributes in
5938         interfaces (Ravi is working on that) and we get IndexerName
5939         support in interfaces.
5940
5941         * interface.cs: Register the indexers as properties.
5942
5943         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5944         warning, I have verified that this is a bug in the .NET runtime
5945         (JavaScript suffers of the same problem).
5946
5947         * typemanager.cs (MemberLookup): When looking up members for
5948         interfaces, the parent of an interface is the implicit
5949         System.Object (so we succeed in searches of Object methods in an
5950         interface method invocation.  Example:  IEnumerable x;  x.ToString
5951         ()) 
5952
5953 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
5954
5955         * class.cs (Event): Events should also register if they do
5956         implement the methods that an interface requires.
5957
5958         * typemanager.cs (MemberLookup); use the new GetInterfaces
5959         method. 
5960
5961         (GetInterfaces): The code used to lookup interfaces for a type is
5962         used in more than one place, factor it here. 
5963
5964         * driver.cs: Track the errors at the bottom of the file, we kept
5965         on going.
5966
5967         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5968         instance if the method we are calling is static!
5969
5970 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
5971
5972         * attribute.cs (ApplyAttributes): Make this function filter out
5973         the IndexerName attribute (as that attribute in reality is never
5974         applied) and return the string constant for the IndexerName
5975         attribute. 
5976
5977         * class.cs (TypeContainer.Emit): Validate that all the indexers
5978         have the same IndexerName attribute, and if so, set the
5979         DefaultName attribute on the class. 
5980
5981         * typemanager.cs: The return value might contain other stuff (not
5982         only methods).  For instance, consider a method with an "Item"
5983         property and an Item method.
5984
5985         * class.cs: If there is a problem with the parameter types,
5986         return. 
5987
5988 2002-05-24  Ravi Pratap  <ravi@ximian.com>
5989
5990         * ecore.cs (ImplicitConversionExists): Wrapper function which also
5991         looks at user defined conversion after making a call to 
5992         StandardConversionExists - we need this for overload resolution.
5993
5994         * expression.cs : Update accordingly the various method calls.
5995
5996         This fixes 2 bugs filed against implicit user defined conversions 
5997
5998 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
5999
6000         * statement.cs: Track the result of the assignment.
6001
6002 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
6003
6004         * expression.cs (MemberAccess): Improved error reporting for
6005         inaccessible members.
6006
6007 2002-05-22  Martin Baulig  <martin@gnome.org>
6008
6009         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
6010         itself with debugging support.
6011
6012 2002-05-22  Martin Baulig  <martin@gnome.org>
6013
6014         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
6015         Removed, this isn't needed anymore.
6016
6017 2002-05-20  Martin Baulig  <martin@gnome.org>
6018
6019         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
6020         be underlying type for an enum.
6021
6022 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
6023
6024         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
6025         that splits out the loading of just the core types.
6026
6027         * rootcontext.cs (ResolveCore): Split the struct resolution in
6028         two, so we can load the enumeration underlying types before any
6029         enums are used.
6030
6031         * expression.cs (Is): Bandaid until we fix properly Switch (see
6032         bug #24985 for details).
6033
6034         * typemanager.cs (ImplementsInterface): The hashtable will contain
6035         a null if there are no interfaces implemented.
6036
6037 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
6038
6039         * cs-parser.jay (indexer_declarator): It is fine to have array
6040         parameters
6041
6042 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6043
6044         * typemanager.cs: (RegisterBuilder): New function used to register
6045         TypeBuilders that implement interfaces.  Since
6046         TypeBuilder.GetInterfaces (as usual) does not work with lame
6047         Reflection.Emit. 
6048         (AddUserType): register interfaces.
6049
6050         (ImplementsInterface): Use the builder_to_ifaces hash if we are
6051         dealing with TypeBuilder.  Also, arrays are showing up as
6052         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
6053         methods can not be invoked on them!
6054
6055         * ecore.cs (ExplicitReferenceConversionExists): Made public.
6056         (ImplicitReferenceConversionExists): Split out from
6057         StandardConversionExists. 
6058
6059         * expression.cs (As): We were only implementing one of the three
6060         cases for the as operator.  We now implement them all.
6061         (Is): Implement the various other cases for Is as well.
6062
6063         * typemanager.cs (CACHE): New define used to control if we want or
6064         not the FindMembers cache.  Seems to have a negative impact on
6065         performance currently
6066
6067         (MemberLookup): Nested types have full acess to
6068         enclosing type members
6069
6070         Remove code that coped with instance/static returns for events, we
6071         now catch this in RealFindMembers.
6072
6073         (RealFindMembers): only perform static lookup if the instance
6074         lookup did not return a type or an event.  
6075
6076 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6077
6078         * assign.cs (CompoundAssign): We pass more semantic information
6079         now to Compound Assignments than we did before: now we have all
6080         the information at hand, and now we resolve the target *before* we
6081         do the expression expansion, which allows the "CacheValue" method
6082         to have the effect we intended (before, a [x] += 1 would generate
6083         two differen ArrayAccess expressions from the ElementAccess,
6084         during the resolution process).
6085
6086         (CompoundAssign.DoResolve): Resolve target and original_source here.
6087
6088 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
6089
6090         * expression.cs (ArrayAccess): dropped debugging information. 
6091
6092         * typemanager.cs: Small bug fix: I was always returning i_members,
6093         instead of one of i_members or s_members (depending on which had
6094         the content).
6095
6096         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
6097         method is invoked before any code generation takes place, and it
6098         is a mechanism to inform that the expression will be invoked more
6099         than once, and that the method should use temporary values to
6100         avoid having side effects
6101
6102         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6103         
6104         * ecore.cs (Expression.CacheTemporaries): Provide empty default
6105         implementation.
6106
6107         * expression.cs (Indirection, ArrayAccess): Add support for
6108         CacheTemporaries in these two bad boys. 
6109
6110         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6111         ldobj or ldind_ref.  
6112         (StoreFromPtr): Handle stobj as well.
6113
6114         * expression.cs (UnaryMutator): Share more code.
6115         
6116         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6117         down: I was not tracking the Filter function as well, which
6118         was affecting the results of the cache.
6119
6120 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
6121
6122         * attribute.cs: Remove the hack to handle the CharSet property on
6123         StructLayouts. 
6124
6125 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
6126
6127         * attribute.cs (DoResolve): More uglyness, we now only try to
6128         resolve the attribute partially, to extract the CharSet
6129         information (only if we are a StructLayout attribute).  Otherwise 
6130
6131         (GetExtraTypeInfo): Add some code to conditionally kill in the
6132         future this.   I am more and more convinced that the .NET
6133         framework has special code to handle the attribute setting on
6134         certain elements.
6135
6136         * expression.cs (IsParamsMethodApplicable): Revert my previous
6137         foreach change here, it was wrong.
6138
6139 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
6140
6141         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6142         (pp_expr): do not abort on unknown input, just return.
6143         (eval): abort if there are pending chars.
6144
6145         * attribute.cs (Attribute.Resolve): Positional parameters are
6146         optional.  Deal with that case.
6147
6148         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6149         the Ansi/Unicode/Auto information for the type.
6150
6151         (TypeContainer.DefineType): instantiate the EmitContext here, as
6152         we will be using it during the type definition (to resolve
6153         attributes) and during the emit phase.
6154
6155         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6156         to pull type information out of the attributes
6157
6158         (Attribute.Resolve): track the constructor builder, and allow for
6159         multiple invocations (structs and classes will use this).
6160
6161         * ecore.cs (MemberLookupFinal): new version with all the
6162         parameters customizable.
6163
6164         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6165         constructors.  Return if the result value is null (as the error
6166         would have been flagged already by MemberLookupFinal)
6167
6168         Do not allow instances of abstract classes or interfaces to be
6169         created.
6170         
6171         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6172         We have to compare the assembly property here when dealing with
6173         FamANDAssem and Assembly access modifiers, because we might be
6174         creating an assembly from *modules* (that means that we are not
6175         getting TypeBuilders for types defined in other modules that are
6176         part of this assembly).
6177
6178         (Method.Emit): If the method is marked abstract and has a body,
6179         emit an error. 
6180
6181         (TypeContainer.DefineMembers): If both the defined member and the
6182         parent name match are methods, then do not emit any warnings: let
6183         the Method.Define routine take care of flagging warnings.  But if
6184         there is a mismatch (method overrides something else, or method is
6185         overriwritten by something, then emit warning).
6186
6187         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6188         set to null, this means `do not check for the return type on the
6189         signature'. 
6190
6191         (Method.Define): set the return type for the method signature to
6192         null, so that we get methods with the same name and parameters and
6193         different return types.  This is used to flag warning 114 (you are
6194         hiding a method, and you probably want to use the new/override
6195         keywords instead).
6196
6197         * typemanager.cs (MemberLookup): Implemented proper access
6198         control, closing a long standing set of bug reports.  The problem
6199         was that the Framework only has two bits: Public and NonPublic,
6200         and NonPublic includes private and protected methods, but we need
6201         to enforce the FamANDAssem, FamOrAssem and Family. 
6202
6203 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
6204
6205         * statement.cs (GotoCase): Return true: Ammounts to giving up
6206         knowledge on whether we return or not, and letting the other case
6207         be responsible for it.
6208
6209 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
6210
6211         * driver.cs: Do not load directories for each file processed, only
6212         do it if there is a pattern.
6213
6214         * ecore.cs: Report readonly assigns here as well, as we might have
6215         been resolved only by MemberAccess.
6216
6217         (SimpleName.SimpleNameResolve): Also be useful for LValue
6218         resolution.   We need this to propagate assign to local readonly variables
6219
6220         * typemanager.cs: Use a ptrhashtable for the criteria, because we
6221         do not want to reuse potential criteria memory.
6222
6223         * class.cs (MyEventBuilder): Set reflected_type;
6224
6225         * ecore.cs (Constantify): Added support for constifying bools.
6226
6227         (RootContext.LookupType): Added a cache for values looked up in
6228         the declaration space.
6229
6230         * typemanager.cs (FindMembers): Now is a front-end to
6231         RealFindMembers, and provides a two-level hashtable-based cache to
6232         the request.  
6233
6234         15% performance improvement: from 22.5 to 19.2 seconds.
6235
6236         * expression.cs (IsParamsMethodApplicable): use foreach.
6237         (Invocation.DoResolve): ditto.
6238         (New.DoResolve): ditto.
6239         (ArrayCreation.DoResolve): ditto.
6240
6241         * ecore.cs (FindMostEncompassingType): use foreach.
6242
6243         * delegate.cs (NewDelegate.DoResolve): Use foreach
6244
6245         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6246         (RemoveMethods): use foreach.
6247
6248         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6249         nested foreach statements instead of for, and also break out of
6250         the inner loop once a match is found.
6251         
6252         (Invocation.OverloadResolve): Use foreach, simplify the code. 
6253
6254 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
6255
6256         * cfold.cs (BinaryFold): During an enumeration evaluation context,
6257         we actually unwrap the expression to allow for extra information
6258         to be extracted. 
6259
6260         * expression.cs: Use Shr_Un on unsigned operations. 
6261
6262 2002-05-08  Ravi Pratap  <ravi@ximian.com>
6263
6264         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
6265         applicable operators was not being considered correctly. This closes
6266         the bug Miguel reported.
6267
6268 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6269
6270         * attribute.cs: check that the type derives from System.Attribute
6271         and report the correct error in that case (moved the duplicate code to
6272         its own method, too).
6273
6274 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6275
6276         * attribute.cs: lookup attribute type name as the spec says: first the
6277         bare attribute name and then name + "Attribute" (nant compiles with
6278         mcs after this fix).
6279
6280 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
6281
6282         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
6283         Because of the way we parse things, we should try to see if a
6284         UIntConstant can fit in an integer.
6285
6286 2002-05-07  Ravi Pratap  <ravi@ximian.com>
6287
6288         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6289         when we are in an explicit context.
6290
6291         (ConvertReferenceExplicit): When converting from Iface type S to Class
6292         T make sure the rules are implemented as an OR.
6293
6294         * parameter.cs (ParameterType): Make it a property for now although the
6295         purpose really isn't anything immediate.
6296         
6297         * expression.cs (Is*Applicable): Do better checking on the parameter type
6298         of a ref/out parameter. The ones from the system assemblies are already 
6299         marked with the correct type so we don't need to do any correction.
6300
6301         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
6302         the object type is standard too so include that.
6303
6304 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6305
6306         * ecore.cs (StandardConversionExists): Augment with missing code:
6307         deal with IntConstant, LongConstants and Enumerations.
6308
6309         * assign.cs: Report the error, instead of failing silently
6310
6311         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6312         typecontainer that they are declared, because the
6313         typecontainer/namespace will have the list of using clauses that
6314         need to be applied.
6315
6316         Assembly Attributes were escaping the normal registration
6317         mechanism. 
6318
6319         (EmitCode): Apply attributes within an EmitContext that represents
6320         the container they were declared on.
6321         
6322         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
6323
6324 2002-05-06  Ravi Pratap  <ravi@ximian.com>
6325
6326         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6327         Revamp completely - make much cleaner as we now operate only
6328         on a set of Types.
6329
6330         (FindMostSpecificSource, FindMostSpecificTarget): New methods
6331         to implement the logic detailed in the spec more correctly.
6332
6333         (UserDefinedConversion): Update accordingly.
6334
6335 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6336
6337         * statement.cs: Return flow analysis information up.
6338
6339         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6340         and the default.
6341
6342         (token): Do not consume an extra character before calling
6343         decimal_digits.
6344
6345 2002-05-06  Piers Haken <piersh@friskit.com>
6346
6347         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6348
6349 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6350
6351         * class.cs (Constructor.Emit): Set the IsStatic flag in the
6352         EmitContext during the instance constructor initializer
6353         resolution, to stop access to instance variables.
6354
6355         This is mandated by the spec, last paragraph of the `constructor
6356         initializers' section. 
6357
6358 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
6359
6360         * cs-parser.jay, class.cs (Accessor): new class used to represent
6361         an accessor (get or set).  In the past we used `null' to represent
6362         a missing accessor.  But this is ambiguous because there was no
6363         way to tell in abstract indexers/properties if one of them was
6364         specified.
6365
6366         Now there is a way of addressing that.
6367
6368         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6369         instead of FindMembers.
6370
6371         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6372         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6373
6374         * attribute.cs: Treat indexers and properties as the same in terms
6375         of applying attributes
6376
6377         * ecore.cs (FindMostEncompassedType): Use statically initialized
6378         EmptyExpressions()s like we do elsewhere to avoid creating useless
6379         objects (and we take this out of the tight loop).
6380
6381         (GetConversionOperators): Move the code to extract the actual
6382         operators to a separate routine to clean things up.
6383
6384 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
6385
6386         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6387         events are always registered FieldBuilders.
6388         
6389         * class.cs (FieldBase): New class shared by Fields 
6390
6391         * delegate.cs: If we are a toplevel delegate, use our full name.
6392         If we are a nested delegate, then only use our tail name.
6393
6394 2002-05-02  Ravi Pratap  <ravi@ximian.com>
6395
6396         * expression.cs (IsApplicable): Ensure that we add the "&" to
6397         ref/out types before comparing it with the type of the argument.
6398
6399         (IsParamsMethodApplicable): Ditto.
6400
6401         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
6402         silly me ;-)
6403
6404         * delegate.cs : Handle the case when we have more than one applicable
6405         method. Flag an error only when we finish checking all.
6406
6407 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
6408
6409         * expression.cs: Add support for boolean static initializers.
6410
6411 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
6412
6413         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6414
6415         * parameter.cs (ComputeParameterTypes,
6416         ComputeAndDefineParameterTypes): Better error handling: now we
6417         clear the `types' cache if we fail during any of the type lookups.
6418         We also return the status code correctly to our caller
6419
6420         * delegate.cs: If we fail to define a delegate, abort the extra
6421         steps. 
6422
6423         * expression.cs (Binary.ResolveOperator): for
6424         operator==(object,object) and operator !=(object, object) we also
6425         have to verify that there is an implicit conversion from one to
6426         the other.
6427
6428         (ArrayAccess.DoResolve): Array Access can operate on
6429         non-variables. 
6430
6431 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
6432
6433         * assign.cs (CompoundAssign): A new class used as a "flag" that
6434         the assignment actually is happening as part of a compound
6435         assignment operator.
6436
6437         During compound assignment, a few new rules exist to enable things
6438         like:
6439
6440         byte b |= 1 + 2
6441
6442         From the spec:
6443         
6444         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6445         to the type of x) if y is implicitly convertible to the type of x,
6446         and the operator is a builtin operator and the return type of the
6447         operator is explicitly convertible to the type of x. 
6448
6449         * rootcontext.cs: Reset warning level to 2.  4 catches various
6450         "interesting" features in mcs, we must clean this up at some
6451         point, but currently am trying to kill other bugs ;-)
6452
6453         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6454         in container classes as well.  
6455
6456         * expression.cs (Binary.ResolveOperator): Handle string case
6457         before anything else (as operator overloading does emit an error
6458         before doing anything else).
6459
6460         This code could go away when we move to a table driven model, but
6461         i could not come up with a good plan last night.
6462         
6463 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
6464
6465         * typemanager.cs (CSharpName): reimplementation using regex.
6466         * class.cs: added null check for fields in Emit
6467         * rootcontext.cs: set warninglevel to 4
6468
6469 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
6470
6471         * typemanager.cs (CSharpName): reimplemented with Lupus
6472         suggestion.
6473
6474 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
6475
6476         * statement.cs (If): correclty implement Resolve, because we were
6477         not catching sem errors in there.  The same process is needed
6478         everywhere else. 
6479         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6480         
6481
6482         (Statement.Warning_DeadCodeFound): Factorize code.
6483         (While): Report dead code here too.
6484
6485         (Statement): Added Resolve virtual method to allow
6486         for resolution split from the emit code.
6487
6488 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6489
6490         * statement.cs (EmitBoolExpression): No longer try to resolve the
6491         expression here.    
6492         (MakeBoolean): New utility function that resolve, implicitly
6493         converts to boolean and tags the expression. 
6494         
6495
6496         (If, Do): Implement dead code elimination.
6497         (While): Implement loop inversion
6498
6499         (Do, While, For, If): Resolve the expression prior to calling our
6500         code generation.
6501
6502 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
6503
6504         * class.cs:
6505           - added method Report28 (warning: program has more than one entry point)
6506           - added method IsEntryPoint, implements paragraph 10.1 of the spec
6507           - modified method Method.Define, the part at the end of the method
6508
6509         * rootcontext.cs: added static public Location EntryPointLocation;
6510           
6511         * ../errors/cs0028.cs : Add test case for the above warning.              
6512
6513         * typemanager.cs:
6514           - modified method CSharpName to allow arrays of primitive type to
6515             be printed nicely (e.g. instead of System.Int32[][] it now prints
6516             int[][])
6517           - added method CSharpSignature: returns the signature of a method
6518             in string format to be used in reporting errors, warnings, etc.
6519
6520         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6521         with String.Empty.
6522         
6523 2002-04-26  Ravi Pratap  <ravi@ximian.com>
6524
6525         * delegate.cs (Define): Fix extremely silly bug where I was
6526         setting the type of the 'object' parameter of the BeginInvoke
6527         method to System.IAsyncResult instead of System.Object ;-)
6528
6529 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6530
6531         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6532         here. 
6533
6534         (Constructor.Emit): return if we fail to initialize the
6535         constructor.  Another door closed!  
6536
6537         * expression.cs (New.DoResolve): Improve error message (from -6 to
6538         1501).  Use DeclaredOnly lookup to find the exact constructor.
6539
6540         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6541         loop.  This is useful.
6542
6543         * cs-parser.jay: Adjust the default parameters so that destructors
6544         have the proper signature.
6545
6546 2002-04-26  Martin Baulig  <martin@gnome.org>
6547
6548         * driver.cs (LoadAssembly): If `assembly' contains any characters
6549         which are only valid in path names and not in assembly names
6550         (currently slash, backslash and point), use Assembly.LoadFrom ()
6551         instead of Assembly.Load () on the `assembly' (before iteration
6552         over the link_paths).
6553
6554 2002-04-26  Martin Baulig  <martin@gnome.org>
6555
6556         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6557
6558 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
6559
6560         * class.cs (Property): use the new typemanager.MemberLookup
6561
6562         (TypeContainer.MemberLookup): Implement using the
6563         TypeManager.MemberLookup now. 
6564         
6565         * typemanager.cs: Make MemberLookup a function of the TypeManager,
6566         and return MemberInfos, so that these can be used without an
6567         EmitContext (what we had before).
6568
6569 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
6570
6571         * expression.cs: Fix the case where the argument to params if the
6572         type of the params.  I omitted handling this before.   Fixed
6573
6574 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6575
6576         * driver.cs: Call BootCorlib_PopulateCoreType
6577
6578         * class.cs (Property.CheckBase): Check for properties only, not
6579         for all members. 
6580
6581         * interface.cs: Temporary hack: try/catch around the
6582         CustomAttributeBuilder, because I am getting an exception that I
6583         do not understand.
6584
6585         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6586         types whose definitions are required to be there (attributes are
6587         defined before standard types).
6588
6589         Compute definitions as we boot the various types, as they are used
6590         immediately (value_type class will need object_type, but if we do
6591         not initialize object_type, we will pass a null, which will let
6592         the runtime pick the System.Object from the existing corlib, which
6593         is not what we want).
6594
6595 2002-04-22  Patrik Torstensson <totte@labs2.com>
6596
6597         * cs-tokenizer.cs: fixed a number of trim() issues.
6598
6599 2002-04-22  Ravi Pratap  <ravi@ximian.com>
6600
6601         * expression.cs (Argument.Type): Ensure that we return the correct
6602         type when we have out or ref parameters [in which case we 
6603         append a "&"].
6604         
6605 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6606
6607         * class.cs (Property, Indexer): Allow extern modifier in there. 
6608
6609         * typemanager.cs (InitBaseTypes): Initializes object_type and
6610         value_type, since those will be used early on during the bootstrap
6611         process to compile corlib.
6612
6613         (InitCoreTypes): Move code from here to InitBaseTypes.
6614
6615 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
6616
6617         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6618         single-dimension arrays as using the ldlen opcode.  
6619
6620         Daniel Lewis discovered this optimization.  
6621
6622         * typemanager.cs: Add signature for System.Array::get_Length
6623
6624 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6625
6626         * statement.cs: report the error when the foreach does not apply to an
6627         array nor a collection.
6628
6629 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
6630
6631         * expression.cs: Add implicit conversions to the operator ~.
6632
6633         * constant.cs (DecimalConstant.Emit): Emit decimal value.
6634
6635         * typemanager.cs: Locate the decimal constructor.
6636
6637 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6638
6639         * attribute.cs: use the new property of TypeOf.
6640         * expression.cs: added 'get' property around typearg.
6641
6642         These changes fix a build breaker reported by NickD. Is this the
6643         correct way to fix?  If not, please, revert my changes and make it
6644         work :-).
6645
6646 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
6647
6648         * attribute.cs: Add support for typeof in attribute invocations.
6649         I am not sure that this is right though.
6650
6651 2002-04-14  Duncan Mak  <duncan@ximian.com>
6652
6653         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6654         Binary.Operator.Division case.
6655
6656 2002-04-13  Ravi Pratap  <ravi@ximian.com>
6657
6658         * class.cs (DefineType): Ensure that we do a proper check on
6659         attribute types and also register it with the TypeManager.
6660
6661         (TypeContainer.Targets): The default for attribute types is
6662         AttributeTargets.All.
6663         
6664         * attribute.cs (ApplyAttributes): Registering the attribute type
6665         is done elsewhere, not when we discover we have a Usage attribute.
6666
6667 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6668
6669         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6670         and get rid of is_delegate parameter.
6671
6672         * everywhere : update.
6673         
6674 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6675
6676         * cs-parser.jay (compilation_unit): Revamp completely to use
6677         some new ideas that I got from Rhys' grammar to solve the problems
6678         with assembly level attributes.
6679
6680         (outer_declaration): New grammar production.
6681
6682         (attribute_sections): Add.
6683
6684         (opt_attributes): Base on attribute_sections
6685
6686         (namespace_declaration): Allow opt_attributes to tackle the case
6687         when we have assembly level attributes - we are clever in this
6688         regard now ;-)
6689
6690         * attribute.cs (ApplyAttributes): Do not worry about assembly 
6691         attributes in the non-global context.
6692
6693         * rootcontext.cs (AddGlobalAttributes): Go back to using this
6694         instead of SetGlobalAttributes.
6695
6696         * class.cs, rootcontext.cs : Ensure we define and generate 
6697         attribute types before anything else.
6698
6699         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6700         and flag the new error -20 for the case when the attribute type
6701         does not have valid targets specified. csc does not catch this.
6702
6703         * ../errors/errors.txt : update for error # -20
6704
6705 2002-04-11  Ravi Pratap  <ravi@ximian.com>
6706
6707         * support.cs (InternalParameters.ParameterModifier): Do some null
6708         checking and return sane values.
6709
6710         * class.cs (Method.Define): If we are a PInvoke method, ensure
6711         that we are static and extern. Report error # 601
6712
6713         * ../errors/cs0601.cs : Add test case for the above error.
6714
6715 2002-04-07  Ravi Pratap  <ravi@ximian.com>
6716
6717         * rootcontext.cs (attribute_types): We need to keep type of
6718         all attribute types separately and emit code for them first.
6719
6720         (RegisterAttribute) : Implement.
6721
6722         * class.cs (DefineType): Check if the current Type is a custom
6723         attribute type and register it accordingly.
6724
6725         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6726         adding the first attribute twice and rename to
6727
6728         (SetGlobalAttributes): this.
6729
6730         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6731         lookups.
6732
6733         * attribute.cs (ApplyAttributes): Take an additional argument telling us
6734         if we are processing global arguments. Hmm, I am unsure of this.
6735
6736 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6737
6738         * expression.cs: added static array of strings to avoid calling
6739         Enum.ToString () for Operator in Binary. Significant recover of
6740         performance.
6741
6742 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
6743
6744         * class.cs (FindMembers): Allow the Builders of the various
6745         members to be null.  If they are skip them.  This only happens
6746         during the PInvoke declaration.
6747
6748 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
6749
6750         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6751         failure, so we do not keep going afterwards.
6752
6753         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6754         wanted to pass `false' as the `is_delegate' argument.  If this is
6755         the case, why not use delegate_type == null to mean `is_delegate =
6756         false' and anything else as is_delegate = true.
6757
6758 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
6759
6760         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6761         code for the section, not the beginning of the tests.
6762
6763 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
6764
6765         * cfold.cs: Handle operator + (Enum x, Underlying x) 
6766
6767         * expression.cs (Binary): same.  Warn about errors where we have
6768         Enum/Enum in operator + as well.
6769
6770 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
6771
6772         * statement.cs:
6773                 - added support for switch(bool)
6774                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6775                 - add TableSwitchEmit() to handle table-based switch statements
6776
6777 2002-04-05  Ravi Pratap  <ravi@ximian.com>
6778
6779         * expression.cs (Invocation.OverloadResolve): Factor out code which
6780         does parameter compatibility checking with arguments so that we can 
6781         re-use the code even from Delegate.VerifyApplicability
6782
6783         (VerifyArgumentsCompat): Move above code here.
6784
6785         * delegate.cs (VerifyApplicability): Get rid of duplicate code
6786         and instead make a call to the above method.
6787
6788 2002-03-31  Ravi Pratap  <ravi@ximian.com>
6789
6790         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6791         We use it to keep track of classes which are attribute types.
6792
6793 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
6794
6795         * delegate.cs (Delegate.Define): Correctly define the types in the
6796         presence of fixed and array parameters.
6797
6798         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6799         doing FindMembers.
6800
6801         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6802         include NonPublic after the first iteration.
6803
6804         * class.cs (Indexer.CheckBase): Only check if both parents are
6805         non-null. 
6806         
6807         * cs-parser.jay (accessor_body): If empty, set to null.
6808
6809         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6810         same code path here to resolve constants names that we did have in
6811         MemberAccess.DoResolve.  There is too much code duplicated here.
6812
6813 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
6814
6815         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6816
6817         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6818         to MakeUnionSet.
6819
6820         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6821         tokens, numbers and strings.
6822
6823         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6824         parenthesis.
6825
6826         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6827         asyncronous parameters and the regular parameters.  
6828
6829         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6830         specify the target directory.
6831
6832         * expression.cs: (This.DoResolve): Simplify
6833         (As.Emit): Optimize, do not generate IsInst if the expression is
6834         always of the given type.
6835
6836         (Is.DoResolve): Bug fix, we were reporting both always/never for
6837         the is expression.
6838
6839         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6840         creating too many unnecessary arrays.
6841
6842 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
6843
6844         * class.cs (EmitFieldInitializer): Use Assign expression to assign
6845         fields instead of rolling our own initializer.   Takes care of all
6846         implicit conversions, and drops unnecessary static checks/argument.
6847
6848 2002-03-31  Dick Porter  <dick@ximian.com>
6849
6850         * driver.cs: use the GetDirectories() return values properly, and
6851         use "/" as path separator.
6852
6853 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
6854
6855         * expression.cs (Unary): Optimize - - expr into expr.
6856         (Binary): Optimize a + (-b) into a -b.
6857
6858         * codegen.cs (CodeGen): Made all methods static.
6859
6860 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
6861
6862         * rootcontext.cs: 
6863
6864         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6865         TypeBuilder property.
6866
6867         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6868         instead. 
6869
6870         * tree.cs: Removed the various RecordXXXX, and replaced with a
6871         single RecordDecl.  Removed all the accessor methods, and just
6872         left a single access point Type 
6873
6874         * enum.cs: Rename DefineEnum to DefineType.
6875
6876         * decl.cs: New abstract method `DefineType' used to unify the
6877         Defines for Enumerations, Interfaces, TypeContainers and
6878         Delegates.
6879
6880         (FindType): Moved LookupInterfaceOrClass here.  Moved the
6881         LookupBaseClasses method that used to live in class.cs and
6882         interface.cs here, and renamed to FindType.
6883         
6884         * delegate.cs: Implement DefineType.  Take advantage of the
6885         refactored pattern for locating the parent builder without taking
6886         the parent_builder argument (which we know does not work if we are
6887         nested, and triggering a toplevel definition).
6888
6889 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6890
6891         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6892         accessibility of a member has changed during override and report
6893         an error if so.
6894
6895         * class.cs (Method.Define, Property.Define): Only complain on
6896         overrides if the method is private, any other accessibility is
6897         fine (and since we just checked the permission is the same, we are
6898         good to go).
6899
6900         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6901         and elif are processed always.  The other pre-processing
6902         directives are only processed if we are "taking" the path
6903
6904 2002-03-29  Martin Baulig  <martin@gnome.org>
6905
6906         * class.cs (Method.Emit): Only emit symbolic debugging info if the
6907         current location is not Null.
6908
6909         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6910         a separate method so we can profile it.
6911
6912         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6913         `span.Seconds' are just seconds, but no minutes or hours.
6914         (MainDriver): Profile the CodeGen.SaveSymbols calls.
6915
6916 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6917
6918         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6919         Remove the gratuitous set of Final:
6920
6921                                 // If an interface implementation, then we can set Final.
6922                                 if (((flags & MethodAttributes.Abstract) == 0) &&
6923                                     implementing.DeclaringType.IsInterface)
6924                                         flags |= MethodAttributes.Final;
6925
6926         I do not know what I was smoking when I used that.
6927         
6928
6929         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6930         step into fixing the name resolution issues for delegates and
6931         unifying the toplevel name resolution.
6932
6933 2002-03-28  Martin Baulig  <martin@gnome.org>
6934
6935         * class.cs (Method.Emit): If we have a symbol writer, call its
6936         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6937         tell it about the current method.
6938
6939         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6940         writer that we're going to emit the first byte of IL code for a new
6941         statement (a new source line).
6942         (EmitContext.EmitTopBlock): If we have a symbol writer, call
6943         EmitContext.Mark() before emitting any code.
6944
6945         * location.cs (SymbolDocument): Return null when we're Null.
6946
6947         * statement.cs (Statement): Moved the `Location loc' variable here.
6948         (Statement.EmitBoolExpression): If we have a symbol writer, call
6949         ec.Mark() before emitting any code to tell it that we're at the
6950         beginning of a new statement.
6951         (StatementExpression): Added `Location' argument to the constructor.
6952         (Block): Added public readonly variable `StartLocation' and public
6953         variable `EndLocation'.  The latter is to be set using SetEndLocation().
6954         (Block): Added constructor which takes a start and end location.
6955         (Block.SetEndLocation): New method. This sets the end location.
6956         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6957         local variables we create.
6958         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6959         each statement and do also mark the begin and end of the block.
6960
6961         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6962         tell it the current lexer.Location, use Location.Null for the end of the
6963         block.
6964         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6965         current block, set its end location using SetEndLocation().
6966         (statement_expression): StatementExpression constructor now takes the
6967         lexer.Location as additional argument.
6968         (for_statement, declare_local_variables): Likewise.
6969         (declare_local_variables): When creating a new implicit block, use the
6970         new Block constructor and pass it the lexer.Location.
6971
6972 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6973
6974         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6975         members also on the parent interfaces recursively.
6976
6977 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
6978
6979         * report.cs: Use new formats, since Gonzalo finished the missing
6980         bits. 
6981
6982         * expression.cs (Binary.ResolveOperator): added missing operator|
6983         operator& and operator^ for bool/bool.
6984
6985         * cs-parser.jay: CheckDef now takes a Location argument that is
6986         used to report errors more precisly (instead of reporting the end
6987         of a definition, we try to track something which is a lot closer
6988         to the source of the problem).
6989
6990         * cs-tokenizer.cs: Track global token use, so we can properly flag
6991         the use of #define/#undef after the first token has been seen.
6992
6993         Also, rename the reportXXXX to Error_DescriptiveName
6994
6995         * decl.cs (DeclSpace.IsTopLevel): Move property here from
6996         TypeContainer, so that Enum and Interface can use this too.
6997
6998         * class.cs (TypeContainer.LookupInterfaceOrClass,
6999         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
7000         `builder' argument.  Typically this was used to pass the parent
7001         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
7002         the definition).  
7003
7004         The problem is that a nested class could trigger the definition of
7005         a toplevel class, and the builder would be obviously wrong in that
7006         case. 
7007
7008         So we drop this argument, and we compute dynamically the
7009         TypeBuilder/ModuleBuilder (the correct information was available
7010         to us anyways from DeclSpace.Parent)
7011
7012         * interface.cs (Interface.DefineInterface): Drop builder
7013         parameter cleanup like class.cs
7014
7015         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
7016         like class.cs
7017
7018         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
7019         values. 
7020
7021         (Try.Emit): Propagate the returns value from the statement.
7022
7023         (Return.Emit): Even if we are leavning 
7024
7025         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
7026
7027         * modifiers.cs: Fix the computation of MethodAttributes flags.
7028
7029 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
7030
7031         * driver.cs: allow compilation of files that start with '/'.
7032         Add a default case when checking the argument of --target.
7033
7034 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
7035
7036         * interface.cs: Implement the same search algorithm for types in
7037         the interface code.
7038
7039         * delegate.cs: Do not allow multiple definition.
7040
7041         * Recovered ChangeLog that got accidentally amputated
7042
7043         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
7044
7045         * rootcontext.cs: Load manually enum to allow core classes to
7046         contain enumerations.
7047
7048         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
7049         Update to new static methods in TypeManager.
7050
7051         * typemanager.cs (GetMethod, GetConstructor): Use our
7052         implementation of FindMembers to find the members, since during
7053         corlib compilation, the types are TypeBuilders and GetMethod and
7054         GetConstructor do not work.
7055
7056         Make all methods in TypeManager static.
7057
7058         (InitCodeHelpers): Split the functionality from
7059         the InitCodeTypes function.
7060
7061         * driver.cs: Call InitCodeHelpers after we have populated the
7062         types. 
7063
7064         * cs-parser.jay (delegate_declaration): we did not used to compute
7065         the delegate name correctly for void delegates.
7066
7067 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
7068
7069         * rootcontext.cs (RootContext): Init the interface_resolve_order
7070         and type_container_resolve_order always.
7071
7072         (ResolveCore, BootstrapCorlib_ResolveClass,
7073         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
7074         compiler when compiling with --nostdlib
7075
7076         * class.cs (TypeContainer.DefineType): Check that our parent is
7077         not null.  This test is most important when we are bootstraping
7078         the core types.
7079
7080         * codegen.cs: Split out the symbol writing code.
7081
7082 2002-03-25  Martin Baulig  <martin@gnome.org>
7083
7084         * driver.cs (-g): Made -g an alias for --debug.
7085
7086 2002-03-24  Martin Baulig  <martin@gnome.org>
7087
7088         * codegen.cs (SymbolWriter): New public variable. Returns the
7089         current symbol writer.
7090         (CodeGen): Added `bool want_debugging_support' argument to the
7091          constructor. If true, tell the ModuleBuild that we want debugging
7092         support and ask it for the ISymbolWriter.
7093         (Save): If we have a symbol writer, call it's Close() method after
7094         saving the assembly.
7095
7096         * driver.c (--debug): New command line argument to create a
7097         debugger information file.
7098
7099         * location.cs (SymbolDocument): New public property. Returns an
7100         ISymbolDocumentWriter object for the current source file or null
7101         if we don't have a symbol writer.
7102
7103 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
7104
7105         * driver.cs (LoadAssembly): Correctly return when all the paths
7106         have been tried and not before.
7107
7108         * statement.cs (Switch.Emit): return the actual coverage for this
7109         statement (returns/not-returns)
7110
7111         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7112         switch of the statement if we are the last switch section.  That
7113         kills two problems: try/catch problems (we used to emit an empty
7114         nop at the end) and switch statements where all branches would
7115         return. 
7116
7117 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
7118
7119         * driver.cs: Add default assemblies (the equivalent to the
7120         Microsoft CSC.RSP file)
7121
7122         * cs-tokenizer.cs: When updating `cols and setting it to zero,
7123         also update tokens_seen and set it to false.
7124
7125         * driver.cs: Implement --recurse for Mike.
7126
7127         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7128         correctly splitting out the paths.
7129
7130 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
7131
7132         * interface.cs (Interface.PopulateProperty): Instead of using
7133         `parent' as the declaration space for the set parameters, use
7134         `this' 
7135
7136         * support.cs (InternalParameters): InternalParameters constructor
7137         takes a DeclSpace instead of a TypeContainer.
7138
7139         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7140         types are being initialized, load the address of it before calling
7141         the function.  
7142
7143         (New): Provide a mechanism to disable the generation of local
7144         value type temporaries when the caller will be providing us with
7145         an address to store it.
7146
7147         (ArrayCreation.EmitDynamicInitializers): Use it.
7148
7149 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
7150
7151         * expression.cs (Invocation.EmitArguments): Only probe for array
7152         property if there is more than one argument.  Sorry about that.
7153
7154         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7155         empty param arrays.
7156         
7157         * class.cs (Method.LabelParameters): Fix incorrect code path that
7158         prevented the `ParamArrayAttribute' from being applied to the
7159         params attribute.
7160
7161 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
7162
7163         * support.cs (ReflectionParameters): Correctly compute whether the
7164         last argument is a params array.  Fixes the problem with
7165         string.Split ('a')
7166
7167         * typemanager.cs: Make the assemblies array always be non-null
7168         (empty, but non-null)
7169
7170         * tree.cs (RecordDecl): New function that abstracts the recording
7171         of names.  This reports error 101, and provides a pointer to the
7172         previous declaration.  Fixes a crash in the compiler.
7173
7174         * cs-parser.jay (constructor_declaration): Update to new grammar,
7175         and provide a constructor_body that can be empty.
7176
7177 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
7178
7179         * driver.cs: Add support for --resources.
7180
7181         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7182         Make all types for the various array helper methods be integer.
7183
7184         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7185         CheckState to ConvCast.
7186
7187         (ConvCast): Now it takes a `checked' state argument, to avoid
7188         depending on the emit context for the conversion, and just using
7189         the resolve time setting.
7190
7191         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7192         instead of Invocation.EmitArguments.  We do not emit the original
7193         arguments, instead we emit those which have been converted to
7194         unsigned int expressions.
7195
7196         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
7197
7198         * codegen.cs: ditto.
7199
7200         * expression.cs (LocalVariableReference): Drop the use of the
7201         Store function that depended on the variable index.
7202
7203         * statement.cs (VariableInfo): Drop the `Idx' property from this
7204         class, as this is not taking into account the indexes for
7205         temporaries tat we generate during the execution, getting the
7206         indexes wrong.
7207
7208         * class.cs: First emit class initializers, then call the parent
7209         constructor. 
7210
7211         * expression.cs (Binary): Fix opcode emision.
7212         (UnaryMutator.EmitCode): Support checked code generation
7213
7214         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
7215         matches for events for both the Static and Instance scans,
7216         pointing to the same element.   Fix that.
7217
7218 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
7219
7220         * rootcontext.cs (ResolveTree): Always set the
7221         interface_resolve_order, because nested interfaces will be calling
7222         into us.
7223
7224         * class.cs (GetInterfaceOrClass): Track the same resolution
7225         process used by TypeManager.LookupType.  This fixes the nested
7226         type lookups in class declarations (separate path from
7227         LookupType). 
7228
7229         (TypeContainer.DefineType): Also define nested interfaces.
7230         (TypeContainer.RegisterOrder): New public function used to
7231         register the order in which child interfaces need to be closed.
7232
7233         Nested interfaces need to be closed after their parents have been
7234         created. 
7235         
7236         * interface.cs (InterfaceAttr): Put all the logic for computing
7237         the interface attribute here. 
7238
7239         (DefineInterface): Register our interface order with the
7240         RootContext or with the TypeContainer depending on the case.
7241
7242 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7243
7244         * cs-parser.jay: rework foreach statement to work with the new
7245         changes to the policy on SimpleNames.
7246         
7247         * report.cs: support Stacktrace on warnings as well.
7248
7249         * makefile: drop --unsafe and /unsafe from the compile.
7250
7251 2002-03-13  Ravi Pratap  <ravi@ximian.com>
7252
7253         * ecore.cs (StandardConversionExists): Modify to take an Expression
7254         as the first parameter. Ensure we do null -> reference type conversion
7255         checking.
7256
7257         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7258         temporary Expression objects.
7259
7260 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7261
7262         * interface.cs: workaround bug in method overloading resolution
7263         (there is already a bugzilla bug for it).
7264
7265 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7266
7267         We could also solve this problem by having a separate path for
7268         performing type lookups, instead of DoResolve, we could have a
7269         ResolveType entry point, and only participating pieces of the
7270         production (simplename, deref, array) would implement this. 
7271         
7272         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7273         signal SimpleName to only resolve type names and not attempt to
7274         resolve anything else.
7275
7276         * expression.cs (Cast): Set the flag.
7277
7278         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7279
7280         * class.cs: Only report 108 if there is no `new' modifier.
7281
7282         * cs-parser.jay: rework foreach statement to work with the new
7283         changes to the policy on SimpleNames.
7284         
7285         * report.cs: support Stacktrace on warnings as well.
7286
7287         * makefile: drop --unsafe and /unsafe from the compile.
7288
7289 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
7290
7291         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7292         lookups here, instead of doing that at parse time.  This means
7293         that our grammar will not introduce `LocalVariableReferences' as
7294         expressions at this point.  That solves the problem of code like
7295         this:
7296
7297         class X {
7298            static void Main ()
7299            { int X = 1;
7300             { X x = null }}}
7301
7302         This is only half the fix.  The full fix requires parameters to
7303         also be handled in this way.
7304
7305         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7306         makes the use more obvious of the DeclSpace.  The
7307         ec.TypeContainer.TypeBuilder is now only used to pull the
7308         TypeBuilder for it.
7309
7310         My theory is that I can get rid of the TypeBuilder completely from
7311         the EmitContext, and have typecasts where it is used (from
7312         DeclSpace to where it matters).  
7313
7314         The only pending problem is that the code that implements Aliases
7315         is on TypeContainer, and probably should go in DeclSpace.
7316
7317         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7318         lookups here, instead of doing that at parse time.  This means
7319         that our grammar will not introduce `LocalVariableReferences' as
7320         expressions at this point.  That solves the problem of code like
7321         this:
7322
7323         class X {
7324            static void Main ()
7325            { int X = 1;
7326             { X x = null }}}
7327
7328         This is only half the fix.  The full fix requires parameters to
7329         also be handled in this way.
7330
7331         * class.cs (Property.DefineMethod): When implementing an interface
7332         method, set newslot, when implementing an abstract method, do not
7333         set the flag (before we tried never setting it, or always setting
7334         it, which is the difference).
7335         (Indexer.DefineMethod): same.
7336         (Method.DefineMethod): same.
7337
7338         * ecore.cs: Only set the status used flag if we get back a Field.
7339
7340         * attribute.cs: Temporary hack, so Paolo can keep working.
7341
7342 2002-03-08  Ravi Pratap  <ravi@ximian.com>
7343
7344         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7345         the unmanaged type in the case we have a MarshalAs attribute.
7346
7347         (Resolve): Handle the case when we are parsing the special MarshalAs
7348         attribute [we need to store the unmanaged type to use later]
7349         
7350         * typemanager.cs (marshal_as_attr_type): Built in type for the 
7351         MarshalAs Attribute.
7352
7353         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
7354         on parameters and accordingly set the marshalling info.
7355         
7356 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
7357
7358         * class.cs: Optimizing slightly by removing redundant code after
7359         we switched to the `NoTypes' return value.
7360         (Property.DefineMethod): use NoTypes here too.
7361
7362         This fixes the bug I introduced in my last batch of changes.
7363
7364 2002-03-05  Ravi Pratap  <ravi@ximian.com>
7365
7366         * tree.cs (RecordEnum): Add. We now keep track of enums too.
7367
7368         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7369         Enums since those are types too. 
7370
7371         * cs-parser.jay (enum_declaration): Record enums as we parse them.
7372         
7373         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
7374         thanks to a call during the lookup process.
7375
7376 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
7377
7378         * statement.cs (Foreach): Lots of work to accomodate a particular
7379         kind of foreach statement that I had not kept in mind.  It is
7380         possible to have foreachs on classes that provide a GetEnumerator
7381         method that return objects that implement the "pattern" for using
7382         a foreach, there is no need to support GetEnumerator
7383         specifically. 
7384
7385         This is needed to compile nant.
7386
7387         * decl.cs: Only report 114 if the member is not `Finalize' and if
7388         the warning level is at least 2.
7389
7390         * class.cs: Moved the compare function from Method to
7391         MethodSignature. 
7392
7393         (MethodSignature.InheritableMemberSignatureCompare): Add new
7394         filter function that is used to extract inheritable methods from a
7395         class. 
7396
7397         (Method.Define): Use the new `inheritable_method_signature_filter'
7398         delegate
7399
7400         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7401         command. 
7402
7403 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
7404
7405         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7406
7407         * cs-parser.jay: Add opt_semicolon to the interface declaration.
7408
7409         * expression.cs: Pass location information to
7410         ConvertImplicitStandard. 
7411
7412         * class.cs: Added debugging code to track return values from
7413         interfaces. 
7414
7415 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
7416
7417         * expression.cs (Is.DoResolve): If either side of the `is' is an
7418         interface, do not flag the warning.
7419
7420         * ecore.cs (ImplicitReferenceConversion): We need a separate test
7421         for interfaces
7422
7423         * report.cs: Allow for --fatal to be used with --probe.
7424         
7425         * typemanager.cs (NoTypes): Move the definition for the empty Type
7426         array here. 
7427
7428         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7429         properties. 
7430         (TypeContainer.DefineProxy): New function used to proxy to parent
7431         implementations when implementing interfaces.
7432         (TypeContainer.ParentImplements): used to lookup if our parent
7433         implements a public function that is required by an interface.
7434         (TypeContainer.VerifyPendingMethods): Hook this up.
7435
7436         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7437         `modules' and `assemblies' arraylists into arrays.  We only grow
7438         these are the very early start up of the program, so this improves
7439         the speedof LookupType (nicely measured).
7440
7441         * expression.cs (MakeByteBlob): Replaced unsafe code with
7442         BitConverter, as suggested by Paolo.
7443
7444         * cfold.cs (ConstantFold.Binary): Special case: perform constant
7445         folding of string concatenation, but if either side is a string,
7446         and the other is not, then return null, and let the runtime use
7447         the concatenation on the string plus the object (using
7448         `Object.ToString'). 
7449
7450 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
7451
7452         Constant Folding has been implemented now.
7453         
7454         * expression.cs (Unary.Reduce): Do not throw an exception, catch
7455         the error instead on types that are not supported in one's
7456         complement. 
7457
7458         * constant.cs (Constant and all children): New set of functions to
7459         perform implict and explicit conversions.
7460         
7461         * ecore.cs (EnumConstant): Implement the new functions to perform
7462         conversion by proxying to the child expression.
7463
7464         * codegen.cs: (ConstantCheckState): Constant evaluation has its
7465         own separate setting that can not be turned off from the command
7466         line using --unchecked or --checked and is only controlled using
7467         the checked/unchecked statements and expressions.  This setting is
7468         used by the constant folder to flag errors.
7469
7470         * expression.cs (CheckedExpr, UncheckedExpr): Set the
7471         ConstantCheckState as well.   
7472
7473         During Resolve, they also have to flag the state, because the
7474         constant folder runs completely in the Resolve phase.
7475
7476         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7477         well.
7478
7479 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7480
7481         * cfold.cs: New file, this file contains the constant folder.
7482         
7483         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7484         argument to track whether we are using the resulting address to
7485         load or store a value and provide better error messages. 
7486
7487         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7488         new AddressOf arguments.
7489
7490         * statement.cs (Foreach.EmitCollectionForeach): Update
7491
7492         * expression.cs (Argument.Emit): Call AddressOf with proper
7493         arguments to track usage.
7494
7495         (New.DoEmit): Call AddressOf with new arguments.
7496
7497         (Unary.Emit): Adjust AddressOf call.
7498
7499 2002-03-01  Ravi Pratap  <ravi@ximian.com>
7500
7501         * cs-parser.jay (member_access): Change the case for pre-defined types
7502         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
7503         this suggestion.
7504
7505         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7506         a method body.
7507
7508         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7509         essentially like methods and apply attributes like MethodImplOptions to them too.
7510
7511         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7512         not being null.
7513
7514         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7515         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7516         is the DeclSpace.
7517
7518         * Update code everywhere accordingly.
7519
7520         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7521
7522         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7523
7524 2002-02-28  Ravi Pratap  <ravi@ximian.com>
7525
7526         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7527         try performing lookups against those instead of jumping straight into using
7528         the 'using' clauses.
7529
7530         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7531
7532         (LookupType): Perform lookups in implicit parents too.
7533
7534         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7535         sequence as RootContext.LookupType. 
7536
7537         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
7538         the various cases of namespace lookups into this method.
7539
7540 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7541
7542         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7543         in positional arguments)
7544
7545         * class.cs (Operator): Update the AllowedModifiers to contain
7546         extern. 
7547
7548         * cs-parser.jay: Update operator declaration to allow for the
7549         operator body to be empty.
7550
7551         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7552         values. 
7553
7554 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
7555
7556         * class.cs (Method.Emit): Label parameters.
7557
7558         * driver.cs: Return 1 or 0 as the program exit code.
7559
7560 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
7561
7562         * expression.cs: Special case the `null' object when trying to
7563         auto-compute the type, as anything can be explicitly converted to
7564         that. 
7565
7566         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7567         spotting this Paolo.
7568
7569         (Expression.ImplicitNumericConversion): Perform comparissions of
7570         the type using the underlying type in the case of an enumeration
7571         rather than using the enumeration type for the compare.
7572
7573         Cope with the underlying == type case, which is not possible to
7574         catch before. 
7575
7576         (Expression.ConvertNumericExplicit): Perform comparissions of
7577         the type using the underlying type in the case of an enumeration
7578         rather than using the enumeration type for the compare.
7579
7580         * driver.cs: If the user does not supply an extension, assume .exe
7581
7582         * cs-parser.jay (if_statement): Rewrote so that we can track the
7583         location for the if statement.
7584
7585         * expression.cs (Binary.ConstantFold): Only concat strings when
7586         the operation is "+", not everything ;-)
7587
7588         * statement.cs (Statement.EmitBoolExpression): Take a location
7589         argument. 
7590         (If, While, Do): Track location.
7591
7592         * expression.cs (Binary.ResolveOperator): In the object + string
7593         case, I was missing a call to ConvertImplicit
7594
7595 2002-02-25  Ravi Pratap  <ravi@ximian.com>
7596
7597         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7598         Location arguments. Ensure we use RootContext.LookupType to do our work
7599         and not try to do a direct Type.GetType and ModuleBuilder.GetType
7600
7601         * interface.cs (PopulateMethod): Handle the type of the parameter being
7602         null gracefully.
7603
7604         * expression.cs (Invocation.BetterFunction): Handle the case when we 
7605         have a params method with no fixed arguments and a call is made with no
7606         arguments.
7607
7608 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
7609
7610         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7611         the verbatim-string-literal
7612
7613         * support.cs (InternalParameters.ParameterModifier): handle null
7614         fixed parameters.
7615         (InternalParameters.ParameterType): ditto.
7616
7617         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7618         duplicating the name of the variable parameter.
7619         (GetParameterByName): Fix bug where we were not looking up array
7620         paramters if they were the only present (thanks Paolo!).
7621         (GetParameterInfo): We only have an empty set of types if both
7622         fixed and array are set to null.
7623         (GetParameterInfo-idx): Handle FixedParameter == null
7624
7625         * cs-parser.jay: Handle the case where there is no catch
7626         statements (missing null test).
7627
7628 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
7629
7630         * driver.cs (MainDriver): Be conservative on our command line
7631         handling.
7632
7633         Catch DirectoryNotFoundException when calling GetFiles.
7634         
7635         (SplitPathAndPattern): Used to split the input specification into
7636         a path and a pattern that we can feed to Directory.GetFiles.
7637
7638 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
7639
7640         * statement.cs (Fixed): Implement the last case of the Fixed
7641         statement (string handling).
7642
7643         * expression.cs (StringPtr): New class used to return a char * to
7644         a string;  Used by the Fixed statement.
7645
7646         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
7647
7648         * expression.cs (Binary.ResolveOperator): Remove redundant
7649         MemberLookup pn parent type.
7650         Optimize union call, we do not need a union if the types are the same.
7651         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7652         type.
7653
7654         Specialize the use of MemberLookup everywhere, instead of using
7655         the default settings. 
7656
7657         (StackAlloc): Implement stackalloc keyword.
7658
7659         * cs-parser.jay: Add rule to parse stackalloc.
7660         
7661         * driver.cs: Handle /h, /help, /?
7662
7663         * expression.cs (MakeByteBlob): Removed the hacks we had in place
7664         before we supported unsafe code.
7665         
7666         * makefile: add --unsafe to the self compilation of mcs.
7667
7668 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
7669
7670         * expression.cs (PointerArithmetic): New class that is used to
7671         perform pointer arithmetic.
7672         (Binary.Resolve): Handle pointer arithmetic
7673         Handle pointer comparission.
7674         (ArrayPtr): Utility expression class that is used to take the
7675         address of an array.
7676
7677         (ElementAccess): Implement array access for pointers
7678         
7679         * statement.cs (Fixed): Implement fixed statement for arrays, we
7680         are missing one more case before we are done.
7681
7682         * expression.cs (Indirection): Implement EmitAssign and set the
7683         ExprClass to Variable.  This allows pointer dereferences to be
7684         treated as variables, and to have values assigned to them.
7685         
7686         * ecore.cs (Expression.StoreFromPtr): New utility function to
7687         store values dereferencing.
7688
7689 2002-02-20  Ravi Pratap  <ravi@ximian.com>
7690
7691         * expression.cs (Binary.ResolveOperator): Ensure that we are
7692         not trying to operate on a void type - this fixes the reported
7693         bug.
7694
7695         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7696         the parent implementation is sealed.
7697
7698         * ../errors/cs0239.cs : Add.
7699
7700         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7701
7702         * typemanager.cs (unverifiable_code_type): Corresponds to 
7703         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7704         which have unsafe code in them.
7705
7706         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
7707         unsafe context.
7708
7709 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
7710
7711         * cs-tokenizer.cs: Add support for @"litreal strings"
7712
7713         Make tokenizer accept pre-processor directives
7714         on any column (remove the old C-like limitation). 
7715
7716         * rootcontext.cs (EmitCode): Emit any global attributes.
7717         (AddGlobalAttributes): Used to keep track of assembly attributes. 
7718
7719         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7720
7721         * cs-parser.jay: Add support for global attributes.  
7722
7723 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
7724
7725         * expression.cs (Indirection): New helper class.  Unary will
7726         create Indirection classes to be able to implement the
7727         IMemoryLocation interface on it.
7728
7729 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
7730
7731         * cs-parser.jay (fixed_statement): reference the right statement.
7732
7733         * statement.cs (Fixed.Emit): Finish implementing the fixed
7734         statement for the &x case.
7735
7736 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
7737
7738         * class.cs (Property.Define, Method.Define): Remove newslot when
7739         `implementing'.  
7740
7741         * modifiers.cs: My use of NewSlot when `Abstract' was set was
7742         wrong.  NewSlot should only be used if the `new' keyword is present.
7743
7744         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7745         locating our system dir.  Sorry about this.
7746
7747 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7748
7749         * driver.cs (GetSystemDir): Compute correctly the location of our
7750         system assemblies.  I was using the compiler directory instead of
7751         the library directory.
7752
7753 2002-02-13  Ravi Pratap  <ravi@ximian.com>
7754
7755         * expression.cs (BetterFunction): Put back in what Miguel commented out
7756         since it is the correct fix. The problem is elsewhere ;-)
7757
7758         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7759         parameters of the parms method are themselves compatible or not !
7760
7761         (StandardConversionExists): Fix very dangerous bug where we were forgetting
7762         to check that a class implements an interface before saying that an implicit
7763         conversion was allowed. Use ImplementsInterface to do the checking.
7764
7765 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7766
7767         * class.cs (Method.Define): Track whether we are an explicit
7768         implementation or not.  And only call DefineMethodOverride if we
7769         are an explicit implementation.
7770
7771         (Property.DefineMethod): Ditto.
7772
7773 2002-02-11  Ravi Pratap  <ravi@ximian.com>
7774
7775         * expression.cs (BetterFunction): Catch hideous bug which was
7776          preventing us from detecting ambiguous calls due to implicit casts i.e
7777         cs0121.
7778
7779 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
7780
7781         * support.cs (Pair): Remove un-needed method.  I figured why I was
7782         getting the error in cs-parser.jay, the variable in a foreach loop
7783         is readonly, and the compiler does not really treat this as a variable.
7784
7785         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
7786         instead of EQUALS in grammar.  
7787
7788         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7789
7790         * expression.cs (Unary.DoResolve): Check whether the argument is
7791         managed or not.
7792
7793 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
7794
7795         * support.cs: Api for Pair to set a value.  Despite the fact that
7796         the variables are public the MS C# compiler refuses to compile
7797         code that accesses the field if the variable is part of a foreach
7798         statement. 
7799
7800         * statement.cs (Fixed): Begin implementation of the fixed
7801         statement.
7802
7803         (Block.AddVariable): Return the VariableInfo on success and null
7804         on failure instead of true/false. 
7805
7806         * cs-parser.jay (foreach): Catch errors on variables already
7807         defined (we were ignoring this value before) and properly unwind
7808         the block hierarchy
7809
7810         (fixed_statement): grammar for the fixed statement.
7811
7812 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
7813
7814         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7815         pointer types to be incretemented.
7816
7817         (SizeOf): Implement.
7818
7819         * cs-parser.jay (pointer_member_access): Implement
7820         expr->IDENTIFIER production.
7821
7822         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7823         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7824         on safe contexts.
7825
7826         (Unary): Implement indirection.
7827
7828         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7829         use in non-unsafe context).
7830
7831         (SimpleName.DoResolve): Check for pointers in field access on safe
7832         contexts. 
7833
7834         (Expression.LoadFromPtr): Factor the load-indirect code in this
7835         function.  This was duplicated in UnboxCast and ParameterReference
7836
7837 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
7838
7839         * expression.cs (ComposedCast): report an error if a pointer cast
7840         is used in a safe region.
7841
7842         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7843         pointer type casts in unsafe context.
7844
7845         * codegen.cs (EmitContext): Set up IsUnsafe.
7846
7847         * cs-parser.jay (non_expression_type): Add productions for pointer
7848         casts. 
7849
7850         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7851         code.  We should not use force into static mode if the method is
7852         not virtual.  Fixes bug in MIS
7853
7854         * statement.cs (Do.Emit, While.Emit, For.Emit,
7855         Statement.EmitBoolExpression): Add support to Do and While to
7856         propagate infinite loop as `I do return' semantics.
7857
7858         Improve the For case to also test for boolean constants.
7859
7860         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7861         to the list of attributes we can add.
7862
7863         Remove `EmitContext' argument.
7864
7865         * class.cs (Method.Define): Apply parameter attributes.
7866         (Constructor.Define): Apply parameter attributes.
7867         (MethodCore.LabelParameters): Move here the core of labeling
7868         parameters. 
7869
7870         * support.cs (ReflectionParameters.ParameterModifier,
7871         InternalParameters.ParameterModifier): Use IsByRef on the type and
7872         only return the OUT bit for these parameters instead of in/out/ref
7873         flags.
7874
7875         This is because I miss-understood things.  The ParameterInfo.IsIn
7876         and IsOut represent whether the parameter has the [In] and [Out]
7877         attributes set.  
7878
7879 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
7880
7881         * ecore.cs (FieldExpr.Emit): Release temporaries.
7882
7883         * assign.cs (LocalTemporary.Release): new function.
7884
7885         * codegen.cs (EmitContext.GetTemporaryStorage,
7886         EmitContext.FreeTemporaryStorage): Rework the way we deal with
7887         temporary storage.  Now we can "put back" localbuilders when we
7888         are done with them
7889
7890 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
7891
7892         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7893         need to make a copy of the variable to generate verifiable code.
7894
7895 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
7896
7897         * driver.cs: Compute dynamically the system directory.
7898
7899         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7900         Slower, but more generally useful.  Used by the abstract
7901         registering implementation. 
7902
7903         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7904         the rules for the special rule on Type/instances.  First check if
7905         we have the same name, and if so, try that special static path
7906         rather than the instance path.
7907         
7908 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
7909
7910         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7911         for, while and if.
7912
7913         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7914         Enum, ValueType, Delegate or Array for non-corlib compiles.
7915
7916         * cs-tokenizer.cs: Catch long identifiers (645)
7917
7918         * typemanager.cs (IndexerPropetyName): Ravi never tested this
7919         piece of code.
7920
7921         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7922         fix, we were returning too early, so we were not registering
7923         pending methods from abstract classes.
7924
7925         Do not register pending methods if the class is abstract.
7926
7927         * expression.cs (Conditional.DoResolve): Report circular implicit
7928         conversions when we neecd to compute it for conditional
7929         expressions. 
7930
7931         (Is.DoResolve): If the expression is always of the provided type,
7932         flag warning 183.  If the expression can not ever be of the
7933         provided type flag warning 184.
7934
7935         * class.cs: Catch 169 as well.
7936
7937         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7938         read. 
7939
7940 2002-01-18  Nick Drochak  <ndrochak@gol.com>
7941
7942         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
7943
7944 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
7945
7946         * interface.cs: (PopulateMethod): Check for pointers being defined
7947         only if the unsafe context is active.
7948         (PopulateProperty): ditto.
7949         (PopulateIndexer): ditto.
7950
7951         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7952         specified.  If pointers are present, make sure that they are
7953         present in an unsafe context.
7954         (Constructor, Constructor.Define): ditto.
7955         (Field, Field.Define): ditto.
7956         (Property, Property.Define): ditto.
7957         (Event, Event.Define): ditto.
7958
7959         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7960         hashtable if there are classes or structs defined.
7961
7962         * expression.cs (LocalVariableReference.DoResolve): Simplify this
7963         code, as the constant resolution moved.
7964
7965         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7966         the metadata, so we can flag error 133. 
7967
7968         * decl.cs (MemberCore.UnsafeOK): New function to test that a
7969         pointer is being declared in an unsafe context.
7970
7971 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
7972
7973         * modifiers.cs (Modifiers.Check): Require a Location argument.
7974         Report error 227 for Unsafe use.
7975
7976         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7977
7978         * statement.cs (For.Emit): If the test is null, then report that
7979         we do `return', as we wont reach anything afterwards.
7980
7981         (Switch.SwitchGoverningType): Track the expression that matched
7982         the conversion.
7983
7984         * driver.cs: Allow negative numbers as an error code to flag.
7985
7986         * cs-parser.jay: Handle 1551.
7987
7988         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
7989
7990 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
7991
7992         * cs-parser.jay: Report 1518 (type declaration can only contain
7993         class, struct, interface, enum or delegate)
7994
7995         (switch_label): Report 1523 (keywords `case' or `default' must
7996         preced code)
7997
7998         (opt_switch_sections): Report 1522 (empty switch)
7999
8000         * driver.cs: Report 1515 (response file specified multiple times)
8001         Report 1516 (Source file specified multiple times).
8002
8003         * expression.cs (Argument.Resolve): Signal 1510
8004
8005         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
8006         access not allowed in static code)
8007
8008 2002-01-11  Ravi Pratap  <ravi@ximian.com>
8009
8010         * typemanager.cs (IsPointerType): Utility method which we are going
8011         to need a lot.
8012
8013         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
8014         the object type, so we take care of that.
8015
8016         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
8017         
8018         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
8019         added to non-params parameters :-)
8020
8021         * typemanager.cs (CSharpName): Include 'void' type too. 
8022
8023         (void_ptr_type): Include in the set of core types.
8024
8025         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
8026         duplicating code.
8027
8028         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
8029         an unsafe context.
8030
8031         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
8032         completely forgotten about it.
8033
8034 2002-01-10  Ravi Pratap  <ravi@ximian.com>
8035
8036         * cs-parser.jay (pointer_type): Add. This begins our implementation
8037         of parsing rules for unsafe code.
8038
8039         (unsafe_statement): Implement.
8040
8041         (embedded_statement): Modify to include the above.
8042
8043         * statement.cs (Unsafe): Implement new class for unsafe blocks.
8044
8045         * codegen.cs (EmitContext.InUnsafe): Add. This determines
8046         if the current context is an unsafe one.
8047
8048         * cs-parser.jay (local_variable_pointer_type): Since local variable types
8049         are handled differently, we need separate rules for them.
8050
8051         (local_variable_declaration): Update to use local_variable_pointer_type
8052         to allow variable declarations of unmanaged pointer types.
8053
8054         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
8055         in unsafe contexts.
8056
8057         * ../errors/cs0214.cs : Add.
8058
8059 2002-01-16  Nick Drochak  <ndrochak@gol.com>
8060
8061         * makefile: remove 'response' file when cleaning.
8062
8063 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8064
8065         * cs-parser.jay: Report 1524.
8066
8067 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
8068
8069         * typemanager.cs (RegisterMethod): drop checking if we have
8070         registered this from here
8071
8072 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
8073
8074         * class.cs (Method.EmitDestructor): Implement calling our base
8075         destructor. 
8076
8077         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
8078         value of InFinally.
8079
8080         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
8081         this routine and will wrap the call in a try/catch block.  Deal
8082         with the case.
8083
8084 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
8085
8086         * ecore.cs (Expression.MemberLookup): instead of taking a
8087         parameter `same_type' that was used to tell whether we could
8088         access private members we compute our containing type from the
8089         EmitContext.
8090
8091         (FieldExpr): Added partial support for volatile fields.  This does
8092         not work for volatile fields exposed from assemblies, as I can not
8093         figure out how to extract the modreq from it.
8094
8095         Updated all the source files to use this.
8096
8097         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
8098         because it is referenced by MemberLookup very often. 
8099
8100 2002-01-09  Ravi Pratap  <ravi@ximian.com>
8101
8102         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8103         TypeBuilder.GetCustomAttributes to retrieve what we need.
8104
8105         Get rid of redundant default_member_attr_type as this is the same as
8106         default_member_type which already exists.
8107
8108         * interface.cs, attribute.cs : Update accordingly.
8109         
8110 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
8111
8112         * typemanager.cs: Enable IndexerPropertyName again.  It does not
8113         work for TYpeBuilders though.  Ravi, can you please fix this?
8114
8115         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8116
8117         * expression.cs (Argument.Emit): Handle the case of ref objects
8118         being passed to ref functions;  
8119
8120         (ParameterReference.EmitLoad): Loads the content of the pointer
8121         without dereferencing.
8122
8123 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8124
8125         * cs-tokenizer.cs: Implemented the pre-processing expressions.
8126
8127 2002-01-08  Ravi Pratap  <ravi@ximian.com>
8128
8129         * class.cs (Indexer.DefineMethod): Incorporate the interface
8130         type in the name of the method if we are doing explicit interface
8131         implementation.
8132
8133         * expression.cs (ConversionExists): Remove as it is completely obsolete.
8134
8135         (BetterConversion): Fix extremely trivial bug where we were referring to
8136         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8137         again !
8138
8139         * ../errors/bug16.cs : Add although we have fixed it.
8140
8141 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8142
8143         * expression.cs (BaseIndexer): Begin implementation.
8144
8145         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8146
8147         * cs-parser.jay (indexer_declarator): Use qualified_identifier
8148         production directly to remove a shift/reduce, and implement
8149         explicit interface implementation.
8150
8151         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8152         after a floating point suffix.
8153
8154         * expression.cs (DoNumericPromotions): Improved the conversion for
8155         uint/uint.  If we have a constant, we avoid doing a typecast to a
8156         larger type.
8157
8158         * class.cs (Indexer): Implement explicit interface implementation
8159         for indexers.
8160         
8161 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8162
8163         * class.cs: make the default instance constructor public and hidebysig.
8164
8165 2001-01-03  Ravi Pratap  <ravi@ximian.com>
8166
8167         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8168         so we can call it from elsewhere.
8169
8170         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8171         we emit it internally if the class has a defined indexer; otherwise the user
8172         emits it by decorating the class definition with the DefaultMemberAttribute.
8173
8174         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8175         attribute is not used on a type which defines an indexer.
8176
8177         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8178         character when we skip whitespace.
8179
8180         * ../errors/cs0646.cs : Add.
8181
8182 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
8183
8184         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8185         again. 
8186
8187         * makefile: Add practical target `mcs3.exe' which builds the third
8188         generation compiler. 
8189
8190         * expression.cs (New): Fix structures constructor calling.
8191
8192         * class.cs (Property, Method, Indexer): Emit Final flag on the
8193         method if we are an interface implementation and we are not
8194         abstract. 
8195
8196         * ecore.cs (PropertyExpr): New public field `IsBase', tells
8197         whether this property is referencing a `base' method.
8198
8199         * expression.cs (Invocation.EmitCall): take an extra argument:
8200         is_base, this is used to determine whether the `call' or
8201         `callvirt' opcode should be used.
8202
8203         
8204         * delegate.cs: update EmitCall.
8205
8206         * class.cs (Method.Define): Set NewSlot for the cases where we are
8207         not implementing an interface method.
8208
8209         (Property.Define): ditto.
8210
8211 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
8212
8213         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
8214         'r'.  Allows mcs to parse itself fully.
8215
8216 2002-01-02  Ravi Pratap  <ravi@ximian.com>
8217
8218         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8219         of the number of initializers that require the InitializeArray method.
8220
8221         (CheckIndices): Store the Expression in all cases - not the plain value. Also
8222         update the above field where necessary.
8223
8224         (MakeByteBlob): Update accordingly.
8225
8226         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
8227         greater than 2.
8228
8229         (EmitDynamicInitializers): Update in accordance with the new optimization.
8230
8231         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8232         same OpCode applies.
8233
8234         * cs-parser.jay : Fix some glaring errors I introduced.
8235
8236 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
8237
8238         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8239         so that we can check for name clashes there too.
8240
8241         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8242         for interface indexers.
8243
8244         * interfaces.cs (Define): Emit the default member attribute.
8245
8246         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8247         variable was being referred to while setting the value ;-)
8248
8249 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
8250
8251         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8252         byte-by-byte information when we know the data is zero.
8253
8254         Make the block always a multiple of 4, because
8255         DefineInitializedData has a bug.
8256
8257         * assign.cs: Fix, we should assign from the temporary, not from
8258         the source. 
8259
8260         * expression.cs (MakeByteBlob): Fix my incorrect code.
8261
8262 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
8263
8264         * typemanager.cs (EnumToUnderlying): This function is used to get
8265         the underlying type from an enumeration, because it does not
8266         always work. 
8267
8268         * constant.cs: Use the I4_S form for values between -128 and 127.
8269
8270         * statement.cs (Block.LookupLabel): Looks up a label.
8271         (Block): Drop support for labeled blocks.
8272
8273         (LabeledStatement): New kind of statement that represents a label
8274         only.
8275
8276         (Goto): Finally implement this bad boy.
8277         
8278         * cs-parser.jay: Update to reflect new mechanism to implement
8279         labels.
8280
8281 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
8282
8283         * codegen.cs (EmitContext.This): a codegen property that keeps the
8284         a single instance of this instead of creating many different this
8285         instances. 
8286
8287         * delegate.cs (Delegate.DoResolve): Update to use the property;
8288
8289         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8290
8291         * expression.cs (BaseAccess.DoResolve): Ditto.
8292
8293 2001-12-29  Ravi Pratap  <ravi@ximian.com>
8294
8295         * typemanager.cs (methodimpl_attr_type): Add to hold the type
8296         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8297
8298         (InitCoreTypes): Update accordingly.
8299
8300         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8301         so we can quickly store the state.
8302
8303         (ApplyAttributes): Set the correct implementation flags
8304         for InternalCall methods.
8305
8306 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
8307
8308         * expression.cs (EmitCall): if a method is not virtual, then do
8309         not use callvirt on it.
8310
8311         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8312         user defined stuff) requires the use of stobj, which takes an
8313         address on the stack instead of an array and an index.  So emit
8314         the Ldelema operation for it.
8315
8316         (EmitStoreOpcode): Use stobj for valuetypes.
8317
8318         (UnaryMutator.EmitCode): Use the right 1 value depending on
8319         whether we are dealing with int64/uint64, float or doubles.
8320
8321         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8322         constructors that I implemented last night.
8323
8324         (Constructor.IsDefault): Fix to work properly for static
8325         constructors.
8326
8327         * cs-parser.jay (CheckDef): report method signature errors.
8328         Update error number 103 to be 132.
8329
8330         * decl.cs: New AdditionResult enumeration value: MethodExists.
8331         Although we do this check for methods later on in the semantic
8332         analysis, catching repeated default constructors is so easy that
8333         we catch these here. 
8334         
8335         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8336         promotions code.
8337
8338         (ParameterReference.EmitAssign, Emit): handle
8339         bools as bytes.
8340
8341         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8342         (ArrayAccess.EmitStoreOpcode): ditto.
8343
8344         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8345
8346         * expression.cs (MakeByteBlob): Complete all the missing types
8347         (uint, short, ushort, byte, sbyte)
8348
8349         * class.cs: Only init instance field initializers on instance
8350         constructors. 
8351
8352         Rename `constructors' to instance_constructors. 
8353
8354         (TypeContainer.AddConstructor): Only add constructors to the list
8355         if it is not static.
8356
8357         Make sure that we handle default_static_constructor independently
8358         everywhere where we handle instance_constructors
8359
8360 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
8361
8362         * class.cs: Do not lookup or create a base initializer for a
8363         static constructor.
8364
8365         (ConstructorInitializer.Resolve): use the proper type to lookup
8366         for constructors.
8367
8368         * cs-parser.jay: Report error 1585 (modifiers between type and name).
8369
8370         * enum.cs, interface.cs: Remove CloseType, this is taken care by
8371         in DeclSpace. 
8372
8373         * decl.cs: CloseType is now an virtual method, the default
8374         implementation just closes this type.
8375         
8376 2001-12-28  Ravi Pratap  <ravi@ximian.com>
8377
8378         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8379         to PreserveSig by default. Also emit HideBySig on such methods.
8380
8381         Basically, set the defaults to standard values.
8382
8383         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8384         argument, if candidate is better, it can't be worse than the best !
8385
8386         (Invocation): Re-write bits to differentiate between methods being
8387         applicable in their expanded form and their normal form - for params
8388         methods of course.
8389
8390         Get rid of use_standard everywhere as only standard conversions are allowed
8391         in overload resolution. 
8392
8393         More spec conformance.
8394         
8395 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8396
8397         * driver.cs: Add --timestamp, to see where the compiler spends
8398         most of its time.
8399
8400         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8401         `this' in static code.
8402
8403         (SimpleName.DoResolve): Implement in terms of a helper function
8404         that allows static-references to be passed upstream to
8405         MemberAccess.
8406
8407         (Expression.ResolveWithSimpleName): Resolve specially simple
8408         names when called by MemberAccess to implement the special
8409         semantics. 
8410
8411         (Expression.ImplicitReferenceConversion): Handle conversions from
8412         Null to reference types before others, as Null's type is
8413         System.Object. 
8414
8415         * expression.cs (Invocation.EmitCall): Handle the special case of
8416         calling methods declared on a reference type from a ValueType
8417         (Base classes System.Object and System.Enum)
8418
8419         (MemberAccess.Resolve): Only perform lookups on Enumerations if
8420         the left hand side is a TypeExpr, not on every enumeration. 
8421
8422         (Binary.Resolve): If types are reference types, then do a cast to
8423         object on operators != and == of both arguments.
8424         
8425         * typemanager.cs (FindMembers): Extract instance and static
8426         members if requested.
8427
8428         * interface.cs (PopulateProperty): Use void_type instead of null
8429         as the return type for the setter method.
8430
8431         (PopulateIndexer): ditto.
8432
8433 2001-12-27  Ravi Pratap  <ravi@ximian.com>
8434
8435         * support.cs (ReflectionParameters): Fix minor bug where we
8436         were examining the wrong parameter for the ParamArray attribute.
8437
8438         Cope with requests for the type of the parameter at position
8439         greater than the params parameter's. We now return the element
8440         type of the params array as that makes more sense.
8441
8442         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
8443         accordingly as we no longer have to extract the element type
8444         ourselves.
8445
8446         (Invocation.OverloadResolve): Update.
8447
8448 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8449
8450         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8451         against IEnumerator, test whether the return value is a descendant
8452         of the IEnumerator interface.
8453
8454         * class.cs (Indexer.Define): Use an auxiliary method to implement
8455         the other bits of the method definition.  Begin support for
8456         explicit interface implementation.
8457
8458         (Property.DefineMethod): Use TypeManager.void_type instead of null
8459         for an empty return value.
8460
8461 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
8462
8463         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8464         dealing with a FieldExpr which is composed of a FieldBuilder, in
8465         the code path we did extract the constant, but we should have
8466         obtained the underlying value to be able to cast it (otherwise we
8467         end up in an infinite loop, this is what Ravi was running into).
8468
8469         (ArrayCreation.UpdateIndices): Arrays might be empty.
8470
8471         (MemberAccess.ResolveMemberAccess): Add support for section
8472         14.5.4.1 that deals with the special case of E.I when E is a type
8473         and something else, that I can be a reference to a static member.
8474
8475         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8476         handle a particular array type to create byte blobs, it is just
8477         something we dont generate byteblobs for.
8478
8479         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8480         arguments. 
8481
8482         * location.cs (Push): remove the key from the hashtable that we
8483         are about to add.   This happens for empty files.
8484
8485         * driver.cs: Dispose files after we have parsed them.
8486
8487         (tokenize): new function that only runs the tokenizer on its
8488         input, for speed testing.
8489
8490 2001-12-26  Ravi Pratap  <ravi@ximian.com>
8491
8492         * class.cs (Event.Define): Define the private field only if there
8493         are no accessors defined.
8494
8495         * expression.cs (ResolveMemberAccess): If there is no associated
8496         field with the event, that means we have an event defined with its
8497         own accessors and we should flag error cs0070 since transforming
8498         ourselves into a field is not valid in that case.
8499
8500         * ecore.cs (SimpleName.DoResolve): Same as above.
8501
8502         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8503         and charset to sane values.
8504
8505 2001-12-25  Ravi Pratap  <ravi@ximian.com>
8506
8507         * assign.cs (DoResolve): Perform check on events only if they 
8508         are being accessed outside the declaring type.
8509
8510         * cs-parser.jay (event_declarations): Update rules to correctly
8511         set the type of the implicit parameter etc.
8512
8513         (add_accessor, remove_accessor): Set current local parameters.
8514
8515         * expression.cs (Binary): For delegate addition and subtraction,
8516         cast the return value from the method into the appropriate delegate
8517         type.
8518
8519 2001-12-24  Ravi Pratap  <ravi@ximian.com>
8520
8521         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8522         of these as the workaround is unnecessary.
8523
8524         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8525         delegate data - none of that is needed at all.
8526
8527         Re-write bits to extract the instance expression and the delegate method
8528         correctly.
8529
8530         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
8531         on delegates too.
8532
8533         * attribute.cs (ApplyAttributes): New method to take care of common tasks
8534         of attaching attributes instead of duplicating code everywhere.
8535
8536         * everywhere : Update code to do attribute emission using the above method.
8537
8538 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8539
8540         * expression.cs (IsParamsMethodApplicable): if there are not
8541         parameters, return immediately.
8542
8543         * ecore.cs: The 0 literal can be implicity converted to an enum
8544         type. 
8545
8546         (SimpleName.DoResolve): First lookup the type, then lookup the
8547         members. 
8548
8549         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8550         want to get its address.  If the InstanceExpression is not
8551         addressable, store the result in a temporary variable, then get
8552         the address of it.
8553
8554         * codegen.cs: Only display 219 errors on warning level or above. 
8555
8556         * expression.cs (ArrayAccess): Make it implement the
8557         IMemoryLocation interface.
8558
8559         (Binary.DoResolve): handle the operator == (object a, object b)
8560         and operator != (object a, object b) without incurring into a
8561         BoxedCast (because 5 != o should never be performed).
8562
8563         Handle binary enumerator operators.
8564
8565         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8566         value type, otherwise use Ldelem_ref.
8567
8568         Use precomputed names;
8569
8570         (AddressOf): Implement address of
8571
8572         * cs-parser.jay (labeled_statement): Fix recursive block
8573         addition by reworking the production.
8574
8575         * expression.cs (New.DoEmit): New has a special case:
8576                 
8577                  If we are dealing with a ValueType, we have a few
8578                  situations to deal with:
8579                 
8580                     * The target of New is a ValueType variable, that is
8581                       easy, we just pass this as the variable reference
8582                 
8583                     * The target of New is being passed as an argument,
8584                       to a boxing operation or a function that takes a
8585                       ValueType.
8586                 
8587                       In this case, we need to create a temporary variable
8588                       that is the argument of New.
8589
8590
8591 2001-12-23  Ravi Pratap  <ravi@ximian.com>
8592
8593         * rootcontext.cs (LookupType): Check that current_type is not null before
8594         going about looking at nested types.
8595
8596         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8597         not implement the IAssignMethod interface any more.
8598
8599         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8600         where we tranform them into FieldExprs if they are being resolved from within
8601         the declaring type.
8602
8603         * ecore.cs (SimpleName.DoResolve): Do the same here.
8604
8605         * assign.cs (DoResolve, Emit): Clean up code considerably. 
8606
8607         * ../errors/bug10.cs : Add.
8608
8609         * ../errors/cs0070.cs : Add.
8610
8611         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8612
8613         * assign.cs : Get rid of EventIsLocal everywhere.
8614         
8615 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8616
8617         * ecore.cs (ConvertIntLiteral): finished the implementation.
8618
8619         * statement.cs (SwitchLabel): Convert the value we are using as a
8620         key before looking up the table.
8621
8622 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8623
8624         * codegen.cs (EmitTopBlock): Require a Location argument now.
8625
8626         * cs-parser.jay (constructor_declarator): We need to setup
8627         current_local_parameters before we parse the
8628         opt_constructor_initializer, to allow the variables to be bound
8629         to the constructor arguments.
8630
8631         * rootcontext.cs (LookupType): First lookup nested classes in our
8632         class and our parents before we go looking outside our class.
8633
8634         * expression.cs (ConstantFold): Extract/debox the values at the
8635         beginnning. 
8636
8637         * rootcontext.cs (EmitCode): Resolve the constants first before we
8638         resolve the types.  This is not really needed, but it helps debugging.
8639
8640         * statement.cs: report location.
8641         
8642         * cs-parser.jay: pass location to throw statement.
8643
8644         * driver.cs: Small bug fix.
8645
8646         * report.cs: Updated format to be 4-zero filled digits.
8647
8648 2001-12-22  Ravi Pratap  <ravi@ximian.com>
8649
8650         * expression.cs (CheckIndices): Fix minor bug where the wrong
8651         variable was being referred to ;-)
8652
8653         (DoEmit): Do not call EmitStaticInitializers when the 
8654         underlying type is System.Object.
8655
8656 2001-12-21  Ravi Pratap  <ravi@ximian.com>
8657
8658         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8659         and do the usual workaround for SRE.
8660
8661         * class.cs (MyEventBuilder.EventType): New member to get at the type
8662         of the event, quickly.
8663
8664         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8665
8666         * assign.cs (Assign.DoResolve): Handle the case when the target
8667         is an EventExpr and perform the necessary checks.
8668
8669         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8670         interface.
8671
8672         (SimpleName.MemberStaticCheck): Include check for EventExpr.
8673
8674         (EventExpr): Set the type in the constructor itself since we 
8675         are meant to be born fully resolved.
8676
8677         (EventExpr.Define): Revert code I wrote earlier.
8678                 
8679         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8680         instance expression is null. The instance expression is a This in that case
8681         or a null, depending on whether it is a static method or not.
8682
8683         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8684         refers to more than one method.
8685
8686         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8687         and accordingly flag errors.
8688
8689 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8690
8691         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8692
8693 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8694
8695         * location.cs (ToString): Provide useful rutine.
8696
8697 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8698
8699         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8700         objects, return the actual integral boxed.
8701
8702         * statement.cs (SwitchLabel): define an ILLabel for each
8703         SwitchLabel. 
8704         
8705         (Switch.CheckSwitch): If the value is a Literal, extract
8706         the underlying literal.
8707         
8708         Also in the unused hashtable we had, add the SwitchLabel so we can
8709         quickly look this value up.
8710
8711         * constant.cs: Implement a bunch of new constants.  Rewrite
8712         Literal based on this.  Made changes everywhere to adapt to this.
8713         
8714         * expression.cs (Expression.MakeByteBlob): Optimize routine by
8715         dereferencing array only once, and also copes with enumrations.
8716
8717         bytes are two bytes wide, not one.
8718
8719         (Cast): Perform constant conversions.
8720         
8721         * ecore.cs (TryImplicitIntConversion): Return literals instead of
8722         wrappers to the literals here.
8723
8724         * expression.cs (DoNumericPromotions): long literals can converted
8725         to ulong implicity (this is taken care of elsewhere, but I was
8726         missing this spot).
8727
8728         * ecore.cs (Expression.Literalize): Make the return type Literal,
8729         to improve type checking.
8730
8731         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8732
8733 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8734
8735         * literal.cs: Revert code from ravi that checked the bounds.  The
8736         bounds are sane by the definition of the type itself. 
8737
8738         * typemanager.cs: Fix implementation of ImplementsInterface.  We
8739         need to actually look up in our parent hierarchy for interfaces
8740         implemented. 
8741
8742         * const.cs: Use the underlying type for enumerations
8743
8744         * delegate.cs: Compute the basename for the delegate creation,
8745         that should fix the delegate test case, and restore the correct
8746         Type Lookup semantics in rootcontext
8747
8748         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
8749         referencing a nested type with the Reflection API is using the "+"
8750         sign. 
8751
8752         * cs-parser.jay: Do not require EOF token at the end.
8753
8754 2001-12-20  Ravi Pratap  <ravi@ximian.com>
8755
8756         * rootcontext.cs (LookupType): Concatenate type names with
8757         a '.' instead of a '+' The test suite passes again.
8758
8759         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8760         field of the enumeration.
8761
8762         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8763         the case when the member is an EventExpr.
8764
8765         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8766         static has an associated instance expression.
8767
8768         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8769
8770         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8771
8772         * class.cs (Event.Define): Register event and perform appropriate checks
8773         for error #111.
8774
8775         We define the Add and Remove methods even if the use provides none because
8776         in that case, we provide default implementations ourselves.
8777
8778         Define a private field of the type of the event. This is done by the CSC compiler
8779         and we should be doing it too ;-)
8780
8781         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8782         More methods we use in code we generate.
8783
8784         (multicast_delegate_type, delegate_type): Two separate types since the distinction
8785         is important.
8786
8787         (InitCoreTypes): Update accordingly for the above.
8788
8789         * class.cs (Event.Emit): Generate code for default accessors that we provide
8790
8791         (EmitDefaultMethod): Do the job in the above.
8792
8793         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
8794         appropriate place.
8795
8796 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8797
8798         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8799         builders even if we were missing one.
8800
8801         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8802         pass the Basename as our class name instead of the Name.  The
8803         basename will be correctly composed for us.
8804
8805         * parameter.cs (Paramters): Now takes a Location argument.
8806
8807         * decl.cs (DeclSpace.LookupType): Removed convenience function and
8808         make all the code call directly LookupType in RootContext and take
8809         this chance to pass the Location information everywhere.
8810
8811         * Everywhere: pass Location information.
8812
8813 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
8814
8815         * class.cs (Constructor.Define): Updated way of detecting the
8816         length of the parameters.
8817
8818         (TypeContainer.DefineType): Use basename as the type name for
8819         nested types.
8820
8821         (TypeContainer.Define): Do not recursively define types here, as
8822         definition is taken care in order by the RootContext.
8823
8824         * tree.cs: Keep track of namespaces in a per-file basis.
8825
8826         * parameter.cs (Parameter.ComputeSignature): Update to use
8827         DeclSpace. 
8828
8829         (Parameters.GetSignature): ditto.
8830
8831         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8832         instead of a TypeContainer.
8833
8834         (Interface.SemanticAnalysis): Use `this' instead of our parent to
8835         resolve names.  Because we need to be resolve in our context, not
8836         our parents.
8837         
8838         * driver.cs: Implement response files.
8839
8840         * class.cs (TypeContainer.DefineType): If we are defined, do not
8841         redefine ourselves.
8842         
8843         (Event.Emit): Emit the code for add/remove handlers.
8844         (Event.Define): Save the MethodBuilders for add/remove.
8845
8846         * typemanager.cs: Use pair here too.
8847
8848         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8849         DictionaryEntry requires the first argument to be non-null.  
8850         
8851         (enum_declaration): Compute full name for registering the
8852         enumeration.
8853         
8854         (delegate_declaration): Instead of using
8855         formal_parameter_list, use opt_formal_parameter_list as the list
8856         can be empty.
8857
8858         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8859         (EventParsing): New property that controls whether `add' and
8860         `remove' are returned as tokens or identifiers (for events);
8861
8862 2001-12-19  Ravi Pratap  <ravi@ximian.com>
8863
8864         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8865         use MyEventBuilder only and let it wrap the real builder for us.
8866
8867         (MyEventBuilder): Revamp constructor etc.
8868
8869         Implement all operations that we perform on EventBuilder in precisely the same
8870         way here too.
8871
8872         (FindMembers): Update to use the EventBuilder member.
8873
8874         (Event.Emit): Update accordingly.
8875
8876 2001-12-18  Ravi Pratap  <ravi@ximian.com>
8877
8878         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8879         by calling the appropriate methods.
8880
8881         (GetCustomAttributes): Make stubs as they cannot possibly do anything
8882         useful.
8883
8884         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8885
8886 2001-12-17  Ravi Pratap  <ravi@ximian.com>
8887
8888         * delegate.cs (Delegate.Populate): Check that the return type
8889         and various parameters types are indeed accessible.
8890
8891         * class.cs (Constructor.Define): Same here.
8892
8893         (Field.Define): Ditto.
8894
8895         (Event.Define): Ditto.
8896
8897         (Operator.Define): Check that the underlying Method defined itself
8898         correctly - so it's MethodBuilder should not be null.
8899
8900         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8901         expression happens to be null.
8902
8903         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8904         members but as of now we don't seem to be able to do anything really useful with it.
8905
8906         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8907         not the EventBuilder.
8908
8909 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
8910
8911         * cs-tokenizer.cs: Add support for defines.
8912         Add support for #if, #elif, #else, #endif
8913         
8914         (eval_var): evaluates a variable.
8915         (eval): stubbed for evaluating functions.
8916
8917         * cs-parser.jay: Pass the defines information
8918
8919         * driver.cs: Add --define command line option.
8920
8921         * decl.cs: Move MemberCore here.
8922
8923         Make it the base class for DeclSpace.  This allows us to catch and
8924         report 108 and 109 for everything now.
8925
8926         * class.cs (TypeContainer.Define): Extract all the members
8927         before populating and emit the warning 108 (new keyword required
8928         to override) instead of having each member implement this.
8929
8930         (MemberCore.Define): New abstract method, we will be using this in
8931         the warning reporting engine in Populate.
8932         
8933         (Operator.Define): Adjust to new MemberCore protocol. 
8934
8935         * const.cs (Const): This does not derive from Expression, it is a
8936         temporary object we use to create fields, it is a MemberCore. 
8937
8938         * class.cs (Method.Define): Allow the entry point to be in a
8939         specific class.
8940
8941         * driver.cs: Rewrite the argument handler to clean it up a bit.
8942
8943         * rootcontext.cs: Made it just an auxiliary namespace feature by
8944         making everything static.
8945
8946         * driver.cs: Adapt code to use RootContext type name instead of
8947         instance variable.
8948
8949         * delegate.cs: Remove RootContext argument.
8950
8951         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8952         argument. 
8953
8954         * class.cs (Event.Define): The lookup can fail.
8955         
8956         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
8957
8958         * expression.cs: Resolve the this instance before invoking the code.
8959
8960 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
8961
8962         * cs-parser.jay: Add a production in element_access that allows
8963         the thing to become a "type" reference.  This way we can parse
8964         things like "(string [])" as a type.
8965
8966         Note that this still does not handle the more complex rules of
8967         casts. 
8968         
8969
8970         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
8971
8972         * ecore.cs: (CopyNewMethods): new utility function used to
8973         assemble the list of methods from running FindMembers.
8974
8975         (MemberLookup): Rework FindMembers so that 
8976
8977 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
8978
8979         * class.cs (TypeContainer): Remove Delegates who fail to be
8980         defined.
8981
8982         * delegate.cs (Populate): Verify that we dont get null return
8983         values.   TODO: Check for AsAccessible.
8984
8985         * cs-parser.jay: Use basename to emit error 574 (destructor should
8986         have the same name as container class), not the full name.
8987
8988         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
8989         possible representation.  
8990
8991         Also implements integer type suffixes U and L.
8992
8993 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
8994
8995         * expression.cs (ArrayCreation.DoResolve): We need to do the
8996         argument resolution *always*.
8997
8998         * decl.cs: Make this hold the namespace.  Hold the root context as
8999         well.
9000         (LookupType): Move here.
9001
9002         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
9003
9004         * location.cs (Row, Name): Fixed the code, it was always returning
9005         references to the first file.
9006
9007         * interface.cs: Register properties defined through interfaces.
9008
9009         * driver.cs: Add support for globbing on the command line
9010
9011         * class.cs (Field): Make it derive from MemberCore as well.
9012         (Event): ditto.
9013
9014 2001-12-15  Ravi Pratap  <ravi@ximian.com>
9015
9016         * class.cs (Event::Define): Check that the type of the event is a delegate
9017         type else flag error #66.
9018
9019         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
9020         same.
9021
9022         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
9023         values of EntryPoint, CharSet etc etc.
9024
9025         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
9026
9027         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
9028         be null and we should ignore this. I am not sure if this is really clean. Apparently,
9029         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
9030         which needs this to do its work.
9031
9032         * ../errors/cs0066.cs : Add.
9033
9034 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
9035
9036         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
9037         helper functions.
9038
9039         * class.cs: (MethodSignature.MethodSignature): Removed hack that
9040         clears out the parameters field.
9041         (MemberSignatureCompare): Cleanup
9042
9043         (MemberCore): New base class used to share code between MethodCore
9044         and Property.
9045
9046         (RegisterRequiredImplementations) BindingFlags.Public requires
9047         either BindingFlags.Instace or Static.  Use instance here.
9048
9049         (Property): Refactored code to cope better with the full spec.
9050
9051         * parameter.cs (GetParameterInfo): Return an empty array instead
9052         of null on error.
9053
9054         * class.cs (Property): Abstract or extern properties have no bodies.
9055
9056         * parameter.cs (GetParameterInfo): return a zero-sized array.
9057
9058         * class.cs (TypeContainer.MethodModifiersValid): Move all the
9059         method modifier validation to the typecontainer so we can reuse
9060         this on properties.
9061
9062         (MethodCore.ParameterTypes): return an empty sized array of types.
9063
9064         (Property.Define): Test property modifier validity.
9065
9066         Add tests for sealed/override too.
9067
9068         (Method.Emit): abstract or extern methods have no bodies.
9069
9070 2001-12-14  Ravi Pratap  <ravi@ximian.com>
9071
9072         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
9073         thing.
9074
9075         (Method::Define, ::Emit): Modify accordingly.
9076
9077         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
9078
9079         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
9080
9081         * makefile: Pass in /unsafe.
9082
9083 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
9084
9085         * class.cs (MakeKey): Kill routine.
9086         
9087         * class.cs (TypeContainer.Define): Correctly define explicit
9088         method implementations (they require the full interface name plus
9089         the method name).
9090
9091         * typemanager.cs: Deply the PtrHashtable here and stop using the
9092         lame keys.  Things work so much better.
9093
9094         This of course broke everyone who depended on `RegisterMethod' to
9095         do the `test for existance' test.  This has to be done elsewhere.
9096
9097         * support.cs (PtrHashtable): A hashtable that avoid comparing with
9098         the object stupid Equals method (because, that like fails all over
9099         the place).  We still do not use it.
9100
9101         * class.cs (TypeContainer.SetRequiredInterface,
9102         TypeContainer.RequireMethods): Killed these two routines and moved
9103         all the functionality to RegisterRequiredImplementations.
9104
9105         (TypeContainer.RegisterRequiredImplementations): This routine now
9106         registers all the implementations required in an array for the
9107         interfaces and abstract methods.  We use an array of structures
9108         which can be computed ahead of time to reduce memory usage and we
9109         also assume that lookups are cheap as most classes will not
9110         implement too many interfaces.
9111
9112         We also avoid creating too many MethodSignatures.
9113
9114         (TypeContainer.IsInterfaceMethod): Update and optionally does not
9115         clear the "pending" bit if we find that there are problems with
9116         the declaration.
9117
9118         (TypeContainer.VerifyPendingMethods): Update to report errors of
9119         methods that look like implementations but are not.
9120
9121         (TypeContainer.Define): Add support for explicit interface method
9122         implementation. 
9123         
9124 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
9125
9126         * typemanager.cs: Keep track of the parameters here instead of
9127         being a feature of the TypeContainer.
9128
9129         * class.cs: Drop the registration of parameters here, as
9130         InterfaceMethods are also interface declarations.
9131
9132         * delegate.cs: Register methods with the TypeManager not only with
9133         the TypeContainer.  This code was buggy.
9134
9135         * interface.cs: Full registation here.
9136
9137 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
9138
9139         * expression.cs: Remove reducer for binary expressions, it can not
9140         be done this way.
9141
9142         * const.cs: Put here the code that used to go into constant.cs
9143
9144         * constant.cs: Put here the code for constants, this is a new base
9145         class for Literals.
9146
9147         * literal.cs: Make Literal derive from Constant.
9148
9149 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
9150
9151         * statement.cs (Return.Emit): Report error 157 if the user
9152         attempts to return from a finally block.
9153
9154         (Return.Emit): Instead of emitting a return, jump to the end of
9155         the function.
9156
9157         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9158         LocalBuilder to store the result of the function.  ReturnLabel is
9159         the target where we jump.
9160         
9161
9162 2001-12-09  Radek Doulik  <rodo@ximian.com>
9163
9164         * cs-parser.jay: remember alias in current namespace
9165
9166         * ecore.cs (SimpleName::DoResolve): use aliases for types or
9167         namespaces
9168
9169         * class.cs (LookupAlias): lookup alias in my_namespace
9170
9171         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9172         aliases hashtable
9173         (LookupAlias): lookup alias in this and if needed in parent
9174         namespaces
9175
9176 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
9177
9178         * support.cs: 
9179
9180         * rootcontext.cs: (ModuleBuilder) Made static, first step into
9181         making things static.  I need this to avoid passing the
9182         TypeContainer when calling ParameterType.
9183
9184         * support.cs (InternalParameters.ParameterType): Remove ugly hack
9185         that did string manipulation to compute the type and then call
9186         GetType.  Use Parameter.ParameterType instead.
9187
9188         * cs-tokenizer.cs: Consume the suffix for floating values.
9189
9190         * expression.cs (ParameterReference): figure out whether this is a
9191         reference parameter or not.  Kill an extra variable by computing
9192         the arg_idx during emission.
9193
9194         * parameter.cs (Parameters.GetParameterInfo): New overloaded
9195         function that returns whether a parameter is an out/ref value or not.
9196
9197         (Parameter.ParameterType): The type of the parameter (base,
9198         without ref/out applied).
9199         
9200         (Parameter.Resolve): Perform resolution here.
9201         (Parameter.ExternalType): The full type (with ref/out applied).
9202
9203         * statement.cs (Using.Emit, Using.EmitExpression): Implement
9204         support for expressions on the using statement.
9205
9206 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
9207
9208         * statement.cs (Using.EmitLocalVariableDecls): Split the
9209         localvariable handling of the using statement.
9210
9211         (Block.EmitMeta): Keep track of variable count across blocks.  We
9212         were reusing slots on separate branches of blocks.
9213
9214         (Try.Emit): Emit the general code block, we were not emitting it. 
9215
9216         Check the type of the declaration to be an IDisposable or
9217         something that can be implicity converted to it. 
9218
9219         Emit conversions if required.
9220
9221         * ecore.cs (EmptyExpression): New utility class.
9222         (Expression.ImplicitConversionExists): New utility function.
9223
9224 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
9225
9226         * statement.cs (Using): Implement.
9227
9228         * expression.cs (LocalVariableReference): Support read only variables.
9229
9230         * statement.cs: Remove the explicit emit for the Leave opcode.
9231         (VariableInfo): Add a readonly field.
9232
9233 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
9234
9235         * ecore.cs (ConvCast): new class used to encapsulate the various
9236         explicit integer conversions that works in both checked and
9237         unchecked contexts.
9238
9239         (Expression.ConvertNumericExplicit): Use new ConvCast class to
9240         properly generate the overflow opcodes.
9241
9242 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9243
9244         * statement.cs: The correct type for the EmptyExpression is the
9245         element_type, not the variable type.  Ravi pointed this out.
9246
9247 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9248
9249         * class.cs (Method::Define): Handle PInvoke methods specially
9250         by using DefinePInvokeMethod instead of the usual one.
9251
9252         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9253         above to do the task of extracting information and defining the method.
9254         
9255 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9256
9257         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9258         of the condition for string type.
9259
9260         (Emit): Move that here. 
9261
9262         (ArrayCreation::CheckIndices): Keep string literals in their expression
9263         form.
9264
9265         (EmitDynamicInitializers): Handle strings appropriately.
9266
9267 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9268
9269         * codegen.cs (EmitContext): Replace multiple variables with a
9270         single pointer to the current Switch statement.
9271
9272         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9273         EmitContext.
9274
9275 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9276
9277         * statement.cs 
9278
9279         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9280         default'.
9281         
9282         (Foreach.Emit): Foreach on arrays was not setting
9283         up the loop variables (for break/continue).
9284
9285         (GotoCase): Semi-implented.
9286         
9287 2001-12-03  Ravi Pratap  <ravi@ximian.com>
9288
9289         * attribute.cs (CheckAttribute): Handle system attributes by using
9290         Attribute.GetAttributes to examine information we need.
9291
9292         (GetValidPlaces): Same here.
9293
9294         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9295
9296         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9297
9298         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9299
9300         (Method::Define): Set appropriate flags if we have a DllImport attribute.
9301
9302         (Method::Emit): Handle the case when we are a PInvoke method.
9303
9304 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9305
9306         * expression.cs: Use ResolveWithSimpleName on compound names.
9307
9308 2001-12-02  Ravi Pratap  <ravi@ximian.com>
9309
9310         * constant.cs (EmitConstant): Make sure we resolve the associated expression
9311         before trying to reduce it.
9312
9313         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9314
9315         * constant.cs (LookupConstantValue): Implement.
9316
9317         (EmitConstant): Use the above in emitting the constant.
9318
9319         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9320         that are user-defined by doing a LookupConstantValue on them.
9321
9322         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9323         too, like above.
9324
9325 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
9326
9327         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9328
9329         (BaseAccess.DoResolve): Implement.
9330
9331         (MemberAccess.DoResolve): Split this routine into a
9332         ResolveMemberAccess routine that can be used independently
9333
9334 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
9335
9336         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9337         As that share bits of the implementation.  Is returns a boolean,
9338         while As returns the Type that is being probed.
9339
9340 2001-12-01  Ravi Pratap  <ravi@ximian.com>
9341
9342         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9343         instead of a Literal - much easier.
9344
9345         (EnumInTransit): Remove - utterly useless :-)
9346
9347         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9348
9349         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9350
9351         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9352         chain when we have no associated expression.
9353
9354 2001-11-30  Ravi Pratap  <ravi@ximian.com>
9355
9356         * constant.cs (Define): Use Location while reporting the errror.
9357
9358         Also emit a warning when 'new' is used and there is no inherited
9359         member to hide.
9360
9361         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
9362         populated.
9363
9364         (LookupEnumValue): Implement to lookup an enum member's value and define it
9365         if necessary.
9366
9367         (Populate): Re-write accordingly to use the above routine.
9368
9369 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
9370
9371         * expression.cs (This): Fix prototype for DoResolveLValue to
9372         override the base class DoResolveLValue.
9373
9374         * cs-parser.cs: Report errors cs574 and cs575 (destructor
9375         declarations) 
9376
9377         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9378         (we need to load the address of the field here).  This fixes
9379         test-22. 
9380         
9381         (FieldExpr.DoResolveLValue): Call the DoResolve
9382         function to initialize the Instance expression.
9383         
9384         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9385         correctly the GetEnumerator operation on a value type.
9386
9387         * cs-parser.jay: Add more simple parsing error catches.
9388
9389         * statement.cs (Switch): Add support for string switches.
9390         Handle null specially.
9391
9392         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
9393
9394 2001-11-28  Ravi Pratap  <ravi@ximian.com>
9395
9396         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9397
9398         (declare_local_constant): New helper function.
9399
9400         * statement.cs (AddConstant): Keep a separate record of constants
9401
9402         (IsConstant): Implement to determine if a variable is a constant.
9403
9404         (GetConstantExpression): Implement.
9405
9406         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9407
9408         * statement.cs (IsVariableDefined): Re-write.
9409
9410 2001-11-27  Ravi Pratap  <ravi@ximian.com>
9411
9412         * class.cs (TypeContainer::FindMembers): Look for constants
9413         in the case when we are looking for MemberTypes.Field
9414
9415         * expression.cs (MemberAccess::DoResolve): Check that in the
9416         case we are a FieldExpr and a Literal, we are not being accessed
9417         by an instance reference.
9418
9419         * cs-parser.jay (local_constant_declaration): Implement.
9420
9421         (declaration_statement): Implement for constant declarations.
9422
9423 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
9424
9425         * statement.cs (Switch): Catch double defaults.
9426
9427         (Switch): More work on the switch() statement
9428         implementation.  It works for integral values now, need to finish
9429         string support.
9430
9431
9432 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9433
9434         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9435         integer literals into other integer literals.  To be used by
9436         switch. 
9437
9438 2001-11-24  Ravi Pratap  <ravi@ximian.com>
9439
9440         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9441         some memory.
9442
9443         (EmitDynamicInitializers): Cope with the above since we extract data
9444         directly from ArrayData now.
9445
9446         (ExpectInitializers): Keep track of whether initializers are mandatory
9447         or not.
9448
9449         (Bounds): Make it a hashtable to prevent the same dimension being 
9450         recorded for every element in that dimension.
9451
9452         (EmitDynamicInitializers): Fix bug which prevented the Set array method
9453         from being found.
9454
9455         Also fix bug which was causing the indices to be emitted in the reverse
9456         order.
9457
9458 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9459
9460         * expression.cs (ArrayCreation): Implement the bits that Ravi left
9461         unfinished.  They do not work, because the underlying code is
9462         sloppy.
9463
9464 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9465
9466         * cs-parser.jay: Remove bogus fixme.
9467
9468         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9469         on Switch statement.
9470         
9471 2001-11-23  Ravi Pratap  <ravi@ximian.com>
9472
9473         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9474         the same. 
9475         
9476         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9477         parameter. Apparently, any expression is allowed. 
9478
9479         (ValidateInitializers): Update accordingly.
9480
9481         (CheckIndices): Fix some tricky bugs thanks to recursion.
9482
9483         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
9484         I was being completely brain-dead.
9485
9486         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9487         and re-write acordingly.
9488
9489         (DelegateInvocation): Re-write accordingly.
9490
9491         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9492
9493         (MakeByteBlob): Handle types more correctly.
9494
9495         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9496         initialization from expressions but it is incomplete because I am a complete
9497         Dodo :-|
9498
9499 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9500
9501         * statement.cs (If.Emit): Fix a bug that generated incorrect code
9502         on If.  Basically, we have to return `true' (ie, we do return to
9503         our caller) only if both branches of the if return.
9504
9505         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9506         short-circuit operators, handle them as short circuit operators. 
9507
9508         (Cast.DoResolve): Resolve type.
9509         (Cast.Cast): Take an expression as the target type.
9510
9511         * cs-parser.jay (cast_expression): Remove old hack that only
9512         allowed a limited set of types to be handled.  Now we take a
9513         unary_expression and we resolve to a type during semantic
9514         analysis.
9515
9516         Use the grammar productions from Rhys to handle casts (this is
9517         not complete like Rhys syntax yet, we fail to handle that corner
9518         case that C# has regarding (-x), but we will get there.
9519         
9520 2001-11-22  Ravi Pratap  <ravi@ximian.com>
9521
9522         * class.cs (EmitFieldInitializer): Take care of the case when we have a
9523         field which is an array type.
9524
9525         * cs-parser.jay (declare_local_variables): Support array initialization too.
9526
9527         * typemanager.cs (MakeKey): Implement.
9528
9529         (everywhere): Use the above appropriately.
9530
9531         * cs-parser.jay (for_statement): Update for array initialization while
9532         declaring variables.
9533
9534         * ecore.cs : The error message was correct, it's the variable's names that
9535         were misleading ;-) Make the code more readable.
9536
9537         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9538         the correct type etc.
9539
9540         (ConvertExplicit): Handle Enum types by examining the underlying type.
9541
9542 2001-11-21  Ravi Pratap  <ravi@ximian.com>
9543
9544         * parameter.cs (GetCallingConvention): Always return
9545         CallingConventions.Standard for now.
9546
9547 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9548
9549         * expression.cs (Binary.ResolveOperator): Update the values of `l'
9550         and `r' after calling DoNumericPromotions.
9551
9552         * ecore.cs: Fix error message (the types were in the wrong order).
9553
9554         * statement.cs (Foreach.ProbeCollectionType): Need to pass
9555         BindingFlags.Instance as well 
9556
9557         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9558         implicit int literal conversion in an empty cast so that we
9559         propagate the right type upstream.
9560
9561         (UnboxCast): new class used to unbox value types.
9562         (Expression.ConvertExplicit): Add explicit type conversions done
9563         by unboxing.
9564
9565         (Expression.ImplicitNumericConversion): Oops, forgot to test for
9566         the target type before applying the implicit LongLiterals to ULong
9567         literal cast.
9568
9569 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
9570
9571         * cs-parser.jay (for_statement): Reworked the way For works: now
9572         we declare manually any variables that are introduced in
9573         for_initializer to solve the problem of having out-of-band code
9574         emition (that is what got for broken).
9575
9576         (declaration_statement): Perform the actual variable declaration
9577         that used to be done in local_variable_declaration here.
9578
9579         (local_variable_declaration): Do not declare anything, just pass
9580         the information on a DictionaryEntry
9581
9582 2001-11-20  Ravi Pratap  <ravi@ximian.com>
9583
9584         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9585         re-write of the logic to now make it recursive.
9586
9587         (UpdateIndices): Re-write accordingly.
9588
9589         Store element data in a separate ArrayData list in the above methods.
9590
9591         (MakeByteBlob): Implement to dump the array data into a byte array.
9592
9593 2001-11-19  Ravi Pratap  <ravi@ximian.com>
9594
9595         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9596         into CheckIndices.
9597
9598         * constant.cs (Define): Implement.
9599
9600         (EmitConstant): Re-write fully.
9601
9602         Pass in location info.
9603
9604         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9605         respectively.
9606
9607         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9608         DictionaryEntry since we need location info too.
9609
9610         (constant_declaration): Update accordingly.
9611
9612         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9613         code into another method : UpdateIndices.
9614
9615 2001-11-18  Ravi Pratap  <ravi@ximian.com>
9616
9617         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9618         some type checking etc.
9619
9620 2001-11-17  Ravi Pratap  <ravi@ximian.com>
9621
9622         * expression.cs (ArrayCreation::ValidateInitializers): Implement
9623         bits to provide dimension info if the user skips doing that.
9624
9625         Update second constructor to store the rank correctly.
9626
9627 2001-11-16  Ravi Pratap  <ravi@ximian.com>
9628
9629         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9630         and try to implement.
9631
9632         * ../errors/cs0150.cs : Add.
9633
9634         * ../errors/cs0178.cs : Add.
9635
9636 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
9637
9638         * statement.cs: Implement foreach on multi-dimensional arrays. 
9639
9640         * parameter.cs (Parameters.GetParameterByName): Also lookup the
9641         name of the params argument.
9642
9643         * expression.cs: Use EmitStoreOpcode to get the right opcode while
9644         initializing the array.
9645
9646         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9647         we can use this elsewhere.
9648
9649         * statement.cs: Finish implementation of foreach for single
9650         dimension arrays.
9651
9652         * cs-parser.jay: Use an out-of-band stack to pass information
9653         around, I wonder why I need this.
9654
9655         foreach_block: Make the new foreach_block the current_block.
9656
9657         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9658         function used to return a static Parameters structure.  Used for
9659         empty parameters, as those are created very frequently.
9660
9661         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9662
9663 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9664
9665         * interface.cs : Default modifier is private, not public. The
9666         make verify test passes again.
9667
9668 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9669
9670         * support.cs (ReflectionParameters): Fix logic to determine
9671         whether the last parameter is a params one. Test 9 passes again.
9672
9673         * delegate.cs (Populate): Register the builders we define with
9674         RegisterParameterForBuilder. Test 19 passes again.
9675
9676         * cs-parser.jay (property_declaration): Reference $6 instead
9677         of $$ to get at the location.
9678
9679         (indexer_declaration): Similar stuff.
9680
9681         (attribute): Ditto.
9682
9683         * class.cs (Property): Register parameters for the Get and Set methods
9684         if they exist. Test 23 passes again.
9685
9686         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9687         call to EmitArguments as we are sure there aren't any params arguments. 
9688         Test 32 passes again.
9689
9690         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9691         IndexOutOfRangeException. 
9692
9693         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9694         Test 33 now passes again.
9695         
9696 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
9697
9698         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9699         broke a bunch of things.  Will have to come up with a better way
9700         of tracking locations.
9701
9702         * statement.cs: Implemented foreach for single dimension arrays.
9703
9704 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9705
9706         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9707         an error.  This removes the lookup from the critical path.
9708
9709         * cs-parser.jay: Removed use of temporary_loc, which is completely
9710         broken. 
9711
9712 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
9713
9714         * support.cs (ReflectionParameters.ParameterModifier): Report
9715         whether the argument is a PARAMS argument or not.
9716
9717         * class.cs: Set the attribute `ParamArrayAttribute' on the
9718         parameter argument.
9719
9720         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9721         and cons_param_array_attribute (ConstructorInfo for
9722         ParamArrayAttribute)., 
9723
9724         * codegen.cs: Emit the return using the `Return' statement, that
9725         way we can report the error correctly for missing return values. 
9726
9727         * class.cs (Method.Emit): Clean up.
9728
9729         * expression.cs (Argument.Resolve): Take another argument: the
9730         location where this argument is used.  Notice that this is not
9731         part of the "Argument" class as to reduce the size of the
9732         structure (we know the approximate location anyways).
9733
9734         Test if the argument is a variable-reference, if not, then
9735         complain with a 206.
9736
9737         (Argument.Emit): Emit addresses of variables.
9738
9739         (Argument.FullDesc): Simplify.
9740
9741         (Invocation.DoResolve): Update for Argument.Resolve.
9742
9743         (ElementAccess.DoResolve): ditto.
9744
9745         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9746         method should be virtual, as this method is always virtual.
9747
9748         (NewDelegate.DoResolve): Update for Argument.Resolve.
9749
9750         * class.cs (ConstructorInitializer.DoResolve): ditto.
9751         
9752         * attribute.cs (Attribute.Resolve): ditto.
9753
9754 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
9755
9756         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9757
9758         * expression.cs (ParameterReference): Drop IStackStorage and implement
9759         IAssignMethod instead. 
9760
9761         (LocalVariableReference): ditto.
9762         
9763         * ecore.cs (FieldExpr): Drop IStackStorage and implement
9764         IAssignMethod instead. 
9765
9766 2001-11-13  Miguel de Icaza <miguel@ximian.com>
9767
9768         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9769         enumerations that are used in heavily used structures derive from
9770         byte in a laughable and pathetic attempt to reduce memory usage.
9771         This is the kind of pre-optimzations that you should not do at
9772         home without adult supervision.
9773
9774         * expression.cs (UnaryMutator): New class, used to handle ++ and
9775         -- separatedly from the other unary operators.  Cleans up the
9776         code, and kills the ExpressionStatement dependency in Unary.
9777
9778         (Unary): Removed `method' and `Arguments' from this class, making
9779         it smaller, and moving it all to SimpleCall, so I can reuse this
9780         code in other locations and avoid creating a lot of transient data
9781         strucutres when not required.
9782
9783         * cs-parser.jay: Adjust for new changes.
9784
9785 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
9786
9787         * enum.cs (Enum.Populate): If there is a failure during
9788         definition, return
9789
9790         * cs-parser.jay (opt_enum_base): we used to catch type errors
9791         here, but this is really incorrect.  The type error should be
9792         catched during semantic analysis.
9793
9794 2001-12-11  Ravi Pratap  <ravi@ximian.com>
9795
9796         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9797         current_local_parameters as expected since I, in my stupidity, had forgotten
9798         to do this :-)
9799
9800         * attribute.cs (GetValidPlaces): Fix stupid bug.
9801
9802         * class.cs (Method::Emit): Perform check on applicability of attributes.
9803
9804         (Constructor::Emit): Ditto.
9805
9806         (Field::Emit): Ditto.
9807
9808         (Field.Location): Store location information.
9809
9810         (Property, Event, Indexer, Operator): Ditto.
9811
9812         * cs-parser.jay (field_declaration): Pass in location for each field.
9813
9814         * ../errors/cs0592.cs : Add.
9815
9816 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9817
9818         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9819
9820         (InitCoreTypes): Update accordingly.
9821
9822         (RegisterAttrType, LookupAttr): Implement.
9823
9824         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9825         info about the same.
9826
9827         (Resolve): Update to populate the above as necessary.
9828
9829         (Error592): Helper.
9830
9831         (GetValidPlaces): Helper to the above.
9832
9833         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9834
9835         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9836
9837 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9838
9839         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9840
9841         * ../errors/cs0617.cs : Add.
9842
9843 2001-11-11  Ravi Pratap  <ravi@ximian.com>
9844
9845         * enum.cs (Emit): Rename to Populate to be more consistent with what
9846         we expect it to do and when exactly it is called.
9847
9848         * class.cs, rootcontext.cs : Update accordingly.
9849
9850         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9851         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9852
9853         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9854
9855         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9856         of a fieldinfo using the above, when dealing with a FieldBuilder.
9857
9858 2001-11-10  Ravi Pratap  <ravi@ximian.com>
9859
9860         * ../errors/cs0031.cs : Add.
9861
9862         * ../errors/cs1008.cs : Add.
9863
9864         * ../errrors/cs0543.cs : Add.
9865
9866         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9867         enum type.
9868
9869         (FindMembers): Implement.
9870
9871         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9872         enums and delegates too.
9873
9874         (enum_types): Rename to builder_to_enum.
9875
9876         (delegate_types): Rename to builder_to_delegate.
9877
9878         * delegate.cs (FindMembers): Implement.
9879
9880 2001-11-09  Ravi Pratap  <ravi@ximian.com>
9881
9882         * typemanager.cs (IsEnumType): Implement.
9883
9884         * enum.cs (Emit): Re-write parts to account for the underlying type
9885         better and perform checking etc.
9886
9887         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9888         of the underlying type.
9889
9890         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9891         value
9892
9893         * enum.cs (error31): Helper to report error #31.
9894
9895         * cs-parser.jay (enum_declaration): Store location of each member too.
9896
9897         * enum.cs (member_to_location): New hashtable. 
9898
9899         (AddEnumMember): Update location hashtable.
9900
9901         (Emit): Use the location of each member while reporting errors.
9902
9903 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9904
9905         * cs-parser.jay: A for_initializer if is a
9906         local_variable_declaration really ammount to have an implicit
9907         block with the variable declaration and no initializer for for.
9908
9909         * statement.cs (For.Emit): Cope with null initializers.
9910
9911         This fixes the infinite loop on for initializers.
9912
9913 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
9914
9915         * enum.cs: More cleanup.
9916
9917         * ecore.cs: Remove dead code.
9918
9919         * class.cs (Property.Emit): More simplification.
9920         (Event.Emit): ditto.
9921
9922         Reworked to have less levels of indentation.
9923         
9924 2001-11-08  Ravi Pratap  <ravi@ximian.com>
9925
9926         * class.cs (Property): Emit attributes.
9927
9928         (Field): Ditto.
9929         
9930         (Event): Ditto.
9931
9932         (Indexer): Ditto.
9933
9934         (Operator): Ditto.
9935
9936         * enum.cs (Emit): Ditto.
9937
9938         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9939         Enums too.
9940
9941         * class.cs (Field, Event, etc.): Move attribute generation into the
9942         Emit method everywhere.
9943
9944         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9945         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9946         as we had no way of defining nested enums !
9947
9948         * rootcontext.cs : Adjust code accordingly.
9949
9950         * typemanager.cs (AddEnumType): To keep track of enum types separately.
9951
9952 2001-11-07  Ravi Pratap  <ravi@ximian.com>
9953
9954         * expression.cs (EvalConstantExpression): Move into ecore.cs
9955         
9956         * enum.cs (Enum): Rename some members and make them public and readonly
9957         according to our convention.
9958
9959         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9960         nothing else.
9961
9962         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9963
9964         (Enum::Emit): Write a simple version for now which doesn't try to compute
9965         expressions. I shall modify this to be more robust in just a while.
9966
9967         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9968
9969         (TypeContainer::CloseType): Create the Enum types too.
9970
9971         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9972
9973         * expression.cs (EvalConstantExpression): Get rid of completely.
9974
9975         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9976         user-defined values and other cases.
9977
9978         (IsValidEnumLiteral): Helper function.
9979
9980         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
9981         out there in the case we had a literal FieldExpr.
9982
9983         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9984
9985         (Literalize): Revamp a bit to take two arguments.
9986         
9987         (EnumLiteral): New class which derives from Literal to wrap enum literals.
9988         
9989 2001-11-06  Ravi Pratap  <ravi@ximian.com>
9990
9991         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
9992
9993         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
9994
9995         (Resolve): Use the above to ensure we have proper initializers.
9996
9997 2001-11-05  Ravi Pratap  <ravi@ximian.com>
9998
9999         * expression.cs (Expression::EvalConstantExpression): New method to 
10000         evaluate constant expressions.
10001
10002         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
10003
10004 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
10005
10006         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
10007         in an array.
10008
10009         (Binary.ResolveOperator): Handle operator != (object a, object b)
10010         and operator == (object a, object b);
10011
10012         (Binary.DoNumericPromotions): Indicate whether the numeric
10013         promotion was possible.
10014
10015         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
10016         Implement.  
10017
10018         Made the ArrayAccess implement interface IAssignMethod instead of
10019         IStackStore as the order in which arguments are passed reflects
10020         this.
10021
10022         * assign.cs: Instead of using expr.ExprClass to select the way of
10023         assinging, probe for the IStackStore/IAssignMethod interfaces.
10024
10025         * typemanager.cs: Load InitializeArray definition.
10026
10027         * rootcontext.cs (RootContext.MakeStaticData): Used to define
10028         static data that can be used to initialize arrays. 
10029
10030 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
10031
10032         * expression.cs: Handle operator== and operator!= for booleans.
10033
10034         (Conditioal.Reduce): Implement reducer for the ?: operator.
10035
10036         (Conditional.Resolve): Implement dead code elimination.
10037
10038         (Binary.Resolve): Catch string literals and return a new
10039         concatenated string.
10040
10041         (Unary.Reduce): Implement reduction of unary expressions.
10042
10043         * ecore.cs: Split out the expression core handling here.
10044
10045         (Expression.Reduce): New method used to perform constant folding
10046         and CSE.  This is needed to support constant-expressions. 
10047         
10048         * statement.cs (Statement.EmitBoolExpression): Pass true and false
10049         targets, and optimize for !x.
10050
10051 2001-11-04  Ravi Pratap  <ravi@ximian.com>
10052
10053         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
10054         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
10055         set custom atttributes.
10056
10057         * literal.cs (Literal::GetValue): New abstract method to return the actual
10058         value of the literal, cast as an object.
10059
10060         (*Literal): Implement GetValue method.
10061
10062         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
10063         expressions to the arraylist but objects of type Argument.
10064
10065         * class.cs (TypeContainer::Emit): Emit our attributes too.
10066
10067         (Method::Emit, Constructor::Emit): Ditto.
10068
10069         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
10070         to be ignoring earlier.
10071
10072 2001-11-03  Ravi Pratap  <ravi@ximian.com>
10073
10074         * attribute.cs (AttributeSection::Define): Implement to do the business
10075         of constructing a CustomAttributeBuilder.
10076
10077         (Attribute): New trivial class. Increases readability of code.  
10078
10079         * cs-parser.jay : Update accordingly.
10080
10081         (positional_argument_list, named_argument_list, named_argument): New rules
10082
10083         (attribute_arguments): Use the above so that we are more correct.
10084         
10085 2001-11-02  Ravi Pratap  <ravi@ximian.com>
10086         
10087         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
10088         to perform all checks for a method with a params parameter.
10089
10090         (Invocation::OverloadResolve): Update to use the above method and therefore
10091         cope correctly with params method invocations.
10092
10093         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
10094         params too.
10095
10096         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
10097         constructors in our parent too because we can't afford to miss out on 
10098         protected ones ;-)
10099
10100         * attribute.cs (AttributeSection): New name for the class Attribute
10101
10102         Other trivial changes to improve readability.
10103
10104         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10105         use the new class names.
10106         
10107 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10108
10109         * class.cs (Method::Define): Complete definition for params types too
10110
10111         (Indexer::Define): Ditto.
10112
10113         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10114         Cope everywhere with a request for info about the array parameter.
10115
10116 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10117
10118         * tree.cs (RecordNamespace): Fix up to check for the correct key.
10119
10120         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
10121         local_variable_type to extract the string corresponding to the type.
10122
10123         (local_variable_type): Fixup the action to use the new helper method.
10124
10125         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
10126         go.
10127
10128         * expression.cs : Clean out code which uses the above.
10129
10130 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10131         
10132         * typemanager.cs (RegisterMethod): Check if we already have an existing key
10133         and bale out if necessary by returning a false.
10134
10135         (RegisterProperty): Ditto.
10136
10137         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10138         and print out appropriate error messages.
10139
10140         * interface.cs (everywhere): Ditto.
10141
10142         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10143         location to constructor.
10144
10145         * class.cs (Property, Event, Indexer): Update accordingly.
10146
10147         * ../errors/cs111.cs : Added.
10148
10149         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10150         of a method, as laid down by the spec.
10151
10152         (Invocation::OverloadResolve): Use the above method.
10153
10154 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10155
10156         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10157         now take a TypeContainer and a Parameters object.
10158
10159         (ParameterData): Modify return type of ParameterModifier method to be 
10160         Parameter.Modifier and not a string.
10161
10162         (ReflectionParameters, InternalParameters): Update accordingly.
10163
10164         * expression.cs (Argument::GetParameterModifier): Same here.
10165
10166         * support.cs (InternalParameters::ParameterType): Find a better way of determining
10167         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10168         symbol in it at all so maybe this is only for now.
10169
10170 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10171
10172         * support.cs (InternalParameters): Constructor now takes an extra argument 
10173         which is the actual Parameters class.
10174
10175         (ParameterDesc): Update to provide info on ref/out modifiers.
10176
10177         * class.cs (everywhere): Update call to InternalParameters to pass in
10178         the second argument too.
10179
10180         * support.cs (ParameterData): Add ParameterModifier, which is a method 
10181         to return the modifier info [ref/out etc]
10182
10183         (InternalParameters, ReflectionParameters): Implement the above.
10184
10185         * expression.cs (Argument::ParameterModifier): Similar function to return
10186         info about the argument's modifiers.
10187
10188         (Invocation::OverloadResolve): Update to take into account matching modifiers 
10189         too.
10190
10191         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10192         a new SetFormalParameters object which we pass to InternalParameters.
10193
10194 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10195
10196         * expression.cs (NewArray): Merge into the ArrayCreation class.
10197
10198 2001-10-29  Ravi Pratap  <ravi@ximian.com>
10199
10200         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
10201         NewUserdefinedArray into one as there wasn't much of a use in having
10202         two separate ones.
10203
10204         * expression.cs (Argument): Change field's name to ArgType from Type.
10205
10206         (Type): New readonly property which returns the proper type, taking into 
10207         account ref/out modifiers.
10208
10209         (everywhere): Adjust code accordingly for the above.
10210
10211         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
10212         whether we are emitting for a ref or out parameter.
10213
10214         * expression.cs (Argument::Emit): Use the above field to set the state.
10215
10216         (LocalVariableReference::Emit): Update to honour the flag and emit the
10217         right stuff.
10218
10219         * parameter.cs (Attributes): Set the correct flags for ref parameters.
10220
10221         * expression.cs (Argument::FullDesc): New function to provide a full desc.
10222
10223         * support.cs (ParameterData): Add method ParameterDesc to the interface.
10224
10225         (ReflectionParameters, InternalParameters): Implement the above method.
10226
10227         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10228         reporting errors.
10229
10230         (Invocation::FullMethodDesc): Ditto. 
10231
10232 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
10233
10234         * cs-parser.jay: Add extra production for the second form of array
10235         creation. 
10236
10237         * expression.cs (ArrayCreation): Update to reflect the above
10238         change. 
10239
10240         * Small changes to prepare for Array initialization.
10241
10242 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
10243
10244         * typemanager.cs (ImplementsInterface): interface might be null;
10245         Deal with this problem;
10246
10247         Also, we do store negative hits on the cache (null values), so use
10248         this instead of calling t.GetInterfaces on the type everytime.
10249
10250 2001-10-28  Ravi Pratap  <ravi@ximian.com>
10251
10252         * typemanager.cs (IsBuiltinType): New method to help determine the same.
10253
10254         * expression.cs (New::DoResolve): Get rid of array creation code and instead
10255         split functionality out into different classes.
10256
10257         (New::FormArrayType): Move into NewBuiltinArray.
10258
10259         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10260         quite useless.
10261
10262         (NewBuiltinArray): New class to handle creation of built-in arrays.
10263
10264         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10265         account creation of one-dimensional arrays.
10266
10267         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10268
10269         (NewUserdefinedArray::DoResolve): Implement.
10270
10271         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10272
10273         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10274         we maintain inside the TypeManager. This is necessary to perform lookups on the
10275         module builder.
10276
10277         (LookupType): Update to perform GetType on the module builders too.     
10278
10279         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10280
10281         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10282
10283 2001-10-23  Ravi Pratap  <ravi@ximian.com>
10284
10285         * expression.cs (New::DoResolve): Implement guts of array creation.
10286
10287         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10288         
10289 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
10290
10291         * expression.cs: Fix bug I introduced lsat night that broke
10292         Delegates. 
10293
10294         (Expression.Resolve): Report a 246 error (can not resolve name)
10295         if we find a SimpleName in the stream.
10296         
10297         (Expression.ResolveLValue): Ditto.
10298         
10299         (Expression.ResolveWithSimpleName): This function is a variant of
10300         ResolveName, this one allows SimpleNames to be returned without a
10301         warning.  The only consumer of SimpleNames is MemberAccess
10302
10303 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
10304
10305         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10306         might arrive here.  I have my doubts that this is correct.
10307
10308         * statement.cs (Lock): Implement lock statement.
10309
10310         * cs-parser.jay: Small fixes to support `lock' and `using'
10311
10312         * cs-tokenizer.cs: Remove extra space
10313
10314         * driver.cs: New flag --checked, allows to turn on integer math
10315         checking. 
10316
10317         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10318         Threading.Monitor.Exit 
10319         
10320 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
10321
10322         * expression.cs (IndexerAccess::DoResolveLValue): Set the
10323         Expression Class to be IndexerAccess.
10324
10325         Notice that Indexer::DoResolve sets the eclass to Value.
10326
10327 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
10328
10329         * class.cs (TypeContainer::Emit): Emit code for indexers.
10330
10331         * assign.cs (IAssignMethod): New interface implemented by Indexers
10332         and Properties for handling assignment.
10333
10334         (Assign::Emit): Simplify and reuse code. 
10335         
10336         * expression.cs (IndexerAccess, PropertyExpr): Implement
10337         IAssignMethod, clean up old code. 
10338
10339 2001-10-22  Ravi Pratap  <ravi@ximian.com>
10340
10341         * typemanager.cs (ImplementsInterface): New method to determine if a type
10342         implements a given interface. Provides a nice cache too.
10343
10344         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10345         method.
10346
10347         (ConvertReferenceExplicit): Ditto.
10348
10349         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
10350         various methods, with correct names etc.
10351
10352         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
10353         Operator.UnaryNegation.
10354
10355         * cs-parser.jay (operator_declarator): Be a little clever in the case where
10356         we have a unary plus or minus operator.
10357
10358         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
10359         UnaryMinus.
10360
10361         * everywhere : update accordingly.
10362
10363         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10364         respectively.
10365
10366         * class.cs (Method::Define): For the case where we are implementing a method
10367         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
10368         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10369         
10370 2001-10-21  Ravi Pratap  <ravi@ximian.com>
10371
10372         * interface.cs (FindMembers): Implement to work around S.R.E
10373         lameness.
10374
10375         * typemanager.cs (IsInterfaceType): Implement.
10376
10377         (FindMembers): Update to handle interface types too.
10378
10379         * expression.cs (ImplicitReferenceConversion): Re-write bits which
10380         use IsAssignableFrom as that is not correct - it doesn't work.
10381
10382         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10383         and accordingly override EmitStatement.
10384
10385         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10386         using the correct logic :-)
10387
10388 2001-10-19  Ravi Pratap  <ravi@ximian.com>
10389
10390         * ../errors/cs-11.cs : Add to demonstrate error -11 
10391
10392 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
10393
10394         * assign.cs (Assign::Resolve): Resolve right hand side first, and
10395         then pass this as a hint to ResolveLValue.
10396         
10397         * expression.cs (FieldExpr): Add Location information
10398
10399         (FieldExpr::LValueResolve): Report assignment to readonly
10400         variable. 
10401         
10402         (Expression::ExprClassFromMemberInfo): Pass location information.
10403
10404         (Expression::ResolveLValue): Add new method that resolves an
10405         LValue. 
10406
10407         (Expression::DoResolveLValue): Default invocation calls
10408         DoResolve. 
10409
10410         (Indexers): New class used to keep track of indexers in a given
10411         Type. 
10412
10413         (IStackStore): Renamed from LValue, as it did not really describe
10414         what this did.  Also ResolveLValue is gone from this interface and
10415         now is part of Expression.
10416
10417         (ElementAccess): Depending on the element access type
10418         
10419         * typemanager.cs: Add `indexer_name_type' as a Core type
10420         (System.Runtime.CompilerServices.IndexerNameAttribute)
10421
10422         * statement.cs (Goto): Take a location.
10423         
10424 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10425
10426         * delegate.cs (Delegate::VerifyDelegate): New method to verify
10427         if two delegates are compatible.
10428
10429         (NewDelegate::DoResolve): Update to take care of the case when
10430         we instantiate a delegate from another delegate.
10431
10432         * typemanager.cs (FindMembers): Don't even try to look up members
10433         of Delegate types for now.
10434
10435 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10436
10437         * delegate.cs (NewDelegate): New class to take care of delegate
10438         instantiation.
10439
10440         * expression.cs (New): Split the delegate related code out into 
10441         the NewDelegate class.
10442
10443         * delegate.cs (DelegateInvocation): New class to handle delegate 
10444         invocation.
10445
10446         * expression.cs (Invocation): Split out delegate related code into
10447         the DelegateInvocation class.
10448
10449 2001-10-17  Ravi Pratap  <ravi@ximian.com>
10450
10451         * expression.cs (New::DoResolve): Implement delegate creation fully
10452         and according to the spec.
10453
10454         (New::DoEmit): Update to handle delegates differently.
10455
10456         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10457         because of which we were printing out arguments in reverse order !
10458
10459         * delegate.cs (VerifyMethod): Implement to check if the given method
10460         matches the delegate.
10461
10462         (FullDelegateDesc): Implement.
10463
10464         (VerifyApplicability): Implement.
10465
10466         * expression.cs (Invocation::DoResolve): Update to accordingly handle
10467         delegate invocations too.
10468
10469         (Invocation::Emit): Ditto.
10470
10471         * ../errors/cs1593.cs : Added.
10472
10473         * ../errors/cs1594.cs : Added.
10474
10475         * delegate.cs (InstanceExpression, TargetMethod): New properties.
10476
10477 2001-10-16  Ravi Pratap  <ravi@ximian.com>
10478
10479         * typemanager.cs (intptr_type): Core type for System.IntPtr
10480
10481         (InitCoreTypes): Update for the same.
10482
10483         (iasyncresult_type, asynccallback_type): Ditto.
10484
10485         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10486         correct.
10487
10488         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10489         too.
10490
10491         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10492         the builders for the 4 members of a delegate type :-)
10493
10494         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10495         type.
10496
10497         * expression.cs (New::DoResolve): Implement guts for delegate creation.
10498
10499         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10500
10501 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
10502
10503         * statement.cs (Break::Emit): Implement.   
10504         (Continue::Emit): Implement.
10505
10506         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10507         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10508         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10509         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
10510         end loop
10511         
10512         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10513         properties that track the label for the current loop (begin of the
10514         loop and end of the loop).
10515
10516 2001-10-15  Ravi Pratap  <ravi@ximian.com>
10517
10518         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10519         use of emitting anything at all.
10520
10521         * class.cs, rootcontext.cs : Get rid of calls to the same.
10522
10523         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10524
10525         (Populate): Define the constructor correctly and set the implementation
10526         attributes.
10527
10528         * typemanager.cs (delegate_types): New hashtable to hold delegates that
10529         have been defined.
10530
10531         (AddDelegateType): Implement.
10532
10533         (IsDelegateType): Implement helper method.
10534
10535         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10536
10537         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10538         and accordingly handle it.
10539
10540         * delegate.cs (Populate): Take TypeContainer argument.
10541         Implement bits to define the Invoke method. However, I still haven't figured out
10542         how to take care of the native int bit :-(
10543
10544         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
10545         Qualify the name of the delegate, not its return type !
10546
10547         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10548         conversion.
10549
10550         (StandardConversionExists): Checking for array types turns out to be recursive.
10551
10552         (ConvertReferenceExplicit): Implement array conversion.
10553
10554         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10555         
10556 2001-10-12  Ravi Pratap  <ravi@ximian.com>
10557
10558         * cs-parser.jay (delegate_declaration): Store the fully qualified
10559         name as it is a type declaration.
10560
10561         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
10562         readonly.
10563
10564         (DefineDelegate): Renamed from Define. Does the same thing essentially,
10565         as TypeContainer::DefineType.
10566
10567         (Populate): Method in which all the definition of the various methods (Invoke)
10568         etc is done.
10569
10570         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10571         see.
10572         
10573         (CloseDelegate): Finally creates the delegate.
10574
10575         * class.cs (TypeContainer::DefineType): Update to define delegates.
10576         (Populate, Emit and CloseType): Do the same thing here too.
10577
10578         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10579         delegates in all these operations.
10580
10581 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
10582
10583         * expression.cs: LocalTemporary: a new expression used to
10584         reference a temporary that has been created.
10585
10586         * assign.cs: Handle PropertyAccess back here, so that we can
10587         provide the proper semantic access to properties.
10588
10589         * expression.cs (Expression::ConvertReferenceExplicit): Implement
10590         a few more explicit conversions. 
10591
10592         * modifiers.cs: `NEW' modifier maps to HideBySig.
10593
10594         * expression.cs (PropertyExpr): Make this into an
10595         ExpressionStatement, and support the EmitStatement code path. 
10596
10597         Perform get/set error checking, clean up the interface.
10598
10599         * assign.cs: recognize PropertyExprs as targets, and if so, turn
10600         them into toplevel access objects.
10601
10602 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
10603
10604         * expression.cs: PropertyExpr::PropertyExpr: use work around the
10605         SRE.
10606
10607         * typemanager.cs: Keep track here of our PropertyBuilders again to
10608         work around lameness in SRE.
10609
10610 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
10611
10612         * expression.cs (LValue::LValueResolve): New method in the
10613         interface, used to perform a second resolution pass for LValues. 
10614         
10615         (This::DoResolve): Catch the use of this in static methods.
10616
10617         (This::LValueResolve): Implement.
10618
10619         (This::Store): Remove warning, assigning to `this' in structures
10620         is 
10621
10622         (Invocation::Emit): Deal with invocation of
10623         methods on value types.  We need to pass the address to structure
10624         methods rather than the object itself.  (The equivalent code to
10625         emit "this" for structures leaves the entire structure on the
10626         stack instead of a pointer to it). 
10627
10628         (ParameterReference::DoResolve): Compute the real index for the
10629         argument based on whether the method takes or not a `this' pointer
10630         (ie, the method is static).
10631
10632         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10633         value types returned from functions when we need to invoke a
10634         method on the sturcture.
10635         
10636
10637 2001-10-11  Ravi Pratap  <ravi@ximian.com>
10638
10639         * class.cs (TypeContainer::DefineType): Method to actually do the business of
10640         defining the type in the Modulebuilder or Typebuilder. This is to take
10641         care of nested types which need to be defined on the TypeBuilder using
10642         DefineNestedMethod.
10643
10644         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
10645         methods in RootContext, only ported to be part of TypeContainer.
10646
10647         (TypeContainer::GetInterfaceOrClass): Ditto.
10648
10649         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10650
10651         * interface.cs (Interface::DefineInterface): New method. Does exactly
10652         what RootContext.CreateInterface did earlier, only it takes care of nested types 
10653         too.
10654
10655         (Interface::GetInterfaces): Move from RootContext here and port.
10656
10657         (Interface::GetInterfaceByName): Same here.
10658
10659         * rootcontext.cs (ResolveTree): Re-write.
10660
10661         (PopulateTypes): Re-write.
10662
10663         * class.cs (TypeContainer::Populate): Populate nested types too.
10664         (TypeContainer::Emit): Emit nested members too.
10665
10666         * typemanager.cs (AddUserType): Do not make use of the FullName property,
10667         instead just use the name argument passed in as it is already fully
10668         qualified.
10669
10670         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10671         to TypeContainer mapping to see if a type is user-defined.
10672
10673         * class.cs (TypeContainer::CloseType): Implement. 
10674
10675         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10676         the default constructor.
10677         
10678         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10679         twice.
10680
10681         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10682
10683         * interface.cs (CloseType): Create the type here.
10684         
10685         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10686         the hierarchy.
10687
10688         Remove all the methods which are now in TypeContainer.
10689
10690 2001-10-10  Ravi Pratap  <ravi@ximian.com>
10691
10692         * delegate.cs (Define): Re-write bits to define the delegate
10693         correctly.
10694
10695 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
10696
10697         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10698
10699         * expression.cs (ImplicitReferenceConversion): handle null as well
10700         as a source to convert to any reference type.
10701
10702         * statement.cs (Return): Perform any implicit conversions to
10703         expected return type.  
10704
10705         Validate use of return statement.  
10706
10707         * codegen.cs (EmitContext): Pass the expected return type here.
10708
10709         * class.cs (Method, Constructor, Property): Pass expected return
10710         type to EmitContext.
10711
10712 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
10713
10714         * expression.cs: Make DoResolve take an EmitContext instead of a
10715         TypeContainer.
10716
10717         Replaced `l' and `location' for `loc', for consistency.
10718         
10719         (Error, Warning): Remove unneeded Tc argument.
10720
10721         * assign.cs, literal.cs, constant.cs: Update to new calling
10722         convention. 
10723         
10724         * codegen.cs: EmitContext now contains a flag indicating whether
10725         code is being generated in a static method or not.
10726
10727         * cs-parser.jay: DecomposeQI, new function that replaces the old
10728         QualifiedIdentifier.  Now we always decompose the assembled
10729         strings from qualified_identifier productions into a group of
10730         memberaccesses.
10731
10732 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
10733
10734         * rootcontext.cs: Deal with field-less struct types correctly now
10735         by passing the size option to Define Type.
10736
10737         * class.cs: Removed hack that created one static field. 
10738
10739 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10740
10741         * statement.cs: Moved most of the code generation here. 
10742
10743 2001-10-09  Ravi Pratap  <ravi@ximian.com>
10744
10745         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10746         seem very right.
10747
10748         (ElementAccess): Remove useless bits for now - keep checks as the spec
10749         says.
10750
10751 2001-10-08  Ravi Pratap  <ravi@ximian.com>
10752
10753         * expression.cs (ElementAccess::DoResolve): Remove my crap code
10754         and start performing checks according to the spec.
10755
10756 2001-10-07  Ravi Pratap  <ravi@ximian.com>
10757
10758         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10759         rank_specifiers instead.
10760
10761         (rank_specifiers): Change the order in which the rank specifiers are stored
10762
10763         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10764
10765         * expression.cs (ElementAccess): Implement the LValue interface too.
10766         
10767 2001-10-06  Ravi Pratap  <ravi@ximian.com>
10768         
10769         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10770         except that user defined conversions are not included.
10771
10772         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
10773         perform the conversion of the return type, if necessary.
10774
10775         (New::DoResolve): Check whether we are creating an array or an object
10776         and accordingly do the needful.
10777
10778         (New::Emit): Same here.
10779
10780         (New::DoResolve): Implement guts of array creation.
10781
10782         (New::FormLookupType): Helper function.
10783
10784 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10785
10786         * codegen.cs: Removed most of the code generation here, and move the
10787         corresponding code generation bits to the statement classes. 
10788
10789         Added support for try/catch/finalize and throw.
10790         
10791         * cs-parser.jay: Added support for try/catch/finalize.
10792
10793         * class.cs: Catch static methods having the flags override,
10794         virtual or abstract.
10795
10796         * expression.cs (UserCast): This user cast was not really doing
10797         what it was supposed to do.  Which is to be born in fully resolved
10798         state.  Parts of the resolution were being performed at Emit time! 
10799
10800         Fixed this code.
10801
10802 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10803
10804         * expression.cs: Implicity convert the result from UserCast.
10805
10806 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10807
10808         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10809         prevented it from working correctly. 
10810
10811         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10812         merely ConvertImplicit.
10813
10814 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10815
10816         * typemanager.cs: Make the LookupTypeContainer function static,
10817         and not per-instance.  
10818
10819         * class.cs: Make static FindMembers (the one that takes a Type
10820         argument). 
10821
10822         * codegen.cs: Add EmitForeach here.
10823
10824         * cs-parser.jay: Make foreach a toplevel object instead of the
10825         inline expansion, as we need to perform semantic analysis on it. 
10826
10827 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10828
10829         * expression.cs (Expression::ImplicitUserConversion): Rename to
10830         UserDefinedConversion.
10831
10832         (Expression::UserDefinedConversion): Take an extra argument specifying 
10833         whether we look for explicit user conversions too.
10834
10835         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10836
10837         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10838
10839         (ExplicitUserConversion): Make it a call to UserDefinedConversion
10840         with the appropriate arguments.
10841
10842         * cs-parser.jay (cast_expression): Record location too.
10843
10844         * expression.cs (Cast): Record location info.
10845
10846         (Expression::ConvertExplicit): Take location argument.
10847
10848         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10849         to determine if we are doing explicit conversions.
10850
10851         (UserCast::Emit): Update accordingly.
10852
10853         (Expression::ConvertExplicit): Report an error if everything fails.
10854
10855         * ../errors/cs0030.cs : Add.
10856
10857 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
10858
10859         * modifiers.cs: If the ABSTRACT keyword is present, also set the
10860         virtual and newslot bits. 
10861
10862         * class.cs (TypeContainer::RegisterRequiredImplementations):
10863         Record methods we need.
10864
10865         (TypeContainer::MakeKey): Helper function to make keys for
10866         MethodBases, since the Methodbase key is useless.
10867
10868         (TypeContainer::Populate): Call RegisterRequiredImplementations
10869         before defining the methods.   
10870
10871         Create a mapping for method_builders_to_methods ahead of time
10872         instead of inside a tight loop.
10873
10874         (::RequireMethods):  Accept an object as the data to set into the
10875         hashtable so we can report interface vs abstract method mismatch.
10876
10877 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10878
10879         * report.cs: Make all of it static.
10880
10881         * rootcontext.cs: Drop object_type and value_type computations, as
10882         we have those in the TypeManager anyways.
10883
10884         Drop report instance variable too, now it is a global.
10885
10886         * driver.cs: Use try/catch on command line handling.
10887
10888         Add --probe option to debug the error reporting system with a test
10889         suite. 
10890
10891         * report.cs: Add support for exiting program when a probe
10892         condition is reached.
10893
10894 2001-10-03  Ravi Pratap  <ravi@ximian.com>
10895
10896         * expression.cs (Binary::DoNumericPromotions): Fix the case when
10897         we do a forcible conversion regardless of type, to check if 
10898         ForceConversion returns a null.
10899
10900         (Binary::error19): Use location to report error.
10901
10902         (Unary::error23): Use location here too.
10903
10904         * ../errors/cs0019.cs : Check in.
10905
10906         * ../errors/cs0023.cs : Check in.
10907
10908         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10909         case of a non-null MethodInfo object with a length of 0 !
10910
10911         (Binary::ResolveOperator): Flag error if overload resolution fails to find
10912         an applicable member - according to the spec :-)
10913         Also fix logic to find members in base types.
10914
10915         (Unary::ResolveOperator): Same here.
10916
10917         (Unary::report23): Change name to error23 and make first argument a TypeContainer
10918         as I was getting thoroughly confused between this and error19 :-)
10919         
10920         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10921         (::FindMostEncompassedType): Implement.
10922         (::FindMostEncompassingType): Implement.
10923         (::StandardConversionExists): Implement.
10924
10925         (UserImplicitCast): Re-vamp. We now need info about most specific
10926         source and target types so that we can do the necessary conversions.
10927
10928         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10929         mathematical union with no duplicates.
10930
10931 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10932
10933         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10934         in order from base classes to child classes, so that we can in
10935         child classes look up in our parent for method names and
10936         attributes (required for handling abstract, virtual, new, override
10937         constructs: we need to instrospect our base class, and if we dont
10938         populate the classes in order, the introspection might be
10939         incorrect.  For example, a method could query its parent before
10940         the parent has any methods and would determine that the parent has
10941         no abstract methods (while it could have had them)).
10942
10943         (RootContext::CreateType): Record the order in which we define the
10944         classes.
10945
10946 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
10947
10948         * class.cs (TypeContainer::Populate): Also method definitions can
10949         fail now, keep track of this.
10950
10951         (TypeContainer::FindMembers): Implement support for
10952         DeclaredOnly/noDeclaredOnly flag.
10953
10954         (Constructor::Emit) Return the ConstructorBuilder.
10955
10956         (Method::Emit) Return the MethodBuilder. 
10957         Check for abstract or virtual methods to be public.
10958
10959         * rootcontext.cs (RootContext::CreateType): Register all the
10960         abstract methods required for the class to be complete and the
10961         interface methods that must be implemented. 
10962
10963         * cs-parser.jay: Report error 501 (method requires body if it is
10964         not marked abstract or extern).
10965
10966         * expression.cs (TypeOf::Emit): Implement.
10967
10968         * typemanager.cs: runtime_handle_type, new global type.
10969
10970         * class.cs (Property::Emit): Generate code for properties.
10971
10972 2001-10-02  Ravi Pratap  <ravi@ximian.com>
10973
10974         * expression.cs (Unary::ResolveOperator): Find operators on base type
10975         too - we now conform exactly to the spec.
10976
10977         (Binary::ResolveOperator): Same here.
10978
10979         * class.cs (Operator::Define): Fix minor quirk in the tests.
10980
10981         * ../errors/cs0215.cs : Added.
10982
10983         * ../errors/cs0556.cs : Added.
10984
10985         * ../errors/cs0555.cs : Added.
10986
10987 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
10988
10989         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
10990         single integer which is really efficient
10991
10992 2001-10-01  Ravi Pratap  <ravi@ximian.com>
10993
10994         *  expression.cs (Expression::ImplicitUserConversion): Use location
10995         even in the case when we are examining True operators.
10996  
10997         * class.cs (Operator::Define): Perform extensive checks to conform
10998         with the rules for operator overloading in the spec.
10999
11000         * expression.cs (Expression::ImplicitReferenceConversion): Implement
11001         some of the other conversions mentioned in the spec.
11002
11003         * typemanager.cs (array_type): New static member for the System.Array built-in
11004         type.
11005
11006         (cloneable_interface): For System.ICloneable interface.
11007
11008         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
11009         we start resolving the tree and populating types.
11010
11011         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
11012  
11013 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11014
11015         * expression.cs (Expression::ExprClassFromMemberInfo,
11016         Expression::Literalize): Create literal expressions from
11017         FieldInfos which are literals.
11018
11019         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
11020         type casts, because they were wrong.  The test suite in tests
11021         caught these ones.
11022
11023         (ImplicitNumericConversion): ushort to ulong requires a widening
11024         cast. 
11025
11026         Int32 constant to long requires widening cast as well.
11027
11028         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
11029         for integers because the type on the stack is not i4.
11030
11031 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
11032
11033         * expression.cs (report118): require location argument. 
11034
11035         * parameter.cs: Do not dereference potential null value.
11036
11037         * class.cs: Catch methods that lack the `new' keyword when
11038         overriding a name.  Report warnings when `new' is used without
11039         anything being there to override.
11040
11041         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
11042
11043         * class.cs: Only add constructor to hashtable if it is non-null
11044         (as now constructors can fail on define).
11045
11046         (TypeManager, Class, Struct): Take location arguments.
11047
11048         Catch field instance initialization in structs as errors.
11049
11050         accepting_filter: a new filter for FindMembers that is static so
11051         that we dont create an instance per invocation.
11052
11053         (Constructor::Define): Catch errors where a struct constructor is
11054         parameterless 
11055
11056         * cs-parser.jay: Pass location information for various new
11057         constructs. 
11058         
11059         * delegate.cs (Delegate): take a location argument.
11060
11061         * driver.cs: Do not call EmitCode if there were problesm in the
11062         Definition of the types, as many Builders wont be there. 
11063
11064         * decl.cs (Decl::Decl): Require a location argument.
11065
11066         * cs-tokenizer.cs: Handle properly hex constants that can not fit
11067         into integers, and find the most appropiate integer for it.
11068
11069         * literal.cs: Implement ULongLiteral.
11070
11071         * rootcontext.cs: Provide better information about the location of
11072         failure when CreateType fails.
11073         
11074 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
11075
11076         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
11077         as well.
11078
11079         * expression.cs (Binary::CheckShiftArguments): Add missing type
11080         computation.
11081         (Binary::ResolveOperator): Add type to the logical and and logical
11082         or, Bitwise And/Or and Exclusive Or code paths, it was missing
11083         before.
11084
11085         (Binary::DoNumericPromotions): In the case where either argument
11086         is ulong (and most signed types combined with ulong cause an
11087         error) perform implicit integer constant conversions as well.
11088
11089 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11090
11091         * expression.cs (UserImplicitCast): Method should always be
11092         non-null. 
11093         (Invocation::BetterConversion): Simplified test for IntLiteral.
11094
11095         (Expression::ImplicitNumericConversion): Split this routine out.
11096         Put the code that performs implicit constant integer conversions
11097         here. 
11098
11099         (Expression::Resolve): Become a wrapper around DoResolve so we can
11100         check eclass and type being set after resolve.
11101
11102         (Invocation::Badness): Remove this dead function
11103
11104         (Binary::ResolveOperator): Do not compute the expensive argumnets
11105         unless we have a union for it.
11106
11107         (Probe::Emit): Is needs to do an isinst and then
11108         compare against null.
11109
11110         (::CanConvert): Added Location argument.  If the Location argument
11111         is null (Location.Null), then we do not report errors.  This is
11112         used by the `probe' mechanism of the Explicit conversion.  We do
11113         not want to generate an error for something that the user
11114         explicitly requested to be casted.  But the pipeline for an
11115         explicit cast first tests for potential implicit casts.
11116
11117         So for now, if the Location is null, it means `Probe only' to
11118         avoid adding another argument.   Might have to revise this
11119         strategy later.
11120
11121         (ClassCast): New class used to type cast objects into arbitrary
11122         classes (used in Explicit Reference Conversions).
11123
11124         Implement `as' as well.
11125
11126         Reverted all the patches from Ravi below: they were broken:
11127
11128                 * The use of `level' as a mechanism to stop recursive
11129                   invocations is wrong.  That was there just to catch the
11130                   bug with a strack trace but not as a way of addressing
11131                   the problem.
11132
11133                   To fix the problem we have to *understand* what is going
11134                   on and the interactions and come up with a plan, not
11135                   just get things going.
11136
11137                 * The use of the type conversion cache that I proposed
11138                   last night had an open topic: How does this work across
11139                   protection domains.  A user defined conversion might not
11140                   be public in the location where we are applying the
11141                   conversion, a different conversion might be selected
11142                   (ie, private A->B (better) but public B->A (worse),
11143                   inside A, A->B applies, but outside it, B->A will
11144                   apply).
11145
11146                 * On top of that (ie, even if the above is solved),
11147                   conversions in a cache need to be abstract.  Ie, `To
11148                   convert from an Int to a Short use an OpcodeCast', not
11149                   `To convert from an Int to a Short use the OpcodeCast on
11150                   the variable 5' (which is what this patch was doing).
11151         
11152 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11153
11154         * expression.cs (Invocation::ConversionExists): Re-write to use
11155         the conversion cache
11156         
11157         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11158         cache all conversions done, not just user-defined ones.
11159
11160         (Invocation::BetterConversion): The real culprit. Use ConversionExists
11161         to determine if a conversion exists instead of acutually trying to 
11162         perform the conversion. It's faster too.
11163
11164         (Expression::ConvertExplicit): Modify to use ConversionExists to check
11165         and only then attempt the implicit conversion.
11166
11167 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11168
11169         * expression.cs (ConvertImplicit): Use a cache for conversions
11170         already found. Check level of recursion and bail out if necessary.
11171         
11172 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11173
11174         * typemanager.cs (string_concat_string_string, string_concat_object_object):
11175         Export standard methods that we expect for string operations.
11176         
11177         * statement.cs (Block::UsageWarning): Track usage of variables and
11178         report the errors for not used variables.
11179
11180         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11181         operator. 
11182
11183 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11184
11185         * codegen.cs: remove unnneded code 
11186
11187         * expression.cs: Removed BuiltinTypeAccess class
11188
11189         Fix the order in which implicit conversions are
11190         done.  
11191
11192         The previous fixed dropped support for boxed conversions (adding a
11193         test to the test suite now)
11194
11195         (UserImplicitCast::CanConvert): Remove test for source being null,
11196         that code is broken.  We should not feed a null to begin with, if
11197         we do, then we should track the bug where the problem originates
11198         and not try to cover it up here.
11199
11200         Return a resolved expression of type UserImplicitCast on success
11201         rather than true/false.  Ravi: this is what I was talking about,
11202         the pattern is to use a static method as a "constructor" for
11203         objects. 
11204
11205         Also, do not create arguments until the very last minute,
11206         otherwise we always create the arguments even for lookups that
11207         will never be performed. 
11208
11209         (UserImplicitCast::Resolve): Eliminate, objects of type
11210         UserImplicitCast are born in a fully resolved state. 
11211         
11212         * typemanager.cs (InitCoreTypes): Init also value_type
11213         (System.ValueType). 
11214
11215         * expression.cs (Cast::Resolve): First resolve the child expression.
11216
11217         (LValue): Add new method AddressOf to be used by
11218         the `&' operator.  
11219
11220         Change the argument of Store to take an EmitContext instead of an
11221         ILGenerator, because things like FieldExpr need to be able to call
11222         their children expression to generate the instance code. 
11223
11224         (Expression::Error, Expression::Warning): Sugar functions for
11225         reporting errors.
11226
11227         (Expression::MemberLookup): Accept a TypeContainer instead of a
11228         Report as the first argument.
11229
11230         (Expression::ResolvePrimary): Killed.  I still want to improve
11231         this as currently the code is just not right.
11232
11233         (Expression::ResolveMemberAccess): Simplify, but it is still
11234         wrong. 
11235
11236         (Unary::Resolve): Catch errors in AddressOf operators.
11237
11238         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11239         index to a byte for the short-version, or the compiler will choose
11240         the wrong Emit call, which generates the wrong data.
11241
11242         (ParameterReference::Emit, ::Store): same.
11243
11244         (FieldExpr::AddressOf): Implement.
11245         
11246         * typemanager.cs: TypeManager: made public variable instead of
11247         property.
11248         
11249         * driver.cs: document --fatal.
11250
11251         * report.cs (ErrorMessage, WarningMessage): new names for the old
11252         Error and Warning classes.
11253
11254         * cs-parser.jay (member_access): Turn built-in access to types
11255         into a normal simplename
11256
11257 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11258
11259         * expression.cs (Invocation::BetterConversion): Fix to cope
11260         with q being null, since this was introducing a bug.
11261
11262         * expression.cs (ConvertImplicit): Do built-in conversions first.
11263
11264 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11265
11266         * expression.cs (UserImplicitCast::Resolve): Fix bug.
11267
11268 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11269
11270         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11271         I had introduced long ago (what's new ?).
11272
11273         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
11274         the work of all the checking. 
11275         (ConvertImplicit): Call CanConvert and only then create object if necessary.
11276         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11277
11278         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11279         that is the right way. 
11280
11281         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
11282         overloading resolution. Use everywhere instead of cutting and pasting code.
11283
11284         (Binary::ResolveOperator): Use MakeUnionSet.
11285
11286         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
11287         we have to convert to bool types. Not complete yet.
11288         
11289 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11290
11291         * typemanager.cs (TypeManager::CSharpName): support ushort.
11292
11293         * expression.cs (Expression::TryImplicitIntConversion): Attempts
11294         to provide an expression that performsn an implicit constant int
11295         conversion (section 6.1.6).
11296         (Expression::ConvertImplicitRequired): Reworked to include
11297         implicit constant expression conversions.
11298
11299         (Expression::ConvertNumericExplicit): Finished.
11300
11301         (Invocation::Emit): If InstanceExpression is null, then it means
11302         that we perform a call on this.
11303         
11304 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11305
11306         * expression.cs (Unary::Emit): Remove some dead code.
11307         (Probe): Implement Resolve and Emit for `is'.
11308         (Expression::ConvertImplicitRequired): Attempt to do constant
11309         expression conversions here.  Maybe should be moved to
11310         ConvertImplicit, but I am not sure.
11311         (Expression::ImplicitLongConstantConversionPossible,
11312         Expression::ImplicitIntConstantConversionPossible): New functions
11313         that tell whether is it possible to apply an implicit constant
11314         expression conversion.
11315
11316         (ConvertNumericExplicit): Started work on explicit numeric
11317         conversions.
11318
11319         * cs-parser.jay: Update operator constants.
11320
11321         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11322         (Parameters::GetSignature): Hook up VerifyArgs here.
11323         (Parameters::VerifyArgs): Verifies that no two arguments have the
11324         same name. 
11325
11326         * class.cs (Operator): Update the operator names to reflect the
11327         ones that the spec expects (as we are just stringizing the
11328         operator names).
11329         
11330         * expression.cs (Unary::ResolveOperator): Fix bug: Use
11331         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11332         previous usage did only work for our methods.
11333         (Expression::ConvertImplicit): Handle decimal implicit numeric
11334         conversions as well.
11335         (Expression::InternalTypeConstructor): Used to invoke constructors
11336         on internal types for default promotions.
11337
11338         (Unary::Emit): Implement special handling for the pre/post
11339         increment/decrement for overloaded operators, as they need to have
11340         the same semantics as the other operators.
11341
11342         (Binary::ResolveOperator): ditto.
11343         (Invocation::ConversionExists): ditto.
11344         (UserImplicitCast::Resolve): ditto.
11345         
11346 2001-09-26  Ravi Pratap  <ravi@ximian.com>
11347
11348         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11349         operator, return after emitting body. Regression tests pass again !
11350
11351         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11352         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11353         (Invocation::OverloadResolve): Ditto.
11354         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11355
11356         * everywhere : update calls to the above methods accordingly.
11357
11358 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11359
11360         * assign.cs (Assign): Make it inherit from ExpressionStatement.
11361
11362         * expression.cs (ExpressionStatement): New base class used for
11363         expressions that can appear in statements, so that we can provide
11364         an alternate path to generate expression that do not leave a value
11365         on the stack.
11366
11367         (Expression::Emit, and all the derivatives): We no longer return
11368         whether a value is left on the stack or not.  Every expression
11369         after being emitted leaves a single value on the stack.
11370
11371         * codegen.cs (EmitContext::EmitStatementExpression): Use the
11372         facilties of ExpressionStatement if possible.
11373
11374         * cs-parser.jay: Update statement_expression.
11375
11376 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
11377
11378         * driver.cs: Change the wording of message
11379
11380 2001-09-25  Ravi Pratap  <ravi@ximian.com>
11381
11382         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
11383         the type of the expression to the return type of the method if
11384         we have an overloaded operator match ! The regression tests pass again !
11385         (Unary::ResolveOperator): Ditto.
11386
11387         * expression.cs (Invocation::ConversionExists): Correct the member lookup
11388         to find "op_Implicit", not "implicit" ;-)
11389         (UserImplicitCast): New class to take care of user-defined implicit conversions.
11390         (ConvertImplicit, ForceConversion): Take TypeContainer argument
11391
11392         * everywhere : Correct calls to the above accordingly.
11393
11394         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11395         (ConvertImplicit): Do user-defined conversion if it exists.
11396
11397 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
11398
11399         * assign.cs: track location.
11400         (Resolve): Use implicit conversions on assignment.
11401
11402         * literal.cs: Oops.  Not good, Emit of short access values should
11403         pass (Bytes) or the wrong argument will be selected.
11404
11405         * expression.cs (Unary::Emit): Emit code for -expr.
11406         
11407         (Unary::ResolveOperator): Handle `Substract' for non-constants
11408         (substract from zero from the non-constants).
11409         Deal with Doubles as well. 
11410         
11411         (Expression::ConvertImplicitRequired): New routine that reports an
11412         error if no implicit conversion exists. 
11413
11414         (Invocation::OverloadResolve): Store the converted implicit
11415         expressions if we make them
11416         
11417 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11418
11419         * class.cs (ConstructorInitializer): Take a Location argument.
11420         (ConstructorBaseInitializer): Same here.
11421         (ConstructorThisInitializer): Same here.
11422
11423         * cs-parser.jay : Update all calls accordingly.
11424
11425         * expression.cs (Unary, Binary, New): Take location argument.
11426         Update accordingly everywhere.
11427
11428         * cs-parser.jay : Update all calls to the above to take a location
11429         argument.
11430
11431         * class.cs : Ditto.
11432
11433 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11434
11435         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11436         (Invocation::BetterConversion): Same here
11437         (Invocation::ConversionExists): Ditto.
11438
11439         (Invocation::ConversionExists): Implement.
11440
11441 2001-09-22  Ravi Pratap  <ravi@ximian.com>
11442
11443         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11444         Also take an additional TypeContainer argument.
11445
11446         * All over : Pass in TypeContainer as argument to OverloadResolve.
11447
11448         * typemanager.cs (CSharpName): Update to check for the string type and return
11449         that too.
11450
11451         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11452         a given method.
11453         
11454 2001-09-21  Ravi Pratap  <ravi@ximian.com>
11455
11456         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11457         (Invocation::BetterFunction): Implement.
11458         (Invocation::BetterConversion): Implement.
11459         (Invocation::ConversionExists): Skeleton, no implementation yet.
11460
11461         Okay, things work fine !
11462
11463 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
11464
11465         * typemanager.cs: declare and load enum_type, delegate_type and
11466         void_type. 
11467
11468         * expression.cs (Expression::Emit): Now emit returns a value that
11469         tells whether a value is left on the stack or not.  This strategy
11470         might be reveted tomorrow with a mechanism that would address
11471         multiple assignments.
11472         (Expression::report118): Utility routine to report mismatches on
11473         the ExprClass.
11474
11475         (Unary::Report23): Report impossible type/operator combination
11476         utility function.
11477
11478         (Unary::IsIncrementableNumber): Whether the type can be
11479         incremented or decremented with add.
11480         (Unary::ResolveOperator): Also allow enumerations to be bitwise
11481         complemented. 
11482         (Unary::ResolveOperator): Implement ++, !, ~,
11483
11484         (Invocation::Emit): Deal with new Emit convetion.
11485         
11486         * All Expression derivatives: Updated their Emit method to return
11487         whether they leave values on the stack or not.
11488         
11489         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11490         stack for expressions that are statements. 
11491
11492 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11493
11494         * expression.cs (LValue): New interface.  Must be implemented by
11495         LValue objects.
11496         (LocalVariableReference, ParameterReference, FieldExpr): Implement
11497         LValue interface.
11498         
11499         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11500         interface for generating code, simplifies the code.
11501
11502 2001-09-20  Ravi Pratap  <ravi@ximian.com>
11503
11504         * expression.cs (everywhere): Comment out return statements in ::Resolve
11505         methods to avoid the warnings.
11506
11507 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11508
11509         * driver.cs (parse): Report error 2001 if we can not open the
11510         source file.
11511
11512         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11513         not resolve it.
11514
11515         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11516         object. 
11517
11518         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11519         otherwise nested blocks end up with the same index.
11520
11521         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11522
11523         * expression.cs:  Instead of having FIXMEs in the Resolve
11524         functions, throw exceptions so it is obvious that we are facing a
11525         bug. 
11526
11527         * cs-parser.jay (invocation_expression): Pass Location information.
11528
11529         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11530         Use a basename for those routines because .NET does not like paths
11531         on them. 
11532
11533         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11534         already defined.
11535
11536 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
11537
11538         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11539         are loading the correct data types (throws an exception if not).
11540         (TypeManager::InitCoreTypes): Use CoreLookupType
11541
11542         * expression.cs (Unary::ResolveOperator): return the child
11543         expression for expressions which are just +expr.
11544         (Unary::ResolveOperator): Return negative literals for -LITERAL
11545         expressions (otherwise they are Unary {Literal}).
11546         (Invocation::Badness): Take into account `Implicit constant
11547         expression conversions'.
11548
11549         * literal.cs (LongLiteral): Implement long literal class.
11550         (IntLiteral): export the `Value' of the intliteral. 
11551
11552 2001-09-19  Ravi Pratap  <ravi@ximian.com>
11553
11554         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11555
11556         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
11557         instead of 'Operator'
11558
11559         * expression.cs (Binary::ResolveOperator): Update accordingly.
11560         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11561         and 'Minus'
11562
11563         * cs-parser.jay (unary_expression): Update to use the new names.
11564
11565         * gen-treedump.cs (GetUnary): Same here.
11566
11567         * expression.cs (Unary::Resolve): Implement.
11568         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
11569         operators are found instead of making noise ;-)
11570         (Unary::ResolveOperator): New method to do precisely the same thing which
11571         Binary::ResolveOperator does for Binary expressions.
11572         (Unary.method, .Arguments): Add.
11573         (Unary::OperName): Implement.   
11574         (Unary::ForceConversion): Copy and Paste !
11575
11576         * class.cs (Operator::Define): Fix a small bug for the case when we have 
11577         a unary operator.
11578
11579         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11580         for the inbuilt operators. Only overloading works for now ;-)
11581
11582 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
11583
11584         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11585         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11586
11587         * expression.cs (This::Emit): Implement. 
11588         (This::Resolve): Implement.
11589         (TypeOf:Resolve): Implement.
11590         (Expression::ResolveSimpleName): Add an implicit this to instance
11591         field references. 
11592         (MemberAccess::Resolve): Deal with Parameters and Fields. 
11593         Bind instance variable to Field expressions.
11594         (FieldExpr::Instance): New field used to track the expression that
11595         represents the object instance.
11596         (FieldExpr::Resolve): Track potential errors from MemberLookup not
11597         binding 
11598         (FieldExpr::Emit): Implement.
11599
11600         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11601         the last instruction contains a return opcode to avoid generating
11602         the last `ret' instruction (this generates correct code, and it is
11603         nice to pass the peverify output).
11604
11605         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11606         initializer for static and instance variables.
11607         (Constructor::Emit): Allow initializer to be null in the case of
11608         static constructors.  Only emit initializer for instance
11609         constructors. 
11610
11611         (TypeContainer::FindMembers): Return a null array if there are no
11612         matches.
11613
11614         Also fix the code for the MemberTypes.Method branch, as it was not
11615         scanning that for operators (or tried to access null variables before).
11616
11617         * assign.cs (Assign::Emit): Handle instance and static fields. 
11618
11619         * TODO: Updated.
11620
11621         * driver.cs: Stop compilation if there are parse errors.
11622
11623         * cs-parser.jay (constructor_declaration): Provide default base
11624         initializer for non-static constructors.
11625         (constructor_declarator): Do not provide a default base
11626         initializers if none was specified.
11627         Catch the fact that constructors should not have parameters.
11628
11629         * class.cs: Do not emit parent class initializers for static
11630         constructors, that should be flagged as an error.
11631
11632 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11633
11634         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11635         Move back code into TypeContainer::Populate.
11636
11637 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11638
11639         * class.cs (TypeContainer::AddConstructor): Fix the check to
11640         compare against Name, not Basename. 
11641         (Operator::OpType): Change Plus and Minus to Add and Subtract.
11642
11643         * cs-parser.jay : Update accordingly.
11644
11645         * class.cs (TypeContainer::FindMembers): For the case where we are searching
11646         for methods, don't forget to look into the operators too.
11647         (RegisterMethodBuilder): Helper method to take care of this for
11648         methods, constructors and operators.
11649         (Operator::Define): Completely revamp.
11650         (Operator.OperatorMethod, MethodName): New fields.
11651         (TypeContainer::Populate): Move the registering of builders into
11652         RegisterMethodBuilder.
11653         (Operator::Emit): Re-write.
11654
11655         * expression.cs (Binary::Emit): Comment out code path to emit method
11656         invocation stuff for the case when we have a user defined operator. I am
11657         just not able to get it right !
11658         
11659 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11660
11661         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11662         argument. 
11663
11664         (Expression::MemberLookup): Provide a version that allows to
11665         specify the MemberTypes and BindingFlags. 
11666
11667         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11668         so it was not fetching variable information from outer blocks.
11669
11670         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11671         Beforefieldinit as it was buggy.
11672
11673         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11674         that Ravi put here.  
11675
11676         * class.cs (Constructor::Emit): Only emit if block is not null.
11677         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11678         deal with this by semantically definining it as if the user had
11679         done it.
11680
11681         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11682         constructors as we now "emit" them at a higher level.
11683
11684         (TypeContainer::DefineDefaultConstructor): Used to define the
11685         default constructors if none was provided.
11686
11687         (ConstructorInitializer): Add methods Resolve and Emit. 
11688         
11689         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11690
11691 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11692
11693         * class.cs (TypeContainer::EmitDefaultConstructor): Register
11694         the default constructor builder with our hashtable for methodbuilders
11695         to methodcores.
11696
11697         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11698         and argument_count is 0 in which case we have a match.
11699         (Binary::ResolveOperator): More null checking and miscellaneous coding
11700         style cleanup.
11701
11702 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11703
11704         * rootcontext.cs (IsNameSpace): Compare against null.
11705
11706         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11707
11708         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11709         and Unary::Operator.
11710
11711         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11712         accordingly.
11713
11714         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11715         we have overloaded operators.
11716         (Binary::ResolveOperator): Implement the part which does the operator overload
11717         resolution.
11718
11719         * class.cs (Operator::Emit): Implement.
11720         (TypeContainer::Emit): Emit the operators we have too.
11721
11722         * expression.cs (Binary::Emit): Update to emit the appropriate code for
11723         the case when we have a user-defined operator.
11724         
11725 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11726
11727         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11728
11729 2001-09-16  Ravi Pratap  <ravi@ximian.com>
11730
11731         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11732         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11733         (Constructor::Emit): Implement.
11734         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11735         if we have no work to do. 
11736         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
11737         Emit method.
11738
11739         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11740         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11741
11742         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11743         of parent.parent.
11744
11745 2001-09-15  Ravi Pratap  <ravi@ximian.com>
11746
11747         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11748         in the source.
11749         (Tree::RecordNamespace): Method to do what the name says ;-)
11750         (Tree::Namespaces): Property to get at the namespaces hashtable.
11751
11752         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
11753         keep track.
11754
11755         * rootcontext.cs (IsNamespace): Fixed it :-)
11756
11757 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11758
11759         * class.cs (TypeContainer::FindMembers): Add support for
11760         constructors. 
11761         (MethodCore): New class that encapsulates both the shared aspects
11762         of a Constructor and a Method.  
11763         (Method, Constructor): Factored pieces into MethodCore.
11764
11765         * driver.cs: Added --fatal which makes errors throw exceptions.
11766         Load System assembly as well as part of the standard library.
11767
11768         * report.cs: Allow throwing exceptions on errors for debugging.
11769
11770         * modifiers.cs: Do not use `parent', instead use the real type
11771         container to evaluate permission settings.
11772
11773         * class.cs: Put Ravi's patch back in.  He is right, and we will
11774         have to cope with the
11775
11776 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11777
11778         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11779         FamORAssem, not FamANDAssem.
11780         
11781 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11782
11783         * driver.cs: Added --parse option that only parses its input files
11784         and terminates.
11785
11786         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
11787         incorrect.  IsTopLevel is not used to tell whether an object is
11788         root_types or not (that can be achieved by testing this ==
11789         root_types).  But to see if this is a top-level *class* (not
11790         necessarly our "toplevel" container). 
11791
11792 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11793
11794         * enum.cs (Enum::Define): Modify to call the Lookup method on the
11795         parent instead of a direct call to GetType.
11796
11797 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11798
11799         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11800         Modifiers.TypeAttr. This should just be a call to that method.
11801
11802         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11803         object so that we can determine if we are top-level or not.
11804
11805         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
11806         TypeContainer too.
11807
11808         * enum.cs (Enum::Define): Ditto.
11809
11810         * modifiers.cs (FieldAttr): Re-write.
11811
11812         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11813         (TypeContainer::HaveStaticConstructor): New property to provide access
11814         to precisely that info.
11815
11816         * modifiers.cs (MethodAttr): Re-write.
11817         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11818
11819         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11820         of top-level types as claimed.
11821         
11822 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11823
11824         * expression.cs (MemberLookup): Fruitless attempt to lookup
11825         constructors.  Maybe I need to emit default constructors?  That
11826         might be it (currently .NET emits this for me automatically).
11827         (Invocation::OverloadResolve): Cope with Arguments == null.
11828         (Invocation::EmitArguments): new function, shared by the new
11829         constructor and us.
11830         (Invocation::Emit): Handle static and instance methods.  Emit
11831         proper call instruction for virtual or non-virtual invocations.
11832         (New::Emit): Implement.
11833         (New::Resolve): Implement.
11834         (MemberAccess:Resolve): Implement.
11835         (MethodGroupExpr::InstanceExpression): used conforming to the spec
11836         to track instances.
11837         (FieldExpr::Resolve): Set type.
11838
11839         * support.cs: Handle empty arguments.
11840                 
11841         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11842         SimpleLookup): Auxiliary routines to help parse a qualifier
11843         identifier.  
11844
11845         Update qualifier_identifier rule.
11846
11847         * codegen.cs: Removed debugging messages.
11848
11849         * class.cs: Make this a global thing, this acts just as a "key" to
11850         objects that we might have around.
11851
11852         (Populate): Only initialize method_builders_to_methods once.
11853
11854         * expression.cs (PropertyExpr): Initialize type from the
11855         PropertyType. 
11856
11857         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11858         Resolve pattern.  Attempt to implicitly convert value to boolean.
11859         Emit code.
11860
11861         * expression.cs: Set the type for the int32/int32 argument case.
11862         (Binary::ResolveOperator): Set the return type to boolean for
11863         comparission operators
11864
11865         * typemanager.cs: Remove debugging print code.
11866
11867         (Invocation::Resolve): resolve type.
11868
11869         * class.cs: Allocate a MemberInfo of the correct size, as the code
11870         elsewhere depends on the test to reflect the correct contents.
11871
11872         (Method::) Keep track of parameters, due to System.Reflection holes
11873
11874         (TypeContainer::Populate): Keep track of MethodBuilders to Method
11875         mapping here.
11876
11877         (TypeContainer::FindMembers): Use ArrayList and then copy an array
11878         of the exact size and return that.
11879
11880         (Class::LookupMethodByBuilder): New function that maps
11881         MethodBuilders to its methods.  Required to locate the information
11882         on methods because System.Reflection bit us again.
11883
11884         * support.cs: New file, contains an interface ParameterData and
11885         two implementations: ReflectionParameters and InternalParameters
11886         used to access Parameter information.  We will need to grow this
11887         as required.
11888
11889         * expression.cs (Invocation::GetParameterData): implement a cache
11890         and a wrapper around the ParameterData creation for methods. 
11891         (Invocation::OverloadResolve): Use new code.
11892
11893 2001-09-13  Ravi Pratap  <ravi@ximian.com>
11894
11895         * class.cs (TypeContainer::EmitField): Remove and move into 
11896         (Field::Define): here and modify accordingly.
11897         (Field.FieldBuilder): New member.
11898         (TypeContainer::Populate): Update accordingly.
11899         (TypeContainer::FindMembers): Implement.
11900
11901 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11902
11903         * statement.cs: (VariableInfo::VariableType): New field to be
11904         initialized with the full type once it is resolved. 
11905
11906 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
11907
11908         * parameter.cs (GetParameterInfo): Use a type cache to compute
11909         things only once, and to reuse this information
11910
11911         * expression.cs (LocalVariableReference::Emit): Implement.
11912         (OpcodeCast::Emit): fix.
11913
11914         (ParameterReference::Resolve): Implement.
11915         (ParameterReference::Emit): Implement.
11916
11917         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11918         that are expressions need to stay as Expressions.
11919
11920         * typemanager.cs (CSharpName): Returns the C# name of a type if
11921         possible. 
11922
11923         * expression.cs (Expression::ConvertImplicit): New function that
11924         implements implicit type conversions.
11925
11926         (Expression::ImplicitReferenceConversion): Implements implicit
11927         reference conversions.
11928
11929         (EmptyCast): New type for transparent casts.
11930
11931         (OpcodeCast): New type for casts of types that are performed with
11932         a sequence of bytecodes.
11933         
11934         (BoxedCast): New type used for casting value types into reference
11935         types.  Emits a box opcode.
11936
11937         (Binary::DoNumericPromotions): Implements numeric promotions of
11938         and computation of the Binary::Type.
11939
11940         (Binary::EmitBranchable): Optimization.
11941
11942         (Binary::Emit): Implement code emission for expressions.
11943         
11944         * typemanager.cs (TypeManager): Added two new core types: sbyte
11945         and byte.
11946
11947 2001-09-12  Ravi Pratap  <ravi@ximian.com>
11948
11949         * class.cs (TypeContainer::FindMembers): Method which does exactly
11950         what Type.FindMembers does, only we don't have to use reflection. No
11951         implementation yet.
11952
11953         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11954         typecontainer objects as we need to get at them.
11955         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11956
11957         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11958         typecontainer object.
11959
11960         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11961         of just a Report object.
11962
11963 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11964
11965         * class.cs (Event::Define): Go back to using the prefixes "add_" and
11966         "remove_"
11967         (TypeContainer::Populate): Now define the delegates of the type too.
11968         (TypeContainer.Delegates): Property to access the list of delegates defined
11969         in the type.
11970
11971         * delegates.cs (Delegate::Define): Implement partially.
11972
11973         * modifiers.cs (TypeAttr): Handle more flags.
11974
11975 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11976
11977         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11978         and not <=
11979         (Operator::Define): Re-write logic to get types by using the LookupType method
11980         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11981         (Indexer::Define): Ditto.
11982         (Event::Define): Ditto.
11983         (Property::Define): Ditto.
11984         
11985 2001-09-10  Ravi Pratap  <ravi@ximian.com>
11986
11987         * class.cs (TypeContainer::Populate): Now define operators too. 
11988         (TypeContainer.Operators): New property to access the list of operators
11989         in a type.
11990         (Operator.OperatorMethodBuilder): New member to hold the method builder
11991         for the operator we are defining.
11992         (Operator::Define): Implement.
11993
11994 2001-09-10  Ravi Pratap  <ravi@ximian.com>
11995
11996         * class.cs (Event::Define): Make the prefixes of the accessor methods
11997         addOn_ and removeOn_ 
11998
11999         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
12000         of the location being passed in too. Ideally, this should go later since all
12001         error reporting should be done through the Report object.
12002
12003         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
12004         (Populate): Iterate thru the indexers we have and define them too.
12005         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
12006         for the get and set accessors.
12007         (Indexer::Define): Implement.
12008         
12009 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
12010
12011         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
12012         my previous implementation, did not work.
12013
12014         * typemanager.cs: Add a couple of missing types (the longs).
12015
12016         * literal.cs: Use TypeManager.bool_type instead of getting it.
12017
12018         * expression.cs (EventExpr): New kind of expressions.
12019         (Expressio::ExprClassFromMemberInfo): finish
12020
12021 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
12022
12023         * assign.cs: Emit stores to static fields differently.
12024
12025 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12026
12027         * Merge in changes and adjust code to tackle conflicts. Backed out my
12028         code in Assign::Resolve ;-) 
12029
12030 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12031
12032         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
12033         instead Report.Error and also pass in the location.
12034         (CSharpParser::Lexer): New readonly property to return the reference
12035         to the Tokenizer object.
12036         (declare_local_variables): Use Report.Error with location instead of plain 
12037         old error.
12038         (CheckDef): Ditto.
12039
12040         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
12041         (Operator.CheckBinaryOperator): Ditto.
12042
12043         * cs-parser.jay (operator_declarator): Update accordingly.
12044
12045         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
12046         (CheckBinaryOperator): Same here.
12047
12048         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
12049         on the name without any prefixes of namespace names etc. This is because we
12050         already might have something already fully qualified like 
12051         'System.Console.WriteLine'
12052
12053         * assign.cs (Resolve): Begin implementation. Stuck ;-)
12054
12055 2001-09-07  Ravi Pratap  <ravi@ximian.com>
12056
12057         * cs-tokenizer.cs (location): Return a string which also contains
12058         the file name.
12059
12060         * expression.cs (ElementAccess): New class for expressions of the
12061         type 'element access.'
12062         (BaseAccess): New class for expressions of the type 'base access.'
12063         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
12064         respectively.
12065         
12066         * cs-parser.jay (element_access): Implement action.
12067         (base_access): Implement actions.
12068         (checked_expression, unchecked_expression): Implement.
12069
12070         * cs-parser.jay (local_variable_type): Correct and implement.
12071         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
12072
12073         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
12074
12075         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
12076         name and the specifiers.
12077
12078         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
12079         
12080         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
12081         making them all public ;-)
12082
12083         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
12084         class anyways.
12085         
12086 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
12087
12088         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
12089         PropertyExprs.
12090         (FieldExpr, PropertyExprs): New resolved expressions.
12091         (SimpleName::MemberStaticCheck): Perform static checks for access
12092         to non-static fields on static methods. Maybe this should be
12093         generalized for MemberAccesses. 
12094         (SimpleName::ResolveSimpleName): More work on simple name
12095         resolution. 
12096
12097         * cs-parser.jay (primary_expression/qualified_identifier): track
12098         the parameter index.
12099
12100         * codegen.cs (CodeGen::Save): Catch save exception, report error.
12101         (EmitContext::EmitBoolExpression): Chain to expression generation
12102         instead of temporary hack.
12103         (::EmitStatementExpression): Put generic expression code generation.
12104
12105         * assign.cs (Assign::Emit): Implement variable assignments to
12106         local variables, parameters and fields.
12107
12108 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
12109
12110         * statement.cs (Block::GetVariableInfo): New method, returns the
12111         VariableInfo for a variable name in a block.
12112         (Block::GetVariableType): Implement in terms of GetVariableInfo
12113
12114         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12115         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12116
12117 2001-09-06  Ravi Pratap  <ravi@ximian.com>
12118
12119         * cs-parser.jay (operator_declaration): Continue on my quest : update
12120         to take attributes argument.
12121         (event_declaration): Ditto.
12122         (enum_declaration): Ditto.
12123         (indexer_declaration): Ditto.
12124         
12125         * class.cs (Operator::Operator): Update constructor accordingly.
12126         (Event::Event): Ditto.
12127
12128         * delegate.cs (Delegate::Delegate): Same here.
12129
12130         * enum.cs (Enum::Enum): Same here.
12131         
12132 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12133
12134         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12135
12136         * ../tests/cs0658.cs : New file to demonstrate error 0658.
12137
12138         * attribute.cs (Attributes): New class to encapsulate all attributes which were
12139         being passed around as an arraylist.
12140         (Attributes::AddAttribute): Method to add attribute sections.
12141
12142         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12143         (struct_declaration): Update accordingly.
12144         (constant_declaration): Update.
12145         (field_declaration): Update.
12146         (method_header): Update.
12147         (fixed_parameter): Update.
12148         (parameter_array): Ditto.
12149         (property_declaration): Ditto.
12150         (destructor_declaration): Ditto.
12151         
12152         * class.cs (Struct::Struct): Update constructors accordingly.
12153         (Class::Class): Ditto.
12154         (Field::Field): Ditto.
12155         (Method::Method): Ditto.
12156         (Property::Property): Ditto.
12157         (TypeContainer::OptAttribute): update property's return type.
12158         
12159         * interface.cs (Interface.opt_attributes): New member.
12160         (Interface::Interface): Update to take the extra Attributes argument.
12161
12162         * parameter.cs (Parameter::Parameter): Ditto.
12163
12164         * constant.cs (Constant::Constant): Ditto.
12165
12166         * interface.cs (InterfaceMemberBase): New OptAttributes field.
12167         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
12168         the attributes as a parameter.
12169         (InterfaceProperty): Update constructor call.
12170         (InterfaceEvent): Ditto.
12171         (InterfaceMethod): Ditto.
12172         (InterfaceIndexer): Ditto.
12173
12174         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
12175         pass the attributes too.
12176         (interface_event_declaration): Ditto.
12177         (interface_property_declaration): Ditto.
12178         (interface_method_declaration): Ditto.
12179         (interface_declaration): Ditto.
12180
12181 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
12182
12183         * class.cs (Method::Define): Track the "static Main" definition to
12184         create an entry point. 
12185
12186         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12187         EntryPoint if we find it. 
12188
12189         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12190         (EmitContext::ig): Make this variable public.
12191
12192         * driver.cs: Make the default output file be the first file name
12193         with the .exe extension.  
12194
12195         Detect empty compilations
12196
12197         Handle various kinds of output targets.  Handle --target and
12198         rename -t to --dumper.
12199
12200         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
12201         methods inherited from Expression return now an Expression.  This
12202         will is used during the tree rewriting as we resolve them during
12203         semantic analysis.
12204
12205         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
12206         the spec.  Missing entirely is the information about
12207         accessability of elements of it.
12208
12209         (Expression::ExprClassFromMemberInfo): New constructor for
12210         Expressions that creates a fully initialized Expression based on
12211         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
12212         a Type.
12213
12214         (Invocation::Resolve): Begin implementing resolution of invocations.
12215         
12216         * literal.cs (StringLiteral):  Implement Emit.
12217
12218 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12219
12220         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12221         member.
12222         
12223 2001-09-04  Ravi Pratap  <ravi@ximian.com>
12224
12225         * cs-parser.jay (attribute_arguments): Implement actions.
12226         (attribute): Fix bug in production. Implement action.
12227         (attribute_list): Implement.
12228         (attribute_target): Implement.
12229         (attribute_target_specifier, opt_target_specifier): Implement
12230         (CheckAttributeTarget): New method to check if the attribute target
12231         is valid.
12232         (attribute_section): Implement.
12233         (opt_attributes): Implement.
12234
12235         * attribute.cs : New file to handle attributes.
12236         (Attribute): Class to hold attribute info.
12237
12238         * cs-parser.jay (opt_attribute_target_specifier): Remove production
12239         (attribute_section): Modify production to use 2 different rules to 
12240         achieve the same thing. 1 s/r conflict down !
12241         Clean out commented, useless, non-reducing dimension_separator rules.
12242         
12243         * class.cs (TypeContainer.attributes): New member to hold list
12244         of attributes for a type.
12245         (Struct::Struct): Modify to take one more argument, the attribute list.
12246         (Class::Class): Ditto.
12247         (Field::Field): Ditto.
12248         (Method::Method): Ditto.
12249         (Property::Property): Ditto.
12250         
12251         * cs-parser.jay (struct_declaration): Update constructor call to
12252         pass in the attributes too.
12253         (class_declaration): Ditto.
12254         (constant_declaration): Ditto.
12255         (field_declaration): Ditto.
12256         (method_header): Ditto.
12257         (fixed_parameter): Ditto.
12258         (parameter_array): Ditto.
12259         (property_declaration): Ditto.
12260
12261         * constant.cs (Constant::Constant): Update constructor similarly.
12262         Use System.Collections.
12263
12264         * parameter.cs (Parameter::Parameter): Update as above.
12265
12266 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12267
12268         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12269         (TypeContainer.delegates): New member to hold list of delegates.
12270
12271         * cs-parser.jay (delegate_declaration): Implement the action correctly 
12272         this time as I seem to be on crack ;-)
12273
12274 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
12275
12276         * rootcontext.cs (RootContext::IsNamespace): new function, used to
12277         tell whether an identifier represents a namespace.
12278
12279         * expression.cs (NamespaceExpr): A namespace expression, used only
12280         temporarly during expression resolution.
12281         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12282         utility functions to resolve names on expressions.
12283
12284 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
12285
12286         * codegen.cs: Add hook for StatementExpressions. 
12287
12288         * class.cs: Fix inverted test for static flag in methods.
12289
12290 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12291
12292         * class.cs (Operator::CheckUnaryOperator): Correct error number used
12293         to make it coincide with MS' number.
12294         (Operator::CheckBinaryOperator): Ditto.
12295
12296         * ../errors/errors.txt : Remove error numbers added earlier.
12297
12298         * ../errors/cs1019.cs : Test case for error # 1019
12299
12300         * ../errros/cs1020.cs : Test case for error # 1020
12301
12302         * cs-parser.jay : Clean out commented cruft.
12303         (dimension_separators, dimension_separator): Comment out. Ostensibly not
12304         used anywhere - non-reducing rule.
12305         (namespace_declarations): Non-reducing rule - comment out.
12306
12307         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12308         with TypeContainer::AddEnum.
12309
12310         * delegate.cs : New file for delegate handling classes.
12311         (Delegate): Class for declaring delegates.
12312
12313         * makefile : Update.
12314
12315         * cs-parser.jay (delegate_declaration): Implement.
12316
12317 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
12318
12319         * class.cs (Event::Define): Implement.
12320         (Event.EventBuilder): New member.
12321
12322         * class.cs (TypeContainer::Populate): Update to define all enums and events
12323         we have.
12324         (Events): New property for the events arraylist we hold. Shouldn't we move to using
12325         readonly fields for all these cases ?
12326
12327 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12328
12329         * class.cs (Property): Revamp to use the convention of making fields readonly.
12330         Accordingly modify code elsewhere.
12331
12332         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12333         the Define method of the Property class.
12334
12335         * class.cs : Clean up applied patch and update references to variables etc. Fix 
12336         trivial bug.
12337         (TypeContainer::Populate): Update to define all the properties we have. Also
12338         define all enumerations.
12339
12340         * enum.cs (Define): Implement.
12341         
12342 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12343
12344         * cs-parser.jay (overloadable_operator): The semantic value is an
12345         enum of the Operator class.
12346         (operator_declarator): Implement actions.
12347         (operator_declaration): Implement.
12348
12349         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12350         validity of definitions.
12351         (Operator::CheckBinaryOperator): Static method to check for binary operators
12352         (TypeContainer::AddOperator): New method to add an operator to a type.
12353
12354         * cs-parser.jay (indexer_declaration): Added line to actually call the
12355         AddIndexer method so it gets added ;-)
12356
12357         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
12358         already taken care of by the MS compiler ?  
12359
12360 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12361
12362         * class.cs (Operator): New class for operator declarations.
12363         (Operator::OpType): Enum for the various operators.
12364
12365 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12366
12367         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12368         ostensibly handle this in semantic analysis.
12369
12370         * cs-parser.jay (general_catch_clause): Comment out
12371         (specific_catch_clauses, specific_catch_clause): Ditto.
12372         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12373         (catch_args, opt_catch_args): New productions.
12374         (catch_clause): Rewrite to use the new productions above
12375         (catch_clauses): Modify accordingly.
12376         (opt_catch_clauses): New production to use in try_statement
12377         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12378         and re-write the code in the actions to extract the specific and
12379         general catch clauses by being a little smart ;-)
12380
12381         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12382         Hooray, try and catch statements parse fine !
12383         
12384 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12385
12386         * statement.cs (Block::GetVariableType): Fix logic to extract the type
12387         string from the hashtable of variables.
12388
12389         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12390         I end up making that mistake ;-)
12391         (catch_clauses): Fixed gross error which made Key and Value of the 
12392         DictionaryEntry the same : $1 !!
12393
12394 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12395
12396         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12397
12398         * cs-parser.jay (event_declaration): Correct to remove the semicolon
12399         when the add and remove accessors are specified. 
12400
12401 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12402
12403         * cs-parser.jay (IndexerDeclaration): New helper class to hold
12404         information about indexer_declarator.
12405         (indexer_declarator): Implement actions.
12406         (parsing_indexer): New local boolean used to keep track of whether
12407         we are parsing indexers or properties. This is necessary because 
12408         implicit_parameters come into picture even for the get accessor in the 
12409         case of an indexer.
12410         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12411
12412         * class.cs (Indexer): New class for indexer declarations.
12413         (TypeContainer::AddIndexer): New method to add an indexer to a type.
12414         (TypeContainer::indexers): New member to hold list of indexers for the
12415         type.
12416
12417 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12418
12419         * cs-parser.jay (add_accessor_declaration): Implement action.
12420         (remove_accessor_declaration): Implement action.
12421         (event_accessors_declaration): Implement
12422         (variable_declarators): swap statements for first rule - trivial.
12423
12424         * class.cs (Event): New class to hold information about event
12425         declarations.
12426         (TypeContainer::AddEvent): New method to add an event to a type
12427         (TypeContainer::events): New member to hold list of events.
12428
12429         * cs-parser.jay (event_declaration): Implement actions.
12430
12431 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12432
12433         * cs-parser.jay (dim_separators): Implement. Make it a string
12434         concatenating all the commas together, just as they appear.
12435         (opt_dim_separators): Modify accordingly
12436         (rank_specifiers): Update accordingly. Basically do the same
12437         thing - instead, collect the brackets here.
12438         (opt_rank_sepcifiers): Modify accordingly.
12439         (array_type): Modify to actually return the complete type string
12440         instead of ignoring the rank_specifiers.
12441         (expression_list): Implement to collect the expressions
12442         (variable_initializer): Implement. We make it a list of expressions
12443         essentially so that we can handle the array_initializer case neatly too.
12444         (variable_initializer_list): Implement.
12445         (array_initializer): Make it a list of variable_initializers
12446         (opt_array_initializer): Modify accordingly.
12447
12448         * expression.cs (New::NType): Add enumeration to help us
12449         keep track of whether we have an object/delegate creation
12450         or an array creation.
12451         (New:NewType, New::Rank, New::Indices, New::Initializers): New
12452         members to hold data about array creation.
12453         (New:New): Modify to update NewType
12454         (New:New): New Overloaded contructor for the array creation
12455         case.
12456
12457         * cs-parser.jay (array_creation_expression): Implement to call
12458         the overloaded New constructor.
12459         
12460 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
12461
12462         * class.cs (TypeContainer::Constructors): Return member
12463         constructors instead of returning null.
12464
12465 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
12466
12467         * typemanager.cs (InitCoreTypes): Initialize the various core
12468         types after we have populated the type manager with the user
12469         defined types (this distinction will be important later while
12470         compiling corlib.dll)
12471
12472         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12473         on Expression Classification.  Now all expressions have a method
12474         `Resolve' and a method `Emit'.
12475
12476         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12477         generation from working.     Also add some temporary debugging
12478         code. 
12479         
12480 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
12481
12482         * codegen.cs: Lots of code generation pieces.  This is only the
12483         beginning, will continue tomorrow with more touches of polish.  We
12484         handle the fundamentals of if, while, do, for, return.  Others are
12485         trickier and I need to start working on invocations soon.
12486         
12487         * gen-treedump.cs: Bug fix, use s.Increment here instead of
12488         s.InitStatement. 
12489
12490         * codegen.cs (EmitContext): New struct, used during code
12491         emission to keep a context.   Most of the code generation will be
12492         here. 
12493
12494         * cs-parser.jay: Add embedded blocks to the list of statements of
12495         this block.  So code generation proceeds in a top down fashion.
12496
12497 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
12498
12499         * statement.cs: Add support for multiple child blocks.
12500
12501 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
12502
12503         * codegen.cs (EmitCode): New function, will emit the code for a
12504         Block of code given a TypeContainer and its ILGenerator. 
12505
12506         * statement.cs (Block): Standard public readonly optimization.
12507         (Block::Block constructors): Link children. 
12508         (Block::Child): Child Linker.
12509         (Block::EmitVariables): Emits IL variable declarations.
12510
12511         * class.cs: Drop support for MethodGroups here, delay until
12512         Semantic Analysis.
12513         (Method::): Applied the same simplification that I did before, and
12514         move from Properties to public readonly fields.
12515         (Method::ParameterTypes): Returns the parameter types for the
12516         function, and implements a cache that will be useful later when I
12517         do error checking and the semantic analysis on the methods is
12518         performed.
12519         (Constructor::GetCallingConvention): Renamed from CallingConvetion
12520         and made a method, optional argument tells whether this is a class
12521         or a structure to apply the `has-this' bit.
12522         (Method::GetCallingConvention): Implement, returns the calling
12523         convention. 
12524         (Method::Define): Defines the type, a second pass is performed
12525         later to populate the methods.
12526
12527         (Constructor::ParameterTypes): implement a cache similar to the
12528         one on Method::ParameterTypes, useful later when we do semantic
12529         analysis. 
12530
12531         (TypeContainer::EmitMethod):  New method.  Emits methods.
12532
12533         * expression.cs: Removed MethodGroup class from here.
12534         
12535         * parameter.cs (Parameters::GetCallingConvention): new method.
12536
12537 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
12538
12539         * class.cs (TypeContainer::Populate): Drop RootContext from the
12540         argument. 
12541
12542         (Constructor::CallingConvention): Returns the calling convention.
12543         (Constructor::ParameterTypes): Returns the constructor parameter
12544         types. 
12545         
12546         (TypeContainer::AddConstructor): Keep track of default constructor
12547         and the default static constructor.
12548
12549         (Constructor::) Another class that starts using `public readonly'
12550         instead of properties. 
12551
12552         (Constructor::IsDefault): Whether this is a default constructor. 
12553
12554         (Field::) use readonly public fields instead of properties also.
12555
12556         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12557         track of static constructors;  If none is used, turn on
12558         BeforeFieldInit in the TypeAttributes. 
12559
12560         * cs-parser.jay (opt_argument_list): now the return can be null
12561         for the cases where there are no arguments. 
12562
12563         (constructor_declarator): If there is no implicit `base' or
12564         `this', then invoke the default parent constructor. 
12565         
12566         * modifiers.cs (MethodAttr): New static function maps a set of
12567         modifiers flags into a MethodAttributes enum
12568         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
12569         MethodAttr, TypeAttr to represent the various mappings where the
12570         modifiers are used.
12571         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
12572
12573 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
12574
12575         * parameter.cs (GetParameterInfo): Fix bug where there would be no
12576         method arguments.
12577
12578         * interface.cs (PopulateIndexer): Implemented the code generator
12579         for interface indexers.
12580
12581 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
12582
12583         * interface.cs (InterfaceMemberBase): Now we track the new status
12584         here.  
12585
12586         (PopulateProperty): Implement property population.  Woohoo!  Got
12587         Methods and Properties going today. 
12588
12589         Removed all the properties for interfaces, and replaced them with
12590         `public readonly' fields. 
12591
12592 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
12593
12594         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12595         initialize their hashtables/arraylists only when they are needed
12596         instead of doing this always.
12597
12598         * parameter.cs: Handle refs and out parameters.
12599
12600         * cs-parser.jay: Use an ArrayList to construct the arguments
12601         instead of the ParameterCollection, and then cast that to a
12602         Parameter[] array.
12603
12604         * parameter.cs: Drop the use of ParameterCollection and use
12605         instead arrays of Parameters.
12606
12607         (GetParameterInfo): Use the Type, not the Name when resolving
12608         types. 
12609
12610 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
12611
12612         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12613         and instead use public readonly fields.
12614
12615         * class.cs: Put back walking code for type containers.
12616
12617 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
12618
12619         * class.cs (MakeConstant): Code to define constants.
12620
12621         * rootcontext.cs (LookupType): New function.  Used to locate types 
12622
12623         
12624 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
12625
12626         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
12627         this System.Reflection code is.  Kudos to Microsoft
12628         
12629         * typemanager.cs: Implement a type cache and avoid loading all
12630         types at boot time.  Wrap in LookupType the internals.  This made
12631         the compiler so much faster.  Wow.  I rule!
12632         
12633         * driver.cs: Make sure we always load mscorlib first (for
12634         debugging purposes, nothing really important).
12635
12636         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
12637         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
12638
12639         * rootcontext.cs: Lookup types on their namespace;  Lookup types
12640         on namespaces that have been imported using the `using' keyword.
12641
12642         * class.cs (TypeContainer::TypeAttr): Virtualize.
12643         (Class::TypeAttr): Return attributes suitable for this bad boy.
12644         (Struct::TypeAttr): ditto.
12645         Handle nested classes.
12646         (TypeContainer::) Remove all the type visiting code, it is now
12647         replaced with the rootcontext.cs code
12648
12649         * rootcontext.cs (GetClassBases): Added support for structs. 
12650
12651 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
12652
12653         * interface.cs, statement.cs, class.cs, parameter.cs,
12654         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12655         Drop use of TypeRefs, and use strings instead.
12656
12657 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
12658
12659         * rootcontext.cs: 
12660
12661         * class.cs (Struct::Struct): set the SEALED flags after
12662         checking the modifiers.
12663         (TypeContainer::TypeAttr): new property, returns the
12664         TypeAttributes for a class.  
12665
12666         * cs-parser.jay (type_list): Oops, list production was creating a
12667         new list of base types.
12668
12669         * rootcontext.cs (StdLib): New property.
12670         (GetInterfaceTypeByName): returns an interface by type name, and
12671         encapsulates error handling here.
12672         (GetInterfaces): simplified.
12673         (ResolveTree): Encapsulated all the tree resolution here.
12674         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12675         types. 
12676         
12677         * driver.cs: Add support for --nostdlib, to avoid loading the
12678         default assemblies.
12679         (Main): Do not put tree resolution here. 
12680
12681         * rootcontext.cs: Beginning of the class resolution.
12682
12683 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
12684
12685         * rootcontext.cs: Provide better error reporting. 
12686
12687         * cs-parser.jay (interface_base): set our $$ to be interfaces.
12688
12689         * rootcontext.cs (CreateInterface): Handle the case where there
12690         are no parent interfaces.
12691         
12692         (CloseTypes): Routine to flush types at the end.
12693         (CreateInterface): Track types.
12694         (GetInterfaces): Returns an array of Types from the list of
12695         defined interfaces.
12696
12697         * typemanager.c (AddUserType): Mechanism to track user types (puts
12698         the type on the global type hash, and allows us to close it at the
12699         end). 
12700         
12701 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
12702
12703         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12704         RecordInterface instead.
12705
12706         * cs-parser.jay: Updated to reflect changes above.
12707
12708         * decl.cs (Definition): Keep track of the TypeBuilder type that
12709         represents this type here.  Not sure we will use it in the long
12710         run, but wont hurt for now.
12711
12712         * driver.cs: Smaller changes to accomodate the new code.
12713
12714         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12715         when done. 
12716
12717         * rootcontext.cs (CreateInterface):  New method, used to create
12718         the System.TypeBuilder type for interfaces.
12719         (ResolveInterfaces): new entry point to resolve the interface
12720         hierarchy. 
12721         (CodeGen): Property, used to keep track of the code generator.
12722
12723 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
12724
12725         * cs-parser.jay: Add a second production for delegate_declaration
12726         with `VOID'.
12727
12728         (enum_body): Put an opt_comma here instead of putting it on
12729         enum_body or enum_member_declarations so we can handle trailing
12730         commas on enumeration members.  Gets rid of a shift/reduce.
12731         
12732         (type_list): Need a COMMA in the middle.
12733
12734         (indexer_declaration): Tell tokenizer to recognize get/set
12735
12736         * Remove old targets.
12737
12738         * Re-add the parser target.
12739
12740 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12741
12742         * cs-parser.jay: Add precendence rules for a number of operators
12743         ot reduce the number of shift/reduce conflicts in the grammar.
12744         
12745 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
12746
12747         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12748         and put it here.
12749
12750         Get rid of old crufty code.
12751
12752         * rootcontext.cs: Use this to keep track of the parsed
12753         representation and the defined types available to the program. 
12754
12755         * gen-treedump.cs: adjust for new convention.
12756
12757         * type.cs: Split out the type manager, and the assembly builder
12758         from here. 
12759
12760         * typemanager.cs: the type manager will live here now.
12761
12762         * cil-codegen.cs: And the code generator here. 
12763
12764 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
12765
12766         * makefile: Fixed up for easy making.
12767
12768 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12769
12770         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12771         the 
12772
12773         (unary_expression): Expand pre_increment_expression and
12774         post_decrement_expression to reduce a shift/reduce.
12775
12776 2001-07-11  Simon Cozens
12777
12778         * cs-tokenizer.cs: Hex numbers should begin with a 0.
12779
12780         Improve allow_keyword_as_indent name.
12781
12782 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
12783
12784         * Adjustments for Beta2. 
12785
12786 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
12787
12788         * decl.cs: Added `Define' abstract method.
12789         (InTransit): new property, used to catch recursive definitions. 
12790
12791         * interface.cs: Implement `Define'. 
12792
12793         * modifiers.cs: Map Modifiers.constants to
12794         System.Reflection.TypeAttribute flags.
12795
12796         * class.cs: Keep track of types and user-defined types.
12797         (BuilderInit): New method for creating an assembly
12798         (ResolveType): New function to launch the resolution process, only
12799         used by interfaces for now.
12800
12801         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12802         that are inserted into the name space. 
12803
12804 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
12805
12806         * ARGH.  I have screwed up my tree so many times due to the use of
12807         rsync rather than using CVS.  Going to fix this at once. 
12808
12809         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
12810         load types.
12811
12812 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
12813
12814         * Experiment successful: Use System.Type rather that our own
12815         version of Type.  
12816
12817 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
12818
12819         * cs-parser.jay: Removed nsAliases from here.
12820
12821         Use new namespaces, handle `using XXX;' 
12822
12823         * namespace.cs: Reimplemented namespace handling, use a recursive
12824         definition of the class.  Now we can keep track of using clauses
12825         and catch invalid using clauses.
12826
12827 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
12828
12829         * gen-treedump.cs: Adapted for all the renaming.
12830
12831         * expression.cs (Expression): this class now has a Type property
12832         which returns an expression Type.
12833
12834         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12835         `Type', as this has a different meaning now in the base
12836
12837 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
12838
12839         * interface.cs, class.cs: Removed from all the sources the
12840         references to signature computation, as we can not do method
12841         signature computation during the parsing time, as we are not
12842         trying to solve at that point distinguishing:
12843
12844         class X {
12845                 void a (Blah x) {}
12846                 void a (NS.Blah x) {}
12847         }
12848
12849         Which depending on the context might be valid or not, as we do not
12850         know if Blah is the same thing as NS.Blah at that point.
12851
12852         * Redid everything so the code uses TypeRefs now instead of
12853         Types.  TypeRefs are just temporary type placeholders, that need
12854         to be resolved.  They initially have a pointer to a string and the
12855         current scope in which they are used.  This is used later by the
12856         compiler to resolve the reference to an actual Type. 
12857
12858         * DeclSpace is no longer a CIR.Type, and neither are
12859         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
12860         are all DeclSpaces, but no Types. 
12861
12862         * type.cs (TypeRefManager): This implements the TypeRef manager,
12863         which keeps track of all the types that need to be resolved after
12864         the parsing has finished. 
12865
12866 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
12867
12868         * ARGH.  We are going to have to store `foreach' as a class rather
12869         than resolving it, as we need to verify error 1579 after name
12870         resolution.   *OR* we could keep a flag that says `This request to
12871         IEnumerator comes from a foreach statement' which we can then use
12872         to generate the error.
12873
12874 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
12875
12876         * class.cs (TypeContainer.AddMethod): we now add methods to the
12877         MethodGroup instead of the method hashtable.  
12878
12879         * expression.cs: Add MethodGroup abstraction, which gets us one
12880         step closer to the specification in the way we handle method
12881         declarations.  
12882
12883         * cs-parser.jay (primary_expression): qualified_identifier now
12884         tried to match up an identifier to a local variable reference or
12885         to a parameter reference.
12886
12887         current_local_parameters is now a parser global variable that
12888         points to the current parameters for the block, used during name
12889         lookup.
12890
12891         (property_declaration): Now creates an implicit `value' argument to
12892         the set accessor.
12893
12894 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
12895
12896         * parameter.cs: Do not use `param' arguments as part of the
12897         signature, per the spec.
12898
12899 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
12900
12901         * decl.cs: Base class for classes, structs and interfaces.  This
12902         is the "Declaration Space" 
12903
12904         * cs-parser.jay: Use CheckDef for checking declaration errors
12905         instead of having one on each function.
12906
12907         * class.cs: Factor out some code for handling error handling in
12908         accordance to the "Declarations" section in the "Basic Concepts"
12909         chapter in the ECMA C# spec.
12910
12911         * interface.cs: Make all interface member classes derive from
12912         InterfaceMemberBase.
12913
12914 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
12915
12916         * Many things: all interfaces are parsed and generated in
12917         gen-treedump.  Support for member variables, constructors,
12918         destructors, properties, constants is there.
12919
12920         Beginning of the IL backend, but very little done, just there for
12921         testing purposes. 
12922
12923 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
12924
12925         * cs-parser.jay: Fix labeled statement.
12926
12927         * cs-tokenizer.cs (escape): Escape " and ' always.
12928         ref_line, ref_name: keep track of the line/filename as instructed
12929         by #line by the compiler.
12930         Parse #line.
12931
12932 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
12933
12934         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12935         to match the values in System.CodeDOM.
12936
12937         Divid renamed to Divide.
12938
12939         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12940         statements. 
12941         (Statements.set): remove.
12942
12943         * System.CodeDOM/CodeCatchClause.cs: always have a valid
12944         statements. 
12945
12946         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12947         falseStatements always have valid values. 
12948
12949         * cs-parser.jay: Use System.CodeDOM now.
12950