ec6d491e6dbee1ee5f1061a2193b33d3496f5f49
[mono.git] / mcs / gmcs / ChangeLog
1 2003-07-22  Ravi Pratap  <ravi@ximian.com>
2
3         * expression.cs (Invocation.OverloadResolve): Follow the spec more
4         closely: we eliminate methods in base types when we have an
5         applicable method in a top-level type.
6
7         Please see section 14.5.5.1 for an exact description of what goes
8         on. 
9
10         This fixes bug #45127 and a host of other related to corlib compilation.
11
12         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
13         array is the method corresponding to the top-level type (this is
14         because of the changes made to icall.c) so we change this
15         accordingly.
16
17         (MethodGroupExpr.Name): This too.
18
19         * typemanager.cs (GetElementType): New method which does the right
20         thing when compiling corlib. 
21
22         * everywhere: Make use of the above in the relevant places.
23
24 2003-07-22  Martin Baulig  <martin@ximian.com>
25
26         * cs-parser.jay (invocation_expression): Moved
27         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
28         `cast_expression', but create a InvocationOrCast which later
29         resolves to either an Invocation or a Cast.
30
31         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
32         method; call this before EmitStatement() to make sure that this
33         expression can be used as a statement.
34
35         * expression.cs (InvocationOrCast): New class; resolves to either
36         an Invocation or a Cast.
37
38         * statement.cs (StatementExpression): Call ResolveStatement() on
39         the ExpressionStatement before emitting it.
40
41 2003-07-21  Martin Baulig  <martin@ximian.com>
42
43         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
44         `ref' and `out' attributes match; fixes #46220.
45         (MemberAccess.ResolveMemberAccess): You can't reference a type
46         through an expression; fixes #33180.
47         (Indexers.GetIndexersForType): Don't return the indexers from
48         interfaces the class implements; fixes #46502.
49
50 2003-07-21  Martin Baulig  <martin@ximian.com>
51
52         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
53         CS0661 checks; fixes bug #30442.
54
55 2003-07-21  Martin Baulig  <martin@ximian.com>
56
57         * decl.cs (AdditionResult): Added `Error'.
58
59         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
60
61         * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
62         makes cs0031.cs actually work.
63
64 2003-07-20  Martin Baulig  <martin@ximian.com>
65
66         * namespace.cs: Fixed that bug which caused a crash when compiling
67         the debugger's GUI.
68
69 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
70
71         * typemanager.cs (LookupTypeReflection): Never expose types which
72         are NotPublic, NestedPrivate, NestedAssembly, or
73         NestedFamANDAssem.  We used to return these, and later do a check
74         that would report a meaningful error, but the problem is that we
75         would not get the real match, if there was a name override.
76
77 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
78
79         * namespace.cs (Namespace, Name): Do not compute the namespace
80         name dynamically, compute it in the constructor.  This reduced
81         memory usage by 1697 KB.
82
83         * driver.cs: Use --pause to pause at the end.
84
85 2003-07-17  Peter Williams  <peter@newton.cx>
86
87         * Makefile: Change the name of the test target so that it doesn't
88         conflict with the recursive test target.
89
90 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
91
92         * expression.cs (LocalVariableReference.Emit, EmitAssign,
93         AddressOf): Do not use EmitThis, that was wrong, use the actual
94         this pointer.
95
96 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
97
98         * class.cs (MethodData.Define): While checking if a method is an
99         interface implementation, improve the test: If we are not public
100         (use new test here: use the computed MethodAttributes directly,
101         instead of the parsed modifier flags) check if the `implementing'
102         method comes from an interface or not.
103
104         * pending.cs (VerifyPendingMethods): Slightly better error
105         message.
106
107         * makefile: add test target that does the mcs bootstrap.
108
109 2003-07-16  Ravi Pratap  <ravi@ximian.com>
110
111         * interface.cs (Define): Do nothing here since there are no
112         members to populate etc. Move the attribute emission out of here
113         since this was just totally the wrong place to put it. Attribute
114         application happens during the 'Emit' phase, not in the 'Define'
115         phase.
116
117         (Emit): Add this method and move the attribute emission here
118
119         * rootcontext.cs (EmitCode): Call the Emit method on interface
120         types too.
121
122 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
123
124         * expression.cs (OverloadResolve): Report error only if Location
125         is not 'Null' which means that there was a probe going on.
126
127 2003-07-14  Martin Baulig  <martin@ximian.com>
128
129         * expression.cs (ConditionalLogicalOperator): New public class to
130         implement user defined conditional logical operators.
131         This is section 14.11.2 in the spec and bug #40505.
132
133 2003-07-14  Martin Baulig  <martin@ximian.com>
134
135         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
136
137 2003-07-14  Martin Baulig  <martin@ximian.com>
138
139         * codegen.cs (EmitContext.InFixedInitializer): New public field.
140
141         * ecore.cs (IVariable.VerifyFixed): New interface method.
142
143         * expression.cs (Unary.ResolveOperator): When resolving the `&'
144         operator, check whether the variable is actually fixed.  Fixes bug
145         #36055.  Set a variable definitely assigned when taking its
146         address as required by the spec.
147
148         * statement.cs (LocalInfo.IsFixed): New field.
149         (LocalInfo.MakePinned): Set `IsFixed' to true.
150
151 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
152
153         * attribute.cs (Attribute.Resolve): While doing a Member lookup
154         for .ctors, ensure that we only ask for members declared in the
155         attribute type (BindingFlags.DeclaredOnly).
156
157         Fixes bug #43632.
158
159         * expression.cs (Error_WrongNumArguments): Report error 1501
160         correctly the way CSC does.
161
162 2003-07-13  Martin Baulig  <martin@ximian.com>
163
164         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
165         lookup on the fully qualified name, to make things like "X.X" work
166         where "X.X" is a fully qualified type name, but we also have a
167         namespace "X" in the using list.  Fixes #41975.
168
169 2003-07-13  Martin Baulig  <martin@ximian.com>
170
171         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
172         function. If we're a CompoundAssign, we need to create an embedded
173         CompoundAssign, not an embedded Assign.
174         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
175         Fixes #45854.
176
177 2003-07-13  Martin Baulig  <martin@ximian.com>
178
179         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
180         work to fix bug #46088.
181
182 2003-07-13  Ravi Pratap <ravi@ximian.com>
183
184         * class.cs (Operator.Emit): Do not emit attributes here - it is
185         taken care of by the Method class that we delegate too. This takes
186         care of bug #45876.
187         
188 2003-07-10  Martin Baulig  <martin@ximian.com>
189
190         * expression.cs (TypeOfVoid): New class.
191         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
192
193 2003-07-10  Martin Baulig  <martin@ximian.com>
194
195         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
196         bug #35957.
197
198 2003-07-10  Martin Baulig  <martin@ximian.com>
199
200         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
201         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
202
203         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
204
205         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
206
207 2003-07-10  Martin Baulig  <martin@ximian.com>
208
209         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
210         of decimal.  Fixes #42850.
211
212         NOTE: I also fixed the created byte blob, but this doesn't work on
213         the MS runtime and csc never produces any byte blobs for decimal
214         arrays.
215
216 2003-07-10  Martin Baulig  <martin@ximian.com>
217
218         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
219         structs; fixes #32068.
220         (Block.AddChildVariableNames): Fixed #44302.
221
222 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
223
224         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
225         
226 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
227
228         * attribute.cs: And this test is onger needed.
229
230 2003-07-08  Martin Baulig  <martin@ximian.com>
231
232         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
233         inaccessible types.  Fixes #36313.
234
235         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
236
237         * namespace.cs (NamespaceEntry): Create implicit entries for all
238         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
239         implicit entries for N1.N2 and N1.
240
241 2003-07-08  Martin Baulig  <martin@ximian.com>
242
243         Rewrote the handling of namespaces to fix a lot of the issues
244         wrt. `using' aliases etc.
245
246         * namespace.cs (Namespace): Splitted this class into a
247         per-assembly `Namespace' and a per-file `NamespaceEntry'.
248
249         * typemanager.cs (TypeManager.IsNamespace): Removed.
250         (TypeManager.ComputeNamespaces): Only compute namespaces from
251         loaded assemblies here, not the namespaces from the assembly we're
252         currently compiling.
253
254 2003-07-08  Martin Baulig  <martin@ximian.com>
255
256         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
257
258 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
259
260         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
261         already fixed it.  
262
263         I thought about the memory savings here, but LookupTypeReflection
264         is used under already very constrained scenarios.  Compiling
265         corlib or mcs only exposes one hit, so it would not really reduce
266         any memory consumption.
267
268 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
269
270         * typemanager.cs: fixes bug #45889 by only adding public types from
271         other assemblies to the list of known types.
272
273 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
274
275         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
276         on the type we resolved.
277
278 2003-07-05  Martin Baulig  <martin@ximian.com>
279
280         * pending.cs (PendingImplementation.ParentImplements): Don't
281         create the proxy if the parent is abstract.
282
283         * class.cs (TypeContainer.DefineIndexers): Process explicit
284         interface implementations first.  Fixes #37714.
285
286 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
287
288         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
289         defined recursively;  but since we modify the input parameters
290         (left is set to `this' temporarily), we reset this value if the
291         left_is_explicit is false, which gives the original semantics to
292         the code.  
293
294         * literal.cs (NullPointer): new class used to represent a null
295         literal in a pointer context.
296
297         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
298         type is a pointer, use a NullPointer object instead of a
299         NullLiteral.   Closes 43687
300
301         (ExplicitConversion): Convert pointer values using
302         the conv opcode to the proper type.
303
304         * ecore.cs (New): change ValueTypeVariable property into a method,
305         that returns whether the valuetype is suitable for being used.
306
307         * expression.cs (Binary.DoNumericPromotions): Only return if we
308         the int constant was a valid uint, and we can return both left and
309         right as uints.  If not, we continue processing, to trigger the
310         type conversion.  This fixes 39018.
311
312         * statement.cs (Block.EmitMeta): During constant resolution, set
313         the CurrentBlock property on the emitcontext, so that we resolve
314         constants propertly.
315
316 2003-07-02  Martin Baulig  <martin@ximian.com>
317
318         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
319         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
320
321         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
322         than emitting it here.
323
324         * statement.cs: Fixed some more flow analysis bugs.
325
326 2003-07-02  Martin Baulig  <martin@ximian.com>
327
328         * class.cs (MethodData.Define): When implementing interface
329         methods, set Final unless we're Virtual.
330
331         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
332         check work for interface methods.
333
334 2003-07-01  Martin Baulig  <martin@ximian.com>
335
336         * ecore.cs (EmitContext.This): Replaced this property with a
337         GetThis() method which takes a Location argument.  This ensures
338         that we get the correct error location for a CS0188.
339
340 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
341
342         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
343         ImplicitStandardConversion.
344
345         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
346
347 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
348
349         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
350         optimization.
351
352 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
353
354         * class.cs (Constructor.Define): Turn off initlocals for unsafe
355         constructors.
356
357         (MethodData.Define): Turn off initlocals for unsafe methods.
358
359 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
360
361         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
362         complete;  Fixes #37521.
363
364         * delegate.cs: Use Modifiers.TypeAttr to compute the
365         TypeAttributes, instead of rolling our own.  This makes the flags
366         correct for the delegates.
367
368 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
369
370         * class.cs (Constructor.Define): Set the private flag for static
371         constructors as well.
372
373         * cs-parser.jay (statement_expression): Set the return value to
374         null, to avoid a crash when we catch an error.
375
376 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
377
378         * cs-parser.jay: Applied patch from Jackson that adds support for
379         extern and unsafe modifiers to destructor declarations.
380
381         * expression.cs: Report error 21 if the user is trying to index a
382         System.Array.
383
384         * driver.cs: Add an error message, suggested by the bug report.
385
386         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
387         if we do not have a ": this ()" constructor initializer.  Fixes 45149
388
389 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
390
391         * namespace.cs: Add some information to reduce FAQs.
392
393 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
394
395         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
396         underlying enumeration types.  Fixes #43915.
397
398         * expression.cs: Treat ushort/short as legal values to be used in
399         bitwise operations.
400
401 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
402
403         * delegate.cs: transfer custom attributes for paramenters from
404         the delegate declaration to Invoke and BeginInvoke.
405
406 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
407
408         * attribute.cs: handle custom marshalers and emit marshal info
409         for fields, too.
410
411 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
412
413         * makefile.gnu: Added anonymous.cs to the compiler sources.
414
415 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
416
417         * iterators.cs: Change the name of the proxy class to include two
418         underscores.
419
420         * cs-parser.jay: Update grammar to include anonymous methods.
421         
422         * anonymous.cs: new file.
423
424 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
425
426         * class.cs (Field.Define): Add missing test for pointers and
427         safety. 
428
429 2003-05-27  Ravi Pratap  <ravi@ximian.com>
430
431         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
432         we use the stobj opcode.
433
434         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
435         since it wasn't the correct fix. 
436
437         It still is puzzling that we are required to use stobj for IntPtr
438         which seems to be a ValueType.
439
440 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
441
442         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
443         during regular simple name resolution.   Now, the trick is that
444         instead of returning for processing the simplename, we do a
445         TypeManager.LookupType (ie, a rooted lookup as opposed to a
446         contextual lookup type).   If a match is found, return that, if
447         not, return for further composition.
448
449         This fixes long-standing 30485.
450
451         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
452         using the address to initialize an object, do an Stobj instead of
453         using the regular Stelem.
454
455         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
456         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
457         Because if we are a BaseIndexerAccess that value will be true.
458         Fixes 43643.
459
460         * statement.cs (GotoCase.Resolve): Return after reporting an
461         error, do not attempt to continue. 
462
463         * expression.cs (PointerArithmetic.Emit): If our operand is a
464         long, convert our constants to match the operand before
465         multiplying.  Convert to I type before adding.   Fixes 43670.
466         
467 2003-05-14  Ravi Pratap  <ravi@ximian.com>
468
469         * enum.cs (ImplicitConversionExists) : Rename to
470         ImplicitEnumConversionExists to remove ambiguity. 
471
472         * ecore.cs (NullCast): New type of cast expression class which
473         basically is very similar to EmptyCast with the difference being
474         it still is a constant since it is used only to cast a null to
475         something else
476         (eg. (string) null)
477
478         * convert.cs (ImplicitReferenceConversion): When casting a null
479         literal, we return a NullCast.
480
481         * literal.cs (NullLiteralTyped): Remove - I don't see why this
482         should be around anymore.
483
484         The renaming (reported was slightly wrong). Corrections:
485
486         ConvertImplicitStandard -> ImplicitConversionStandard
487         ConvertExplicitStandard -> ExplicitConversionStandard
488
489         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
490         before passing them in !
491
492         * convert.cs (ImplicitConversionStandard): When comparing for
493         equal expr and target types, ensure that expr is not a
494         NullLiteral.
495
496         In general, we must not be checking (expr_type ==
497         target_type) in the top level conversion methods
498         (ImplicitConversion, ExplicitConversion etc). This checking is
499         done in the methods that they delegate to.
500
501 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
502
503         * convert.cs: Move Error_CannotConvertType,
504         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
505         ImplicitNumericConversion, ImplicitConversionExists,
506         ImplicitUserConversionExists, StandardConversionExists,
507         FindMostEncompassedType, FindMostSpecificSource,
508         FindMostSpecificTarget, ImplicitUserConversion,
509         ExplicitUserConversion, GetConversionOperators,
510         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
511         TryImplicitIntConversion, Error_CannotConvertImplicit,
512         ConvertImplicitRequired, ConvertNumericExplicit,
513         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
514         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
515         its own file.
516
517         Perform the following renames:
518         
519         StandardConversionExists -> ImplicitStandardConversionExists
520         ConvertImplicit -> ImplicitConversion
521         ConvertImplicitStandard -> ImplicitStandardConversion
522         TryImplicitIntConversion -> ImplicitIntConversion
523         ConvertImplicitRequired -> ImplicitConversionRequired
524         ConvertNumericExplicit -> ExplicitNumericConversion
525         ConvertReferenceExplicit -> ExplicitReferenceConversion
526         ConvertExplicit -> ExplicitConversion
527         ConvertExplicitStandard -> ExplicitStandardConversion
528
529 2003-05-19  Martin Baulig  <martin@ximian.com>
530
531         * statement.cs (TypeInfo.StructInfo): Made this type protected.
532         (TypeInfo): Added support for structs having structs as fields.
533
534         * ecore.cs (FieldExpr): Implement IVariable.
535         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
536         VariableInfo for the field.
537
538 2003-05-18  Martin Baulig  <martin@ximian.com>
539
540         * expression.cs (This.DoResolve): Report a CS0027 if we're
541         emitting a field initializer.
542
543 2003-05-18  Martin Baulig  <martin@ximian.com>
544
545         * expression.cs (This.ResolveBase): New public function.
546         (This.DoResolve): Check for CS0188.
547
548         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
549         This.Resolve().
550
551         * ecore.cs (MethodGroupExpr.DoResolve): Set the
552         `instance_expression' to null if we don't have any non-static
553         methods.
554
555 2003-05-18  Martin Baulig  <martin@ximian.com>
556
557         Reworked the way how local variables and parameters are handled by
558         the flow analysis code.
559
560         * statement.cs (TypeInfo, VariableMap): New public classes.
561         (VariableInfo): New public class.  This is now responsible for
562         checking whether a variable has been assigned.  It is used for
563         parameters and local variables.
564         (Block.EmitMeta): Take the InternalParameters as argument; compute
565         the layout of the flow vectors here.
566         (Block.LocalMap, Block.ParameterMap): New public properties.
567         (FlowBranching): The .ctor doesn't get the InternalParameters
568         anymore since Block.EmitMeta() now computes the layout of the flow
569         vector.
570         (MyStructInfo): This class is now known as `StructInfo' and nested
571         in `TypeInfo'; we don't access this directly anymore.
572
573         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
574         property and removed IsAssigned(), IsFieldAssigned(),
575         SetAssigned() and SetFieldAssigned(); we now call them on the
576         VariableInfo so we don't need to duplicate this code everywhere.
577
578         * expression.cs (ParameterReference): Added `Block block' argument
579         to the .ctor.
580         (LocalVariableReference, ParameterReference, This): The new
581         VariableInfo class is now responsible for all the definite
582         assignment stuff.
583
584         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
585         IsParameterAssigned, SetParameterAssigned): Removed.
586
587 2003-05-18  Martin Baulig  <martin@ximian.com>
588
589         * typemanager.cs (InitCoreTypes): Try calling
590         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
591         the 3-args-version.  Corlib now also needs our `void_type'.
592         (GetMethod): Added overloaded version which takes an optional
593         `bool report_errors' to allow lookups of optional methods.
594
595 2003-05-12  Martin Baulig  <martin@ximian.com>
596
597         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
598         only used for locals and not for parameters.
599
600 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
601
602         * support.cs (InternalParameters.ParameterType): Return the
603         ExternalType of the parameter.
604
605         * parameter.cs (Parameter.ExternalType): drop the two arguments,
606         they were unused.
607
608 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
609
610         * class.cs (MethodData.Define): Do not set the `newslot' on
611         interface members, if they are also flagged as "override".
612
613         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
614         better code for ++i and i++.  This only works for static fields
615         and local variables.
616
617         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
618         want to pull the DeclSpace out of the builder_to_declspace instead
619         of the TypeBuilder (like in TypeContainer.FindMembers).
620
621         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
622         instead of LookupTypeContainer.  Fixes the crash on .NET for
623         looking up interface members.
624
625         * const.cs: Create our own emit context during the Definition
626         stage, so that constants are evaluated in the proper context, when
627         a recursive definition happens.
628
629 2003-05-11  Martin Baulig  <martin@ximian.com>
630
631         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
632         new block for a switch section.
633         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
634         the adding/lookup in the switch block.  Fixes #39828.
635
636 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
637
638         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
639         functionality: I needed to convert the data after I had performed
640         the add/sub operation into the operands type size.
641
642         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
643         pass the type for the box operation, otherwise the resulting
644         object would have been of type object.
645
646         (BoxedCast): Add constructor to specify the type to box as.
647
648 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
649
650         * iterators.cs: I was reusing the `count' variable inadvertently,
651         take steps to not allow this to happen.
652
653 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
654
655         * attribute.cs (Attribute.Resolve): Params attributes are encoded
656         by creating an array at the point where the params starts and
657         putting all those arguments there, then adjusting the size of the
658         array.
659
660 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
661
662         * expression.cs (New.AddressOf): Implement interface
663         IMemoryLocation.  This is used when the `new' operator is used in
664         the context of an invocation to a method on a value type.
665
666         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
667         example. 
668
669         * namespace.cs: Also check the using aliases here.
670
671         * driver.cs: Move the test for using validity after the types have
672         been entered, so we do a single pass that also includes the using
673         aliases. 
674
675         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
676         in the regular case.   CreateSiblingForFinally is doing extra
677         error checking.
678
679         * attribute.cs (GetAttributeArgumentExpression): Store the result
680         on an out value, and use the return value to indicate failure
681         instead of using null (which is a valid return for Constant.GetValue).
682
683         * statement.cs: Perform the analysis flow for the increment
684         portion after the statement, because this will be the real flow of
685         execution.  Fixes #42385
686
687         * codegen.cs (EmitContext.EmitArgument,
688         EmitContext.EmitStoreArgument): New helper functions when the
689         RemapToProxy flag is set.
690
691         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
692         function.
693
694         Add support for remapping parameters. 
695
696         * iterators.cs: Propagate parameter values;  Store parameter
697         values in the proxy classes.
698         
699 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
700
701         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
702         need a proxy reference;  I do not know what I was thinking
703
704         * cs-parser.jay (constructor_initializer): catch another error,
705         and display nice message.
706         
707         (field_declaration): catch void field declaration
708         to flag a better error. 
709
710         * class.cs (MemberBase.CheckBase): Report an error instead of a
711         warning if a new protected member is declared in a struct. 
712         (Field.Define): catch the error of readonly/volatile.
713
714         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
715
716         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
717         volatile variable is taken
718
719 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
720
721         * statement.cs (Fixed.Resolve): Report an error if we are not in
722         an unsafe context.
723
724 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
725
726         * typemanager.cs: reuse the code that handles type clashes for
727         delegates and enumerations.
728
729         * class.cs (Report28): Always report.
730
731         * expression.cs (EncodeAsAttribute): Allow nulls here.
732
733 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
734
735         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
736         the functionality for testing whether an expression is valid for
737         an attribute here.  Also handle the case of arrays of elements
738         being stored. 
739
740         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
741         encoding a linear array into an array of objects that are suitable
742         to be passed to an CustomAttributeBuilder.
743
744         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
745
746         * ecore.cs: (FieldExpr): Handle field remapping here.
747
748         * iteratators.cs: Pass the instance variable (if the method is an
749         instance method) to the constructors, so we can access the field
750         variables on the class.
751
752         TODO: Test this with structs.  I think the THIS variable on
753         structs might have to be a pointer, and not a refenrece
754
755 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
756
757         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
758         local variables to fields in a proxy class.
759
760         * iterators.cs (PopulateProxy): Rename our internal fields to
761         <XXX>.  
762         Create a <THIS> field if we are an instance method, so we can
763         reference our parent container variables.
764         (MapVariable): Called back from the EmitContext code to enter a
765         new variable to field mapping into the proxy class (we just create
766         a FieldBuilder).
767
768         * expression.cs
769         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
770         for using the remapped locals to fields.
771
772         I placed the code here, because that gives the same semantics to
773         local variables, and only changes the Emit code.
774
775         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
776         statements inside iterators.
777         (VariableInfo): Add a FieldBuilder for the cases when we are
778         remapping local variables to fields in a proxy class
779
780         * ecore.cs (SimpleNameResolve): Avoid testing two times for
781         current_block != null.
782
783         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
784         not cope with strings, as it has been moved to the
785         TableSwitchEmit.  Fixed bug in switch generation.
786
787         * expression.cs (New.DoResolve): Provide more context for the user
788         when reporting an error.
789
790         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
791         pointers. 
792
793         * expression.cs (MemberAccess.DoResolve): When we get a type back,
794         check the permissions for it.  Note than in a type-resolution
795         context the check was already present in DeclSpace.ResolveType,
796         but was missing from the MemberAccess.
797
798         (ArrayCreation.CheckIndices): warn if the user has
799         more nested levels of expressions, but there are no more
800         dimensions specified.  Avoids crash on bug 41906.
801
802 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
803
804         * statement.cs (Block): replace Implicit bool, for a generic
805         flags.   
806         New flag: `Unchecked'.  This is used during the EmitMeta phase
807         (which is out-of-line with the regular Resolve/Emit process for a
808         statement, as this is done ahead of time, but still gets a chance
809         to call constant resolve).
810         
811         (Block.Flags): new enum for adding a new flag.
812
813         (Block.EmitMeta): track the state of unchecked.
814         
815         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
816         to enable constant resolution to work there as well.
817
818 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
819
820         * typemanager.cs (ienumerable_type): Also look up
821         System.Collections.IEnumerable. 
822
823 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
824
825         TODO: Test more than one conditional per method.
826         
827         * class.cs (Indexer.Define): Report the location where the user is
828         referencing the unsupported feature.
829
830         (MethodData): Overload the use of `conditionals' to
831         minimize the creation of needless ArrayLists.   This saves roughly
832         212kb on my machine.
833
834         (Method): Implement the new IIteratorContainer interface.
835         (Method.SetYields): Implement the method by setting the ModFlags
836         to contain METHOD_YIELDS.
837         
838         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
839         which just got set to null.
840
841         * iterators.cs: New file.
842
843         (Yield, YieldBreak): New statements.
844
845         * statement.cs (Return.Resolve): Flag an error if we are used in
846         an iterator method.
847
848         * codegen.cs (InIterator): New flag set if the code is being
849         compiled in an iterator method.
850
851         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
852         internal modifier, and we just use it to avoid adding extra
853         fields, as this is seldom used.  
854
855         * cs-parser.jay: Add yield_statement (yield and yield break).
856
857         * driver.cs: New flag -v2 to turn on version 2 features. 
858
859         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
860         hashtable when v2 is enabled.
861
862 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
863
864         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
865         there is already a namespace defined with this name.
866
867         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
868         people upgraded their corlibs.
869
870         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
871         always use fully qualified types, no need to use the compiler
872         front end.
873
874         (TypeManager.IsNamespace): Use binarysearch.
875         
876         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
877         AddDelegate): I did not quite use the new IsValid API properly: I
878         have to pass the short-name and the fullname.  I was passing only
879         the basename instead of the fullname sometimes. 
880
881         (TypeContainer.DefineType): call NamespaceClash.
882
883         * interface.cs (Interface.DefineType): use NamespaceClash before
884         defining the type.
885
886         * delegate.cs (Delegate.DefineType): use NamespaceClash before
887         defining the type.
888
889         * enum.cs: (Enum.DefineType): use NamespaceClash before
890         defining the type.
891
892         * typemanager.cs (: 3-line patch that gives us some tasty 11%
893         speed increase.  First, use the negative_hits cache when we get a
894         negative.  Second, add the type with its full original name
895         instead of the new . and + encoded name (reflection uses + to
896         separate type from a nested type).  Use LookupTypeReflection
897         directly which bypasses the type->name hashtable (that we already
898         know does not contain the type.
899         
900         * decl.cs (DeclSpace.ResolveTypeExpr): track the
901         location/container type. 
902
903         * driver.cs: When passing utf8, use directly the UTF8Encoding.
904
905 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
906
907         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
908
909         * delegate.cs (NewDelegate.Resolve): Test whether an instance
910         method is being referenced in the method group from a static
911         context, and report error 120 if so.
912
913         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
914         Error118. 
915
916         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
917         is created, we create the A namespace).
918
919         * cs-parser.jay: A namespace also introduces a DeclarationFound.
920         Fixes #41591
921
922 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
923
924         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
925         invocation to ModuleBuilder.GetType with the same values will
926         return a new type instance, so we need to cache its return
927         values. 
928
929         * expression.cs (Binary.ResolveOperator): Only allow the compare
930         operators on enums if they are of the same type.
931
932         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
933         types of ValueType on their own case.  Before we were giving them
934         the same treatment as objects.
935
936         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
937         fullname.  Short name is used to compare against container name.
938         Fullname is used to check against defined namespace names.
939         
940         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
941         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
942
943         (Method.CheckBase): Call parent.
944         (MemberBase.CheckBase): Check for protected members on sealed
945         classes.
946         (PropertyBase.CheckBase): Call parent.
947         (Field.Define): Call parent.
948
949         * report.cs: Negative error codes are now mapped to 8000 - code,
950         so that the display is render more nicely.
951
952         * typemanager.cs: Do not use try/catch, instead report a regular
953         error. 
954
955         (GetPointerType, GetReferenceType): These methods provide
956         mechanisms to obtain the T* and T& from a T.  We had the code
957         previously scattered around the code base, and it also used
958         TypeManager.LookupType that would go through plenty of caches.
959         This one goes directly to the type source.
960
961         In some places we did the Type.GetType followed by
962         ModuleBuilder.GetType, but not in others, so this unifies the
963         processing as well.
964
965         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
966         statements now that we have namespace information.
967
968         * typemanager.cs (IsNamespace): New method, returns whether the
969         string presented is a namespace or not.
970
971         (ComputeNamespaces): New public entry point, computes the list of
972         available namespaces, using the GetNamespaces API call in Mono, or
973         the slower version in MS.NET.   
974
975         Now before we start the semantic analysis phase, we have a
976         complete list of namespaces including everything that the user has
977         provided.
978
979         Deleted old code to cache namespaces in .nsc files.
980
981 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
982
983         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
984         class/struct location definition Location for the implicit
985         constructor location.
986
987         (Operator.Define): Use the location of the operator for the
988         implicit Method definition.
989
990         (Constructor.Emit): use the constructor location for the implicit
991         base initializer constructor.
992
993         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
994         and the Expression class now contains two new methods:
995
996         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
997         isolate type lookup from the rest of the resolution process.
998
999         Since we use Expressions to hold type definitions due to the way
1000         we parse the input we have historically overloaded Resolve to
1001         perform the Type lookups if a special flag is passed.  Now this is
1002         eliminated and two methods take their place. 
1003         
1004         The differences in the two methods between xStep and xTerminal is
1005         that xStep is involved in our current lookup system that uses
1006         SimpleNames to compose a name, while xTerminal is used just to
1007         catch the case where the simplename lookup failed.
1008         
1009 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
1010
1011         * expression.cs (ResolveMemberAccess): Remove redundant code.
1012         TypeExpr expressions are always born fully resolved.
1013
1014         * interface.cs (PopulateMethod): Do not lookup the types twice.
1015         We were doing it once during SemanticAnalysis and once during
1016         PopulateMethod.
1017
1018         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1019         in local variable type definitions, were being returned as a
1020         SimpleName (we decomposed everything into a string), that is
1021         because primary_expression was being used instead of a type in the
1022         grammar (reduce/reduce conflicts).
1023
1024         The part that was wrong is that we converted the expression into a
1025         string (an oversimplification in one hand, compounded with primary
1026         expressions doing string concatenation).
1027
1028         So things like:
1029
1030         A.B.C [] x;
1031
1032         Would return "A.B.C[]" as a SimpleName.  This stopped things like
1033         using clauses from working on this particular context.  And a type
1034         was being matched directly against "A.B.C[]".
1035
1036         We now use the correct approach, and allow for ComposedCast to be
1037         part of the unary expression.  So the "A.B.C []" become a composed
1038         cast of "A.B.C" (as a nested group of MemberAccess with a
1039         SimpleName at the end) plus the rank composition "[]". 
1040
1041         Also fixes 35567
1042         
1043 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
1044
1045         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1046         for the access level checking.
1047
1048         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
1049         `TypeContainer container', because I kept getting confused when I
1050         was debugging this code.
1051
1052         * expression.cs (Indexers): Instead of tracking getters/setters,
1053         we now track them in parallel.  We create one arraylist less, but
1054         most importantly it is possible now for the LValue code to find a
1055         matching get for a set.
1056
1057         (IndexerAccess.DoResolveLValue): Update the code.
1058         GetIndexersForType has been modified already to extract all the
1059         indexers from a type.  The code assumed it did not.
1060
1061         Also make the code set the correct return type for the indexer.
1062         This was fixed a long time ago for properties, but was missing for
1063         indexers.  It used to be void_type.
1064
1065         (Binary.Emit): Test first for doubles instead of
1066         floats, as they are more common.
1067
1068         (Binary.EmitBranchable): Use the .un version of the branch opcodes
1069         when dealing with floats and the <=, >= operators.  This fixes bug
1070         #39314 
1071
1072         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1073         to load the array value by emitting a load on the foreach variable
1074         type.  This was incorrect.  
1075
1076         We now emit the code to load an element using the the array
1077         variable type, and then we emit the conversion operator.
1078
1079         Fixed #40176
1080
1081 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
1082
1083         * attribute.cs: Avoid allocation of ArrayLists in the common case.
1084
1085 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
1086
1087         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1088         test for protection before we test for signatures. 
1089
1090         (MethodSignature.ToString): implement.
1091
1092         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1093         to the case where we reduced into a LongConstant.
1094
1095         * decl.cs (CheckAccessLevel): If the type is an array, we can not
1096         depend on whether the information is acurrate, because the
1097         Microsoft runtime will always claim that the array type is public,
1098         regardless of the real state.
1099
1100         If the type is a pointer, another problem happens: the type is
1101         reported as non-public in Microsoft.  
1102
1103         In both cases we have to call CheckAccessLevel recursively with
1104         the underlying type as the argument to be tested.
1105
1106 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
1107
1108         * assign.cs (Assign.Emit): If we are dealing with a compound
1109         assignment expression, we should use the code path that stores the
1110         intermediate result in a temporary value.  This fixes #40903.
1111
1112         *expression.cs (Indirection.ToString): Provide ToString method for
1113         debugging. 
1114         
1115 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
1116
1117         * class.cs: Null out fields holding references to Block objects so
1118         they can be garbage collected.
1119
1120         * expression.cs (OverloadResolve): Remove unused local.
1121
1122 2003-04-07  Martin Baulig  <martin@ximian.com>
1123
1124         * codegen.cs (EmitContext.CurrentFile): New public field.
1125         (EmitContext.Mark): Use the CurrentFile to check whether the
1126         location is in the correct file.
1127         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1128
1129 2003-04-07  Martin Baulig  <martin@ximian.com>
1130
1131         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1132
1133         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1134         location.  [FIXME: The location argument which gets passed to this
1135         method is sometimes wrong!]
1136
1137 2003-04-07  Nick Drochak <ndrochak@gol.com>
1138
1139         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
1140
1141 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
1142
1143         * expression.cs (Indirection.EmitAssign): We were using the
1144         temporary, but returning immediately instead of continuing the
1145         EmitAssing flow.
1146
1147 2003-04-06  Martin Baulig  <martin@ximian.com>
1148
1149         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
1150         if it's a nested child, but also deriving from the outer class.
1151         See test 190.cs.
1152
1153         * typemanager.cs (IsNestedChildOf): Make this work if it's a
1154         nested child, but also deriving from the outer class.  See
1155         test-190.cs.
1156         (FilterWithClosure): We may access private members of the outer
1157         class if we're a nested child and deriving from the outer class.
1158         (RealMemberLookup): Only set `closure_private_ok' if the
1159         `original_bf' contained BindingFlags.NonPublic.
1160
1161 2003-04-05  Martin Baulig  <martin@ximian.com>
1162
1163         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
1164
1165 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
1166
1167         * class.cs (Event.Define): Do not allow abstract events to have
1168         initializers. 
1169
1170 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
1171
1172         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
1173         block in event declarations.
1174
1175         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
1176         value type, get its address.
1177
1178         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
1179         leaving a class on the stack instead of a boolean value (int
1180         0/1).  Change the code so we compare against null, and then the
1181         result against zero.
1182
1183         * class.cs (TypeContainer.GetClassBases): We were checking for the
1184         parent class being sealed too late.
1185
1186         * expression.cs (Binary.Emit): For <= and >= when dealing with
1187         floating point values, use cgt.un and clt.un instead of cgt and
1188         clt alone.
1189
1190 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
1191
1192         * statement.cs: Apply the same optimization as MS: skip the 
1193         GetEnumerator returning an IEnumerator, and use the one returning a 
1194         CharEnumerator instead. This allows us to avoid the try-finally block 
1195         and the boxing.
1196
1197 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
1198
1199         * cs-parser.jay: Attributes cannot be applied to
1200                          namespaces. Fixes #40473
1201
1202 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1203
1204         * class.cs:
1205         (Add*): check if the name is valid using the full name for constants,
1206         fields, properties and events.
1207
1208 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
1209
1210         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
1211         char constants to be part of the enumeration.
1212
1213         * expression.cs (Conditional.DoResolve): Add support for operator
1214         true. Implements the missing functionality from 14.12
1215
1216         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
1217         operator true/false as required by the spec.
1218
1219         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
1220         implicit conversion to boolean.
1221
1222         * statement.cs (Statement.ResolveBoolean): A boolean expression is
1223         also one where the type implements `operator true'. 
1224
1225         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
1226         get an expression that will invoke operator true based on an
1227         expression.  
1228
1229         (GetConversionOperators): Removed the hack that called op_True
1230         here.  
1231
1232         (Expression.ResolveBoolean): Move this from Statement.
1233
1234 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
1235
1236         * ecore.cs (FieldExpr): do not allow initialization of initonly
1237         fields on derived classes
1238
1239 2003-03-13  Martin Baulig  <martin@ximian.com>
1240
1241         * statement.cs (Block.Emit): Call ig.BeginScope() and
1242         ig.EndScope() when compiling with debugging info; call
1243         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
1244
1245 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
1246
1247         * expression.cs (Indexers): Do not construct immediately, allow
1248         for new members to be appended as we go.  Fixes 38143
1249
1250 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1251
1252         * expression.cs: save/restore context when resolving an unchecked
1253         expression.
1254
1255 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
1256
1257         * cfold.cs: Catch division by zero in modulus operator during
1258         constant folding.
1259
1260 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
1261
1262         * interface.cs (Interface.DefineMembers): Avoid defining members
1263         twice. 
1264
1265 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
1266
1267         * driver.cs: handle the +/- options for -noconfig
1268
1269         * statement.cs (Unckeched.Resolve): Also track the state of
1270         unchecked in the Resolve phase.
1271
1272 2003-02-27  Martin Baulig  <martin@ximian.com>
1273
1274         * ecore.cs (Expression.MemberLookup): Don't create a
1275         MethodGroupExpr for something which is not a method.  Fixes #38291.
1276
1277 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
1278
1279         * class.cs (MemberBase.CheckParameters): Also check that the type
1280         is unmanaged if it is a pointer.
1281
1282         * expression.cs (SizeOf.Resolve): Add location information.
1283
1284         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
1285         a managed type is declared.
1286
1287         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
1288         parameter modifiers as well.  Fixes bug 38606
1289
1290         * class.cs: Very sad.  Am backing out the speed up changes
1291         introduced by the ArrayList -> Array in the TypeContainer, as they
1292         were not actually that much faster, and introduced a bug (no error
1293         reports on duplicated methods).
1294
1295         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
1296         source first, this will guarantee that we have a valid expression
1297         before calling in lower levels functions that will require a
1298         resolved object.  Then use this original_source in the
1299         target.ResolveLValue instead of the original source that was
1300         passed to us.
1301
1302         Another change.  Use target.Resolve instead of LValueResolve.
1303         Although we are resolving for LValues, we will let the Assign code
1304         take care of that (it will be called again from Resolve).  This
1305         basically allows code like this:
1306
1307         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
1308         class Y { void A (X x) { x [0] += o; }
1309
1310         The problem was that the indexer was trying to resolve for
1311         set_Item (idx, object o) and never finding one.  The real set_Item
1312         was set_Item (idx, X).  By delaying the process we get the right
1313         semantics. 
1314
1315         Fixes bug 36505
1316         
1317 2003-02-23  Martin Baulig  <martin@ximian.com>
1318
1319         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
1320         while calling DoEmit ().
1321
1322         * codegen.cs (EmitContext.Mark): Don't mark locations in other
1323         source files; if you use the #line directive inside a method, the
1324         compiler stops emitting line numbers for the debugger until it
1325         reaches the end of the method or another #line directive which
1326         restores the original file.
1327
1328 2003-02-23  Martin Baulig  <martin@ximian.com>
1329
1330         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
1331
1332 2003-02-23  Martin Baulig  <martin@ximian.com>
1333
1334         * statement.cs (Block.AddChildVariableNames): We need to call this
1335         recursively, not just for our immediate children.
1336
1337 2003-02-23  Martin Baulig  <martin@ximian.com>
1338
1339         * class.cs (Event.Define): Always make the field private, like csc does.
1340
1341         * typemanager.cs (TypeManager.RealMemberLookup): Make events
1342         actually work, fixes bug #37521.
1343
1344 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
1345
1346         * delegate.cs: When creating the various temporary "Parameters"
1347         classes, make sure that we call the ComputeAndDefineParameterTypes
1348         on those new parameters (just like we do with the formal ones), to
1349         allow them to be resolved in the context of the DeclSpace.
1350
1351         This fixes the bug that Dick observed in Bugzilla #38530.
1352
1353 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
1354
1355         * expression.cs (ResolveMemberAccess): When resolving a constant,
1356         do not attempt to pull a constant if the value was not able to
1357         generate a valid constant.
1358
1359         * const.cs (LookupConstantValue): Do not report more errors than required.
1360
1361 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1362
1363         * expression.cs: fixes bug #38328.
1364
1365 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
1366
1367         * class.cs: Changed all the various members that can be part of a
1368         class from being an ArrayList to be an Array of the right type.
1369         During the DefineType type_list, interface_list, delegate_list and
1370         enum_list are turned into types, interfaces, delegates and enums
1371         arrays.  
1372
1373         And during the member population, indexer_list, event_list,
1374         constant_list, field_list, instance_constructor_list, method_list,
1375         operator_list and property_list are turned into their real arrays.
1376
1377         Although we could probably perform this operation earlier, for
1378         good error reporting we need to keep the lists and remove the
1379         lists for longer than required.
1380
1381         This optimization was triggered by Paolo profiling the compiler
1382         speed on the output of `gen-sample-program.pl' perl script. 
1383
1384         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
1385         not crash in methods like MemberLookupFailed that use this field.  
1386
1387         This problem arises when the compiler fails to resolve a type
1388         during interface type definition for example.
1389
1390 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
1391
1392         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
1393         inherit from System.Object, so we have to stop at null, not only
1394         when reaching System.Object.
1395
1396 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
1397
1398         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
1399         DeclaredOnly because the parent indexer might have had a different
1400         name, but did not loop until the top of the hierarchy was reached.
1401
1402         The problem this one fixes is 35492: when a class implemented an
1403         indexer from an interface, we were getting the interface method
1404         (which was abstract) and we were flagging an error (can not invoke
1405         abstract method).
1406
1407         This also keeps bug 33089 functioning, and test-148 functioning.
1408
1409         * typemanager.cs (IsSpecialMethod): The correct way of figuring
1410         out if a method is special is to see if it is declared in a
1411         property or event, or whether it is one of the predefined operator
1412         names.   This should fix correctly #36804.
1413
1414 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
1415
1416         The goal here is to remove the dependency on EmptyCast.Peel ().
1417         Killing it completely.
1418         
1419         The problem is that currently in a number of places where
1420         constants are expected, we have to "probe" for an EmptyCast, and
1421         Peel, which is not the correct thing to do, as this will be
1422         repetitive and will likely lead to errors. 
1423
1424         The idea is to remove any EmptyCasts that are used in casts that
1425         can be reduced to constants, so we only have to cope with
1426         constants. 
1427
1428         This bug hunt was triggered by Bug 37363 and the desire to remove
1429         the duplicate pattern where we were "peeling" emptycasts to check
1430         whether they were constants.  Now constants will always be
1431         constants.
1432         
1433         * ecore.cs: Use an enumconstant here instead of wrapping with
1434         EmptyCast.  
1435
1436         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
1437         throwing me off.  By handling this we can get rid of a few hacks.
1438         
1439         * statement.cs (Switch): Removed Peel() code.
1440
1441 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
1442
1443         * class.cs: Location information for error 508
1444
1445         * expression.cs (New.DoResolve): Add a guard against double
1446         resolution of an expression.  
1447
1448         The New DoResolve might be called twice when initializing field
1449         expressions (see EmitFieldInitializers, the call to
1450         GetInitializerExpression will perform a resolve on the expression,
1451         and later the assign will trigger another resolution
1452
1453         This leads to bugs (#37014)
1454
1455         * delegate.cs: The signature for EndInvoke should contain any ref
1456         or out parameters as well.  We were not doing this in the past. 
1457
1458         * class.cs (Field.Define): Do not overwrite the type definition
1459         inside the `volatile' group.  Turns out that volatile enumerations
1460         were changing the type here to perform a validity test, which
1461         broke conversions. 
1462
1463 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
1464
1465         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
1466         and structs, we do not want to load the instance variable
1467
1468         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
1469         enum_type has to be handled like an object reference (implicit
1470         conversions exists from this to object), but the regular IsClass
1471         and IsValueType tests will never return true for this one.
1472
1473         Also we use TypeManager.IsValueType instead of type.IsValueType,
1474         just for consistency with the rest of the code (this is only
1475         needed if we ever use the construct exposed by test-180.cs inside
1476         corlib, which we dont today).
1477
1478 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
1479
1480         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
1481         just InternalCall.
1482
1483 2003-02-09  Martin Baulig  <martin@ximian.com>
1484
1485         * namespace.cs (Namespace..ctor): Added SourceFile argument.
1486         (Namespace.DefineNamespaces): New static public method; this is
1487         called when we're compiling with debugging to add all namespaces
1488         to the symbol file.
1489
1490         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
1491         pass it to the Namespace's .ctor.
1492
1493         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
1494         and MethodBase arguments; pass the namespace ID to the symwriter;
1495         pass the MethodBase instead of the token to the symwriter.
1496         (SymbolWriter.DefineNamespace): New method to add a namespace to
1497         the symbol file.
1498
1499 2003-02-09  Martin Baulig  <martin@ximian.com>
1500
1501         * symbolwriter.cs: New file.  This is a wrapper around
1502         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
1503         methods here in near future.
1504
1505 2003-02-09  Martin Baulig  <martin@ximian.com>
1506
1507         * codegen.cs (EmitContext.Mark): Just pass the arguments to
1508         ILGenerator.MarkSequencePoint() which are actually used by the
1509         symbol writer.
1510
1511 2003-02-09  Martin Baulig  <martin@ximian.com>
1512
1513         * location.cs (SourceFile): New public sealed class.  This
1514         contains the name and an index which is used in the location's token.
1515         (Location): Reserve an appropriate number of bits in the token for
1516         the source file instead of walking over that list, this gives us a
1517         really huge performance improvement when compiling with debugging.
1518
1519         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
1520         `SourceFile' argument instead of a string.
1521         (Driver.ProcessFile): Add all the files via Location.AddFile(),
1522         but don't parse/tokenize here, we need to generate the list of all
1523         source files before we do that.
1524         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
1525         the files.
1526
1527         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
1528         instead of a string.
1529
1530         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
1531         of a string.
1532
1533 2003-02-09  Martin Baulig  <martin@ximian.com>
1534
1535         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
1536         filename on `#line default'.
1537
1538 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
1539
1540         * statement.cs: don't clear the pinned var when the fixed statement
1541         returns from the method (fixes bug#37752).
1542
1543 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
1544
1545         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
1546         to IsValueType.
1547
1548 2003-02-07  Martin Baulig  <martin@ximian.com>
1549
1550         * driver.cs: Removed the `--debug-args' command line argument.
1551
1552         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
1553         automatically by the AsssemblyBuilder.
1554         (CodeGen.InitializeSymbolWriter): We don't need to call any
1555         initialization function on the symbol writer anymore.  This method
1556         doesn't take any arguments.
1557
1558 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
1559
1560         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
1561         from referenced assemblies as well.
1562
1563 2003-02-02  Martin Baulig  <martin@ximian.com>
1564
1565         * class.cs (MethodData.Emit): Generate debugging info for external methods.
1566
1567 2003-02-02  Martin Baulig  <martin@ximian.com>
1568
1569         * class.cs (Constructor.Emit): Open the symbol writer before
1570         emitting the constructor initializer.
1571         (ConstructorInitializer.Emit): Call ec.Mark() to allow
1572         single-stepping through constructor initializers.
1573
1574 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
1575
1576         * class.cs: Handle error 549: do not allow virtual methods in
1577         sealed classes. 
1578
1579 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
1580
1581         * decl.cs: Check access levels when resolving types
1582         
1583 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
1584
1585         * statement.cs: Add parameters and locals set in catch blocks that might 
1586         return to set vector
1587
1588 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
1589
1590         * class.cs (Operator): Set the SpecialName flags for operators.
1591         
1592         * expression.cs (Invocation.DoResolve): Only block calls to
1593         accessors and operators on SpecialName methods.
1594
1595         (Cast.TryReduce): Handle conversions from char constants.
1596
1597
1598 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
1599
1600         * statement.cs: small memory and time optimization in FlowBranching.
1601         
1602 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
1603
1604         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
1605         problem that the last fix but in the other sid (Set).
1606
1607         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
1608         access when there is no indexer in the hierarchy.
1609         
1610 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
1611
1612         * class.cs: Combine some if statements.
1613
1614 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1615
1616         * driver.cs: fixed bug #37187.
1617
1618 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
1619
1620         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
1621         any indexer, it's needed to build a list with all the indexers in the
1622         hierarchy (AllGetters), else we have problems. Fixes #35653.
1623
1624 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
1625
1626         * class.cs (MethodData.Define): It is wrong for an interface
1627         implementation to be static in both cases: explicit and implicit.
1628         We were only handling this in one case.
1629
1630         Improve the if situation there to not have negations.
1631         
1632         * class.cs (Field.Define): Turns out that we do not need to check
1633         the unsafe bit on field definition, only on usage.  Remove the test.
1634
1635 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1636
1637         * driver.cs: use assembly.Location instead of Codebase (the latest
1638         patch made mcs fail when using MS assemblies).
1639
1640 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
1641
1642         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
1643         get the path to *corlib.dll.
1644
1645 2003-01-21  Nick Drochak <ndrochak@gol.com>
1646
1647         * cs-tokenizer.cs:
1648         * pending.cs:
1649         * typemanager.cs: Remove compiler warnings
1650
1651 2003-01-20  Duncan Mak  <duncan@ximian.com>
1652
1653         * AssemblyInfo.cs: Bump the version number to 0.19.
1654         
1655 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1656
1657         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
1658
1659 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
1660
1661         * class.cs (Constructor::Emit): Emit debugging info for constructors.
1662
1663 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
1664
1665         * cs-parser.jay: Small fix: we were not comparing the constructor
1666         name correctly.   Thanks to Zoltan for the initial pointer.
1667
1668 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
1669
1670         * cs-tokenizer.cs: Set file name when specified with #line
1671
1672 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
1673
1674         * cs-parser.jay: Only perform the constructor checks here if we
1675         are named like the class;  This will help provider a better
1676         error.  The constructor path is taken when a type definition is
1677         not found, but most likely the user forgot to add the type, so
1678         report that rather than the constructor error.
1679
1680 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
1681
1682         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
1683         allocations.
1684
1685 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
1686
1687         * cs-parser.jay: Add cleanup call.
1688
1689 2003-01-13  Duncan Mak  <duncan@ximian.com>
1690
1691         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
1692         consistent with other methods.
1693
1694 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
1695
1696         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
1697         
1698 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
1699
1700         * attribute.cs: only set GuidAttr to true when we have a
1701         GuidAttribute.
1702
1703 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1704
1705         * ecore.cs:
1706         * expression.cs:
1707         * typemanager.cs: fixes to allow mcs compile corlib with the new
1708         Type.IsSubclassOf fix.
1709
1710 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
1711
1712         * expression.cs (LocalVariableReference.DoResolve): Classify a
1713         constant as a value, not as a variable.   Also, set the type for
1714         the variable.
1715
1716         * cs-parser.jay (fixed_statement): take a type instead of a
1717         pointer_type, so we can produce a better error message later.
1718         
1719         * statement.cs (Fixed.Resolve): Flag types that are not pointers
1720         as an error.  
1721         
1722         (For.DoEmit): Make inifinite loops have a
1723         non-conditional branch back.
1724
1725         (Fixed.DoEmit): First populate the pinned variables, then emit the
1726         statement, then clear the variables.  Before I was emitting the
1727         code once for each fixed piece.
1728
1729
1730 2003-01-08  Martin Baulig  <martin@ximian.com>
1731
1732         * statement.cs (FlowBranching.MergeChild): A break in a
1733         SWITCH_SECTION does not leave a loop.  Fixes #36155.
1734
1735 2003-01-08  Martin Baulig  <martin@ximian.com>
1736
1737         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
1738         lives in the same number space than `param_map'.  Fixes #36154.
1739
1740 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
1741
1742         * cs-parser.jay (constructor_declaration): Set the
1743         Constructor.ModFlags before probing for it.  This makes the
1744         compiler report 514, 515 and 132 (the code was there, but got
1745         broken). 
1746
1747         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
1748         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
1749         (GotoCase.Resolve): Set `Returns' to ALWAYS.
1750
1751 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
1752
1753         * enum.cs: create the enum static fields using the enum type.
1754
1755 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
1756
1757         * class.cs: don't try to create the ParamBuilder for the return
1758         type if it's not needed (and handle it breaking for the ms runtime
1759         anyway).
1760
1761 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
1762
1763         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
1764
1765 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
1766
1767         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
1768         the command.   This showed up while compiling the JANET source
1769         code, which used \r as its only newline separator.
1770
1771 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
1772
1773         * class.cs (Method.Define): If we are an operator (because it
1774         reuses our code), then set the SpecialName and HideBySig.  #36128
1775
1776 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
1777
1778         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
1779         exception, report error 120 `object reference required'.
1780
1781         * driver.cs: Add --pause option, used during to measure the size
1782         of the process as it goes with --timestamp.
1783
1784         * expression.cs (Invocation.DoResolve): Do not allow methods with
1785         SpecialName to be invoked.
1786
1787 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
1788
1789         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
1790         number before adding it.
1791
1792 2002-12-21  Ravi Pratap  <ravi@ximian.com>
1793
1794         * ecore.cs (StandardImplicitConversion): When in an unsafe
1795         context, we allow conversion between void * to any other pointer
1796         type. This fixes bug #35973.
1797
1798 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
1799
1800         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
1801         is not thrown when extensionless outputs are used 
1802
1803 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1804
1805         * rootcontext.cs: fixed compilation of corlib.
1806
1807 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
1808
1809         * attribute.cs (Attributes.Contains): Add new method.
1810
1811         * class.cs (MethodCore.LabelParameters): if the parameter is an
1812         `out' parameter, check that no attribute `[In]' has been passed.
1813
1814         * enum.cs: Handle the `value__' name in an enumeration.
1815
1816 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
1817
1818         * decl.cs: Added special case to allow overrides on "protected
1819         internal" methods
1820         
1821 2002-12-18  Ravi Pratap  <ravi@ximian.com>
1822
1823         * attribute.cs (Attributes.AddAttributeSection): Rename to this
1824         since it makes much more sense.
1825
1826         (Attributes.ctor): Don't require a Location parameter.
1827         
1828         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
1829
1830         * attribute.cs (ApplyAttributes): Remove extra Location parameters
1831         since we already have that information per attribute.
1832
1833         * everywhere : make appropriate changes.
1834
1835         * class.cs (LabelParameters): Write the code which actually
1836         applies attributes to the return type. We can't do this on the MS
1837         .NET runtime so we flag a warning in the case an exception is
1838         thrown.
1839
1840 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
1841
1842         * const.cs: Handle implicit null conversions here too.
1843
1844 2002-12-17  Ravi Pratap  <ravi@ximian.com>
1845
1846         * class.cs (MethodCore.LabelParameters): Remove the extra
1847         Type [] parameter since it is completely unnecessary. Instead
1848         pass in the method's attributes so that we can extract
1849         the "return" attribute.
1850
1851 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
1852
1853         * cs-parser.jay (parse): Use Report.Error to flag errors instead
1854         of ignoring it and letting the compile continue.
1855
1856         * typemanager.cs (ChangeType): use an extra argument to return an
1857         error condition instead of throwing an exception.
1858
1859 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
1860
1861         * expression.cs (Unary.TryReduce): mimic the code for the regular
1862         code path.  Perform an implicit cast in the cases where we can
1863         implicitly convert to one of the integral types, and then reduce
1864         based on that constant.   This fixes bug #35483.
1865
1866 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1867
1868         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
1869
1870 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1871
1872         * namespace.cs: fixed bug #35489.
1873
1874 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
1875
1876         * class.cs: Remove some dead code.
1877
1878         * cs-parser.jay: Estimate the number of methods needed
1879         (RootContext.MethodCount);
1880
1881         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
1882         numbers instead of StringBuilders.
1883
1884         * support.cs (PtrHashtable): Add constructor with initial size;
1885         We can now reduce reallocations of the method table.
1886
1887 2002-12-10  Ravi Pratap  <ravi@ximian.com>
1888
1889         * attribute.cs (ApplyAttributes): Keep track of the emitted
1890         attributes on a per-target basis. This fixes bug #35413.
1891
1892 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
1893
1894         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
1895         default to the Windows 1252 encoding.
1896
1897         (UnixParseOption): Support version, thanks to Alp for the missing
1898         pointer. 
1899
1900         * AssemblyInfo.cs: Add nice assembly information.
1901
1902         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
1903         (bug 35169).
1904
1905         * cs-parser.jay: Allow a trailing comma before the close bracked
1906         in the attribute_section production.
1907
1908         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
1909         address of the instance was being taken, I will take this out,
1910         because we take the address of the object immediately here.
1911
1912 2002-12-09  Ravi Pratap  <ravi@ximian.com>
1913
1914         * typemanager.cs (AreMultipleAllowed): Take care of the most
1915         obvious case where attribute type is not in the current assembly -
1916         stupid me ;-)
1917
1918 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
1919
1920         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
1921         definitions, instead of doing that afterwards.  
1922
1923         Also we use a nice little hack, depending on the constructor, we
1924         know if we are a "composed" name or a simple name.  Hence, we
1925         avoid the IndexOf test, and we avoid 
1926
1927         * codegen.cs: Add code to assist in a bug reporter to track down
1928         the source of a compiler crash. 
1929
1930 2002-12-07  Ravi Pratap  <ravi@ximian.com>
1931
1932         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
1933         types have been emitted for a given element and flag an error
1934         if something which does not have AllowMultiple set is used more
1935         than once.
1936
1937         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
1938         attribute types and their corresponding AllowMultiple properties
1939
1940         (AreMultipleAllowed): Check the property for a given type.
1941
1942         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
1943         property in the case we have a TypeContainer.
1944
1945         (Attributes.AddAttribute): Detect duplicates and just skip on
1946         adding them. This trivial fix catches a pretty gross error in our
1947         attribute emission - global attributes were being emitted twice!
1948
1949         Bugzilla bug #33187 is now fixed.
1950
1951 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
1952
1953         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
1954         instead of pp_and).
1955
1956         * expression.cs (Binary.ResolveOperator): I can only use the
1957         Concat (string, string, string) and Concat (string, string,
1958         string, string) if the child is actually a concatenation of
1959         strings. 
1960
1961 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
1962
1963         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
1964         context where we need a 2-character lookahead.
1965
1966         * pending.cs (PendingImplementation): Rework so we can keep track
1967         of interface types all the time, and flag those which were
1968         implemented by parents as optional.
1969
1970 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
1971
1972         * expression.cs (Binary.ResolveOperator): Use
1973         String.Concat(string,string,string) or
1974         String.Concat(string,string,string,string) when possible. 
1975
1976         * typemanager: More helper methods.
1977
1978
1979 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
1980
1981         * pending.cs: remove the bogus return from GetMissingInterfaces()
1982         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
1983
1984 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1985
1986         * namespace.cs: avoid duplicated 'using xxx' being added to
1987         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
1988         when we get more than one 'using' statement for the same namespace.
1989         Report a CS0105 warning for it.
1990
1991 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
1992
1993         * cs-tokenizer.cs (consume_identifier): use read directly, instead
1994         of calling getChar/putback, uses internal knowledge of it.    
1995
1996         (xtoken): Reorder tokenizer so most common patterns are checked
1997         first.  This reduces the compilation time in another 5% (from 8.11s
1998         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
1999
2000         The parsing time is 22% of the compilation in mcs, and from that
2001         64% is spent on the tokenization process.  
2002
2003         I tried using a binary search for keywords, but this is slower
2004         than the hashtable.  Another option would be to do a couple of
2005         things:
2006
2007                 * Not use a StringBuilder, instead use an array of chars,
2008                   with a set value.  Notice that this way we could catch
2009                   the 645 error without having to do it *afterwards*.
2010
2011                 * We could write a hand-parser to avoid the hashtable
2012                   compares altogether.
2013
2014         The identifier consumption process takes 37% of the tokenization
2015         time.  Another 15% is spent on is_number.  56% of the time spent
2016         on is_number is spent on Int64.Parse:
2017
2018                 * We could probably choose based on the string length to
2019                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
2020                   computations. 
2021
2022         Another 3% is spend on wrapping `xtoken' in the `token' function.
2023
2024         Handle 0xa0 as whitespace (#34752)
2025         
2026 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
2027
2028         * typemanager.cs (IsCLRType): New routine to tell whether a type
2029         is one of the builtin types.  
2030
2031         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
2032         typecode in more places instead of doing pointer comparissions.
2033         We could leverage some knowledge about the way the typecodes are
2034         laid out.
2035
2036         New code to cache namespaces in assemblies, it is currently not
2037         invoked, to be used soon.
2038
2039         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2040
2041         * expression.cs (Binary.ResolveOperator): specially handle
2042         strings, and do not perform user-defined operator overloading for
2043         built-in types.
2044
2045 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
2046
2047         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2048         internalcall as it is a pretty simple operation;  Avoid whenever
2049         possible to call Char.IsLetter.
2050
2051         (consume_identifier): Cut by half the number of
2052         hashtable calls by merging the is_keyword and GetKeyword behavior.
2053
2054         Do not short-circuit, because if we do, we
2055         report errors (ie, #if false && true would produce an invalid
2056         directive error);
2057         
2058
2059 2002-11-24  Martin Baulig  <martin@ximian.com>
2060
2061         * expression.cs (Cast.TryReduce): If we're in checked syntax,
2062         check constant ranges and report a CS0221.  Fixes #33186.
2063
2064 2002-11-24  Martin Baulig  <martin@ximian.com>
2065
2066         * cs-parser.jay: Make this work for uninitialized variable
2067         declarations in the `for' initializer.  Fixes #32416.
2068
2069 2002-11-24  Martin Baulig  <martin@ximian.com>
2070
2071         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2072         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
2073
2074 2002-11-24  Martin Baulig  <martin@ximian.com>
2075
2076         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2077         argument; if true, we also check for user-defined conversions.
2078         This is only needed if both arguments are of a user-defined type.
2079         Fixes #30443, added test-175.cs.
2080         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2081
2082         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2083
2084 2002-11-24  Martin Baulig  <martin@ximian.com>
2085
2086         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2087         function to get the store opcode.
2088         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2089         only emit the Ldelema if the store opcode is Stobj.  You must run
2090         both test-34 and test-167 to test this.  Fixes #34529.
2091
2092 2002-11-23  Martin Baulig  <martin@ximian.com>
2093
2094         * ecore.cs (Expression.MemberLookup): Added additional
2095         `qualifier_type' argument which is used when we're being called
2096         from MemberAccess.DoResolve() and null if we're called from a
2097         SimpleName lookup.
2098         (Expression.MemberLookupFailed): New method to report errors; this
2099         does the CS1540 check and reports the correct error message.
2100
2101         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2102         argument for the CS1540 check and redone the way how we're dealing
2103         with private members.  See the comment in the source code for details.
2104         (FilterWithClosure): Reverted this back to revision 1.197; renamed
2105         `closure_start_type' to `closure_qualifier_type' and check whether
2106         it's not null.  It was not this filter being broken, it was just
2107         being called with the wrong arguments.
2108
2109         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2110         and pass it the correct `qualifier_type'; this also does the error
2111         handling for us.
2112
2113 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
2114
2115         * expression.cs (Invocation.EmitParams): If the we are dealing
2116         with a non-built-in value type, load its address as well.
2117
2118         (ArrayCreation): Use a a pretty constant instead
2119         of the hardcoded value 2.   Use 6 instead of 2 for the number of
2120         static initializers.  
2121
2122         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2123         because they are not really value types, just glorified integers. 
2124
2125         * driver.cs: Do not append .exe, the CSC compiler does not do it.
2126
2127         * ecore.cs: Remove redundant code for enumerations, make them use
2128         the same code path as everything else, fixes the casting issue
2129         with enumerations in Windows.Forms.
2130
2131         * attribute.cs: Do only cast to string if it is a string, the
2132         validation happens later.
2133
2134         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2135         people upgrade their corlibs.
2136
2137         * ecore.cs: Oops, enumerations were not following the entire code path
2138
2139 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
2140
2141         * typemanager.cs (FilterWithClosure): Commented out the test for
2142         1540 in typemanager.cs, as it has problems when accessing
2143         protected methods from a parent class (see test-174.cs). 
2144
2145         * attribute.cs (Attribute.ValidateGuid): new method.
2146         (Attribute.Resolve): Use above.
2147
2148 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
2149
2150         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
2151
2152         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
2153         handling for enumerations, as we only needed the TypeContainer
2154         functionality to begin with (this is required for the fix below to
2155         work for enums that reference constants in a container class for
2156         example). 
2157
2158         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
2159
2160         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
2161         a valid TypeBuilder to perform lookups on.o
2162
2163         * class.cs (InheritableMemberSignatureCompare): Use true in the
2164         call to GetGetMethod and GetSetMethod, because we are comparing
2165         the signature, and we need to get the methods *even* if they are
2166         private. 
2167
2168         (PropertyBase.CheckBase): ditto.
2169
2170         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
2171         GotoCase.Resolve): Use Peel on EmpytCasts.
2172
2173         * ecore.cs (EmptyCast): drop child, add Peel method.
2174
2175 2002-11-17  Martin Baulig  <martin@ximian.com>
2176
2177         * ecore.cs (EmptyCast.Child): New public property.
2178
2179         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
2180         label resolved to an EmptyCast.  Fixes #34162.
2181         (GotoCase.Resolve): Likewise.
2182         (Block.EmitMeta): Likewise.
2183
2184 2002-11-17  Martin Baulig  <martin@ximian.com>
2185
2186         * expression.cs (Invocation.BetterConversion): Prefer int over
2187         uint; short over ushort; long over ulong for integer literals.
2188         Use ImplicitConversionExists instead of StandardConversionExists
2189         since we also need to check for user-defined implicit conversions.
2190         Fixes #34165.  Added test-173.cs.
2191
2192 2002-11-16  Martin Baulig  <martin@ximian.com>
2193
2194         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
2195         with the `true' and `false' literals.  Fixes #33151.
2196
2197 2002-11-16  Martin Baulig  <martin@ximian.com>
2198
2199         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
2200         October 22nd; don't do the cs1540 check for static members.
2201
2202         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
2203         now using our own filter here and doing the cs1540 check again.
2204
2205 2002-11-16  Martin Baulig  <martin@ximian.com>
2206
2207         * support.cs (InternalParameters): Don't crash if we don't have
2208         any fixed parameters.  Fixes #33532.
2209
2210 2002-11-16  Martin Baulig  <martin@ximian.com>
2211
2212         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
2213         when looking up static methods to make this work on Windows.
2214         Fixes #33773.
2215
2216 2002-11-16  Martin Baulig  <martin@ximian.com>
2217
2218         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
2219         a setter rather than using PropertyInfo.CanWrite.
2220
2221 2002-11-15  Nick Drochak  <ndrochak@gol.com>
2222
2223         * class.cs: Allow acces to block member by subclasses. Fixes build
2224         breaker.
2225
2226 2002-11-14  Martin Baulig  <martin@ximian.com>
2227
2228         * class.cs (Constructor.Emit): Added the extern/block check.
2229         Fixes bug #33678.
2230
2231 2002-11-14  Martin Baulig  <martin@ximian.com>
2232
2233         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
2234         iteration while looking for indexers, this is needed because the
2235         indexer may have a different name in our base classes.  Fixed the
2236         error reporting (no indexers at all, not get accessor, no
2237         overloaded match).  Fixes bug #33089.
2238         (IndexerAccess.DoResolveLValue): Likewise.
2239
2240 2002-11-14  Martin Baulig  <martin@ximian.com>
2241
2242         * class.cs (PropertyBase.CheckBase): Make this work for multiple
2243         indexers.  Fixes the first part of bug #33089.
2244         (MethodSignature.InheritableMemberSignatureCompare): Added support
2245         for properties.
2246
2247 2002-11-13  Ravi Pratap  <ravi@ximian.com>
2248
2249         * attribute.cs (Attribute.Resolve): Catch the
2250         NullReferenceException and report it since it isn't supposed to
2251         happen. 
2252         
2253 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
2254
2255         * expression.cs (Binary.EmitBranchable): Also handle the cases for
2256         LogicalOr and LogicalAnd that can benefit from recursively
2257         handling EmitBranchable.  The code now should be nice for Paolo.
2258
2259 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
2260
2261         * typemanager.cs (LookupType): Added a negative-hit hashtable for
2262         the Type lookups, as we perform quite a number of lookups on
2263         non-Types.  This can be removed once we can deterministically tell
2264         whether we have a type or a namespace in advance.
2265
2266         But this might require special hacks from our corlib.
2267
2268         * TODO: updated.
2269
2270         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
2271         and double which avoids a conversion from an integer to a double.
2272
2273         * expression.cs: tiny optimization, avoid calling IsConstant,
2274         because it effectively performs the lookup twice.
2275
2276 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
2277
2278         But a bogus return here to keep the semantics of the old code
2279         until the Mono runtime is fixed.
2280         
2281         * pending.cs (GetMissingInterfaces): New method used to remove all
2282         the interfaces that are already implemented by our parent
2283         classes from the list of pending methods. 
2284
2285         * interface.cs: Add checks for calls after ResolveTypeExpr.
2286
2287 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
2288
2289         * class.cs (Class.Emit): Report warning 67: event not used if the
2290         warning level is beyond 3.
2291
2292         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
2293         being a NullLiteral.
2294
2295         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
2296         specifiers. 
2297
2298         * class.cs (TypeContainer.GetClassBases): Cover a missing code
2299         path that might fail if a type can not be resolved.
2300
2301         * expression.cs (Binary.Emit): Emit unsigned versions of the
2302         operators. 
2303
2304         * driver.cs: use error 5.
2305         
2306 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
2307
2308         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
2309
2310 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
2311
2312         * cs-parser.jay (switch_section): A beautiful patch from Martin
2313         Baulig that fixed 33094.
2314
2315 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
2316
2317         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
2318         Check whether the base is abstract and report an error if so.
2319
2320         * expression.cs (IndexerAccess.DoResolveLValue,
2321         IndexerAccess.DoResolve): ditto. 
2322
2323         (Invocation.DoResolve): ditto.
2324         
2325         (Invocation.FullMethodDesc): Improve the report string.
2326
2327         * statement.cs (Block): Eliminate IsVariableDefined as it is
2328         basically just a wrapper for GetVariableInfo.
2329
2330         * ecore.cs (SimpleName): Use new 
2331
2332         * support.cs (ReflectionParamter.ParameterType): We unwrap the
2333         type, as we return the actual parameter ref/unref state on a
2334         different call.
2335
2336 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
2337
2338         * support.cs: Return proper flags REF/OUT fixing the previous
2339         commit.  
2340
2341         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
2342         not used to mean `ref' but `ref or out' in ParameterReference
2343         
2344         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
2345         full type signature instead of calling TypeManger.CSharpName
2346         ourselves. 
2347
2348         * support.cs (InternalParameters.ParameterDesc): Do not compare
2349         directly to the modflags, because REF/OUT will actually be bitsets
2350         if set. 
2351
2352         * delegate.cs (VerifyMethod): Check also the modifiers.
2353
2354         * cs-tokenizer.cs: Fix bug where floating point values with an
2355         exponent where a sign was missing was ignored.
2356
2357         * driver.cs: Allow multiple assemblies to be specified in a single
2358         /r: argument
2359
2360 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
2361
2362         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
2363         because identifiers after a parenthesis would end up in this kind
2364         of production, and we needed to desamiguate it for having casts
2365         like:
2366
2367                 (UserDefinedType *) xxx
2368
2369 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
2370
2371         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
2372         we should set on the Bindingflags.NonPublic, but not turn on
2373         private_ok.  private_ok controls whether a Private member is
2374         returned (this is chekced on the filter routine), while the
2375         BindingFlags.NonPublic just controls whether private/protected
2376         will be allowed.   This fixes the problem part of the problem of
2377         private properties being allowed to be used in derived classes.
2378
2379         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
2380         so we can call the children DoResolveLValue method (this will
2381         properly signal errors on lvalue assignments to base properties)
2382         
2383         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
2384         getter are null, and we have a property info, we know that this
2385         happened because the lookup failed, so we report an error 122 for
2386         protection level violation.
2387
2388         We also silently return if setter and getter are null in the
2389         resolve functions, this condition only happens if we have flagged
2390         the error before.  This is the other half of the problem. 
2391
2392         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
2393         not have accessibility information, that is why we were returning
2394         true in the filter function in typemanager.cs.
2395
2396         To properly report 122 (property is inaccessible because of its
2397         protection level) correctly, we report this error in ResolveAccess
2398         by failing if both the setter and the getter are lacking (ie, the
2399         lookup failed). 
2400
2401         DoResolve and DoLResolve have been modified to check for both
2402         setter/getter being null and returning silently, the reason being
2403         that I did not want to put the knowledge about this error in upper
2404         layers, like:
2405
2406         int old = Report.Errors;
2407         x = new PropertyExpr (...);
2408         if (old != Report.Errors)
2409                 return null;
2410         else
2411                 return x;
2412
2413         So the property expr is returned, but it is invalid, so the error
2414         will be flagged during the resolve process. 
2415
2416         * class.cs: Remove InheritablePropertySignatureCompare from the
2417         class, as we no longer depend on the property signature to compute
2418         whether it is possible to implement a method or not.
2419
2420         The reason is that calling PropertyInfo.GetGetMethod will return
2421         null (in .NET, in Mono it works, and we should change this), in
2422         cases where the Get Method does not exist in that particular
2423         class.
2424
2425         So this code:
2426
2427         class X { public virtual int A { get { return 1; } } }
2428         class Y : X { }
2429         class Z : Y { public override int A { get { return 2; } } }
2430
2431         Would fail in Z because the parent (Y) would not have the property
2432         defined.  So we avoid this completely now (because the alternative
2433         fix was ugly and slow), and we now depend exclusively on the
2434         method names.
2435
2436         (PropertyBase.CheckBase): Use a method-base mechanism to find our
2437         reference method, instead of using the property.
2438
2439         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
2440         routines are gone now.
2441
2442         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
2443         names, they were incorrectly named.
2444
2445         * cs-tokenizer.cs: Return are more gentle token on failure. 
2446
2447         * pending.cs (PendingImplementation.InterfaceMethod): This routine
2448         had an out-of-sync index variable, which caused it to remove from
2449         the list of pending methods the wrong method sometimes.
2450
2451 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
2452
2453         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
2454         CanWrite, because those refer to this particular instance of the
2455         property, and do not take into account the fact that we can
2456         override single members of a property.
2457
2458         Constructor requires an EmitContext.  The resolution process does
2459         not happen here, but we need to compute the accessors before,
2460         because the resolution does not always happen for properties.
2461         
2462         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
2463         subclass, before we did not update this flag, but we did update
2464         bindingflags. 
2465
2466         (GetAccessors): Drop this routine, as it did not work in the
2467         presence of partially overwritten set/get methods. 
2468
2469         Notice that this broke the cs1540 detection, but that will require
2470         more thinking. 
2471         
2472 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2473
2474         * class.cs:
2475         * codegen.cs:
2476         * driver.cs: issue a warning instead of an error if we don't support
2477         debugging for the platform. Also ignore a couple of errors that may
2478         arise when trying to write the symbols. Undo my previous patch.
2479
2480 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2481
2482         * driver.cs: ignore /debug switch except for Unix platforms.
2483
2484 2002-10-23  Nick Drochak  <ndrochak@gol.com>
2485
2486         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
2487
2488 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
2489
2490         * driver.cs: Do not make mcs-debug conditional, so we do not break
2491         builds that use it.
2492
2493         * statement.cs (UsageVector.MergeChildren): I would like Martin to
2494         review this patch.  But basically after all the children variables
2495         have been merged, the value of "Breaks" was not being set to
2496         new_breaks for Switch blocks.  I think that it should be set after
2497         it has executed.  Currently I set this to the value of new_breaks,
2498         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
2499         conservative, but I do not understand this code very well.
2500
2501         I did not break anything in the build, so that is good ;-)
2502
2503         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
2504
2505 2002-10-20  Mark Crichton  <crichton@gimp.org>
2506
2507         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
2508
2509 2002-10-20  Nick Drochak  <ndrochak@gol.com>
2510
2511         * cfold.cs: Fixed compile blocker.
2512
2513 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
2514
2515         * driver.cs: I was chekcing the key, not the file.
2516
2517 2002-10-19  Ravi Pratap  <ravi@ximian.com>
2518
2519         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
2520         message that we were generating - we just need to silently return
2521         a null.
2522
2523 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
2524
2525         * class.cs (Event.Define): Change my previous commit, as this
2526         breaks the debugger.  This is a temporary hack, as it seems like
2527         the compiler is generating events incorrectly to begin with.
2528
2529         * expression.cs (Binary.ResolveOperator): Added support for 
2530         "U operator - (E x, E y)"
2531
2532         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
2533         y)".
2534
2535         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
2536         init-only variables, but this path did not take into account that
2537         there might be also instance readonly variables.  Correct this
2538         problem. 
2539
2540         This fixes bug 32253
2541
2542         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
2543         delegates as well.
2544
2545         * driver.cs: Change the extension for modules to `netmodule'
2546
2547         * cs-parser.jay: Improved slightly the location tracking for
2548         the debugger symbols.
2549
2550         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
2551         modifiers that were specified instead of the hardcoded value
2552         (FamAndAssem).  This was basically ignoring the static modifier,
2553         and others.  Fixes 32429.
2554
2555         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
2556         fixed a bug in the process (32476)
2557
2558         * expression.cs (ArrayAccess.EmitAssign): Patch from
2559         hwang_rob@yahoo.ca that fixes bug 31834.3
2560
2561 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
2562
2563         * driver.cs: Make the module extension .netmodule.
2564
2565 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
2566
2567         * driver.cs: Report an error if the resource file is not found
2568         instead of crashing.
2569
2570         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
2571         false, like Emit does.
2572
2573 2002-10-16  Nick Drochak  <ndrochak@gol.com>
2574
2575         * typemanager.cs: Remove unused private member.  Also reported mcs
2576         bug to report this as a warning like csc.
2577
2578 2002-10-15  Martin Baulig  <martin@gnome.org>
2579
2580         * statement.cs (Statement.Emit): Made this a virtual method; emits
2581         the line number info and calls DoEmit().
2582         (Statement.DoEmit): New protected abstract method, formerly knows
2583         as Statement.Emit().
2584
2585         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
2586
2587 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
2588
2589         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
2590         have fixed a remaining problem: not every AddXXXX was adding a
2591         fully qualified name.  
2592
2593         Now everyone registers a fully qualified name in the DeclSpace as
2594         being defined instead of the partial name.  
2595
2596         Downsides: we are slower than we need to be due to the excess
2597         copies and the names being registered this way.  
2598
2599         The reason for this is that we currently depend (on the corlib
2600         bootstrap for instance) that types are fully qualified, because
2601         we dump all the types in the namespace, and we should really have
2602         types inserted into the proper namespace, so we can only store the
2603         basenames in the defined_names array.
2604
2605 2002-10-10  Martin Baulig  <martin@gnome.org>
2606
2607         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
2608         from bug #31834, see the bug report for a testcase which is
2609         miscompiled.
2610
2611 2002-10-10  Martin Baulig  <martin@gnome.org>
2612
2613         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
2614         flow analysis code for this.
2615
2616         * statement.cs (Do, While, For): Tell the flow analysis code about
2617         infinite loops.
2618         (FlowBranching.UsageVector): Added support for infinite loops.
2619         (Block.Resolve): Moved the dead code elimination here and use flow
2620         analysis to do it.
2621
2622 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
2623
2624         * class.cs (Field.Define): Catch cycles on struct type
2625         definitions. 
2626
2627         * typemanager.cs (IsUnmanagedtype): Do not recursively check
2628         fields if the fields are static.  We only need to check instance
2629         fields. 
2630
2631         * expression.cs (As.DoResolve): Test for reference type.
2632
2633         * statement.cs (Using.ResolveExpression): Use
2634         ConvertImplicitRequired, not ConvertImplicit which reports an
2635         error on failture
2636         (Using.ResolveLocalVariableDecls): ditto.
2637
2638         * expression.cs (Binary.ResolveOperator): Report errors in a few
2639         places where we had to.
2640
2641         * typemanager.cs (IsUnmanagedtype): Finish implementation.
2642
2643 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
2644
2645         * expression.cs: Use StoreFromPtr instead of extracting the type
2646         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
2647
2648         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
2649         an enumeration value to a System.Enum, but System.Enum is not a
2650         value type, but an class type, so we need to box.
2651
2652         (Expression.ConvertExplicit): One codepath could return
2653         errors but not flag them.  Fix this.  Fixes #31853
2654
2655         * parameter.cs (Resolve): Do not allow void as a parameter type.
2656
2657 2002-10-06  Martin Baulig  <martin@gnome.org>
2658
2659         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
2660         if it's a class type and not a struct.  Fixes #31815.
2661
2662 2002-10-06  Martin Baulig  <martin@gnome.org>
2663
2664         * statement.cs: Reworked the flow analysis code a bit to make it
2665         usable for dead code elimination.
2666
2667 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2668
2669         * cs-parser.jay: allow empty source files. Fixes bug #31781.
2670
2671 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
2672
2673         * expression.cs (ComposedCast.DoResolveType): A quick workaround
2674         to fix the test 165, will investigate deeper.
2675
2676 2002-10-04  Martin Baulig  <martin@gnome.org>
2677
2678         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
2679         finally blocks actually work.
2680         (Try.Resolve): We don't need to create a sibling for `finally' if
2681         there is no finally block.
2682
2683 2002-10-04  Martin Baulig  <martin@gnome.org>
2684
2685         * class.cs (Constructor.Define): The default accessibility for a
2686         non-default constructor is private, not public.
2687
2688 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
2689
2690         * class.cs (Constructor): Make AllowedModifiers public, add
2691         EXTERN.
2692
2693         * cs-parser.jay: Perform the modifiers test here, as the
2694         constructor for the Constructor class usually receives a zero
2695         because of the way we create it (first we create, later we
2696         customize, and we were never checking the modifiers).
2697
2698         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
2699         is a version of LookupTypeReflection that includes the type-name
2700         cache.  This can be used as a fast path for functions that know
2701         the fully qualified name and are only calling into *.GetType() to
2702         obtain a composed type.
2703
2704         This is also used by TypeManager.LookupType during its type
2705         composition.
2706
2707         (LookupType): We now also track the real type name, as sometimes
2708         we can get a quey for the real type name from things like
2709         ComposedCast.  This fixes bug 31422.
2710         
2711         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
2712         complete type fullname, it does not have to go through the type
2713         resolution system to obtain the composed version of the type (for
2714         obtaining arrays or pointers).
2715         
2716         (Conditional.Emit): Use the EmitBoolExpression to
2717         generate nicer code, as requested by Paolo.
2718
2719         (ArrayCreation.CheckIndices): Use the patch from
2720         hwang_rob@yahoo.ca to validate the array initializers. 
2721
2722 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
2723
2724         * class.cs (ConstructorInitializer.Emit): simplify code by using
2725         Invocation.EmitCall, and at the same time, fix the bugs in calling
2726         parent constructors that took variable arguments. 
2727
2728         * ecore.cs (Expression.ConvertNumericExplicit,
2729         Expression.ImplicitNumericConversion): Remove the code that
2730         manually wrapped decimal (InternalTypeConstructor call is now gone
2731         as well).
2732
2733         * expression.cs (Cast.TryReduce): Also handle decimal types when
2734         trying to perform a constant fold on the type.
2735
2736         * typemanager.cs (IsUnmanagedtype): Partially implemented.
2737
2738         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
2739         that only turned off an error report, and did nothing else. 
2740
2741 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
2742
2743         * driver.cs: Handle and ignore /fullpaths
2744
2745 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
2746
2747         * expression.cs (Binary.ResolveOperator): Catch the case where
2748         DoNumericPromotions returns true, 
2749
2750         (Binary.DoNumericPromotions): Simplify the code, and the tests.
2751
2752 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
2753
2754         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
2755         report error 70.
2756
2757 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
2758
2759         * ecore.cs (ConvertNumericExplicit): It is not enough that the
2760         conversion exists, but it is also required that the conversion be
2761         performed.  This manifested in "(Type64Enum) 2".  
2762
2763         * class.cs (TypeManager.AddMethod): The fix is not to change
2764         AddEnum, because that one was using a fully qualified name (every
2765         DeclSpace derivative does), but to change the AddMethod routine
2766         that was using an un-namespaced name.  This now correctly reports
2767         the duplicated name.
2768
2769         Revert patch until I can properly fix it.  The issue
2770         is that we have a shared Type space across all namespaces
2771         currently, which is wrong.
2772
2773         Options include making the Namespace a DeclSpace, and merge
2774         current_namespace/current_container in the parser.
2775
2776 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
2777
2778         * cs-parser.jay: Improve error reporting when we get a different
2779         kind of expression in local_variable_type and
2780         local_variable_pointer_type. 
2781
2782         Propagate this to avoid missleading errors being reported.
2783
2784         * ecore.cs (ImplicitReferenceConversion): treat
2785         TypeManager.value_type as a target just like object_type.   As
2786         code like this:
2787
2788         ValueType v = 1;
2789
2790         Is valid, and needs to result in the int 1 being boxed before it
2791         is assigned to the value type v.
2792
2793         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
2794         to validate the enumeration name.
2795
2796         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
2797         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
2798         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
2799
2800         * ecore.cs (TryImplicitIntConversion): When doing an
2801         implicit-enumeration-conversion, check if the type is 64-bits and
2802         perform a conversion before passing to EnumConstant.
2803
2804 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
2805
2806         * decl.cs (Error_AmbiguousTypeReference); New routine used to
2807         report ambiguous type references.  Unlike the MS version, we
2808         report what the ambiguity is.   Innovation at work ;-)
2809
2810         (DeclSpace.FindType): Require a location argument to
2811         display when we display an ambiguous error.
2812
2813         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
2814
2815         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
2816
2817         * expression.cs (EmitDynamicInitializers): Apply patch from
2818         hwang_rob@yahoo.ca that fixes the order in which we emit our
2819         initializers. 
2820
2821 2002-09-21  Martin Baulig  <martin@gnome.org>
2822
2823         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
2824         delegate takes no arguments.
2825
2826 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
2827
2828         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
2829         from integers.
2830
2831         * expression.cs: Extract the underlying type.
2832
2833         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
2834
2835         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
2836
2837 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
2838
2839         * class.cs (TypeContainer.DefineType): We can not use the nice
2840         PackingSize with the size set to 1 DefineType method, because it
2841         will not allow us to define the interfaces that the struct
2842         implements.
2843
2844         This completes the fixing of bug 27287
2845
2846         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
2847         means also structs.  This fixes part of the problem. 
2848         (Expresion.ImplicitReferenceConversionExists): ditto.
2849
2850         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
2851         error if there were no errors reported during the type lookup
2852         process, to avoid duplicates or redundant errors.  Without this
2853         you would get an ambiguous errors plus a type not found.  We have
2854         beaten the user enough with the first error.  
2855
2856         (DeclSparce.FindType): Emit a warning if we have an ambiguous
2857         reference. 
2858
2859         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
2860         during the resolution process, stop the lookup, this avoids
2861         repeated error reports (same error twice).
2862
2863         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
2864
2865         * typemanager.cs (LookupType): Redo the type lookup code to match
2866         the needs of System.Reflection.  
2867
2868         The issue is that System.Reflection requires references to nested
2869         types to begin with a "+" sign instead of a dot.  So toplevel
2870         types look like: "NameSpace.TopLevelClass", and nested ones look
2871         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
2872         levels. 
2873
2874 2002-09-19  Martin Baulig  <martin@gnome.org>
2875
2876         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
2877         says that a method always returns or always throws an exception,
2878         don't report the CS0161.
2879
2880         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
2881         set `Returns = new_returns'.
2882
2883 2002-09-19  Martin Baulig  <martin@gnome.org>
2884
2885         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
2886         to an enum constant, check for a CS0176.
2887
2888 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
2889
2890         * class.cs (TypeContainer.CheckPairedOperators): Now we check
2891         for operators that must be in pairs and report errors.
2892
2893         * ecore.cs (SimpleName.DoResolveType): During the initial type
2894         resolution process, when we define types recursively, we must
2895         check first for types in our current scope before we perform
2896         lookups in the enclosing scopes.
2897
2898         * expression.cs (MakeByteBlob): Handle Decimal blobs.
2899
2900         (Invocation.VerifyArgumentsCompat): Call
2901         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
2902         I thought we were supposed to always call this, but there are a
2903         few places in the code where we dont do it.
2904
2905 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
2906
2907         * driver.cs: Add support in -linkres and -resource to specify the
2908         name of the identifier.
2909
2910 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
2911
2912         * ecore.cs (StandardConversionExists): Sync with the conversion
2913         code: allow anything-* to void* conversions.
2914
2915         (FindMostSpecificSource): Use an Expression argument
2916         instead of a Type, because we might be handed over a Literal which
2917         gets a few more implicit conversions that plain types do not.  So
2918         this information was being lost.
2919
2920         Also, we drop the temporary type-holder expression when not
2921         required.
2922
2923 2002-09-17  Martin Baulig  <martin@gnome.org>
2924
2925         * class.cs (PropertyBase.CheckBase): Don't check the base class if
2926         this is an explicit interface implementation.
2927
2928 2002-09-17  Martin Baulig  <martin@gnome.org>
2929
2930         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
2931         different `IndexerName' attributes.
2932
2933         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
2934         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
2935         virtual CommonResolve().
2936
2937 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
2938
2939         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
2940         and convert that to the UnderlyingType.
2941
2942         * statement.cs (Foreach.Resolve): Indexers are just like variables
2943         or PropertyAccesses.
2944
2945         * cs-tokenizer.cs (consume_string): Track line numbers and columns
2946         inside quoted strings, we were not doing this before.
2947
2948 2002-09-16  Martin Baulig  <martin@gnome.org>
2949
2950         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
2951         resolve it.  This is needed for the definite assignment check of the
2952         instance expression, fixes bug #29846.
2953         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
2954
2955 2002-09-16  Nick Drochak  <ndrochak@gol.com>
2956
2957         * parameter.cs: Fix compile error.  Cannot reference static member
2958         from an instance object.  Is this an mcs bug?
2959
2960 2002-09-14  Martin Baulig  <martin@gnome.org>
2961
2962         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
2963         multiple times.  Fixes bug #30295, added test-166.cs.
2964
2965 2002-09-14  Martin Baulig  <martin@gnome.org>
2966
2967         * statement.cs (Block.Emit): Don't emit unreachable code.
2968         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
2969         `break' statements.
2970         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
2971
2972 2002-09-14  Martin Baulig  <martin@gnome.org>
2973
2974         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
2975         is set.
2976
2977 2002-09-14  Martin Baulig  <martin@gnome.org>
2978
2979         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
2980         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
2981         be false on the ms runtime.
2982
2983 2002-09-13  Martin Baulig  <martin@gnome.org>
2984
2985         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
2986         the CS0038 error message.
2987
2988 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
2989
2990         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
2991         constant inside, return it.
2992
2993 2002-09-12  Martin Baulig  <martin@gnome.org>
2994
2995         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
2996         implicit conversion can be done between enum types.
2997
2998         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
2999         check whether an implicit conversion to the current enum's UnderlyingType
3000         exists and report an error if not.
3001
3002         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3003         without debugging support.
3004
3005         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3006         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
3007
3008 2002-09-12  Martin Baulig  <martin@gnome.org>
3009
3010         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3011
3012         * ecore.cs (IMemberExpr.DeclaringType): New property.
3013         (SimpleName.SimpleNameResolve): Check whether we're accessing a
3014         nonstatic member of an outer type (CS0038).
3015
3016 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
3017
3018         * driver.cs: Activate the using-error detector at warning level
3019         4 (at least for MS-compatible APIs).
3020
3021         * namespace.cs (VerifyUsing): Small buglett fix.
3022
3023         * pending.cs (PendingImplementation): pass the container pointer. 
3024
3025         * interface.cs (GetMethods): Allow for recursive definition.  Long
3026         term, I would like to move every type to support recursive
3027         definitions, not the current ordering mechanism that we have right
3028         now.
3029
3030         The situation is this: Attributes are handled before interfaces,
3031         so we can apply attributes to interfaces.  But some attributes
3032         implement interfaces, we will now handle the simple cases
3033         (recursive definitions will just get an error).  
3034
3035         * parameter.cs: Only invalidate types at the end if we fail to
3036         lookup all types.  
3037
3038 2002-09-09  Martin Baulig  <martin@gnome.org>
3039
3040         * ecore.cs (PropertyExpr.Emit): Also check for
3041         TypeManager.system_int_array_get_length so this'll also work when
3042         compiling corlib.  Fixes #30003.
3043
3044 2002-09-09  Martin Baulig  <martin@gnome.org>
3045
3046         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3047         and throw an exception if we can't get the type's size.  Fixed #30040,
3048         added test-165.cs.
3049
3050 2002-09-09  Martin Baulig  <martin@gnome.org>
3051
3052         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3053
3054         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3055         context.  Fixes bug #30027.
3056
3057         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3058         virtual functions.  Fixes bug #30043, added test-164.cs.
3059
3060 2002-09-08  Ravi Pratap  <ravi@ximian.com>
3061
3062         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3063
3064 2002-09-08  Nick Drochak  <ndrochak@gol.com>
3065
3066         * driver.cs: Use an object to get the windows codepage since it's not a
3067         static property.
3068
3069 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
3070
3071         * statement.cs (For.Emit): for infinite loops (test == null)
3072         return whether there is a break inside, not always "true".
3073
3074         * namespace.cs (UsingEntry): New struct to hold the name of the
3075         using definition, the location where it is defined, and whether it
3076         has been used in a successful type lookup.
3077         
3078         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3079         strings.
3080
3081         * decl.cs: ditto.
3082
3083 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3084
3085         * attribute.cs : Fix incorrect code which relied on catching
3086         a NullReferenceException to detect a null being passed in
3087         where an object was expected.
3088
3089 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
3090
3091         * statement.cs (Try): flag the catch variable as assigned
3092
3093         * expression.cs (Cast): Simplified by using ResolveType instead of
3094         manually resolving.
3095
3096         * statement.cs (Catch): Fix bug by using ResolveType.
3097
3098 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3099
3100         * expression.cs (BetterConversion): Special case for when we have
3101         a NullLiteral as the argument and we have to choose between string
3102         and object types - we choose string the way csc does.
3103
3104         * attribute.cs (Attribute.Resolve): Catch the
3105         NullReferenceException and report error #182 since the Mono
3106         runtime no more has the bug and having this exception raised means
3107         we tried to select a constructor which takes an object and is
3108         passed a null.
3109
3110 2002-09-05  Ravi Pratap  <ravi@ximian.com>
3111
3112         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3113         message (1502, 1503) when we can't locate a method after overload
3114         resolution. This is much more informative and closes the bug
3115         Miguel reported.
3116
3117         * interface.cs (PopulateMethod): Return if there are no argument
3118         types. Fixes a NullReferenceException bug.
3119
3120         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3121         expressions too. Previously we were checking only in one place for
3122         positional arguments leaving out named arguments.
3123
3124         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3125         type to the enum type is not allowed. Remove code corresponding to
3126         that.
3127
3128         (ConvertNumericExplicit): Allow explicit conversions from
3129         the underlying type to enum type. This precisely follows the spec
3130         and closes a bug filed by Gonzalo.
3131         
3132 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3133
3134         * compiler.csproj:
3135         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3136
3137 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
3138
3139         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
3140         it was important that we stored the right value after the
3141         reduction in `converted'.
3142
3143 2002-09-04  Martin Baulig  <martin@gnome.org>
3144
3145         * location.cs (Location.SymbolDocument): Use full pathnames for the
3146         source files.
3147
3148 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
3149
3150         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
3151         of the expression resolve mechanism, because that will catch the
3152         SimpleName error failures.
3153
3154         (Conditional): If we can not resolve the
3155         expression, return, do not crash.
3156
3157 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3158
3159         * cs-tokenizer.cs:
3160         (location): display token name instead of its number.
3161
3162 2002-08-28  Martin Baulig  <martin@gnome.org>
3163
3164         * expression.cs (Binary.ResolveOperator): Don't silently return
3165         but return an error if an operator cannot be applied between two
3166         enum types.
3167
3168 2002-08-28  Martin Baulig  <martin@gnome.org>
3169
3170         * class.cs (Constructor.Define): Set the permission attributes
3171         correctly instead of making all constructors public.
3172
3173 2002-08-28  Martin Baulig  <martin@gnome.org>
3174
3175         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
3176         for private members before reporting a CS0103; if we find anything,
3177         it's a CS0122.
3178
3179 2002-08-28  Martin Baulig  <martin@gnome.org>
3180
3181         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
3182         to check whether `closure_start_type == closure_invocation_type',
3183         we also need to check whether `m.DeclaringType == closure_invocation_type'
3184         before bypassing the permission checks.  We might be accessing
3185         protected/private members from the base class.
3186         (TypeManager.RealMemberLookup): Only set private_ok if private
3187         members were requested via BindingFlags.NonPublic.
3188
3189         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
3190
3191         * expression.cs (MemberAccess.ResolveMemberAccess): Set
3192         MethodGroupExpr.IsExplicitImpl if appropriate.
3193         (Invocation.DoResolve): Don't report the CS0120 for explicit
3194         interface implementations.
3195
3196 2002-08-27  Martin Baulig  <martin@gnome.org>
3197
3198         * expression.cs (Invocation.DoResolve): If this is a static
3199         method and we don't have an InstanceExpression, we must report
3200         a CS0120.
3201
3202 2002-08-25  Martin Baulig  <martin@gnome.org>
3203
3204         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
3205         `==' between a valuetype and an object.
3206
3207 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
3208
3209         * ecore.cs (TypeExpr): Provide a ToString method.
3210
3211 2002-08-24  Martin Baulig  <martin@gnome.org>
3212
3213         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
3214         now called proggie.dbg and it's a binary file.
3215
3216 2002-08-23  Martin Baulig  <martin@gnome.org>
3217
3218         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
3219
3220 2002-08-23  Martin Baulig  <martin@gnome.org>
3221
3222         * struct.cs (MyStructInfo.ctor): Make this work with empty
3223         structs; it's not allowed to use foreach() on null.
3224
3225 2002-08-23  Martin Baulig  <martin@gnome.org>
3226
3227         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
3228         writer the full pathname of the generated assembly.
3229
3230 2002-08-23  Martin Baulig  <martin@gnome.org>
3231
3232         * statements.cs (FlowBranching.UsageVector.MergeChildren):
3233         A `finally' block never returns or breaks; improved handling of
3234         unreachable code.
3235
3236 2002-08-23  Martin Baulig  <martin@gnome.org>
3237
3238         * statement.cs (Throw.Resolve): Allow `throw null'.
3239
3240 2002-08-23  Martin Baulig  <martin@gnome.org>
3241
3242         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
3243         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
3244         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
3245         MemberLookup would return a wrong event if this is an explicit
3246         interface implementation and the class has an event with the same
3247         name.
3248
3249 2002-08-23  Martin Baulig  <martin@gnome.org>
3250
3251         * statement.cs (Block.AddChildVariableNames): New public method.
3252         (Block.AddChildVariableName): Likewise.
3253         (Block.IsVariableNameUsedInChildBlock): Likewise.
3254         (Block.AddVariable): Check whether a variable name has already
3255         been used in a child block.
3256
3257         * cs-parser.jay (declare_local_variables): Mark all variable names
3258         from the current block as being used in a child block in the
3259         implicit block.
3260
3261 2002-08-23  Martin Baulig  <martin@gnome.org>
3262
3263         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
3264         find the symbol writer.
3265
3266         * driver.cs: csc also allows the arguments to /define being
3267         separated by commas, not only by semicolons.
3268
3269 2002-08-23  Martin Baulig  <martin@gnome.org>
3270
3271         * interface.cs (Interface.GetMembers): Added static check for events.
3272
3273 2002-08-15  Martin Baulig  <martin@gnome.org>
3274
3275         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
3276         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
3277
3278         * ecore.cs (Expression.MemberLookup): Added documentation and explained
3279         why the MethodData.EmitDestructor() change was necessary.
3280
3281 2002-08-20  Martin Baulig  <martin@gnome.org>
3282
3283         * class.cs (TypeContainer.FindMembers): Added static check for events.
3284
3285         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
3286
3287         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
3288         use Type.GetEvents(), not Type.FindMembers().
3289
3290 2002-08-20  Martin Baulig  <martin@gnome.org>
3291
3292         * decl.cs (MemberCache): Added a special method cache which will
3293         be used for method-only searched.  This ensures that a method
3294         search will return a MethodInfo with the correct ReflectedType for
3295         inherited methods.      
3296
3297 2002-08-20  Martin Baulig  <martin@gnome.org>
3298
3299         * decl.cs (DeclSpace.FindMembers): Made this public.
3300
3301 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3302
3303         * delegate.cs: fixed build on windows.
3304         [FIXME:  Filed as bug #29150: MCS must report these errors.]
3305
3306 2002-08-19  Ravi Pratap  <ravi@ximian.com>
3307
3308         * ecore.cs (StandardConversionExists): Return a false
3309         if we are trying to convert the void type to anything else
3310         since that is not allowed.
3311
3312         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
3313         we flag error 70 in the event an event is trying to be accessed
3314         directly from outside the declaring type.
3315
3316 2002-08-20  Martin Baulig  <martin@gnome.org>
3317
3318         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
3319         MemberCache from typemanager.cs to decl.cs.
3320
3321 2002-08-19  Martin Baulig  <martin@gnome.org>
3322
3323         * class.cs (TypeContainer): Implement IMemberContainer.
3324         (TypeContainer.DefineMembers): Create the MemberCache.
3325         (TypeContainer.FindMembers): Do better BindingFlags checking; only
3326         return public members if BindingFlags.Public was given, check
3327         whether members are static.
3328
3329 2002-08-16  Martin Baulig  <martin@gnome.org>
3330
3331         * decl.cs (DeclSpace.Define): Splitted this in Define and
3332         DefineMembers.  DefineMembers is called first and initializes the
3333         MemberCache.
3334
3335         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
3336         DefineMembers() on all our DeclSpaces.
3337
3338         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
3339         but call DefineMembers() on all nested interfaces.  We call their
3340         Define() in our new Define() function.
3341
3342         * interface.cs (Interface): Implement IMemberContainer.
3343         (Interface.Define): Moved all code except the attribute stuf to
3344         DefineMembers().
3345         (Interface.DefineMembers): Initialize the member cache.
3346
3347         * typemanager.cs (IMemberFinder): Removed this interface, we don't
3348         need this anymore since we can use MemberCache.FindMembers directly.
3349
3350 2002-08-19  Martin Baulig  <martin@gnome.org>
3351
3352         * typemanager.cs (MemberCache): When creating the cache for an
3353         interface type, add all inherited members.
3354         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
3355         to `out bool used_cache' and documented it.
3356         (TypeManager.MemberLookup): If we already used the cache in the first
3357         iteration, we don't need to do the interfaces check.
3358
3359 2002-08-19  Martin Baulig  <martin@gnome.org>
3360
3361         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
3362         here from IMemberFinder and don't implement this interface anymore.
3363         (DeclSpace.MemberCache): Moved here from IMemberFinder.
3364
3365         * typemanager.cs (IMemberFinder): This interface is now only used by
3366         classes which actually support the member cache.
3367         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
3368         since we only put DeclSpaces into this Hashtable.
3369         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
3370         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
3371
3372 2002-08-16  Martin Baulig  <martin@gnome.org>
3373
3374         * typemanager.cs (ICachingMemberFinder): Removed.
3375         (IMemberFinder.MemberCache): New property.
3376         (TypeManager.FindMembers): Merged this with RealFindMembers().
3377         This function will never be called from TypeManager.MemberLookup()
3378         so we can't use the cache here, just the IMemberFinder.
3379         (TypeManager.MemberLookup_FindMembers): Check whether the
3380         IMemberFinder has a MemberCache and call the cache's FindMembers
3381         function.
3382         (MemberCache): Rewrote larger parts of this yet another time and
3383         cleaned it up a bit.
3384
3385 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
3386
3387         * driver.cs (LoadArgs): Support quoting.
3388
3389         (Usage): Show the CSC-like command line arguments.
3390
3391         Improved a few error messages.
3392
3393 2002-08-15  Martin Baulig  <martin@gnome.org>
3394
3395         * typemanager.cs (IMemberContainer.Type): New property.
3396         (IMemberContainer.IsInterface): New property.
3397
3398         The following changes are conditional to BROKEN_RUNTIME, which is
3399         defined at the top of the file.
3400
3401         * typemanager.cs (MemberCache.MemberCache): Don't add the base
3402         class'es members, but add all members from TypeHandle.ObjectType
3403         if we're an interface.
3404         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
3405         is the current type.
3406         (MemberCache.CacheEntry.Container): Removed this field.
3407         (TypeHandle.GetMembers): Include inherited members.
3408
3409 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3410
3411         * typemanager.cs: fixed compilation and added a comment on a field that
3412         is never used.
3413
3414 2002-08-15  Martin Baulig  <martin@gnome.org>
3415
3416         * class.cs (ConstructorInitializer.Resolve): In the
3417         Expression.MemberLookup call, use the queried_type as
3418         invocation_type.
3419
3420         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
3421         declared' attribute, it's always true.
3422         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
3423         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
3424         temporary wrapper for FindMembers which tells MemberLookup whether
3425         members from the base classes are included in the return value.
3426         This will go away soon.
3427         (TypeManager.MemberLookup): Use this temporary hack here; once the
3428         new MemberCache is completed, we don't need to do the DeclaredOnly
3429         looping here anymore since the MemberCache will take care of this.
3430         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
3431         (MemberCache): When creating the MemberCache for a class, get
3432         members from the current class and all its base classes.
3433         (MemberCache.CacheEntry.Container): New field.  This is a
3434         temporary hack until the Mono runtime is fixed to distinguish
3435         between ReflectedType and DeclaringType.  It allows us to use MCS
3436         with both the MS runtime and the unfixed Mono runtime without
3437         problems and without accecting performance.
3438         (MemberCache.SearchMembers): The DeclaredOnly looping from
3439         TypeManager.MemberLookup is now done here.      
3440
3441 2002-08-14  Martin Baulig  <martin@gnome.org>
3442
3443         * statement.cs (MyStructInfo.MyStructInfo): Don't call
3444         Type.GetFields on dynamic types but get the fields from the
3445         corresponding TypeContainer.
3446         (MyStructInfo.GetStructInfo): Added check for enum types.
3447
3448         * typemanager.cs (MemberList.IsSynchronized): Implemented.
3449         (MemberList.SyncRoot): Implemented.
3450         (TypeManager.FilterWithClosure): No need to check permissions if
3451         closure_start_type == closure_invocation_type, don't crash if
3452         closure_invocation_type is null.
3453
3454 2002-08-13  Martin Baulig  <martin@gnome.org>
3455
3456         Rewrote TypeContainer.FindMembers to use a member cache.  This
3457         gives us a speed increase of about 35% for the self-hosting MCS
3458         build and of about 15-20% for the class libs (both on GNU/Linux).
3459
3460         * report.cs (Timer): New class to get enhanced profiling.  This
3461         whole class is "TIMER" conditional since it remarkably slows down
3462         compilation speed.
3463
3464         * class.cs (MemberList): New class.  This is an IList wrapper
3465         which we're now using instead of passing MemberInfo[]'s around to
3466         avoid copying this array unnecessarily.
3467         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
3468         (ICachingMemberFinder, IMemberContainer): New interface.
3469         (TypeManager.FilterWithClosure): If `criteria' is null, the name
3470         has already been checked, otherwise use it for the name comparision.
3471         (TypeManager.FindMembers): Renamed to RealMemberFinder and
3472         provided wrapper which tries to use ICachingMemberFinder.FindMembers
3473         if possible.  Returns a MemberList, not a MemberInfo [].
3474         (TypeHandle): New class, implements IMemberContainer.  We create
3475         one instance of this class per type, it contains a MemberCache
3476         which is used to do the member lookups.
3477         (MemberCache): New class.  Each instance of this class contains
3478         all members of a type and a name-based hash table.
3479         (MemberCache.FindMembers): This is our new member lookup
3480         function.  First, it looks up all members of the requested name in
3481         the hash table.  Then, it walks this list and sorts out all
3482         applicable members and returns them.
3483
3484 2002-08-13  Martin Baulig  <martin@gnome.org>
3485
3486         In addition to a nice code cleanup, this gives us a performance
3487         increase of about 1.4% on GNU/Linux - not much, but it's already
3488         half a second for the self-hosting MCS compilation.
3489
3490         * typemanager.cs (IMemberFinder): New interface.  It is used by
3491         TypeManager.FindMembers to call FindMembers on a TypeContainer,
3492         Enum, Delegate or Interface.
3493         (TypeManager.finder_to_member_finder): New PtrHashtable.
3494         (TypeManager.finder_to_container): Removed.
3495         (TypeManager.finder_to_delegate): Removed.
3496         (TypeManager.finder_to_interface): Removed.
3497         (TypeManager.finder_to_enum): Removed.
3498
3499         * interface.cs (Interface): Implement IMemberFinder.
3500
3501         * delegate.cs (Delegate): Implement IMemberFinder.
3502
3503         * enum.cs (Enum): Implement IMemberFinder.
3504
3505         * class.cs (TypeContainer): Implement IMemberFinder.
3506
3507 2002-08-12  Martin Baulig  <martin@gnome.org>
3508
3509         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
3510
3511 2002-08-12  Martin Baulig  <martin@gnome.org>
3512
3513         * ecore.cs (ITypeExpression): New interface for expressions which
3514         resolve to a type.
3515         (TypeExpression): Renamed to TypeLookupExpression.
3516         (Expression.DoResolve): If we're doing a types-only lookup, the
3517         expression must implement the ITypeExpression interface and we
3518         call DoResolveType() on it.
3519         (SimpleName): Implement the new ITypeExpression interface.
3520         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
3521         hack, the situation that we're only looking up types can't happen
3522         anymore when this method is called.  Moved the type lookup code to
3523         DoResolveType() and call it.
3524         (SimpleName.DoResolveType): This ITypeExpression interface method
3525         is now doing the types-only lookup.
3526         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
3527         (ResolveFlags): Added MaskExprClass.
3528
3529         * expression.cs (MemberAccess): Implement the ITypeExpression
3530         interface.
3531         (MemberAccess.DoResolve): Added support for a types-only lookup
3532         when we're called via ITypeExpression.DoResolveType().
3533         (ComposedCast): Implement the ITypeExpression interface.
3534
3535         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
3536         Expression.Resolve() with ResolveFlags.Type instead.
3537
3538 2002-08-12  Martin Baulig  <martin@gnome.org>
3539
3540         * interface.cs (Interface.Define): Apply attributes.
3541
3542         * attribute.cs (Attribute.ApplyAttributes): Added support for
3543         interface attributes.
3544
3545 2002-08-11  Martin Baulig  <martin@gnome.org>
3546
3547         * statement.cs (Block.Emit): Only check the "this" variable if we
3548         do not always throw an exception.
3549
3550         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
3551         whether the property has a set accessor.
3552
3553 2002-08-11  Martin Baulig  <martin@gnome.org>
3554
3555         Added control flow analysis support for structs.
3556
3557         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
3558         with control flow analysis turned off.
3559         (IVariable): New interface.
3560         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
3561         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
3562         (FieldExpr.DoResolve): Resolve the instance expression with flow
3563         analysis turned off and do the definite assignment check after the
3564         resolving when we know what the expression will resolve to.
3565
3566         * expression.cs (LocalVariableReference, ParameterReference):
3567         Implement the new IVariable interface, only call the flow analysis
3568         code if ec.DoFlowAnalysis is true.
3569         (This): Added constructor which takes a Block argument.  Implement
3570         the new IVariable interface.
3571         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
3572         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
3573         This does the definite assignment checks for struct members.
3574
3575         * class.cs (Constructor.Emit): If this is a non-static `struct'
3576         constructor which doesn't have any initializer, call
3577         Block.AddThisVariable() to tell the flow analysis code that all
3578         struct elements must be initialized before control returns from
3579         the constructor.
3580
3581         * statement.cs (MyStructInfo): New public class.
3582         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
3583         argument to this indexer.  If non-zero, check an individual struct
3584         member, not the whole struct.
3585         (FlowBranching.CheckOutParameters): Check struct members.
3586         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
3587         overloaded versions of these methods which take an additional
3588         `int field_idx' argument to check struct members.
3589         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
3590         overloaded versions of these methods which take an additional
3591         `string field_name' argument to check struct member.s
3592         (VariableInfo): Implement the IVariable interface.
3593         (VariableInfo.StructInfo): New public property.  Returns the
3594         MyStructInfo instance of the variable if it's a struct or null.
3595         (Block.AddThisVariable): New public method.  This is called from
3596         Constructor.Emit() for non-static `struct' constructor which do
3597         not have any initializer.  It creates a special variable for the
3598         "this" instance variable which will be checked by the flow
3599         analysis code to ensure that all of the struct's fields are
3600         initialized before control returns from the constructor.
3601         (UsageVector): Added support for struct members.  If a
3602         variable/parameter is a struct with N members, we reserve a slot
3603         in the usage vector for each member.  A struct is considered fully
3604         initialized if either the struct itself (slot 0) or all its
3605         members are initialized.
3606
3607 2002-08-08  Martin Baulig  <martin@gnome.org>
3608
3609         * driver.cs (Driver.MainDriver): Only report an error CS5001
3610         if there were no compilation errors.
3611
3612         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
3613         `UnsafeContext' property to determine whether the parent is in
3614         unsafe context rather than checking the parent's ModFlags:
3615         classes nested in an unsafe class are unsafe as well.
3616
3617 2002-08-08  Martin Baulig  <martin@gnome.org>
3618
3619         * statement.cs (UsageVector.MergeChildren): Distinguish between
3620         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
3621         we return.  Added test17() and test18() to test-154.cs.
3622
3623 2002-08-08  Martin Baulig  <martin@gnome.org>
3624
3625         * typemanager.cs (TypeManager.FilterWithClosure): If we have
3626         Family access, make sure the invoking type isn't a subclass of the
3627         queried type (that'd be a CS1540).
3628
3629         * ecore.cs (Expression.MemberLookup): Added overloaded version of
3630         this method which takes an additional `Type invocation_type'.
3631
3632         * expression.cs (BaseAccess.DoResolve): Use the base type as
3633         invocation and query type.
3634         (MemberAccess.DoResolve): If the lookup failed and we're about to
3635         report a CS0122, try a lookup with the ec.ContainerType - if this
3636         succeeds, we must report a CS1540.
3637
3638 2002-08-08  Martin Baulig  <martin@gnome.org>
3639
3640         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
3641         (MethodGroupExpr): Implement the IMemberExpr interface.
3642
3643         * expression (MemberAccess.ResolveMemberAccess): No need to have
3644         any special code for MethodGroupExprs anymore, they're now
3645         IMemberExprs.   
3646
3647 2002-08-08  Martin Baulig  <martin@gnome.org>
3648
3649         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
3650         Family, FamANDAssem and FamORAssem permissions.
3651         (TypeManager.IsSubclassOrNestedChildOf): New public method.
3652
3653 2002-08-08  Martin Baulig  <martin@gnome.org>
3654
3655         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
3656         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
3657         or loop block.
3658
3659 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
3660
3661         * driver.cs: implemented /resource option to embed managed resources.
3662
3663 2002-08-07  Martin Baulig  <martin@gnome.org>
3664
3665         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
3666         (FieldBase.HasFieldInitializer): New public property.
3667         (FieldBase.GetInitializerExpression): New public method.  Resolves and
3668         returns the field initializer and makes sure it is only resolved once.
3669         (TypeContainer.EmitFieldInitializers): Call
3670         FieldBase.GetInitializerExpression to get the initializer, this ensures
3671         that it isn't resolved multiple times.
3672
3673         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
3674         the resolving process (SimpleName/MemberLookup) that we're currently
3675         emitting a field initializer (which must not access any instance members,
3676         this is an error CS0236).
3677
3678         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
3679         argument, if the `IsFieldInitializer' flag is set, we must report and
3680         error CS0236 and not an error CS0120.   
3681
3682 2002-08-07  Martin Baulig  <martin@gnome.org>
3683
3684         * ecore.cs (IMemberExpr): New public interface.
3685         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
3686         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
3687         if the expression is an IMemberExpr.
3688
3689         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
3690         to be null, implicitly default to `this' if we're non-static in
3691         this case.  Simplified the code a lot by using the new IMemberExpr
3692         interface.  Also fixed bug #28176 here.
3693
3694 2002-08-06  Martin Baulig  <martin@gnome.org>
3695
3696         * cs-parser.jay (SimpleLookup): Removed.  We need to create
3697         ParameterReferences during semantic analysis so that we can do a
3698         type-only search when resolving Cast, TypeOf and SizeOf.
3699         (block): Pass the `current_local_parameters' to the Block's
3700         constructor.
3701
3702         * class.cs (ConstructorInitializer): Added `Parameters parameters'
3703         argument to the constructor.
3704         (ConstructorInitializer.Resolve): Create a temporary implicit
3705         block with the parameters.
3706
3707         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
3708         references here if we aren't doing a type-only search.
3709
3710         * statement.cs (Block): Added constructor which takes a
3711         `Parameters parameters' argument.
3712         (Block.Parameters): New public property.
3713
3714         * support.cs (InternalParameters.Parameters): Renamed `parameters'
3715         to `Parameters' and made it public readonly.
3716
3717 2002-08-06  Martin Baulig  <martin@gnome.org>
3718
3719         * ecore.cs (Expression.Warning): Made this public as well.
3720
3721         * report.cs (Report.Debug): Print the contents of collections.
3722
3723 2002-08-06  Martin Baulig  <martin@gnome.org>
3724
3725         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
3726         used to tell Resolve() which kinds of expressions it may return.
3727         (Expression.Resolve): Added overloaded version of this method which
3728         takes a `ResolveFlags flags' argument.  This can be used to tell
3729         Resolve() which kinds of expressions it may return.  Reports a
3730         CS0118 on error.
3731         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
3732         ResolveFlags.SimpleName.
3733         (Expression.Error118): Added overloaded version of this method which
3734         takes a `ResolveFlags flags' argument.  It uses the flags to determine
3735         which kinds of expressions are allowed.
3736
3737         * expression.cs (Argument.ResolveMethodGroup): New public method.
3738         Resolves an argument, but allows a MethodGroup to be returned.
3739         This is used when invoking a delegate.
3740
3741         * TODO: Updated a bit.
3742
3743 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3744
3745         Fixed compilation with csc.
3746
3747         * ecore.cs: Expression.Error made public. Is this correct? Should
3748         Warning be made public too?
3749
3750         * expression.cs: use ea.Location instead of ea.loc.
3751         [FIXME:  Filed as bug #28607: MCS must report these errors.]
3752
3753 2002-08-06  Martin Baulig  <martin@gnome.org>
3754
3755         * ecore.cs (Expression.loc): Moved the location here instead of
3756         duplicating it in all derived classes.
3757         (Expression.Location): New public property.
3758         (Expression.Error, Expression.Warning): Made them non-static and
3759         removed the location argument.
3760         (Expression.Warning): Added overloaded version which takes an
3761         `int level' argument.
3762         (Expression.Error118): Make this non-static and removed the
3763         expression and location arguments.
3764         (TypeExpr): Added location argument to the constructor.
3765
3766         * expression.cs (StaticCallExpr): Added location argument to
3767         the constructor.
3768         (Indirection, PointerArithmetic): Likewise.
3769         (CheckedExpr, UnCheckedExpr): Likewise.
3770         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
3771         (StringPtr): Likewise.
3772
3773
3774 2002-08-05  Martin Baulig  <martin@gnome.org>
3775
3776         * expression.cs (BaseAccess.DoResolve): Actually report errors.
3777
3778         * assign.cs (Assign.DoResolve): Check whether the source
3779         expression is a value or variable.
3780
3781         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
3782         while resolving the corresponding blocks.
3783
3784         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
3785         an error, don't silently return null.
3786
3787         * statement.cs (Block.AddVariable): Do the error reporting here
3788         and distinguish between CS0128 and CS0136.
3789         (Block.DoResolve): Report all unused labels (warning CS0164).
3790         (LabeledStatement): Pass the location to the constructor.
3791         (LabeledStatement.HasBeenReferenced): New property.
3792         (LabeledStatement.Resolve): Set it to true here.
3793
3794         * statement.cs (Return.Emit): Return success even after reporting
3795         a type mismatch error (CS0126 or CS0127), this is what csc does and
3796         it avoids confusing the users with any consecutive errors.
3797
3798 2002-08-05  Martin Baulig  <martin@gnome.org>
3799
3800         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
3801
3802         * const.cs (Const.LookupConstantValue): Catch circular definitions.
3803
3804         * expression.cs (MemberAccess.DoResolve): Silently return if an
3805         error has already been reported.
3806
3807         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
3808         error has already been reported.
3809
3810 2002-08-05  Martin Baulig  <martin@gnome.org>
3811
3812         * statement.cs (UsageVector): Only initialize the `parameters'
3813         vector if we actually have any "out" parameters.
3814
3815 2002-08-05  Martin Baulig  <martin@gnome.org>
3816
3817         * expression.cs (Binary.ResolveOperator): When combining delegates,
3818         they must have the same type.
3819
3820 2002-08-05  Martin Baulig  <martin@gnome.org>
3821
3822         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
3823         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
3824         work with the ms runtime and we also don't need it: if we're a
3825         PropertyBuilder and not in the `indexer_arguments' hash, then we
3826         are a property and not an indexer.
3827
3828         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
3829         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
3830         since the latter one doesn't work with the ms runtime.
3831
3832 2002-08-03  Martin Baulig  <martin@gnome.org>
3833
3834         Fixed bugs #27998 and #22735.
3835
3836         * class.cs (Method.IsOperator): New public field.
3837         (Method.CheckBase): Report CS0111 if there's already a method
3838         with the same parameters in the current class.  Report CS0508 when
3839         attempting to change the return type of an inherited method.
3840         (MethodData.Emit): Report CS0179 if a method doesn't have a body
3841         and it's not marked abstract or extern.
3842         (PropertyBase): New abstract base class for Property and Indexer.
3843         (PropertyBase.CheckBase): Moved here from Property and made it work
3844         for indexers.
3845         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
3846         the same so we can reuse it there.
3847         (Property, Indexer): Derive from PropertyBase.
3848         (MethodSignature.inheritable_property_signature_filter): New delegate
3849         to find properties and indexers.
3850
3851         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
3852         argument and improved error reporting.
3853
3854         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
3855         EmptyReadOnlyParameters and made it a property.
3856
3857         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
3858         version of this method which takes a `PropertyInfo indexer'.
3859         (TypeManager.RegisterIndexer): New method.
3860
3861         * class.cs: Added myself as author of this file :-)
3862
3863 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3864
3865         * class.cs: fixed compilation on windoze.
3866
3867 2002-08-03  Martin Baulig  <martin@gnome.org>
3868
3869         * interface.cs (Interface.GetInterfaceBases): Check whether all
3870         base interfaces are at least as accessible than the current one.
3871
3872         * class.cs (TypeContainer.GetClassBases): Check whether base types
3873         are at least as accessible than the current type.
3874         (TypeContainer.AsAccessible): Implemented and made non-static.
3875         (MemberBase.CheckParameters): Report errors if the accessibility
3876         checks fail.
3877
3878         * delegate.cs (Delegate.Delegate): The default visibility is
3879         internal for top-level types and private for nested types.
3880         (Delegate.Define): Report errors if the accessibility checks fail.
3881
3882         * enum.cs (Enum.Enum): The default visibility is internal for
3883         top-level types and private for nested types.
3884         (Enum.DefineType): Compute the correct visibility.
3885
3886         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
3887         function which takes a `bool is_toplevel' instead of a TypeContainer.
3888
3889         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
3890         builtin type.
3891
3892 2002-08-02  Martin Baulig  <martin@gnome.org>
3893
3894         * expression.cs (LocalVariableReferenc): Added constructor which
3895         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
3896         (LocalVariableReference.IsReadOnly): New property.
3897         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
3898         variable is readonly, use our own readonly flag to do this; you can
3899         use the new constructor to get a writable reference to a read-only
3900         variable.
3901
3902         * cs-parser.jay (foreach_statement, using_statement): Get a writable
3903         reference to the local variable.
3904
3905 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
3906
3907         * rootcontext.cs (ResolveCore): Also include System.Exception
3908
3909         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
3910         we reach an EmptyStatement.
3911
3912         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
3913         is also fine.
3914
3915         * expression.cs (Binary.ResolveOperator): Check error result in
3916         two places.
3917
3918         use brtrue/brfalse directly and avoid compares to null.
3919
3920 2002-08-02  Martin Baulig  <martin@gnome.org>
3921
3922         * class.cs (TypeContainer.Define): Define all nested interfaces here.
3923         Fixes bug #28407, added test-155.cs.
3924
3925 2002-08-01  Martin Baulig  <martin@gnome.org>
3926
3927         * class.cs (Event.EmitDefaultMethod): Make this work with static
3928         events.  Fixes #28311, added verify-3.cs.
3929
3930 2002-08-01  Martin Baulig  <martin@gnome.org>
3931
3932         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
3933         `is_disposable' fields.
3934         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
3935         `hm.is_disposable' if we're using the collection pattern.
3936         (Foreach.EmitCollectionForeach): Use the correct type for the
3937         enumerator's local variable, only emit the try/finally block if
3938         necessary (fixes #27713).
3939
3940 2002-08-01  Martin Baulig  <martin@gnome.org>
3941
3942         * ecore.cs (Expression.report118): Renamed to Error118 and made
3943         it public static.
3944
3945         * statement.cs (Throw.Resolve): Check whether the expression is of
3946         the correct type (CS0118) and whether the type derives from
3947         System.Exception (CS0155).
3948         (Catch.Resolve): New method.  Do the type lookup here and check
3949         whether it derives from System.Exception (CS0155).
3950         (Catch.CatchType, Catch.IsGeneral): New public properties.
3951
3952         * typemanager.cs (TypeManager.exception_type): Added.
3953
3954 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
3955
3956         * driver.cs: Updated About function.
3957
3958 2002-07-31  Martin Baulig  <martin@gnome.org>
3959
3960         Implemented Control Flow Analysis.
3961
3962         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
3963         (EmitContext.CurrentBranching): Added.
3964         (EmitContext.StartFlowBranching): Added.
3965         (EmitContext.EndFlowBranching): Added.
3966         (EmitContext.KillFlowBranching): Added.
3967         (EmitContext.IsVariableAssigned): Added.
3968         (EmitContext.SetVariableAssigned): Added.
3969         (EmitContext.IsParameterAssigned): Added.
3970         (EmitContext.SetParameterAssigned): Added.
3971         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
3972         Added control flow analysis stuff here.
3973
3974         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
3975         resolve the expression as lvalue.
3976         (LocalVariableReference.DoResolve): Check whether the variable has
3977         already been assigned.
3978         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
3979         the parameter as assigned here.
3980         (ParameterReference.DoResolve): Check whether the parameter has already
3981         been assigned.
3982         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
3983         expression as lvalue.
3984
3985         * statement.cs (FlowBranching): New class for the flow analysis code.
3986         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
3987         (LabeledStatement.IsDefined): New public property.
3988         (LabeledStatement.AddUsageVector): New public method to tell flow
3989         analyis that the label may be reached via a forward jump.
3990         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
3991         flow analysis.
3992         (VariableInfo.Number): New public field.  This is used by flow analysis
3993         to number all locals of a block.
3994         (Block.CountVariables): New public property.  This is the number of
3995         local variables in this block (including the locals from all parent
3996         blocks).
3997         (Block.EmitMeta): Number all the variables.
3998
3999         * statement.cs: Added flow analysis support to all classes.
4000
4001 2002-07-31  Martin Baulig  <martin@gnome.org>
4002
4003         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4004         To get debugging messages, compile mcs with /define:MCS_DEBUG and
4005         then use this argument.
4006
4007         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4008
4009         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4010         use this to specify /define options.
4011
4012 2002-07-29  Martin Baulig  <martin@gnome.org>
4013
4014         * statement.cs (Fixed): Moved all code that does variable lookups
4015         and resolvings from Emit to Resolve.
4016
4017         * statement.cs (For): Moved all code that does variable lookups
4018         and resolvings from Emit to Resolve.
4019
4020         * statement.cs (Using): Moved all code that does variable lookups
4021         and resolvings from Emit to Resolve.
4022
4023 2002-07-29  Martin Baulig  <martin@gnome.org>
4024
4025         * attribute.cs (Attribute.Resolve): Explicitly catch a
4026         System.NullReferenceException when creating the
4027         CustromAttributeBuilder and report a different warning message.
4028
4029 2002-07-29  Martin Baulig  <martin@gnome.org>
4030
4031         * support.cs (ParameterData.ParameterName): Added method to
4032         get the name of a parameter.
4033
4034         * typemanager.cs (TypeManager.IsValueType): New public method.
4035
4036 2002-07-29  Martin Baulig  <martin@gnome.org>
4037
4038         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
4039         is a flag which specifies that it's either ref or out.
4040         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4041         the out parameter to `out Parameter.Modifier mod', also set the
4042         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4043
4044         * support.cs (InternalParameters.ParameterModifier): Distinguish
4045         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4046         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4047
4048         * expression.cs (Argument.GetParameterModifier): Distinguish
4049         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4050         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4051
4052 2002-07-29  Martin Baulig  <martin@gnome.org>
4053
4054         * expression.cs (ParameterReference.ParameterReference): Added
4055         `Location loc' argument to the constructor.
4056
4057         * cs-parser.jay: Pass location to ParameterReference.
4058
4059 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
4060
4061         * statement.cs (Try): Initialize the location.
4062
4063         * cs-parser.jay: pass location to Try.
4064
4065         * expression.cs (Unary.Reduce): Change the prototype to return
4066         whether a constant fold could be performed or not.  The result is
4067         returned in an out parameters.  In the case of Indirection and
4068         AddressOf, we want to perform the full tests.
4069
4070 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
4071
4072         * statement.cs (Statement.Emit): Flag dead code.
4073
4074 2002-07-27  Andrew Birkett  <andy@nobugs.org>
4075
4076         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4077
4078 2002-07-27  Martin Baulig  <martin@gnome.org>
4079
4080         * class.cs (MethodData.Define): Put back call to
4081         TypeManager.AddMethod(), accidentally commented this out.
4082
4083         * report.cs (Debug): New public method to print debugging information,
4084         this is `[Conditional ("DEBUG")]'.
4085
4086 2002-07-26  Martin Baulig  <martin@gnome.org>
4087
4088         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4089         (switch_statement): Push the current_block to the switch_stack and
4090         pop it again when we're done with the switch.
4091         (switch_section): The new block is a child of the current_block.
4092         Fixes bug #24007, added test-152.cs.
4093
4094 2002-07-27  Martin Baulig  <martin@gnome.org>
4095
4096         * expression.cs (Invocation.EmitArguments): When calling a varargs
4097         function with only its fixed arguments, we need to pass an empty
4098         array.
4099
4100 2002-07-27  Martin Baulig  <martin@gnome.org>
4101
4102         Mono 0.13 has been released.
4103
4104 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
4105
4106         * driver.cs: Rename --resource to --linkres, because that is what
4107         we do currently, we dont support --resource yet.
4108
4109         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4110
4111 2002-07-25  Martin Baulig  <martin@gnome.org>
4112
4113         * class.cs (MethodData): New public class.  This is a `method builder'
4114         class for a method or one accessor of a Property/Indexer/Event.
4115         (MethodData.GetMethodFlags): Moved here from MemberBase.
4116         (MethodData.ApplyAttributes): Likewise.
4117         (MethodData.ApplyObsoleteAttribute): Likewise.
4118         (MethodData.ApplyConditionalAttribute): Likewise.
4119         (MethodData.ApplyDllImportAttribute): Likewise.
4120         (MethodData.CheckAbstractAndExternal): Likewise.
4121         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4122         (MethodData.Emit): Formerly known as Method.Emit().
4123         (MemberBase): Moved everything which was specific to a single
4124         accessor/method to MethodData.
4125         (Method): Create a new MethodData and call Define() and Emit() on it.
4126         (Property, Indexer, Event): Create a new MethodData objects for each
4127         accessor and call Define() and Emit() on them.
4128
4129 2002-07-25  Martin Baulig  <martin@gnome.org>
4130
4131         Made MethodCore derive from MemberBase to reuse the code from there.
4132         MemberBase now also checks for attributes.
4133
4134         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4135         (MemberBase.GetMethodFlags): Moved here from class Method and marked
4136         as virtual.
4137         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4138         `CallingConventions cc' and `Attributes opt_attrs' arguments.
4139         (MemberBase.ApplyAttributes): New virtual method; applies the
4140         attributes to a method or accessor.
4141         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
4142         (MemberBase.ApplyConditionalAttribute): Likewise.
4143         (MemberBase.ApplyDllImportAttribute): Likewise.
4144         (MemberBase.CheckAbstractAndExternal): Likewise.
4145         (MethodCore.ParameterTypes): This is now a property instead of a
4146         method, it's initialized from DoDefineParameters().
4147         (MethodCore.ParameterInfo): Removed the set accessor.
4148         (MethodCore.DoDefineParameters): New protected virtual method to
4149         initialize ParameterTypes and ParameterInfo.
4150         (Method.GetReturnType): We can now simply return the MemberType.
4151         (Method.GetMethodFlags): Override the MemberBase version and add
4152         the conditional flags.
4153         (Method.CheckBase): Moved some code from Define() here, call
4154         DoDefineParameters() here.
4155         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
4156         here to avoid some larger code duplication.
4157         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
4158         ensure that abstract and external accessors don't declare a body.
4159
4160         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
4161         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
4162         lookup in the attribute's parent classes, so we need to abort as soon
4163         as we found the first match.
4164         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
4165         the attribute has no arguments.
4166
4167         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
4168         of a Method.
4169
4170 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4171
4172         * cs-parser.jay: reverted previous patch.
4173
4174 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4175
4176         * cs-parser.jay: fixed bug #22119.
4177
4178 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4179
4180         * attribute.cs: fixed compilation. The error was:
4181         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
4182         be assigned to before control leaves the current method."
4183         [FIXME:  Filed as bug #28186: MCS must report this error.]
4184
4185 2002-07-25  Martin Baulig  <martin@gnome.org>
4186
4187         * attribute.cs (Attribute.Conditional_GetConditionName): New static
4188         method to pull the condition name ouf of a Conditional attribute.
4189         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
4190         the obsolete message and error flag out of an Obsolete attribute.
4191
4192         * class.cs (Method.GetMethodFlags): New public method to get the
4193         TypeManager.MethodFlags for this method.
4194         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
4195         private methods.
4196         (Method.Define): Get and apply the Obsolete and Conditional attributes;
4197         if we're overriding a virtual function, set the new private variable
4198         `parent_method'; call the new TypeManager.AddMethod().
4199
4200         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
4201         the MethodBuilder and the Method in a PtrHashtable.
4202         (TypeManager.builder_to_method): Added for this purpose.
4203         (TypeManager.MethodFlags): Added IsObsoleteError.
4204         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
4205         Obsolete and Conditional arguments in MethodBuilders.  If we discover
4206         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
4207         the message from the attribute.
4208
4209 2002-07-24  Martin Baulig  <martin@gnome.org>
4210
4211         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
4212         preprocessor directives, ensure that the argument to #define/#undef is
4213         exactly one identifier and that it's actually an identifier.
4214
4215         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
4216         did not work ....
4217
4218 2002-07-24  Martin Baulig  <martin@gnome.org>
4219
4220         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
4221         initialize it to TypeManager.object_type in the constructor.
4222         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
4223         of the `hm.get_current' method if we're using the collection pattern.
4224         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
4225         for the explicit conversion to make it work when we're using the collection
4226         pattern and the `Current' property has a different return type than `object'.
4227         Fixes #27713.
4228
4229 2002-07-24  Martin Baulig  <martin@gnome.org>
4230
4231         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
4232         does not match, but don't report any errors.  This method is called in
4233         order for all methods in a MethodGroupExpr until a matching method is
4234         found, so we don't want to bail out if the first method doesn't match.
4235         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
4236         matches, report the 123.  Fixes #28070.
4237
4238 2002-07-24  Martin Baulig  <martin@gnome.org>
4239
4240         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
4241         TypeManager.TypeToCoreType() to the top of the method so the
4242         following equality checks will work.  Fixes #28107.
4243
4244 2002-07-24  Martin Baulig  <martin@gnome.org>
4245
4246         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
4247         operand is of type uint, and the other operand is of type sbyte,
4248         short or int, the operands are converted to type long." -
4249         Actually do what this comment already told us.  Fixes bug #28106,
4250         added test-150.cs.
4251
4252 2002-07-24  Martin Baulig  <martin@gnome.org>
4253
4254         * class.cs (MethodBase): New abstract class.  This is now a base
4255         class for Property, Indexer and Event to avoid some code duplication
4256         in their Define() and DefineMethods() methods.
4257         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
4258         generic methods for Define() and DefineMethods().
4259         (FieldBase): Derive from MemberBase, not MemberCore.
4260         (Property): Derive from MemberBase, not MemberCore.
4261         (Property.DefineMethod): Moved all the code from this method to the
4262         new MethodBase.DefineAccessor(), just call it with appropriate
4263         argumetnts.
4264         (Property.Define): Call the new Property.DoDefine(), this does some
4265         sanity checks and we don't need to duplicate the code everywhere.
4266         (Event): Derive from MemberBase, not MemberCore.
4267         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
4268         accessors, this will also make them work with interface events.
4269         (Indexer): Derive from MemberBase, not MemberCore.
4270         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
4271         (Indexer.Define): Use the new MethodBase functions.
4272
4273         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
4274         argument to the constructor.
4275         (Interface.FindMembers): Added support for interface events.
4276         (Interface.PopluateEvent): Implemented.
4277
4278         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
4279
4280 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
4281
4282         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
4283         but this is required to check for a method name being the same as
4284         the containing class.  
4285
4286         Handle this now.
4287
4288 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4289
4290         * interface.cs: initialize variable.
4291
4292 2002-07-23  Martin Baulig  <martin@gnome.org>
4293
4294         Implemented the IndexerName attribute in interfaces.
4295
4296         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
4297         name if this is an explicit interface implementation.
4298         (Indexer.InterfaceIndexerName): New public variable.  If we're
4299         implementing an interface indexer, this is the IndexerName in that
4300         interface.  Otherwise, it's the IndexerName.
4301         (Indexer.DefineMethod): If we're implementing interface indexer,
4302         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
4303         and Pending.ImplementIndexer methods.
4304         (Indexer.Define): Also define the PropertyBuilder if we're
4305         implementing an interface indexer and this is neither an explicit
4306         interface implementation nor do the IndexerName match the one in
4307         the interface.
4308
4309         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
4310         If a method is defined here, then we always need to create a proxy
4311         for it.  This is used when implementing interface indexers.
4312         (Pending.IsInterfaceIndexer): New public method.
4313         (Pending.ImplementIndexer): New public method.
4314         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
4315         This is used when implementing interface indexers to define a proxy
4316         if necessary.
4317         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
4318         define a proxy if necessary.
4319
4320         * interface.cs (Interface.IndexerName): New public variable.
4321         (Interface.PopulateIndexer): Set the IndexerName.
4322         (Interface.DefineIndexers): New private method.  Populate all the
4323         indexers and make sure their IndexerNames match.
4324
4325         * typemanager.cs (IndexerPropertyName): Added support for interface
4326         indexers.
4327
4328 2002-07-22  Martin Baulig  <martin@gnome.org>
4329
4330         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
4331         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
4332         ret if HasReturnLabel.
4333         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
4334         variables.
4335
4336         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
4337         and set the ec.LoopBeginTryCatchLevel.
4338         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
4339         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
4340         the current ec.TryCatchLevel, the branch goes out of an exception
4341         block.  In this case, we need to use Leave and not Br.
4342
4343 2002-07-22  Martin Baulig  <martin@gnome.org>
4344
4345         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
4346         block unless the block does not always return or it is contained in
4347         another try { ... } catch { ... } block.  Fixes bug #26506.
4348         Added verify-1.cs to the test suite.
4349
4350 2002-07-22  Martin Baulig  <martin@gnome.org>
4351
4352         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
4353         then we do not always return.  Fixes bug #24985.
4354
4355 2002-07-22  Martin Baulig  <martin@gnome.org>
4356
4357         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
4358         lookup on a per-class level; ie. walk up the class hierarchy until we
4359         found at least one applicable method, then choose the best among them.
4360         Fixes bug #24463 and test-29.cs.
4361
4362 2002-07-22  Martin Baulig  <martin@gnome.org>
4363
4364         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
4365         return types of the methods.  The return type is not part of the
4366         signature and we must not check it to make the `new' modifier work.
4367         Fixes bug #27999, also added test-147.cs.
4368         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
4369
4370         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
4371         on the method's return type.
4372
4373 2002-07-21  Martin Baulig  <martin@gnome.org>
4374
4375         * assign.cs: Make this work if the rightmost source is a constant and
4376         we need to do an implicit type conversion.  Also adding a few more tests
4377         to test-38.cs which should have caught this.
4378
4379         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
4380         target in the makefile for this.  The makefile.gnu is primarily intended
4381         for end-users who don't want to debug the compiler.
4382
4383 2002-07-21  Martin Baulig  <martin@gnome.org>
4384
4385         * assign.cs: Improved the Assign class so it can now handle embedded
4386         assignments (X = Y = Z = something).  As a side-effect this'll now also
4387         consume less local variables.  test-38.cs now passes with MCS, added
4388         a few new test cases to that test.
4389
4390 2002-07-20  Martin Baulig  <martin@gnome.org>
4391
4392         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
4393         instructions.  Fixes bug #27977, also added test-146.cs.
4394
4395 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4396
4397         * cs-tokenizer.cs: fixed getHex ().
4398
4399 2002-07-19  Martin Baulig  <martin@gnome.org>
4400
4401         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
4402         not Type.GetType() to lookup the array type.  This is needed when
4403         we're constructing an array of a user-defined type.
4404         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
4405         single-dimensional arrays, but also for single-dimensial arrays of
4406         type decimal.
4407
4408 2002-07-19  Martin Baulig  <martin@gnome.org>
4409
4410         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
4411         this function is called, it's not allowed to share LocalBuilders
4412         among ILGenerators.
4413
4414 2002-07-19  Martin Baulig  <martin@gnome.org>
4415
4416         * expression.cs (Argument.Resolve): Report an error 118 when trying
4417         to pass a type as argument.
4418
4419 2002-07-18  Martin Baulig  <martin@gnome.org>
4420
4421         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
4422         Conv_R_Un for the signed `long' type.
4423
4424 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
4425
4426         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
4427         `expr' for the temporary result, as that will fail if we do
4428         multiple resolves on the same expression.
4429
4430 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
4431
4432         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
4433         ec.TypeContainer for looking up aliases. 
4434
4435         * class.cs (TypeContainer): Remove LookupAlias from here.
4436
4437         * decl.cs (DeclSpace); Move here.
4438
4439 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
4440
4441         * class.cs (FindMembers): Only call filter if the constructor
4442         bulider is not null.
4443
4444         Also handle delegates in `NestedTypes' now.  Now we will perform
4445         type lookups using the standard resolution process.  This also
4446         fixes a bug.
4447
4448         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
4449         This uses Expressions (the limited kind that can be parsed by the
4450         tree) instead of strings.
4451
4452         * expression.cs (ComposedCast.ToString): Implement, used to flag
4453         errors since now we have to render expressions.
4454
4455         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
4456         FormArrayType. 
4457
4458         * ecore.cs (SimpleName.ToString): ditto.
4459
4460         * cs-parser.jay: Instead of using strings to assemble types, use
4461         Expressions to assemble the type (using SimpleName, ComposedCast,
4462         MemberAccess).  This should fix the type lookups in declarations,
4463         because we were using a different code path for this.
4464
4465         * statement.cs (Block.Resolve): Continue processing statements
4466         even when there is an error.
4467
4468 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
4469
4470         * class.cs (Event.Define): Also remove the `remove' method from
4471         the list of pending items.
4472
4473         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
4474         generate more compact code. 
4475
4476 2002-07-17  Martin Baulig  <martin@gnome.org>
4477
4478         * const.cs (Const.LookupConstantValue): Add support for constant
4479         `unchecked' and `checked' expressions.
4480         Also adding test case test-140.cs for this.
4481
4482 2002-07-17  Martin Baulig  <martin@gnome.org>
4483
4484         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
4485         check whether mi.ReturnType implements the IEnumerator interface; the
4486         `==' and the IsAssignableFrom() will fail in this situation.
4487
4488 2002-07-16  Ravi Pratap  <ravi@ximian.com>
4489
4490         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
4491         here too.
4492
4493 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4494
4495         * expression.cs: fixed bug #27811.
4496
4497 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
4498
4499         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
4500         Molaro: when we are a ref, the value already contains a pointer
4501         value, do not take the address of it.
4502
4503 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
4504         * removed mb-parser.jay and mb-tokenizer.cs
4505
4506 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4507
4508         * expression.cs: check against the building corlib void type.
4509
4510 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
4511
4512         * ecore.cs: fix for valuetype static readonly fields: when 
4513         initializing them, we need their address, not the address of a copy.
4514
4515 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
4516
4517         * typemanager.cs: register also enum_type in corlib.
4518
4519 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4520
4521         * class.cs: allow calling this (but not base) initializers in structs.
4522
4523 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
4524
4525         * ecore.cs: make sure we compare against the building base types
4526         in GetTypeSize ().
4527
4528 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
4529
4530         * typemanager.cs: fix TypeToCoreType() to handle void and object
4531         (corlib gets no more typerefs after this change).
4532
4533 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
4534
4535         * expression.cs (ArrayCreation.EmitArrayArguments): use
4536         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
4537
4538         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
4539         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
4540         array indexes, the runtime actually forbids them.
4541
4542         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
4543         for array arguments here.
4544
4545         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
4546         instead of the default for ValueTypes.
4547
4548         (New.DoEmit): Use IsValueType instead of
4549         IsSubclassOf (value_type)
4550         (New.DoResolve): ditto.
4551         (Invocation.EmitCall): ditto.
4552
4553         * assign.cs (Assign): ditto.
4554
4555         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
4556         Statements *are* currently doing part of their resolution during
4557         Emit.  
4558
4559         Expressions do always resolve during resolve, but statements are
4560         only required to propagate resolution to their children.
4561
4562 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
4563
4564         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
4565
4566         (LoadAssembly): Do not add the dll if it is already specified
4567         
4568         (MainDriver): Add the System directory to the link path at the end,
4569         after all the other -L arguments. 
4570
4571         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
4572         wrong opcode for loading bytes and bools (ldelem.i1 instead of
4573         ldelem.u1) and using the opposite for sbytes.
4574
4575         This fixes Digger, and we can finally run it.
4576
4577         * driver.cs (UnixParseOption): Move the option parsing here.  
4578         (CSCParseOption): Implement CSC-like parsing of options.
4579
4580         We now support both modes of operation, the old Unix way, and the
4581         new CSC-like way.  This should help those who wanted to make cross
4582         platform makefiles.
4583
4584         The only thing broken is that /r:, /reference: and /lib: are not
4585         implemented, because I want to make those have the same semantics
4586         as the CSC compiler has, and kill once and for all the confussion
4587         around this.   Will be doing this tomorrow.
4588
4589         * statement.cs (Unsafe.Resolve): The state is checked during
4590         resolve, not emit, so we have to set the flags for IsUnsfe here.
4591
4592 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
4593
4594         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
4595         not catch the Error_ObjectRefRequired in SimpleName (as it is
4596         possible to have a class/instance variable name that later gets
4597         deambiguated), we have to check this here.      
4598
4599 2002-07-10  Ravi Pratap  <ravi@ximian.com>
4600
4601         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
4602         make static and put into Expression.
4603
4604         (Event.Define): Register the private field of the event with the 
4605         TypeManager so that GetFieldFromEvent can get at it.
4606
4607         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
4608         keep track of the private field associated with an event which
4609         has no accessors.
4610
4611         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
4612         private field.
4613
4614         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
4615         
4616 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
4617
4618         * expression.cs (Binary.EmitBranchable): this routine emits the
4619         Binary expression in a branchable context.  This basically means:
4620         we need to branch somewhere, not just get the value on the stack.
4621
4622         This works together with Statement.EmitBoolExpression.
4623
4624         * statement.cs (Statement.EmitBoolExpression): Use
4625         EmitBranchable. 
4626
4627 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
4628
4629         * statement.cs (For): Reduce the number of jumps in loops.
4630
4631         (For): Implement loop inversion for the For statement.
4632
4633         (Break): We can be breaking out of a Try/Catch controlled section
4634         (foreach might have an implicit try/catch clause), so we need to
4635         use Leave instead of Br.
4636
4637         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
4638         now).  If the instace expression supports IMemoryLocation, we use
4639         the AddressOf method from the IMemoryLocation to extract the
4640         address instead of emitting the instance.
4641
4642         This showed up with `This', as we were emitting the instance
4643         always (Emit) instead of the Address of This.  Particularly
4644         interesting when This is a value type, as we dont want the Emit
4645         effect (which was to load the object).
4646         
4647 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
4648
4649         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
4650
4651         * statement.cs (Checked): Set the CheckedState during the resolve
4652         process too, as the ConvCast operations track the checked state on
4653         the resolve process, and not emit.
4654
4655         * cs-parser.jay (namespace_member_declaration): Flag that we have
4656         found a declaration when we do.  This is used to flag error 1529
4657
4658         * driver.cs: Report ok when we display the help only.
4659
4660 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
4661
4662         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
4663
4664 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
4665
4666         * cs-tokenizer.cs (define): We also have to track locally the
4667         defines.  AllDefines is just used for the Conditional Attribute,
4668         but we also need the local defines for the current source code. 
4669
4670 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
4671
4672         * statement.cs (While, For, Do): These loops can exit through a
4673         Break statement, use this information to tell whether the
4674         statement is the last piece of code.
4675
4676         (Break): Flag that we break.
4677
4678         * codegen.cs (EmitContexts): New `Breaks' state variable.
4679
4680 2002-07-03  Martin Baulig  <martin@gnome.org>
4681
4682         * class.cs (TypeContainer.MethodModifiersValid): Allow override
4683         modifiers in method declarations in structs.  Otherwise, you won't
4684         be able to override things like Object.Equals().
4685
4686 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
4687
4688         * class.cs (Method, Property, Indexer): Do not allow the public
4689         modifier to be used in explicit interface implementations.
4690
4691         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
4692         override modifiers in method declarations in structs
4693
4694 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
4695
4696         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
4697         integer or real overflow, report an error
4698
4699 2002-07-02  Martin Baulig  <martin@gnome.org>
4700
4701         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
4702         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
4703         to tell the runtime about our newly created System.Object and
4704         System.ValueType types.
4705
4706 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
4707
4708         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
4709         struct instead of Ldarg/Starg.
4710
4711 2002-07-02  Martin Baulig  <martin@gnome.org>
4712
4713         * expression.cs (Indirection.Indirection): Call
4714         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
4715
4716 2002-07-02  Martin Baulig  <martin@gnome.org>
4717
4718         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
4719         ValueType, call TypeManager.TypeToCoreType() on it.
4720         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
4721         the OpCodes.Newarr argument.
4722
4723 2002-07-02  Martin Baulig  <martin@gnome.org>
4724
4725         * expression.cs (Invocation.EmitCall): When compiling corlib,
4726         replace all calls to the system's System.Array type to calls to
4727         the newly created one.
4728
4729         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
4730         System.Array methods.
4731         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
4732         from the system's System.Array type which must be replaced.
4733
4734 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
4735
4736         * typemanager.cs: load unverifiable_code_ctor so we can build
4737         corlib using the correct type. Avoid using GetTypeCode() with
4738         TypeBuilders.
4739         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
4740         TypeManager.object_type to allow building corlib.
4741
4742 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
4743
4744         * ecore.cs: handle System.Enum separately in LoadFromPtr().
4745
4746 2002-07-01  Martin Baulig  <martin@gnome.org>
4747
4748         * class.cs: Make the last change actually work, we need to check
4749         whether `ifaces != null' to avoid a crash.
4750
4751 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4752
4753         * class.cs: when we build structs without fields that implement
4754         interfaces, we need to add the interfaces separately, since there is
4755         no API to both set the size and add the interfaces at type creation
4756         time.
4757
4758 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4759
4760         * expression.cs: the dimension arguments to the array constructors
4761         need to be converted if they are a long.
4762
4763 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
4764
4765         * class.cs: don't emit ldarg.0 if there is no parent constructor
4766         (fixes showstopper for corlib).
4767
4768 2002-06-29  Martin Baulig  <martin@gnome.org>
4769
4770         MCS now compiles corlib on GNU/Linux :-)
4771
4772         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
4773         ie. check for MethodImplOptions.InternalCall.
4774
4775         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
4776         and TypeManager.attribute_type are null, so we must explicitly check
4777         whether parent is not null to find out whether it's an attribute type.
4778         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
4779         and SetBuilder, not only if the property is neither abstract nor external.
4780         This is necessary to set the MethodImplOptions on the accessor methods.
4781         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
4782         SetBuilder, see Property.Emit().
4783
4784         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
4785         populate "System.Object", "System.ValueType" and "System.Attribute" since
4786         they've already been populated from BootCorlib_PopulateCoreTypes().
4787
4788 2002-06-29  Martin Baulig  <martin@gnome.org>
4789
4790         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
4791         is the NullLiteral, we also need to make sure that target_type is not
4792         an enum type.   
4793
4794 2002-06-29  Martin Baulig  <martin@gnome.org>
4795
4796         * rootcontext.cs (RootContext.ResolveCore): We must initialize
4797         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
4798         before calling BootstrapCorlib_ResolveDelegate ().
4799
4800 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4801
4802         * statement.cs: fixed build-breaker. All tests passed ok.
4803
4804 2002-06-27  Martin Baulig  <martin@gnome.org>
4805
4806         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
4807         for System.Decimal when compiling corlib.
4808
4809 2002-06-27  Martin Baulig  <martin@gnome.org>
4810
4811         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
4812         switch blocks which contain nothing but a default clause.
4813
4814 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
4815
4816        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
4817
4818 2002-06-27  Martin Baulig  <martin@gnome.org>
4819
4820         * ecore.cs (PropertyExpr.PropertyExpr): Call
4821         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
4822
4823         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
4824         is already a TypeBuilder.
4825
4826 2002-06-27  Martin Baulig  <martin@gnome.org>
4827
4828         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
4829         `target_type == TypeManager.array_type', not IsAssignableFrom() in
4830         the "from an array-type to System.Array" case.  This makes it work
4831         when compiling corlib.
4832
4833 2002-06-27  Martin Baulig  <martin@gnome.org>
4834
4835         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
4836         non-static PropertyExpr, set its InstanceExpression.  This makes
4837         the `ICollection.Count' property work in System/Array.cs.
4838
4839 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
4840
4841         * driver.cs: Made error handling more consistent.  Errors now
4842         tracked by Report class, so many methods which used to return int
4843         now return void.  Main() now prints success/failure and 
4844         errors/warnings message.
4845
4846         Renamed '--probe' compiler argument to '--expect-error'.  Removed
4847         the magic number return values (123 and 124).  Now, if the
4848         expected error occurs, the compiler exits with success (exit value
4849         0).  If the compilation completes without seeing that particular
4850         error, the compiler exits with failure (exit value 1).  The
4851         makefile in mcs/errors has been changed to handle the new behaviour.
4852
4853         * report.cs: Made 'expected error' number a property and renamed
4854         it from 'Probe' to 'ExpectedError'.
4855
4856         * genericparser.cs: Removed error handling support, since it is
4857         now all done by Report class.
4858
4859         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
4860         class, so parse() no longer returns an int.
4861
4862         * namespace.cs: Use Report.Error instead of GenericParser.error
4863
4864 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
4865
4866         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
4867         TypeContainer.AddOperator): At the front of the list put the
4868         explicit implementations, so they get resolved/defined first. 
4869
4870 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
4871
4872         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
4873         interface type is implemented by this TypeContainer.  Used during
4874         explicit interface implementation.
4875
4876         (Property.Define, Indexer.Define, Method.Define): Validate that
4877         the given interface in the explicit implementation is one of the
4878         base classes for the containing type.
4879
4880         Also if we are explicitly implementing an interface, but there is
4881         no match in the pending implementation table, report an error.
4882
4883         (Property.Define): Only define the property if we are
4884         not explicitly implementing a property from an interface.  Use the
4885         correct name also for those properties (the same CSC uses,
4886         although that is really not needed).
4887         
4888         (Property.Emit): Do not emit attributes for explicitly implemented
4889         properties, as there is no TypeBuilder.
4890
4891         (Indexer.Emit): ditto.
4892
4893         Hiding then means that we do not really *implement* a pending
4894         implementation, which makes code fail.
4895
4896 2002-06-22  Martin Baulig  <martin@gnome.org>
4897
4898         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
4899         the return value of Object.GetType().  [FIXME: we need to do this whenever
4900         we get a type back from the reflection library].
4901
4902 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
4903
4904         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
4905
4906 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
4907
4908         * attribute.cs: Return null if we can not look up the type.
4909
4910         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
4911         the interface types found.
4912
4913         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
4914         interface types found.
4915
4916         * typemanager.cs (GetInterfaces): Make this routine returns alll
4917         the interfaces and work around the lame differences between
4918         System.Type and System.Reflection.Emit.TypeBuilder in the results
4919         result for GetInterfaces.
4920         
4921         (ExpandInterfaces): Given an array of interface types, expand and
4922         eliminate repeated ocurrences of an interface.  This expands in
4923         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
4924         be IA, IB, IC.
4925         
4926 2002-06-21  Martin Baulig  <martin@gnome.org>
4927
4928         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
4929         on System.Enum.
4930
4931 2002-06-21  Martin Baulig  <martin@gnome.org>
4932
4933         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
4934         and called with one of the core types, return the corresponding typebuilder for
4935         that type.
4936
4937         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
4938         element type.
4939
4940 2002-06-21  Martin Baulig  <martin@gnome.org>
4941
4942         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
4943         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
4944         (Expression.ConvertReferenceExplicit): Likewise.
4945
4946         * expression.cs (ElementAccess.DoResolve): Likewise.
4947         (ElementAccess.DoResolveLValue): Likewise.
4948
4949 2002-06-10  Martin Baulig  <martin@gnome.org>
4950
4951         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
4952         add the "value" parameter to the parameter list.
4953
4954         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
4955         to our caller.
4956
4957 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
4958
4959         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
4960         the argument to an int, uint, long or ulong, per the spec.  Also
4961         catch negative constants in array creation.
4962
4963 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
4964
4965         * class.cs: do not allow the same interface to appear twice in
4966         the definition list.
4967
4968 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
4969
4970         * ecore.cs: don't use ldlen with System.Array.
4971
4972 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
4973
4974         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
4975
4976 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
4977
4978         * modifiers.cs: produce correct field attributes for protected
4979         internal. Easy fix so miguel can work on ther harder stuff:-)
4980
4981 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
4982
4983         * pending.cs: New file.  Move the code from class.cs here.
4984         Support clearning the pending flag for all methods (when not doing
4985         explicit interface implementation).
4986
4987 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
4988
4989         * rootcontext.cs: added a couple more types needed to bootstrap.
4990
4991 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
4992
4993         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
4994         constructor in the type, instead of any constructor in the type
4995         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
4996         a bug in the Mono runtime when applying the params attribute). 
4997
4998 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
4999         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5000
5001 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
5002
5003         * expression.cs (Unary.ResolveOperator): Use TypeManager
5004         to resolve the type.
5005         
5006 2002-06-13  Ravi Pratap  <ravi@ximian.com>
5007
5008         * cs-parser.jay (enum_member_declaration): Pass in the attributes
5009         attached.
5010
5011         * enum.cs (AddEnumMember): Add support to store the attributes associated 
5012         with each member too.
5013
5014         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5015         field builders too - this takes care of the enum member case.
5016
5017 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
5018
5019         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5020         address-of operator on both value types and pointers.
5021         
5022 2002-06-10  Martin Baulig  <martin@gnome.org>
5023
5024         * interface.cs (Interface.PopulateIndexer): Add the indexer's
5025         PropertyBuilder to the `property_builders' list.
5026
5027         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5028         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5029         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
5030         find any indexers which are inherited from an interface.
5031
5032 2002-06-09  Martin Baulig  <martin@gnome.org>
5033
5034         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5035         the same type as the constant if necessary.  There's also a test-130.cs
5036         for this.
5037
5038         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5039
5040         * typemanager.cs (TypeManager.ChangeType): Previously known as
5041         Enum.ChangeEnumType().
5042
5043 2002-06-09  Martin Baulig  <martin@gnome.org>
5044
5045         * expression.cs (Cast.TryReduce): Added support for consts.
5046
5047 2002-06-08  Ravi Pratap  <ravi@ximian.com>
5048
5049         * class.cs (Accessor): Hold attributes information so we can pass
5050         it along.
5051
5052         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5053         Modify to pass in attributes attached to the methods.
5054
5055         (add_accessor_declaration, remove_accessor_declaration): Ditto.
5056
5057         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5058         to handle the Accessor kind :-)
5059
5060         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5061         
5062 2002-06-08  Martin Baulig  <martin@gnome.org>
5063
5064         * expression.cs (Unary.TryReduceNegative): Added support for
5065         ULongConstants.
5066
5067 2002-06-08  Martin Baulig  <martin@gnome.org>
5068
5069         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5070         name can't be found in the `defined_names' - the caller will do a
5071         MemberLookup in this case and thus find methods in System.Enum
5072         such as Enum.IsDefined().
5073
5074 2002-06-08  Martin Baulig  <martin@gnome.org>
5075
5076         * enum.cs (Enum.ChangeEnumType): This is a custom version of
5077         Convert.ChangeType() which works with TypeBuilder created types.
5078         (Enum.LookupEnumValue, Enum.Define): Use it here.
5079
5080         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5081         `TypeBuilder.BaseType != null' check.
5082         (TypeContainer.FindMembers): Only lookup parent members if we
5083         actually have a parent.
5084         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5085         (ConstructorInitializer.Resolve): Likewise.
5086
5087         * interface.cs (Interface.FindMembers): Added
5088         `TypeBuilder.BaseType != null' check.
5089
5090         * rootcontext.cs (RootContext.ResolveCore): Added
5091         "System.Runtime.CompilerServices.IndexerNameAttribute" to
5092         classes_second_stage.
5093
5094         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5095         debug_type and trace_type when compiling with --nostdlib.       
5096
5097 2002-06-07  Martin Baulig  <martin@gnome.org>
5098
5099         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5100         (AddField): Set it to true when adding a non-static field.
5101         (DefineType): Use `have_nonstatic_fields' to find out whether we
5102         have non-static fields, not `Fields != null'.
5103
5104 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
5105
5106         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5107         dereferencing a null on the static-field code path)
5108
5109 2002-05-30  Martin Baulig  <martin@gnome.org>
5110
5111         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5112         to take command line arguments.  Use reflection to call the new
5113         custom `Initialize' function on the symbol writer and pass it the
5114         command line arguments.
5115
5116         * driver.cs (--debug-args): New command line argument to pass command
5117         line arguments to the symbol writer.
5118
5119 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
5120
5121         * assign.cs (DoResolve): Forgot to do the implicit conversion to
5122         the target type for indexers and properties.  Thanks to Joe for
5123         catching this.
5124
5125 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
5126
5127         * typemanager.cs (MethodFlags): returns the method flags
5128         (Obsolete/ShouldIgnore) that control warning emission and whether
5129         the invocation should be made, or ignored. 
5130
5131         * expression.cs (Invocation.Emit): Remove previous hack, we should
5132         not do this on matching a base type, we should do this based on an attribute
5133
5134         Only emit calls to System.Diagnostics.Debug and
5135         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5136         on the command line.
5137
5138         * rootcontext.cs: Global settings for tracing and debugging.
5139
5140         * cs-tokenizer.cs (define): New utility function to track
5141         defines.   Set the global settings for TRACE and DEBUG if found.
5142
5143 2002-05-25  Ravi Pratap  <ravi@ximian.com>
5144
5145         * interface.cs (Populate*): Pass in the TypeContainer as well as
5146         the DeclSpace as parameters so that we can create EmitContexts and
5147         then use that to apply attributes etc.
5148
5149         (PopulateMethod, PopulateEvent, PopulateProperty)
5150         (PopulateIndexer): Apply attributes everywhere.
5151
5152         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
5153         etc.
5154
5155         (ApplyAttributes): Update accordingly.
5156
5157         We now apply interface attributes for all members too.
5158
5159 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
5160
5161         * class.cs (Indexer.Define); Correctly check if we are explicit
5162         implementation (instead of checking the Name for a ".", we
5163         directly look up if the InterfaceType was specified).
5164
5165         Delay the creation of the PropertyBuilder.
5166
5167         Only create the PropertyBuilder if we are not an explicit
5168         interface implementation.   This means that explicit interface
5169         implementation members do not participate in regular function
5170         lookups, and hence fixes another major ambiguity problem in
5171         overload resolution (that was the visible effect).
5172
5173         (DefineMethod): Return whether we are doing an interface
5174         implementation. 
5175         
5176         * typemanager.cs: Temporary hack until we get attributes in
5177         interfaces (Ravi is working on that) and we get IndexerName
5178         support in interfaces.
5179
5180         * interface.cs: Register the indexers as properties.
5181
5182         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
5183         warning, I have verified that this is a bug in the .NET runtime
5184         (JavaScript suffers of the same problem).
5185
5186         * typemanager.cs (MemberLookup): When looking up members for
5187         interfaces, the parent of an interface is the implicit
5188         System.Object (so we succeed in searches of Object methods in an
5189         interface method invocation.  Example:  IEnumerable x;  x.ToString
5190         ()) 
5191
5192 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
5193
5194         * class.cs (Event): Events should also register if they do
5195         implement the methods that an interface requires.
5196
5197         * typemanager.cs (MemberLookup); use the new GetInterfaces
5198         method. 
5199
5200         (GetInterfaces): The code used to lookup interfaces for a type is
5201         used in more than one place, factor it here. 
5202
5203         * driver.cs: Track the errors at the bottom of the file, we kept
5204         on going.
5205
5206         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
5207         instance if the method we are calling is static!
5208
5209 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
5210
5211         * attribute.cs (ApplyAttributes): Make this function filter out
5212         the IndexerName attribute (as that attribute in reality is never
5213         applied) and return the string constant for the IndexerName
5214         attribute. 
5215
5216         * class.cs (TypeContainer.Emit): Validate that all the indexers
5217         have the same IndexerName attribute, and if so, set the
5218         DefaultName attribute on the class. 
5219
5220         * typemanager.cs: The return value might contain other stuff (not
5221         only methods).  For instance, consider a method with an "Item"
5222         property and an Item method.
5223
5224         * class.cs: If there is a problem with the parameter types,
5225         return. 
5226
5227 2002-05-24  Ravi Pratap  <ravi@ximian.com>
5228
5229         * ecore.cs (ImplicitConversionExists): Wrapper function which also
5230         looks at user defined conversion after making a call to 
5231         StandardConversionExists - we need this for overload resolution.
5232
5233         * expression.cs : Update accordingly the various method calls.
5234
5235         This fixes 2 bugs filed against implicit user defined conversions 
5236
5237 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
5238
5239         * statement.cs: Track the result of the assignment.
5240
5241 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
5242
5243         * expression.cs (MemberAccess): Improved error reporting for
5244         inaccessible members.
5245
5246 2002-05-22  Martin Baulig  <martin@gnome.org>
5247
5248         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
5249         itself with debugging support.
5250
5251 2002-05-22  Martin Baulig  <martin@gnome.org>
5252
5253         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
5254         Removed, this isn't needed anymore.
5255
5256 2002-05-20  Martin Baulig  <martin@gnome.org>
5257
5258         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
5259         be underlying type for an enum.
5260
5261 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
5262
5263         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
5264         that splits out the loading of just the core types.
5265
5266         * rootcontext.cs (ResolveCore): Split the struct resolution in
5267         two, so we can load the enumeration underlying types before any
5268         enums are used.
5269
5270         * expression.cs (Is): Bandaid until we fix properly Switch (see
5271         bug #24985 for details).
5272
5273         * typemanager.cs (ImplementsInterface): The hashtable will contain
5274         a null if there are no interfaces implemented.
5275
5276 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
5277
5278         * cs-parser.jay (indexer_declarator): It is fine to have array
5279         parameters
5280
5281 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
5282
5283         * typemanager.cs: (RegisterBuilder): New function used to register
5284         TypeBuilders that implement interfaces.  Since
5285         TypeBuilder.GetInterfaces (as usual) does not work with lame
5286         Reflection.Emit. 
5287         (AddUserType): register interfaces.
5288
5289         (ImplementsInterface): Use the builder_to_ifaces hash if we are
5290         dealing with TypeBuilder.  Also, arrays are showing up as
5291         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
5292         methods can not be invoked on them!
5293
5294         * ecore.cs (ExplicitReferenceConversionExists): Made public.
5295         (ImplicitReferenceConversionExists): Split out from
5296         StandardConversionExists. 
5297
5298         * expression.cs (As): We were only implementing one of the three
5299         cases for the as operator.  We now implement them all.
5300         (Is): Implement the various other cases for Is as well.
5301
5302         * typemanager.cs (CACHE): New define used to control if we want or
5303         not the FindMembers cache.  Seems to have a negative impact on
5304         performance currently
5305
5306         (MemberLookup): Nested types have full acess to
5307         enclosing type members
5308
5309         Remove code that coped with instance/static returns for events, we
5310         now catch this in RealFindMembers.
5311
5312         (RealFindMembers): only perform static lookup if the instance
5313         lookup did not return a type or an event.  
5314
5315 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
5316
5317         * assign.cs (CompoundAssign): We pass more semantic information
5318         now to Compound Assignments than we did before: now we have all
5319         the information at hand, and now we resolve the target *before* we
5320         do the expression expansion, which allows the "CacheValue" method
5321         to have the effect we intended (before, a [x] += 1 would generate
5322         two differen ArrayAccess expressions from the ElementAccess,
5323         during the resolution process).
5324
5325         (CompoundAssign.DoResolve): Resolve target and original_source here.
5326
5327 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
5328
5329         * expression.cs (ArrayAccess): dropped debugging information. 
5330
5331         * typemanager.cs: Small bug fix: I was always returning i_members,
5332         instead of one of i_members or s_members (depending on which had
5333         the content).
5334
5335         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
5336         method is invoked before any code generation takes place, and it
5337         is a mechanism to inform that the expression will be invoked more
5338         than once, and that the method should use temporary values to
5339         avoid having side effects
5340
5341         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
5342         
5343         * ecore.cs (Expression.CacheTemporaries): Provide empty default
5344         implementation.
5345
5346         * expression.cs (Indirection, ArrayAccess): Add support for
5347         CacheTemporaries in these two bad boys. 
5348
5349         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
5350         ldobj or ldind_ref.  
5351         (StoreFromPtr): Handle stobj as well.
5352
5353         * expression.cs (UnaryMutator): Share more code.
5354         
5355         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
5356         down: I was not tracking the Filter function as well, which
5357         was affecting the results of the cache.
5358
5359 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
5360
5361         * attribute.cs: Remove the hack to handle the CharSet property on
5362         StructLayouts. 
5363
5364 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
5365
5366         * attribute.cs (DoResolve): More uglyness, we now only try to
5367         resolve the attribute partially, to extract the CharSet
5368         information (only if we are a StructLayout attribute).  Otherwise 
5369
5370         (GetExtraTypeInfo): Add some code to conditionally kill in the
5371         future this.   I am more and more convinced that the .NET
5372         framework has special code to handle the attribute setting on
5373         certain elements.
5374
5375         * expression.cs (IsParamsMethodApplicable): Revert my previous
5376         foreach change here, it was wrong.
5377
5378 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
5379
5380         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
5381         (pp_expr): do not abort on unknown input, just return.
5382         (eval): abort if there are pending chars.
5383
5384         * attribute.cs (Attribute.Resolve): Positional parameters are
5385         optional.  Deal with that case.
5386
5387         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
5388         the Ansi/Unicode/Auto information for the type.
5389
5390         (TypeContainer.DefineType): instantiate the EmitContext here, as
5391         we will be using it during the type definition (to resolve
5392         attributes) and during the emit phase.
5393
5394         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
5395         to pull type information out of the attributes
5396
5397         (Attribute.Resolve): track the constructor builder, and allow for
5398         multiple invocations (structs and classes will use this).
5399
5400         * ecore.cs (MemberLookupFinal): new version with all the
5401         parameters customizable.
5402
5403         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
5404         constructors.  Return if the result value is null (as the error
5405         would have been flagged already by MemberLookupFinal)
5406
5407         Do not allow instances of abstract classes or interfaces to be
5408         created.
5409         
5410         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
5411         We have to compare the assembly property here when dealing with
5412         FamANDAssem and Assembly access modifiers, because we might be
5413         creating an assembly from *modules* (that means that we are not
5414         getting TypeBuilders for types defined in other modules that are
5415         part of this assembly).
5416
5417         (Method.Emit): If the method is marked abstract and has a body,
5418         emit an error. 
5419
5420         (TypeContainer.DefineMembers): If both the defined member and the
5421         parent name match are methods, then do not emit any warnings: let
5422         the Method.Define routine take care of flagging warnings.  But if
5423         there is a mismatch (method overrides something else, or method is
5424         overriwritten by something, then emit warning).
5425
5426         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
5427         set to null, this means `do not check for the return type on the
5428         signature'. 
5429
5430         (Method.Define): set the return type for the method signature to
5431         null, so that we get methods with the same name and parameters and
5432         different return types.  This is used to flag warning 114 (you are
5433         hiding a method, and you probably want to use the new/override
5434         keywords instead).
5435
5436         * typemanager.cs (MemberLookup): Implemented proper access
5437         control, closing a long standing set of bug reports.  The problem
5438         was that the Framework only has two bits: Public and NonPublic,
5439         and NonPublic includes private and protected methods, but we need
5440         to enforce the FamANDAssem, FamOrAssem and Family. 
5441
5442 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
5443
5444         * statement.cs (GotoCase): Return true: Ammounts to giving up
5445         knowledge on whether we return or not, and letting the other case
5446         be responsible for it.
5447
5448 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
5449
5450         * driver.cs: Do not load directories for each file processed, only
5451         do it if there is a pattern.
5452
5453         * ecore.cs: Report readonly assigns here as well, as we might have
5454         been resolved only by MemberAccess.
5455
5456         (SimpleName.SimpleNameResolve): Also be useful for LValue
5457         resolution.   We need this to propagate assign to local readonly variables
5458
5459         * typemanager.cs: Use a ptrhashtable for the criteria, because we
5460         do not want to reuse potential criteria memory.
5461
5462         * class.cs (MyEventBuilder): Set reflected_type;
5463
5464         * ecore.cs (Constantify): Added support for constifying bools.
5465
5466         (RootContext.LookupType): Added a cache for values looked up in
5467         the declaration space.
5468
5469         * typemanager.cs (FindMembers): Now is a front-end to
5470         RealFindMembers, and provides a two-level hashtable-based cache to
5471         the request.  
5472
5473         15% performance improvement: from 22.5 to 19.2 seconds.
5474
5475         * expression.cs (IsParamsMethodApplicable): use foreach.
5476         (Invocation.DoResolve): ditto.
5477         (New.DoResolve): ditto.
5478         (ArrayCreation.DoResolve): ditto.
5479
5480         * ecore.cs (FindMostEncompassingType): use foreach.
5481
5482         * delegate.cs (NewDelegate.DoResolve): Use foreach
5483
5484         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
5485         (RemoveMethods): use foreach.
5486
5487         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
5488         nested foreach statements instead of for, and also break out of
5489         the inner loop once a match is found.
5490         
5491         (Invocation.OverloadResolve): Use foreach, simplify the code. 
5492
5493 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
5494
5495         * cfold.cs (BinaryFold): During an enumeration evaluation context,
5496         we actually unwrap the expression to allow for extra information
5497         to be extracted. 
5498
5499         * expression.cs: Use Shr_Un on unsigned operations. 
5500
5501 2002-05-08  Ravi Pratap  <ravi@ximian.com>
5502
5503         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
5504         applicable operators was not being considered correctly. This closes
5505         the bug Miguel reported.
5506
5507 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
5508
5509         * attribute.cs: check that the type derives from System.Attribute
5510         and report the correct error in that case (moved the duplicate code to
5511         its own method, too).
5512
5513 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
5514
5515         * attribute.cs: lookup attribute type name as the spec says: first the
5516         bare attribute name and then name + "Attribute" (nant compiles with
5517         mcs after this fix).
5518
5519 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
5520
5521         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
5522         Because of the way we parse things, we should try to see if a
5523         UIntConstant can fit in an integer.
5524
5525 2002-05-07  Ravi Pratap  <ravi@ximian.com>
5526
5527         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
5528         when we are in an explicit context.
5529
5530         (ConvertReferenceExplicit): When converting from Iface type S to Class
5531         T make sure the rules are implemented as an OR.
5532
5533         * parameter.cs (ParameterType): Make it a property for now although the
5534         purpose really isn't anything immediate.
5535         
5536         * expression.cs (Is*Applicable): Do better checking on the parameter type
5537         of a ref/out parameter. The ones from the system assemblies are already 
5538         marked with the correct type so we don't need to do any correction.
5539
5540         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
5541         the object type is standard too so include that.
5542
5543 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5544
5545         * ecore.cs (StandardConversionExists): Augment with missing code:
5546         deal with IntConstant, LongConstants and Enumerations.
5547
5548         * assign.cs: Report the error, instead of failing silently
5549
5550         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
5551         typecontainer that they are declared, because the
5552         typecontainer/namespace will have the list of using clauses that
5553         need to be applied.
5554
5555         Assembly Attributes were escaping the normal registration
5556         mechanism. 
5557
5558         (EmitCode): Apply attributes within an EmitContext that represents
5559         the container they were declared on.
5560         
5561         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
5562
5563 2002-05-06  Ravi Pratap  <ravi@ximian.com>
5564
5565         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
5566         Revamp completely - make much cleaner as we now operate only
5567         on a set of Types.
5568
5569         (FindMostSpecificSource, FindMostSpecificTarget): New methods
5570         to implement the logic detailed in the spec more correctly.
5571
5572         (UserDefinedConversion): Update accordingly.
5573
5574 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5575
5576         * statement.cs: Return flow analysis information up.
5577
5578         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
5579         and the default.
5580
5581         (token): Do not consume an extra character before calling
5582         decimal_digits.
5583
5584 2002-05-06  Piers Haken <piersh@friskit.com>
5585
5586         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
5587
5588 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
5589
5590         * class.cs (Constructor.Emit): Set the IsStatic flag in the
5591         EmitContext during the instance constructor initializer
5592         resolution, to stop access to instance variables.
5593
5594         This is mandated by the spec, last paragraph of the `constructor
5595         initializers' section. 
5596
5597 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
5598
5599         * cs-parser.jay, class.cs (Accessor): new class used to represent
5600         an accessor (get or set).  In the past we used `null' to represent
5601         a missing accessor.  But this is ambiguous because there was no
5602         way to tell in abstract indexers/properties if one of them was
5603         specified.
5604
5605         Now there is a way of addressing that.
5606
5607         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
5608         instead of FindMembers.
5609
5610         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
5611         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
5612
5613         * attribute.cs: Treat indexers and properties as the same in terms
5614         of applying attributes
5615
5616         * ecore.cs (FindMostEncompassedType): Use statically initialized
5617         EmptyExpressions()s like we do elsewhere to avoid creating useless
5618         objects (and we take this out of the tight loop).
5619
5620         (GetConversionOperators): Move the code to extract the actual
5621         operators to a separate routine to clean things up.
5622
5623 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
5624
5625         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
5626         events are always registered FieldBuilders.
5627         
5628         * class.cs (FieldBase): New class shared by Fields 
5629
5630         * delegate.cs: If we are a toplevel delegate, use our full name.
5631         If we are a nested delegate, then only use our tail name.
5632
5633 2002-05-02  Ravi Pratap  <ravi@ximian.com>
5634
5635         * expression.cs (IsApplicable): Ensure that we add the "&" to
5636         ref/out types before comparing it with the type of the argument.
5637
5638         (IsParamsMethodApplicable): Ditto.
5639
5640         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
5641         silly me ;-)
5642
5643         * delegate.cs : Handle the case when we have more than one applicable
5644         method. Flag an error only when we finish checking all.
5645
5646 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
5647
5648         * expression.cs: Add support for boolean static initializers.
5649
5650 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
5651
5652         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
5653
5654         * parameter.cs (ComputeParameterTypes,
5655         ComputeAndDefineParameterTypes): Better error handling: now we
5656         clear the `types' cache if we fail during any of the type lookups.
5657         We also return the status code correctly to our caller
5658
5659         * delegate.cs: If we fail to define a delegate, abort the extra
5660         steps. 
5661
5662         * expression.cs (Binary.ResolveOperator): for
5663         operator==(object,object) and operator !=(object, object) we also
5664         have to verify that there is an implicit conversion from one to
5665         the other.
5666
5667         (ArrayAccess.DoResolve): Array Access can operate on
5668         non-variables. 
5669
5670 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
5671
5672         * assign.cs (CompoundAssign): A new class used as a "flag" that
5673         the assignment actually is happening as part of a compound
5674         assignment operator.
5675
5676         During compound assignment, a few new rules exist to enable things
5677         like:
5678
5679         byte b |= 1 + 2
5680
5681         From the spec:
5682         
5683         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
5684         to the type of x) if y is implicitly convertible to the type of x,
5685         and the operator is a builtin operator and the return type of the
5686         operator is explicitly convertible to the type of x. 
5687
5688         * rootcontext.cs: Reset warning level to 2.  4 catches various
5689         "interesting" features in mcs, we must clean this up at some
5690         point, but currently am trying to kill other bugs ;-)
5691
5692         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
5693         in container classes as well.  
5694
5695         * expression.cs (Binary.ResolveOperator): Handle string case
5696         before anything else (as operator overloading does emit an error
5697         before doing anything else).
5698
5699         This code could go away when we move to a table driven model, but
5700         i could not come up with a good plan last night.
5701         
5702 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
5703
5704         * typemanager.cs (CSharpName): reimplementation using regex.
5705         * class.cs: added null check for fields in Emit
5706         * rootcontext.cs: set warninglevel to 4
5707
5708 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
5709
5710         * typemanager.cs (CSharpName): reimplemented with Lupus
5711         suggestion.
5712
5713 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
5714
5715         * statement.cs (If): correclty implement Resolve, because we were
5716         not catching sem errors in there.  The same process is needed
5717         everywhere else. 
5718         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
5719         
5720
5721         (Statement.Warning_DeadCodeFound): Factorize code.
5722         (While): Report dead code here too.
5723
5724         (Statement): Added Resolve virtual method to allow
5725         for resolution split from the emit code.
5726
5727 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
5728
5729         * statement.cs (EmitBoolExpression): No longer try to resolve the
5730         expression here.    
5731         (MakeBoolean): New utility function that resolve, implicitly
5732         converts to boolean and tags the expression. 
5733         
5734
5735         (If, Do): Implement dead code elimination.
5736         (While): Implement loop inversion
5737
5738         (Do, While, For, If): Resolve the expression prior to calling our
5739         code generation.
5740
5741 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
5742
5743         * class.cs:
5744           - added method Report28 (warning: program has more than one entry point)
5745           - added method IsEntryPoint, implements paragraph 10.1 of the spec
5746           - modified method Method.Define, the part at the end of the method
5747
5748         * rootcontext.cs: added static public Location EntryPointLocation;
5749           
5750         * ../errors/cs0028.cs : Add test case for the above warning.              
5751
5752         * typemanager.cs:
5753           - modified method CSharpName to allow arrays of primitive type to
5754             be printed nicely (e.g. instead of System.Int32[][] it now prints
5755             int[][])
5756           - added method CSharpSignature: returns the signature of a method
5757             in string format to be used in reporting errors, warnings, etc.
5758
5759         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
5760         with String.Empty.
5761         
5762 2002-04-26  Ravi Pratap  <ravi@ximian.com>
5763
5764         * delegate.cs (Define): Fix extremely silly bug where I was
5765         setting the type of the 'object' parameter of the BeginInvoke
5766         method to System.IAsyncResult instead of System.Object ;-)
5767
5768 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
5769
5770         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
5771         here. 
5772
5773         (Constructor.Emit): return if we fail to initialize the
5774         constructor.  Another door closed!  
5775
5776         * expression.cs (New.DoResolve): Improve error message (from -6 to
5777         1501).  Use DeclaredOnly lookup to find the exact constructor.
5778
5779         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
5780         loop.  This is useful.
5781
5782         * cs-parser.jay: Adjust the default parameters so that destructors
5783         have the proper signature.
5784
5785 2002-04-26  Martin Baulig  <martin@gnome.org>
5786
5787         * driver.cs (LoadAssembly): If `assembly' contains any characters
5788         which are only valid in path names and not in assembly names
5789         (currently slash, backslash and point), use Assembly.LoadFrom ()
5790         instead of Assembly.Load () on the `assembly' (before iteration
5791         over the link_paths).
5792
5793 2002-04-26  Martin Baulig  <martin@gnome.org>
5794
5795         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
5796
5797 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
5798
5799         * class.cs (Property): use the new typemanager.MemberLookup
5800
5801         (TypeContainer.MemberLookup): Implement using the
5802         TypeManager.MemberLookup now. 
5803         
5804         * typemanager.cs: Make MemberLookup a function of the TypeManager,
5805         and return MemberInfos, so that these can be used without an
5806         EmitContext (what we had before).
5807
5808 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
5809
5810         * expression.cs: Fix the case where the argument to params if the
5811         type of the params.  I omitted handling this before.   Fixed
5812
5813 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
5814
5815         * driver.cs: Call BootCorlib_PopulateCoreType
5816
5817         * class.cs (Property.CheckBase): Check for properties only, not
5818         for all members. 
5819
5820         * interface.cs: Temporary hack: try/catch around the
5821         CustomAttributeBuilder, because I am getting an exception that I
5822         do not understand.
5823
5824         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
5825         types whose definitions are required to be there (attributes are
5826         defined before standard types).
5827
5828         Compute definitions as we boot the various types, as they are used
5829         immediately (value_type class will need object_type, but if we do
5830         not initialize object_type, we will pass a null, which will let
5831         the runtime pick the System.Object from the existing corlib, which
5832         is not what we want).
5833
5834 2002-04-22  Patrik Torstensson <totte@labs2.com>
5835
5836         * cs-tokenizer.cs: fixed a number of trim() issues.
5837
5838 2002-04-22  Ravi Pratap  <ravi@ximian.com>
5839
5840         * expression.cs (Argument.Type): Ensure that we return the correct
5841         type when we have out or ref parameters [in which case we 
5842         append a "&"].
5843         
5844 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
5845
5846         * class.cs (Property, Indexer): Allow extern modifier in there. 
5847
5848         * typemanager.cs (InitBaseTypes): Initializes object_type and
5849         value_type, since those will be used early on during the bootstrap
5850         process to compile corlib.
5851
5852         (InitCoreTypes): Move code from here to InitBaseTypes.
5853
5854 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
5855
5856         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
5857         single-dimension arrays as using the ldlen opcode.  
5858
5859         Daniel Lewis discovered this optimization.  
5860
5861         * typemanager.cs: Add signature for System.Array::get_Length
5862
5863 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5864
5865         * statement.cs: report the error when the foreach does not apply to an
5866         array nor a collection.
5867
5868 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
5869
5870         * expression.cs: Add implicit conversions to the operator ~.
5871
5872         * constant.cs (DecimalConstant.Emit): Emit decimal value.
5873
5874         * typemanager.cs: Locate the decimal constructor.
5875
5876 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5877
5878         * attribute.cs: use the new property of TypeOf.
5879         * expression.cs: added 'get' property around typearg.
5880
5881         These changes fix a build breaker reported by NickD. Is this the
5882         correct way to fix?  If not, please, revert my changes and make it
5883         work :-).
5884
5885 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
5886
5887         * attribute.cs: Add support for typeof in attribute invocations.
5888         I am not sure that this is right though.
5889
5890 2002-04-14  Duncan Mak  <duncan@ximian.com>
5891
5892         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
5893         Binary.Operator.Division case.
5894
5895 2002-04-13  Ravi Pratap  <ravi@ximian.com>
5896
5897         * class.cs (DefineType): Ensure that we do a proper check on
5898         attribute types and also register it with the TypeManager.
5899
5900         (TypeContainer.Targets): The default for attribute types is
5901         AttributeTargets.All.
5902         
5903         * attribute.cs (ApplyAttributes): Registering the attribute type
5904         is done elsewhere, not when we discover we have a Usage attribute.
5905
5906 2002-04-12  Ravi Pratap  <ravi@ximian.com>
5907
5908         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
5909         and get rid of is_delegate parameter.
5910
5911         * everywhere : update.
5912         
5913 2002-04-12  Ravi Pratap  <ravi@ximian.com>
5914
5915         * cs-parser.jay (compilation_unit): Revamp completely to use
5916         some new ideas that I got from Rhys' grammar to solve the problems
5917         with assembly level attributes.
5918
5919         (outer_declaration): New grammar production.
5920
5921         (attribute_sections): Add.
5922
5923         (opt_attributes): Base on attribute_sections
5924
5925         (namespace_declaration): Allow opt_attributes to tackle the case
5926         when we have assembly level attributes - we are clever in this
5927         regard now ;-)
5928
5929         * attribute.cs (ApplyAttributes): Do not worry about assembly 
5930         attributes in the non-global context.
5931
5932         * rootcontext.cs (AddGlobalAttributes): Go back to using this
5933         instead of SetGlobalAttributes.
5934
5935         * class.cs, rootcontext.cs : Ensure we define and generate 
5936         attribute types before anything else.
5937
5938         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
5939         and flag the new error -20 for the case when the attribute type
5940         does not have valid targets specified. csc does not catch this.
5941
5942         * ../errors/errors.txt : update for error # -20
5943
5944 2002-04-11  Ravi Pratap  <ravi@ximian.com>
5945
5946         * support.cs (InternalParameters.ParameterModifier): Do some null
5947         checking and return sane values.
5948
5949         * class.cs (Method.Define): If we are a PInvoke method, ensure
5950         that we are static and extern. Report error # 601
5951
5952         * ../errors/cs0601.cs : Add test case for the above error.
5953
5954 2002-04-07  Ravi Pratap  <ravi@ximian.com>
5955
5956         * rootcontext.cs (attribute_types): We need to keep type of
5957         all attribute types separately and emit code for them first.
5958
5959         (RegisterAttribute) : Implement.
5960
5961         * class.cs (DefineType): Check if the current Type is a custom
5962         attribute type and register it accordingly.
5963
5964         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
5965         adding the first attribute twice and rename to
5966
5967         (SetGlobalAttributes): this.
5968
5969         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
5970         lookups.
5971
5972         * attribute.cs (ApplyAttributes): Take an additional argument telling us
5973         if we are processing global arguments. Hmm, I am unsure of this.
5974
5975 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5976
5977         * expression.cs: added static array of strings to avoid calling
5978         Enum.ToString () for Operator in Binary. Significant recover of
5979         performance.
5980
5981 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
5982
5983         * class.cs (FindMembers): Allow the Builders of the various
5984         members to be null.  If they are skip them.  This only happens
5985         during the PInvoke declaration.
5986
5987 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
5988
5989         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
5990         failure, so we do not keep going afterwards.
5991
5992         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
5993         wanted to pass `false' as the `is_delegate' argument.  If this is
5994         the case, why not use delegate_type == null to mean `is_delegate =
5995         false' and anything else as is_delegate = true.
5996
5997 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
5998
5999         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6000         code for the section, not the beginning of the tests.
6001
6002 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
6003
6004         * cfold.cs: Handle operator + (Enum x, Underlying x) 
6005
6006         * expression.cs (Binary): same.  Warn about errors where we have
6007         Enum/Enum in operator + as well.
6008
6009 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
6010
6011         * statement.cs:
6012                 - added support for switch(bool)
6013                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6014                 - add TableSwitchEmit() to handle table-based switch statements
6015
6016 2002-04-05  Ravi Pratap  <ravi@ximian.com>
6017
6018         * expression.cs (Invocation.OverloadResolve): Factor out code which
6019         does parameter compatibility checking with arguments so that we can 
6020         re-use the code even from Delegate.VerifyApplicability
6021
6022         (VerifyArgumentsCompat): Move above code here.
6023
6024         * delegate.cs (VerifyApplicability): Get rid of duplicate code
6025         and instead make a call to the above method.
6026
6027 2002-03-31  Ravi Pratap  <ravi@ximian.com>
6028
6029         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6030         We use it to keep track of classes which are attribute types.
6031
6032 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
6033
6034         * delegate.cs (Delegate.Define): Correctly define the types in the
6035         presence of fixed and array parameters.
6036
6037         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6038         doing FindMembers.
6039
6040         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6041         include NonPublic after the first iteration.
6042
6043         * class.cs (Indexer.CheckBase): Only check if both parents are
6044         non-null. 
6045         
6046         * cs-parser.jay (accessor_body): If empty, set to null.
6047
6048         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6049         same code path here to resolve constants names that we did have in
6050         MemberAccess.DoResolve.  There is too much code duplicated here.
6051
6052 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
6053
6054         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6055
6056         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6057         to MakeUnionSet.
6058
6059         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6060         tokens, numbers and strings.
6061
6062         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6063         parenthesis.
6064
6065         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6066         asyncronous parameters and the regular parameters.  
6067
6068         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6069         specify the target directory.
6070
6071         * expression.cs: (This.DoResolve): Simplify
6072         (As.Emit): Optimize, do not generate IsInst if the expression is
6073         always of the given type.
6074
6075         (Is.DoResolve): Bug fix, we were reporting both always/never for
6076         the is expression.
6077
6078         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6079         creating too many unnecessary arrays.
6080
6081 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
6082
6083         * class.cs (EmitFieldInitializer): Use Assign expression to assign
6084         fields instead of rolling our own initializer.   Takes care of all
6085         implicit conversions, and drops unnecessary static checks/argument.
6086
6087 2002-03-31  Dick Porter  <dick@ximian.com>
6088
6089         * driver.cs: use the GetDirectories() return values properly, and
6090         use "/" as path separator.
6091
6092 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
6093
6094         * expression.cs (Unary): Optimize - - expr into expr.
6095         (Binary): Optimize a + (-b) into a -b.
6096
6097         * codegen.cs (CodeGen): Made all methods static.
6098
6099 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
6100
6101         * rootcontext.cs: 
6102
6103         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6104         TypeBuilder property.
6105
6106         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6107         instead. 
6108
6109         * tree.cs: Removed the various RecordXXXX, and replaced with a
6110         single RecordDecl.  Removed all the accessor methods, and just
6111         left a single access point Type 
6112
6113         * enum.cs: Rename DefineEnum to DefineType.
6114
6115         * decl.cs: New abstract method `DefineType' used to unify the
6116         Defines for Enumerations, Interfaces, TypeContainers and
6117         Delegates.
6118
6119         (FindType): Moved LookupInterfaceOrClass here.  Moved the
6120         LookupBaseClasses method that used to live in class.cs and
6121         interface.cs here, and renamed to FindType.
6122         
6123         * delegate.cs: Implement DefineType.  Take advantage of the
6124         refactored pattern for locating the parent builder without taking
6125         the parent_builder argument (which we know does not work if we are
6126         nested, and triggering a toplevel definition).
6127
6128 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6129
6130         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6131         accessibility of a member has changed during override and report
6132         an error if so.
6133
6134         * class.cs (Method.Define, Property.Define): Only complain on
6135         overrides if the method is private, any other accessibility is
6136         fine (and since we just checked the permission is the same, we are
6137         good to go).
6138
6139         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
6140         and elif are processed always.  The other pre-processing
6141         directives are only processed if we are "taking" the path
6142
6143 2002-03-29  Martin Baulig  <martin@gnome.org>
6144
6145         * class.cs (Method.Emit): Only emit symbolic debugging info if the
6146         current location is not Null.
6147
6148         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
6149         a separate method so we can profile it.
6150
6151         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
6152         `span.Seconds' are just seconds, but no minutes or hours.
6153         (MainDriver): Profile the CodeGen.SaveSymbols calls.
6154
6155 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6156
6157         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
6158         Remove the gratuitous set of Final:
6159
6160                                 // If an interface implementation, then we can set Final.
6161                                 if (((flags & MethodAttributes.Abstract) == 0) &&
6162                                     implementing.DeclaringType.IsInterface)
6163                                         flags |= MethodAttributes.Final;
6164
6165         I do not know what I was smoking when I used that.
6166         
6167
6168         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
6169         step into fixing the name resolution issues for delegates and
6170         unifying the toplevel name resolution.
6171
6172 2002-03-28  Martin Baulig  <martin@gnome.org>
6173
6174         * class.cs (Method.Emit): If we have a symbol writer, call its
6175         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
6176         tell it about the current method.
6177
6178         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
6179         writer that we're going to emit the first byte of IL code for a new
6180         statement (a new source line).
6181         (EmitContext.EmitTopBlock): If we have a symbol writer, call
6182         EmitContext.Mark() before emitting any code.
6183
6184         * location.cs (SymbolDocument): Return null when we're Null.
6185
6186         * statement.cs (Statement): Moved the `Location loc' variable here.
6187         (Statement.EmitBoolExpression): If we have a symbol writer, call
6188         ec.Mark() before emitting any code to tell it that we're at the
6189         beginning of a new statement.
6190         (StatementExpression): Added `Location' argument to the constructor.
6191         (Block): Added public readonly variable `StartLocation' and public
6192         variable `EndLocation'.  The latter is to be set using SetEndLocation().
6193         (Block): Added constructor which takes a start and end location.
6194         (Block.SetEndLocation): New method. This sets the end location.
6195         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
6196         local variables we create.
6197         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
6198         each statement and do also mark the begin and end of the block.
6199
6200         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
6201         tell it the current lexer.Location, use Location.Null for the end of the
6202         block.
6203         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
6204         current block, set its end location using SetEndLocation().
6205         (statement_expression): StatementExpression constructor now takes the
6206         lexer.Location as additional argument.
6207         (for_statement, declare_local_variables): Likewise.
6208         (declare_local_variables): When creating a new implicit block, use the
6209         new Block constructor and pass it the lexer.Location.
6210
6211 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6212
6213         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
6214         members also on the parent interfaces recursively.
6215
6216 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
6217
6218         * report.cs: Use new formats, since Gonzalo finished the missing
6219         bits. 
6220
6221         * expression.cs (Binary.ResolveOperator): added missing operator|
6222         operator& and operator^ for bool/bool.
6223
6224         * cs-parser.jay: CheckDef now takes a Location argument that is
6225         used to report errors more precisly (instead of reporting the end
6226         of a definition, we try to track something which is a lot closer
6227         to the source of the problem).
6228
6229         * cs-tokenizer.cs: Track global token use, so we can properly flag
6230         the use of #define/#undef after the first token has been seen.
6231
6232         Also, rename the reportXXXX to Error_DescriptiveName
6233
6234         * decl.cs (DeclSpace.IsTopLevel): Move property here from
6235         TypeContainer, so that Enum and Interface can use this too.
6236
6237         * class.cs (TypeContainer.LookupInterfaceOrClass,
6238         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
6239         `builder' argument.  Typically this was used to pass the parent
6240         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
6241         the definition).  
6242
6243         The problem is that a nested class could trigger the definition of
6244         a toplevel class, and the builder would be obviously wrong in that
6245         case. 
6246
6247         So we drop this argument, and we compute dynamically the
6248         TypeBuilder/ModuleBuilder (the correct information was available
6249         to us anyways from DeclSpace.Parent)
6250
6251         * interface.cs (Interface.DefineInterface): Drop builder
6252         parameter cleanup like class.cs
6253
6254         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
6255         like class.cs
6256
6257         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
6258         values. 
6259
6260         (Try.Emit): Propagate the returns value from the statement.
6261
6262         (Return.Emit): Even if we are leavning 
6263
6264         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
6265
6266         * modifiers.cs: Fix the computation of MethodAttributes flags.
6267
6268 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
6269
6270         * driver.cs: allow compilation of files that start with '/'.
6271         Add a default case when checking the argument of --target.
6272
6273 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
6274
6275         * interface.cs: Implement the same search algorithm for types in
6276         the interface code.
6277
6278         * delegate.cs: Do not allow multiple definition.
6279
6280         * Recovered ChangeLog that got accidentally amputated
6281
6282         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
6283
6284         * rootcontext.cs: Load manually enum to allow core classes to
6285         contain enumerations.
6286
6287         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
6288         Update to new static methods in TypeManager.
6289
6290         * typemanager.cs (GetMethod, GetConstructor): Use our
6291         implementation of FindMembers to find the members, since during
6292         corlib compilation, the types are TypeBuilders and GetMethod and
6293         GetConstructor do not work.
6294
6295         Make all methods in TypeManager static.
6296
6297         (InitCodeHelpers): Split the functionality from
6298         the InitCodeTypes function.
6299
6300         * driver.cs: Call InitCodeHelpers after we have populated the
6301         types. 
6302
6303         * cs-parser.jay (delegate_declaration): we did not used to compute
6304         the delegate name correctly for void delegates.
6305
6306 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
6307
6308         * rootcontext.cs (RootContext): Init the interface_resolve_order
6309         and type_container_resolve_order always.
6310
6311         (ResolveCore, BootstrapCorlib_ResolveClass,
6312         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
6313         compiler when compiling with --nostdlib
6314
6315         * class.cs (TypeContainer.DefineType): Check that our parent is
6316         not null.  This test is most important when we are bootstraping
6317         the core types.
6318
6319         * codegen.cs: Split out the symbol writing code.
6320
6321 2002-03-25  Martin Baulig  <martin@gnome.org>
6322
6323         * driver.cs (-g): Made -g an alias for --debug.
6324
6325 2002-03-24  Martin Baulig  <martin@gnome.org>
6326
6327         * codegen.cs (SymbolWriter): New public variable. Returns the
6328         current symbol writer.
6329         (CodeGen): Added `bool want_debugging_support' argument to the
6330          constructor. If true, tell the ModuleBuild that we want debugging
6331         support and ask it for the ISymbolWriter.
6332         (Save): If we have a symbol writer, call it's Close() method after
6333         saving the assembly.
6334
6335         * driver.c (--debug): New command line argument to create a
6336         debugger information file.
6337
6338         * location.cs (SymbolDocument): New public property. Returns an
6339         ISymbolDocumentWriter object for the current source file or null
6340         if we don't have a symbol writer.
6341
6342 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
6343
6344         * driver.cs (LoadAssembly): Correctly return when all the paths
6345         have been tried and not before.
6346
6347         * statement.cs (Switch.Emit): return the actual coverage for this
6348         statement (returns/not-returns)
6349
6350         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
6351         switch of the statement if we are the last switch section.  That
6352         kills two problems: try/catch problems (we used to emit an empty
6353         nop at the end) and switch statements where all branches would
6354         return. 
6355
6356 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
6357
6358         * driver.cs: Add default assemblies (the equivalent to the
6359         Microsoft CSC.RSP file)
6360
6361         * cs-tokenizer.cs: When updating `cols and setting it to zero,
6362         also update tokens_seen and set it to false.
6363
6364         * driver.cs: Implement --recurse for Mike.
6365
6366         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
6367         correctly splitting out the paths.
6368
6369 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
6370
6371         * interface.cs (Interface.PopulateProperty): Instead of using
6372         `parent' as the declaration space for the set parameters, use
6373         `this' 
6374
6375         * support.cs (InternalParameters): InternalParameters constructor
6376         takes a DeclSpace instead of a TypeContainer.
6377
6378         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
6379         types are being initialized, load the address of it before calling
6380         the function.  
6381
6382         (New): Provide a mechanism to disable the generation of local
6383         value type temporaries when the caller will be providing us with
6384         an address to store it.
6385
6386         (ArrayCreation.EmitDynamicInitializers): Use it.
6387
6388 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
6389
6390         * expression.cs (Invocation.EmitArguments): Only probe for array
6391         property if there is more than one argument.  Sorry about that.
6392
6393         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
6394         empty param arrays.
6395         
6396         * class.cs (Method.LabelParameters): Fix incorrect code path that
6397         prevented the `ParamArrayAttribute' from being applied to the
6398         params attribute.
6399
6400 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
6401
6402         * support.cs (ReflectionParameters): Correctly compute whether the
6403         last argument is a params array.  Fixes the problem with
6404         string.Split ('a')
6405
6406         * typemanager.cs: Make the assemblies array always be non-null
6407         (empty, but non-null)
6408
6409         * tree.cs (RecordDecl): New function that abstracts the recording
6410         of names.  This reports error 101, and provides a pointer to the
6411         previous declaration.  Fixes a crash in the compiler.
6412
6413         * cs-parser.jay (constructor_declaration): Update to new grammar,
6414         and provide a constructor_body that can be empty.
6415
6416 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
6417
6418         * driver.cs: Add support for --resources.
6419
6420         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
6421         Make all types for the various array helper methods be integer.
6422
6423         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
6424         CheckState to ConvCast.
6425
6426         (ConvCast): Now it takes a `checked' state argument, to avoid
6427         depending on the emit context for the conversion, and just using
6428         the resolve time setting.
6429
6430         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
6431         instead of Invocation.EmitArguments.  We do not emit the original
6432         arguments, instead we emit those which have been converted to
6433         unsigned int expressions.
6434
6435         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
6436
6437         * codegen.cs: ditto.
6438
6439         * expression.cs (LocalVariableReference): Drop the use of the
6440         Store function that depended on the variable index.
6441
6442         * statement.cs (VariableInfo): Drop the `Idx' property from this
6443         class, as this is not taking into account the indexes for
6444         temporaries tat we generate during the execution, getting the
6445         indexes wrong.
6446
6447         * class.cs: First emit class initializers, then call the parent
6448         constructor. 
6449
6450         * expression.cs (Binary): Fix opcode emision.
6451         (UnaryMutator.EmitCode): Support checked code generation
6452
6453         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
6454         matches for events for both the Static and Instance scans,
6455         pointing to the same element.   Fix that.
6456
6457 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
6458
6459         * rootcontext.cs (ResolveTree): Always set the
6460         interface_resolve_order, because nested interfaces will be calling
6461         into us.
6462
6463         * class.cs (GetInterfaceOrClass): Track the same resolution
6464         process used by TypeManager.LookupType.  This fixes the nested
6465         type lookups in class declarations (separate path from
6466         LookupType). 
6467
6468         (TypeContainer.DefineType): Also define nested interfaces.
6469         (TypeContainer.RegisterOrder): New public function used to
6470         register the order in which child interfaces need to be closed.
6471
6472         Nested interfaces need to be closed after their parents have been
6473         created. 
6474         
6475         * interface.cs (InterfaceAttr): Put all the logic for computing
6476         the interface attribute here. 
6477
6478         (DefineInterface): Register our interface order with the
6479         RootContext or with the TypeContainer depending on the case.
6480
6481 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
6482
6483         * cs-parser.jay: rework foreach statement to work with the new
6484         changes to the policy on SimpleNames.
6485         
6486         * report.cs: support Stacktrace on warnings as well.
6487
6488         * makefile: drop --unsafe and /unsafe from the compile.
6489
6490 2002-03-13  Ravi Pratap  <ravi@ximian.com>
6491
6492         * ecore.cs (StandardConversionExists): Modify to take an Expression
6493         as the first parameter. Ensure we do null -> reference type conversion
6494         checking.
6495
6496         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
6497         temporary Expression objects.
6498
6499 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
6500
6501         * interface.cs: workaround bug in method overloading resolution
6502         (there is already a bugzilla bug for it).
6503
6504 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
6505
6506         We could also solve this problem by having a separate path for
6507         performing type lookups, instead of DoResolve, we could have a
6508         ResolveType entry point, and only participating pieces of the
6509         production (simplename, deref, array) would implement this. 
6510         
6511         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
6512         signal SimpleName to only resolve type names and not attempt to
6513         resolve anything else.
6514
6515         * expression.cs (Cast): Set the flag.
6516
6517         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
6518
6519         * class.cs: Only report 108 if there is no `new' modifier.
6520
6521         * cs-parser.jay: rework foreach statement to work with the new
6522         changes to the policy on SimpleNames.
6523         
6524         * report.cs: support Stacktrace on warnings as well.
6525
6526         * makefile: drop --unsafe and /unsafe from the compile.
6527
6528 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
6529
6530         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6531         lookups here, instead of doing that at parse time.  This means
6532         that our grammar will not introduce `LocalVariableReferences' as
6533         expressions at this point.  That solves the problem of code like
6534         this:
6535
6536         class X {
6537            static void Main ()
6538            { int X = 1;
6539             { X x = null }}}
6540
6541         This is only half the fix.  The full fix requires parameters to
6542         also be handled in this way.
6543
6544         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
6545         makes the use more obvious of the DeclSpace.  The
6546         ec.TypeContainer.TypeBuilder is now only used to pull the
6547         TypeBuilder for it.
6548
6549         My theory is that I can get rid of the TypeBuilder completely from
6550         the EmitContext, and have typecasts where it is used (from
6551         DeclSpace to where it matters).  
6552
6553         The only pending problem is that the code that implements Aliases
6554         is on TypeContainer, and probably should go in DeclSpace.
6555
6556         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
6557         lookups here, instead of doing that at parse time.  This means
6558         that our grammar will not introduce `LocalVariableReferences' as
6559         expressions at this point.  That solves the problem of code like
6560         this:
6561
6562         class X {
6563            static void Main ()
6564            { int X = 1;
6565             { X x = null }}}
6566
6567         This is only half the fix.  The full fix requires parameters to
6568         also be handled in this way.
6569
6570         * class.cs (Property.DefineMethod): When implementing an interface
6571         method, set newslot, when implementing an abstract method, do not
6572         set the flag (before we tried never setting it, or always setting
6573         it, which is the difference).
6574         (Indexer.DefineMethod): same.
6575         (Method.DefineMethod): same.
6576
6577         * ecore.cs: Only set the status used flag if we get back a Field.
6578
6579         * attribute.cs: Temporary hack, so Paolo can keep working.
6580
6581 2002-03-08  Ravi Pratap  <ravi@ximian.com>
6582
6583         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
6584         the unmanaged type in the case we have a MarshalAs attribute.
6585
6586         (Resolve): Handle the case when we are parsing the special MarshalAs
6587         attribute [we need to store the unmanaged type to use later]
6588         
6589         * typemanager.cs (marshal_as_attr_type): Built in type for the 
6590         MarshalAs Attribute.
6591
6592         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
6593         on parameters and accordingly set the marshalling info.
6594         
6595 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
6596
6597         * class.cs: Optimizing slightly by removing redundant code after
6598         we switched to the `NoTypes' return value.
6599         (Property.DefineMethod): use NoTypes here too.
6600
6601         This fixes the bug I introduced in my last batch of changes.
6602
6603 2002-03-05  Ravi Pratap  <ravi@ximian.com>
6604
6605         * tree.cs (RecordEnum): Add. We now keep track of enums too.
6606
6607         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
6608         Enums since those are types too. 
6609
6610         * cs-parser.jay (enum_declaration): Record enums as we parse them.
6611         
6612         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
6613         thanks to a call during the lookup process.
6614
6615 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
6616
6617         * statement.cs (Foreach): Lots of work to accomodate a particular
6618         kind of foreach statement that I had not kept in mind.  It is
6619         possible to have foreachs on classes that provide a GetEnumerator
6620         method that return objects that implement the "pattern" for using
6621         a foreach, there is no need to support GetEnumerator
6622         specifically. 
6623
6624         This is needed to compile nant.
6625
6626         * decl.cs: Only report 114 if the member is not `Finalize' and if
6627         the warning level is at least 2.
6628
6629         * class.cs: Moved the compare function from Method to
6630         MethodSignature. 
6631
6632         (MethodSignature.InheritableMemberSignatureCompare): Add new
6633         filter function that is used to extract inheritable methods from a
6634         class. 
6635
6636         (Method.Define): Use the new `inheritable_method_signature_filter'
6637         delegate
6638
6639         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
6640         command. 
6641
6642 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
6643
6644         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
6645
6646         * cs-parser.jay: Add opt_semicolon to the interface declaration.
6647
6648         * expression.cs: Pass location information to
6649         ConvertImplicitStandard. 
6650
6651         * class.cs: Added debugging code to track return values from
6652         interfaces. 
6653
6654 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
6655
6656         * expression.cs (Is.DoResolve): If either side of the `is' is an
6657         interface, do not flag the warning.
6658
6659         * ecore.cs (ImplicitReferenceConversion): We need a separate test
6660         for interfaces
6661
6662         * report.cs: Allow for --fatal to be used with --probe.
6663         
6664         * typemanager.cs (NoTypes): Move the definition for the empty Type
6665         array here. 
6666
6667         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
6668         properties. 
6669         (TypeContainer.DefineProxy): New function used to proxy to parent
6670         implementations when implementing interfaces.
6671         (TypeContainer.ParentImplements): used to lookup if our parent
6672         implements a public function that is required by an interface.
6673         (TypeContainer.VerifyPendingMethods): Hook this up.
6674
6675         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
6676         `modules' and `assemblies' arraylists into arrays.  We only grow
6677         these are the very early start up of the program, so this improves
6678         the speedof LookupType (nicely measured).
6679
6680         * expression.cs (MakeByteBlob): Replaced unsafe code with
6681         BitConverter, as suggested by Paolo.
6682
6683         * cfold.cs (ConstantFold.Binary): Special case: perform constant
6684         folding of string concatenation, but if either side is a string,
6685         and the other is not, then return null, and let the runtime use
6686         the concatenation on the string plus the object (using
6687         `Object.ToString'). 
6688
6689 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
6690
6691         Constant Folding has been implemented now.
6692         
6693         * expression.cs (Unary.Reduce): Do not throw an exception, catch
6694         the error instead on types that are not supported in one's
6695         complement. 
6696
6697         * constant.cs (Constant and all children): New set of functions to
6698         perform implict and explicit conversions.
6699         
6700         * ecore.cs (EnumConstant): Implement the new functions to perform
6701         conversion by proxying to the child expression.
6702
6703         * codegen.cs: (ConstantCheckState): Constant evaluation has its
6704         own separate setting that can not be turned off from the command
6705         line using --unchecked or --checked and is only controlled using
6706         the checked/unchecked statements and expressions.  This setting is
6707         used by the constant folder to flag errors.
6708
6709         * expression.cs (CheckedExpr, UncheckedExpr): Set the
6710         ConstantCheckState as well.   
6711
6712         During Resolve, they also have to flag the state, because the
6713         constant folder runs completely in the Resolve phase.
6714
6715         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
6716         well.
6717
6718 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
6719
6720         * cfold.cs: New file, this file contains the constant folder.
6721         
6722         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
6723         argument to track whether we are using the resulting address to
6724         load or store a value and provide better error messages. 
6725
6726         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
6727         new AddressOf arguments.
6728
6729         * statement.cs (Foreach.EmitCollectionForeach): Update
6730
6731         * expression.cs (Argument.Emit): Call AddressOf with proper
6732         arguments to track usage.
6733
6734         (New.DoEmit): Call AddressOf with new arguments.
6735
6736         (Unary.Emit): Adjust AddressOf call.
6737
6738 2002-03-01  Ravi Pratap  <ravi@ximian.com>
6739
6740         * cs-parser.jay (member_access): Change the case for pre-defined types
6741         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
6742         this suggestion.
6743
6744         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
6745         a method body.
6746
6747         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
6748         essentially like methods and apply attributes like MethodImplOptions to them too.
6749
6750         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
6751         not being null.
6752
6753         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
6754         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
6755         is the DeclSpace.
6756
6757         * Update code everywhere accordingly.
6758
6759         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
6760
6761         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
6762
6763 2002-02-28  Ravi Pratap  <ravi@ximian.com>
6764
6765         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
6766         try performing lookups against those instead of jumping straight into using
6767         the 'using' clauses.
6768
6769         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
6770
6771         (LookupType): Perform lookups in implicit parents too.
6772
6773         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
6774         sequence as RootContext.LookupType. 
6775
6776         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
6777         the various cases of namespace lookups into this method.
6778
6779 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
6780
6781         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
6782         in positional arguments)
6783
6784         * class.cs (Operator): Update the AllowedModifiers to contain
6785         extern. 
6786
6787         * cs-parser.jay: Update operator declaration to allow for the
6788         operator body to be empty.
6789
6790         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
6791         values. 
6792
6793 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
6794
6795         * class.cs (Method.Emit): Label parameters.
6796
6797         * driver.cs: Return 1 or 0 as the program exit code.
6798
6799 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
6800
6801         * expression.cs: Special case the `null' object when trying to
6802         auto-compute the type, as anything can be explicitly converted to
6803         that. 
6804
6805         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
6806         spotting this Paolo.
6807
6808         (Expression.ImplicitNumericConversion): Perform comparissions of
6809         the type using the underlying type in the case of an enumeration
6810         rather than using the enumeration type for the compare.
6811
6812         Cope with the underlying == type case, which is not possible to
6813         catch before. 
6814
6815         (Expression.ConvertNumericExplicit): Perform comparissions of
6816         the type using the underlying type in the case of an enumeration
6817         rather than using the enumeration type for the compare.
6818
6819         * driver.cs: If the user does not supply an extension, assume .exe
6820
6821         * cs-parser.jay (if_statement): Rewrote so that we can track the
6822         location for the if statement.
6823
6824         * expression.cs (Binary.ConstantFold): Only concat strings when
6825         the operation is "+", not everything ;-)
6826
6827         * statement.cs (Statement.EmitBoolExpression): Take a location
6828         argument. 
6829         (If, While, Do): Track location.
6830
6831         * expression.cs (Binary.ResolveOperator): In the object + string
6832         case, I was missing a call to ConvertImplicit
6833
6834 2002-02-25  Ravi Pratap  <ravi@ximian.com>
6835
6836         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
6837         Location arguments. Ensure we use RootContext.LookupType to do our work
6838         and not try to do a direct Type.GetType and ModuleBuilder.GetType
6839
6840         * interface.cs (PopulateMethod): Handle the type of the parameter being
6841         null gracefully.
6842
6843         * expression.cs (Invocation.BetterFunction): Handle the case when we 
6844         have a params method with no fixed arguments and a call is made with no
6845         arguments.
6846
6847 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
6848
6849         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
6850         the verbatim-string-literal
6851
6852         * support.cs (InternalParameters.ParameterModifier): handle null
6853         fixed parameters.
6854         (InternalParameters.ParameterType): ditto.
6855
6856         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
6857         duplicating the name of the variable parameter.
6858         (GetParameterByName): Fix bug where we were not looking up array
6859         paramters if they were the only present (thanks Paolo!).
6860         (GetParameterInfo): We only have an empty set of types if both
6861         fixed and array are set to null.
6862         (GetParameterInfo-idx): Handle FixedParameter == null
6863
6864         * cs-parser.jay: Handle the case where there is no catch
6865         statements (missing null test).
6866
6867 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
6868
6869         * driver.cs (MainDriver): Be conservative on our command line
6870         handling.
6871
6872         Catch DirectoryNotFoundException when calling GetFiles.
6873         
6874         (SplitPathAndPattern): Used to split the input specification into
6875         a path and a pattern that we can feed to Directory.GetFiles.
6876
6877 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
6878
6879         * statement.cs (Fixed): Implement the last case of the Fixed
6880         statement (string handling).
6881
6882         * expression.cs (StringPtr): New class used to return a char * to
6883         a string;  Used by the Fixed statement.
6884
6885         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
6886
6887         * expression.cs (Binary.ResolveOperator): Remove redundant
6888         MemberLookup pn parent type.
6889         Optimize union call, we do not need a union if the types are the same.
6890         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
6891         type.
6892
6893         Specialize the use of MemberLookup everywhere, instead of using
6894         the default settings. 
6895
6896         (StackAlloc): Implement stackalloc keyword.
6897
6898         * cs-parser.jay: Add rule to parse stackalloc.
6899         
6900         * driver.cs: Handle /h, /help, /?
6901
6902         * expression.cs (MakeByteBlob): Removed the hacks we had in place
6903         before we supported unsafe code.
6904         
6905         * makefile: add --unsafe to the self compilation of mcs.
6906
6907 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
6908
6909         * expression.cs (PointerArithmetic): New class that is used to
6910         perform pointer arithmetic.
6911         (Binary.Resolve): Handle pointer arithmetic
6912         Handle pointer comparission.
6913         (ArrayPtr): Utility expression class that is used to take the
6914         address of an array.
6915
6916         (ElementAccess): Implement array access for pointers
6917         
6918         * statement.cs (Fixed): Implement fixed statement for arrays, we
6919         are missing one more case before we are done.
6920
6921         * expression.cs (Indirection): Implement EmitAssign and set the
6922         ExprClass to Variable.  This allows pointer dereferences to be
6923         treated as variables, and to have values assigned to them.
6924         
6925         * ecore.cs (Expression.StoreFromPtr): New utility function to
6926         store values dereferencing.
6927
6928 2002-02-20  Ravi Pratap  <ravi@ximian.com>
6929
6930         * expression.cs (Binary.ResolveOperator): Ensure that we are
6931         not trying to operate on a void type - this fixes the reported
6932         bug.
6933
6934         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
6935         the parent implementation is sealed.
6936
6937         * ../errors/cs0239.cs : Add.
6938
6939         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
6940
6941         * typemanager.cs (unverifiable_code_type): Corresponds to 
6942         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
6943         which have unsafe code in them.
6944
6945         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
6946         unsafe context.
6947
6948 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
6949
6950         * cs-tokenizer.cs: Add support for @"litreal strings"
6951
6952         Make tokenizer accept pre-processor directives
6953         on any column (remove the old C-like limitation). 
6954
6955         * rootcontext.cs (EmitCode): Emit any global attributes.
6956         (AddGlobalAttributes): Used to keep track of assembly attributes. 
6957
6958         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
6959
6960         * cs-parser.jay: Add support for global attributes.  
6961
6962 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
6963
6964         * expression.cs (Indirection): New helper class.  Unary will
6965         create Indirection classes to be able to implement the
6966         IMemoryLocation interface on it.
6967
6968 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
6969
6970         * cs-parser.jay (fixed_statement): reference the right statement.
6971
6972         * statement.cs (Fixed.Emit): Finish implementing the fixed
6973         statement for the &x case.
6974
6975 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
6976
6977         * class.cs (Property.Define, Method.Define): Remove newslot when
6978         `implementing'.  
6979
6980         * modifiers.cs: My use of NewSlot when `Abstract' was set was
6981         wrong.  NewSlot should only be used if the `new' keyword is present.
6982
6983         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
6984         locating our system dir.  Sorry about this.
6985
6986 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
6987
6988         * driver.cs (GetSystemDir): Compute correctly the location of our
6989         system assemblies.  I was using the compiler directory instead of
6990         the library directory.
6991
6992 2002-02-13  Ravi Pratap  <ravi@ximian.com>
6993
6994         * expression.cs (BetterFunction): Put back in what Miguel commented out
6995         since it is the correct fix. The problem is elsewhere ;-)
6996
6997         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
6998         parameters of the parms method are themselves compatible or not !
6999
7000         (StandardConversionExists): Fix very dangerous bug where we were forgetting
7001         to check that a class implements an interface before saying that an implicit
7002         conversion was allowed. Use ImplementsInterface to do the checking.
7003
7004 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7005
7006         * class.cs (Method.Define): Track whether we are an explicit
7007         implementation or not.  And only call DefineMethodOverride if we
7008         are an explicit implementation.
7009
7010         (Property.DefineMethod): Ditto.
7011
7012 2002-02-11  Ravi Pratap  <ravi@ximian.com>
7013
7014         * expression.cs (BetterFunction): Catch hideous bug which was
7015          preventing us from detecting ambiguous calls due to implicit casts i.e
7016         cs0121.
7017
7018 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
7019
7020         * support.cs (Pair): Remove un-needed method.  I figured why I was
7021         getting the error in cs-parser.jay, the variable in a foreach loop
7022         is readonly, and the compiler does not really treat this as a variable.
7023
7024         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
7025         instead of EQUALS in grammar.  
7026
7027         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7028
7029         * expression.cs (Unary.DoResolve): Check whether the argument is
7030         managed or not.
7031
7032 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
7033
7034         * support.cs: Api for Pair to set a value.  Despite the fact that
7035         the variables are public the MS C# compiler refuses to compile
7036         code that accesses the field if the variable is part of a foreach
7037         statement. 
7038
7039         * statement.cs (Fixed): Begin implementation of the fixed
7040         statement.
7041
7042         (Block.AddVariable): Return the VariableInfo on success and null
7043         on failure instead of true/false. 
7044
7045         * cs-parser.jay (foreach): Catch errors on variables already
7046         defined (we were ignoring this value before) and properly unwind
7047         the block hierarchy
7048
7049         (fixed_statement): grammar for the fixed statement.
7050
7051 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
7052
7053         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7054         pointer types to be incretemented.
7055
7056         (SizeOf): Implement.
7057
7058         * cs-parser.jay (pointer_member_access): Implement
7059         expr->IDENTIFIER production.
7060
7061         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7062         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7063         on safe contexts.
7064
7065         (Unary): Implement indirection.
7066
7067         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7068         use in non-unsafe context).
7069
7070         (SimpleName.DoResolve): Check for pointers in field access on safe
7071         contexts. 
7072
7073         (Expression.LoadFromPtr): Factor the load-indirect code in this
7074         function.  This was duplicated in UnboxCast and ParameterReference
7075
7076 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
7077
7078         * expression.cs (ComposedCast): report an error if a pointer cast
7079         is used in a safe region.
7080
7081         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7082         pointer type casts in unsafe context.
7083
7084         * codegen.cs (EmitContext): Set up IsUnsafe.
7085
7086         * cs-parser.jay (non_expression_type): Add productions for pointer
7087         casts. 
7088
7089         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7090         code.  We should not use force into static mode if the method is
7091         not virtual.  Fixes bug in MIS
7092
7093         * statement.cs (Do.Emit, While.Emit, For.Emit,
7094         Statement.EmitBoolExpression): Add support to Do and While to
7095         propagate infinite loop as `I do return' semantics.
7096
7097         Improve the For case to also test for boolean constants.
7098
7099         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7100         to the list of attributes we can add.
7101
7102         Remove `EmitContext' argument.
7103
7104         * class.cs (Method.Define): Apply parameter attributes.
7105         (Constructor.Define): Apply parameter attributes.
7106         (MethodCore.LabelParameters): Move here the core of labeling
7107         parameters. 
7108
7109         * support.cs (ReflectionParameters.ParameterModifier,
7110         InternalParameters.ParameterModifier): Use IsByRef on the type and
7111         only return the OUT bit for these parameters instead of in/out/ref
7112         flags.
7113
7114         This is because I miss-understood things.  The ParameterInfo.IsIn
7115         and IsOut represent whether the parameter has the [In] and [Out]
7116         attributes set.  
7117
7118 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
7119
7120         * ecore.cs (FieldExpr.Emit): Release temporaries.
7121
7122         * assign.cs (LocalTemporary.Release): new function.
7123
7124         * codegen.cs (EmitContext.GetTemporaryStorage,
7125         EmitContext.FreeTemporaryStorage): Rework the way we deal with
7126         temporary storage.  Now we can "put back" localbuilders when we
7127         are done with them
7128
7129 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
7130
7131         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7132         need to make a copy of the variable to generate verifiable code.
7133
7134 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
7135
7136         * driver.cs: Compute dynamically the system directory.
7137
7138         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
7139         Slower, but more generally useful.  Used by the abstract
7140         registering implementation. 
7141
7142         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
7143         the rules for the special rule on Type/instances.  First check if
7144         we have the same name, and if so, try that special static path
7145         rather than the instance path.
7146         
7147 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
7148
7149         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
7150         for, while and if.
7151
7152         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
7153         Enum, ValueType, Delegate or Array for non-corlib compiles.
7154
7155         * cs-tokenizer.cs: Catch long identifiers (645)
7156
7157         * typemanager.cs (IndexerPropetyName): Ravi never tested this
7158         piece of code.
7159
7160         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
7161         fix, we were returning too early, so we were not registering
7162         pending methods from abstract classes.
7163
7164         Do not register pending methods if the class is abstract.
7165
7166         * expression.cs (Conditional.DoResolve): Report circular implicit
7167         conversions when we neecd to compute it for conditional
7168         expressions. 
7169
7170         (Is.DoResolve): If the expression is always of the provided type,
7171         flag warning 183.  If the expression can not ever be of the
7172         provided type flag warning 184.
7173
7174         * class.cs: Catch 169 as well.
7175
7176         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
7177         read. 
7178
7179 2002-01-18  Nick Drochak  <ndrochak@gol.com>
7180
7181         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
7182
7183 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
7184
7185         * interface.cs: (PopulateMethod): Check for pointers being defined
7186         only if the unsafe context is active.
7187         (PopulateProperty): ditto.
7188         (PopulateIndexer): ditto.
7189
7190         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
7191         specified.  If pointers are present, make sure that they are
7192         present in an unsafe context.
7193         (Constructor, Constructor.Define): ditto.
7194         (Field, Field.Define): ditto.
7195         (Property, Property.Define): ditto.
7196         (Event, Event.Define): ditto.
7197
7198         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
7199         hashtable if there are classes or structs defined.
7200
7201         * expression.cs (LocalVariableReference.DoResolve): Simplify this
7202         code, as the constant resolution moved.
7203
7204         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
7205         the metadata, so we can flag error 133. 
7206
7207         * decl.cs (MemberCore.UnsafeOK): New function to test that a
7208         pointer is being declared in an unsafe context.
7209
7210 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
7211
7212         * modifiers.cs (Modifiers.Check): Require a Location argument.
7213         Report error 227 for Unsafe use.
7214
7215         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
7216
7217         * statement.cs (For.Emit): If the test is null, then report that
7218         we do `return', as we wont reach anything afterwards.
7219
7220         (Switch.SwitchGoverningType): Track the expression that matched
7221         the conversion.
7222
7223         * driver.cs: Allow negative numbers as an error code to flag.
7224
7225         * cs-parser.jay: Handle 1551.
7226
7227         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
7228
7229 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
7230
7231         * cs-parser.jay: Report 1518 (type declaration can only contain
7232         class, struct, interface, enum or delegate)
7233
7234         (switch_label): Report 1523 (keywords `case' or `default' must
7235         preced code)
7236
7237         (opt_switch_sections): Report 1522 (empty switch)
7238
7239         * driver.cs: Report 1515 (response file specified multiple times)
7240         Report 1516 (Source file specified multiple times).
7241
7242         * expression.cs (Argument.Resolve): Signal 1510
7243
7244         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
7245         access not allowed in static code)
7246
7247 2002-01-11  Ravi Pratap  <ravi@ximian.com>
7248
7249         * typemanager.cs (IsPointerType): Utility method which we are going
7250         to need a lot.
7251
7252         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
7253         the object type, so we take care of that.
7254
7255         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
7256         
7257         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
7258         added to non-params parameters :-)
7259
7260         * typemanager.cs (CSharpName): Include 'void' type too. 
7261
7262         (void_ptr_type): Include in the set of core types.
7263
7264         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
7265         duplicating code.
7266
7267         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
7268         an unsafe context.
7269
7270         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
7271         completely forgotten about it.
7272
7273 2002-01-10  Ravi Pratap  <ravi@ximian.com>
7274
7275         * cs-parser.jay (pointer_type): Add. This begins our implementation
7276         of parsing rules for unsafe code.
7277
7278         (unsafe_statement): Implement.
7279
7280         (embedded_statement): Modify to include the above.
7281
7282         * statement.cs (Unsafe): Implement new class for unsafe blocks.
7283
7284         * codegen.cs (EmitContext.InUnsafe): Add. This determines
7285         if the current context is an unsafe one.
7286
7287         * cs-parser.jay (local_variable_pointer_type): Since local variable types
7288         are handled differently, we need separate rules for them.
7289
7290         (local_variable_declaration): Update to use local_variable_pointer_type
7291         to allow variable declarations of unmanaged pointer types.
7292
7293         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
7294         in unsafe contexts.
7295
7296         * ../errors/cs0214.cs : Add.
7297
7298 2002-01-16  Nick Drochak  <ndrochak@gol.com>
7299
7300         * makefile: remove 'response' file when cleaning.
7301
7302 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
7303
7304         * cs-parser.jay: Report 1524.
7305
7306 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
7307
7308         * typemanager.cs (RegisterMethod): drop checking if we have
7309         registered this from here
7310
7311 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
7312
7313         * class.cs (Method.EmitDestructor): Implement calling our base
7314         destructor. 
7315
7316         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
7317         value of InFinally.
7318
7319         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
7320         this routine and will wrap the call in a try/catch block.  Deal
7321         with the case.
7322
7323 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
7324
7325         * ecore.cs (Expression.MemberLookup): instead of taking a
7326         parameter `same_type' that was used to tell whether we could
7327         access private members we compute our containing type from the
7328         EmitContext.
7329
7330         (FieldExpr): Added partial support for volatile fields.  This does
7331         not work for volatile fields exposed from assemblies, as I can not
7332         figure out how to extract the modreq from it.
7333
7334         Updated all the source files to use this.
7335
7336         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
7337         because it is referenced by MemberLookup very often. 
7338
7339 2002-01-09  Ravi Pratap  <ravi@ximian.com>
7340
7341         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
7342         TypeBuilder.GetCustomAttributes to retrieve what we need.
7343
7344         Get rid of redundant default_member_attr_type as this is the same as
7345         default_member_type which already exists.
7346
7347         * interface.cs, attribute.cs : Update accordingly.
7348         
7349 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
7350
7351         * typemanager.cs: Enable IndexerPropertyName again.  It does not
7352         work for TYpeBuilders though.  Ravi, can you please fix this?
7353
7354         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
7355
7356         * expression.cs (Argument.Emit): Handle the case of ref objects
7357         being passed to ref functions;  
7358
7359         (ParameterReference.EmitLoad): Loads the content of the pointer
7360         without dereferencing.
7361
7362 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
7363
7364         * cs-tokenizer.cs: Implemented the pre-processing expressions.
7365
7366 2002-01-08  Ravi Pratap  <ravi@ximian.com>
7367
7368         * class.cs (Indexer.DefineMethod): Incorporate the interface
7369         type in the name of the method if we are doing explicit interface
7370         implementation.
7371
7372         * expression.cs (ConversionExists): Remove as it is completely obsolete.
7373
7374         (BetterConversion): Fix extremely trivial bug where we were referring to
7375         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
7376         again !
7377
7378         * ../errors/bug16.cs : Add although we have fixed it.
7379
7380 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
7381
7382         * expression.cs (BaseIndexer): Begin implementation.
7383
7384         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
7385
7386         * cs-parser.jay (indexer_declarator): Use qualified_identifier
7387         production directly to remove a shift/reduce, and implement
7388         explicit interface implementation.
7389
7390         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
7391         after a floating point suffix.
7392
7393         * expression.cs (DoNumericPromotions): Improved the conversion for
7394         uint/uint.  If we have a constant, we avoid doing a typecast to a
7395         larger type.
7396
7397         * class.cs (Indexer): Implement explicit interface implementation
7398         for indexers.
7399         
7400 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
7401
7402         * class.cs: make the default instance constructor public and hidebysig.
7403
7404 2001-01-03  Ravi Pratap  <ravi@ximian.com>
7405
7406         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
7407         so we can call it from elsewhere.
7408
7409         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
7410         we emit it internally if the class has a defined indexer; otherwise the user
7411         emits it by decorating the class definition with the DefaultMemberAttribute.
7412
7413         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
7414         attribute is not used on a type which defines an indexer.
7415
7416         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
7417         character when we skip whitespace.
7418
7419         * ../errors/cs0646.cs : Add.
7420
7421 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
7422
7423         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
7424         again. 
7425
7426         * makefile: Add practical target `mcs3.exe' which builds the third
7427         generation compiler. 
7428
7429         * expression.cs (New): Fix structures constructor calling.
7430
7431         * class.cs (Property, Method, Indexer): Emit Final flag on the
7432         method if we are an interface implementation and we are not
7433         abstract. 
7434
7435         * ecore.cs (PropertyExpr): New public field `IsBase', tells
7436         whether this property is referencing a `base' method.
7437
7438         * expression.cs (Invocation.EmitCall): take an extra argument:
7439         is_base, this is used to determine whether the `call' or
7440         `callvirt' opcode should be used.
7441
7442         
7443         * delegate.cs: update EmitCall.
7444
7445         * class.cs (Method.Define): Set NewSlot for the cases where we are
7446         not implementing an interface method.
7447
7448         (Property.Define): ditto.
7449
7450 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
7451
7452         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
7453         'r'.  Allows mcs to parse itself fully.
7454
7455 2002-01-02  Ravi Pratap  <ravi@ximian.com>
7456
7457         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
7458         of the number of initializers that require the InitializeArray method.
7459
7460         (CheckIndices): Store the Expression in all cases - not the plain value. Also
7461         update the above field where necessary.
7462
7463         (MakeByteBlob): Update accordingly.
7464
7465         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
7466         greater than 2.
7467
7468         (EmitDynamicInitializers): Update in accordance with the new optimization.
7469
7470         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
7471         same OpCode applies.
7472
7473         * cs-parser.jay : Fix some glaring errors I introduced.
7474
7475 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
7476
7477         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
7478         so that we can check for name clashes there too.
7479
7480         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
7481         for interface indexers.
7482
7483         * interfaces.cs (Define): Emit the default member attribute.
7484
7485         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
7486         variable was being referred to while setting the value ;-)
7487
7488 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
7489
7490         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
7491         byte-by-byte information when we know the data is zero.
7492
7493         Make the block always a multiple of 4, because
7494         DefineInitializedData has a bug.
7495
7496         * assign.cs: Fix, we should assign from the temporary, not from
7497         the source. 
7498
7499         * expression.cs (MakeByteBlob): Fix my incorrect code.
7500
7501 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
7502
7503         * typemanager.cs (EnumToUnderlying): This function is used to get
7504         the underlying type from an enumeration, because it does not
7505         always work. 
7506
7507         * constant.cs: Use the I4_S form for values between -128 and 127.
7508
7509         * statement.cs (Block.LookupLabel): Looks up a label.
7510         (Block): Drop support for labeled blocks.
7511
7512         (LabeledStatement): New kind of statement that represents a label
7513         only.
7514
7515         (Goto): Finally implement this bad boy.
7516         
7517         * cs-parser.jay: Update to reflect new mechanism to implement
7518         labels.
7519
7520 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
7521
7522         * codegen.cs (EmitContext.This): a codegen property that keeps the
7523         a single instance of this instead of creating many different this
7524         instances. 
7525
7526         * delegate.cs (Delegate.DoResolve): Update to use the property;
7527
7528         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
7529
7530         * expression.cs (BaseAccess.DoResolve): Ditto.
7531
7532 2001-12-29  Ravi Pratap  <ravi@ximian.com>
7533
7534         * typemanager.cs (methodimpl_attr_type): Add to hold the type
7535         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
7536
7537         (InitCoreTypes): Update accordingly.
7538
7539         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
7540         so we can quickly store the state.
7541
7542         (ApplyAttributes): Set the correct implementation flags
7543         for InternalCall methods.
7544
7545 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
7546
7547         * expression.cs (EmitCall): if a method is not virtual, then do
7548         not use callvirt on it.
7549
7550         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
7551         user defined stuff) requires the use of stobj, which takes an
7552         address on the stack instead of an array and an index.  So emit
7553         the Ldelema operation for it.
7554
7555         (EmitStoreOpcode): Use stobj for valuetypes.
7556
7557         (UnaryMutator.EmitCode): Use the right 1 value depending on
7558         whether we are dealing with int64/uint64, float or doubles.
7559
7560         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
7561         constructors that I implemented last night.
7562
7563         (Constructor.IsDefault): Fix to work properly for static
7564         constructors.
7565
7566         * cs-parser.jay (CheckDef): report method signature errors.
7567         Update error number 103 to be 132.
7568
7569         * decl.cs: New AdditionResult enumeration value: MethodExists.
7570         Although we do this check for methods later on in the semantic
7571         analysis, catching repeated default constructors is so easy that
7572         we catch these here. 
7573         
7574         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
7575         promotions code.
7576
7577         (ParameterReference.EmitAssign, Emit): handle
7578         bools as bytes.
7579
7580         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
7581         (ArrayAccess.EmitStoreOpcode): ditto.
7582
7583         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
7584
7585         * expression.cs (MakeByteBlob): Complete all the missing types
7586         (uint, short, ushort, byte, sbyte)
7587
7588         * class.cs: Only init instance field initializers on instance
7589         constructors. 
7590
7591         Rename `constructors' to instance_constructors. 
7592
7593         (TypeContainer.AddConstructor): Only add constructors to the list
7594         if it is not static.
7595
7596         Make sure that we handle default_static_constructor independently
7597         everywhere where we handle instance_constructors
7598
7599 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
7600
7601         * class.cs: Do not lookup or create a base initializer for a
7602         static constructor.
7603
7604         (ConstructorInitializer.Resolve): use the proper type to lookup
7605         for constructors.
7606
7607         * cs-parser.jay: Report error 1585 (modifiers between type and name).
7608
7609         * enum.cs, interface.cs: Remove CloseType, this is taken care by
7610         in DeclSpace. 
7611
7612         * decl.cs: CloseType is now an virtual method, the default
7613         implementation just closes this type.
7614         
7615 2001-12-28  Ravi Pratap  <ravi@ximian.com>
7616
7617         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
7618         to PreserveSig by default. Also emit HideBySig on such methods.
7619
7620         Basically, set the defaults to standard values.
7621
7622         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
7623         argument, if candidate is better, it can't be worse than the best !
7624
7625         (Invocation): Re-write bits to differentiate between methods being
7626         applicable in their expanded form and their normal form - for params
7627         methods of course.
7628
7629         Get rid of use_standard everywhere as only standard conversions are allowed
7630         in overload resolution. 
7631
7632         More spec conformance.
7633         
7634 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
7635
7636         * driver.cs: Add --timestamp, to see where the compiler spends
7637         most of its time.
7638
7639         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
7640         `this' in static code.
7641
7642         (SimpleName.DoResolve): Implement in terms of a helper function
7643         that allows static-references to be passed upstream to
7644         MemberAccess.
7645
7646         (Expression.ResolveWithSimpleName): Resolve specially simple
7647         names when called by MemberAccess to implement the special
7648         semantics. 
7649
7650         (Expression.ImplicitReferenceConversion): Handle conversions from
7651         Null to reference types before others, as Null's type is
7652         System.Object. 
7653
7654         * expression.cs (Invocation.EmitCall): Handle the special case of
7655         calling methods declared on a reference type from a ValueType
7656         (Base classes System.Object and System.Enum)
7657
7658         (MemberAccess.Resolve): Only perform lookups on Enumerations if
7659         the left hand side is a TypeExpr, not on every enumeration. 
7660
7661         (Binary.Resolve): If types are reference types, then do a cast to
7662         object on operators != and == of both arguments.
7663         
7664         * typemanager.cs (FindMembers): Extract instance and static
7665         members if requested.
7666
7667         * interface.cs (PopulateProperty): Use void_type instead of null
7668         as the return type for the setter method.
7669
7670         (PopulateIndexer): ditto.
7671
7672 2001-12-27  Ravi Pratap  <ravi@ximian.com>
7673
7674         * support.cs (ReflectionParameters): Fix minor bug where we
7675         were examining the wrong parameter for the ParamArray attribute.
7676
7677         Cope with requests for the type of the parameter at position
7678         greater than the params parameter's. We now return the element
7679         type of the params array as that makes more sense.
7680
7681         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
7682         accordingly as we no longer have to extract the element type
7683         ourselves.
7684
7685         (Invocation.OverloadResolve): Update.
7686
7687 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
7688
7689         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
7690         against IEnumerator, test whether the return value is a descendant
7691         of the IEnumerator interface.
7692
7693         * class.cs (Indexer.Define): Use an auxiliary method to implement
7694         the other bits of the method definition.  Begin support for
7695         explicit interface implementation.
7696
7697         (Property.DefineMethod): Use TypeManager.void_type instead of null
7698         for an empty return value.
7699
7700 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
7701
7702         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
7703         dealing with a FieldExpr which is composed of a FieldBuilder, in
7704         the code path we did extract the constant, but we should have
7705         obtained the underlying value to be able to cast it (otherwise we
7706         end up in an infinite loop, this is what Ravi was running into).
7707
7708         (ArrayCreation.UpdateIndices): Arrays might be empty.
7709
7710         (MemberAccess.ResolveMemberAccess): Add support for section
7711         14.5.4.1 that deals with the special case of E.I when E is a type
7712         and something else, that I can be a reference to a static member.
7713
7714         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
7715         handle a particular array type to create byte blobs, it is just
7716         something we dont generate byteblobs for.
7717
7718         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
7719         arguments. 
7720
7721         * location.cs (Push): remove the key from the hashtable that we
7722         are about to add.   This happens for empty files.
7723
7724         * driver.cs: Dispose files after we have parsed them.
7725
7726         (tokenize): new function that only runs the tokenizer on its
7727         input, for speed testing.
7728
7729 2001-12-26  Ravi Pratap  <ravi@ximian.com>
7730
7731         * class.cs (Event.Define): Define the private field only if there
7732         are no accessors defined.
7733
7734         * expression.cs (ResolveMemberAccess): If there is no associated
7735         field with the event, that means we have an event defined with its
7736         own accessors and we should flag error cs0070 since transforming
7737         ourselves into a field is not valid in that case.
7738
7739         * ecore.cs (SimpleName.DoResolve): Same as above.
7740
7741         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
7742         and charset to sane values.
7743
7744 2001-12-25  Ravi Pratap  <ravi@ximian.com>
7745
7746         * assign.cs (DoResolve): Perform check on events only if they 
7747         are being accessed outside the declaring type.
7748
7749         * cs-parser.jay (event_declarations): Update rules to correctly
7750         set the type of the implicit parameter etc.
7751
7752         (add_accessor, remove_accessor): Set current local parameters.
7753
7754         * expression.cs (Binary): For delegate addition and subtraction,
7755         cast the return value from the method into the appropriate delegate
7756         type.
7757
7758 2001-12-24  Ravi Pratap  <ravi@ximian.com>
7759
7760         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
7761         of these as the workaround is unnecessary.
7762
7763         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
7764         delegate data - none of that is needed at all.
7765
7766         Re-write bits to extract the instance expression and the delegate method
7767         correctly.
7768
7769         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
7770         on delegates too.
7771
7772         * attribute.cs (ApplyAttributes): New method to take care of common tasks
7773         of attaching attributes instead of duplicating code everywhere.
7774
7775         * everywhere : Update code to do attribute emission using the above method.
7776
7777 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
7778
7779         * expression.cs (IsParamsMethodApplicable): if there are not
7780         parameters, return immediately.
7781
7782         * ecore.cs: The 0 literal can be implicity converted to an enum
7783         type. 
7784
7785         (SimpleName.DoResolve): First lookup the type, then lookup the
7786         members. 
7787
7788         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
7789         want to get its address.  If the InstanceExpression is not
7790         addressable, store the result in a temporary variable, then get
7791         the address of it.
7792
7793         * codegen.cs: Only display 219 errors on warning level or above. 
7794
7795         * expression.cs (ArrayAccess): Make it implement the
7796         IMemoryLocation interface.
7797
7798         (Binary.DoResolve): handle the operator == (object a, object b)
7799         and operator != (object a, object b) without incurring into a
7800         BoxedCast (because 5 != o should never be performed).
7801
7802         Handle binary enumerator operators.
7803
7804         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
7805         value type, otherwise use Ldelem_ref.
7806
7807         Use precomputed names;
7808
7809         (AddressOf): Implement address of
7810
7811         * cs-parser.jay (labeled_statement): Fix recursive block
7812         addition by reworking the production.
7813
7814         * expression.cs (New.DoEmit): New has a special case:
7815                 
7816                  If we are dealing with a ValueType, we have a few
7817                  situations to deal with:
7818                 
7819                     * The target of New is a ValueType variable, that is
7820                       easy, we just pass this as the variable reference
7821                 
7822                     * The target of New is being passed as an argument,
7823                       to a boxing operation or a function that takes a
7824                       ValueType.
7825                 
7826                       In this case, we need to create a temporary variable
7827                       that is the argument of New.
7828
7829
7830 2001-12-23  Ravi Pratap  <ravi@ximian.com>
7831
7832         * rootcontext.cs (LookupType): Check that current_type is not null before
7833         going about looking at nested types.
7834
7835         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
7836         not implement the IAssignMethod interface any more.
7837
7838         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
7839         where we tranform them into FieldExprs if they are being resolved from within
7840         the declaring type.
7841
7842         * ecore.cs (SimpleName.DoResolve): Do the same here.
7843
7844         * assign.cs (DoResolve, Emit): Clean up code considerably. 
7845
7846         * ../errors/bug10.cs : Add.
7847
7848         * ../errors/cs0070.cs : Add.
7849
7850         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
7851
7852         * assign.cs : Get rid of EventIsLocal everywhere.
7853         
7854 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
7855
7856         * ecore.cs (ConvertIntLiteral): finished the implementation.
7857
7858         * statement.cs (SwitchLabel): Convert the value we are using as a
7859         key before looking up the table.
7860
7861 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
7862
7863         * codegen.cs (EmitTopBlock): Require a Location argument now.
7864
7865         * cs-parser.jay (constructor_declarator): We need to setup
7866         current_local_parameters before we parse the
7867         opt_constructor_initializer, to allow the variables to be bound
7868         to the constructor arguments.
7869
7870         * rootcontext.cs (LookupType): First lookup nested classes in our
7871         class and our parents before we go looking outside our class.
7872
7873         * expression.cs (ConstantFold): Extract/debox the values at the
7874         beginnning. 
7875
7876         * rootcontext.cs (EmitCode): Resolve the constants first before we
7877         resolve the types.  This is not really needed, but it helps debugging.
7878
7879         * statement.cs: report location.
7880         
7881         * cs-parser.jay: pass location to throw statement.
7882
7883         * driver.cs: Small bug fix.
7884
7885         * report.cs: Updated format to be 4-zero filled digits.
7886
7887 2001-12-22  Ravi Pratap  <ravi@ximian.com>
7888
7889         * expression.cs (CheckIndices): Fix minor bug where the wrong
7890         variable was being referred to ;-)
7891
7892         (DoEmit): Do not call EmitStaticInitializers when the 
7893         underlying type is System.Object.
7894
7895 2001-12-21  Ravi Pratap  <ravi@ximian.com>
7896
7897         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
7898         and do the usual workaround for SRE.
7899
7900         * class.cs (MyEventBuilder.EventType): New member to get at the type
7901         of the event, quickly.
7902
7903         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
7904
7905         * assign.cs (Assign.DoResolve): Handle the case when the target
7906         is an EventExpr and perform the necessary checks.
7907
7908         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
7909         interface.
7910
7911         (SimpleName.MemberStaticCheck): Include check for EventExpr.
7912
7913         (EventExpr): Set the type in the constructor itself since we 
7914         are meant to be born fully resolved.
7915
7916         (EventExpr.Define): Revert code I wrote earlier.
7917                 
7918         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
7919         instance expression is null. The instance expression is a This in that case
7920         or a null, depending on whether it is a static method or not.
7921
7922         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
7923         refers to more than one method.
7924
7925         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
7926         and accordingly flag errors.
7927
7928 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
7929
7930         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
7931
7932 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
7933
7934         * location.cs (ToString): Provide useful rutine.
7935
7936 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
7937
7938         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
7939         objects, return the actual integral boxed.
7940
7941         * statement.cs (SwitchLabel): define an ILLabel for each
7942         SwitchLabel. 
7943         
7944         (Switch.CheckSwitch): If the value is a Literal, extract
7945         the underlying literal.
7946         
7947         Also in the unused hashtable we had, add the SwitchLabel so we can
7948         quickly look this value up.
7949
7950         * constant.cs: Implement a bunch of new constants.  Rewrite
7951         Literal based on this.  Made changes everywhere to adapt to this.
7952         
7953         * expression.cs (Expression.MakeByteBlob): Optimize routine by
7954         dereferencing array only once, and also copes with enumrations.
7955
7956         bytes are two bytes wide, not one.
7957
7958         (Cast): Perform constant conversions.
7959         
7960         * ecore.cs (TryImplicitIntConversion): Return literals instead of
7961         wrappers to the literals here.
7962
7963         * expression.cs (DoNumericPromotions): long literals can converted
7964         to ulong implicity (this is taken care of elsewhere, but I was
7965         missing this spot).
7966
7967         * ecore.cs (Expression.Literalize): Make the return type Literal,
7968         to improve type checking.
7969
7970         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
7971
7972 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
7973
7974         * literal.cs: Revert code from ravi that checked the bounds.  The
7975         bounds are sane by the definition of the type itself. 
7976
7977         * typemanager.cs: Fix implementation of ImplementsInterface.  We
7978         need to actually look up in our parent hierarchy for interfaces
7979         implemented. 
7980
7981         * const.cs: Use the underlying type for enumerations
7982
7983         * delegate.cs: Compute the basename for the delegate creation,
7984         that should fix the delegate test case, and restore the correct
7985         Type Lookup semantics in rootcontext
7986
7987         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
7988         referencing a nested type with the Reflection API is using the "+"
7989         sign. 
7990
7991         * cs-parser.jay: Do not require EOF token at the end.
7992
7993 2001-12-20  Ravi Pratap  <ravi@ximian.com>
7994
7995         * rootcontext.cs (LookupType): Concatenate type names with
7996         a '.' instead of a '+' The test suite passes again.
7997
7998         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
7999         field of the enumeration.
8000
8001         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8002         the case when the member is an EventExpr.
8003
8004         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8005         static has an associated instance expression.
8006
8007         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8008
8009         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8010
8011         * class.cs (Event.Define): Register event and perform appropriate checks
8012         for error #111.
8013
8014         We define the Add and Remove methods even if the use provides none because
8015         in that case, we provide default implementations ourselves.
8016
8017         Define a private field of the type of the event. This is done by the CSC compiler
8018         and we should be doing it too ;-)
8019
8020         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8021         More methods we use in code we generate.
8022
8023         (multicast_delegate_type, delegate_type): Two separate types since the distinction
8024         is important.
8025
8026         (InitCoreTypes): Update accordingly for the above.
8027
8028         * class.cs (Event.Emit): Generate code for default accessors that we provide
8029
8030         (EmitDefaultMethod): Do the job in the above.
8031
8032         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
8033         appropriate place.
8034
8035 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8036
8037         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8038         builders even if we were missing one.
8039
8040         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8041         pass the Basename as our class name instead of the Name.  The
8042         basename will be correctly composed for us.
8043
8044         * parameter.cs (Paramters): Now takes a Location argument.
8045
8046         * decl.cs (DeclSpace.LookupType): Removed convenience function and
8047         make all the code call directly LookupType in RootContext and take
8048         this chance to pass the Location information everywhere.
8049
8050         * Everywhere: pass Location information.
8051
8052 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
8053
8054         * class.cs (Constructor.Define): Updated way of detecting the
8055         length of the parameters.
8056
8057         (TypeContainer.DefineType): Use basename as the type name for
8058         nested types.
8059
8060         (TypeContainer.Define): Do not recursively define types here, as
8061         definition is taken care in order by the RootContext.
8062
8063         * tree.cs: Keep track of namespaces in a per-file basis.
8064
8065         * parameter.cs (Parameter.ComputeSignature): Update to use
8066         DeclSpace. 
8067
8068         (Parameters.GetSignature): ditto.
8069
8070         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8071         instead of a TypeContainer.
8072
8073         (Interface.SemanticAnalysis): Use `this' instead of our parent to
8074         resolve names.  Because we need to be resolve in our context, not
8075         our parents.
8076         
8077         * driver.cs: Implement response files.
8078
8079         * class.cs (TypeContainer.DefineType): If we are defined, do not
8080         redefine ourselves.
8081         
8082         (Event.Emit): Emit the code for add/remove handlers.
8083         (Event.Define): Save the MethodBuilders for add/remove.
8084
8085         * typemanager.cs: Use pair here too.
8086
8087         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8088         DictionaryEntry requires the first argument to be non-null.  
8089         
8090         (enum_declaration): Compute full name for registering the
8091         enumeration.
8092         
8093         (delegate_declaration): Instead of using
8094         formal_parameter_list, use opt_formal_parameter_list as the list
8095         can be empty.
8096
8097         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8098         (EventParsing): New property that controls whether `add' and
8099         `remove' are returned as tokens or identifiers (for events);
8100
8101 2001-12-19  Ravi Pratap  <ravi@ximian.com>
8102
8103         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8104         use MyEventBuilder only and let it wrap the real builder for us.
8105
8106         (MyEventBuilder): Revamp constructor etc.
8107
8108         Implement all operations that we perform on EventBuilder in precisely the same
8109         way here too.
8110
8111         (FindMembers): Update to use the EventBuilder member.
8112
8113         (Event.Emit): Update accordingly.
8114
8115 2001-12-18  Ravi Pratap  <ravi@ximian.com>
8116
8117         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8118         by calling the appropriate methods.
8119
8120         (GetCustomAttributes): Make stubs as they cannot possibly do anything
8121         useful.
8122
8123         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8124
8125 2001-12-17  Ravi Pratap  <ravi@ximian.com>
8126
8127         * delegate.cs (Delegate.Populate): Check that the return type
8128         and various parameters types are indeed accessible.
8129
8130         * class.cs (Constructor.Define): Same here.
8131
8132         (Field.Define): Ditto.
8133
8134         (Event.Define): Ditto.
8135
8136         (Operator.Define): Check that the underlying Method defined itself
8137         correctly - so it's MethodBuilder should not be null.
8138
8139         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
8140         expression happens to be null.
8141
8142         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
8143         members but as of now we don't seem to be able to do anything really useful with it.
8144
8145         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
8146         not the EventBuilder.
8147
8148 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
8149
8150         * cs-tokenizer.cs: Add support for defines.
8151         Add support for #if, #elif, #else, #endif
8152         
8153         (eval_var): evaluates a variable.
8154         (eval): stubbed for evaluating functions.
8155
8156         * cs-parser.jay: Pass the defines information
8157
8158         * driver.cs: Add --define command line option.
8159
8160         * decl.cs: Move MemberCore here.
8161
8162         Make it the base class for DeclSpace.  This allows us to catch and
8163         report 108 and 109 for everything now.
8164
8165         * class.cs (TypeContainer.Define): Extract all the members
8166         before populating and emit the warning 108 (new keyword required
8167         to override) instead of having each member implement this.
8168
8169         (MemberCore.Define): New abstract method, we will be using this in
8170         the warning reporting engine in Populate.
8171         
8172         (Operator.Define): Adjust to new MemberCore protocol. 
8173
8174         * const.cs (Const): This does not derive from Expression, it is a
8175         temporary object we use to create fields, it is a MemberCore. 
8176
8177         * class.cs (Method.Define): Allow the entry point to be in a
8178         specific class.
8179
8180         * driver.cs: Rewrite the argument handler to clean it up a bit.
8181
8182         * rootcontext.cs: Made it just an auxiliary namespace feature by
8183         making everything static.
8184
8185         * driver.cs: Adapt code to use RootContext type name instead of
8186         instance variable.
8187
8188         * delegate.cs: Remove RootContext argument.
8189
8190         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
8191         argument. 
8192
8193         * class.cs (Event.Define): The lookup can fail.
8194         
8195         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
8196
8197         * expression.cs: Resolve the this instance before invoking the code.
8198
8199 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
8200
8201         * cs-parser.jay: Add a production in element_access that allows
8202         the thing to become a "type" reference.  This way we can parse
8203         things like "(string [])" as a type.
8204
8205         Note that this still does not handle the more complex rules of
8206         casts. 
8207         
8208
8209         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
8210
8211         * ecore.cs: (CopyNewMethods): new utility function used to
8212         assemble the list of methods from running FindMembers.
8213
8214         (MemberLookup): Rework FindMembers so that 
8215
8216 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
8217
8218         * class.cs (TypeContainer): Remove Delegates who fail to be
8219         defined.
8220
8221         * delegate.cs (Populate): Verify that we dont get null return
8222         values.   TODO: Check for AsAccessible.
8223
8224         * cs-parser.jay: Use basename to emit error 574 (destructor should
8225         have the same name as container class), not the full name.
8226
8227         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
8228         possible representation.  
8229
8230         Also implements integer type suffixes U and L.
8231
8232 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
8233
8234         * expression.cs (ArrayCreation.DoResolve): We need to do the
8235         argument resolution *always*.
8236
8237         * decl.cs: Make this hold the namespace.  Hold the root context as
8238         well.
8239         (LookupType): Move here.
8240
8241         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
8242
8243         * location.cs (Row, Name): Fixed the code, it was always returning
8244         references to the first file.
8245
8246         * interface.cs: Register properties defined through interfaces.
8247
8248         * driver.cs: Add support for globbing on the command line
8249
8250         * class.cs (Field): Make it derive from MemberCore as well.
8251         (Event): ditto.
8252
8253 2001-12-15  Ravi Pratap  <ravi@ximian.com>
8254
8255         * class.cs (Event::Define): Check that the type of the event is a delegate
8256         type else flag error #66.
8257
8258         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
8259         same.
8260
8261         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
8262         values of EntryPoint, CharSet etc etc.
8263
8264         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
8265
8266         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
8267         be null and we should ignore this. I am not sure if this is really clean. Apparently,
8268         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
8269         which needs this to do its work.
8270
8271         * ../errors/cs0066.cs : Add.
8272
8273 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
8274
8275         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
8276         helper functions.
8277
8278         * class.cs: (MethodSignature.MethodSignature): Removed hack that
8279         clears out the parameters field.
8280         (MemberSignatureCompare): Cleanup
8281
8282         (MemberCore): New base class used to share code between MethodCore
8283         and Property.
8284
8285         (RegisterRequiredImplementations) BindingFlags.Public requires
8286         either BindingFlags.Instace or Static.  Use instance here.
8287
8288         (Property): Refactored code to cope better with the full spec.
8289
8290         * parameter.cs (GetParameterInfo): Return an empty array instead
8291         of null on error.
8292
8293         * class.cs (Property): Abstract or extern properties have no bodies.
8294
8295         * parameter.cs (GetParameterInfo): return a zero-sized array.
8296
8297         * class.cs (TypeContainer.MethodModifiersValid): Move all the
8298         method modifier validation to the typecontainer so we can reuse
8299         this on properties.
8300
8301         (MethodCore.ParameterTypes): return an empty sized array of types.
8302
8303         (Property.Define): Test property modifier validity.
8304
8305         Add tests for sealed/override too.
8306
8307         (Method.Emit): abstract or extern methods have no bodies.
8308
8309 2001-12-14  Ravi Pratap  <ravi@ximian.com>
8310
8311         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
8312         thing.
8313
8314         (Method::Define, ::Emit): Modify accordingly.
8315
8316         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
8317
8318         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
8319
8320         * makefile: Pass in /unsafe.
8321
8322 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
8323
8324         * class.cs (MakeKey): Kill routine.
8325         
8326         * class.cs (TypeContainer.Define): Correctly define explicit
8327         method implementations (they require the full interface name plus
8328         the method name).
8329
8330         * typemanager.cs: Deply the PtrHashtable here and stop using the
8331         lame keys.  Things work so much better.
8332
8333         This of course broke everyone who depended on `RegisterMethod' to
8334         do the `test for existance' test.  This has to be done elsewhere.
8335
8336         * support.cs (PtrHashtable): A hashtable that avoid comparing with
8337         the object stupid Equals method (because, that like fails all over
8338         the place).  We still do not use it.
8339
8340         * class.cs (TypeContainer.SetRequiredInterface,
8341         TypeContainer.RequireMethods): Killed these two routines and moved
8342         all the functionality to RegisterRequiredImplementations.
8343
8344         (TypeContainer.RegisterRequiredImplementations): This routine now
8345         registers all the implementations required in an array for the
8346         interfaces and abstract methods.  We use an array of structures
8347         which can be computed ahead of time to reduce memory usage and we
8348         also assume that lookups are cheap as most classes will not
8349         implement too many interfaces.
8350
8351         We also avoid creating too many MethodSignatures.
8352
8353         (TypeContainer.IsInterfaceMethod): Update and optionally does not
8354         clear the "pending" bit if we find that there are problems with
8355         the declaration.
8356
8357         (TypeContainer.VerifyPendingMethods): Update to report errors of
8358         methods that look like implementations but are not.
8359
8360         (TypeContainer.Define): Add support for explicit interface method
8361         implementation. 
8362         
8363 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
8364
8365         * typemanager.cs: Keep track of the parameters here instead of
8366         being a feature of the TypeContainer.
8367
8368         * class.cs: Drop the registration of parameters here, as
8369         InterfaceMethods are also interface declarations.
8370
8371         * delegate.cs: Register methods with the TypeManager not only with
8372         the TypeContainer.  This code was buggy.
8373
8374         * interface.cs: Full registation here.
8375
8376 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
8377
8378         * expression.cs: Remove reducer for binary expressions, it can not
8379         be done this way.
8380
8381         * const.cs: Put here the code that used to go into constant.cs
8382
8383         * constant.cs: Put here the code for constants, this is a new base
8384         class for Literals.
8385
8386         * literal.cs: Make Literal derive from Constant.
8387
8388 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
8389
8390         * statement.cs (Return.Emit): Report error 157 if the user
8391         attempts to return from a finally block.
8392
8393         (Return.Emit): Instead of emitting a return, jump to the end of
8394         the function.
8395
8396         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
8397         LocalBuilder to store the result of the function.  ReturnLabel is
8398         the target where we jump.
8399         
8400
8401 2001-12-09  Radek Doulik  <rodo@ximian.com>
8402
8403         * cs-parser.jay: remember alias in current namespace
8404
8405         * ecore.cs (SimpleName::DoResolve): use aliases for types or
8406         namespaces
8407
8408         * class.cs (LookupAlias): lookup alias in my_namespace
8409
8410         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
8411         aliases hashtable
8412         (LookupAlias): lookup alias in this and if needed in parent
8413         namespaces
8414
8415 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
8416
8417         * support.cs: 
8418
8419         * rootcontext.cs: (ModuleBuilder) Made static, first step into
8420         making things static.  I need this to avoid passing the
8421         TypeContainer when calling ParameterType.
8422
8423         * support.cs (InternalParameters.ParameterType): Remove ugly hack
8424         that did string manipulation to compute the type and then call
8425         GetType.  Use Parameter.ParameterType instead.
8426
8427         * cs-tokenizer.cs: Consume the suffix for floating values.
8428
8429         * expression.cs (ParameterReference): figure out whether this is a
8430         reference parameter or not.  Kill an extra variable by computing
8431         the arg_idx during emission.
8432
8433         * parameter.cs (Parameters.GetParameterInfo): New overloaded
8434         function that returns whether a parameter is an out/ref value or not.
8435
8436         (Parameter.ParameterType): The type of the parameter (base,
8437         without ref/out applied).
8438         
8439         (Parameter.Resolve): Perform resolution here.
8440         (Parameter.ExternalType): The full type (with ref/out applied).
8441
8442         * statement.cs (Using.Emit, Using.EmitExpression): Implement
8443         support for expressions on the using statement.
8444
8445 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
8446
8447         * statement.cs (Using.EmitLocalVariableDecls): Split the
8448         localvariable handling of the using statement.
8449
8450         (Block.EmitMeta): Keep track of variable count across blocks.  We
8451         were reusing slots on separate branches of blocks.
8452
8453         (Try.Emit): Emit the general code block, we were not emitting it. 
8454
8455         Check the type of the declaration to be an IDisposable or
8456         something that can be implicity converted to it. 
8457
8458         Emit conversions if required.
8459
8460         * ecore.cs (EmptyExpression): New utility class.
8461         (Expression.ImplicitConversionExists): New utility function.
8462
8463 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
8464
8465         * statement.cs (Using): Implement.
8466
8467         * expression.cs (LocalVariableReference): Support read only variables.
8468
8469         * statement.cs: Remove the explicit emit for the Leave opcode.
8470         (VariableInfo): Add a readonly field.
8471
8472 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
8473
8474         * ecore.cs (ConvCast): new class used to encapsulate the various
8475         explicit integer conversions that works in both checked and
8476         unchecked contexts.
8477
8478         (Expression.ConvertNumericExplicit): Use new ConvCast class to
8479         properly generate the overflow opcodes.
8480
8481 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
8482
8483         * statement.cs: The correct type for the EmptyExpression is the
8484         element_type, not the variable type.  Ravi pointed this out.
8485
8486 2001-12-04  Ravi Pratap  <ravi@ximian.com>
8487
8488         * class.cs (Method::Define): Handle PInvoke methods specially
8489         by using DefinePInvokeMethod instead of the usual one.
8490
8491         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
8492         above to do the task of extracting information and defining the method.
8493         
8494 2001-12-04  Ravi Pratap  <ravi@ximian.com>
8495
8496         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
8497         of the condition for string type.
8498
8499         (Emit): Move that here. 
8500
8501         (ArrayCreation::CheckIndices): Keep string literals in their expression
8502         form.
8503
8504         (EmitDynamicInitializers): Handle strings appropriately.
8505
8506 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
8507
8508         * codegen.cs (EmitContext): Replace multiple variables with a
8509         single pointer to the current Switch statement.
8510
8511         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
8512         EmitContext.
8513
8514 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
8515
8516         * statement.cs 
8517
8518         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
8519         default'.
8520         
8521         (Foreach.Emit): Foreach on arrays was not setting
8522         up the loop variables (for break/continue).
8523
8524         (GotoCase): Semi-implented.
8525         
8526 2001-12-03  Ravi Pratap  <ravi@ximian.com>
8527
8528         * attribute.cs (CheckAttribute): Handle system attributes by using
8529         Attribute.GetAttributes to examine information we need.
8530
8531         (GetValidPlaces): Same here.
8532
8533         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
8534
8535         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
8536
8537         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
8538
8539         (Method::Define): Set appropriate flags if we have a DllImport attribute.
8540
8541         (Method::Emit): Handle the case when we are a PInvoke method.
8542
8543 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
8544
8545         * expression.cs: Use ResolveWithSimpleName on compound names.
8546
8547 2001-12-02  Ravi Pratap  <ravi@ximian.com>
8548
8549         * constant.cs (EmitConstant): Make sure we resolve the associated expression
8550         before trying to reduce it.
8551
8552         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
8553
8554         * constant.cs (LookupConstantValue): Implement.
8555
8556         (EmitConstant): Use the above in emitting the constant.
8557
8558         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
8559         that are user-defined by doing a LookupConstantValue on them.
8560
8561         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
8562         too, like above.
8563
8564 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
8565
8566         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
8567
8568         (BaseAccess.DoResolve): Implement.
8569
8570         (MemberAccess.DoResolve): Split this routine into a
8571         ResolveMemberAccess routine that can be used independently
8572
8573 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
8574
8575         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
8576         As that share bits of the implementation.  Is returns a boolean,
8577         while As returns the Type that is being probed.
8578
8579 2001-12-01  Ravi Pratap  <ravi@ximian.com>
8580
8581         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
8582         instead of a Literal - much easier.
8583
8584         (EnumInTransit): Remove - utterly useless :-)
8585
8586         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
8587
8588         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
8589
8590         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
8591         chain when we have no associated expression.
8592
8593 2001-11-30  Ravi Pratap  <ravi@ximian.com>
8594
8595         * constant.cs (Define): Use Location while reporting the errror.
8596
8597         Also emit a warning when 'new' is used and there is no inherited
8598         member to hide.
8599
8600         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
8601         populated.
8602
8603         (LookupEnumValue): Implement to lookup an enum member's value and define it
8604         if necessary.
8605
8606         (Populate): Re-write accordingly to use the above routine.
8607
8608 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
8609
8610         * expression.cs (This): Fix prototype for DoResolveLValue to
8611         override the base class DoResolveLValue.
8612
8613         * cs-parser.cs: Report errors cs574 and cs575 (destructor
8614         declarations) 
8615
8616         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
8617         (we need to load the address of the field here).  This fixes
8618         test-22. 
8619         
8620         (FieldExpr.DoResolveLValue): Call the DoResolve
8621         function to initialize the Instance expression.
8622         
8623         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
8624         correctly the GetEnumerator operation on a value type.
8625
8626         * cs-parser.jay: Add more simple parsing error catches.
8627
8628         * statement.cs (Switch): Add support for string switches.
8629         Handle null specially.
8630
8631         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
8632
8633 2001-11-28  Ravi Pratap  <ravi@ximian.com>
8634
8635         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
8636
8637         (declare_local_constant): New helper function.
8638
8639         * statement.cs (AddConstant): Keep a separate record of constants
8640
8641         (IsConstant): Implement to determine if a variable is a constant.
8642
8643         (GetConstantExpression): Implement.
8644
8645         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
8646
8647         * statement.cs (IsVariableDefined): Re-write.
8648
8649 2001-11-27  Ravi Pratap  <ravi@ximian.com>
8650
8651         * class.cs (TypeContainer::FindMembers): Look for constants
8652         in the case when we are looking for MemberTypes.Field
8653
8654         * expression.cs (MemberAccess::DoResolve): Check that in the
8655         case we are a FieldExpr and a Literal, we are not being accessed
8656         by an instance reference.
8657
8658         * cs-parser.jay (local_constant_declaration): Implement.
8659
8660         (declaration_statement): Implement for constant declarations.
8661
8662 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
8663
8664         * statement.cs (Switch): Catch double defaults.
8665
8666         (Switch): More work on the switch() statement
8667         implementation.  It works for integral values now, need to finish
8668         string support.
8669
8670
8671 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
8672
8673         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
8674         integer literals into other integer literals.  To be used by
8675         switch. 
8676
8677 2001-11-24  Ravi Pratap  <ravi@ximian.com>
8678
8679         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
8680         some memory.
8681
8682         (EmitDynamicInitializers): Cope with the above since we extract data
8683         directly from ArrayData now.
8684
8685         (ExpectInitializers): Keep track of whether initializers are mandatory
8686         or not.
8687
8688         (Bounds): Make it a hashtable to prevent the same dimension being 
8689         recorded for every element in that dimension.
8690
8691         (EmitDynamicInitializers): Fix bug which prevented the Set array method
8692         from being found.
8693
8694         Also fix bug which was causing the indices to be emitted in the reverse
8695         order.
8696
8697 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
8698
8699         * expression.cs (ArrayCreation): Implement the bits that Ravi left
8700         unfinished.  They do not work, because the underlying code is
8701         sloppy.
8702
8703 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8704
8705         * cs-parser.jay: Remove bogus fixme.
8706
8707         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
8708         on Switch statement.
8709         
8710 2001-11-23  Ravi Pratap  <ravi@ximian.com>
8711
8712         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
8713         the same. 
8714         
8715         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
8716         parameter. Apparently, any expression is allowed. 
8717
8718         (ValidateInitializers): Update accordingly.
8719
8720         (CheckIndices): Fix some tricky bugs thanks to recursion.
8721
8722         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
8723         I was being completely brain-dead.
8724
8725         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
8726         and re-write acordingly.
8727
8728         (DelegateInvocation): Re-write accordingly.
8729
8730         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
8731
8732         (MakeByteBlob): Handle types more correctly.
8733
8734         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
8735         initialization from expressions but it is incomplete because I am a complete
8736         Dodo :-|
8737
8738 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8739
8740         * statement.cs (If.Emit): Fix a bug that generated incorrect code
8741         on If.  Basically, we have to return `true' (ie, we do return to
8742         our caller) only if both branches of the if return.
8743
8744         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
8745         short-circuit operators, handle them as short circuit operators. 
8746
8747         (Cast.DoResolve): Resolve type.
8748         (Cast.Cast): Take an expression as the target type.
8749
8750         * cs-parser.jay (cast_expression): Remove old hack that only
8751         allowed a limited set of types to be handled.  Now we take a
8752         unary_expression and we resolve to a type during semantic
8753         analysis.
8754
8755         Use the grammar productions from Rhys to handle casts (this is
8756         not complete like Rhys syntax yet, we fail to handle that corner
8757         case that C# has regarding (-x), but we will get there.
8758         
8759 2001-11-22  Ravi Pratap  <ravi@ximian.com>
8760
8761         * class.cs (EmitFieldInitializer): Take care of the case when we have a
8762         field which is an array type.
8763
8764         * cs-parser.jay (declare_local_variables): Support array initialization too.
8765
8766         * typemanager.cs (MakeKey): Implement.
8767
8768         (everywhere): Use the above appropriately.
8769
8770         * cs-parser.jay (for_statement): Update for array initialization while
8771         declaring variables.
8772
8773         * ecore.cs : The error message was correct, it's the variable's names that
8774         were misleading ;-) Make the code more readable.
8775
8776         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
8777         the correct type etc.
8778
8779         (ConvertExplicit): Handle Enum types by examining the underlying type.
8780
8781 2001-11-21  Ravi Pratap  <ravi@ximian.com>
8782
8783         * parameter.cs (GetCallingConvention): Always return
8784         CallingConventions.Standard for now.
8785
8786 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
8787
8788         * expression.cs (Binary.ResolveOperator): Update the values of `l'
8789         and `r' after calling DoNumericPromotions.
8790
8791         * ecore.cs: Fix error message (the types were in the wrong order).
8792
8793         * statement.cs (Foreach.ProbeCollectionType): Need to pass
8794         BindingFlags.Instance as well 
8795
8796         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
8797         implicit int literal conversion in an empty cast so that we
8798         propagate the right type upstream.
8799
8800         (UnboxCast): new class used to unbox value types.
8801         (Expression.ConvertExplicit): Add explicit type conversions done
8802         by unboxing.
8803
8804         (Expression.ImplicitNumericConversion): Oops, forgot to test for
8805         the target type before applying the implicit LongLiterals to ULong
8806         literal cast.
8807
8808 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
8809
8810         * cs-parser.jay (for_statement): Reworked the way For works: now
8811         we declare manually any variables that are introduced in
8812         for_initializer to solve the problem of having out-of-band code
8813         emition (that is what got for broken).
8814
8815         (declaration_statement): Perform the actual variable declaration
8816         that used to be done in local_variable_declaration here.
8817
8818         (local_variable_declaration): Do not declare anything, just pass
8819         the information on a DictionaryEntry
8820
8821 2001-11-20  Ravi Pratap  <ravi@ximian.com>
8822
8823         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
8824         re-write of the logic to now make it recursive.
8825
8826         (UpdateIndices): Re-write accordingly.
8827
8828         Store element data in a separate ArrayData list in the above methods.
8829
8830         (MakeByteBlob): Implement to dump the array data into a byte array.
8831
8832 2001-11-19  Ravi Pratap  <ravi@ximian.com>
8833
8834         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
8835         into CheckIndices.
8836
8837         * constant.cs (Define): Implement.
8838
8839         (EmitConstant): Re-write fully.
8840
8841         Pass in location info.
8842
8843         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
8844         respectively.
8845
8846         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
8847         DictionaryEntry since we need location info too.
8848
8849         (constant_declaration): Update accordingly.
8850
8851         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
8852         code into another method : UpdateIndices.
8853
8854 2001-11-18  Ravi Pratap  <ravi@ximian.com>
8855
8856         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
8857         some type checking etc.
8858
8859 2001-11-17  Ravi Pratap  <ravi@ximian.com>
8860
8861         * expression.cs (ArrayCreation::ValidateInitializers): Implement
8862         bits to provide dimension info if the user skips doing that.
8863
8864         Update second constructor to store the rank correctly.
8865
8866 2001-11-16  Ravi Pratap  <ravi@ximian.com>
8867
8868         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
8869         and try to implement.
8870
8871         * ../errors/cs0150.cs : Add.
8872
8873         * ../errors/cs0178.cs : Add.
8874
8875 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
8876
8877         * statement.cs: Implement foreach on multi-dimensional arrays. 
8878
8879         * parameter.cs (Parameters.GetParameterByName): Also lookup the
8880         name of the params argument.
8881
8882         * expression.cs: Use EmitStoreOpcode to get the right opcode while
8883         initializing the array.
8884
8885         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
8886         we can use this elsewhere.
8887
8888         * statement.cs: Finish implementation of foreach for single
8889         dimension arrays.
8890
8891         * cs-parser.jay: Use an out-of-band stack to pass information
8892         around, I wonder why I need this.
8893
8894         foreach_block: Make the new foreach_block the current_block.
8895
8896         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
8897         function used to return a static Parameters structure.  Used for
8898         empty parameters, as those are created very frequently.
8899
8900         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
8901
8902 2001-11-15  Ravi Pratap  <ravi@ximian.com>
8903
8904         * interface.cs : Default modifier is private, not public. The
8905         make verify test passes again.
8906
8907 2001-11-15  Ravi Pratap  <ravi@ximian.com>
8908
8909         * support.cs (ReflectionParameters): Fix logic to determine
8910         whether the last parameter is a params one. Test 9 passes again.
8911
8912         * delegate.cs (Populate): Register the builders we define with
8913         RegisterParameterForBuilder. Test 19 passes again.
8914
8915         * cs-parser.jay (property_declaration): Reference $6 instead
8916         of $$ to get at the location.
8917
8918         (indexer_declaration): Similar stuff.
8919
8920         (attribute): Ditto.
8921
8922         * class.cs (Property): Register parameters for the Get and Set methods
8923         if they exist. Test 23 passes again.
8924
8925         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
8926         call to EmitArguments as we are sure there aren't any params arguments. 
8927         Test 32 passes again.
8928
8929         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
8930         IndexOutOfRangeException. 
8931
8932         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
8933         Test 33 now passes again.
8934         
8935 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
8936
8937         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
8938         broke a bunch of things.  Will have to come up with a better way
8939         of tracking locations.
8940
8941         * statement.cs: Implemented foreach for single dimension arrays.
8942
8943 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
8944
8945         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
8946         an error.  This removes the lookup from the critical path.
8947
8948         * cs-parser.jay: Removed use of temporary_loc, which is completely
8949         broken. 
8950
8951 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
8952
8953         * support.cs (ReflectionParameters.ParameterModifier): Report
8954         whether the argument is a PARAMS argument or not.
8955
8956         * class.cs: Set the attribute `ParamArrayAttribute' on the
8957         parameter argument.
8958
8959         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
8960         and cons_param_array_attribute (ConstructorInfo for
8961         ParamArrayAttribute)., 
8962
8963         * codegen.cs: Emit the return using the `Return' statement, that
8964         way we can report the error correctly for missing return values. 
8965
8966         * class.cs (Method.Emit): Clean up.
8967
8968         * expression.cs (Argument.Resolve): Take another argument: the
8969         location where this argument is used.  Notice that this is not
8970         part of the "Argument" class as to reduce the size of the
8971         structure (we know the approximate location anyways).
8972
8973         Test if the argument is a variable-reference, if not, then
8974         complain with a 206.
8975
8976         (Argument.Emit): Emit addresses of variables.
8977
8978         (Argument.FullDesc): Simplify.
8979
8980         (Invocation.DoResolve): Update for Argument.Resolve.
8981
8982         (ElementAccess.DoResolve): ditto.
8983
8984         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
8985         method should be virtual, as this method is always virtual.
8986
8987         (NewDelegate.DoResolve): Update for Argument.Resolve.
8988
8989         * class.cs (ConstructorInitializer.DoResolve): ditto.
8990         
8991         * attribute.cs (Attribute.Resolve): ditto.
8992
8993 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
8994
8995         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
8996
8997         * expression.cs (ParameterReference): Drop IStackStorage and implement
8998         IAssignMethod instead. 
8999
9000         (LocalVariableReference): ditto.
9001         
9002         * ecore.cs (FieldExpr): Drop IStackStorage and implement
9003         IAssignMethod instead. 
9004
9005 2001-11-13  Miguel de Icaza <miguel@ximian.com>
9006
9007         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9008         enumerations that are used in heavily used structures derive from
9009         byte in a laughable and pathetic attempt to reduce memory usage.
9010         This is the kind of pre-optimzations that you should not do at
9011         home without adult supervision.
9012
9013         * expression.cs (UnaryMutator): New class, used to handle ++ and
9014         -- separatedly from the other unary operators.  Cleans up the
9015         code, and kills the ExpressionStatement dependency in Unary.
9016
9017         (Unary): Removed `method' and `Arguments' from this class, making
9018         it smaller, and moving it all to SimpleCall, so I can reuse this
9019         code in other locations and avoid creating a lot of transient data
9020         strucutres when not required.
9021
9022         * cs-parser.jay: Adjust for new changes.
9023
9024 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
9025
9026         * enum.cs (Enum.Populate): If there is a failure during
9027         definition, return
9028
9029         * cs-parser.jay (opt_enum_base): we used to catch type errors
9030         here, but this is really incorrect.  The type error should be
9031         catched during semantic analysis.
9032
9033 2001-12-11  Ravi Pratap  <ravi@ximian.com>
9034
9035         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9036         current_local_parameters as expected since I, in my stupidity, had forgotten
9037         to do this :-)
9038
9039         * attribute.cs (GetValidPlaces): Fix stupid bug.
9040
9041         * class.cs (Method::Emit): Perform check on applicability of attributes.
9042
9043         (Constructor::Emit): Ditto.
9044
9045         (Field::Emit): Ditto.
9046
9047         (Field.Location): Store location information.
9048
9049         (Property, Event, Indexer, Operator): Ditto.
9050
9051         * cs-parser.jay (field_declaration): Pass in location for each field.
9052
9053         * ../errors/cs0592.cs : Add.
9054
9055 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9056
9057         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9058
9059         (InitCoreTypes): Update accordingly.
9060
9061         (RegisterAttrType, LookupAttr): Implement.
9062
9063         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9064         info about the same.
9065
9066         (Resolve): Update to populate the above as necessary.
9067
9068         (Error592): Helper.
9069
9070         (GetValidPlaces): Helper to the above.
9071
9072         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9073
9074         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9075
9076 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9077
9078         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9079
9080         * ../errors/cs0617.cs : Add.
9081
9082 2001-11-11  Ravi Pratap  <ravi@ximian.com>
9083
9084         * enum.cs (Emit): Rename to Populate to be more consistent with what
9085         we expect it to do and when exactly it is called.
9086
9087         * class.cs, rootcontext.cs : Update accordingly.
9088
9089         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9090         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9091
9092         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9093
9094         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9095         of a fieldinfo using the above, when dealing with a FieldBuilder.
9096
9097 2001-11-10  Ravi Pratap  <ravi@ximian.com>
9098
9099         * ../errors/cs0031.cs : Add.
9100
9101         * ../errors/cs1008.cs : Add.
9102
9103         * ../errrors/cs0543.cs : Add.
9104
9105         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9106         enum type.
9107
9108         (FindMembers): Implement.
9109
9110         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9111         enums and delegates too.
9112
9113         (enum_types): Rename to builder_to_enum.
9114
9115         (delegate_types): Rename to builder_to_delegate.
9116
9117         * delegate.cs (FindMembers): Implement.
9118
9119 2001-11-09  Ravi Pratap  <ravi@ximian.com>
9120
9121         * typemanager.cs (IsEnumType): Implement.
9122
9123         * enum.cs (Emit): Re-write parts to account for the underlying type
9124         better and perform checking etc.
9125
9126         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9127         of the underlying type.
9128
9129         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9130         value
9131
9132         * enum.cs (error31): Helper to report error #31.
9133
9134         * cs-parser.jay (enum_declaration): Store location of each member too.
9135
9136         * enum.cs (member_to_location): New hashtable. 
9137
9138         (AddEnumMember): Update location hashtable.
9139
9140         (Emit): Use the location of each member while reporting errors.
9141
9142 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9143
9144         * cs-parser.jay: A for_initializer if is a
9145         local_variable_declaration really ammount to have an implicit
9146         block with the variable declaration and no initializer for for.
9147
9148         * statement.cs (For.Emit): Cope with null initializers.
9149
9150         This fixes the infinite loop on for initializers.
9151
9152 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
9153
9154         * enum.cs: More cleanup.
9155
9156         * ecore.cs: Remove dead code.
9157
9158         * class.cs (Property.Emit): More simplification.
9159         (Event.Emit): ditto.
9160
9161         Reworked to have less levels of indentation.
9162         
9163 2001-11-08  Ravi Pratap  <ravi@ximian.com>
9164
9165         * class.cs (Property): Emit attributes.
9166
9167         (Field): Ditto.
9168         
9169         (Event): Ditto.
9170
9171         (Indexer): Ditto.
9172
9173         (Operator): Ditto.
9174
9175         * enum.cs (Emit): Ditto.
9176
9177         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
9178         Enums too.
9179
9180         * class.cs (Field, Event, etc.): Move attribute generation into the
9181         Emit method everywhere.
9182
9183         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
9184         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
9185         as we had no way of defining nested enums !
9186
9187         * rootcontext.cs : Adjust code accordingly.
9188
9189         * typemanager.cs (AddEnumType): To keep track of enum types separately.
9190
9191 2001-11-07  Ravi Pratap  <ravi@ximian.com>
9192
9193         * expression.cs (EvalConstantExpression): Move into ecore.cs
9194         
9195         * enum.cs (Enum): Rename some members and make them public and readonly
9196         according to our convention.
9197
9198         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
9199         nothing else.
9200
9201         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
9202
9203         (Enum::Emit): Write a simple version for now which doesn't try to compute
9204         expressions. I shall modify this to be more robust in just a while.
9205
9206         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
9207
9208         (TypeContainer::CloseType): Create the Enum types too.
9209
9210         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
9211
9212         * expression.cs (EvalConstantExpression): Get rid of completely.
9213
9214         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
9215         user-defined values and other cases.
9216
9217         (IsValidEnumLiteral): Helper function.
9218
9219         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
9220         out there in the case we had a literal FieldExpr.
9221
9222         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
9223
9224         (Literalize): Revamp a bit to take two arguments.
9225         
9226         (EnumLiteral): New class which derives from Literal to wrap enum literals.
9227         
9228 2001-11-06  Ravi Pratap  <ravi@ximian.com>
9229
9230         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
9231
9232         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
9233
9234         (Resolve): Use the above to ensure we have proper initializers.
9235
9236 2001-11-05  Ravi Pratap  <ravi@ximian.com>
9237
9238         * expression.cs (Expression::EvalConstantExpression): New method to 
9239         evaluate constant expressions.
9240
9241         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
9242
9243 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
9244
9245         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
9246         in an array.
9247
9248         (Binary.ResolveOperator): Handle operator != (object a, object b)
9249         and operator == (object a, object b);
9250
9251         (Binary.DoNumericPromotions): Indicate whether the numeric
9252         promotion was possible.
9253
9254         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
9255         Implement.  
9256
9257         Made the ArrayAccess implement interface IAssignMethod instead of
9258         IStackStore as the order in which arguments are passed reflects
9259         this.
9260
9261         * assign.cs: Instead of using expr.ExprClass to select the way of
9262         assinging, probe for the IStackStore/IAssignMethod interfaces.
9263
9264         * typemanager.cs: Load InitializeArray definition.
9265
9266         * rootcontext.cs (RootContext.MakeStaticData): Used to define
9267         static data that can be used to initialize arrays. 
9268
9269 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
9270
9271         * expression.cs: Handle operator== and operator!= for booleans.
9272
9273         (Conditioal.Reduce): Implement reducer for the ?: operator.
9274
9275         (Conditional.Resolve): Implement dead code elimination.
9276
9277         (Binary.Resolve): Catch string literals and return a new
9278         concatenated string.
9279
9280         (Unary.Reduce): Implement reduction of unary expressions.
9281
9282         * ecore.cs: Split out the expression core handling here.
9283
9284         (Expression.Reduce): New method used to perform constant folding
9285         and CSE.  This is needed to support constant-expressions. 
9286         
9287         * statement.cs (Statement.EmitBoolExpression): Pass true and false
9288         targets, and optimize for !x.
9289
9290 2001-11-04  Ravi Pratap  <ravi@ximian.com>
9291
9292         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
9293         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
9294         set custom atttributes.
9295
9296         * literal.cs (Literal::GetValue): New abstract method to return the actual
9297         value of the literal, cast as an object.
9298
9299         (*Literal): Implement GetValue method.
9300
9301         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
9302         expressions to the arraylist but objects of type Argument.
9303
9304         * class.cs (TypeContainer::Emit): Emit our attributes too.
9305
9306         (Method::Emit, Constructor::Emit): Ditto.
9307
9308         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
9309         to be ignoring earlier.
9310
9311 2001-11-03  Ravi Pratap  <ravi@ximian.com>
9312
9313         * attribute.cs (AttributeSection::Define): Implement to do the business
9314         of constructing a CustomAttributeBuilder.
9315
9316         (Attribute): New trivial class. Increases readability of code.  
9317
9318         * cs-parser.jay : Update accordingly.
9319
9320         (positional_argument_list, named_argument_list, named_argument): New rules
9321
9322         (attribute_arguments): Use the above so that we are more correct.
9323         
9324 2001-11-02  Ravi Pratap  <ravi@ximian.com>
9325         
9326         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
9327         to perform all checks for a method with a params parameter.
9328
9329         (Invocation::OverloadResolve): Update to use the above method and therefore
9330         cope correctly with params method invocations.
9331
9332         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
9333         params too.
9334
9335         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
9336         constructors in our parent too because we can't afford to miss out on 
9337         protected ones ;-)
9338
9339         * attribute.cs (AttributeSection): New name for the class Attribute
9340
9341         Other trivial changes to improve readability.
9342
9343         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
9344         use the new class names.
9345         
9346 2001-11-01  Ravi Pratap  <ravi@ximian.com>
9347
9348         * class.cs (Method::Define): Complete definition for params types too
9349
9350         (Indexer::Define): Ditto.
9351
9352         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
9353         Cope everywhere with a request for info about the array parameter.
9354
9355 2001-11-01  Ravi Pratap  <ravi@ximian.com>
9356
9357         * tree.cs (RecordNamespace): Fix up to check for the correct key.
9358
9359         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
9360         local_variable_type to extract the string corresponding to the type.
9361
9362         (local_variable_type): Fixup the action to use the new helper method.
9363
9364         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
9365         go.
9366
9367         * expression.cs : Clean out code which uses the above.
9368
9369 2001-10-31  Ravi Pratap  <ravi@ximian.com>
9370         
9371         * typemanager.cs (RegisterMethod): Check if we already have an existing key
9372         and bale out if necessary by returning a false.
9373
9374         (RegisterProperty): Ditto.
9375
9376         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
9377         and print out appropriate error messages.
9378
9379         * interface.cs (everywhere): Ditto.
9380
9381         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
9382         location to constructor.
9383
9384         * class.cs (Property, Event, Indexer): Update accordingly.
9385
9386         * ../errors/cs111.cs : Added.
9387
9388         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
9389         of a method, as laid down by the spec.
9390
9391         (Invocation::OverloadResolve): Use the above method.
9392
9393 2001-10-31  Ravi Pratap  <ravi@ximian.com>
9394
9395         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
9396         now take a TypeContainer and a Parameters object.
9397
9398         (ParameterData): Modify return type of ParameterModifier method to be 
9399         Parameter.Modifier and not a string.
9400
9401         (ReflectionParameters, InternalParameters): Update accordingly.
9402
9403         * expression.cs (Argument::GetParameterModifier): Same here.
9404
9405         * support.cs (InternalParameters::ParameterType): Find a better way of determining
9406         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
9407         symbol in it at all so maybe this is only for now.
9408
9409 2001-10-30  Ravi Pratap  <ravi@ximian.com>
9410
9411         * support.cs (InternalParameters): Constructor now takes an extra argument 
9412         which is the actual Parameters class.
9413
9414         (ParameterDesc): Update to provide info on ref/out modifiers.
9415
9416         * class.cs (everywhere): Update call to InternalParameters to pass in
9417         the second argument too.
9418
9419         * support.cs (ParameterData): Add ParameterModifier, which is a method 
9420         to return the modifier info [ref/out etc]
9421
9422         (InternalParameters, ReflectionParameters): Implement the above.
9423
9424         * expression.cs (Argument::ParameterModifier): Similar function to return
9425         info about the argument's modifiers.
9426
9427         (Invocation::OverloadResolve): Update to take into account matching modifiers 
9428         too.
9429
9430         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
9431         a new SetFormalParameters object which we pass to InternalParameters.
9432
9433 2001-10-30  Ravi Pratap  <ravi@ximian.com>
9434
9435         * expression.cs (NewArray): Merge into the ArrayCreation class.
9436
9437 2001-10-29  Ravi Pratap  <ravi@ximian.com>
9438
9439         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
9440         NewUserdefinedArray into one as there wasn't much of a use in having
9441         two separate ones.
9442
9443         * expression.cs (Argument): Change field's name to ArgType from Type.
9444
9445         (Type): New readonly property which returns the proper type, taking into 
9446         account ref/out modifiers.
9447
9448         (everywhere): Adjust code accordingly for the above.
9449
9450         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
9451         whether we are emitting for a ref or out parameter.
9452
9453         * expression.cs (Argument::Emit): Use the above field to set the state.
9454
9455         (LocalVariableReference::Emit): Update to honour the flag and emit the
9456         right stuff.
9457
9458         * parameter.cs (Attributes): Set the correct flags for ref parameters.
9459
9460         * expression.cs (Argument::FullDesc): New function to provide a full desc.
9461
9462         * support.cs (ParameterData): Add method ParameterDesc to the interface.
9463
9464         (ReflectionParameters, InternalParameters): Implement the above method.
9465
9466         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
9467         reporting errors.
9468
9469         (Invocation::FullMethodDesc): Ditto. 
9470
9471 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
9472
9473         * cs-parser.jay: Add extra production for the second form of array
9474         creation. 
9475
9476         * expression.cs (ArrayCreation): Update to reflect the above
9477         change. 
9478
9479         * Small changes to prepare for Array initialization.
9480
9481 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
9482
9483         * typemanager.cs (ImplementsInterface): interface might be null;
9484         Deal with this problem;
9485
9486         Also, we do store negative hits on the cache (null values), so use
9487         this instead of calling t.GetInterfaces on the type everytime.
9488
9489 2001-10-28  Ravi Pratap  <ravi@ximian.com>
9490
9491         * typemanager.cs (IsBuiltinType): New method to help determine the same.
9492
9493         * expression.cs (New::DoResolve): Get rid of array creation code and instead
9494         split functionality out into different classes.
9495
9496         (New::FormArrayType): Move into NewBuiltinArray.
9497
9498         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
9499         quite useless.
9500
9501         (NewBuiltinArray): New class to handle creation of built-in arrays.
9502
9503         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
9504         account creation of one-dimensional arrays.
9505
9506         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
9507
9508         (NewUserdefinedArray::DoResolve): Implement.
9509
9510         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
9511
9512         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
9513         we maintain inside the TypeManager. This is necessary to perform lookups on the
9514         module builder.
9515
9516         (LookupType): Update to perform GetType on the module builders too.     
9517
9518         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
9519
9520         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
9521
9522 2001-10-23  Ravi Pratap  <ravi@ximian.com>
9523
9524         * expression.cs (New::DoResolve): Implement guts of array creation.
9525
9526         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
9527         
9528 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
9529
9530         * expression.cs: Fix bug I introduced lsat night that broke
9531         Delegates. 
9532
9533         (Expression.Resolve): Report a 246 error (can not resolve name)
9534         if we find a SimpleName in the stream.
9535         
9536         (Expression.ResolveLValue): Ditto.
9537         
9538         (Expression.ResolveWithSimpleName): This function is a variant of
9539         ResolveName, this one allows SimpleNames to be returned without a
9540         warning.  The only consumer of SimpleNames is MemberAccess
9541
9542 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
9543
9544         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
9545         might arrive here.  I have my doubts that this is correct.
9546
9547         * statement.cs (Lock): Implement lock statement.
9548
9549         * cs-parser.jay: Small fixes to support `lock' and `using'
9550
9551         * cs-tokenizer.cs: Remove extra space
9552
9553         * driver.cs: New flag --checked, allows to turn on integer math
9554         checking. 
9555
9556         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
9557         Threading.Monitor.Exit 
9558         
9559 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
9560
9561         * expression.cs (IndexerAccess::DoResolveLValue): Set the
9562         Expression Class to be IndexerAccess.
9563
9564         Notice that Indexer::DoResolve sets the eclass to Value.
9565
9566 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
9567
9568         * class.cs (TypeContainer::Emit): Emit code for indexers.
9569
9570         * assign.cs (IAssignMethod): New interface implemented by Indexers
9571         and Properties for handling assignment.
9572
9573         (Assign::Emit): Simplify and reuse code. 
9574         
9575         * expression.cs (IndexerAccess, PropertyExpr): Implement
9576         IAssignMethod, clean up old code. 
9577
9578 2001-10-22  Ravi Pratap  <ravi@ximian.com>
9579
9580         * typemanager.cs (ImplementsInterface): New method to determine if a type
9581         implements a given interface. Provides a nice cache too.
9582
9583         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
9584         method.
9585
9586         (ConvertReferenceExplicit): Ditto.
9587
9588         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
9589         various methods, with correct names etc.
9590
9591         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
9592         Operator.UnaryNegation.
9593
9594         * cs-parser.jay (operator_declarator): Be a little clever in the case where
9595         we have a unary plus or minus operator.
9596
9597         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
9598         UnaryMinus.
9599
9600         * everywhere : update accordingly.
9601
9602         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
9603         respectively.
9604
9605         * class.cs (Method::Define): For the case where we are implementing a method
9606         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
9607         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
9608         
9609 2001-10-21  Ravi Pratap  <ravi@ximian.com>
9610
9611         * interface.cs (FindMembers): Implement to work around S.R.E
9612         lameness.
9613
9614         * typemanager.cs (IsInterfaceType): Implement.
9615
9616         (FindMembers): Update to handle interface types too.
9617
9618         * expression.cs (ImplicitReferenceConversion): Re-write bits which
9619         use IsAssignableFrom as that is not correct - it doesn't work.
9620
9621         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
9622         and accordingly override EmitStatement.
9623
9624         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
9625         using the correct logic :-)
9626
9627 2001-10-19  Ravi Pratap  <ravi@ximian.com>
9628
9629         * ../errors/cs-11.cs : Add to demonstrate error -11 
9630
9631 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
9632
9633         * assign.cs (Assign::Resolve): Resolve right hand side first, and
9634         then pass this as a hint to ResolveLValue.
9635         
9636         * expression.cs (FieldExpr): Add Location information
9637
9638         (FieldExpr::LValueResolve): Report assignment to readonly
9639         variable. 
9640         
9641         (Expression::ExprClassFromMemberInfo): Pass location information.
9642
9643         (Expression::ResolveLValue): Add new method that resolves an
9644         LValue. 
9645
9646         (Expression::DoResolveLValue): Default invocation calls
9647         DoResolve. 
9648
9649         (Indexers): New class used to keep track of indexers in a given
9650         Type. 
9651
9652         (IStackStore): Renamed from LValue, as it did not really describe
9653         what this did.  Also ResolveLValue is gone from this interface and
9654         now is part of Expression.
9655
9656         (ElementAccess): Depending on the element access type
9657         
9658         * typemanager.cs: Add `indexer_name_type' as a Core type
9659         (System.Runtime.CompilerServices.IndexerNameAttribute)
9660
9661         * statement.cs (Goto): Take a location.
9662         
9663 2001-10-18  Ravi Pratap  <ravi@ximian.com>
9664
9665         * delegate.cs (Delegate::VerifyDelegate): New method to verify
9666         if two delegates are compatible.
9667
9668         (NewDelegate::DoResolve): Update to take care of the case when
9669         we instantiate a delegate from another delegate.
9670
9671         * typemanager.cs (FindMembers): Don't even try to look up members
9672         of Delegate types for now.
9673
9674 2001-10-18  Ravi Pratap  <ravi@ximian.com>
9675
9676         * delegate.cs (NewDelegate): New class to take care of delegate
9677         instantiation.
9678
9679         * expression.cs (New): Split the delegate related code out into 
9680         the NewDelegate class.
9681
9682         * delegate.cs (DelegateInvocation): New class to handle delegate 
9683         invocation.
9684
9685         * expression.cs (Invocation): Split out delegate related code into
9686         the DelegateInvocation class.
9687
9688 2001-10-17  Ravi Pratap  <ravi@ximian.com>
9689
9690         * expression.cs (New::DoResolve): Implement delegate creation fully
9691         and according to the spec.
9692
9693         (New::DoEmit): Update to handle delegates differently.
9694
9695         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
9696         because of which we were printing out arguments in reverse order !
9697
9698         * delegate.cs (VerifyMethod): Implement to check if the given method
9699         matches the delegate.
9700
9701         (FullDelegateDesc): Implement.
9702
9703         (VerifyApplicability): Implement.
9704
9705         * expression.cs (Invocation::DoResolve): Update to accordingly handle
9706         delegate invocations too.
9707
9708         (Invocation::Emit): Ditto.
9709
9710         * ../errors/cs1593.cs : Added.
9711
9712         * ../errors/cs1594.cs : Added.
9713
9714         * delegate.cs (InstanceExpression, TargetMethod): New properties.
9715
9716 2001-10-16  Ravi Pratap  <ravi@ximian.com>
9717
9718         * typemanager.cs (intptr_type): Core type for System.IntPtr
9719
9720         (InitCoreTypes): Update for the same.
9721
9722         (iasyncresult_type, asynccallback_type): Ditto.
9723
9724         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
9725         correct.
9726
9727         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
9728         too.
9729
9730         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
9731         the builders for the 4 members of a delegate type :-)
9732
9733         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
9734         type.
9735
9736         * expression.cs (New::DoResolve): Implement guts for delegate creation.
9737
9738         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
9739
9740 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
9741
9742         * statement.cs (Break::Emit): Implement.   
9743         (Continue::Emit): Implement.
9744
9745         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9746         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9747         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
9748         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
9749         end loop
9750         
9751         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
9752         properties that track the label for the current loop (begin of the
9753         loop and end of the loop).
9754
9755 2001-10-15  Ravi Pratap  <ravi@ximian.com>
9756
9757         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
9758         use of emitting anything at all.
9759
9760         * class.cs, rootcontext.cs : Get rid of calls to the same.
9761
9762         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
9763
9764         (Populate): Define the constructor correctly and set the implementation
9765         attributes.
9766
9767         * typemanager.cs (delegate_types): New hashtable to hold delegates that
9768         have been defined.
9769
9770         (AddDelegateType): Implement.
9771
9772         (IsDelegateType): Implement helper method.
9773
9774         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
9775
9776         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
9777         and accordingly handle it.
9778
9779         * delegate.cs (Populate): Take TypeContainer argument.
9780         Implement bits to define the Invoke method. However, I still haven't figured out
9781         how to take care of the native int bit :-(
9782
9783         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
9784         Qualify the name of the delegate, not its return type !
9785
9786         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
9787         conversion.
9788
9789         (StandardConversionExists): Checking for array types turns out to be recursive.
9790
9791         (ConvertReferenceExplicit): Implement array conversion.
9792
9793         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
9794         
9795 2001-10-12  Ravi Pratap  <ravi@ximian.com>
9796
9797         * cs-parser.jay (delegate_declaration): Store the fully qualified
9798         name as it is a type declaration.
9799
9800         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
9801         readonly.
9802
9803         (DefineDelegate): Renamed from Define. Does the same thing essentially,
9804         as TypeContainer::DefineType.
9805
9806         (Populate): Method in which all the definition of the various methods (Invoke)
9807         etc is done.
9808
9809         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
9810         see.
9811         
9812         (CloseDelegate): Finally creates the delegate.
9813
9814         * class.cs (TypeContainer::DefineType): Update to define delegates.
9815         (Populate, Emit and CloseType): Do the same thing here too.
9816
9817         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
9818         delegates in all these operations.
9819
9820 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
9821
9822         * expression.cs: LocalTemporary: a new expression used to
9823         reference a temporary that has been created.
9824
9825         * assign.cs: Handle PropertyAccess back here, so that we can
9826         provide the proper semantic access to properties.
9827
9828         * expression.cs (Expression::ConvertReferenceExplicit): Implement
9829         a few more explicit conversions. 
9830
9831         * modifiers.cs: `NEW' modifier maps to HideBySig.
9832
9833         * expression.cs (PropertyExpr): Make this into an
9834         ExpressionStatement, and support the EmitStatement code path. 
9835
9836         Perform get/set error checking, clean up the interface.
9837
9838         * assign.cs: recognize PropertyExprs as targets, and if so, turn
9839         them into toplevel access objects.
9840
9841 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
9842
9843         * expression.cs: PropertyExpr::PropertyExpr: use work around the
9844         SRE.
9845
9846         * typemanager.cs: Keep track here of our PropertyBuilders again to
9847         work around lameness in SRE.
9848
9849 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
9850
9851         * expression.cs (LValue::LValueResolve): New method in the
9852         interface, used to perform a second resolution pass for LValues. 
9853         
9854         (This::DoResolve): Catch the use of this in static methods.
9855
9856         (This::LValueResolve): Implement.
9857
9858         (This::Store): Remove warning, assigning to `this' in structures
9859         is 
9860
9861         (Invocation::Emit): Deal with invocation of
9862         methods on value types.  We need to pass the address to structure
9863         methods rather than the object itself.  (The equivalent code to
9864         emit "this" for structures leaves the entire structure on the
9865         stack instead of a pointer to it). 
9866
9867         (ParameterReference::DoResolve): Compute the real index for the
9868         argument based on whether the method takes or not a `this' pointer
9869         (ie, the method is static).
9870
9871         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
9872         value types returned from functions when we need to invoke a
9873         method on the sturcture.
9874         
9875
9876 2001-10-11  Ravi Pratap  <ravi@ximian.com>
9877
9878         * class.cs (TypeContainer::DefineType): Method to actually do the business of
9879         defining the type in the Modulebuilder or Typebuilder. This is to take
9880         care of nested types which need to be defined on the TypeBuilder using
9881         DefineNestedMethod.
9882
9883         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
9884         methods in RootContext, only ported to be part of TypeContainer.
9885
9886         (TypeContainer::GetInterfaceOrClass): Ditto.
9887
9888         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
9889
9890         * interface.cs (Interface::DefineInterface): New method. Does exactly
9891         what RootContext.CreateInterface did earlier, only it takes care of nested types 
9892         too.
9893
9894         (Interface::GetInterfaces): Move from RootContext here and port.
9895
9896         (Interface::GetInterfaceByName): Same here.
9897
9898         * rootcontext.cs (ResolveTree): Re-write.
9899
9900         (PopulateTypes): Re-write.
9901
9902         * class.cs (TypeContainer::Populate): Populate nested types too.
9903         (TypeContainer::Emit): Emit nested members too.
9904
9905         * typemanager.cs (AddUserType): Do not make use of the FullName property,
9906         instead just use the name argument passed in as it is already fully
9907         qualified.
9908
9909         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
9910         to TypeContainer mapping to see if a type is user-defined.
9911
9912         * class.cs (TypeContainer::CloseType): Implement. 
9913
9914         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
9915         the default constructor.
9916         
9917         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
9918         twice.
9919
9920         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
9921
9922         * interface.cs (CloseType): Create the type here.
9923         
9924         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
9925         the hierarchy.
9926
9927         Remove all the methods which are now in TypeContainer.
9928
9929 2001-10-10  Ravi Pratap  <ravi@ximian.com>
9930
9931         * delegate.cs (Define): Re-write bits to define the delegate
9932         correctly.
9933
9934 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
9935
9936         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
9937
9938         * expression.cs (ImplicitReferenceConversion): handle null as well
9939         as a source to convert to any reference type.
9940
9941         * statement.cs (Return): Perform any implicit conversions to
9942         expected return type.  
9943
9944         Validate use of return statement.  
9945
9946         * codegen.cs (EmitContext): Pass the expected return type here.
9947
9948         * class.cs (Method, Constructor, Property): Pass expected return
9949         type to EmitContext.
9950
9951 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
9952
9953         * expression.cs: Make DoResolve take an EmitContext instead of a
9954         TypeContainer.
9955
9956         Replaced `l' and `location' for `loc', for consistency.
9957         
9958         (Error, Warning): Remove unneeded Tc argument.
9959
9960         * assign.cs, literal.cs, constant.cs: Update to new calling
9961         convention. 
9962         
9963         * codegen.cs: EmitContext now contains a flag indicating whether
9964         code is being generated in a static method or not.
9965
9966         * cs-parser.jay: DecomposeQI, new function that replaces the old
9967         QualifiedIdentifier.  Now we always decompose the assembled
9968         strings from qualified_identifier productions into a group of
9969         memberaccesses.
9970
9971 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
9972
9973         * rootcontext.cs: Deal with field-less struct types correctly now
9974         by passing the size option to Define Type.
9975
9976         * class.cs: Removed hack that created one static field. 
9977
9978 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
9979
9980         * statement.cs: Moved most of the code generation here. 
9981
9982 2001-10-09  Ravi Pratap  <ravi@ximian.com>
9983
9984         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
9985         seem very right.
9986
9987         (ElementAccess): Remove useless bits for now - keep checks as the spec
9988         says.
9989
9990 2001-10-08  Ravi Pratap  <ravi@ximian.com>
9991
9992         * expression.cs (ElementAccess::DoResolve): Remove my crap code
9993         and start performing checks according to the spec.
9994
9995 2001-10-07  Ravi Pratap  <ravi@ximian.com>
9996
9997         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
9998         rank_specifiers instead.
9999
10000         (rank_specifiers): Change the order in which the rank specifiers are stored
10001
10002         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10003
10004         * expression.cs (ElementAccess): Implement the LValue interface too.
10005         
10006 2001-10-06  Ravi Pratap  <ravi@ximian.com>
10007         
10008         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10009         except that user defined conversions are not included.
10010
10011         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
10012         perform the conversion of the return type, if necessary.
10013
10014         (New::DoResolve): Check whether we are creating an array or an object
10015         and accordingly do the needful.
10016
10017         (New::Emit): Same here.
10018
10019         (New::DoResolve): Implement guts of array creation.
10020
10021         (New::FormLookupType): Helper function.
10022
10023 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10024
10025         * codegen.cs: Removed most of the code generation here, and move the
10026         corresponding code generation bits to the statement classes. 
10027
10028         Added support for try/catch/finalize and throw.
10029         
10030         * cs-parser.jay: Added support for try/catch/finalize.
10031
10032         * class.cs: Catch static methods having the flags override,
10033         virtual or abstract.
10034
10035         * expression.cs (UserCast): This user cast was not really doing
10036         what it was supposed to do.  Which is to be born in fully resolved
10037         state.  Parts of the resolution were being performed at Emit time! 
10038
10039         Fixed this code.
10040
10041 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10042
10043         * expression.cs: Implicity convert the result from UserCast.
10044
10045 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10046
10047         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10048         prevented it from working correctly. 
10049
10050         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10051         merely ConvertImplicit.
10052
10053 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10054
10055         * typemanager.cs: Make the LookupTypeContainer function static,
10056         and not per-instance.  
10057
10058         * class.cs: Make static FindMembers (the one that takes a Type
10059         argument). 
10060
10061         * codegen.cs: Add EmitForeach here.
10062
10063         * cs-parser.jay: Make foreach a toplevel object instead of the
10064         inline expansion, as we need to perform semantic analysis on it. 
10065
10066 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10067
10068         * expression.cs (Expression::ImplicitUserConversion): Rename to
10069         UserDefinedConversion.
10070
10071         (Expression::UserDefinedConversion): Take an extra argument specifying 
10072         whether we look for explicit user conversions too.
10073
10074         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10075
10076         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10077
10078         (ExplicitUserConversion): Make it a call to UserDefinedConversion
10079         with the appropriate arguments.
10080
10081         * cs-parser.jay (cast_expression): Record location too.
10082
10083         * expression.cs (Cast): Record location info.
10084
10085         (Expression::ConvertExplicit): Take location argument.
10086
10087         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10088         to determine if we are doing explicit conversions.
10089
10090         (UserCast::Emit): Update accordingly.
10091
10092         (Expression::ConvertExplicit): Report an error if everything fails.
10093
10094         * ../errors/cs0030.cs : Add.
10095
10096 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
10097
10098         * modifiers.cs: If the ABSTRACT keyword is present, also set the
10099         virtual and newslot bits. 
10100
10101         * class.cs (TypeContainer::RegisterRequiredImplementations):
10102         Record methods we need.
10103
10104         (TypeContainer::MakeKey): Helper function to make keys for
10105         MethodBases, since the Methodbase key is useless.
10106
10107         (TypeContainer::Populate): Call RegisterRequiredImplementations
10108         before defining the methods.   
10109
10110         Create a mapping for method_builders_to_methods ahead of time
10111         instead of inside a tight loop.
10112
10113         (::RequireMethods):  Accept an object as the data to set into the
10114         hashtable so we can report interface vs abstract method mismatch.
10115
10116 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10117
10118         * report.cs: Make all of it static.
10119
10120         * rootcontext.cs: Drop object_type and value_type computations, as
10121         we have those in the TypeManager anyways.
10122
10123         Drop report instance variable too, now it is a global.
10124
10125         * driver.cs: Use try/catch on command line handling.
10126
10127         Add --probe option to debug the error reporting system with a test
10128         suite. 
10129
10130         * report.cs: Add support for exiting program when a probe
10131         condition is reached.
10132
10133 2001-10-03  Ravi Pratap  <ravi@ximian.com>
10134
10135         * expression.cs (Binary::DoNumericPromotions): Fix the case when
10136         we do a forcible conversion regardless of type, to check if 
10137         ForceConversion returns a null.
10138
10139         (Binary::error19): Use location to report error.
10140
10141         (Unary::error23): Use location here too.
10142
10143         * ../errors/cs0019.cs : Check in.
10144
10145         * ../errors/cs0023.cs : Check in.
10146
10147         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
10148         case of a non-null MethodInfo object with a length of 0 !
10149
10150         (Binary::ResolveOperator): Flag error if overload resolution fails to find
10151         an applicable member - according to the spec :-)
10152         Also fix logic to find members in base types.
10153
10154         (Unary::ResolveOperator): Same here.
10155
10156         (Unary::report23): Change name to error23 and make first argument a TypeContainer
10157         as I was getting thoroughly confused between this and error19 :-)
10158         
10159         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
10160         (::FindMostEncompassedType): Implement.
10161         (::FindMostEncompassingType): Implement.
10162         (::StandardConversionExists): Implement.
10163
10164         (UserImplicitCast): Re-vamp. We now need info about most specific
10165         source and target types so that we can do the necessary conversions.
10166
10167         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
10168         mathematical union with no duplicates.
10169
10170 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10171
10172         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
10173         in order from base classes to child classes, so that we can in
10174         child classes look up in our parent for method names and
10175         attributes (required for handling abstract, virtual, new, override
10176         constructs: we need to instrospect our base class, and if we dont
10177         populate the classes in order, the introspection might be
10178         incorrect.  For example, a method could query its parent before
10179         the parent has any methods and would determine that the parent has
10180         no abstract methods (while it could have had them)).
10181
10182         (RootContext::CreateType): Record the order in which we define the
10183         classes.
10184
10185 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
10186
10187         * class.cs (TypeContainer::Populate): Also method definitions can
10188         fail now, keep track of this.
10189
10190         (TypeContainer::FindMembers): Implement support for
10191         DeclaredOnly/noDeclaredOnly flag.
10192
10193         (Constructor::Emit) Return the ConstructorBuilder.
10194
10195         (Method::Emit) Return the MethodBuilder. 
10196         Check for abstract or virtual methods to be public.
10197
10198         * rootcontext.cs (RootContext::CreateType): Register all the
10199         abstract methods required for the class to be complete and the
10200         interface methods that must be implemented. 
10201
10202         * cs-parser.jay: Report error 501 (method requires body if it is
10203         not marked abstract or extern).
10204
10205         * expression.cs (TypeOf::Emit): Implement.
10206
10207         * typemanager.cs: runtime_handle_type, new global type.
10208
10209         * class.cs (Property::Emit): Generate code for properties.
10210
10211 2001-10-02  Ravi Pratap  <ravi@ximian.com>
10212
10213         * expression.cs (Unary::ResolveOperator): Find operators on base type
10214         too - we now conform exactly to the spec.
10215
10216         (Binary::ResolveOperator): Same here.
10217
10218         * class.cs (Operator::Define): Fix minor quirk in the tests.
10219
10220         * ../errors/cs0215.cs : Added.
10221
10222         * ../errors/cs0556.cs : Added.
10223
10224         * ../errors/cs0555.cs : Added.
10225
10226 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
10227
10228         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
10229         single integer which is really efficient
10230
10231 2001-10-01  Ravi Pratap  <ravi@ximian.com>
10232
10233         *  expression.cs (Expression::ImplicitUserConversion): Use location
10234         even in the case when we are examining True operators.
10235  
10236         * class.cs (Operator::Define): Perform extensive checks to conform
10237         with the rules for operator overloading in the spec.
10238
10239         * expression.cs (Expression::ImplicitReferenceConversion): Implement
10240         some of the other conversions mentioned in the spec.
10241
10242         * typemanager.cs (array_type): New static member for the System.Array built-in
10243         type.
10244
10245         (cloneable_interface): For System.ICloneable interface.
10246
10247         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
10248         we start resolving the tree and populating types.
10249
10250         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
10251  
10252 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
10253
10254         * expression.cs (Expression::ExprClassFromMemberInfo,
10255         Expression::Literalize): Create literal expressions from
10256         FieldInfos which are literals.
10257
10258         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
10259         type casts, because they were wrong.  The test suite in tests
10260         caught these ones.
10261
10262         (ImplicitNumericConversion): ushort to ulong requires a widening
10263         cast. 
10264
10265         Int32 constant to long requires widening cast as well.
10266
10267         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
10268         for integers because the type on the stack is not i4.
10269
10270 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
10271
10272         * expression.cs (report118): require location argument. 
10273
10274         * parameter.cs: Do not dereference potential null value.
10275
10276         * class.cs: Catch methods that lack the `new' keyword when
10277         overriding a name.  Report warnings when `new' is used without
10278         anything being there to override.
10279
10280         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
10281
10282         * class.cs: Only add constructor to hashtable if it is non-null
10283         (as now constructors can fail on define).
10284
10285         (TypeManager, Class, Struct): Take location arguments.
10286
10287         Catch field instance initialization in structs as errors.
10288
10289         accepting_filter: a new filter for FindMembers that is static so
10290         that we dont create an instance per invocation.
10291
10292         (Constructor::Define): Catch errors where a struct constructor is
10293         parameterless 
10294
10295         * cs-parser.jay: Pass location information for various new
10296         constructs. 
10297         
10298         * delegate.cs (Delegate): take a location argument.
10299
10300         * driver.cs: Do not call EmitCode if there were problesm in the
10301         Definition of the types, as many Builders wont be there. 
10302
10303         * decl.cs (Decl::Decl): Require a location argument.
10304
10305         * cs-tokenizer.cs: Handle properly hex constants that can not fit
10306         into integers, and find the most appropiate integer for it.
10307
10308         * literal.cs: Implement ULongLiteral.
10309
10310         * rootcontext.cs: Provide better information about the location of
10311         failure when CreateType fails.
10312         
10313 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
10314
10315         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
10316         as well.
10317
10318         * expression.cs (Binary::CheckShiftArguments): Add missing type
10319         computation.
10320         (Binary::ResolveOperator): Add type to the logical and and logical
10321         or, Bitwise And/Or and Exclusive Or code paths, it was missing
10322         before.
10323
10324         (Binary::DoNumericPromotions): In the case where either argument
10325         is ulong (and most signed types combined with ulong cause an
10326         error) perform implicit integer constant conversions as well.
10327
10328 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
10329
10330         * expression.cs (UserImplicitCast): Method should always be
10331         non-null. 
10332         (Invocation::BetterConversion): Simplified test for IntLiteral.
10333
10334         (Expression::ImplicitNumericConversion): Split this routine out.
10335         Put the code that performs implicit constant integer conversions
10336         here. 
10337
10338         (Expression::Resolve): Become a wrapper around DoResolve so we can
10339         check eclass and type being set after resolve.
10340
10341         (Invocation::Badness): Remove this dead function
10342
10343         (Binary::ResolveOperator): Do not compute the expensive argumnets
10344         unless we have a union for it.
10345
10346         (Probe::Emit): Is needs to do an isinst and then
10347         compare against null.
10348
10349         (::CanConvert): Added Location argument.  If the Location argument
10350         is null (Location.Null), then we do not report errors.  This is
10351         used by the `probe' mechanism of the Explicit conversion.  We do
10352         not want to generate an error for something that the user
10353         explicitly requested to be casted.  But the pipeline for an
10354         explicit cast first tests for potential implicit casts.
10355
10356         So for now, if the Location is null, it means `Probe only' to
10357         avoid adding another argument.   Might have to revise this
10358         strategy later.
10359
10360         (ClassCast): New class used to type cast objects into arbitrary
10361         classes (used in Explicit Reference Conversions).
10362
10363         Implement `as' as well.
10364
10365         Reverted all the patches from Ravi below: they were broken:
10366
10367                 * The use of `level' as a mechanism to stop recursive
10368                   invocations is wrong.  That was there just to catch the
10369                   bug with a strack trace but not as a way of addressing
10370                   the problem.
10371
10372                   To fix the problem we have to *understand* what is going
10373                   on and the interactions and come up with a plan, not
10374                   just get things going.
10375
10376                 * The use of the type conversion cache that I proposed
10377                   last night had an open topic: How does this work across
10378                   protection domains.  A user defined conversion might not
10379                   be public in the location where we are applying the
10380                   conversion, a different conversion might be selected
10381                   (ie, private A->B (better) but public B->A (worse),
10382                   inside A, A->B applies, but outside it, B->A will
10383                   apply).
10384
10385                 * On top of that (ie, even if the above is solved),
10386                   conversions in a cache need to be abstract.  Ie, `To
10387                   convert from an Int to a Short use an OpcodeCast', not
10388                   `To convert from an Int to a Short use the OpcodeCast on
10389                   the variable 5' (which is what this patch was doing).
10390         
10391 2001-09-28  Ravi Pratap  <ravi@ximian.com>
10392
10393         * expression.cs (Invocation::ConversionExists): Re-write to use
10394         the conversion cache
10395         
10396         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
10397         cache all conversions done, not just user-defined ones.
10398
10399         (Invocation::BetterConversion): The real culprit. Use ConversionExists
10400         to determine if a conversion exists instead of acutually trying to 
10401         perform the conversion. It's faster too.
10402
10403         (Expression::ConvertExplicit): Modify to use ConversionExists to check
10404         and only then attempt the implicit conversion.
10405
10406 2001-09-28  Ravi Pratap  <ravi@ximian.com>
10407
10408         * expression.cs (ConvertImplicit): Use a cache for conversions
10409         already found. Check level of recursion and bail out if necessary.
10410         
10411 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
10412
10413         * typemanager.cs (string_concat_string_string, string_concat_object_object):
10414         Export standard methods that we expect for string operations.
10415         
10416         * statement.cs (Block::UsageWarning): Track usage of variables and
10417         report the errors for not used variables.
10418
10419         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
10420         operator. 
10421
10422 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
10423
10424         * codegen.cs: remove unnneded code 
10425
10426         * expression.cs: Removed BuiltinTypeAccess class
10427
10428         Fix the order in which implicit conversions are
10429         done.  
10430
10431         The previous fixed dropped support for boxed conversions (adding a
10432         test to the test suite now)
10433
10434         (UserImplicitCast::CanConvert): Remove test for source being null,
10435         that code is broken.  We should not feed a null to begin with, if
10436         we do, then we should track the bug where the problem originates
10437         and not try to cover it up here.
10438
10439         Return a resolved expression of type UserImplicitCast on success
10440         rather than true/false.  Ravi: this is what I was talking about,
10441         the pattern is to use a static method as a "constructor" for
10442         objects. 
10443
10444         Also, do not create arguments until the very last minute,
10445         otherwise we always create the arguments even for lookups that
10446         will never be performed. 
10447
10448         (UserImplicitCast::Resolve): Eliminate, objects of type
10449         UserImplicitCast are born in a fully resolved state. 
10450         
10451         * typemanager.cs (InitCoreTypes): Init also value_type
10452         (System.ValueType). 
10453
10454         * expression.cs (Cast::Resolve): First resolve the child expression.
10455
10456         (LValue): Add new method AddressOf to be used by
10457         the `&' operator.  
10458
10459         Change the argument of Store to take an EmitContext instead of an
10460         ILGenerator, because things like FieldExpr need to be able to call
10461         their children expression to generate the instance code. 
10462
10463         (Expression::Error, Expression::Warning): Sugar functions for
10464         reporting errors.
10465
10466         (Expression::MemberLookup): Accept a TypeContainer instead of a
10467         Report as the first argument.
10468
10469         (Expression::ResolvePrimary): Killed.  I still want to improve
10470         this as currently the code is just not right.
10471
10472         (Expression::ResolveMemberAccess): Simplify, but it is still
10473         wrong. 
10474
10475         (Unary::Resolve): Catch errors in AddressOf operators.
10476
10477         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
10478         index to a byte for the short-version, or the compiler will choose
10479         the wrong Emit call, which generates the wrong data.
10480
10481         (ParameterReference::Emit, ::Store): same.
10482
10483         (FieldExpr::AddressOf): Implement.
10484         
10485         * typemanager.cs: TypeManager: made public variable instead of
10486         property.
10487         
10488         * driver.cs: document --fatal.
10489
10490         * report.cs (ErrorMessage, WarningMessage): new names for the old
10491         Error and Warning classes.
10492
10493         * cs-parser.jay (member_access): Turn built-in access to types
10494         into a normal simplename
10495
10496 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10497
10498         * expression.cs (Invocation::BetterConversion): Fix to cope
10499         with q being null, since this was introducing a bug.
10500
10501         * expression.cs (ConvertImplicit): Do built-in conversions first.
10502
10503 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10504
10505         * expression.cs (UserImplicitCast::Resolve): Fix bug.
10506
10507 2001-09-27  Ravi Pratap  <ravi@ximian.com>
10508
10509         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
10510         I had introduced long ago (what's new ?).
10511
10512         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
10513         the work of all the checking. 
10514         (ConvertImplicit): Call CanConvert and only then create object if necessary.
10515         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
10516
10517         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
10518         that is the right way. 
10519
10520         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
10521         overloading resolution. Use everywhere instead of cutting and pasting code.
10522
10523         (Binary::ResolveOperator): Use MakeUnionSet.
10524
10525         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
10526         we have to convert to bool types. Not complete yet.
10527         
10528 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
10529
10530         * typemanager.cs (TypeManager::CSharpName): support ushort.
10531
10532         * expression.cs (Expression::TryImplicitIntConversion): Attempts
10533         to provide an expression that performsn an implicit constant int
10534         conversion (section 6.1.6).
10535         (Expression::ConvertImplicitRequired): Reworked to include
10536         implicit constant expression conversions.
10537
10538         (Expression::ConvertNumericExplicit): Finished.
10539
10540         (Invocation::Emit): If InstanceExpression is null, then it means
10541         that we perform a call on this.
10542         
10543 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
10544
10545         * expression.cs (Unary::Emit): Remove some dead code.
10546         (Probe): Implement Resolve and Emit for `is'.
10547         (Expression::ConvertImplicitRequired): Attempt to do constant
10548         expression conversions here.  Maybe should be moved to
10549         ConvertImplicit, but I am not sure.
10550         (Expression::ImplicitLongConstantConversionPossible,
10551         Expression::ImplicitIntConstantConversionPossible): New functions
10552         that tell whether is it possible to apply an implicit constant
10553         expression conversion.
10554
10555         (ConvertNumericExplicit): Started work on explicit numeric
10556         conversions.
10557
10558         * cs-parser.jay: Update operator constants.
10559
10560         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
10561         (Parameters::GetSignature): Hook up VerifyArgs here.
10562         (Parameters::VerifyArgs): Verifies that no two arguments have the
10563         same name. 
10564
10565         * class.cs (Operator): Update the operator names to reflect the
10566         ones that the spec expects (as we are just stringizing the
10567         operator names).
10568         
10569         * expression.cs (Unary::ResolveOperator): Fix bug: Use
10570         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
10571         previous usage did only work for our methods.
10572         (Expression::ConvertImplicit): Handle decimal implicit numeric
10573         conversions as well.
10574         (Expression::InternalTypeConstructor): Used to invoke constructors
10575         on internal types for default promotions.
10576
10577         (Unary::Emit): Implement special handling for the pre/post
10578         increment/decrement for overloaded operators, as they need to have
10579         the same semantics as the other operators.
10580
10581         (Binary::ResolveOperator): ditto.
10582         (Invocation::ConversionExists): ditto.
10583         (UserImplicitCast::Resolve): ditto.
10584         
10585 2001-09-26  Ravi Pratap  <ravi@ximian.com>
10586
10587         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
10588         operator, return after emitting body. Regression tests pass again !
10589
10590         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
10591         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
10592         (Invocation::OverloadResolve): Ditto.
10593         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
10594
10595         * everywhere : update calls to the above methods accordingly.
10596
10597 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
10598
10599         * assign.cs (Assign): Make it inherit from ExpressionStatement.
10600
10601         * expression.cs (ExpressionStatement): New base class used for
10602         expressions that can appear in statements, so that we can provide
10603         an alternate path to generate expression that do not leave a value
10604         on the stack.
10605
10606         (Expression::Emit, and all the derivatives): We no longer return
10607         whether a value is left on the stack or not.  Every expression
10608         after being emitted leaves a single value on the stack.
10609
10610         * codegen.cs (EmitContext::EmitStatementExpression): Use the
10611         facilties of ExpressionStatement if possible.
10612
10613         * cs-parser.jay: Update statement_expression.
10614
10615 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
10616
10617         * driver.cs: Change the wording of message
10618
10619 2001-09-25  Ravi Pratap  <ravi@ximian.com>
10620
10621         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
10622         the type of the expression to the return type of the method if
10623         we have an overloaded operator match ! The regression tests pass again !
10624         (Unary::ResolveOperator): Ditto.
10625
10626         * expression.cs (Invocation::ConversionExists): Correct the member lookup
10627         to find "op_Implicit", not "implicit" ;-)
10628         (UserImplicitCast): New class to take care of user-defined implicit conversions.
10629         (ConvertImplicit, ForceConversion): Take TypeContainer argument
10630
10631         * everywhere : Correct calls to the above accordingly.
10632
10633         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
10634         (ConvertImplicit): Do user-defined conversion if it exists.
10635
10636 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
10637
10638         * assign.cs: track location.
10639         (Resolve): Use implicit conversions on assignment.
10640
10641         * literal.cs: Oops.  Not good, Emit of short access values should
10642         pass (Bytes) or the wrong argument will be selected.
10643
10644         * expression.cs (Unary::Emit): Emit code for -expr.
10645         
10646         (Unary::ResolveOperator): Handle `Substract' for non-constants
10647         (substract from zero from the non-constants).
10648         Deal with Doubles as well. 
10649         
10650         (Expression::ConvertImplicitRequired): New routine that reports an
10651         error if no implicit conversion exists. 
10652
10653         (Invocation::OverloadResolve): Store the converted implicit
10654         expressions if we make them
10655         
10656 2001-09-24  Ravi Pratap  <ravi@ximian.com>
10657
10658         * class.cs (ConstructorInitializer): Take a Location argument.
10659         (ConstructorBaseInitializer): Same here.
10660         (ConstructorThisInitializer): Same here.
10661
10662         * cs-parser.jay : Update all calls accordingly.
10663
10664         * expression.cs (Unary, Binary, New): Take location argument.
10665         Update accordingly everywhere.
10666
10667         * cs-parser.jay : Update all calls to the above to take a location
10668         argument.
10669
10670         * class.cs : Ditto.
10671
10672 2001-09-24  Ravi Pratap  <ravi@ximian.com>
10673
10674         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
10675         (Invocation::BetterConversion): Same here
10676         (Invocation::ConversionExists): Ditto.
10677
10678         (Invocation::ConversionExists): Implement.
10679
10680 2001-09-22  Ravi Pratap  <ravi@ximian.com>
10681
10682         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
10683         Also take an additional TypeContainer argument.
10684
10685         * All over : Pass in TypeContainer as argument to OverloadResolve.
10686
10687         * typemanager.cs (CSharpName): Update to check for the string type and return
10688         that too.
10689
10690         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
10691         a given method.
10692         
10693 2001-09-21  Ravi Pratap  <ravi@ximian.com>
10694
10695         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
10696         (Invocation::BetterFunction): Implement.
10697         (Invocation::BetterConversion): Implement.
10698         (Invocation::ConversionExists): Skeleton, no implementation yet.
10699
10700         Okay, things work fine !
10701
10702 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
10703
10704         * typemanager.cs: declare and load enum_type, delegate_type and
10705         void_type. 
10706
10707         * expression.cs (Expression::Emit): Now emit returns a value that
10708         tells whether a value is left on the stack or not.  This strategy
10709         might be reveted tomorrow with a mechanism that would address
10710         multiple assignments.
10711         (Expression::report118): Utility routine to report mismatches on
10712         the ExprClass.
10713
10714         (Unary::Report23): Report impossible type/operator combination
10715         utility function.
10716
10717         (Unary::IsIncrementableNumber): Whether the type can be
10718         incremented or decremented with add.
10719         (Unary::ResolveOperator): Also allow enumerations to be bitwise
10720         complemented. 
10721         (Unary::ResolveOperator): Implement ++, !, ~,
10722
10723         (Invocation::Emit): Deal with new Emit convetion.
10724         
10725         * All Expression derivatives: Updated their Emit method to return
10726         whether they leave values on the stack or not.
10727         
10728         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
10729         stack for expressions that are statements. 
10730
10731 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
10732
10733         * expression.cs (LValue): New interface.  Must be implemented by
10734         LValue objects.
10735         (LocalVariableReference, ParameterReference, FieldExpr): Implement
10736         LValue interface.
10737         
10738         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
10739         interface for generating code, simplifies the code.
10740
10741 2001-09-20  Ravi Pratap  <ravi@ximian.com>
10742
10743         * expression.cs (everywhere): Comment out return statements in ::Resolve
10744         methods to avoid the warnings.
10745
10746 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
10747
10748         * driver.cs (parse): Report error 2001 if we can not open the
10749         source file.
10750
10751         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
10752         not resolve it.
10753
10754         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
10755         object. 
10756
10757         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
10758         otherwise nested blocks end up with the same index.
10759
10760         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
10761
10762         * expression.cs:  Instead of having FIXMEs in the Resolve
10763         functions, throw exceptions so it is obvious that we are facing a
10764         bug. 
10765
10766         * cs-parser.jay (invocation_expression): Pass Location information.
10767
10768         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
10769         Use a basename for those routines because .NET does not like paths
10770         on them. 
10771
10772         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
10773         already defined.
10774
10775 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
10776
10777         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
10778         are loading the correct data types (throws an exception if not).
10779         (TypeManager::InitCoreTypes): Use CoreLookupType
10780
10781         * expression.cs (Unary::ResolveOperator): return the child
10782         expression for expressions which are just +expr.
10783         (Unary::ResolveOperator): Return negative literals for -LITERAL
10784         expressions (otherwise they are Unary {Literal}).
10785         (Invocation::Badness): Take into account `Implicit constant
10786         expression conversions'.
10787
10788         * literal.cs (LongLiteral): Implement long literal class.
10789         (IntLiteral): export the `Value' of the intliteral. 
10790
10791 2001-09-19  Ravi Pratap  <ravi@ximian.com>
10792
10793         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
10794
10795         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
10796         instead of 'Operator'
10797
10798         * expression.cs (Binary::ResolveOperator): Update accordingly.
10799         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
10800         and 'Minus'
10801
10802         * cs-parser.jay (unary_expression): Update to use the new names.
10803
10804         * gen-treedump.cs (GetUnary): Same here.
10805
10806         * expression.cs (Unary::Resolve): Implement.
10807         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
10808         operators are found instead of making noise ;-)
10809         (Unary::ResolveOperator): New method to do precisely the same thing which
10810         Binary::ResolveOperator does for Binary expressions.
10811         (Unary.method, .Arguments): Add.
10812         (Unary::OperName): Implement.   
10813         (Unary::ForceConversion): Copy and Paste !
10814
10815         * class.cs (Operator::Define): Fix a small bug for the case when we have 
10816         a unary operator.
10817
10818         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
10819         for the inbuilt operators. Only overloading works for now ;-)
10820
10821 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
10822
10823         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
10824         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
10825
10826         * expression.cs (This::Emit): Implement. 
10827         (This::Resolve): Implement.
10828         (TypeOf:Resolve): Implement.
10829         (Expression::ResolveSimpleName): Add an implicit this to instance
10830         field references. 
10831         (MemberAccess::Resolve): Deal with Parameters and Fields. 
10832         Bind instance variable to Field expressions.
10833         (FieldExpr::Instance): New field used to track the expression that
10834         represents the object instance.
10835         (FieldExpr::Resolve): Track potential errors from MemberLookup not
10836         binding 
10837         (FieldExpr::Emit): Implement.
10838
10839         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
10840         the last instruction contains a return opcode to avoid generating
10841         the last `ret' instruction (this generates correct code, and it is
10842         nice to pass the peverify output).
10843
10844         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
10845         initializer for static and instance variables.
10846         (Constructor::Emit): Allow initializer to be null in the case of
10847         static constructors.  Only emit initializer for instance
10848         constructors. 
10849
10850         (TypeContainer::FindMembers): Return a null array if there are no
10851         matches.
10852
10853         Also fix the code for the MemberTypes.Method branch, as it was not
10854         scanning that for operators (or tried to access null variables before).
10855
10856         * assign.cs (Assign::Emit): Handle instance and static fields. 
10857
10858         * TODO: Updated.
10859
10860         * driver.cs: Stop compilation if there are parse errors.
10861
10862         * cs-parser.jay (constructor_declaration): Provide default base
10863         initializer for non-static constructors.
10864         (constructor_declarator): Do not provide a default base
10865         initializers if none was specified.
10866         Catch the fact that constructors should not have parameters.
10867
10868         * class.cs: Do not emit parent class initializers for static
10869         constructors, that should be flagged as an error.
10870
10871 2001-09-18  Ravi Pratap  <ravi@ximian.com>
10872
10873         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
10874         Move back code into TypeContainer::Populate.
10875
10876 2001-09-18  Ravi Pratap  <ravi@ximian.com>
10877
10878         * class.cs (TypeContainer::AddConstructor): Fix the check to
10879         compare against Name, not Basename. 
10880         (Operator::OpType): Change Plus and Minus to Add and Subtract.
10881
10882         * cs-parser.jay : Update accordingly.
10883
10884         * class.cs (TypeContainer::FindMembers): For the case where we are searching
10885         for methods, don't forget to look into the operators too.
10886         (RegisterMethodBuilder): Helper method to take care of this for
10887         methods, constructors and operators.
10888         (Operator::Define): Completely revamp.
10889         (Operator.OperatorMethod, MethodName): New fields.
10890         (TypeContainer::Populate): Move the registering of builders into
10891         RegisterMethodBuilder.
10892         (Operator::Emit): Re-write.
10893
10894         * expression.cs (Binary::Emit): Comment out code path to emit method
10895         invocation stuff for the case when we have a user defined operator. I am
10896         just not able to get it right !
10897         
10898 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
10899
10900         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
10901         argument. 
10902
10903         (Expression::MemberLookup): Provide a version that allows to
10904         specify the MemberTypes and BindingFlags. 
10905
10906         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
10907         so it was not fetching variable information from outer blocks.
10908
10909         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
10910         Beforefieldinit as it was buggy.
10911
10912         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
10913         that Ravi put here.  
10914
10915         * class.cs (Constructor::Emit): Only emit if block is not null.
10916         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
10917         deal with this by semantically definining it as if the user had
10918         done it.
10919
10920         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
10921         constructors as we now "emit" them at a higher level.
10922
10923         (TypeContainer::DefineDefaultConstructor): Used to define the
10924         default constructors if none was provided.
10925
10926         (ConstructorInitializer): Add methods Resolve and Emit. 
10927         
10928         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
10929
10930 2001-09-17  Ravi Pratap  <ravi@ximian.com>
10931
10932         * class.cs (TypeContainer::EmitDefaultConstructor): Register
10933         the default constructor builder with our hashtable for methodbuilders
10934         to methodcores.
10935
10936         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
10937         and argument_count is 0 in which case we have a match.
10938         (Binary::ResolveOperator): More null checking and miscellaneous coding
10939         style cleanup.
10940
10941 2001-09-17  Ravi Pratap  <ravi@ximian.com>
10942
10943         * rootcontext.cs (IsNameSpace): Compare against null.
10944
10945         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
10946
10947         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
10948         and Unary::Operator.
10949
10950         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
10951         accordingly.
10952
10953         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
10954         we have overloaded operators.
10955         (Binary::ResolveOperator): Implement the part which does the operator overload
10956         resolution.
10957
10958         * class.cs (Operator::Emit): Implement.
10959         (TypeContainer::Emit): Emit the operators we have too.
10960
10961         * expression.cs (Binary::Emit): Update to emit the appropriate code for
10962         the case when we have a user-defined operator.
10963         
10964 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
10965
10966         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
10967
10968 2001-09-16  Ravi Pratap  <ravi@ximian.com>
10969
10970         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
10971         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
10972         (Constructor::Emit): Implement.
10973         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
10974         if we have no work to do. 
10975         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
10976         Emit method.
10977
10978         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
10979         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
10980
10981         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
10982         of parent.parent.
10983
10984 2001-09-15  Ravi Pratap  <ravi@ximian.com>
10985
10986         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
10987         in the source.
10988         (Tree::RecordNamespace): Method to do what the name says ;-)
10989         (Tree::Namespaces): Property to get at the namespaces hashtable.
10990
10991         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
10992         keep track.
10993
10994         * rootcontext.cs (IsNamespace): Fixed it :-)
10995
10996 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
10997
10998         * class.cs (TypeContainer::FindMembers): Add support for
10999         constructors. 
11000         (MethodCore): New class that encapsulates both the shared aspects
11001         of a Constructor and a Method.  
11002         (Method, Constructor): Factored pieces into MethodCore.
11003
11004         * driver.cs: Added --fatal which makes errors throw exceptions.
11005         Load System assembly as well as part of the standard library.
11006
11007         * report.cs: Allow throwing exceptions on errors for debugging.
11008
11009         * modifiers.cs: Do not use `parent', instead use the real type
11010         container to evaluate permission settings.
11011
11012         * class.cs: Put Ravi's patch back in.  He is right, and we will
11013         have to cope with the
11014
11015 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11016
11017         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11018         FamORAssem, not FamANDAssem.
11019         
11020 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11021
11022         * driver.cs: Added --parse option that only parses its input files
11023         and terminates.
11024
11025         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
11026         incorrect.  IsTopLevel is not used to tell whether an object is
11027         root_types or not (that can be achieved by testing this ==
11028         root_types).  But to see if this is a top-level *class* (not
11029         necessarly our "toplevel" container). 
11030
11031 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11032
11033         * enum.cs (Enum::Define): Modify to call the Lookup method on the
11034         parent instead of a direct call to GetType.
11035
11036 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11037
11038         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11039         Modifiers.TypeAttr. This should just be a call to that method.
11040
11041         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11042         object so that we can determine if we are top-level or not.
11043
11044         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
11045         TypeContainer too.
11046
11047         * enum.cs (Enum::Define): Ditto.
11048
11049         * modifiers.cs (FieldAttr): Re-write.
11050
11051         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11052         (TypeContainer::HaveStaticConstructor): New property to provide access
11053         to precisely that info.
11054
11055         * modifiers.cs (MethodAttr): Re-write.
11056         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11057
11058         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11059         of top-level types as claimed.
11060         
11061 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11062
11063         * expression.cs (MemberLookup): Fruitless attempt to lookup
11064         constructors.  Maybe I need to emit default constructors?  That
11065         might be it (currently .NET emits this for me automatically).
11066         (Invocation::OverloadResolve): Cope with Arguments == null.
11067         (Invocation::EmitArguments): new function, shared by the new
11068         constructor and us.
11069         (Invocation::Emit): Handle static and instance methods.  Emit
11070         proper call instruction for virtual or non-virtual invocations.
11071         (New::Emit): Implement.
11072         (New::Resolve): Implement.
11073         (MemberAccess:Resolve): Implement.
11074         (MethodGroupExpr::InstanceExpression): used conforming to the spec
11075         to track instances.
11076         (FieldExpr::Resolve): Set type.
11077
11078         * support.cs: Handle empty arguments.
11079                 
11080         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11081         SimpleLookup): Auxiliary routines to help parse a qualifier
11082         identifier.  
11083
11084         Update qualifier_identifier rule.
11085
11086         * codegen.cs: Removed debugging messages.
11087
11088         * class.cs: Make this a global thing, this acts just as a "key" to
11089         objects that we might have around.
11090
11091         (Populate): Only initialize method_builders_to_methods once.
11092
11093         * expression.cs (PropertyExpr): Initialize type from the
11094         PropertyType. 
11095
11096         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11097         Resolve pattern.  Attempt to implicitly convert value to boolean.
11098         Emit code.
11099
11100         * expression.cs: Set the type for the int32/int32 argument case.
11101         (Binary::ResolveOperator): Set the return type to boolean for
11102         comparission operators
11103
11104         * typemanager.cs: Remove debugging print code.
11105
11106         (Invocation::Resolve): resolve type.
11107
11108         * class.cs: Allocate a MemberInfo of the correct size, as the code
11109         elsewhere depends on the test to reflect the correct contents.
11110
11111         (Method::) Keep track of parameters, due to System.Reflection holes
11112
11113         (TypeContainer::Populate): Keep track of MethodBuilders to Method
11114         mapping here.
11115
11116         (TypeContainer::FindMembers): Use ArrayList and then copy an array
11117         of the exact size and return that.
11118
11119         (Class::LookupMethodByBuilder): New function that maps
11120         MethodBuilders to its methods.  Required to locate the information
11121         on methods because System.Reflection bit us again.
11122
11123         * support.cs: New file, contains an interface ParameterData and
11124         two implementations: ReflectionParameters and InternalParameters
11125         used to access Parameter information.  We will need to grow this
11126         as required.
11127
11128         * expression.cs (Invocation::GetParameterData): implement a cache
11129         and a wrapper around the ParameterData creation for methods. 
11130         (Invocation::OverloadResolve): Use new code.
11131
11132 2001-09-13  Ravi Pratap  <ravi@ximian.com>
11133
11134         * class.cs (TypeContainer::EmitField): Remove and move into 
11135         (Field::Define): here and modify accordingly.
11136         (Field.FieldBuilder): New member.
11137         (TypeContainer::Populate): Update accordingly.
11138         (TypeContainer::FindMembers): Implement.
11139
11140 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11141
11142         * statement.cs: (VariableInfo::VariableType): New field to be
11143         initialized with the full type once it is resolved. 
11144
11145 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
11146
11147         * parameter.cs (GetParameterInfo): Use a type cache to compute
11148         things only once, and to reuse this information
11149
11150         * expression.cs (LocalVariableReference::Emit): Implement.
11151         (OpcodeCast::Emit): fix.
11152
11153         (ParameterReference::Resolve): Implement.
11154         (ParameterReference::Emit): Implement.
11155
11156         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
11157         that are expressions need to stay as Expressions.
11158
11159         * typemanager.cs (CSharpName): Returns the C# name of a type if
11160         possible. 
11161
11162         * expression.cs (Expression::ConvertImplicit): New function that
11163         implements implicit type conversions.
11164
11165         (Expression::ImplicitReferenceConversion): Implements implicit
11166         reference conversions.
11167
11168         (EmptyCast): New type for transparent casts.
11169
11170         (OpcodeCast): New type for casts of types that are performed with
11171         a sequence of bytecodes.
11172         
11173         (BoxedCast): New type used for casting value types into reference
11174         types.  Emits a box opcode.
11175
11176         (Binary::DoNumericPromotions): Implements numeric promotions of
11177         and computation of the Binary::Type.
11178
11179         (Binary::EmitBranchable): Optimization.
11180
11181         (Binary::Emit): Implement code emission for expressions.
11182         
11183         * typemanager.cs (TypeManager): Added two new core types: sbyte
11184         and byte.
11185
11186 2001-09-12  Ravi Pratap  <ravi@ximian.com>
11187
11188         * class.cs (TypeContainer::FindMembers): Method which does exactly
11189         what Type.FindMembers does, only we don't have to use reflection. No
11190         implementation yet.
11191
11192         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
11193         typecontainer objects as we need to get at them.
11194         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
11195
11196         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
11197         typecontainer object.
11198
11199         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
11200         of just a Report object.
11201
11202 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11203
11204         * class.cs (Event::Define): Go back to using the prefixes "add_" and
11205         "remove_"
11206         (TypeContainer::Populate): Now define the delegates of the type too.
11207         (TypeContainer.Delegates): Property to access the list of delegates defined
11208         in the type.
11209
11210         * delegates.cs (Delegate::Define): Implement partially.
11211
11212         * modifiers.cs (TypeAttr): Handle more flags.
11213
11214 2001-09-11  Ravi Pratap  <ravi@ximian.com>
11215
11216         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
11217         and not <=
11218         (Operator::Define): Re-write logic to get types by using the LookupType method
11219         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
11220         (Indexer::Define): Ditto.
11221         (Event::Define): Ditto.
11222         (Property::Define): Ditto.
11223         
11224 2001-09-10  Ravi Pratap  <ravi@ximian.com>
11225
11226         * class.cs (TypeContainer::Populate): Now define operators too. 
11227         (TypeContainer.Operators): New property to access the list of operators
11228         in a type.
11229         (Operator.OperatorMethodBuilder): New member to hold the method builder
11230         for the operator we are defining.
11231         (Operator::Define): Implement.
11232
11233 2001-09-10  Ravi Pratap  <ravi@ximian.com>
11234
11235         * class.cs (Event::Define): Make the prefixes of the accessor methods
11236         addOn_ and removeOn_ 
11237
11238         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
11239         of the location being passed in too. Ideally, this should go later since all
11240         error reporting should be done through the Report object.
11241
11242         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
11243         (Populate): Iterate thru the indexers we have and define them too.
11244         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
11245         for the get and set accessors.
11246         (Indexer::Define): Implement.
11247         
11248 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
11249
11250         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
11251         my previous implementation, did not work.
11252
11253         * typemanager.cs: Add a couple of missing types (the longs).
11254
11255         * literal.cs: Use TypeManager.bool_type instead of getting it.
11256
11257         * expression.cs (EventExpr): New kind of expressions.
11258         (Expressio::ExprClassFromMemberInfo): finish
11259
11260 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
11261
11262         * assign.cs: Emit stores to static fields differently.
11263
11264 2001-09-08  Ravi Pratap  <ravi@ximian.com>
11265
11266         * Merge in changes and adjust code to tackle conflicts. Backed out my
11267         code in Assign::Resolve ;-) 
11268
11269 2001-09-08  Ravi Pratap  <ravi@ximian.com>
11270
11271         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
11272         instead Report.Error and also pass in the location.
11273         (CSharpParser::Lexer): New readonly property to return the reference
11274         to the Tokenizer object.
11275         (declare_local_variables): Use Report.Error with location instead of plain 
11276         old error.
11277         (CheckDef): Ditto.
11278
11279         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
11280         (Operator.CheckBinaryOperator): Ditto.
11281
11282         * cs-parser.jay (operator_declarator): Update accordingly.
11283
11284         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
11285         (CheckBinaryOperator): Same here.
11286
11287         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
11288         on the name without any prefixes of namespace names etc. This is because we
11289         already might have something already fully qualified like 
11290         'System.Console.WriteLine'
11291
11292         * assign.cs (Resolve): Begin implementation. Stuck ;-)
11293
11294 2001-09-07  Ravi Pratap  <ravi@ximian.com>
11295
11296         * cs-tokenizer.cs (location): Return a string which also contains
11297         the file name.
11298
11299         * expression.cs (ElementAccess): New class for expressions of the
11300         type 'element access.'
11301         (BaseAccess): New class for expressions of the type 'base access.'
11302         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
11303         respectively.
11304         
11305         * cs-parser.jay (element_access): Implement action.
11306         (base_access): Implement actions.
11307         (checked_expression, unchecked_expression): Implement.
11308
11309         * cs-parser.jay (local_variable_type): Correct and implement.
11310         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
11311
11312         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
11313
11314         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
11315         name and the specifiers.
11316
11317         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
11318         
11319         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
11320         making them all public ;-)
11321
11322         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
11323         class anyways.
11324         
11325 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
11326
11327         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
11328         PropertyExprs.
11329         (FieldExpr, PropertyExprs): New resolved expressions.
11330         (SimpleName::MemberStaticCheck): Perform static checks for access
11331         to non-static fields on static methods. Maybe this should be
11332         generalized for MemberAccesses. 
11333         (SimpleName::ResolveSimpleName): More work on simple name
11334         resolution. 
11335
11336         * cs-parser.jay (primary_expression/qualified_identifier): track
11337         the parameter index.
11338
11339         * codegen.cs (CodeGen::Save): Catch save exception, report error.
11340         (EmitContext::EmitBoolExpression): Chain to expression generation
11341         instead of temporary hack.
11342         (::EmitStatementExpression): Put generic expression code generation.
11343
11344         * assign.cs (Assign::Emit): Implement variable assignments to
11345         local variables, parameters and fields.
11346
11347 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
11348
11349         * statement.cs (Block::GetVariableInfo): New method, returns the
11350         VariableInfo for a variable name in a block.
11351         (Block::GetVariableType): Implement in terms of GetVariableInfo
11352
11353         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
11354         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
11355
11356 2001-09-06  Ravi Pratap  <ravi@ximian.com>
11357
11358         * cs-parser.jay (operator_declaration): Continue on my quest : update
11359         to take attributes argument.
11360         (event_declaration): Ditto.
11361         (enum_declaration): Ditto.
11362         (indexer_declaration): Ditto.
11363         
11364         * class.cs (Operator::Operator): Update constructor accordingly.
11365         (Event::Event): Ditto.
11366
11367         * delegate.cs (Delegate::Delegate): Same here.
11368
11369         * enum.cs (Enum::Enum): Same here.
11370         
11371 2001-09-05  Ravi Pratap  <ravi@ximian.com>
11372
11373         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
11374
11375         * ../tests/cs0658.cs : New file to demonstrate error 0658.
11376
11377         * attribute.cs (Attributes): New class to encapsulate all attributes which were
11378         being passed around as an arraylist.
11379         (Attributes::AddAttribute): Method to add attribute sections.
11380
11381         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
11382         (struct_declaration): Update accordingly.
11383         (constant_declaration): Update.
11384         (field_declaration): Update.
11385         (method_header): Update.
11386         (fixed_parameter): Update.
11387         (parameter_array): Ditto.
11388         (property_declaration): Ditto.
11389         (destructor_declaration): Ditto.
11390         
11391         * class.cs (Struct::Struct): Update constructors accordingly.
11392         (Class::Class): Ditto.
11393         (Field::Field): Ditto.
11394         (Method::Method): Ditto.
11395         (Property::Property): Ditto.
11396         (TypeContainer::OptAttribute): update property's return type.
11397         
11398         * interface.cs (Interface.opt_attributes): New member.
11399         (Interface::Interface): Update to take the extra Attributes argument.
11400
11401         * parameter.cs (Parameter::Parameter): Ditto.
11402
11403         * constant.cs (Constant::Constant): Ditto.
11404
11405         * interface.cs (InterfaceMemberBase): New OptAttributes field.
11406         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
11407         the attributes as a parameter.
11408         (InterfaceProperty): Update constructor call.
11409         (InterfaceEvent): Ditto.
11410         (InterfaceMethod): Ditto.
11411         (InterfaceIndexer): Ditto.
11412
11413         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
11414         pass the attributes too.
11415         (interface_event_declaration): Ditto.
11416         (interface_property_declaration): Ditto.
11417         (interface_method_declaration): Ditto.
11418         (interface_declaration): Ditto.
11419
11420 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
11421
11422         * class.cs (Method::Define): Track the "static Main" definition to
11423         create an entry point. 
11424
11425         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
11426         EntryPoint if we find it. 
11427
11428         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
11429         (EmitContext::ig): Make this variable public.
11430
11431         * driver.cs: Make the default output file be the first file name
11432         with the .exe extension.  
11433
11434         Detect empty compilations
11435
11436         Handle various kinds of output targets.  Handle --target and
11437         rename -t to --dumper.
11438
11439         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
11440         methods inherited from Expression return now an Expression.  This
11441         will is used during the tree rewriting as we resolve them during
11442         semantic analysis.
11443
11444         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
11445         the spec.  Missing entirely is the information about
11446         accessability of elements of it.
11447
11448         (Expression::ExprClassFromMemberInfo): New constructor for
11449         Expressions that creates a fully initialized Expression based on
11450         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
11451         a Type.
11452
11453         (Invocation::Resolve): Begin implementing resolution of invocations.
11454         
11455         * literal.cs (StringLiteral):  Implement Emit.
11456
11457 2001-09-05  Ravi Pratap  <ravi@ximian.com>
11458
11459         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
11460         member.
11461         
11462 2001-09-04  Ravi Pratap  <ravi@ximian.com>
11463
11464         * cs-parser.jay (attribute_arguments): Implement actions.
11465         (attribute): Fix bug in production. Implement action.
11466         (attribute_list): Implement.
11467         (attribute_target): Implement.
11468         (attribute_target_specifier, opt_target_specifier): Implement
11469         (CheckAttributeTarget): New method to check if the attribute target
11470         is valid.
11471         (attribute_section): Implement.
11472         (opt_attributes): Implement.
11473
11474         * attribute.cs : New file to handle attributes.
11475         (Attribute): Class to hold attribute info.
11476
11477         * cs-parser.jay (opt_attribute_target_specifier): Remove production
11478         (attribute_section): Modify production to use 2 different rules to 
11479         achieve the same thing. 1 s/r conflict down !
11480         Clean out commented, useless, non-reducing dimension_separator rules.
11481         
11482         * class.cs (TypeContainer.attributes): New member to hold list
11483         of attributes for a type.
11484         (Struct::Struct): Modify to take one more argument, the attribute list.
11485         (Class::Class): Ditto.
11486         (Field::Field): Ditto.
11487         (Method::Method): Ditto.
11488         (Property::Property): Ditto.
11489         
11490         * cs-parser.jay (struct_declaration): Update constructor call to
11491         pass in the attributes too.
11492         (class_declaration): Ditto.
11493         (constant_declaration): Ditto.
11494         (field_declaration): Ditto.
11495         (method_header): Ditto.
11496         (fixed_parameter): Ditto.
11497         (parameter_array): Ditto.
11498         (property_declaration): Ditto.
11499
11500         * constant.cs (Constant::Constant): Update constructor similarly.
11501         Use System.Collections.
11502
11503         * parameter.cs (Parameter::Parameter): Update as above.
11504
11505 2001-09-02  Ravi Pratap  <ravi@ximian.com>
11506
11507         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
11508         (TypeContainer.delegates): New member to hold list of delegates.
11509
11510         * cs-parser.jay (delegate_declaration): Implement the action correctly 
11511         this time as I seem to be on crack ;-)
11512
11513 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
11514
11515         * rootcontext.cs (RootContext::IsNamespace): new function, used to
11516         tell whether an identifier represents a namespace.
11517
11518         * expression.cs (NamespaceExpr): A namespace expression, used only
11519         temporarly during expression resolution.
11520         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
11521         utility functions to resolve names on expressions.
11522
11523 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
11524
11525         * codegen.cs: Add hook for StatementExpressions. 
11526
11527         * class.cs: Fix inverted test for static flag in methods.
11528
11529 2001-09-02  Ravi Pratap  <ravi@ximian.com>
11530
11531         * class.cs (Operator::CheckUnaryOperator): Correct error number used
11532         to make it coincide with MS' number.
11533         (Operator::CheckBinaryOperator): Ditto.
11534
11535         * ../errors/errors.txt : Remove error numbers added earlier.
11536
11537         * ../errors/cs1019.cs : Test case for error # 1019
11538
11539         * ../errros/cs1020.cs : Test case for error # 1020
11540
11541         * cs-parser.jay : Clean out commented cruft.
11542         (dimension_separators, dimension_separator): Comment out. Ostensibly not
11543         used anywhere - non-reducing rule.
11544         (namespace_declarations): Non-reducing rule - comment out.
11545
11546         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
11547         with TypeContainer::AddEnum.
11548
11549         * delegate.cs : New file for delegate handling classes.
11550         (Delegate): Class for declaring delegates.
11551
11552         * makefile : Update.
11553
11554         * cs-parser.jay (delegate_declaration): Implement.
11555
11556 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
11557
11558         * class.cs (Event::Define): Implement.
11559         (Event.EventBuilder): New member.
11560
11561         * class.cs (TypeContainer::Populate): Update to define all enums and events
11562         we have.
11563         (Events): New property for the events arraylist we hold. Shouldn't we move to using
11564         readonly fields for all these cases ?
11565
11566 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
11567
11568         * class.cs (Property): Revamp to use the convention of making fields readonly.
11569         Accordingly modify code elsewhere.
11570
11571         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
11572         the Define method of the Property class.
11573
11574         * class.cs : Clean up applied patch and update references to variables etc. Fix 
11575         trivial bug.
11576         (TypeContainer::Populate): Update to define all the properties we have. Also
11577         define all enumerations.
11578
11579         * enum.cs (Define): Implement.
11580         
11581 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
11582
11583         * cs-parser.jay (overloadable_operator): The semantic value is an
11584         enum of the Operator class.
11585         (operator_declarator): Implement actions.
11586         (operator_declaration): Implement.
11587
11588         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
11589         validity of definitions.
11590         (Operator::CheckBinaryOperator): Static method to check for binary operators
11591         (TypeContainer::AddOperator): New method to add an operator to a type.
11592
11593         * cs-parser.jay (indexer_declaration): Added line to actually call the
11594         AddIndexer method so it gets added ;-)
11595
11596         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
11597         already taken care of by the MS compiler ?  
11598
11599 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
11600
11601         * class.cs (Operator): New class for operator declarations.
11602         (Operator::OpType): Enum for the various operators.
11603
11604 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
11605
11606         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
11607         ostensibly handle this in semantic analysis.
11608
11609         * cs-parser.jay (general_catch_clause): Comment out
11610         (specific_catch_clauses, specific_catch_clause): Ditto.
11611         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
11612         (catch_args, opt_catch_args): New productions.
11613         (catch_clause): Rewrite to use the new productions above
11614         (catch_clauses): Modify accordingly.
11615         (opt_catch_clauses): New production to use in try_statement
11616         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
11617         and re-write the code in the actions to extract the specific and
11618         general catch clauses by being a little smart ;-)
11619
11620         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
11621         Hooray, try and catch statements parse fine !
11622         
11623 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11624
11625         * statement.cs (Block::GetVariableType): Fix logic to extract the type
11626         string from the hashtable of variables.
11627
11628         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
11629         I end up making that mistake ;-)
11630         (catch_clauses): Fixed gross error which made Key and Value of the 
11631         DictionaryEntry the same : $1 !!
11632
11633 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11634
11635         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
11636
11637         * cs-parser.jay (event_declaration): Correct to remove the semicolon
11638         when the add and remove accessors are specified. 
11639
11640 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
11641
11642         * cs-parser.jay (IndexerDeclaration): New helper class to hold
11643         information about indexer_declarator.
11644         (indexer_declarator): Implement actions.
11645         (parsing_indexer): New local boolean used to keep track of whether
11646         we are parsing indexers or properties. This is necessary because 
11647         implicit_parameters come into picture even for the get accessor in the 
11648         case of an indexer.
11649         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
11650
11651         * class.cs (Indexer): New class for indexer declarations.
11652         (TypeContainer::AddIndexer): New method to add an indexer to a type.
11653         (TypeContainer::indexers): New member to hold list of indexers for the
11654         type.
11655
11656 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
11657
11658         * cs-parser.jay (add_accessor_declaration): Implement action.
11659         (remove_accessor_declaration): Implement action.
11660         (event_accessors_declaration): Implement
11661         (variable_declarators): swap statements for first rule - trivial.
11662
11663         * class.cs (Event): New class to hold information about event
11664         declarations.
11665         (TypeContainer::AddEvent): New method to add an event to a type
11666         (TypeContainer::events): New member to hold list of events.
11667
11668         * cs-parser.jay (event_declaration): Implement actions.
11669
11670 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
11671
11672         * cs-parser.jay (dim_separators): Implement. Make it a string
11673         concatenating all the commas together, just as they appear.
11674         (opt_dim_separators): Modify accordingly
11675         (rank_specifiers): Update accordingly. Basically do the same
11676         thing - instead, collect the brackets here.
11677         (opt_rank_sepcifiers): Modify accordingly.
11678         (array_type): Modify to actually return the complete type string
11679         instead of ignoring the rank_specifiers.
11680         (expression_list): Implement to collect the expressions
11681         (variable_initializer): Implement. We make it a list of expressions
11682         essentially so that we can handle the array_initializer case neatly too.
11683         (variable_initializer_list): Implement.
11684         (array_initializer): Make it a list of variable_initializers
11685         (opt_array_initializer): Modify accordingly.
11686
11687         * expression.cs (New::NType): Add enumeration to help us
11688         keep track of whether we have an object/delegate creation
11689         or an array creation.
11690         (New:NewType, New::Rank, New::Indices, New::Initializers): New
11691         members to hold data about array creation.
11692         (New:New): Modify to update NewType
11693         (New:New): New Overloaded contructor for the array creation
11694         case.
11695
11696         * cs-parser.jay (array_creation_expression): Implement to call
11697         the overloaded New constructor.
11698         
11699 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
11700
11701         * class.cs (TypeContainer::Constructors): Return member
11702         constructors instead of returning null.
11703
11704 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
11705
11706         * typemanager.cs (InitCoreTypes): Initialize the various core
11707         types after we have populated the type manager with the user
11708         defined types (this distinction will be important later while
11709         compiling corlib.dll)
11710
11711         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
11712         on Expression Classification.  Now all expressions have a method
11713         `Resolve' and a method `Emit'.
11714
11715         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
11716         generation from working.     Also add some temporary debugging
11717         code. 
11718         
11719 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
11720
11721         * codegen.cs: Lots of code generation pieces.  This is only the
11722         beginning, will continue tomorrow with more touches of polish.  We
11723         handle the fundamentals of if, while, do, for, return.  Others are
11724         trickier and I need to start working on invocations soon.
11725         
11726         * gen-treedump.cs: Bug fix, use s.Increment here instead of
11727         s.InitStatement. 
11728
11729         * codegen.cs (EmitContext): New struct, used during code
11730         emission to keep a context.   Most of the code generation will be
11731         here. 
11732
11733         * cs-parser.jay: Add embedded blocks to the list of statements of
11734         this block.  So code generation proceeds in a top down fashion.
11735
11736 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
11737
11738         * statement.cs: Add support for multiple child blocks.
11739
11740 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
11741
11742         * codegen.cs (EmitCode): New function, will emit the code for a
11743         Block of code given a TypeContainer and its ILGenerator. 
11744
11745         * statement.cs (Block): Standard public readonly optimization.
11746         (Block::Block constructors): Link children. 
11747         (Block::Child): Child Linker.
11748         (Block::EmitVariables): Emits IL variable declarations.
11749
11750         * class.cs: Drop support for MethodGroups here, delay until
11751         Semantic Analysis.
11752         (Method::): Applied the same simplification that I did before, and
11753         move from Properties to public readonly fields.
11754         (Method::ParameterTypes): Returns the parameter types for the
11755         function, and implements a cache that will be useful later when I
11756         do error checking and the semantic analysis on the methods is
11757         performed.
11758         (Constructor::GetCallingConvention): Renamed from CallingConvetion
11759         and made a method, optional argument tells whether this is a class
11760         or a structure to apply the `has-this' bit.
11761         (Method::GetCallingConvention): Implement, returns the calling
11762         convention. 
11763         (Method::Define): Defines the type, a second pass is performed
11764         later to populate the methods.
11765
11766         (Constructor::ParameterTypes): implement a cache similar to the
11767         one on Method::ParameterTypes, useful later when we do semantic
11768         analysis. 
11769
11770         (TypeContainer::EmitMethod):  New method.  Emits methods.
11771
11772         * expression.cs: Removed MethodGroup class from here.
11773         
11774         * parameter.cs (Parameters::GetCallingConvention): new method.
11775
11776 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
11777
11778         * class.cs (TypeContainer::Populate): Drop RootContext from the
11779         argument. 
11780
11781         (Constructor::CallingConvention): Returns the calling convention.
11782         (Constructor::ParameterTypes): Returns the constructor parameter
11783         types. 
11784         
11785         (TypeContainer::AddConstructor): Keep track of default constructor
11786         and the default static constructor.
11787
11788         (Constructor::) Another class that starts using `public readonly'
11789         instead of properties. 
11790
11791         (Constructor::IsDefault): Whether this is a default constructor. 
11792
11793         (Field::) use readonly public fields instead of properties also.
11794
11795         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
11796         track of static constructors;  If none is used, turn on
11797         BeforeFieldInit in the TypeAttributes. 
11798
11799         * cs-parser.jay (opt_argument_list): now the return can be null
11800         for the cases where there are no arguments. 
11801
11802         (constructor_declarator): If there is no implicit `base' or
11803         `this', then invoke the default parent constructor. 
11804         
11805         * modifiers.cs (MethodAttr): New static function maps a set of
11806         modifiers flags into a MethodAttributes enum
11807         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
11808         MethodAttr, TypeAttr to represent the various mappings where the
11809         modifiers are used.
11810         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
11811
11812 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
11813
11814         * parameter.cs (GetParameterInfo): Fix bug where there would be no
11815         method arguments.
11816
11817         * interface.cs (PopulateIndexer): Implemented the code generator
11818         for interface indexers.
11819
11820 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
11821
11822         * interface.cs (InterfaceMemberBase): Now we track the new status
11823         here.  
11824
11825         (PopulateProperty): Implement property population.  Woohoo!  Got
11826         Methods and Properties going today. 
11827
11828         Removed all the properties for interfaces, and replaced them with
11829         `public readonly' fields. 
11830
11831 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
11832
11833         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
11834         initialize their hashtables/arraylists only when they are needed
11835         instead of doing this always.
11836
11837         * parameter.cs: Handle refs and out parameters.
11838
11839         * cs-parser.jay: Use an ArrayList to construct the arguments
11840         instead of the ParameterCollection, and then cast that to a
11841         Parameter[] array.
11842
11843         * parameter.cs: Drop the use of ParameterCollection and use
11844         instead arrays of Parameters.
11845
11846         (GetParameterInfo): Use the Type, not the Name when resolving
11847         types. 
11848
11849 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
11850
11851         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
11852         and instead use public readonly fields.
11853
11854         * class.cs: Put back walking code for type containers.
11855
11856 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
11857
11858         * class.cs (MakeConstant): Code to define constants.
11859
11860         * rootcontext.cs (LookupType): New function.  Used to locate types 
11861
11862         
11863 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
11864
11865         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
11866         this System.Reflection code is.  Kudos to Microsoft
11867         
11868         * typemanager.cs: Implement a type cache and avoid loading all
11869         types at boot time.  Wrap in LookupType the internals.  This made
11870         the compiler so much faster.  Wow.  I rule!
11871         
11872         * driver.cs: Make sure we always load mscorlib first (for
11873         debugging purposes, nothing really important).
11874
11875         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
11876         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
11877
11878         * rootcontext.cs: Lookup types on their namespace;  Lookup types
11879         on namespaces that have been imported using the `using' keyword.
11880
11881         * class.cs (TypeContainer::TypeAttr): Virtualize.
11882         (Class::TypeAttr): Return attributes suitable for this bad boy.
11883         (Struct::TypeAttr): ditto.
11884         Handle nested classes.
11885         (TypeContainer::) Remove all the type visiting code, it is now
11886         replaced with the rootcontext.cs code
11887
11888         * rootcontext.cs (GetClassBases): Added support for structs. 
11889
11890 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
11891
11892         * interface.cs, statement.cs, class.cs, parameter.cs,
11893         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
11894         Drop use of TypeRefs, and use strings instead.
11895
11896 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
11897
11898         * rootcontext.cs: 
11899
11900         * class.cs (Struct::Struct): set the SEALED flags after
11901         checking the modifiers.
11902         (TypeContainer::TypeAttr): new property, returns the
11903         TypeAttributes for a class.  
11904
11905         * cs-parser.jay (type_list): Oops, list production was creating a
11906         new list of base types.
11907
11908         * rootcontext.cs (StdLib): New property.
11909         (GetInterfaceTypeByName): returns an interface by type name, and
11910         encapsulates error handling here.
11911         (GetInterfaces): simplified.
11912         (ResolveTree): Encapsulated all the tree resolution here.
11913         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
11914         types. 
11915         
11916         * driver.cs: Add support for --nostdlib, to avoid loading the
11917         default assemblies.
11918         (Main): Do not put tree resolution here. 
11919
11920         * rootcontext.cs: Beginning of the class resolution.
11921
11922 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
11923
11924         * rootcontext.cs: Provide better error reporting. 
11925
11926         * cs-parser.jay (interface_base): set our $$ to be interfaces.
11927
11928         * rootcontext.cs (CreateInterface): Handle the case where there
11929         are no parent interfaces.
11930         
11931         (CloseTypes): Routine to flush types at the end.
11932         (CreateInterface): Track types.
11933         (GetInterfaces): Returns an array of Types from the list of
11934         defined interfaces.
11935
11936         * typemanager.c (AddUserType): Mechanism to track user types (puts
11937         the type on the global type hash, and allows us to close it at the
11938         end). 
11939         
11940 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
11941
11942         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
11943         RecordInterface instead.
11944
11945         * cs-parser.jay: Updated to reflect changes above.
11946
11947         * decl.cs (Definition): Keep track of the TypeBuilder type that
11948         represents this type here.  Not sure we will use it in the long
11949         run, but wont hurt for now.
11950
11951         * driver.cs: Smaller changes to accomodate the new code.
11952
11953         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
11954         when done. 
11955
11956         * rootcontext.cs (CreateInterface):  New method, used to create
11957         the System.TypeBuilder type for interfaces.
11958         (ResolveInterfaces): new entry point to resolve the interface
11959         hierarchy. 
11960         (CodeGen): Property, used to keep track of the code generator.
11961
11962 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
11963
11964         * cs-parser.jay: Add a second production for delegate_declaration
11965         with `VOID'.
11966
11967         (enum_body): Put an opt_comma here instead of putting it on
11968         enum_body or enum_member_declarations so we can handle trailing
11969         commas on enumeration members.  Gets rid of a shift/reduce.
11970         
11971         (type_list): Need a COMMA in the middle.
11972
11973         (indexer_declaration): Tell tokenizer to recognize get/set
11974
11975         * Remove old targets.
11976
11977         * Re-add the parser target.
11978
11979 2001-07-13  Simon Cozens <simon@simon-cozens.org>
11980
11981         * cs-parser.jay: Add precendence rules for a number of operators
11982         ot reduce the number of shift/reduce conflicts in the grammar.
11983         
11984 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
11985
11986         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
11987         and put it here.
11988
11989         Get rid of old crufty code.
11990
11991         * rootcontext.cs: Use this to keep track of the parsed
11992         representation and the defined types available to the program. 
11993
11994         * gen-treedump.cs: adjust for new convention.
11995
11996         * type.cs: Split out the type manager, and the assembly builder
11997         from here. 
11998
11999         * typemanager.cs: the type manager will live here now.
12000
12001         * cil-codegen.cs: And the code generator here. 
12002
12003 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
12004
12005         * makefile: Fixed up for easy making.
12006
12007 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12008
12009         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12010         the 
12011
12012         (unary_expression): Expand pre_increment_expression and
12013         post_decrement_expression to reduce a shift/reduce.
12014
12015 2001-07-11  Simon Cozens
12016
12017         * cs-tokenizer.cs: Hex numbers should begin with a 0.
12018
12019         Improve allow_keyword_as_indent name.
12020
12021 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
12022
12023         * Adjustments for Beta2. 
12024
12025 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
12026
12027         * decl.cs: Added `Define' abstract method.
12028         (InTransit): new property, used to catch recursive definitions. 
12029
12030         * interface.cs: Implement `Define'. 
12031
12032         * modifiers.cs: Map Modifiers.constants to
12033         System.Reflection.TypeAttribute flags.
12034
12035         * class.cs: Keep track of types and user-defined types.
12036         (BuilderInit): New method for creating an assembly
12037         (ResolveType): New function to launch the resolution process, only
12038         used by interfaces for now.
12039
12040         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12041         that are inserted into the name space. 
12042
12043 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
12044
12045         * ARGH.  I have screwed up my tree so many times due to the use of
12046         rsync rather than using CVS.  Going to fix this at once. 
12047
12048         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
12049         load types.
12050
12051 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
12052
12053         * Experiment successful: Use System.Type rather that our own
12054         version of Type.  
12055
12056 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
12057
12058         * cs-parser.jay: Removed nsAliases from here.
12059
12060         Use new namespaces, handle `using XXX;' 
12061
12062         * namespace.cs: Reimplemented namespace handling, use a recursive
12063         definition of the class.  Now we can keep track of using clauses
12064         and catch invalid using clauses.
12065
12066 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
12067
12068         * gen-treedump.cs: Adapted for all the renaming.
12069
12070         * expression.cs (Expression): this class now has a Type property
12071         which returns an expression Type.
12072
12073         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12074         `Type', as this has a different meaning now in the base
12075
12076 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
12077
12078         * interface.cs, class.cs: Removed from all the sources the
12079         references to signature computation, as we can not do method
12080         signature computation during the parsing time, as we are not
12081         trying to solve at that point distinguishing:
12082
12083         class X {
12084                 void a (Blah x) {}
12085                 void a (NS.Blah x) {}
12086         }
12087
12088         Which depending on the context might be valid or not, as we do not
12089         know if Blah is the same thing as NS.Blah at that point.
12090
12091         * Redid everything so the code uses TypeRefs now instead of
12092         Types.  TypeRefs are just temporary type placeholders, that need
12093         to be resolved.  They initially have a pointer to a string and the
12094         current scope in which they are used.  This is used later by the
12095         compiler to resolve the reference to an actual Type. 
12096
12097         * DeclSpace is no longer a CIR.Type, and neither are
12098         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
12099         are all DeclSpaces, but no Types. 
12100
12101         * type.cs (TypeRefManager): This implements the TypeRef manager,
12102         which keeps track of all the types that need to be resolved after
12103         the parsing has finished. 
12104
12105 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
12106
12107         * ARGH.  We are going to have to store `foreach' as a class rather
12108         than resolving it, as we need to verify error 1579 after name
12109         resolution.   *OR* we could keep a flag that says `This request to
12110         IEnumerator comes from a foreach statement' which we can then use
12111         to generate the error.
12112
12113 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
12114
12115         * class.cs (TypeContainer.AddMethod): we now add methods to the
12116         MethodGroup instead of the method hashtable.  
12117
12118         * expression.cs: Add MethodGroup abstraction, which gets us one
12119         step closer to the specification in the way we handle method
12120         declarations.  
12121
12122         * cs-parser.jay (primary_expression): qualified_identifier now
12123         tried to match up an identifier to a local variable reference or
12124         to a parameter reference.
12125
12126         current_local_parameters is now a parser global variable that
12127         points to the current parameters for the block, used during name
12128         lookup.
12129
12130         (property_declaration): Now creates an implicit `value' argument to
12131         the set accessor.
12132
12133 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
12134
12135         * parameter.cs: Do not use `param' arguments as part of the
12136         signature, per the spec.
12137
12138 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
12139
12140         * decl.cs: Base class for classes, structs and interfaces.  This
12141         is the "Declaration Space" 
12142
12143         * cs-parser.jay: Use CheckDef for checking declaration errors
12144         instead of having one on each function.
12145
12146         * class.cs: Factor out some code for handling error handling in
12147         accordance to the "Declarations" section in the "Basic Concepts"
12148         chapter in the ECMA C# spec.
12149
12150         * interface.cs: Make all interface member classes derive from
12151         InterfaceMemberBase.
12152
12153 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
12154
12155         * Many things: all interfaces are parsed and generated in
12156         gen-treedump.  Support for member variables, constructors,
12157         destructors, properties, constants is there.
12158
12159         Beginning of the IL backend, but very little done, just there for
12160         testing purposes. 
12161
12162 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
12163
12164         * cs-parser.jay: Fix labeled statement.
12165
12166         * cs-tokenizer.cs (escape): Escape " and ' always.
12167         ref_line, ref_name: keep track of the line/filename as instructed
12168         by #line by the compiler.
12169         Parse #line.
12170
12171 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
12172
12173         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
12174         to match the values in System.CodeDOM.
12175
12176         Divid renamed to Divide.
12177
12178         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
12179         statements. 
12180         (Statements.set): remove.
12181
12182         * System.CodeDOM/CodeCatchClause.cs: always have a valid
12183         statements. 
12184
12185         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
12186         falseStatements always have valid values. 
12187
12188         * cs-parser.jay: Use System.CodeDOM now.
12189