2004-06-03 Marek Safar <marek.safar@seznam.cz>
[mono.git] / mcs / mcs / ChangeLog
1 2004-06-03  Marek Safar  <marek.safar@seznam.cz>
2
3         * attribute.cs
4         (GetConditionalAttributeValue): New method. Returns
5         condition of ConditionalAttribute.
6         (SearchMulti): New method.  Returns all attributes of type 't'.
7         Use it when attribute is AllowMultiple = true.
8         (IsConditionalMethodExcluded): New method.
9
10         * class.cs
11         (Method.IsExcluded): Implemented. Returns true if method has conditional
12         attribute and the conditions is not defined (method is excluded).
13         (IMethodData): Extended interface for ConditionalAttribute support.
14         (PropertyMethod.IsExcluded): Implemented.
15
16         * decl.cs
17         (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
18
19         * expression.cs
20         (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
21         on the method.
22
23 2004-06-02 Ben Maurer  <bmaurer@users.sourceforge.net>
24
25         * expression.cs (ArrayCreationExpression): Make this just an
26         `expression'. It can't be a statement, so the code here was
27         dead.
28
29 2004-06-02  Marek Safar  <marek.safar@seznam.cz>
30
31         Fixed #59072
32         * typemanager.cs (GetFullNameSignature): New method for
33         MethodBase types.
34
35 2004-06-02  Marek Safar  <marek.safar@seznam.cz>
36
37         Fixed #56452
38         * class.cs (MemberBase.GetSignatureForError): New virtual method.
39         Use this method when MethodBuilder is null.
40         (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
41         Added test for error CS0626 (MONO reports error for this situation).
42         (IMethodData.GetSignatureForError): Extended interface.
43
44 2004-06-01  Marek Safar  <marek.safar@seznam.cz>
45
46         * attribute.cs
47         (AttributeTester.GetObsoleteAttribute): Returns instance of
48         ObsoleteAttribute when type is obsolete.
49
50         * class.cs
51         (TypeContainer.VerifyObsoleteAttribute): Override.
52         (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
53         (MethodCode.VerifyObsoleteAttribute): Override.
54         (MemberBase.VerifyObsoleteAttribute): Override.
55
56         * decl.cs
57         (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
58         and report proper error.
59
60         *delegate.cs
61         Delegate.VerifyObsoleteAttribute): Override.
62
63         * ecore.cs
64         (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
65         and report proper error.
66         (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
67
68         * enum.cs
69         (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
70         and enum member.
71
72         * expression.cs
73         (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
74         New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
75         Added test for ObsoleteAttribute.
76
77         * statement.cs
78         (Catch): Derived from Statement.
79
80 2004-06-01  Marek Safar  <marek.safar@seznam.cz>
81  
82         Fixed bug #59071 & cs0160.cs
83  
84         * statement.cs (Try.Resolve): Check here whether order of catch
85         clauses matches their dependencies.
86
87 2004-05-31  Miguel de Icaza  <miguel@ximian.com>
88
89         * Reverted patch to namespace.cs (Use lookuptypedirect).  This
90         caused a regression: #59343.  Referencing nested classes from an
91         assembly stopped working.
92
93 2004-05-31  Martin Baulig  <martin@ximian.com>
94
95         MCS is now frozen for beta 2.
96
97 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
98
99         * convert.cs: add a trivial cache for overload operator resolution.
100
101 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
102
103         * decl.cs: If possible, use lookuptypedirect here. We can only do
104         this if there is no `.' after the namespace. Avoids using
105         LookupType, which does lots of slow processing.
106         (FindNestedType) New method, does what it says :-).
107         * namespace.cs: use LookupTypeDirect.
108         * rootcontext.cs: use membercache, if possible.
109         * typemanager.cs (LookupTypeDirect): Cache negative hits too.
110
111 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
112
113         * expression.cs:
114         According to the spec, 
115
116         In a member access of the form E.I, if E is a single identifier,
117         and if the meaning of E as a simple-name (§7.5.2) is a constant,
118         field, property, localvariable, or parameter with the same type as
119         the meaning of E as a type-name (§3.8), then both possible
120         meanings of E are permitted.
121
122         We did not check that E as a simple-name had the same type as E as
123         a type name.
124
125         This trivial check gives us 5-7% on bootstrap time.
126
127 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
128
129         * expression.cs (Invocation.OverloadResolve): Avoid the
130         use of hashtables and boxing here by allocating on demand.
131
132 2004-05-30  Martin Baulig  <martin@ximian.com>
133
134         * rootcontext.cs (RootContext.LookupType): Don't cache things if
135         we're doing a silent lookup.  Don't try to lookup nested types in
136         TypeManager.object_type (thanks to Ben Maurer).
137
138 2004-05-30  Martin Baulig  <martin@ximian.com>
139
140         Committing a patch from Ben Maurer.
141
142         * rootcontext.cs (RootContext.LookupType): Cache negative results.
143
144 2004-05-29  Martin Baulig  <martin@ximian.com>
145
146         * class.cs (IMethodData.ShouldIgnore): New method.
147
148         * typemanager.cs (TypeManager.MethodFlags): Don't take a
149         `Location' argument, we don't need it anywhere.  Use
150         `IMethodData.ShouldIgnore ()' instead of
151         `MethodData.GetMethodFlags ()'.
152         (TypeManager.AddMethod): Removed.
153         (TypeManager.AddMethod2): Renamed to AddMethod.
154
155 2004-05-29  Martin Baulig  <martin@ximian.com>
156
157         Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
158
159         * convert.cs (Convert.ImplicitReferenceConversion): If we're
160         converting from a class type S to an interface type and we already
161         have an object on the stack, don't box it again.  Fixes #52578.
162
163 2004-05-29  Martin Baulig  <martin@ximian.com>
164
165         * class.cs (ConstructorInitializer.GetOverloadedConstructor):
166         Added support for `params' parameters.  Fixes #59267.
167
168 2004-05-29  Martin Baulig  <martin@ximian.com>
169
170         * literal.cs (NullPointer): Provide a private .ctor which sets
171         `type' to TypeManager.object_type.  Fixes #59048.
172
173 2004-05-29  Martin Baulig  <martin@ximian.com>
174
175         * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
176         EventExpr, set `ee.InstanceExpression = left'.  Fixes #59188.
177
178         * ecore.cs (EventExpr.instance_expr): Make the field private.
179
180 2004-05-26  Marek Safar  <marek.safar@seznam.cz>
181
182         Fixed bug #50080 & cs0214-2.cs
183         * expression.cs (Cast.DoResolve): Check unsafe context here.
184         
185         * statement.cs (Resolve.DoResolve): Likewise.
186
187 2004-05-26  Martin Baulig  <martin@ximian.com>
188
189         * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
190
191         * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
192         (RootContext.LookupType): Pass down the `silent' flag.
193
194 2004-05-25  Martin Baulig  <martin@ximian.com>
195
196         * expression.cs
197         (MethodGroupExpr.IdenticalTypeName): New public property.
198         (Invocation.DoResolve): Don't report a CS0176 if the "instance"
199         expression actually refers to a type.
200
201 2004-05-25  Martin Baulig  <martin@ximian.com>
202
203         * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
204         for #56176 and made it actually work.
205
206 2004-05-25  Martin Baulig  <martin@ximian.com>
207
208         * ecore.cs (Expression.CacheTemporaries): Make this virtual.
209         (FieldExpr, PropertyExpr): Override and implement
210         CacheTemporaries.  Fixes #52279.
211
212 2004-05-25  Miguel de Icaza  <miguel@ximian.com>
213
214         * location.cs: In the new compiler listing a file twice is a
215         warning, not an error.
216
217 2004-05-24  Martin Baulig  <martin@ximian.com>
218
219         * enum.cs (Enum.DefineType): For the `BaseType' to be a
220         TypeLookupExpression; otherwise, report a CS1008.  Fixes #58571.
221
222 2004-05-24  Martin Baulig  <martin@ximian.com>
223
224         * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
225         walking the `using' list.  Fixes #53921.
226
227 2004-05-24  Martin Baulig  <martin@ximian.com>
228
229         * const.cs (Const.LookupConstantValue): Added support for
230         EmptyCast's; fixes #55251.
231
232 2004-05-24  Martin Baulig  <martin@ximian.com>
233
234         * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
235         DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
236         which does the CS0135 check.  The reason is that we first need to
237         check whether the variable actually exists.
238
239 2004-05-24  Martin Baulig  <martin@ximian.com>
240
241         * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
242         than RootContext.LookupType() to find the explicit interface
243         type.  Fixes #58584.
244
245 2004-05-24  Raja R Harinath  <rharinath@novell.com>
246
247         * Makefile: Simplify.  Use executable.make.
248         * mcs.exe.sources: New file.  List of sources of mcs.exe.
249
250 2004-05-24  Anders Carlsson  <andersca@gnome.org>
251
252         * decl.cs:
253         * enum.cs:
254         Use the invariant culture when doing String.Compare for CLS case
255         sensitivity.
256         
257 2004-05-23  Martin Baulig  <martin@ximian.com>
258
259         * decl.cs (DeclSpace.FindType): Only check the `using' list if we
260         don't have any dots.  Fixes #52622, added cs0246-8.cs.
261
262         * namespace.cs (NamespaceEntry.Lookup): Likewise.
263         
264 2004-05-23  Marek Safar  <marek.safar@seznam.cz>
265
266         * class.cs (MemberBase.Define): Reuse MemberType member for 
267         resolved type. Other methods can use it too.
268
269 2004-05-23  Martin Baulig  <martin@ximian.com>
270
271         * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
272         the variable also exists in the current block (otherwise, we need
273         to report a CS0103).  Fixes #58670.
274
275 2004-05-23  Martin Baulig  <martin@ximian.com>
276
277         * flowanalysis.cs (Reachability.Reachable): Compute this
278         on-the-fly rather than storing it as a field.
279
280 2004-05-23  Martin Baulig  <martin@ximian.com>
281
282         * flowanalysis.cs (Reachability.And): Manually compute the
283         resulting `barrier' from the reachability.      
284        
285 2004-05-23  Marek Safar  <marek.safar@seznam.cz>
286
287         Fix bug #57835
288         * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
289         instance of ObsoleteAttribute when symbol is obsolete.
290
291         * class.cs
292         (IMethodData): Extended interface for ObsoleteAttribute support.
293
294 2004-05-22  Marek Safar  <marek.safar@seznam.cz>
295
296         * attribute.cs: Fix bug #55970
297
298 2004-05-22  Marek Safar  <marek.safar@seznam.cz>
299
300         Fix bug #52705
301         * attribute.cs
302         (GetObsoleteAttribute): New method. Creates the instance of
303         ObsoleteAttribute.
304         (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
305         ObsoleteAttribute when member is obsolete.
306         (AttributeTester.Report_ObsoleteMessage): Common method for
307         Obsolete error/warning reporting.
308
309         * class.cs
310         (TypeContainer.base_classs_type): New member for storing parent type.
311
312         * decl.cs
313         (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
314         for this MemberCore.
315
316 2004-05-21  Marek Safar  <marek.safar@seznam.cz>
317
318         * attribute.cs, const.cs: Fix bug #58590
319
320 2004-05-21  Martin Baulig  <martin@ximian.com>
321
322         * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
323         out parameters if the end of the method is unreachable.  Fixes
324         #58098. 
325
326 2004-05-21  Marek Safar  <marek.safar@seznam.cz>
327
328         * codegen.cs, cs-parser.jay: Removed SetAttributes method.
329         Hari was right, why extra method.
330
331 2004-05-21  Marek Safar  <marek.safar@seznam.cz>
332
333         * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
334
335 2004-05-20  Martin Baulig  <martin@ximian.com>
336
337         Merged this back from gmcs to keep the differences to a minumum.
338
339         * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
340         instead of a Declspace.
341         (Attribute.ResolveType): Likewise.
342         (Attributes.Search): Likewise.
343         (Attributes.Contains): Likewise.
344         (Attributes.GetClsCompliantAttribute): Likewise.
345
346         * class.cs (TypeContainer.VerifyMembers): Added EmitContext
347         argument.
348         (MethodData.ApplyAttributes): Take an EmitContext instead of a
349         DeclSpace.
350
351 2004-04-20  Martin Baulig  <martin@ximian.com>
352
353         Merged latest changes into gmcs.  Please keep this comment in
354         here, it makes it easier for me to see what changed in MCS since
355         the last time I merged.
356
357 2004-05-19  Marek Safar  <marek.safar@seznam.cz>
358
359         Fix bug #58688 (MCS does not report error when the same attribute
360         is assigned twice)
361
362         * attribute.cs (Attribute.Emit): Distinction between null and default.
363
364 2004-05-19  Raja R Harinath  <rharinath@novell.com>
365
366         * cs-parser.jay (attribute): Create a GlobalAttribute for the case
367         of a top-level attribute without an attribute target.
368         * attribute.cs (Attribute.Error_AttributeConstructorMismatch): 
369         Make non-static.
370         (Attribute.Conditional_GetConditionName), 
371         (Attribute.Obsolete_GetObsoleteMessage): Update.
372         (Attribute.IndexerName_GetIndexerName): New.  Attribute-specific
373         part of ScanForIndexerName.
374         (Attribute.CanIgnoreInvalidAttribute): New function.
375         (Attribute.ScanForIndexerName): Move to ...
376         (Attributes.ScanForIndexerName): ... here.
377         (Attributes.Attrs): Rename from now-misnamed AttributeSections.
378         (Attributes.Search): New internal variant that can choose not to
379         complain if types aren't resolved.  The original signature now
380         complains.
381         (Attributes.GetClsCompliantAttribute): Use internal variant, with
382         complaints suppressed.
383         (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
384         only if it not useful.
385         (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
386         top-level for attributes that are shared between the assembly
387         and a top-level class.
388         * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
389         * class.cs: Update to reflect changes.
390         (DefineIndexers): Fuse loops.
391         * codegen.cs (GetAssemblyName): Update to reflect changes.  Accept
392         a couple more variants of attribute names.
393
394 2004-05-18  Marek Safar  <marek.safar@seznam.cz>
395
396         Fix bug #52585 (Implemented explicit attribute declaration)
397
398         * attribute.cs:
399         (Attributable.ValidAttributeTargets): New abstract method. It gets
400         list of valid attribute targets for explicit target declaration.
401         (Attribute.Target): It holds target itself.
402         (AttributeSection): Removed.
403         (Attribute.CheckTargets): New method. It checks whether attribute
404         target is valid for the current element.
405
406         * class.cs:
407         (EventProperty): New class. For events that are declared like
408         property (with add and remove accessors).
409         (EventField): New class. For events that are declared like field.
410         class.cs
411
412         * cs-parser.jay: Implemented explicit attribute target declaration.
413
414         * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:        
415         Override ValidAttributeTargets.
416
417         * parameter.cs:
418         (ReturnParameter): Class for applying custom attributes on 
419         the return type.
420         (ParameterAtribute): New class. Class for applying custom
421         attributes on the parameter type.
422
423 2004-05-17  Miguel de Icaza  <miguel@ximian.com>
424
425         * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
426         definitions. 
427
428         (Method): Allow UNSAFE here.
429
430         * modifiers.cs: Support unsafe reporting.
431
432 2004-05-17  Marek Safar  <marek.safar@seznam.cz>
433
434         * decl.cs: Fix bug #58478.
435
436 2004-05-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
437
438         * statement.cs: When checking for unreachable code on an EmptyStatement,
439         set the location. Fixes bug #58488.
440
441 2004-05-13  Miguel de Icaza  <miguel@ximian.com>
442
443         * driver.cs: Add -pkg handling.
444
445         From Gonzalo: UseShelLExecute=false
446
447 2004-05-12  Marek Safar  <marek.safar@seznam.cz>
448
449         * attribute.cs:
450         (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
451         for attribute.
452         (Attribute.IsClsCompliaceRequired): Moved to base for better
453         accesibility.
454         (Attribute.UsageAttribute): New property for AttributeUsageAttribute
455         when attribute is AttributeUsageAttribute.
456         (Attribute.GetValidTargets): Simplified.
457         (Attribute.GetAttributeUsage): New method returns AttributeUsage
458         attribute for this type.
459         (Attribute.ApplyAttributes): Method renamed to Emit and make
460         non-static.
461         (GlobalAttributeSection): New class for special handling of global
462         attributes (assembly, module).
463         (AttributeSection.Emit): New method.
464
465         * class.cs: Implemented Attributable abstract methods.
466         (MethodCore.LabelParameters): Moved to Parameter class.
467         (Accessor): Is back simple class.
468         (PropertyMethod): Implemented Attributable abstract class.
469         (DelegateMethod): Implemented Attributable abstract class.
470         (Event): New constructor for disctintion between normal Event
471         and Event with accessors.
472
473         * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
474
475         * codegen.cs, const.cs, decl.cs, delegate.cs:
476         (CommonAssemblyModulClass): Implemented Attributable abstract class
477         and simplified.
478
479         * enum.cs: Implement IAttributeSupport interface.
480         (EnumMember): New class for emum members. Implemented Attributable
481         abstract class
482
483         * parameter.cs:
484         (ParameterBase): Is abstract.
485         (ReturnParameter): New class for easier [return:] attribute handling.
486
487         * typemanager.cs: Removed builder_to_attr.
488
489 2004-05-11  Raja R Harinath  <rharinath@novell.com>
490
491         Fix bug #57151.
492         * attribute.cs (Attribute.GetPositionalValue): New function.
493         * class.cs (TypeContainer.VerifyMembers): New function.
494         (TypeContainer.Emit): Use it.
495         (ClassOrStruct): New base class for Class and Struct.
496         (ClassOrStruct.ApplyAttributeBuilder): New function.  Note if 
497         StructLayout(LayoutKind.Explicit) was ascribed to the struct or
498         class.
499         (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
500         then each non-static field should have a FieldOffset attribute.
501         Otherwise, none of the fields should have a FieldOffset attribute.
502         * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout 
503         and FieldOffset attributes.
504         * typemanager.cs (TypeManager.struct_layout_attribute_type)
505         (TypeManager.field_offset_attribute_type): New core types.
506         (TypeManager.InitCoreTypes): Initialize them.
507
508 2004-05-11  Michal Moskal  <malekith@pld-linux.org>
509
510         * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
511         Return correct type.
512         From bug #58270.
513
514 2004-05-09  Miguel de Icaza  <miguel@ximian.com>
515
516         * expression.cs (Binary.DoNumericPromotions): 0 long constant can
517         be implicitly converted to ulong.
518         
519         * expression.cs: The logic for allowing operator &, | and ^ worked
520         was wrong, it worked before because we did not report an error in
521         an else branch.  Fixes 57895.
522
523         * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
524         allow volatile fields to be reference types.
525
526 2004-05-07  Miguel de Icaza  <miguel@ximian.com>
527
528         * driver.cs: Add support for /debug-
529
530 2004-05-07  Raja R Harinath  <rharinath@novell.com>
531
532         * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType): 
533         Add a 'complain' parameter to silence errors.
534         (Attribute.Resolve): Update to changes.  Put in sanity check to catch
535         silently overlooked type-resolutions.
536         (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
537         to reflect changes.
538         (Attributes.Search): New function.
539         (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
540         (Attributes.GetAttributeFullName): Remove hack.
541         * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes): 
542         Update to reflect changes.
543         * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
544         Use Attributes.Search instead of nested loops.
545
546 2004-05-07  Marek Safar  <marek.safar@seznam.cz>
547
548         * decl.cs:
549         (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
550         (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
551         (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
552
553         * report.cs: (Report.Warning): Renamed to Warning_T because of
554         parameter collision.
555
556 2004-05-05  Raja R Harinath  <rharinath@novell.com>
557
558         * expression.cs (MemberAccess.ResolveMemberAccess):
559         Exit with non-zero status after Report.Error.
560         * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
561         Likewise.
562         * typemanager.cs (TypeManager.CoreLookupType): Likewise.
563
564 2004-05-04  Lluis Sanchez Gual  <lluis@ximian.com>
565
566         * support.cs: Don't hang when the file is empty.
567
568 2004-05-04  Lluis Sanchez Gual  <lluis@ximian.com>
569
570         * support.cs: In SeekableStreamReader, compute the preamble size of the
571           underlying stream. Position changes should take into account that initial
572           count of bytes.
573
574 2004-05-03  Todd Berman  <tberman@sevenl.net>
575
576         * driver.cs: remove unused GetSysVersion function.
577
578 2004-05-03  Todd Berman  <tberman@sevenl.net>
579
580         * driver.cs: Remove the hack from saturday, as well as the hack
581         from jackson (LoadAssemblyFromGac), also adds the CWD to the
582         link_paths to get that bit proper.
583
584 2004-05-01  Todd Berman  <tberman@sevenl.net>
585
586         * driver.cs: Try a LoadFrom before a Load, this checks the current
587         path. This is currently a bug in mono that is be fixed, however, this
588         provides a workaround for now. This will be removed when the bug
589         is fixed.
590
591 2004-05-01  Sebastien Pouliot  <sebastien@ximian.com>
592
593         * CryptoConvert.cs: Updated to latest version. Fix issue with 
594         incomplete key pairs (#57941).
595
596 2004-05-01  Todd Berman  <tberman@sevenl.net>
597
598         * driver.cs: Remove '.' from path_chars, now System.* loads properly
599         from the GAC
600
601 2004-04-30  Jackson Harper  <jackson@ximian.com>
602
603         * codegen.cs: Open keys readonly.
604         
605 2004-04-30  Gonzalo Paniagua Javier <gonzalo@ximian.com>
606
607         * typemanager.cs: don't report cyclic struct layout when a struct
608         contains 2 or more fields of the same type. Failed for Pango.AttrShape
609         which has 2 Pango.Rectangle fields.
610
611 2004-04-29 Ben Maurer  <bmaurer@users.sourceforge.net>
612
613         * expression.cs: Handle IntPtr comparisons with IL code
614         rather than a method call.
615
616 2004-04-29  Martin Baulig  <martin@ximian.com>
617
618         * ecore.cs (PropertyExpr.FindAccessor): New private method.  Walk
619         the list of PropertyInfo's in class hierarchy and find the
620         accessor.  Fixes #56013.
621
622 2004-04-29  Martin Baulig  <martin@ximian.com>
623
624         * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
625
626 2004-04-29  Martin Baulig  <martin@ximian.com>
627
628         Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
629
630         * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
631
632 2004-04-29  Martin Baulig  <martin@ximian.com>
633
634         * class.cs (ConstructorInitializer.Resolve): Check whether the
635         parent .ctor is accessible.  Fixes #52146.
636
637 2004-04-29  Martin Baulig  <martin@ximian.com>
638
639         Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
640
641         * statement.cs (Using.EmitLocalVariableDecls): Use
642         TypeManager.idisposable_type, not typeof (IDisposable).
643         (Foreach.EmitCollectionForeach): Added support for valuetypes.
644
645 2004-04-29  Martin Baulig  <martin@ximian.com>
646
647         * class.cs (Event.Define): Don't emit the field and don't set
648         RTSpecialName and SpecialName for events on interfaces.  Fixes
649         #57703. 
650
651 2004-04-29  Raja R Harinath  <rharinath@novell.com>
652
653         Refactor Attribute.ApplyAttributes.
654         * attribute.cs (Attributable): New base class for objects that can
655         have Attributes applied on them.
656         (Attribute): Make AttributeUsage fields public.
657         (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
658         (Attribute.IsInternalCall): New property.
659         (Attribute.UsageAttr): Convert to a public read-only property.
660         (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
661         (Attribute.ResolveType, Attribute.Resolve)
662         (Attribute.ScanForIndexerName): Update to reflect changes.
663         (Attribute.CheckAttributeTarget): Re-format.
664         (Attribute.ApplyAttributes): Refactor, to various
665         Attributable.ApplyAttributeBuilder methods.
666         * decl.cs (MemberCore): Make Attributable.
667         * class.cs (Accessor): Make Attributable.
668         (MethodData.ApplyAttributes): Use proper attribute types, not
669         attribute names.
670         (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
671         (TypeContainer.ApplyAttributeBuilder)
672         (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
673         (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)   
674         (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
675         (Operator.ApplyAttributeBuilder): New factored-out methods.
676         * const.cs (Const.ApplyAttributeBuilder): Likewise.
677         * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
678         * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
679         * parameter.cs (ParameterBase): New Attributable base class
680         that can also represent Return types.
681         (Parameter): Update to the changes.
682
683 2004-04-29  Jackson Harper  <jackson@ximian.com>
684
685         * driver.cs: Prefer the corlib system version when looking for
686         assemblies in the GAC. This is still a hack, but its a better hack
687         now.
688         
689 2004-04-29  Marek Safar  <marek.safar@seznam.cz>
690
691         * decl.cs, enum.cs: Improved error 3005 reporting.
692   
693         * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
694         (related_symbols): New private member for list of symbols
695         related to reported error/warning.
696         
697         * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
698
699 2004-04-29  Martin Baulig  <martin@ximian.com>
700
701         * ecore.cs (Expression.Constantify): If we're an enum and
702         TypeManager.TypeToCoreType() doesn't give us another type, use
703         t.UnderlyingSystemType.  Fixes #56178.  
704
705 2004-04-29  Martin Baulig  <martin@ximian.com>
706
707         * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
708         interfaces and for each interface, only add members directly
709         declared in that interface.  Fixes #53255.
710
711 2004-04-28  Martin Baulig  <martin@ximian.com>
712
713         * expression.cs (ConditionalLogicalOperator): Use a temporary
714         variable for `left' to avoid that we evaluate it more than once;
715         bug #52588.
716
717 2004-04-28  Martin Baulig  <martin@ximian.com>
718
719         * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
720         `void[]' (CS1547).
721
722 2004-04-28  Martin Baulig  <martin@ximian.com>
723
724         * statement.cs (LocalInfo.Resolve): Check whether the type is not
725         void (CS1547).
726
727         * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
728         whether the type is not void (CS1547).
729
730 2004-04-28  Martin Baulig  <martin@ximian.com>
731
732         * expression.cs (Unary.DoResolveLValue): Override this and report
733         CS0131 for anything but Operator.Indirection.
734
735 2004-04-28  Martin Baulig  <martin@ximian.com>
736
737         Committing a patch from Ben Maurer; see bug #50820.
738
739         * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
740         check for classes.
741
742         * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
743         classes.        
744
745 2004-04-28  Martin Baulig  <martin@ximian.com>
746
747         Committing a patch from Ben Maurer; see bug #50820.
748
749         * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
750         check for classes.
751
752         * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
753         classes.        
754
755 2004-04-28  Martin Baulig  <martin@ximian.com>
756
757         * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
758         (Block.AddLabel): Call DoLookupLabel() to only search in the
759         current block.
760
761 2004-04-28  Martin Baulig  <martin@ximian.com>
762
763         * cfold.cs (ConstantFold.BinaryFold): Added special support for
764         comparing StringConstants and NullLiterals in Equality and Inequality.
765
766 2004-04-28  Jackson Harper  <jackson@ximian.com>
767
768         * driver.cs: Attempt to load referenced assemblies from the
769         GAC. This is the quick and dirty version of this method that
770         doesnt take into account versions and just takes the first
771         canidate found. Will be good enough for now as we will not have more
772         then one version installed into the GAC until I update this method.
773
774 2004-04-28  Martin Baulig  <martin@ximian.com>
775
776         * typemanager.cs (TypeManager.CheckStructCycles): New public
777         static method to check for cycles in the struct layout.
778
779         * rootcontext.cs (RootContext.PopulateTypes): Call
780         TypeManager.CheckStructCycles() for each TypeContainer.
781         [Note: We only need to visit each type once.]
782
783 2004-04-28  Martin Baulig  <martin@ximian.com>
784
785         * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
786
787         * const.cs (Const.LookupConstantValue): Return a `bool' signalling
788         success and added `out object value'.  Use a `bool resolved' field
789         to check whether we've already been called rather than
790         `ConstantValue != null' since this breaks for NullLiterals.
791
792 2004-04-28  Raja R Harinath  <rharinath@novell.com>
793
794         * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
795         setting of this flag, since the 'set' method may be non-public.
796
797 2004-04-28  Raja R Harinath  <rharinath@novell.com>
798
799         * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
800         check on current_vector.Block.
801
802 2004-04-27  Martin Baulig  <martin@ximian.com>
803
804         * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
805         a field initializer.  Fixes #56459.
806
807 2004-04-27  Martin Baulig  <martin@ximian.com>
808
809         * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
810         we're not attempting to use an indexer.  Fixes #52154.
811
812 2004-04-27  Martin Baulig  <martin@ximian.com>
813
814         * statement.cs (Return): Don't create a return label if we don't
815         need it; reverts my change from January 20th.  Thanks to Ben
816         Maurer for this.
817
818 2004-04-27  Martin Baulig  <martin@ximian.com>
819
820         According to the spec, `goto' can only leave a nested scope, but
821         never enter it.
822
823         * statement.cs (Block.LookupLabel): Only lookup in the current
824         block, don't recurse into parent or child blocks.
825         (Block.AddLabel): Check in parent and child blocks, report
826         CS0140/CS0158 if we find a duplicate.
827         (Block): Removed this indexer for label lookups.
828         (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
829         this already does the error reporting for us.
830
831         * flowanalysis.cs
832         (FlowBranching.UsageVector.Block): New public variable; may be null.
833         (FlowBranching.CreateSibling): Added `Block' argument.
834         (FlowBranching.LookupLabel): New public virtual method.  Lookup a
835         label for the target of a `goto' and check whether we're not
836         leaving a `finally'.
837
838 2004-04-27  Martin Baulig  <martin@ximian.com>
839
840         * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
841         a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
842         just for returns).
843
844 2004-04-27  Martin Baulig  <martin@ximian.com>
845
846         * statement.cs (Block.AddLabel): Also check for implicit blocks
847         and added a CS0158 check.
848
849 2004-04-27  Martin Baulig  <martin@ximian.com>
850
851         * flowanalysis.cs (FlowBranchingLoop): New class.
852         (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
853         UsageVector's instead of an ArrayList.
854         (FlowBranching.Label): Likewise.
855         (FlowBranching.UsageVector.MergeBreakOrigins): New method.
856         (FlowBranching.AddBreakVector): New method.
857
858 2004-04-27  Miguel de Icaza  <miguel@ximian.com>
859
860         * attribute.cs: Small regression fix: only convert the type if we
861         the type is different, fixes System.Drawing build.
862
863 2004-04-27  Martin Baulig  <martin@ximian.com>
864
865         * attribute.cs (Attribute.Resolve): If we have a constant value
866         for a named field or property, implicity convert it to the correct
867         type.
868
869 2004-04-27  Raja R Harinath  <rharinath@novell.com>
870
871         * statement.cs (Block.Block): Implicit blocks share
872         'child_variable_names' fields with parent blocks.
873         (Block.AddChildVariableNames): Remove.
874         (Block.AddVariable): Mark variable as "used by a child block" in
875         every surrounding block.
876         * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
877         been used in a child block, complain about violation of "Invariant
878         meaning in blocks" rule.
879         * cs-parser.jay (declare_local_variables): Don't use
880         AddChildVariableNames.
881         (foreach_statement): Don't create an implicit block: 'foreach'
882         introduces a scope.
883
884 2004-04-23  Miguel de Icaza  <miguel@ximian.com>
885
886         * convert.cs (ImplicitNumericConversion): 0 is also positive when
887         converting from 0L to ulong.  Fixes 57522.
888
889 2004-04-22  Marek Safar  <marek.safar@seznam.cz>
890
891         * decl.cs (FindMemberToOverride): Fix wrong warning for case when
892         derived class hides via 'new' keyword field from base class (test-242.cs).
893         TODO: Handle this in the more general way.
894         
895         * class.cs (CheckBase): Ditto.
896
897 2004-04-22  Marek Safar  <marek.safar@seznam.cz>
898
899         * decl.cs (caching_flags): New member for storing cached values
900         as bit flags.
901         (MemberCore.Flags): New enum where bit flags for caching_flags
902         are defined.
903         (MemberCore.cls_compliance): Moved to caching_flags.
904         (DeclSpace.Created): Moved to caching_flags.
905
906         * class.cs: Use caching_flags instead of DeclSpace.Created
907         
908 2004-04-21  Miguel de Icaza  <miguel@ximian.com>
909
910         * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
911         if we are only a derived class, not a nested class.
912
913         * typemanager.cs: Same as above, but do this at the MemberLookup
914         level (used by field and methods, properties are handled in
915         PropertyExpr).   Allow for the qualified access if we are a nested
916         method. 
917
918 2004-04-21  Marek Safar  <marek.safar@seznam.cz>
919
920         * class.cs: Refactoring.
921         (IMethodData): New inteface; Holds links to parent members
922         to avoid member duplication (reduced memory allocation).
923         (Method): Implemented IMethodData interface.
924         (PropertyBase): New inner classes for get/set methods.
925         (PropertyBase.PropertyMethod): Implemented IMethodData interface
926         (Event): New inner classes for add/remove methods.
927         (Event.DelegateMethod): Implemented IMethodData interface.
928
929         * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
930         EmitContext (related to class.cs refactoring).
931
932 2004-04-21  Raja R Harinath  <rharinath@novell.com>
933
934         * delegate.cs (Delegate.VerifyApplicability): If the number of
935         arguments are the same as the number of parameters, first try to
936         verify applicability ignoring  any 'params' modifier on the last
937         parameter.
938         Fixes #56442.
939
940 2004-04-16  Raja R Harinath  <rharinath@novell.com>
941
942         * class.cs (TypeContainer.AddIndexer): Use
943         'ExplicitInterfaceName' to determine if interface name was
944         explicitly specified.  'InterfaceType' is not initialized at this time.
945         (TypeContainer.DefineIndexers): Remove use of temporary list.  The
946         Indexers array is already in the required order.  Initialize
947         'IndexerName' only if there are normal indexers.
948         (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
949         (TypeContainer.Emit): Emit DefaultMember attribute only if
950         IndexerName is initialized.
951         Fixes #56300.
952
953 2004-04-15  Benjamin Jemlich  <pcgod@gmx.net>
954
955         * enum.cs (Enum.DefineType): Don't allow char as type for enum.
956         Fixes #57007
957
958 2004-04-15  Raja R Harinath  <rharinath@novell.com>
959
960         * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
961         attributes.
962         Fix for #56456.
963
964         * attribute.cs (Attribute.Resolve): Check for duplicate named
965         attributes.
966         Fix for #56463.
967
968 2004-04-15  Miguel de Icaza  <miguel@ximian.com>
969
970         * iterators.cs (MarkYield): track whether we are in an exception,
971         and generate code accordingly.  Use a temporary value to store the
972         result for our state.
973
974         I had ignored a bit the interaction of try/catch with iterators
975         since their behavior was not entirely obvious, but now it is
976         possible to verify that our behavior is the same as MS .NET 2.0
977
978         Fixes 54814
979
980 2004-04-14  Miguel de Icaza  <miguel@ximian.com>
981
982         * iterators.cs: Avoid creating temporaries if there is no work to
983         do. 
984
985         * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
986         Enumerations, use TypeManager.EnumToUnderlying and call
987         recursively. 
988
989         Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
990         bug #57013
991
992         (This.Emit): Use EmitContext.EmitThis to emit our
993         instance variable.
994
995         (This.EmitAssign): Ditto.
996
997         * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
998         codepaths, we will move all the functionality into
999         Mono.CSharp.This 
1000
1001         (FieldExpr.EmitAssign): Ditto.
1002
1003         This fixes several hidden bugs that I uncovered while doing a code
1004         review of this today.
1005
1006         * codegen.cs (EmitThis): reworked so the semantics are more clear
1007         and also support value types "this" instances.
1008
1009         * iterators.cs: Changed so that for iterators in value types, we
1010         do not pass the value type as a parameter.  
1011
1012         Initialization of the enumerator helpers is now done in the caller
1013         instead of passing the parameters to the constructors and having
1014         the constructor set the fields.
1015
1016         The fields have now `assembly' visibility instead of private.
1017
1018 2004-04-11  Miguel de Icaza  <miguel@ximian.com>
1019
1020         * expression.cs (Argument.Resolve): Check if fields passed as ref
1021         or out are contained in a MarshalByRefObject.
1022
1023         * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
1024         another compiler type.
1025
1026 2004-04-06 Ben Maurer  <bmaurer@users.sourceforge.net>
1027
1028         * class.cs (Indexer.Define): use the new name checking method.
1029         Also, return false on an error.
1030         * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
1031         (is_identifier_[start/part]_character): make static.
1032
1033 2004-04-10  Miguel de Icaza  <miguel@ximian.com>
1034
1035         * expression.cs (Binary.ResolveOperator): Do no append strings
1036         twice: since we can be invoked more than once (array evaluation)
1037         on the same concatenation, take care of this here.  Based on a fix
1038         from Ben (bug #56454)
1039
1040 2004-04-08  Sebastien Pouliot  <sebastien@ximian.com>
1041
1042         * codegen.cs: Fix another case where CS1548 must be reported (when 
1043         delay-sign isn't specified and no private is available #56564). Fix
1044         loading the ECMA "key" to delay-sign an assembly. Report a CS1548 
1045         error when MCS is used on the MS runtime and we need to delay-sign 
1046         (which seems unsupported by AssemblyBuilder - see #56621).
1047
1048 2004-04-08  Marek Safar  <marek.safar@seznam.cz>
1049
1050         * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
1051         (TypeManager.ComputeNamespaces): Faster implementation for
1052         Microsoft runtime.
1053
1054         * compiler.csproj: Updated AssemblyName to mcs.
1055
1056 2004-04-07  Miguel de Icaza  <miguel@ximian.com>
1057
1058         * rootcontext.cs: Add new types to the boot resolution.
1059
1060         * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
1061         MulticastDelegate is not allowed.
1062
1063         * typemanager.cs: Add new types to lookup: System.TypedReference
1064         and ArgIterator.
1065
1066         * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
1067         check for TypedReference or ArgIterator, they are not allowed. 
1068
1069         * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
1070         makes us properly catch 1510 in some conditions (see bug 56016 for
1071         details). 
1072
1073 2004-04-06  Bernie Solomon  <bernard@ugsolutions.com>
1074
1075         * CryptoConvert.cs: update from corlib version
1076         with endian fixes.
1077
1078 2004-04-05  Miguel de Icaza  <miguel@ximian.com>
1079
1080         * class.cs (Indexer.Define): Check indexername declaration
1081
1082 2004-04-05  Marek Safar  <marek.safar@seznam.cz>
1083
1084         * attribute.cs (IsClsCompliant): Fixed problem with handling
1085         all three states (compliant, not-compliant, undetected).
1086
1087 2004-03-30  Marek Safar  <marek.safar@seznam.cz>
1088
1089         * attribute.cs (Attribute): Location is now public.
1090         (Resolve): Store resolved arguments (pos_values) in attribute class.
1091         Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
1092         (GetClsCompliantAttributeValue): New method that gets
1093         CLSCompliantAttribute value.
1094         (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
1095         if exists else null.
1096         (AttributeTester): New class for CLS-Compliant verification routines.
1097
1098         * class.cs (Emit): Add CLS-Compliant verification.
1099         (Method.GetSignatureForError): Implemented.
1100         (Constructor.GetSignatureForError): Implemented
1101         (Constructor.HasCompliantArgs): Returns if constructor has
1102         CLS-Compliant arguments.
1103         (Constructor.Emit): Override.
1104         (Construcor.IsIdentifierClsCompliant): New method; For constructors
1105         is needed to test only parameters.
1106         (FieldBase.GetSignatureForError): Implemented.
1107         (TypeContainer): New member for storing base interfaces.
1108         (TypeContainer.FindMembers): Search in base interfaces too.
1109
1110         * codegen.cs (GetClsComplianceAttribute): New method that gets
1111         assembly or module CLSCompliantAttribute value.
1112         (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
1113         for assembly.
1114         (ModuleClass.Emit): Add error 3012 test.
1115
1116         * const.cs (Emit): Override and call base for CLS-Compliant tests.
1117
1118         * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
1119         state for all decl types.
1120         (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
1121         if CLS-Compliant tests are required.
1122         (IsClsCompliaceRequired): New method. Analyze whether code
1123         must be CLS-Compliant.
1124         (IsExposedFromAssembly): New method. Returns true when MemberCore
1125         is exposed from assembly.
1126         (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
1127         value or gets cached value.
1128         (HasClsCompliantAttribute): New method. Returns true if MemberCore
1129         is explicitly marked with CLSCompliantAttribute.
1130         (IsIdentifierClsCompliant): New abstract method. This method is
1131         used to testing error 3005.
1132         (IsIdentifierAndParamClsCompliant): New method. Common helper method
1133         for identifier and parameters CLS-Compliant testing.
1134         (VerifyClsCompliance): New method. The main virtual method for
1135         CLS-Compliant verifications.
1136         (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
1137         null. I don't know why is null (too many public members !).
1138         (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
1139         and get value of first CLSCompliantAttribute that found.
1140
1141         * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
1142         (VerifyClsCompliance): Override and add extra tests.
1143
1144         * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
1145         clscheck- disable CLS-Compliant verification event if assembly is has
1146         CLSCompliantAttribute(true).
1147
1148         * enum.cs (Emit): Override and call base for CLS-Compliant tests.
1149         ApllyAttribute is now called in emit section as in the other cases.
1150         Possible future Emit integration.
1151         (IsIdentifierClsCompliant): New override.
1152         (VerifyClsCompliance): New override.
1153         (GetEnumeratorName): Returns full enum name.
1154
1155         * parameter.cs (GetSignatureForError): Implemented.
1156
1157         * report.cs (WarningData): New struct for Warning message information.
1158         (LocationOfPreviousError): New method.
1159         (Warning): New method. Reports warning based on the warning table.
1160         (Error_T): New method. Reports error based on the error table.
1161
1162         * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
1163         verifications are done here.
1164
1165         * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
1166
1167         * typemanager.cs (cls_compliant_attribute_type): New member thath holds
1168         CLSCompliantAttribute.
1169         (all_imported_types): New member holds all imported types from other
1170         assemblies.
1171         (LoadAllImportedTypes): New method fills static table with exported types
1172         from all referenced assemblies.
1173         (Modules): New property returns all assembly modules.
1174
1175 2004-03-30  Miguel de Icaza  <miguel@ximian.com>
1176
1177         * cs-parser.jay: Add a rule to catch wrong event syntax instead of
1178         throwing a parser error.
1179
1180         * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
1181         which removes the hardcoded get_/set_ prefixes for properties, as
1182         IL allows for the properties to be named something else.  
1183
1184         Bug #56013
1185
1186         * expression.cs: Do not override operand before we know if it is
1187         non-null.  Fix 56207
1188
1189 2004-03-29 Ben Maurer  <bmaurer@users.sourceforge.net>
1190
1191         * typemanager.cs: support for pinned variables.
1192
1193 2004-03-29 Ben Maurer  <bmaurer@users.sourceforge.net>
1194
1195         * decl.cs, typemanager.cs: Avoid using an arraylist
1196         as a buffer if there is only one result set.
1197
1198 2004-03-29 Ben Maurer  <bmaurer@users.sourceforge.net>
1199
1200         * expression.cs: Make sure you cant call a static method
1201         with an instance expression, bug #56174.
1202
1203 2004-03-29  Miguel de Icaza  <miguel@ximian.com>
1204
1205         * class.cs (IsDuplicateImplementation): Improve error reporting to
1206         flag 663 (method only differs in parameter modifier).
1207
1208         * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
1209         in preprocessor directives.
1210
1211         * location.cs (LookupFile): Allow for the empty path.
1212
1213         * attribute.cs (DefinePInvokeMethod): Fix 56148;  I would like a
1214         better approach for some of that patch, but its failing with the
1215         CharSet enumeration.  For now try/catch will do.
1216
1217         * typemanager.cs: Do not crash if a struct does not have fields.
1218         Fixes 56150.
1219
1220 2004-03-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1221
1222         * expression.cs: cs0213, cant fix a fixed expression.
1223         fixes 50231.
1224
1225 2004-03-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1226
1227         * cs-parser.jay: detect invalid embeded statements gracefully.
1228         bug #51113.
1229
1230 2004-03-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1231
1232         * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
1233         As a regex:
1234         s/
1235         the invocation type may not be a subclass of the tye of the item/
1236         The type of the item must be a subclass of the invocation item.
1237         /g
1238
1239         Fixes bug #50820.
1240
1241 2004-03-25  Sebastien Pouliot  <sebastien@ximian.com>
1242
1243         * attribute.cs: Added methods to get a string and a bool from an
1244         attribute. Required to information from AssemblyKeyFileAttribute,
1245         AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
1246         * codegen.cs: Modified AssemblyName creation to include support for
1247         strongnames. Catch additional exceptions to report them as CS1548.
1248         * compiler.csproj: Updated include CryptoConvert.cs.
1249         * compiler.csproj.user: Removed file - user specific configuration.
1250         * CryptoConvert.cs: New. A COPY of the class CryptoConvert from 
1251         Mono.Security assembly. The original class is maintained and tested in
1252         /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
1253         * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
1254         like CSC 8.0 (C# v2) supports.
1255         * Makefile: Added CryptoConvert.cs to mcs sources.
1256         * rootcontext.cs: Added new options for strongnames.
1257
1258 2004-03-24 Ben Maurer  <bmaurer@users.sourceforge.net>
1259
1260         * driver.cs: For --expect-error, report error code `2'
1261         if the program compiled with no errors, error code `1' if
1262         it compiled with an error other than the one expected.
1263
1264 2004-03-24  Sebastien Pouliot  <sebastien@ximian.com>
1265
1266         * compiler.csproj: Updated for Visual Studio .NET 2003.
1267         * compiler.csproj.user: Updated for Visual Studio .NET 2003.
1268         * compiler.sln: Updated for Visual Studio .NET 2003.
1269
1270 2004-03-24  Ravi Pratap M  <ravi@ximian.com>
1271
1272         * expression.cs: Fix bug #47234. We basically need to apply the
1273         rule that we prefer the conversion of null to a reference type
1274         when faced with a conversion to 'object' (csc behaviour).
1275
1276 2004-03-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1277
1278         * statement.cs: Shorter form for foreach, eliminates
1279         a local variable. r=Martin.
1280
1281 2004-03-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1282
1283         * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
1284         checks if we can use brtrue/brfalse to test for 0.
1285         * expression.cs: use the above in the test for using brtrue/brfalse.
1286         cleanup code a bit.
1287
1288 2004-03-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1289
1290         * expression.cs: Rewrite string concat stuff. Benefits:
1291
1292         - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
1293         - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
1294         rather than a concat chain.
1295
1296         * typemanager.cs: Add lookups for more concat overloads.
1297
1298 2004-03-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1299
1300         * expression.cs: Emit shorter il code for array init.
1301
1302         newarr
1303         dup
1304         // set 1
1305
1306         // set 2
1307
1308         newarr
1309         stloc.x
1310
1311         ldloc.x
1312         // set 1
1313
1314         ldloc.x
1315         // set 2
1316
1317 2004-03-22 Ben Maurer  <bmaurer@users.sourceforge.net>
1318
1319         * statement.cs: Before, two switch blocks would be merged if the
1320         total size of the blocks (end_item - begin_item + 1) was less than
1321         two times the combined sizes of the blocks.
1322
1323         Now, it will only merge if after the merge at least half of the
1324         slots are filled.
1325
1326         fixes 55885.
1327
1328 2004-03-20  Atsushi Enomoto  <atsushi@ximian.com>
1329
1330         * class.cs : csc build fix for GetMethods(). See bug #52503.
1331
1332 2004-03-20 Ben Maurer  <bmaurer@users.sourceforge.net>
1333
1334         * expression.cs: Make sure fp comparisons work with NaN.
1335         This fixes bug #54303. Mig approved this patch a long
1336         time ago, but we were not able to test b/c the runtime
1337         had a related bug.
1338
1339 2004-03-19  Miguel de Icaza  <miguel@ximian.com>
1340
1341         * ecore.cs (TypExpr.GetHashCode): implement this overload. 
1342
1343 2004-03-19  Martin Baulig  <martin@ximian.com>
1344
1345         * class.cs (MemberCore.IsDuplicateImplementation): Report the
1346         error here and not in our caller.
1347
1348 2004-03-19  Martin Baulig  <martin@ximian.com>
1349
1350         * interface.cs: Completely killed this file.
1351         (Interface): We're now a TypeContainer and live in class.cs.
1352
1353         * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
1354         argument; we're now also called for interfaces.
1355         (TypeContainer.DefineMembers): Allow this method being called
1356         multiple times.
1357         (TypeContainer.GetMethods): New public method; formerly known as
1358         Interface.GetMethod().  This is used by PendingImplementation.
1359         (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
1360         it's now private and non-static.
1361         (Interface): Moved this here; it's now implemented similar to
1362         Class and Struct.
1363         (Method, Property, Event, Indexer): Added `bool is_interface'
1364         argument to their .ctor's.
1365         (MemberBase.IsInterface): New public field.
1366
1367         * cs-parser.jay: Create normal Method, Property, Event, Indexer
1368         instances instead of InterfaceMethod, InterfaceProperty, etc.
1369         (opt_interface_base): Removed; we now use `opt_class_base' instead.
1370         (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
1371
1372 2004-03-19  Martin Baulig  <martin@ximian.com>
1373
1374         * class.cs (MethodCore.IsDuplicateImplementation): New private
1375         method which does the CS0111 checking.
1376         (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
1377         Use IsDuplicateImplementation().
1378
1379 2004-03-17 Ben Maurer  <bmaurer@users.sourceforge.net>
1380
1381         * decl.cs (FindMemberToOverride): New method to find the correct
1382         method or property to override in the base class.
1383         * class.cs
1384             - Make Method/Property use the above method to find the
1385               version in the base class.
1386             - Remove the InheritableMemberSignatureCompare as it is now
1387               dead code.
1388
1389         This patch makes large code bases much faster to compile, as it is
1390         O(n) rather than O(n^2) to do this validation.
1391
1392         Also, it fixes bug 52458 which is that nested classes are not
1393         taken into account when finding the base class member.
1394
1395         Reviewed/Approved by Martin.
1396
1397 2004-03-17  Marek Safar  <marek.safar@seznam.cz>
1398
1399         * interface.cs: In all interface classes removed redundant
1400         member initialization.
1401
1402 2004-03-16  Martin Baulig  <martin@ximian.com>
1403
1404         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
1405
1406 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
1407
1408         * decl.cs (DefineTypeAndParents): New helper method to define a
1409         type's containers before the type itself is defined;  This is a
1410         bug exposed by the recent changes to Windows.Forms when an
1411         implemented interface was defined inside a class that had not been
1412         built yet.   
1413
1414         * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
1415
1416         (Check): Loop correctly to report errors modifiers
1417         (UNSAFE was not in the loop, since it was the same as TOP).
1418
1419         * interface.cs: Every interface member now takes a ModFlags,
1420         instead of a "is_new" bool, which we set on the base MemberCore. 
1421
1422         Every place where we called "UnsafeOk" in the interface, now we
1423         call the proper member (InterfaceMethod.UnsafeOK) instead to get
1424         the unsafe settings from the member declaration instead of the
1425         container interface. 
1426
1427         * cs-parser.jay (opt_new): Allow unsafe here per the spec. 
1428
1429         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
1430         `set_indexer_name' to the pending bits (one per type).
1431
1432         We fixed a bug today that was picking the wrong method to
1433         override, since for properties the existing InterfaceMethod code
1434         basically ignored the method name.  Now we make sure that the
1435         method name is one of the valid indexer names.
1436
1437 2004-03-14  Gustavo Giráldez  <gustavo.giraldez@gmx.net>
1438  
1439         * support.cs (SeekableStreamReader): Keep track of stream byte
1440         positions and don't mix them with character offsets to the buffer.
1441
1442         Patch from Gustavo Giráldez
1443
1444 2004-03-15  Marek Safar  <marek.safar@seznam.cz>
1445
1446         * interface.cs (InterfaceSetGetBase): Removed double member
1447         initialization, base class does it as well.
1448
1449 2004-03-13  Martin Baulig  <martin@ximian.com>
1450
1451         * class.cs: Reverted Miguel's latest commit; it makes mcs crash
1452         when compiling corlib.
1453
1454 2004-03-13  Miguel de Icaza  <miguel@ximian.com>
1455
1456         * convert.cs (ExplicitConversion): We were reporting an error on
1457         certain conversions (object_type source to a value type, when the
1458         expression was `null') before we had a chance to pass it through
1459         the user defined conversions.
1460
1461         * driver.cs: Replace / and \ in resource specifications to dots.
1462         Fixes 50752
1463
1464         * class.cs: Add check for duplicate operators.  Fixes 52477
1465
1466 2004-03-11  Miguel de Icaza  <miguel@ximian.com>
1467
1468         * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
1469         that are in the middle of the statements, not only at the end.
1470         Fixes #54987
1471
1472         * class.cs (TypeContainer.AddField): No longer set the
1473         `HaveStaticConstructor' flag, now we call it
1474         `UserDefineStaticConstructor' to diferentiate the slightly
1475         semantic difference.
1476
1477         The situation is that we were not adding BeforeFieldInit (from
1478         Modifiers.TypeAttr) to classes that could have it.
1479         BeforeFieldInit should be set to classes that have no static
1480         constructor. 
1481
1482         See:
1483
1484         http://www.yoda.arachsys.com/csharp/beforefieldinit.html
1485
1486         And most importantly Zoltan's comment:
1487
1488         http://bugzilla.ximian.com/show_bug.cgi?id=44229
1489
1490         "I think beforefieldinit means 'it's ok to initialize the type sometime 
1491          before its static fields are used', i.e. initialization does not need
1492          to be triggered by the first access to the type. Setting this flag
1493          helps the JIT to compile better code, since it can run the static
1494          constructor at JIT time, and does not need to generate code to call it
1495          (possibly lots of times) at runtime. Unfortunately, mcs does not set
1496          this flag for lots of classes like String. 
1497          
1498          csc sets this flag if the type does not have an explicit static 
1499          constructor. The reasoning seems to be that if there are only static
1500          initalizers for a type, and no static constructor, then the programmer
1501          does not care when this initialization happens, so beforefieldinit
1502          can be used.
1503          
1504          This bug prevents the AOT compiler from being usable, since it 
1505          generates so many calls to mono_runtime_class_init that the AOT code
1506          is much slower than the JITted code. The JITted code is faster, 
1507          because it does not generate these calls if the vtable is type is
1508          already initialized, which is true in the majority of cases. But the
1509          AOT compiler can't do this."
1510
1511 2004-03-10  Miguel de Icaza  <miguel@ximian.com>
1512
1513         * class.cs (MethodData.Emit): Refactor the code so symbolic
1514         information is generated for destructors;  For some reasons we
1515         were taking a code path that did not generate symbolic information
1516         before. 
1517
1518 2004-03-11 Ben Maurer  <bmaurer@users.sourceforge.net>
1519
1520         * class.cs: Create a Constructor.CheckBase method that
1521         takes care of all validation type code. The method
1522         contains some code that was moved from Define.
1523
1524         It also includes new code that checks for duplicate ctors.
1525         This fixes bug #55148.
1526
1527 2004-03-09  Joshua Tauberer <tauberer@for.net>
1528
1529         * expression.cs (ArrayCreation): Fix: More than 6 nulls in
1530         a { ... }-style array creation invokes EmitStaticInitializers
1531         which is not good for reference-type arrays.  String, decimal
1532         and now null constants (NullCast) are not counted toward
1533         static initializers.
1534
1535 2004-03-05  Martin Baulig  <martin@ximian.com>
1536
1537         * location.cs (SourceFile.HasLineDirective): New public field;
1538         specifies whether the file contains or is referenced by a "#line"
1539         directive.
1540         (Location.DefineSymbolDocuments): Ignore source files which
1541         either contain or are referenced by a "#line" directive.        
1542
1543 2004-02-29  Ben Maurer <bmaurer@users.sourceforge.net>
1544
1545         * class.cs (Method.CheckBase): Avoid using FindMembers, we have
1546         direct access to our parent, so check the method inline there.
1547
1548 2004-02-27 Ben Maurer  <bmaurer@users.sourceforge.net>
1549
1550         * expression.cs (Invocation.EmitCall): Miguel's last commit
1551         caused a regression. If you had:
1552
1553             T t = null;
1554             t.Foo ();
1555
1556         In Foo the implict this would be null.
1557
1558 2004-02-27  Miguel de Icaza  <miguel@ximian.com>
1559
1560         * expression.cs (Invocation.EmitCall): If the method is not
1561         virtual, do not emit a CallVirt to it, use Call.
1562
1563         * typemanager.cs (GetFullNameSignature): Improve the method to
1564         cope with ".ctor" and replace it with the type name.
1565
1566         * class.cs (ConstructorInitializer.Resolve): Now the method takes
1567         as an argument the ConstructorBuilder where it is being defined,
1568         to catch the recursive constructor invocations.
1569
1570 2004-02-26  Miguel de Icaza  <miguel@ximian.com>
1571
1572         * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
1573         routines to check if a type is an enumerable/enumerator allow
1574         classes that implement the IEnumerable or IEnumerator interfaces.
1575
1576         * class.cs (Property, Operator): Implement IIteratorContainer, and
1577         implement SetYields.
1578
1579         (Property.Define): Do the block swapping for get_methods in the
1580         context of iterators.   We need to check if Properties also
1581         include indexers or not.
1582
1583         (Operator): Assign the Block before invoking the
1584         OperatorMethod.Define, so we can trigger the Iterator code
1585         replacement. 
1586
1587         * cs-parser.jay (SimpleIteratorContainer): new helper class.  Both
1588         Property and Operator classes are not created when we parse the
1589         declarator but until we have the block completed, so we use a
1590         singleton SimpleIteratorContainer.Simple to flag whether the
1591         SetYields has been invoked.
1592
1593         We propagate this setting then to the Property or the Operator to
1594         allow the `yield' to function.
1595
1596 2004-02-25  Marek Safar  <marek.safar@seznam.cz>
1597
1598         * codegen.cs: Implemented attribute support for modules.
1599         New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
1600         Assembly/Module functionality.
1601
1602         * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
1603         interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
1604         Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
1605
1606 2004-02-16  Marek Safar  <marek.safar@seznam.cz>
1607
1608         * interface.cs (FindMembers): The operation is performed on all base
1609         interfaces and not only on the first. It is required for future CLS Compliance patch.
1610
1611 2004-02-12 Ben Maurer  <bmaurer@users.sourceforge.net>
1612
1613         * statement.cs, codegen.cs:
1614         This patch deals with patterns such as:
1615
1616         public class List : IEnumerable {
1617
1618                 public MyEnumerator GetEnumerator () {
1619                         return new MyEnumerator(this);
1620                 }
1621
1622                 IEnumerator IEnumerable.GetEnumerator () {
1623                         ...
1624                 }
1625                 
1626                 public struct MyEnumerator : IEnumerator {
1627                         ...
1628                 }
1629         }
1630
1631         Before, there were a few things we did wrong:
1632         1) we would emit callvirt on a struct, which is illegal
1633         2) we emited ldarg when we needed to emit ldarga
1634         3) we would mistakenly call the interface methods on an enumerator
1635         type that derived from IEnumerator and was in another assembly. For example:
1636
1637         public class MyEnumerator : IEnumerator
1638
1639         Would have the interface methods called, even if there were public impls of the
1640         method. In a struct, this lead to invalid IL code.
1641
1642 2004-02-11  Marek Safar  <marek.safar@seznam.cz>
1643
1644         * const.cs: Const is now derived from FieldBase. Method EmitConstant name
1645           renamed to Emit.
1646
1647         * delegate.cs (Define): Fixed crash when delegate type is undefined.
1648
1649 2004-02-11  Miguel de Icaza  <miguel@ximian.com>
1650
1651         * cs-parser.jay: Fix small regression: we were not testing V2
1652         compiler features correctly.
1653
1654         * interface.cs: If the emit context is null, then create one
1655
1656 2004-02-09  Marek Safar  <marek.safar@seznam.cz>
1657
1658         * decl.cs (GetSignatureForError): New virtual method to get full name
1659           for error messages.
1660
1661         * attribute.cs (IAttributeSupport): New interface for attribute setting.
1662           Now it is possible to rewrite ApplyAttributes method to be less if/else.
1663
1664         * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
1665           Duplicated members and code in these classes has been removed.
1666           Better encapsulation in these classes.
1667
1668 2004-02-07  Miguel de Icaza  <miguel@ximian.com>
1669
1670         * assign.cs (Assign.DoResolve): When dealing with compound
1671         assignments, there is a new rule in ECMA C# 2.4 (might have been
1672         there before, but it is documented here) that states that in:
1673
1674         a op= b;
1675
1676         If b is of type int, and the `op' is a shift-operator, then the
1677         above is evaluated as:
1678
1679         a = (int) a op b 
1680
1681         * expression.cs (Binary.ResolveOperator): Instead of testing for
1682         int/uint/long/ulong, try to implicitly convert to any of those
1683         types and use that in pointer arithmetic.
1684
1685         * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
1686         method to print information for from the type, not from the
1687         null-method we were given.
1688
1689 2004-02-01  Duncan Mak  <duncan@ximian.com>
1690
1691         * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
1692         parsing for cmd, fixes bug #53694.
1693
1694 2004-02-04  Marek Safar  <marek.safar@seznam.cz>
1695
1696         * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
1697         in the member name duplication tests. Property and operator name duplication
1698         was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
1699
1700 2004-02-03  Marek Safar  <marek.safar@seznam.cz>
1701
1702         * interface.cs (PopulateMethod): Fixed crash when interface method
1703         returns not existing type (error test cs0246-3.cs).
1704
1705 2004-02-02  Ravi Pratap M <ravi@ximian.com>
1706
1707         * cs-parser.jay (interface_accessors): Re-write actions to also
1708         store attributes attached to get and set methods. Fix spelling
1709         while at it.
1710
1711         (inteface_property_declaration): Modify accordingly.
1712
1713         (InterfaceAccessorInfo): New helper class to store information to pass
1714         around between rules that use interface_accessors.
1715
1716         * interface.cs (Emit): Apply attributes on the get and set
1717         accessors of properties and indexers too.
1718
1719         * attribute.cs (ApplyAttributes): Modify accordingly to use the
1720         right MethodBuilder when applying attributes to the get and set accessors.
1721
1722 2004-01-31  Miguel de Icaza  <miguel@ximian.com>
1723
1724         * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
1725
1726 2004-01-26  Miguel de Icaza  <miguel@ximian.com>
1727
1728         * cs-tokenizer.cs: Handle #line hidden from PDC bits.
1729
1730 2004-01-25  Miguel de Icaza  <miguel@ximian.com>
1731
1732         * cs-parser.jay: Remove YIELD token, instead use the new grammar
1733         changes that treat `yield' specially when present before `break'
1734         or `return' tokens.
1735
1736         * cs-tokenizer.cs: yield is no longer a keyword.
1737
1738 2004-01-23  Marek Safar  <marek.safar@seznam.cz>
1739
1740         * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
1741         setting for default constructors.
1742         For default constructors are almost every time set wrong Modifier. The
1743         generated IL code has been alright. But inside mcs this values was
1744         wrong and this was reason why several of my CLS Compliance tests
1745         failed.
1746
1747 2004-01-22  Martin Baulig  <martin@ximian.com>
1748
1749         * cs-parser.jay (namespace_or_type_name): Return an Expression,
1750         not a QualifiedIdentifier.  This is what `type_name_expression'
1751         was previously doing.
1752         (type_name_expression): Removed; the code is now in
1753         `namespace_or_type_name'.
1754         (qualified_identifier): Removed, use `namespace_or_type_name'
1755         instead.
1756         (QualifiedIdentifier): Removed this class.      
1757
1758 2004-01-22  Martin Baulig  <martin@ximian.com>
1759
1760         * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
1761         not a string as alias name.
1762
1763 2004-01-21  Miguel de Icaza  <miguel@ximian.com>
1764
1765         * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
1766         #52730 bug, and instead compute correctly the need to use a
1767         temporary variable when requesting an address based on the
1768         static/instace modified of the field and the constructor.
1769  
1770 2004-01-21  Martin Baulig  <martin@ximian.com>
1771
1772         * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
1773         class and namespace before looking up aliases.  Fixes #52517.
1774
1775 2004-01-21  Martin Baulig  <martin@ximian.com>
1776
1777         * flowanalysis.cs (UsageVector.Merge): Allow variables being
1778         assinged in a 'try'; fixes exception4.cs.
1779
1780 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
1781         * class.cs : Implemented parameter-less constructor for TypeContainer
1782
1783         * decl.cs: Attributes are now stored here. New property OptAttributes
1784
1785         * delegate.cs, enum.cs, interface.cs: Removed attribute member.
1786
1787         * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
1788
1789 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
1790
1791         * typemanager.cs (CSharpSignature): Now reports also inner class name.
1792           (CSharpSignature): New method for indexer and property signature.
1793
1794 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
1795
1796         * pending.cs (IsVirtualFilter): Faster implementation.
1797
1798 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
1799
1800         * typemanager.cs: Avoid inclusion of same assembly more than once.
1801
1802 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
1803
1804         * cs-parser.jay: Fixed problem where the last assembly attribute
1805           has been applied also to following declaration (class, struct, etc.)
1806           
1807 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
1808
1809         * class.cs: Added error CS0538, CS0539 reporting.
1810         Fixed crash on Microsoft runtime when field type is void.
1811
1812         * cs-parser.jay: Added error CS0537 reporting.
1813
1814         * pending.cs: Added error CS0535 reporting.
1815         Improved error report for errors CS0536, CS0534.
1816
1817 2004-01-20  Miguel de Icaza  <miguel@ximian.com>
1818
1819         Merge a few bits from the Anonymous Method MCS tree.
1820
1821         * statement.cs (ToplevelBlock): New class for toplevel methods,
1822         will hold anonymous methods, lifted variables.
1823
1824         * cs-parser.jay: Create toplevel blocks for delegates and for
1825         regular blocks of code. 
1826
1827 2004-01-20  Martin Baulig  <martin@ximian.com>
1828
1829         * codegen.cs (EmitContext): Removed `InTry', `InCatch',
1830         `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
1831         and `NeedExplicitReturn'; added `IsLastStatement'.
1832         (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
1833         have a `ReturnLabel' or we're not unreachable.
1834
1835         * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
1836         child's reachability; don't just override ours with it.  Fixes
1837         #58058 (lluis's example).
1838         (FlowBranching): Added public InTryOrCatch(), InCatch(),
1839         InFinally(), InLoop(), InSwitch() and
1840         BreakCrossesTryCatchBoundary() methods.
1841
1842         * statement.cs (Return): Do all error checking in Resolve().
1843         Unless we are the last statement in a top-level block, always
1844         create a return label and jump to it.
1845         (Break, Continue): Do all error checking in Resolve(); also make
1846         sure we aren't leaving a `finally'.
1847         (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
1848         statement in a top-level block.
1849         (Block.Flags): Added `IsDestructor'.
1850         (Block.IsDestructor): New public property.
1851
1852 2004-01-20  Martin Baulig  <martin@ximian.com>
1853
1854         * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
1855
1856 2004-01-20  Martin Baulig  <martin@ximian.com>
1857
1858         * statement.cs (Statement.ResolveUnreachable): New public method.
1859         (If, While): Do the dead-code elimination in Resolve(), not in Emit().
1860         (Block.Resolve): Resolve unreachable statements.
1861
1862 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
1863
1864         * expression.cs: We need to fix the case where we do
1865         not have a temp variable here.
1866
1867         * assign.cs: Only expression compound assignments need
1868         temporary variables.
1869
1870 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
1871
1872         * flowanalysis.cs: Reduce memory allocation in a few ways:
1873           - A block with no variables should not allocate a bit
1874             vector for itself.
1875           - A method with no out parameters does not need any tracking
1876             for assignment of the parameters, so we need not allocate
1877             any data for it.
1878           - The arrays:
1879                 public readonly Type[] VariableTypes;
1880                 public readonly string[] VariableNames;
1881             Are redundant. The data is already stored in the variable
1882             map, so we need not allocate another array for it.
1883           - We need to add alot of checks for if (params | locals) == null
1884             due to the first two changes.
1885
1886 2004-01-18  Miguel de Icaza  <miguel@ximian.com>
1887
1888         * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
1889         implement IMemoryLocation, we store a copy on a local variable and
1890         take the address of it.  Patch from Benjamin Jemlich
1891
1892         * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
1893         to use a special "type_name_expression" rule which reduces the
1894         number of "QualifiedIdentifier" classes created, and instead
1895         directly creates MemberAccess expressions.
1896
1897 2004-01-17  Miguel de Icaza  <miguel@ximian.com>
1898
1899         * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
1900         that fixes #52853.  Null literal assignment to ValueType
1901
1902         * class.cs (MethodData.Emit): Instead of checking the name of the
1903         method to determine if its a destructor, create a new derived
1904         class from Method called Destructor, and test for that.  
1905
1906         * cs-parser.jay: Create a Destructor object instead of a Method.  
1907
1908         Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
1909
1910         Fixes: 52933
1911
1912 2004-01-16  Miguel de Icaza  <miguel@ximian.com>
1913
1914         * expression.cs (Binary.ResolveOperator): Perform an implicit
1915         conversion from MethodGroups to their delegate types on the
1916         Addition operation.
1917
1918         * delegate.cs: Introduce a new class DelegateCreation that is the
1919         base class for `NewDelegate' and `ImplicitDelegateCreation',
1920         factor some code in here.
1921
1922         * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
1923         conversion from MethodGroups to compatible delegate types. 
1924
1925         * ecore.cs (Expression.Resolve): Do not flag error 654
1926         (Methodgroupd needs parenthesis) if running on the V2 compiler, as
1927         we allow conversions from MethodGroups to delegate types now.
1928
1929         * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
1930         assignments in v2 either.
1931
1932 2004-01-10  Miguel de Icaza  <miguel@ximian.com>
1933
1934         * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
1935         static read-only fields in ctors.
1936
1937         Applied patch from Benjamin Jemlich 
1938
1939         * expression.cs (UnaryMutator): Avoid leaking local variables. 
1940
1941 2004-01-09  Miguel de Icaza  <miguel@ximian.com>
1942
1943         * cs-tokenizer.cs (IsCastToken): Allow the various native types
1944         here to return true, as they can be used like this:
1945
1946                 (XXX) int.MEMBER ()
1947
1948         Fixed 49836 and all the other dups
1949
1950 2004-01-09  Zoltan Varga  <vargaz@freemail.hu>
1951
1952         * driver.cs: Implement /win32res and /win32icon.
1953
1954 2004-01-08  Miguel de Icaza  <miguel@ximian.com>
1955
1956         * cs-parser.jay: Add a rule to improve error handling for the
1957         common mistake of placing modifiers after the type.
1958
1959 2004-01-07  Miguel de Icaza  <miguel@ximian.com>
1960
1961         * cs-parser.jay (interface_event_declaration): Catch
1962         initialization of events on interfaces, and report cs0068
1963
1964         * cs-parser.jay (interface_event_declaration): Catch
1965         initialization of events. 
1966
1967         * ecore.cs: Better report missing constructors.
1968
1969         * expression.cs (Binary.ResolveOperator): My previous bug fix had
1970         the error reporting done in the wrong place.  Fix.
1971
1972         * expression.cs (Binary.ResolveOperator): Catch the 
1973         operator + (E x, E y) error earlier, and later allow for implicit
1974         conversions in operator +/- (E e, U x) from U to the underlying
1975         type of E.
1976
1977         * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
1978         52596, if the container class is abstract, the default constructor
1979         is protected otherwise its public (before, we were always public).
1980
1981         * statement.cs (Fixed.Resolve): Catch a couple more errors in the
1982         fixed statement.
1983
1984         (Using.EmitLocalVariableDecls): Applied patch from Benjamin
1985         Jemlich that fixes bug #52597, MCS was generating invalid code for
1986         idisposable structs.   Thanks to Ben for following up with this
1987         bug as well.
1988
1989 2004-01-06  Miguel de Icaza  <miguel@ximian.com>
1990
1991         * driver.cs: Allow assemblies without code to be generated, fixes
1992         52230.
1993
1994 2004-01-07  Nick Drochak <ndrochak@gol.com>
1995
1996         * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
1997
1998 2004-01-05  Miguel de Icaza  <miguel@ximian.com>
1999
2000         * cs-parser.jay: Add rules to improve error reporting if fields or
2001         methods are declared at the namespace level (error 116)
2002
2003         * Add rules to catch event add/remove
2004
2005 2004-01-04  David Sheldon <dave-mono@earth.li>
2006
2007   * expression.cs: Added matching ")" to error message for 
2008   CS0077
2009
2010 2004-01-03 Todd Berman <tberman@gentoo.org>
2011
2012         * ecore.cs, attribute.cs:
2013         Applying fix from #52429.
2014
2015 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
2016
2017         * ecore.cs, expression.cs, statement.cs:
2018         Total rewrite of how we handle branching. We
2019         now handle complex boolean expressions with fewer
2020         jumps. As well if (x == 0) no longer emits a ceq.
2021
2022         if (x is Foo) is much faster now, because we generate
2023         better code.
2024
2025         Overall, we get a pretty big improvement on our benchmark
2026         tests. The code we generate is smaller and more readable.
2027
2028         I did a full two-stage bootstrap. The patch was reviewed
2029         by Martin and Miguel.
2030
2031 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
2032
2033         * cs-parser.jay: Make primary_expression not take a QI.
2034         we dont need this because the member_access rule covers
2035         us here. So we replace the rule with just IDENTIFIER.
2036
2037         This has two good effects. First, we remove a s/r conflict.
2038         Second, we allocate many fewer QualifiedIdentifier objects.
2039
2040 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
2041
2042         * attribute.cs: Handle MarshalAs attributes as pseudo, and
2043         set the correct information via SRE. This prevents
2044         hanging on the MS runtime. Fixes #29374.
2045
2046 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
2047
2048         * convert.cs: correctly handle conversions to value types
2049         from Enum and ValueType as unboxing conversions.
2050
2051         Fixes bug #52569. Patch by Benjamin Jemlich.
2052
2053 2004-01-02  Ravi Pratap  <ravi@ximian.com>
2054
2055         * expression.cs (BetterConversion): Prefer int -> uint
2056         over int -> ulong (csc's behaviour). This fixed bug #52046.
2057
2058 2004-01-02 Ben Maurer  <bmaurer@users.sourceforge.net>
2059
2060         * decl.cs (MemberCache.FindMembers): now returns a
2061         MemberInfo [].
2062
2063         * typemanager.cs: In general, go with with ^^.
2064         (CopyNewMethods): take an IList.
2065         (RealMemberLookup): Only allocate an arraylist
2066         if we copy from two sets of methods.
2067
2068         This change basically does two things:
2069         1) Fewer array lists allocated due to CopyNewMethods.
2070         2) the explicit cast in MemberList costed ALOT.
2071
2072 2004-01-02  Zoltan Varga  <vargaz@freemail.hu>
2073
2074         * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
2075         a hashtable to avoid needless string allocations when an identifier is
2076         used more than once (the common case).
2077
2078 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
2079
2080         * pending.cs: MS's TypeBuilder.GetInterfaces ()
2081         is broken, it will not return anything. So, we
2082         have to use the information we have in mcs to
2083         do the task.
2084
2085         * typemanager.cs: Add a cache for GetInterfaces,
2086         since this will now be used more often (due to ^^)
2087
2088         (GetExplicitInterfaces) New method that gets the
2089         declared, not effective, interfaces on a type
2090         builder (eg, if you have interface IFoo, interface
2091         IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
2092         { IBar }.
2093
2094         This patch makes MCS able to bootstrap itself on
2095         Windows again.
2096
2097 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
2098
2099         * expression.cs: Remove the Nop's that Miguel put
2100         in by mistake.
2101
2102 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
2103
2104         * report.cs, codegen.cs: Give the real stack trace to
2105         the error when an exception is thrown.
2106
2107 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
2108
2109         * decl.cs: only allocate hashtables for ifaces if 
2110         it is an iface!
2111
2112 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
2113
2114         * expression.cs: fix the error from cs0121-2.cs
2115         (a parent interface has two child interfaces that
2116         have a function with the same name and 0 params
2117         and the function is called through the parent).
2118
2119 2003-12-30 Ben Maurer  <bmaurer@users.sourceforge.net>
2120
2121         * class.cs, rootcontext.cs, typmanager.cs: do not
2122         leak pointers.
2123
2124 2003-12-28 Ben Maurer  <bmaurer@users.sourceforge.net>
2125
2126         * codegen.cs: remove stack for the ec flow branching.
2127         It is already a linked list, so no need.
2128
2129 2003-12-27 Ben Maurer  <bmaurer@users.sourceforge.net>
2130
2131         * Makefile: Allow custom profiler here.
2132
2133 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
2134
2135         * typemanager.cs (LookupType):
2136           - Use a static char [], because split takes
2137             a param array for args, so it was allocating
2138             every time.
2139           - Do not store true in a hashtable, it boxes.
2140
2141 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
2142
2143         * flowanalysis.cs: bytify common enums.
2144
2145 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
2146
2147         * modifiers.cs: Add a new set of flags for the
2148         flags allowed on explicit interface impls.
2149         * cs-parser.jay: catch the use of modifiers in
2150         interfaces correctly.
2151         * class.cs: catch private void IFoo.Blah ().
2152
2153         All related to bug #50572.
2154
2155 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
2156
2157         * decl.cs: Rewrite the consistant accessability checking.
2158         Accessability is not linear, it must be implemented in
2159         a tableish way. Fixes #49704.
2160
2161 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
2162
2163         * expression.cs: Handle negation in a checked context.
2164         We must use subtraction from zero. Fixes #38674.
2165
2166 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
2167
2168         * class.cs: Ignore static void main in DLLs.
2169         * rootcontext.cs: Handle the target type here,
2170         since we are have to access it from class.cs
2171         * driver.cs: account for the above.
2172
2173 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
2174
2175         * report.cs: Give line numbers and files if available.
2176
2177 2003-12-20  Zoltan Varga  <vargaz@freemail.hu>
2178
2179         * driver.cs: Implement /addmodule.
2180
2181         * typemanager.cs:  Change 'modules' field so it now contains Modules not
2182         ModuleBuilders.
2183
2184 2003-12-20  Martin Baulig  <martin@ximian.com>
2185
2186         * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
2187         (FieldBase.IsAssigned): Removed this field.
2188         (FieldBase.SetAssigned): New public method.
2189         (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
2190
2191 2003-12-20  Martin Baulig  <martin@ximian.com>
2192
2193         * expression.cs (LocalVariableReference.DoResolve): Don't set
2194         `vi.Used' if we're called from DoResolveLValue().
2195
2196         * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
2197         returns the usage vector it just merged into the current one -
2198         pass this one to UsageWarning().
2199         (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
2200         of the `EmitContext', don't call this recursively on our children.
2201
2202 2003-12-19  Zoltan Varga  <vargaz@freemail.hu>
2203
2204         * driver.cs: Implement /target:module.
2205
2206 2003-12-18  Zoltan Varga  <vargaz@freemail.hu>
2207
2208         * support.cs (CharArrayHashtable): New helper class.
2209
2210         * cs-tokenizer.cs: Store keywords in a hashtable indexed by 
2211         char arrays, not strings, so we can avoid creating a string in
2212         consume_identifier if the identifier is a keyword.
2213
2214 2003-12-16  Martin Baulig  <martin@ximian.com>
2215
2216         * statement.cs (LocalInfo.Assigned): Removed this property.
2217         (LocalInfo.Flags): Removed `Assigned'.
2218         (LocalInfo.IsAssigned): New public method; takes the EmitContext
2219         and uses flow analysis.
2220         (Block.UsageWarning): Made this method private.
2221         (Block.Resolve): Call UsageWarning() if appropriate.
2222
2223         * expression.cs (LocalVariableReference.DoResolve): Always set
2224         LocalInfo.Used here.
2225
2226 2003-12-13  Martin Baulig  <martin@ximian.com>
2227
2228         * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
2229         any value here; we're now using flow analysis to figure out
2230         whether a statement/block returns a value.
2231
2232 2003-12-13  Martin Baulig  <martin@ximian.com>
2233
2234         * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
2235         working again.
2236         (FlowBranching.MergeFinally): Don't call
2237         `branching.CheckOutParameters()' here, this is called in
2238         MergeTopBlock().
2239         (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
2240         when adding the `finally' vector.       
2241
2242 2003-12-13  Martin Baulig  <martin@ximian.com>
2243
2244         * flowanalysis.cs
2245         (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
2246         actually work and also fix #48962.
2247
2248 2003-12-12 Ben Maurer  <bmaurer@users.sourceforge.net>
2249
2250         * decl.cs: Do not check System.Object for nested types,
2251         since we know it does not have any. Big bang for buck:
2252
2253         BEFORE:
2254            Run 1:   8.35 seconds
2255            Run 2:   8.32 seconds
2256            corlib:  17.99 seconds
2257         AFTER:
2258            Run 1:   8.17 seconds
2259            Run 2:   8.17 seconds
2260            corlib:  17.39 seconds
2261
2262 2003-12-11 Ben Maurer  <bmaurer@users.sourceforge.net>
2263
2264         * class.cs (FindMembers): Allocate arraylists on demand. Most of the
2265         time we are returning 0 members, so we save alot here.
2266
2267 2003-12-11  Martin Baulig  <martin@ximian.com>
2268
2269         * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
2270         `MergeChild()', also just take the `FlowBranching' as argument;
2271         call Merge() on it and return the result.
2272         (FlowBranching.Merge): We don't need to do anything if we just
2273         have one sibling.
2274
2275 2003-12-11  Martin Baulig  <martin@ximian.com>
2276
2277         * flowanalysis.cs: Use a list of `UsageVector's instead of storing
2278         them in an `ArrayList' to reduce memory usage.  Thanks to Ben
2279         Maurer for this idea.
2280
2281 2003-12-11  Martin Baulig  <martin@ximian.com>
2282
2283         * flowanalysis.cs (MergeResult): This class is now gone; we now
2284         use the `UsageVector' for this.  The reason for this is that if a
2285         branching just has one sibling, we don't need to "merge" them at
2286         all - that's the next step to do.
2287         (FlowBranching.Merge): We now return a `UsageVector' instead of a
2288         `MergeResult'.
2289
2290 2003-12-11  Martin Baulig  <martin@ximian.com>
2291
2292         Reworked flow analyis and made it more precise and bug-free.  The
2293         most important change is that we're now using a special `Reachability'
2294         class instead of having "magic" meanings of `FlowReturns'.  I'll
2295         do some more cleanups and optimizations and also add some more
2296         documentation this week.
2297
2298         * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
2299         largely reworked this class.
2300         (FlowReturns): Removed `Unreachable' and `Exception'; we now use
2301         the new `Reachability' class instead of having "magic" values here.
2302         (FlowBranching): We're now using an instance of `Reachability'
2303         instead of having separate `Returns', `Breaks' etc. fields.
2304
2305         * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
2306         based on flow analysis; ignore the return value of block.Emit ().
2307
2308 2003-12-10  Zoltan Varga  <vargaz@freemail.hu>
2309
2310         * driver.cs typemanager.cs: Find the mono extensions to corlib even
2311         if they are private.
2312
2313 2003-12-09  Martin Baulig  <martin@ximian.com>
2314
2315         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
2316         call them directly on the UsageVector.
2317
2318 2003-12-09  Martin Baulig  <martin@ximian.com>
2319
2320         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
2321         Changed return type from `FlowReturns' to `Reachability'.
2322
2323 2003-12-09  Martin Baulig  <martin@ximian.com>
2324
2325         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
2326         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
2327         `Reachable' fields with a single `Reachability' one.
2328
2329 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
2330
2331         * class.cs (FindMembers): Remove foreach's.
2332
2333         Bootstrap times:
2334
2335         BEFORE
2336                 Run 1:   8.74 seconds
2337                 Run 2:   8.71 seconds
2338
2339         AFTER
2340                 Run 1:   8.64 seconds
2341                 Run 2:   8.58 seconds
2342
2343
2344 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
2345
2346         * cs-parser.jay:
2347         * gen-treedump.cs:
2348         * statement.cs:
2349         This patch does a few things:
2350                 1. EmptyStatement is now a singleton, so it is never reallocated.
2351                 2. All blah is EmptyStatement constructs have been changed to
2352                    blah == EmptyStatement.Value, which is much faster and valid
2353                    now that EmptyStatement is a singleton.
2354                 3. When resolving a block, rather than allocating a new array for
2355                    the non-empty statements, empty statements are replaced with
2356                    EmptyStatement.Value
2357                 4. Some recursive functions have been made non-recursive.
2358         Mainly the performance impact is from (3), however (1) and (2) are needed for
2359         this to work. (4) does not make a big difference in normal situations, however
2360         it makes the profile look saner.
2361
2362         Bootstrap times:
2363
2364         BEFORE
2365         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2366         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
2367         Total memory allocated: 56397 KB
2368
2369         AFTER
2370         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
2371         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
2372         Total memory allocated: 55666 KB
2373
2374 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
2375
2376         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
2377         than the hashtable in a hashtable version
2378
2379         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
2380         we always end up concating a string. This results in a huge perf
2381         loss, because many strings have to be tracked by the GC. In this
2382         patch, we first use a hashtable that works with two keys, so that
2383         the strings do not need to be concat'ed.
2384
2385         Bootstrap times:
2386         BEFORE
2387                 Run 1:   8.74 seconds
2388                 Run 2:   8.71 seconds
2389
2390         AFTER
2391                 Run 1:   8.65 seconds
2392                 Run 2:   8.56 seconds
2393
2394 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
2395
2396         * Makefile: Add a new target `do-time' that does a quick and simple
2397         profile, leaving easy to parse output.
2398
2399 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
2400
2401         * codegen.cs (Init): Create the dynamic assembly with 
2402         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
2403
2404 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
2405
2406         * support.cs: Make the PtrHashtable use only one
2407         instance of its comparer.
2408
2409 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
2410
2411         * typemanager.cs: Fix lookup of GetNamespaces.
2412
2413 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
2414
2415         * expression.cs: Removed redundant line.
2416
2417         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
2418         ArrayLists, use for loops with bounds.  
2419
2420         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
2421         arraylist.
2422
2423         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
2424         arraylists, use for loop with bounds.
2425
2426         The above three changes give us a 0.071 second performance
2427         improvement out of 3.294 seconds down to 3.223.  On my machine
2428         the above changes reduced the memory usage by 1,387 KB during
2429         compiler bootstrap.
2430
2431         * cs-parser.jay (QualifiedIdentifier): New class used to represent
2432         QualifiedIdentifiers.  Before we created a new string through
2433         concatenation, and mostly later on, the result would be
2434         manipulated by DecomposeQI through string manipulation.
2435
2436         This reduced the compiler memory usage for bootstrapping from
2437         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
2438         compile times in 0.05 seconds.
2439
2440 2003-11-28  Dick Porter  <dick@ximian.com>
2441
2442         * support.cs: Do string compares with the Invariant culture.
2443
2444         * rootcontext.cs: 
2445         * gen-treedump.cs: 
2446         * expression.cs: 
2447         * driver.cs: 
2448         * decl.cs: 
2449         * codegen.cs: 
2450         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
2451         the comparison is done with the Invariant culture.
2452
2453 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
2454
2455         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
2456         GetEnumerator method.
2457
2458         (ProbeCollectionType): Iterate starting at the most specific type
2459         upwards looking for a GetEnumerator
2460
2461         * expression.cs: Shift count can be up to 31 for int/uint and 63
2462         for long/ulong.
2463
2464 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
2465
2466         * statement.cs (Block.LookupLabel): Also look for the label on the
2467         children blocks.  Use a hash table to keep track of visited
2468         nodes. 
2469
2470         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
2471         we actually did transform the other operand, otherwise fall back
2472         to the common codepath that casts to long.
2473
2474         * cs-tokenizer.cs: Use the same code pattern as the int case.
2475         Maybe I should do the parsing myself, and avoid depending on the
2476         Parse routines to get this done.
2477
2478 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
2479
2480         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
2481         which fixes bug 51347.  This time test it.
2482
2483         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
2484         attributes for example can not tell the difference between these.
2485         The difference was only a syntax feature of the language. 
2486
2487         * attribute.cs: Apply attributes to delegates.
2488
2489         * delegate.cs: Call the apply attributes method.
2490
2491 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
2492
2493         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
2494         comparing 0 vs Byte.MinValue, not the value
2495
2496         (ImplicitConversionRequired): When reporting a conversion error,
2497         use error 31 to print out the constant error instead of the
2498         simpler 29.
2499
2500         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
2501         which fixes bug 51347.
2502
2503 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
2504
2505         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
2506         which fixes the -warnaserror command line option.
2507
2508 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
2509
2510         * cfold.cs (DoNumericPromotions): During constant folding of
2511         additions on UIntConstant, special case intconstants with
2512         IntConstants like we do on the expression binary operator. 
2513
2514 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
2515
2516         * convert.cs (ImplicitReferenceConversion): We were missing a case
2517         (System.Enum are not value types or class types, so we need to
2518         classify them separatedly).
2519
2520         * driver.cs: We do not support error 2007.
2521
2522 2003-11-12 Jackson Harper <jackson@ximian.com>
2523
2524         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
2525         system directory. Also use the full file name so users can
2526         libraries names mscorlib-o-tron.dll in a non system dir.
2527
2528 2003-11-10  Martin Baulig  <martin@ximian.com>
2529
2530         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
2531         (TypeManager.InitCoreTypes): Initialize them here, but instead of
2532         calling `ResolveType()' on them, directly assign their `Type'.
2533
2534 2003-11-08  Martin Baulig  <martin@ximian.com>
2535
2536         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
2537         return value and the `out parent' parameter.
2538         (TypeContainer.DefineType): Moved the CS0644 check into
2539         GetClassBases().  Don't pass the interface types to the
2540         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
2541         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
2542
2543         * ecore.cs (TypeExpr.IsAttribute): New property.
2544         (TypeExpr.GetInterfaces): New method.
2545
2546         * interface.cs (Interface.GetInterfaceTypeByName): Return a
2547         TypeExpr instead of a Type.
2548         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
2549         (Interface.DefineType): Don't pass the interface types to the
2550         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
2551         them later and then call `TypeBulider.AddInterfaceImplementation()'.
2552
2553         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
2554         instead of a `Type[]'.
2555         (TypeManager.RegisterBuilder): Likewise.
2556         (TypeManager.AddUserInterface): Likewise.
2557         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
2558         `Type[]' and also return a `TypeExpr[]'.
2559         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
2560
2561 2003-11-08  Martin Baulig  <martin@ximian.com>
2562
2563         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
2564         Expression.     
2565
2566 2003-11-08  Martin Baulig  <martin@ximian.com>
2567
2568         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
2569         TypeManager.ResolveExpressionTypes().
2570
2571         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
2572         instead of an Expression.
2573         (TypeExpr): This is now an abstract base class for `TypeExpression'.
2574         (TypeExpression): New public class; formerly known as `TypeExpr'.
2575
2576         * expression.cs (ComposedCast): Derive from TypeExpr.
2577
2578         * typemanager.cs (TypeManager.system_*_expr): These are now
2579         TypExpr's instead of Expression's.
2580         (TypeManager.ResolveExpressionTypes): New public static function;
2581         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
2582         of them.        
2583
2584 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
2585
2586         * expression.cs (New.DoResolve): Do not dereference value that
2587         might be a null return.
2588
2589         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
2590         sure that the constant value has the right type.  Fixes an
2591         unreported bug, similar to 50425.
2592
2593         * const.cs (Const.LookupConstantValue): Call
2594         ImplicitStandardConversionExists before doing a conversion to
2595         avoid havng the TypeManager.ChangeType do conversions.
2596
2597         Reduced the number of casts used
2598
2599         (Const.ChangeType): New routine to enable reuse of the constant
2600         type changing code from statement.
2601
2602         * typemanager.cs (ChangeType): Move common initialization to
2603         static global variables.
2604
2605         Fixes #50425.
2606
2607         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
2608         every value type to go through, even if it was void.  Fix that. 
2609
2610         * cs-tokenizer.cs: Use is_identifier_start_character on the start
2611         character of the define, and the is_identifier_part_character for
2612         the rest of the string.
2613
2614 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
2615
2616         * expression.cs (UnaryMutator.EmitCode): When I updated
2617         LocalVariableReference.DoResolve, I overdid it, and dropped an
2618         optimization done on local variable references.
2619
2620 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
2621
2622         * ecore.cs: Convert the return from Ldlen into an int.
2623
2624 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
2625
2626         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
2627         the accessibility, this is a special case for toplevel non-public
2628         classes (internal for instance).
2629
2630 2003-10-20  Nick Drochak <ndrochak@gol.com>
2631
2632         * ecore.cs: Fix typo and build.  Needed another right paren.
2633
2634 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
2635
2636         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
2637         `internal' case regular and protected, but not allowing protected
2638         to be evaluated later.  Bug 49840
2639
2640 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
2641
2642         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
2643         to kb.Nlast, and not the kb.nFirst to isolate the switch
2644         statement.
2645
2646         Extract the underlying type, so enumerations of long/ulong are
2647         treated like long/ulong.
2648
2649 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
2650
2651         * expression.cs (New): Overload the meaning of RequestedType to
2652         track the possible creation of the NewDelegate type, since
2653         DoResolve is invoked more than once for new constructors on field
2654         initialization.
2655
2656         See bugs: #48800 and #37014
2657
2658         * cs-parser.jay (declare_local_constants): Take an arraylist
2659         instead of a single constant.
2660
2661         (local_constant_declaration): It should take a
2662         constant_declarators, not a constant_declarator.  Fixes 49487
2663
2664         * convert.cs: Fix error report.
2665
2666 2003-10-13 Jackson Harper <jackson@ximian.com>
2667
2668         * typemanager.cs (TypeToCoreType): Add float and double this fixes
2669         bug #49611
2670
2671 2003-10-09  Martin Baulig  <martin@ximian.com>
2672
2673         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
2674         to the .ctor.
2675         (MethodCore.DoDefineParameters): Removed the TypeContainer
2676         argument; use the DeclSpace which was passed to the .ctor instead.
2677         (MethodCore.CheckParameter): Take a DeclSpace instead of a
2678         TypeContainer; we only need a DeclSpace here.
2679
2680 2003-10-09  Martin Baulig  <martin@ximian.com>
2681
2682         * class.cs (MethodData): Added additional `DeclSpace ds' argument
2683         to the .ctor.
2684         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
2685         EmitContext's .ctor.    
2686
2687 2003-10-09  Martin Baulig  <martin@ximian.com>
2688
2689         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
2690         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
2691         AsAccessible(), moved them as well.
2692
2693         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
2694
2695 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
2696
2697         * cs-parser.jay : Renamed yyName to yyNames related to jay.
2698
2699 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
2700
2701         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
2702         generation for >=, as spotted by Paolo, bug 48679.  
2703         Patch from David Waite.
2704
2705         * cs-tokenizer.cs: Add handling for #pragma.
2706
2707         * cs-parser.jay: Allow for both yield and yield return in the
2708         syntax.  The anti-cobolization of C# fight will go on!
2709
2710         * class.cs (TypeBuilder.DefineType): Catch error condition here
2711         (Parent.DefineType erroring out and returning null).
2712
2713         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2714         coping with enumerations variables, we were mistakenly processing
2715         them as a regular value type instead of built-in types.  Fixes the
2716         bug #48063
2717
2718         * typemanager.cs (IsBuiltinOrEnum): New method.
2719
2720 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
2721
2722         * cs-parser.jay: Upgrade: yield now needs the return clause.
2723
2724 2003-09-19  Martin Baulig  <martin@ximian.com>
2725
2726         * decl.cs (MemberCache.SetupCacheForInterface): Take a
2727         `MemberCache parent' argument.  Normally, an interface doesn't
2728         have a parent type except System.Object, but we use this in gmcs
2729         for generic type parameters.
2730
2731 2003-09-18  Martin Baulig  <martin@ximian.com>
2732
2733         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
2734         on `type.IsInterface'; don't check whether the type has a parent
2735         to determine whether it's an interface.
2736
2737 2003-09-15  Martin Baulig  <martin@ximian.com>
2738
2739         * class.cs (TypeContainer.DefineType): Added an error flag to
2740         avoid reporting duplicate CS0146's ("class definition is
2741         circular.").
2742
2743         * driver.cs (Driver.MainDriver): Abort if
2744         RootContext.ResolveTree() reported any errors.
2745
2746 2003-09-07  Martin Baulig  <martin@ximian.com>
2747
2748         * report.cs (Error, Warning): Added overloaded versions which take
2749         a `params object[] args' and call String.Format().
2750
2751 2003-09-07  Martin Baulig  <martin@ximian.com>
2752
2753         * decl.cs (DeclSpace..ctor): Don't call
2754         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
2755         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
2756         (DeclSpace.RecordDecl): New method.
2757
2758         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
2759
2760 2003-09-02  Ravi Pratap  <ravi@ximian.com>
2761
2762         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
2763         value attributes to be applied to ParameterBuilders.
2764
2765         * class.cs (MethodCore.LabelParameters): Make static and more
2766         generic so that it can be used from other places - like interface
2767         methods, for instance.
2768
2769         * interface.cs (Interface.Emit): Call LabelParameters before
2770         emitting attributes on the InterfaceMethod.
2771
2772 2003-08-26  Martin Baulig  <martin@ximian.com>
2773
2774         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
2775         resolving aliases; fixes #47927.
2776
2777 2003-08-26  Martin Baulig  <martin@ximian.com>
2778
2779         * statement.cs (Using.DoResolve): This is internally emitting a
2780         try/finally clause, so we need to set ec.NeedExplicitReturn if we
2781         do not always return.  Fixes #47681.
2782
2783 2003-08-26  Martin Baulig  <martin@ximian.com>
2784
2785         * decl.cs (MemberCore): Moved WarningNotHiding(),
2786         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
2787         into MemberBase.
2788         (AdditionResult): Make this nested in DeclSpace.
2789         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
2790         argument; call NamespaceEntry.Define() unless we're nested in a
2791         class or struct.
2792
2793         * namespace.cs (Namespace.DefineName): New public function.  This
2794         is called from DeclSpace's .ctor to add 
2795         (Namespace.Lookup): Include DeclSpaces in the lookup.
2796
2797         * class.cs (Operator): Derive from MemberBase, not MemberCore.
2798
2799         * const.cs (Const): Derive from MemberBase, not MemberCore.     
2800
2801 2003-08-25  Martin Baulig  <martin@ximian.com>
2802
2803         * convert.cs (Convert.ExplicitReferenceConversion): When
2804         converting from an interface type to a class, unbox if the target
2805         type is a struct type.  Fixes #47822.
2806
2807 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2808
2809         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
2810         #47854.
2811
2812 2003-08-22  Martin Baulig  <martin@ximian.com>
2813
2814         * class.cs (TypeManager.DefineType): When defining a nested type,
2815         call DefineType() on our parent; fixes #47801.
2816
2817 2003-08-22  Martin Baulig  <martin@ximian.com>
2818
2819         * class.cs (MethodData.Define): While checking if a method is an
2820         interface implementation, improve the test a bit more to fix #47654.
2821
2822 2003-08-22  Martin Baulig  <martin@ximian.com>
2823
2824         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
2825         correctly; fixes #47722.
2826
2827 2003-08-22  Martin Baulig  <martin@ximian.com>
2828
2829         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
2830         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
2831
2832         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
2833
2834 2003-08-22  Martin Baulig  <martin@ximian.com>
2835
2836         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
2837         can only be assigned in static constructors.  Fixes #47161.
2838
2839 2003-08-22  Martin Baulig  <martin@ximian.com>
2840
2841         Rewrote and improved the flow analysis code.
2842
2843         * flowbranching.cs (FlowBranching): Make this class abstract.
2844         (FlowBranching.CreateBranching): New static function to create a
2845         new flow branching.
2846         (FlowBranchingBlock, FlowBranchingException): New classes.
2847         (FlowBranching.UsageVector.Type): New public readonly field.
2848         (FlowBranching.UsageVector.Breaks): Removed the setter.
2849         (FlowBranching.UsageVector.Returns): Removed the setter.
2850         (FlowBranching.UsageVector): Added Break(), Return(),
2851         NeverReachable() and Throw() methods to modify the reachability.
2852         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
2853         done by FlowBranching.Merge().
2854         (FlowBranching.UsageVector.MergeChild): New method; merges the
2855         merge result into the current vector.
2856         (FlowBranching.Merge): New abstract method to merge a branching.
2857
2858 2003-08-12  Martin Baulig  <martin@ximian.com>
2859
2860         * expression.cs (Indirection.CacheTemporaries): Create the
2861         LocalTemporary with the pointer type, not its element type.
2862
2863 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
2864
2865         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
2866         token was a keyword or not.
2867
2868         Add `error' options where an IDENTIFIER was expected;  Provide
2869         CheckToken and CheckIdentifierToken convenience error reporting
2870         functions. 
2871
2872         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
2873
2874         * decl.cs: Rename `NamespaceEntry Namespace' public field into
2875         NameSpaceEntry NameSpaceEntry.
2876
2877         (LookupInterfaceOrClass): Avoid creating a full qualified name
2878         from namespace and name: avoid doing lookups when we know the
2879         namespace is non-existant.   Use new Tree.LookupByNamespace which
2880         looks up DeclSpaces based on their namespace, name pair.
2881
2882         * driver.cs: Provide a new `parser verbose' to display the
2883         exception thrown during parsing.  This is turned off by default
2884         now, so the output of a failure from mcs is more graceful.
2885
2886         * namespace.cs: Track all the namespaces defined in a hashtable
2887         for quick lookup.
2888
2889         (IsNamespace): New method
2890
2891 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
2892
2893         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
2894         we know that we need to concatenate (full typename can never be
2895         null). 
2896
2897         * class.cs: ditto.
2898
2899         * statement.cs: Use a bitfield;  Do not initialize to null things
2900         which are done by the constructor by default.
2901
2902         * cs-parser.jay: bug fix, parameter was 4, not 3.
2903
2904         * expression.cs: Just use the property;
2905
2906         * statement.cs: No need for GetVariableInfo method.
2907
2908 2003-08-08  Martin Baulig  <martin@ximian.com>
2909
2910         * flowanalysis.cs (FlowReturns): This is now nested in the
2911         `FlowBranching' class.
2912         (MyBitVector): Moved this here from statement.cs.
2913         (FlowBranching.SiblingType): New enum type.
2914         (FlowBranching.CreateSibling): Added `SiblingType' argument.
2915
2916 2003-08-07  Martin Baulig  <martin@ximian.com>
2917
2918         * flowanalysis.cs (FlowBranchingType): This is now nested in the
2919         `FlowBranching' class and called `BranchingType'.
2920
2921 2003-08-07  Martin Baulig  <martin@ximian.com>
2922
2923         * flowanalysis.cs: Moved all the control flow analysis code into
2924         its own file.
2925
2926 2003-08-07  Martin Baulig  <martin@ximian.com>
2927
2928         * assign.cs (Assign.DoResolve): `target' must either be an
2929         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
2930         #37319.
2931
2932 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
2933
2934         * expression.cs (BinaryMethod): This kind of expression is created by the
2935         Binary class if it determines that the operator has to be handled
2936         by a method.
2937
2938         (BinaryDelegate): This kind of expression is created if we are
2939         dealing with a + or - operator on delegates.
2940
2941         (Binary): remove method, argumetns, and DelegateOperator: when
2942         dealing with methods, 
2943
2944         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
2945
2946         * statement.cs (Block): use bitfields for the three extra booleans
2947         we had in use.   Remove unused topblock parameter.
2948
2949         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
2950
2951         * assign.cs: Drop extra unneeded tests.
2952
2953 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
2954
2955         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
2956
2957         * statement.cs (Foreach): Use VariableStorage instead of
2958         LocalBuilders.   
2959
2960         * codegen.cs (VariableStorage): New class used by clients that
2961         require a variable stored: locals or fields for variables that
2962         need to live across yield.
2963
2964         Maybe provide a convenience api for EmitThis+EmitLoad?
2965
2966         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
2967         these bad boys.
2968
2969 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
2970
2971         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
2972         RemapParameterLValue): New methods that are used to turn a
2973         precomputed FieldInfo into an expression like this:
2974
2975                 instance.FieldInfo
2976
2977         The idea is to use this instead of making LocalVariableReference
2978         have more than one meaning.
2979
2980         * cs-parser.jay: Add error production to BASE.
2981
2982         * ecore.cs: Deal with TypeManager.GetField returning null, which
2983         is now a valid return value.
2984
2985         (FieldExprNoAddress): New expression for Fields whose address can
2986         not be taken.
2987
2988         * expression.cs (LocalVariableReference): During the resolve
2989         phases, create new expressions if we are in a remapping context.
2990         Remove code that dealt with remapping here.
2991
2992         (ParameterReference): same.
2993
2994         (ProxyInstance): New expression, like the `This' expression, but
2995         it is born fully resolved.  We know what we are doing, so remove
2996         the errors that are targeted to user-provided uses of `this'.
2997
2998         * statement.cs (Foreach): our variable is now stored as an
2999         Expression;  During resolution, follow the protocol, dont just
3000         assume it will return this.
3001
3002 2003-08-06  Martin Baulig  <martin@ximian.com>
3003
3004         * support.cs (SeekableStreamReader.cs): New public class.
3005
3006         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
3007         SeekableStreamReader instead of the normal StreamReader.
3008
3009 2003-08-04  Martin Baulig  <martin@ximian.com>
3010
3011         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
3012         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
3013         deambiguate casts and delegate invocations.
3014         (parenthesized_expression): Use the new tokens to ensure this is
3015         not a cast of method invocation.
3016
3017         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
3018         when reading a `)' and Deambiguate_CloseParens () was previously
3019         called.
3020
3021         * expression.cs (ParenthesizedExpression): New class.  This is
3022         just used for the CS0075 test.
3023         (Binary.DoResolve): Check for CS0075.   
3024
3025 2003-07-29  Ravi Pratap  <ravi@ximian.com>
3026
3027         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
3028         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
3029         reference comparison.
3030
3031         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
3032         examine the ReturnType for equality - this is necessary in the
3033         cases of implicit and explicit operators whose signature also
3034         includes the return type.
3035
3036 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
3037
3038         * namespace.cs: Cache the result of the namespace computation,
3039         instead of computing it every time.
3040
3041 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
3042
3043         * decl.cs: Use a global arraylist that we reuse over invocations
3044         to avoid excesive memory consumption.  Reduces memory usage on an
3045         mcs compile by one meg (45 average).
3046
3047         * typemanager.cs (LookupTypeReflection): In .NET pointers are
3048         private, work around that.
3049
3050 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
3051
3052         * literal.cs (IntLiteral): Define Zero and One static literals. 
3053
3054         * cs-parser.jay (integer_literal): use static literals to reduce
3055         memory usage for the most used literals (0, 1 and -1).  211kb
3056         reduced in memory usage.
3057
3058         Replace all calls to `new ArrayList' with `new
3059         ArrayList(4)' which is a good average number for most allocations,
3060         and also requires only 16 bytes of memory for its buffer by
3061         default. 
3062
3063         This reduced MCS memory usage in seven megabytes for the RSS after
3064         bootstrapping.
3065
3066 2003-07-28  Ravi Pratap  <ravi@ximian.com>
3067
3068         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
3069         handle params methods the correct way by forming only one
3070         applicable set with params and normal methods in them. Earlier we
3071         were looking at params methods only if we found no normal methods
3072         which was not the correct thing to do.
3073
3074         (Invocation.BetterFunction): Take separate arguments indicating
3075         when candidate and the best method are params methods in their
3076         expanded form.
3077
3078         This fixes bugs #43367 and #46199.
3079
3080         * attribute.cs: Documentation updates.
3081
3082         (CheckAttribute): Rename to CheckAttributeTarget.
3083         (GetValidPlaces): Rename to GetValidTargets.
3084
3085         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
3086         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
3087
3088         Fixes bug #44468.
3089
3090 2003-07-28  Martin Baulig  <martin@ximian.com>
3091
3092         * class.cs (TypeContainer.DefineMembers): Use the base type's full
3093         name when looking up the base class of a nested class.  Fixes #46977.
3094
3095 2003-07-26  Martin Baulig  <martin@ximian.com>
3096
3097         * expression.cs (Indexers.Indexer): New nested struct; contains
3098         getter, setter and the indexer's type.
3099         (Indexers.Properties): This is now an ArrayList of
3100         Indexers.Indexer's.
3101         (IndexerAccess.DoResolveLValue): Correctly set the type if the
3102         indexer doesn't have any getters.
3103
3104         * assign.cs (Assign.DoResolve): Also do the implicit conversions
3105         for embedded property and indexer assignments.
3106
3107 2003-07-26  Martin Baulig  <martin@ximian.com>
3108
3109         * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
3110         preprocessor directive is not the first non-whitespace character
3111         on a line.
3112
3113 2003-07-26  Martin Baulig  <martin@ximian.com>
3114
3115         * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
3116         namespace parsing, follow the spec more closely.
3117
3118         * rootcontext.cs (RootContext.NamespaceLookup): Use the new
3119         NamespaceEntry.Lookup().
3120
3121 2003-07-25  Martin Baulig  <martin@ximian.com>
3122
3123         * MethodCore.cs (OverridesSomething): New public field; it's set
3124         from TypeContainer.DefineMembers if this method overrides
3125         something (which doesn't need to be a method).  Fix #39462.
3126
3127 2003-07-25  Ravi Pratap  <ravi@ximian.com>
3128
3129         * typemanager.cs (GetMembers): Ensure that the list of members is
3130         reversed. This keeps things in sync.
3131
3132         * attribute.cs (Attribute.CheckAttribute): Break as soon as we
3133         find an AttributeUsage attribute.
3134
3135         * expression.cs (Invocation.OverloadResolve): Perform the check
3136         which disallows Invoke to be directly called on a Delegate.
3137
3138         (Error_InvokeOnDelegate): Report error cs1533.
3139
3140 2003-07-25  Martin Baulig  <martin@ximian.com>
3141
3142         * expression.cs (Indexers.GetIndexersForType): Only look in the
3143         interface hierarchy if the requested type is already an
3144         interface.  Fixes #46788 while keeping #46502 fixed.
3145
3146 2003-07-25  Martin Baulig  <martin@ximian.com>
3147
3148         * class.cs (TypeContainer.DefineMembers): Check whether all
3149         readonly fields have been assigned and report warning CS0649 if
3150         not.
3151
3152         * statement.cs (LocalInfo.IsFixed): Always return true if this is
3153         a valuetype.
3154
3155 2003-07-24  Ravi Pratap  <ravi@ximian.com>
3156
3157         * decl.cs (MemberCache.AddMethods): Reverse the order of the array
3158         returned from GetMethods to make things consistent with the
3159         assumptions MCS makes about ordering of methods.
3160
3161         This should comprehensively fix bug #45127 and it does :-)
3162
3163         * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
3164         ordering is actually reverse.
3165
3166         * Clean up some debug messages I left lying around.
3167
3168         * interface.cs (Populate*): Get rid of code which emits attributes
3169         since the stage in which we emit attributes is the 'Emit' stage,
3170         not the define stage.
3171
3172         (Emit): Move attribute emission for interface members here.
3173
3174 2003-07-22  Ravi Pratap  <ravi@ximian.com>
3175
3176         * expression.cs (Invocation.OverloadResolve): Follow the spec more
3177         closely: we eliminate methods in base types when we have an
3178         applicable method in a top-level type.
3179
3180         Please see section 14.5.5.1 for an exact description of what goes
3181         on. 
3182
3183         This fixes bug #45127 and a host of other related to corlib compilation.
3184
3185         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
3186         array is the method corresponding to the top-level type (this is
3187         because of the changes made to icall.c) so we change this
3188         accordingly.
3189
3190         (MethodGroupExpr.Name): This too.
3191
3192         * typemanager.cs (GetElementType): New method which does the right
3193         thing when compiling corlib. 
3194
3195         * everywhere: Make use of the above in the relevant places.
3196
3197 2003-07-22  Martin Baulig  <martin@ximian.com>
3198
3199         * cs-parser.jay (invocation_expression): Moved
3200         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
3201         `cast_expression', but create a InvocationOrCast which later
3202         resolves to either an Invocation or a Cast.
3203
3204         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
3205         method; call this before EmitStatement() to make sure that this
3206         expression can be used as a statement.
3207
3208         * expression.cs (InvocationOrCast): New class; resolves to either
3209         an Invocation or a Cast.
3210
3211         * statement.cs (StatementExpression): Call ResolveStatement() on
3212         the ExpressionStatement before emitting it.
3213
3214 2003-07-21  Martin Baulig  <martin@ximian.com>
3215
3216         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
3217         `ref' and `out' attributes match; fixes #46220.
3218         (MemberAccess.ResolveMemberAccess): You can't reference a type
3219         through an expression; fixes #33180.
3220         (Indexers.GetIndexersForType): Don't return the indexers from
3221         interfaces the class implements; fixes #46502.
3222
3223 2003-07-21  Martin Baulig  <martin@ximian.com>
3224
3225         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
3226         CS0661 checks; fixes bug #30442.
3227
3228 2003-07-21  Martin Baulig  <martin@ximian.com>
3229
3230         * decl.cs (AdditionResult): Added `Error'.
3231
3232         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
3233
3234         * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
3235         makes cs0031.cs actually work.
3236
3237 2003-07-20  Martin Baulig  <martin@ximian.com>
3238
3239         * namespace.cs: Fixed that bug which caused a crash when compiling
3240         the debugger's GUI.
3241
3242 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
3243
3244         * typemanager.cs (LookupTypeReflection): Never expose types which
3245         are NotPublic, NestedPrivate, NestedAssembly, or
3246         NestedFamANDAssem.  We used to return these, and later do a check
3247         that would report a meaningful error, but the problem is that we
3248         would not get the real match, if there was a name override.
3249
3250 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
3251
3252         * namespace.cs (Namespace, Name): Do not compute the namespace
3253         name dynamically, compute it in the constructor.  This reduced
3254         memory usage by 1697 KB.
3255
3256         * driver.cs: Use --pause to pause at the end.
3257
3258 2003-07-17  Peter Williams  <peter@newton.cx>
3259
3260         * Makefile: Change the name of the test target so that it doesn't
3261         conflict with the recursive test target.
3262
3263 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
3264
3265         * expression.cs (LocalVariableReference.Emit, EmitAssign,
3266         AddressOf): Do not use EmitThis, that was wrong, use the actual
3267         this pointer.
3268
3269 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
3270
3271         * class.cs (MethodData.Define): While checking if a method is an
3272         interface implementation, improve the test: If we are not public
3273         (use new test here: use the computed MethodAttributes directly,
3274         instead of the parsed modifier flags) check if the `implementing'
3275         method comes from an interface or not.
3276
3277         * pending.cs (VerifyPendingMethods): Slightly better error
3278         message.
3279
3280         * makefile: add test target that does the mcs bootstrap.
3281
3282 2003-07-16  Ravi Pratap  <ravi@ximian.com>
3283
3284         * interface.cs (Define): Do nothing here since there are no
3285         members to populate etc. Move the attribute emission out of here
3286         since this was just totally the wrong place to put it. Attribute
3287         application happens during the 'Emit' phase, not in the 'Define'
3288         phase.
3289
3290         (Emit): Add this method and move the attribute emission here
3291
3292         * rootcontext.cs (EmitCode): Call the Emit method on interface
3293         types too.
3294
3295 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
3296
3297         * expression.cs (OverloadResolve): Report error only if Location
3298         is not 'Null' which means that there was a probe going on.
3299
3300 2003-07-14  Martin Baulig  <martin@ximian.com>
3301
3302         * expression.cs (ConditionalLogicalOperator): New public class to
3303         implement user defined conditional logical operators.
3304         This is section 14.11.2 in the spec and bug #40505.
3305
3306 2003-07-14  Martin Baulig  <martin@ximian.com>
3307
3308         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
3309
3310 2003-07-14  Martin Baulig  <martin@ximian.com>
3311
3312         * codegen.cs (EmitContext.InFixedInitializer): New public field.
3313
3314         * ecore.cs (IVariable.VerifyFixed): New interface method.
3315
3316         * expression.cs (Unary.ResolveOperator): When resolving the `&'
3317         operator, check whether the variable is actually fixed.  Fixes bug
3318         #36055.  Set a variable definitely assigned when taking its
3319         address as required by the spec.
3320
3321         * statement.cs (LocalInfo.IsFixed): New field.
3322         (LocalInfo.MakePinned): Set `IsFixed' to true.
3323
3324 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
3325
3326         * attribute.cs (Attribute.Resolve): While doing a Member lookup
3327         for .ctors, ensure that we only ask for members declared in the
3328         attribute type (BindingFlags.DeclaredOnly).
3329
3330         Fixes bug #43632.
3331
3332         * expression.cs (Error_WrongNumArguments): Report error 1501
3333         correctly the way CSC does.
3334
3335 2003-07-13  Martin Baulig  <martin@ximian.com>
3336
3337         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
3338         lookup on the fully qualified name, to make things like "X.X" work
3339         where "X.X" is a fully qualified type name, but we also have a
3340         namespace "X" in the using list.  Fixes #41975.
3341
3342 2003-07-13  Martin Baulig  <martin@ximian.com>
3343
3344         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
3345         function. If we're a CompoundAssign, we need to create an embedded
3346         CompoundAssign, not an embedded Assign.
3347         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
3348         Fixes #45854.
3349
3350 2003-07-13  Martin Baulig  <martin@ximian.com>
3351
3352         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
3353         work to fix bug #46088.
3354
3355 2003-07-13  Ravi Pratap <ravi@ximian.com>
3356
3357         * class.cs (Operator.Emit): Do not emit attributes here - it is
3358         taken care of by the Method class that we delegate too. This takes
3359         care of bug #45876.
3360
3361 2003-07-10  Martin Baulig  <martin@ximian.com>
3362
3363         * expression.cs (TypeOfVoid): New class.
3364         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
3365
3366 2003-07-10  Martin Baulig  <martin@ximian.com>
3367
3368         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
3369         bug #35957.
3370
3371 2003-07-10  Martin Baulig  <martin@ximian.com>
3372
3373         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
3374         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
3375
3376         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
3377
3378         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
3379
3380 2003-07-10  Martin Baulig  <martin@ximian.com>
3381
3382         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
3383         of decimal.  Fixes #42850.
3384
3385         NOTE: I also fixed the created byte blob, but this doesn't work on
3386         the MS runtime and csc never produces any byte blobs for decimal
3387         arrays.
3388
3389 2003-07-10  Martin Baulig  <martin@ximian.com>
3390
3391         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
3392         structs; fixes #32068.
3393         (Block.AddChildVariableNames): Fixed #44302.
3394
3395 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3396
3397         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
3398
3399 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
3400
3401         * attribute.cs: And this test is onger needed.
3402
3403 2003-07-08  Martin Baulig  <martin@ximian.com>
3404
3405         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
3406         inaccessible types.  Fixes #36313.
3407
3408         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
3409
3410         * namespace.cs (NamespaceEntry): Create implicit entries for all
3411         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
3412         implicit entries for N1.N2 and N1.
3413
3414 2003-07-08  Martin Baulig  <martin@ximian.com>
3415
3416         Rewrote the handling of namespaces to fix a lot of the issues
3417         wrt. `using' aliases etc.
3418
3419         * namespace.cs (Namespace): Splitted this class into a
3420         per-assembly `Namespace' and a per-file `NamespaceEntry'.
3421
3422         * typemanager.cs (TypeManager.IsNamespace): Removed.
3423         (TypeManager.ComputeNamespaces): Only compute namespaces from
3424         loaded assemblies here, not the namespaces from the assembly we're
3425         currently compiling.
3426
3427 2003-07-08  Martin Baulig  <martin@ximian.com>
3428
3429         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
3430
3431 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
3432
3433         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
3434         already fixed it.  
3435
3436         I thought about the memory savings here, but LookupTypeReflection
3437         is used under already very constrained scenarios.  Compiling
3438         corlib or mcs only exposes one hit, so it would not really reduce
3439         any memory consumption.
3440
3441 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3442
3443         * typemanager.cs: fixes bug #45889 by only adding public types from
3444         other assemblies to the list of known types.
3445
3446 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
3447
3448         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
3449         on the type we resolved.
3450
3451 2003-07-05  Martin Baulig  <martin@ximian.com>
3452
3453         * pending.cs (PendingImplementation.ParentImplements): Don't
3454         create the proxy if the parent is abstract.
3455
3456         * class.cs (TypeContainer.DefineIndexers): Process explicit
3457         interface implementations first.  Fixes #37714.
3458
3459 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
3460
3461         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
3462         defined recursively;  but since we modify the input parameters
3463         (left is set to `this' temporarily), we reset this value if the
3464         left_is_explicit is false, which gives the original semantics to
3465         the code.  
3466
3467         * literal.cs (NullPointer): new class used to represent a null
3468         literal in a pointer context.
3469
3470         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
3471         type is a pointer, use a NullPointer object instead of a
3472         NullLiteral.   Closes 43687
3473
3474         (ExplicitConversion): Convert pointer values using
3475         the conv opcode to the proper type.
3476
3477         * ecore.cs (New): change ValueTypeVariable property into a method,
3478         that returns whether the valuetype is suitable for being used.
3479
3480         * expression.cs (Binary.DoNumericPromotions): Only return if we
3481         the int constant was a valid uint, and we can return both left and
3482         right as uints.  If not, we continue processing, to trigger the
3483         type conversion.  This fixes 39018.
3484
3485         * statement.cs (Block.EmitMeta): During constant resolution, set
3486         the CurrentBlock property on the emitcontext, so that we resolve
3487         constants propertly.
3488
3489 2003-07-02  Martin Baulig  <martin@ximian.com>
3490
3491         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
3492         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
3493
3494         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
3495         than emitting it here.
3496
3497         * statement.cs: Fixed some more flow analysis bugs.
3498
3499 2003-07-02  Martin Baulig  <martin@ximian.com>
3500
3501         * class.cs (MethodData.Define): When implementing interface
3502         methods, set Final unless we're Virtual.
3503
3504         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
3505         check work for interface methods.
3506
3507 2003-07-01  Martin Baulig  <martin@ximian.com>
3508
3509         * ecore.cs (EmitContext.This): Replaced this property with a
3510         GetThis() method which takes a Location argument.  This ensures
3511         that we get the correct error location for a CS0188.
3512
3513 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
3514
3515         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
3516         ImplicitStandardConversion.
3517
3518         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
3519
3520 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
3521
3522         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
3523         optimization.
3524
3525 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
3526
3527         * class.cs (Constructor.Define): Turn off initlocals for unsafe
3528         constructors.
3529
3530         (MethodData.Define): Turn off initlocals for unsafe methods.
3531
3532 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
3533
3534         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
3535         complete;  Fixes #37521.
3536
3537         * delegate.cs: Use Modifiers.TypeAttr to compute the
3538         TypeAttributes, instead of rolling our own.  This makes the flags
3539         correct for the delegates.
3540
3541 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
3542
3543         * class.cs (Constructor.Define): Set the private flag for static
3544         constructors as well.
3545
3546         * cs-parser.jay (statement_expression): Set the return value to
3547         null, to avoid a crash when we catch an error.
3548
3549 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
3550
3551         * cs-parser.jay: Applied patch from Jackson that adds support for
3552         extern and unsafe modifiers to destructor declarations.
3553
3554         * expression.cs: Report error 21 if the user is trying to index a
3555         System.Array.
3556
3557         * driver.cs: Add an error message, suggested by the bug report.
3558
3559         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
3560         if we do not have a ": this ()" constructor initializer.  Fixes 45149
3561
3562 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
3563
3564         * namespace.cs: Add some information to reduce FAQs.
3565
3566 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
3567
3568         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
3569         underlying enumeration types.  Fixes #43915.
3570
3571         * expression.cs: Treat ushort/short as legal values to be used in
3572         bitwise operations.
3573
3574 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
3575
3576         * delegate.cs: transfer custom attributes for paramenters from
3577         the delegate declaration to Invoke and BeginInvoke.
3578
3579 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
3580
3581         * attribute.cs: handle custom marshalers and emit marshal info
3582         for fields, too.
3583
3584 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
3585
3586         * makefile.gnu: Added anonymous.cs to the compiler sources.
3587
3588 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
3589
3590         * iterators.cs: Change the name of the proxy class to include two
3591         underscores.
3592
3593         * cs-parser.jay: Update grammar to include anonymous methods.
3594
3595         * anonymous.cs: new file.
3596
3597 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
3598
3599         * class.cs (Field.Define): Add missing test for pointers and
3600         safety. 
3601
3602 2003-05-27  Ravi Pratap  <ravi@ximian.com>
3603
3604         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
3605         we use the stobj opcode.
3606
3607         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
3608         since it wasn't the correct fix. 
3609
3610         It still is puzzling that we are required to use stobj for IntPtr
3611         which seems to be a ValueType.
3612
3613 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
3614
3615         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
3616         during regular simple name resolution.   Now, the trick is that
3617         instead of returning for processing the simplename, we do a
3618         TypeManager.LookupType (ie, a rooted lookup as opposed to a
3619         contextual lookup type).   If a match is found, return that, if
3620         not, return for further composition.
3621
3622         This fixes long-standing 30485.
3623
3624         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3625         using the address to initialize an object, do an Stobj instead of
3626         using the regular Stelem.
3627
3628         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
3629         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
3630         Because if we are a BaseIndexerAccess that value will be true.
3631         Fixes 43643.
3632
3633         * statement.cs (GotoCase.Resolve): Return after reporting an
3634         error, do not attempt to continue. 
3635
3636         * expression.cs (PointerArithmetic.Emit): If our operand is a
3637         long, convert our constants to match the operand before
3638         multiplying.  Convert to I type before adding.   Fixes 43670.
3639
3640 2003-05-14  Ravi Pratap  <ravi@ximian.com>
3641
3642         * enum.cs (ImplicitConversionExists) : Rename to
3643         ImplicitEnumConversionExists to remove ambiguity. 
3644
3645         * ecore.cs (NullCast): New type of cast expression class which
3646         basically is very similar to EmptyCast with the difference being
3647         it still is a constant since it is used only to cast a null to
3648         something else
3649         (eg. (string) null)
3650
3651         * convert.cs (ImplicitReferenceConversion): When casting a null
3652         literal, we return a NullCast.
3653
3654         * literal.cs (NullLiteralTyped): Remove - I don't see why this
3655         should be around anymore.
3656
3657         The renaming (reported was slightly wrong). Corrections:
3658
3659         ConvertImplicitStandard -> ImplicitConversionStandard
3660         ConvertExplicitStandard -> ExplicitConversionStandard
3661
3662         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
3663         before passing them in !
3664
3665         * convert.cs (ImplicitConversionStandard): When comparing for
3666         equal expr and target types, ensure that expr is not a
3667         NullLiteral.
3668
3669         In general, we must not be checking (expr_type ==
3670         target_type) in the top level conversion methods
3671         (ImplicitConversion, ExplicitConversion etc). This checking is
3672         done in the methods that they delegate to.
3673
3674 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
3675
3676         * convert.cs: Move Error_CannotConvertType,
3677         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
3678         ImplicitNumericConversion, ImplicitConversionExists,
3679         ImplicitUserConversionExists, StandardConversionExists,
3680         FindMostEncompassedType, FindMostSpecificSource,
3681         FindMostSpecificTarget, ImplicitUserConversion,
3682         ExplicitUserConversion, GetConversionOperators,
3683         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
3684         TryImplicitIntConversion, Error_CannotConvertImplicit,
3685         ConvertImplicitRequired, ConvertNumericExplicit,
3686         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
3687         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
3688         its own file.
3689
3690         Perform the following renames:
3691
3692         StandardConversionExists -> ImplicitStandardConversionExists
3693         ConvertImplicit -> ImplicitConversion
3694         ConvertImplicitStandard -> ImplicitStandardConversion
3695         TryImplicitIntConversion -> ImplicitIntConversion
3696         ConvertImplicitRequired -> ImplicitConversionRequired
3697         ConvertNumericExplicit -> ExplicitNumericConversion
3698         ConvertReferenceExplicit -> ExplicitReferenceConversion
3699         ConvertExplicit -> ExplicitConversion
3700         ConvertExplicitStandard -> ExplicitStandardConversion
3701
3702 2003-05-19  Martin Baulig  <martin@ximian.com>
3703
3704         * statement.cs (TypeInfo.StructInfo): Made this type protected.
3705         (TypeInfo): Added support for structs having structs as fields.
3706
3707         * ecore.cs (FieldExpr): Implement IVariable.
3708         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
3709         VariableInfo for the field.
3710
3711 2003-05-18  Martin Baulig  <martin@ximian.com>
3712
3713         * expression.cs (This.DoResolve): Report a CS0027 if we're
3714         emitting a field initializer.
3715
3716 2003-05-18  Martin Baulig  <martin@ximian.com>
3717
3718         * expression.cs (This.ResolveBase): New public function.
3719         (This.DoResolve): Check for CS0188.
3720
3721         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
3722         This.Resolve().
3723
3724         * ecore.cs (MethodGroupExpr.DoResolve): Set the
3725         `instance_expression' to null if we don't have any non-static
3726         methods.
3727
3728 2003-05-18  Martin Baulig  <martin@ximian.com>
3729
3730         Reworked the way how local variables and parameters are handled by
3731         the flow analysis code.
3732
3733         * statement.cs (TypeInfo, VariableMap): New public classes.
3734         (VariableInfo): New public class.  This is now responsible for
3735         checking whether a variable has been assigned.  It is used for
3736         parameters and local variables.
3737         (Block.EmitMeta): Take the InternalParameters as argument; compute
3738         the layout of the flow vectors here.
3739         (Block.LocalMap, Block.ParameterMap): New public properties.
3740         (FlowBranching): The .ctor doesn't get the InternalParameters
3741         anymore since Block.EmitMeta() now computes the layout of the flow
3742         vector.
3743         (MyStructInfo): This class is now known as `StructInfo' and nested
3744         in `TypeInfo'; we don't access this directly anymore.
3745
3746         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
3747         property and removed IsAssigned(), IsFieldAssigned(),
3748         SetAssigned() and SetFieldAssigned(); we now call them on the
3749         VariableInfo so we don't need to duplicate this code everywhere.
3750
3751         * expression.cs (ParameterReference): Added `Block block' argument
3752         to the .ctor.
3753         (LocalVariableReference, ParameterReference, This): The new
3754         VariableInfo class is now responsible for all the definite
3755         assignment stuff.
3756
3757         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
3758         IsParameterAssigned, SetParameterAssigned): Removed.
3759
3760 2003-05-18  Martin Baulig  <martin@ximian.com>
3761
3762         * typemanager.cs (InitCoreTypes): Try calling
3763         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
3764         the 3-args-version.  Corlib now also needs our `void_type'.
3765         (GetMethod): Added overloaded version which takes an optional
3766         `bool report_errors' to allow lookups of optional methods.
3767
3768 2003-05-12  Martin Baulig  <martin@ximian.com>
3769
3770         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
3771         only used for locals and not for parameters.
3772
3773 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
3774
3775         * support.cs (InternalParameters.ParameterType): Return the
3776         ExternalType of the parameter.
3777
3778         * parameter.cs (Parameter.ExternalType): drop the two arguments,
3779         they were unused.
3780
3781 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
3782
3783         * class.cs (MethodData.Define): Do not set the `newslot' on
3784         interface members, if they are also flagged as "override".
3785
3786         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
3787         better code for ++i and i++.  This only works for static fields
3788         and local variables.
3789
3790         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
3791         want to pull the DeclSpace out of the builder_to_declspace instead
3792         of the TypeBuilder (like in TypeContainer.FindMembers).
3793
3794         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
3795         instead of LookupTypeContainer.  Fixes the crash on .NET for
3796         looking up interface members.
3797
3798         * const.cs: Create our own emit context during the Definition
3799         stage, so that constants are evaluated in the proper context, when
3800         a recursive definition happens.
3801
3802 2003-05-11  Martin Baulig  <martin@ximian.com>
3803
3804         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
3805         new block for a switch section.
3806         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
3807         the adding/lookup in the switch block.  Fixes #39828.
3808
3809 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
3810
3811         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
3812         functionality: I needed to convert the data after I had performed
3813         the add/sub operation into the operands type size.
3814
3815         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
3816         pass the type for the box operation, otherwise the resulting
3817         object would have been of type object.
3818
3819         (BoxedCast): Add constructor to specify the type to box as.
3820
3821 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
3822
3823         * iterators.cs: I was reusing the `count' variable inadvertently,
3824         take steps to not allow this to happen.
3825
3826 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
3827
3828         * attribute.cs (Attribute.Resolve): Params attributes are encoded
3829         by creating an array at the point where the params starts and
3830         putting all those arguments there, then adjusting the size of the
3831         array.
3832
3833 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
3834
3835         * expression.cs (New.AddressOf): Implement interface
3836         IMemoryLocation.  This is used when the `new' operator is used in
3837         the context of an invocation to a method on a value type.
3838
3839         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
3840         example. 
3841
3842         * namespace.cs: Also check the using aliases here.
3843
3844         * driver.cs: Move the test for using validity after the types have
3845         been entered, so we do a single pass that also includes the using
3846         aliases. 
3847
3848         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
3849         in the regular case.   CreateSiblingForFinally is doing extra
3850         error checking.
3851
3852         * attribute.cs (GetAttributeArgumentExpression): Store the result
3853         on an out value, and use the return value to indicate failure
3854         instead of using null (which is a valid return for Constant.GetValue).
3855
3856         * statement.cs: Perform the analysis flow for the increment
3857         portion after the statement, because this will be the real flow of
3858         execution.  Fixes #42385
3859
3860         * codegen.cs (EmitContext.EmitArgument,
3861         EmitContext.EmitStoreArgument): New helper functions when the
3862         RemapToProxy flag is set.
3863
3864         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
3865         function.
3866
3867         Add support for remapping parameters. 
3868
3869         * iterators.cs: Propagate parameter values;  Store parameter
3870         values in the proxy classes.
3871
3872 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
3873
3874         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
3875         need a proxy reference;  I do not know what I was thinking
3876
3877         * cs-parser.jay (constructor_initializer): catch another error,
3878         and display nice message.
3879
3880         (field_declaration): catch void field declaration
3881         to flag a better error. 
3882
3883         * class.cs (MemberBase.CheckBase): Report an error instead of a
3884         warning if a new protected member is declared in a struct. 
3885         (Field.Define): catch the error of readonly/volatile.
3886
3887         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
3888
3889         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
3890         volatile variable is taken
3891
3892 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
3893
3894         * statement.cs (Fixed.Resolve): Report an error if we are not in
3895         an unsafe context.
3896
3897 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
3898
3899         * typemanager.cs: reuse the code that handles type clashes for
3900         delegates and enumerations.
3901
3902         * class.cs (Report28): Always report.
3903
3904         * expression.cs (EncodeAsAttribute): Allow nulls here.
3905
3906 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
3907
3908         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
3909         the functionality for testing whether an expression is valid for
3910         an attribute here.  Also handle the case of arrays of elements
3911         being stored. 
3912
3913         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
3914         encoding a linear array into an array of objects that are suitable
3915         to be passed to an CustomAttributeBuilder.
3916
3917         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
3918
3919         * ecore.cs: (FieldExpr): Handle field remapping here.
3920
3921         * iteratators.cs: Pass the instance variable (if the method is an
3922         instance method) to the constructors, so we can access the field
3923         variables on the class.
3924
3925         TODO: Test this with structs.  I think the THIS variable on
3926         structs might have to be a pointer, and not a refenrece
3927
3928 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
3929
3930         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
3931         local variables to fields in a proxy class.
3932
3933         * iterators.cs (PopulateProxy): Rename our internal fields to
3934         <XXX>.  
3935         Create a <THIS> field if we are an instance method, so we can
3936         reference our parent container variables.
3937         (MapVariable): Called back from the EmitContext code to enter a
3938         new variable to field mapping into the proxy class (we just create
3939         a FieldBuilder).
3940
3941         * expression.cs
3942         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
3943         for using the remapped locals to fields.
3944
3945         I placed the code here, because that gives the same semantics to
3946         local variables, and only changes the Emit code.
3947
3948         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
3949         statements inside iterators.
3950         (VariableInfo): Add a FieldBuilder for the cases when we are
3951         remapping local variables to fields in a proxy class
3952
3953         * ecore.cs (SimpleNameResolve): Avoid testing two times for
3954         current_block != null.
3955
3956         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
3957         not cope with strings, as it has been moved to the
3958         TableSwitchEmit.  Fixed bug in switch generation.
3959
3960         * expression.cs (New.DoResolve): Provide more context for the user
3961         when reporting an error.
3962
3963         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
3964         pointers. 
3965
3966         * expression.cs (MemberAccess.DoResolve): When we get a type back,
3967         check the permissions for it.  Note than in a type-resolution
3968         context the check was already present in DeclSpace.ResolveType,
3969         but was missing from the MemberAccess.
3970
3971         (ArrayCreation.CheckIndices): warn if the user has
3972         more nested levels of expressions, but there are no more
3973         dimensions specified.  Avoids crash on bug 41906.
3974
3975 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
3976
3977         * statement.cs (Block): replace Implicit bool, for a generic
3978         flags.   
3979         New flag: `Unchecked'.  This is used during the EmitMeta phase
3980         (which is out-of-line with the regular Resolve/Emit process for a
3981         statement, as this is done ahead of time, but still gets a chance
3982         to call constant resolve).
3983
3984         (Block.Flags): new enum for adding a new flag.
3985
3986         (Block.EmitMeta): track the state of unchecked.
3987
3988         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
3989         to enable constant resolution to work there as well.
3990
3991 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
3992
3993         * typemanager.cs (ienumerable_type): Also look up
3994         System.Collections.IEnumerable. 
3995
3996 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
3997
3998         TODO: Test more than one conditional per method.
3999
4000         * class.cs (Indexer.Define): Report the location where the user is
4001         referencing the unsupported feature.
4002
4003         (MethodData): Overload the use of `conditionals' to
4004         minimize the creation of needless ArrayLists.   This saves roughly
4005         212kb on my machine.
4006
4007         (Method): Implement the new IIteratorContainer interface.
4008         (Method.SetYields): Implement the method by setting the ModFlags
4009         to contain METHOD_YIELDS.
4010
4011         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
4012         which just got set to null.
4013
4014         * iterators.cs: New file.
4015
4016         (Yield, YieldBreak): New statements.
4017
4018         * statement.cs (Return.Resolve): Flag an error if we are used in
4019         an iterator method.
4020
4021         * codegen.cs (InIterator): New flag set if the code is being
4022         compiled in an iterator method.
4023
4024         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
4025         internal modifier, and we just use it to avoid adding extra
4026         fields, as this is seldom used.  
4027
4028         * cs-parser.jay: Add yield_statement (yield and yield break).
4029
4030         * driver.cs: New flag -v2 to turn on version 2 features. 
4031
4032         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
4033         hashtable when v2 is enabled.
4034
4035 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
4036
4037         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
4038         there is already a namespace defined with this name.
4039
4040         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
4041         people upgraded their corlibs.
4042
4043         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
4044         always use fully qualified types, no need to use the compiler
4045         front end.
4046
4047         (TypeManager.IsNamespace): Use binarysearch.
4048
4049         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
4050         AddDelegate): I did not quite use the new IsValid API properly: I
4051         have to pass the short-name and the fullname.  I was passing only
4052         the basename instead of the fullname sometimes. 
4053
4054         (TypeContainer.DefineType): call NamespaceClash.
4055
4056         * interface.cs (Interface.DefineType): use NamespaceClash before
4057         defining the type.
4058
4059         * delegate.cs (Delegate.DefineType): use NamespaceClash before
4060         defining the type.
4061
4062         * enum.cs: (Enum.DefineType): use NamespaceClash before
4063         defining the type.
4064
4065         * typemanager.cs (: 3-line patch that gives us some tasty 11%
4066         speed increase.  First, use the negative_hits cache when we get a
4067         negative.  Second, add the type with its full original name
4068         instead of the new . and + encoded name (reflection uses + to
4069         separate type from a nested type).  Use LookupTypeReflection
4070         directly which bypasses the type->name hashtable (that we already
4071         know does not contain the type.
4072
4073         * decl.cs (DeclSpace.ResolveTypeExpr): track the
4074         location/container type. 
4075
4076         * driver.cs: When passing utf8, use directly the UTF8Encoding.
4077
4078 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
4079
4080         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
4081
4082         * delegate.cs (NewDelegate.Resolve): Test whether an instance
4083         method is being referenced in the method group from a static
4084         context, and report error 120 if so.
4085
4086         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
4087         Error118. 
4088
4089         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
4090         is created, we create the A namespace).
4091
4092         * cs-parser.jay: A namespace also introduces a DeclarationFound.
4093         Fixes #41591
4094
4095 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
4096
4097         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
4098         invocation to ModuleBuilder.GetType with the same values will
4099         return a new type instance, so we need to cache its return
4100         values. 
4101
4102         * expression.cs (Binary.ResolveOperator): Only allow the compare
4103         operators on enums if they are of the same type.
4104
4105         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
4106         types of ValueType on their own case.  Before we were giving them
4107         the same treatment as objects.
4108
4109         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
4110         fullname.  Short name is used to compare against container name.
4111         Fullname is used to check against defined namespace names.
4112
4113         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
4114         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
4115
4116         (Method.CheckBase): Call parent.
4117         (MemberBase.CheckBase): Check for protected members on sealed
4118         classes.
4119         (PropertyBase.CheckBase): Call parent.
4120         (Field.Define): Call parent.
4121
4122         * report.cs: Negative error codes are now mapped to 8000 - code,
4123         so that the display is render more nicely.
4124
4125         * typemanager.cs: Do not use try/catch, instead report a regular
4126         error. 
4127
4128         (GetPointerType, GetReferenceType): These methods provide
4129         mechanisms to obtain the T* and T& from a T.  We had the code
4130         previously scattered around the code base, and it also used
4131         TypeManager.LookupType that would go through plenty of caches.
4132         This one goes directly to the type source.
4133
4134         In some places we did the Type.GetType followed by
4135         ModuleBuilder.GetType, but not in others, so this unifies the
4136         processing as well.
4137
4138         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
4139         statements now that we have namespace information.
4140
4141         * typemanager.cs (IsNamespace): New method, returns whether the
4142         string presented is a namespace or not.
4143
4144         (ComputeNamespaces): New public entry point, computes the list of
4145         available namespaces, using the GetNamespaces API call in Mono, or
4146         the slower version in MS.NET.   
4147
4148         Now before we start the semantic analysis phase, we have a
4149         complete list of namespaces including everything that the user has
4150         provided.
4151
4152         Deleted old code to cache namespaces in .nsc files.
4153
4154 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
4155
4156         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
4157         class/struct location definition Location for the implicit
4158         constructor location.
4159
4160         (Operator.Define): Use the location of the operator for the
4161         implicit Method definition.
4162
4163         (Constructor.Emit): use the constructor location for the implicit
4164         base initializer constructor.
4165
4166         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
4167         and the Expression class now contains two new methods:
4168
4169         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
4170         isolate type lookup from the rest of the resolution process.
4171
4172         Since we use Expressions to hold type definitions due to the way
4173         we parse the input we have historically overloaded Resolve to
4174         perform the Type lookups if a special flag is passed.  Now this is
4175         eliminated and two methods take their place. 
4176
4177         The differences in the two methods between xStep and xTerminal is
4178         that xStep is involved in our current lookup system that uses
4179         SimpleNames to compose a name, while xTerminal is used just to
4180         catch the case where the simplename lookup failed.
4181
4182 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
4183
4184         * expression.cs (ResolveMemberAccess): Remove redundant code.
4185         TypeExpr expressions are always born fully resolved.
4186
4187         * interface.cs (PopulateMethod): Do not lookup the types twice.
4188         We were doing it once during SemanticAnalysis and once during
4189         PopulateMethod.
4190
4191         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
4192         in local variable type definitions, were being returned as a
4193         SimpleName (we decomposed everything into a string), that is
4194         because primary_expression was being used instead of a type in the
4195         grammar (reduce/reduce conflicts).
4196
4197         The part that was wrong is that we converted the expression into a
4198         string (an oversimplification in one hand, compounded with primary
4199         expressions doing string concatenation).
4200
4201         So things like:
4202
4203         A.B.C [] x;
4204
4205         Would return "A.B.C[]" as a SimpleName.  This stopped things like
4206         using clauses from working on this particular context.  And a type
4207         was being matched directly against "A.B.C[]".
4208
4209         We now use the correct approach, and allow for ComposedCast to be
4210         part of the unary expression.  So the "A.B.C []" become a composed
4211         cast of "A.B.C" (as a nested group of MemberAccess with a
4212         SimpleName at the end) plus the rank composition "[]". 
4213
4214         Also fixes 35567
4215
4216 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
4217
4218         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
4219         for the access level checking.
4220
4221         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
4222         `TypeContainer container', because I kept getting confused when I
4223         was debugging this code.
4224
4225         * expression.cs (Indexers): Instead of tracking getters/setters,
4226         we now track them in parallel.  We create one arraylist less, but
4227         most importantly it is possible now for the LValue code to find a
4228         matching get for a set.
4229
4230         (IndexerAccess.DoResolveLValue): Update the code.
4231         GetIndexersForType has been modified already to extract all the
4232         indexers from a type.  The code assumed it did not.
4233
4234         Also make the code set the correct return type for the indexer.
4235         This was fixed a long time ago for properties, but was missing for
4236         indexers.  It used to be void_type.
4237
4238         (Binary.Emit): Test first for doubles instead of
4239         floats, as they are more common.
4240
4241         (Binary.EmitBranchable): Use the .un version of the branch opcodes
4242         when dealing with floats and the <=, >= operators.  This fixes bug
4243         #39314 
4244
4245         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
4246         to load the array value by emitting a load on the foreach variable
4247         type.  This was incorrect.  
4248
4249         We now emit the code to load an element using the the array
4250         variable type, and then we emit the conversion operator.
4251
4252         Fixed #40176
4253
4254 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
4255
4256         * attribute.cs: Avoid allocation of ArrayLists in the common case.
4257
4258 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
4259
4260         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
4261         test for protection before we test for signatures. 
4262
4263         (MethodSignature.ToString): implement.
4264
4265         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
4266         to the case where we reduced into a LongConstant.
4267
4268         * decl.cs (CheckAccessLevel): If the type is an array, we can not
4269         depend on whether the information is acurrate, because the
4270         Microsoft runtime will always claim that the array type is public,
4271         regardless of the real state.
4272
4273         If the type is a pointer, another problem happens: the type is
4274         reported as non-public in Microsoft.  
4275
4276         In both cases we have to call CheckAccessLevel recursively with
4277         the underlying type as the argument to be tested.
4278
4279 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
4280
4281         * assign.cs (Assign.Emit): If we are dealing with a compound
4282         assignment expression, we should use the code path that stores the
4283         intermediate result in a temporary value.  This fixes #40903.
4284
4285         *expression.cs (Indirection.ToString): Provide ToString method for
4286         debugging. 
4287
4288 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
4289
4290         * class.cs: Null out fields holding references to Block objects so
4291         they can be garbage collected.
4292
4293         * expression.cs (OverloadResolve): Remove unused local.
4294
4295 2003-04-07  Martin Baulig  <martin@ximian.com>
4296
4297         * codegen.cs (EmitContext.CurrentFile): New public field.
4298         (EmitContext.Mark): Use the CurrentFile to check whether the
4299         location is in the correct file.
4300         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
4301
4302 2003-04-07  Martin Baulig  <martin@ximian.com>
4303
4304         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
4305
4306         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
4307         location.  [FIXME: The location argument which gets passed to this
4308         method is sometimes wrong!]
4309
4310 2003-04-07  Nick Drochak <ndrochak@gol.com>
4311
4312         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
4313
4314 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
4315
4316         * expression.cs (Indirection.EmitAssign): We were using the
4317         temporary, but returning immediately instead of continuing the
4318         EmitAssing flow.
4319
4320 2003-04-06  Martin Baulig  <martin@ximian.com>
4321
4322         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
4323         if it's a nested child, but also deriving from the outer class.
4324         See test 190.cs.
4325
4326         * typemanager.cs (IsNestedChildOf): Make this work if it's a
4327         nested child, but also deriving from the outer class.  See
4328         test-190.cs.
4329         (FilterWithClosure): We may access private members of the outer
4330         class if we're a nested child and deriving from the outer class.
4331         (RealMemberLookup): Only set `closure_private_ok' if the
4332         `original_bf' contained BindingFlags.NonPublic.
4333
4334 2003-04-05  Martin Baulig  <martin@ximian.com>
4335
4336         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
4337
4338 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
4339
4340         * class.cs (Event.Define): Do not allow abstract events to have
4341         initializers. 
4342
4343 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
4344
4345         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
4346         block in event declarations.
4347
4348         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
4349         value type, get its address.
4350
4351         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
4352         leaving a class on the stack instead of a boolean value (int
4353         0/1).  Change the code so we compare against null, and then the
4354         result against zero.
4355
4356         * class.cs (TypeContainer.GetClassBases): We were checking for the
4357         parent class being sealed too late.
4358
4359         * expression.cs (Binary.Emit): For <= and >= when dealing with
4360         floating point values, use cgt.un and clt.un instead of cgt and
4361         clt alone.
4362
4363 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
4364
4365         * statement.cs: Apply the same optimization as MS: skip the 
4366         GetEnumerator returning an IEnumerator, and use the one returning a 
4367         CharEnumerator instead. This allows us to avoid the try-finally block 
4368         and the boxing.
4369
4370 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
4371
4372         * cs-parser.jay: Attributes cannot be applied to
4373                          namespaces. Fixes #40473
4374
4375 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4376
4377         * class.cs:
4378         (Add*): check if the name is valid using the full name for constants,
4379         fields, properties and events.
4380
4381 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
4382
4383         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
4384         char constants to be part of the enumeration.
4385
4386         * expression.cs (Conditional.DoResolve): Add support for operator
4387         true. Implements the missing functionality from 14.12
4388
4389         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
4390         operator true/false as required by the spec.
4391
4392         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
4393         implicit conversion to boolean.
4394
4395         * statement.cs (Statement.ResolveBoolean): A boolean expression is
4396         also one where the type implements `operator true'. 
4397
4398         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
4399         get an expression that will invoke operator true based on an
4400         expression.  
4401
4402         (GetConversionOperators): Removed the hack that called op_True
4403         here.  
4404
4405         (Expression.ResolveBoolean): Move this from Statement.
4406
4407 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
4408
4409         * ecore.cs (FieldExpr): do not allow initialization of initonly
4410         fields on derived classes
4411
4412 2003-03-13  Martin Baulig  <martin@ximian.com>
4413
4414         * statement.cs (Block.Emit): Call ig.BeginScope() and
4415         ig.EndScope() when compiling with debugging info; call
4416         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
4417
4418 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
4419
4420         * expression.cs (Indexers): Do not construct immediately, allow
4421         for new members to be appended as we go.  Fixes 38143
4422
4423 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4424
4425         * expression.cs: save/restore context when resolving an unchecked
4426         expression.
4427
4428 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
4429
4430         * cfold.cs: Catch division by zero in modulus operator during
4431         constant folding.
4432
4433 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
4434
4435         * interface.cs (Interface.DefineMembers): Avoid defining members
4436         twice. 
4437
4438 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
4439
4440         * driver.cs: handle the +/- options for -noconfig
4441
4442         * statement.cs (Unckeched.Resolve): Also track the state of
4443         unchecked in the Resolve phase.
4444
4445 2003-02-27  Martin Baulig  <martin@ximian.com>
4446
4447         * ecore.cs (Expression.MemberLookup): Don't create a
4448         MethodGroupExpr for something which is not a method.  Fixes #38291.
4449
4450 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
4451
4452         * class.cs (MemberBase.CheckParameters): Also check that the type
4453         is unmanaged if it is a pointer.
4454
4455         * expression.cs (SizeOf.Resolve): Add location information.
4456
4457         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
4458         a managed type is declared.
4459
4460         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
4461         parameter modifiers as well.  Fixes bug 38606
4462
4463         * class.cs: Very sad.  Am backing out the speed up changes
4464         introduced by the ArrayList -> Array in the TypeContainer, as they
4465         were not actually that much faster, and introduced a bug (no error
4466         reports on duplicated methods).
4467
4468         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
4469         source first, this will guarantee that we have a valid expression
4470         before calling in lower levels functions that will require a
4471         resolved object.  Then use this original_source in the
4472         target.ResolveLValue instead of the original source that was
4473         passed to us.
4474
4475         Another change.  Use target.Resolve instead of LValueResolve.
4476         Although we are resolving for LValues, we will let the Assign code
4477         take care of that (it will be called again from Resolve).  This
4478         basically allows code like this:
4479
4480         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
4481         class Y { void A (X x) { x [0] += o; }
4482
4483         The problem was that the indexer was trying to resolve for
4484         set_Item (idx, object o) and never finding one.  The real set_Item
4485         was set_Item (idx, X).  By delaying the process we get the right
4486         semantics. 
4487
4488         Fixes bug 36505
4489
4490 2003-02-23  Martin Baulig  <martin@ximian.com>
4491
4492         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
4493         while calling DoEmit ().
4494
4495         * codegen.cs (EmitContext.Mark): Don't mark locations in other
4496         source files; if you use the #line directive inside a method, the
4497         compiler stops emitting line numbers for the debugger until it
4498         reaches the end of the method or another #line directive which
4499         restores the original file.
4500
4501 2003-02-23  Martin Baulig  <martin@ximian.com>
4502
4503         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
4504
4505 2003-02-23  Martin Baulig  <martin@ximian.com>
4506
4507         * statement.cs (Block.AddChildVariableNames): We need to call this
4508         recursively, not just for our immediate children.
4509
4510 2003-02-23  Martin Baulig  <martin@ximian.com>
4511
4512         * class.cs (Event.Define): Always make the field private, like csc does.
4513
4514         * typemanager.cs (TypeManager.RealMemberLookup): Make events
4515         actually work, fixes bug #37521.
4516
4517 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
4518
4519         * delegate.cs: When creating the various temporary "Parameters"
4520         classes, make sure that we call the ComputeAndDefineParameterTypes
4521         on those new parameters (just like we do with the formal ones), to
4522         allow them to be resolved in the context of the DeclSpace.
4523
4524         This fixes the bug that Dick observed in Bugzilla #38530.
4525
4526 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
4527
4528         * expression.cs (ResolveMemberAccess): When resolving a constant,
4529         do not attempt to pull a constant if the value was not able to
4530         generate a valid constant.
4531
4532         * const.cs (LookupConstantValue): Do not report more errors than required.
4533
4534 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4535
4536         * expression.cs: fixes bug #38328.
4537
4538 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
4539
4540         * class.cs: Changed all the various members that can be part of a
4541         class from being an ArrayList to be an Array of the right type.
4542         During the DefineType type_list, interface_list, delegate_list and
4543         enum_list are turned into types, interfaces, delegates and enums
4544         arrays.  
4545
4546         And during the member population, indexer_list, event_list,
4547         constant_list, field_list, instance_constructor_list, method_list,
4548         operator_list and property_list are turned into their real arrays.
4549
4550         Although we could probably perform this operation earlier, for
4551         good error reporting we need to keep the lists and remove the
4552         lists for longer than required.
4553
4554         This optimization was triggered by Paolo profiling the compiler
4555         speed on the output of `gen-sample-program.pl' perl script. 
4556
4557         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
4558         not crash in methods like MemberLookupFailed that use this field.  
4559
4560         This problem arises when the compiler fails to resolve a type
4561         during interface type definition for example.
4562
4563 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
4564
4565         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
4566         inherit from System.Object, so we have to stop at null, not only
4567         when reaching System.Object.
4568
4569 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
4570
4571         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
4572         DeclaredOnly because the parent indexer might have had a different
4573         name, but did not loop until the top of the hierarchy was reached.
4574
4575         The problem this one fixes is 35492: when a class implemented an
4576         indexer from an interface, we were getting the interface method
4577         (which was abstract) and we were flagging an error (can not invoke
4578         abstract method).
4579
4580         This also keeps bug 33089 functioning, and test-148 functioning.
4581
4582         * typemanager.cs (IsSpecialMethod): The correct way of figuring
4583         out if a method is special is to see if it is declared in a
4584         property or event, or whether it is one of the predefined operator
4585         names.   This should fix correctly #36804.
4586
4587 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
4588
4589         The goal here is to remove the dependency on EmptyCast.Peel ().
4590         Killing it completely.
4591
4592         The problem is that currently in a number of places where
4593         constants are expected, we have to "probe" for an EmptyCast, and
4594         Peel, which is not the correct thing to do, as this will be
4595         repetitive and will likely lead to errors. 
4596
4597         The idea is to remove any EmptyCasts that are used in casts that
4598         can be reduced to constants, so we only have to cope with
4599         constants. 
4600
4601         This bug hunt was triggered by Bug 37363 and the desire to remove
4602         the duplicate pattern where we were "peeling" emptycasts to check
4603         whether they were constants.  Now constants will always be
4604         constants.
4605
4606         * ecore.cs: Use an enumconstant here instead of wrapping with
4607         EmptyCast.  
4608
4609         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
4610         throwing me off.  By handling this we can get rid of a few hacks.
4611
4612         * statement.cs (Switch): Removed Peel() code.
4613
4614 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
4615
4616         * class.cs: Location information for error 508
4617
4618         * expression.cs (New.DoResolve): Add a guard against double
4619         resolution of an expression.  
4620
4621         The New DoResolve might be called twice when initializing field
4622         expressions (see EmitFieldInitializers, the call to
4623         GetInitializerExpression will perform a resolve on the expression,
4624         and later the assign will trigger another resolution
4625
4626         This leads to bugs (#37014)
4627
4628         * delegate.cs: The signature for EndInvoke should contain any ref
4629         or out parameters as well.  We were not doing this in the past. 
4630
4631         * class.cs (Field.Define): Do not overwrite the type definition
4632         inside the `volatile' group.  Turns out that volatile enumerations
4633         were changing the type here to perform a validity test, which
4634         broke conversions. 
4635
4636 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
4637
4638         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
4639         and structs, we do not want to load the instance variable
4640
4641         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
4642         enum_type has to be handled like an object reference (implicit
4643         conversions exists from this to object), but the regular IsClass
4644         and IsValueType tests will never return true for this one.
4645
4646         Also we use TypeManager.IsValueType instead of type.IsValueType,
4647         just for consistency with the rest of the code (this is only
4648         needed if we ever use the construct exposed by test-180.cs inside
4649         corlib, which we dont today).
4650
4651 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
4652
4653         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
4654         just InternalCall.
4655
4656 2003-02-09  Martin Baulig  <martin@ximian.com>
4657
4658         * namespace.cs (Namespace..ctor): Added SourceFile argument.
4659         (Namespace.DefineNamespaces): New static public method; this is
4660         called when we're compiling with debugging to add all namespaces
4661         to the symbol file.
4662
4663         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
4664         pass it to the Namespace's .ctor.
4665
4666         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
4667         and MethodBase arguments; pass the namespace ID to the symwriter;
4668         pass the MethodBase instead of the token to the symwriter.
4669         (SymbolWriter.DefineNamespace): New method to add a namespace to
4670         the symbol file.
4671
4672 2003-02-09  Martin Baulig  <martin@ximian.com>
4673
4674         * symbolwriter.cs: New file.  This is a wrapper around
4675         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
4676         methods here in near future.
4677
4678 2003-02-09  Martin Baulig  <martin@ximian.com>
4679
4680         * codegen.cs (EmitContext.Mark): Just pass the arguments to
4681         ILGenerator.MarkSequencePoint() which are actually used by the
4682         symbol writer.
4683
4684 2003-02-09  Martin Baulig  <martin@ximian.com>
4685
4686         * location.cs (SourceFile): New public sealed class.  This
4687         contains the name and an index which is used in the location's token.
4688         (Location): Reserve an appropriate number of bits in the token for
4689         the source file instead of walking over that list, this gives us a
4690         really huge performance improvement when compiling with debugging.
4691
4692         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
4693         `SourceFile' argument instead of a string.
4694         (Driver.ProcessFile): Add all the files via Location.AddFile(),
4695         but don't parse/tokenize here, we need to generate the list of all
4696         source files before we do that.
4697         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
4698         the files.
4699
4700         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
4701         instead of a string.
4702
4703         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
4704         of a string.
4705
4706 2003-02-09  Martin Baulig  <martin@ximian.com>
4707
4708         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
4709         filename on `#line default'.
4710
4711 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
4712
4713         * statement.cs: don't clear the pinned var when the fixed statement
4714         returns from the method (fixes bug#37752).
4715
4716 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
4717
4718         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
4719         to IsValueType.
4720
4721 2003-02-07  Martin Baulig  <martin@ximian.com>
4722
4723         * driver.cs: Removed the `--debug-args' command line argument.
4724
4725         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
4726         automatically by the AsssemblyBuilder.
4727         (CodeGen.InitializeSymbolWriter): We don't need to call any
4728         initialization function on the symbol writer anymore.  This method
4729         doesn't take any arguments.
4730
4731 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
4732
4733         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
4734         from referenced assemblies as well.
4735
4736 2003-02-02  Martin Baulig  <martin@ximian.com>
4737
4738         * class.cs (MethodData.Emit): Generate debugging info for external methods.
4739
4740 2003-02-02  Martin Baulig  <martin@ximian.com>
4741
4742         * class.cs (Constructor.Emit): Open the symbol writer before
4743         emitting the constructor initializer.
4744         (ConstructorInitializer.Emit): Call ec.Mark() to allow
4745         single-stepping through constructor initializers.
4746
4747 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
4748
4749         * class.cs: Handle error 549: do not allow virtual methods in
4750         sealed classes. 
4751
4752 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
4753
4754         * decl.cs: Check access levels when resolving types
4755
4756 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
4757
4758         * statement.cs: Add parameters and locals set in catch blocks that might 
4759         return to set vector
4760
4761 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
4762
4763         * class.cs (Operator): Set the SpecialName flags for operators.
4764
4765         * expression.cs (Invocation.DoResolve): Only block calls to
4766         accessors and operators on SpecialName methods.
4767
4768         (Cast.TryReduce): Handle conversions from char constants.
4769
4770
4771 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
4772
4773         * statement.cs: small memory and time optimization in FlowBranching.
4774
4775 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
4776
4777         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
4778         problem that the last fix but in the other sid (Set).
4779
4780         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
4781         access when there is no indexer in the hierarchy.
4782
4783 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
4784
4785         * class.cs: Combine some if statements.
4786
4787 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4788
4789         * driver.cs: fixed bug #37187.
4790
4791 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
4792
4793         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
4794         any indexer, it's needed to build a list with all the indexers in the
4795         hierarchy (AllGetters), else we have problems. Fixes #35653.
4796
4797 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
4798
4799         * class.cs (MethodData.Define): It is wrong for an interface
4800         implementation to be static in both cases: explicit and implicit.
4801         We were only handling this in one case.
4802
4803         Improve the if situation there to not have negations.
4804
4805         * class.cs (Field.Define): Turns out that we do not need to check
4806         the unsafe bit on field definition, only on usage.  Remove the test.
4807
4808 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4809
4810         * driver.cs: use assembly.Location instead of Codebase (the latest
4811         patch made mcs fail when using MS assemblies).
4812
4813 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
4814
4815         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
4816         get the path to *corlib.dll.
4817
4818 2003-01-21  Nick Drochak <ndrochak@gol.com>
4819
4820         * cs-tokenizer.cs:
4821         * pending.cs:
4822         * typemanager.cs: Remove compiler warnings
4823
4824 2003-01-20  Duncan Mak  <duncan@ximian.com>
4825
4826         * AssemblyInfo.cs: Bump the version number to 0.19.
4827
4828 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4829
4830         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
4831
4832 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
4833
4834         * class.cs (Constructor::Emit): Emit debugging info for constructors.
4835
4836 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
4837
4838         * cs-parser.jay: Small fix: we were not comparing the constructor
4839         name correctly.   Thanks to Zoltan for the initial pointer.
4840
4841 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
4842
4843         * cs-tokenizer.cs: Set file name when specified with #line
4844
4845 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
4846
4847         * cs-parser.jay: Only perform the constructor checks here if we
4848         are named like the class;  This will help provider a better
4849         error.  The constructor path is taken when a type definition is
4850         not found, but most likely the user forgot to add the type, so
4851         report that rather than the constructor error.
4852
4853 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
4854
4855         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
4856         allocations.
4857
4858 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4859
4860         * cs-parser.jay: Add cleanup call.
4861
4862 2003-01-13  Duncan Mak  <duncan@ximian.com>
4863
4864         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
4865         consistent with other methods.
4866
4867 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4868
4869         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
4870
4871 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
4872
4873         * attribute.cs: only set GuidAttr to true when we have a
4874         GuidAttribute.
4875
4876 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4877
4878         * ecore.cs:
4879         * expression.cs:
4880         * typemanager.cs: fixes to allow mcs compile corlib with the new
4881         Type.IsSubclassOf fix.
4882
4883 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
4884
4885         * expression.cs (LocalVariableReference.DoResolve): Classify a
4886         constant as a value, not as a variable.   Also, set the type for
4887         the variable.
4888
4889         * cs-parser.jay (fixed_statement): take a type instead of a
4890         pointer_type, so we can produce a better error message later.
4891
4892         * statement.cs (Fixed.Resolve): Flag types that are not pointers
4893         as an error.  
4894
4895         (For.DoEmit): Make inifinite loops have a
4896         non-conditional branch back.
4897
4898         (Fixed.DoEmit): First populate the pinned variables, then emit the
4899         statement, then clear the variables.  Before I was emitting the
4900         code once for each fixed piece.
4901
4902
4903 2003-01-08  Martin Baulig  <martin@ximian.com>
4904
4905         * statement.cs (FlowBranching.MergeChild): A break in a
4906         SWITCH_SECTION does not leave a loop.  Fixes #36155.
4907
4908 2003-01-08  Martin Baulig  <martin@ximian.com>
4909
4910         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
4911         lives in the same number space than `param_map'.  Fixes #36154.
4912
4913 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
4914
4915         * cs-parser.jay (constructor_declaration): Set the
4916         Constructor.ModFlags before probing for it.  This makes the
4917         compiler report 514, 515 and 132 (the code was there, but got
4918         broken). 
4919
4920         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
4921         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
4922         (GotoCase.Resolve): Set `Returns' to ALWAYS.
4923
4924 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
4925
4926         * enum.cs: create the enum static fields using the enum type.
4927
4928 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
4929
4930         * class.cs: don't try to create the ParamBuilder for the return
4931         type if it's not needed (and handle it breaking for the ms runtime
4932         anyway).
4933
4934 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
4935
4936         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
4937
4938 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
4939
4940         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
4941         the command.   This showed up while compiling the JANET source
4942         code, which used \r as its only newline separator.
4943
4944 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
4945
4946         * class.cs (Method.Define): If we are an operator (because it
4947         reuses our code), then set the SpecialName and HideBySig.  #36128
4948
4949 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
4950
4951         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
4952         exception, report error 120 `object reference required'.
4953
4954         * driver.cs: Add --pause option, used during to measure the size
4955         of the process as it goes with --timestamp.
4956
4957         * expression.cs (Invocation.DoResolve): Do not allow methods with
4958         SpecialName to be invoked.
4959
4960 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
4961
4962         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
4963         number before adding it.
4964
4965 2002-12-21  Ravi Pratap  <ravi@ximian.com>
4966
4967         * ecore.cs (StandardImplicitConversion): When in an unsafe
4968         context, we allow conversion between void * to any other pointer
4969         type. This fixes bug #35973.
4970
4971 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
4972
4973         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
4974         is not thrown when extensionless outputs are used 
4975
4976 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4977
4978         * rootcontext.cs: fixed compilation of corlib.
4979
4980 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
4981
4982         * attribute.cs (Attributes.Contains): Add new method.
4983
4984         * class.cs (MethodCore.LabelParameters): if the parameter is an
4985         `out' parameter, check that no attribute `[In]' has been passed.
4986
4987         * enum.cs: Handle the `value__' name in an enumeration.
4988
4989 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
4990
4991         * decl.cs: Added special case to allow overrides on "protected
4992         internal" methods
4993
4994 2002-12-18  Ravi Pratap  <ravi@ximian.com>
4995
4996         * attribute.cs (Attributes.AddAttributeSection): Rename to this
4997         since it makes much more sense.
4998
4999         (Attributes.ctor): Don't require a Location parameter.
5000
5001         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
5002
5003         * attribute.cs (ApplyAttributes): Remove extra Location parameters
5004         since we already have that information per attribute.
5005
5006         * everywhere : make appropriate changes.
5007
5008         * class.cs (LabelParameters): Write the code which actually
5009         applies attributes to the return type. We can't do this on the MS
5010         .NET runtime so we flag a warning in the case an exception is
5011         thrown.
5012
5013 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
5014
5015         * const.cs: Handle implicit null conversions here too.
5016
5017 2002-12-17  Ravi Pratap  <ravi@ximian.com>
5018
5019         * class.cs (MethodCore.LabelParameters): Remove the extra
5020         Type [] parameter since it is completely unnecessary. Instead
5021         pass in the method's attributes so that we can extract
5022         the "return" attribute.
5023
5024 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
5025
5026         * cs-parser.jay (parse): Use Report.Error to flag errors instead
5027         of ignoring it and letting the compile continue.
5028
5029         * typemanager.cs (ChangeType): use an extra argument to return an
5030         error condition instead of throwing an exception.
5031
5032 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
5033
5034         * expression.cs (Unary.TryReduce): mimic the code for the regular
5035         code path.  Perform an implicit cast in the cases where we can
5036         implicitly convert to one of the integral types, and then reduce
5037         based on that constant.   This fixes bug #35483.
5038
5039 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5040
5041         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
5042
5043 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5044
5045         * namespace.cs: fixed bug #35489.
5046
5047 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
5048
5049         * class.cs: Remove some dead code.
5050
5051         * cs-parser.jay: Estimate the number of methods needed
5052         (RootContext.MethodCount);
5053
5054         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
5055         numbers instead of StringBuilders.
5056
5057         * support.cs (PtrHashtable): Add constructor with initial size;
5058         We can now reduce reallocations of the method table.
5059
5060 2002-12-10  Ravi Pratap  <ravi@ximian.com>
5061
5062         * attribute.cs (ApplyAttributes): Keep track of the emitted
5063         attributes on a per-target basis. This fixes bug #35413.
5064
5065 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
5066
5067         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
5068         default to the Windows 1252 encoding.
5069
5070         (UnixParseOption): Support version, thanks to Alp for the missing
5071         pointer. 
5072
5073         * AssemblyInfo.cs: Add nice assembly information.
5074
5075         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
5076         (bug 35169).
5077
5078         * cs-parser.jay: Allow a trailing comma before the close bracked
5079         in the attribute_section production.
5080
5081         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
5082         address of the instance was being taken, I will take this out,
5083         because we take the address of the object immediately here.
5084
5085 2002-12-09  Ravi Pratap  <ravi@ximian.com>
5086
5087         * typemanager.cs (AreMultipleAllowed): Take care of the most
5088         obvious case where attribute type is not in the current assembly -
5089         stupid me ;-)
5090
5091 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
5092
5093         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
5094         definitions, instead of doing that afterwards.  
5095
5096         Also we use a nice little hack, depending on the constructor, we
5097         know if we are a "composed" name or a simple name.  Hence, we
5098         avoid the IndexOf test, and we avoid 
5099
5100         * codegen.cs: Add code to assist in a bug reporter to track down
5101         the source of a compiler crash. 
5102
5103 2002-12-07  Ravi Pratap  <ravi@ximian.com>
5104
5105         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
5106         types have been emitted for a given element and flag an error
5107         if something which does not have AllowMultiple set is used more
5108         than once.
5109
5110         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
5111         attribute types and their corresponding AllowMultiple properties
5112
5113         (AreMultipleAllowed): Check the property for a given type.
5114
5115         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
5116         property in the case we have a TypeContainer.
5117
5118         (Attributes.AddAttribute): Detect duplicates and just skip on
5119         adding them. This trivial fix catches a pretty gross error in our
5120         attribute emission - global attributes were being emitted twice!
5121
5122         Bugzilla bug #33187 is now fixed.
5123
5124 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
5125
5126         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
5127         instead of pp_and).
5128
5129         * expression.cs (Binary.ResolveOperator): I can only use the
5130         Concat (string, string, string) and Concat (string, string,
5131         string, string) if the child is actually a concatenation of
5132         strings. 
5133
5134 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
5135
5136         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
5137         context where we need a 2-character lookahead.
5138
5139         * pending.cs (PendingImplementation): Rework so we can keep track
5140         of interface types all the time, and flag those which were
5141         implemented by parents as optional.
5142
5143 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
5144
5145         * expression.cs (Binary.ResolveOperator): Use
5146         String.Concat(string,string,string) or
5147         String.Concat(string,string,string,string) when possible. 
5148
5149         * typemanager: More helper methods.
5150
5151
5152 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
5153
5154         * pending.cs: remove the bogus return from GetMissingInterfaces()
5155         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
5156
5157 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5158
5159         * namespace.cs: avoid duplicated 'using xxx' being added to
5160         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
5161         when we get more than one 'using' statement for the same namespace.
5162         Report a CS0105 warning for it.
5163
5164 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
5165
5166         * cs-tokenizer.cs (consume_identifier): use read directly, instead
5167         of calling getChar/putback, uses internal knowledge of it.    
5168
5169         (xtoken): Reorder tokenizer so most common patterns are checked
5170         first.  This reduces the compilation time in another 5% (from 8.11s
5171         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
5172
5173         The parsing time is 22% of the compilation in mcs, and from that
5174         64% is spent on the tokenization process.  
5175
5176         I tried using a binary search for keywords, but this is slower
5177         than the hashtable.  Another option would be to do a couple of
5178         things:
5179
5180                 * Not use a StringBuilder, instead use an array of chars,
5181                   with a set value.  Notice that this way we could catch
5182                   the 645 error without having to do it *afterwards*.
5183
5184                 * We could write a hand-parser to avoid the hashtable
5185                   compares altogether.
5186
5187         The identifier consumption process takes 37% of the tokenization
5188         time.  Another 15% is spent on is_number.  56% of the time spent
5189         on is_number is spent on Int64.Parse:
5190
5191                 * We could probably choose based on the string length to
5192                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
5193                   computations. 
5194
5195         Another 3% is spend on wrapping `xtoken' in the `token' function.
5196
5197         Handle 0xa0 as whitespace (#34752)
5198
5199 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
5200
5201         * typemanager.cs (IsCLRType): New routine to tell whether a type
5202         is one of the builtin types.  
5203
5204         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
5205         typecode in more places instead of doing pointer comparissions.
5206         We could leverage some knowledge about the way the typecodes are
5207         laid out.
5208
5209         New code to cache namespaces in assemblies, it is currently not
5210         invoked, to be used soon.
5211
5212         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
5213
5214         * expression.cs (Binary.ResolveOperator): specially handle
5215         strings, and do not perform user-defined operator overloading for
5216         built-in types.
5217
5218 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
5219
5220         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
5221         internalcall as it is a pretty simple operation;  Avoid whenever
5222         possible to call Char.IsLetter.
5223
5224         (consume_identifier): Cut by half the number of
5225         hashtable calls by merging the is_keyword and GetKeyword behavior.
5226
5227         Do not short-circuit, because if we do, we
5228         report errors (ie, #if false && true would produce an invalid
5229         directive error);
5230
5231
5232 2002-11-24  Martin Baulig  <martin@ximian.com>
5233
5234         * expression.cs (Cast.TryReduce): If we're in checked syntax,
5235         check constant ranges and report a CS0221.  Fixes #33186.
5236
5237 2002-11-24  Martin Baulig  <martin@ximian.com>
5238
5239         * cs-parser.jay: Make this work for uninitialized variable
5240         declarations in the `for' initializer.  Fixes #32416.
5241
5242 2002-11-24  Martin Baulig  <martin@ximian.com>
5243
5244         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
5245         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
5246
5247 2002-11-24  Martin Baulig  <martin@ximian.com>
5248
5249         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
5250         argument; if true, we also check for user-defined conversions.
5251         This is only needed if both arguments are of a user-defined type.
5252         Fixes #30443, added test-175.cs.
5253         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
5254
5255         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
5256
5257 2002-11-24  Martin Baulig  <martin@ximian.com>
5258
5259         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
5260         function to get the store opcode.
5261         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
5262         only emit the Ldelema if the store opcode is Stobj.  You must run
5263         both test-34 and test-167 to test this.  Fixes #34529.
5264
5265 2002-11-23  Martin Baulig  <martin@ximian.com>
5266
5267         * ecore.cs (Expression.MemberLookup): Added additional
5268         `qualifier_type' argument which is used when we're being called
5269         from MemberAccess.DoResolve() and null if we're called from a
5270         SimpleName lookup.
5271         (Expression.MemberLookupFailed): New method to report errors; this
5272         does the CS1540 check and reports the correct error message.
5273
5274         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
5275         argument for the CS1540 check and redone the way how we're dealing
5276         with private members.  See the comment in the source code for details.
5277         (FilterWithClosure): Reverted this back to revision 1.197; renamed
5278         `closure_start_type' to `closure_qualifier_type' and check whether
5279         it's not null.  It was not this filter being broken, it was just
5280         being called with the wrong arguments.
5281
5282         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
5283         and pass it the correct `qualifier_type'; this also does the error
5284         handling for us.
5285
5286 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
5287
5288         * expression.cs (Invocation.EmitParams): If the we are dealing
5289         with a non-built-in value type, load its address as well.
5290
5291         (ArrayCreation): Use a a pretty constant instead
5292         of the hardcoded value 2.   Use 6 instead of 2 for the number of
5293         static initializers.  
5294
5295         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
5296         because they are not really value types, just glorified integers. 
5297
5298         * driver.cs: Do not append .exe, the CSC compiler does not do it.
5299
5300         * ecore.cs: Remove redundant code for enumerations, make them use
5301         the same code path as everything else, fixes the casting issue
5302         with enumerations in Windows.Forms.
5303
5304         * attribute.cs: Do only cast to string if it is a string, the
5305         validation happens later.
5306
5307         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
5308         people upgrade their corlibs.
5309
5310         * ecore.cs: Oops, enumerations were not following the entire code path
5311
5312 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
5313
5314         * typemanager.cs (FilterWithClosure): Commented out the test for
5315         1540 in typemanager.cs, as it has problems when accessing
5316         protected methods from a parent class (see test-174.cs). 
5317
5318         * attribute.cs (Attribute.ValidateGuid): new method.
5319         (Attribute.Resolve): Use above.
5320
5321 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
5322
5323         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
5324
5325         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
5326         handling for enumerations, as we only needed the TypeContainer
5327         functionality to begin with (this is required for the fix below to
5328         work for enums that reference constants in a container class for
5329         example). 
5330
5331         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
5332
5333         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
5334         a valid TypeBuilder to perform lookups on.o
5335
5336         * class.cs (InheritableMemberSignatureCompare): Use true in the
5337         call to GetGetMethod and GetSetMethod, because we are comparing
5338         the signature, and we need to get the methods *even* if they are
5339         private. 
5340
5341         (PropertyBase.CheckBase): ditto.
5342
5343         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
5344         GotoCase.Resolve): Use Peel on EmpytCasts.
5345
5346         * ecore.cs (EmptyCast): drop child, add Peel method.
5347
5348 2002-11-17  Martin Baulig  <martin@ximian.com>
5349
5350         * ecore.cs (EmptyCast.Child): New public property.
5351
5352         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
5353         label resolved to an EmptyCast.  Fixes #34162.
5354         (GotoCase.Resolve): Likewise.
5355         (Block.EmitMeta): Likewise.
5356
5357 2002-11-17  Martin Baulig  <martin@ximian.com>
5358
5359         * expression.cs (Invocation.BetterConversion): Prefer int over
5360         uint; short over ushort; long over ulong for integer literals.
5361         Use ImplicitConversionExists instead of StandardConversionExists
5362         since we also need to check for user-defined implicit conversions.
5363         Fixes #34165.  Added test-173.cs.
5364
5365 2002-11-16  Martin Baulig  <martin@ximian.com>
5366
5367         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
5368         with the `true' and `false' literals.  Fixes #33151.
5369
5370 2002-11-16  Martin Baulig  <martin@ximian.com>
5371
5372         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
5373         October 22nd; don't do the cs1540 check for static members.
5374
5375         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
5376         now using our own filter here and doing the cs1540 check again.
5377
5378 2002-11-16  Martin Baulig  <martin@ximian.com>
5379
5380         * support.cs (InternalParameters): Don't crash if we don't have
5381         any fixed parameters.  Fixes #33532.
5382
5383 2002-11-16  Martin Baulig  <martin@ximian.com>
5384
5385         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
5386         when looking up static methods to make this work on Windows.
5387         Fixes #33773.
5388
5389 2002-11-16  Martin Baulig  <martin@ximian.com>
5390
5391         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
5392         a setter rather than using PropertyInfo.CanWrite.
5393
5394 2002-11-15  Nick Drochak  <ndrochak@gol.com>
5395
5396         * class.cs: Allow acces to block member by subclasses. Fixes build
5397         breaker.
5398
5399 2002-11-14  Martin Baulig  <martin@ximian.com>
5400
5401         * class.cs (Constructor.Emit): Added the extern/block check.
5402         Fixes bug #33678.
5403
5404 2002-11-14  Martin Baulig  <martin@ximian.com>
5405
5406         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
5407         iteration while looking for indexers, this is needed because the
5408         indexer may have a different name in our base classes.  Fixed the
5409         error reporting (no indexers at all, not get accessor, no
5410         overloaded match).  Fixes bug #33089.
5411         (IndexerAccess.DoResolveLValue): Likewise.
5412
5413 2002-11-14  Martin Baulig  <martin@ximian.com>
5414
5415         * class.cs (PropertyBase.CheckBase): Make this work for multiple
5416         indexers.  Fixes the first part of bug #33089.
5417         (MethodSignature.InheritableMemberSignatureCompare): Added support
5418         for properties.
5419
5420 2002-11-13  Ravi Pratap  <ravi@ximian.com>
5421
5422         * attribute.cs (Attribute.Resolve): Catch the
5423         NullReferenceException and report it since it isn't supposed to
5424         happen. 
5425
5426 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
5427
5428         * expression.cs (Binary.EmitBranchable): Also handle the cases for
5429         LogicalOr and LogicalAnd that can benefit from recursively
5430         handling EmitBranchable.  The code now should be nice for Paolo.
5431
5432 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
5433
5434         * typemanager.cs (LookupType): Added a negative-hit hashtable for
5435         the Type lookups, as we perform quite a number of lookups on
5436         non-Types.  This can be removed once we can deterministically tell
5437         whether we have a type or a namespace in advance.
5438
5439         But this might require special hacks from our corlib.
5440
5441         * TODO: updated.
5442
5443         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
5444         and double which avoids a conversion from an integer to a double.
5445
5446         * expression.cs: tiny optimization, avoid calling IsConstant,
5447         because it effectively performs the lookup twice.
5448
5449 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
5450
5451         But a bogus return here to keep the semantics of the old code
5452         until the Mono runtime is fixed.
5453
5454         * pending.cs (GetMissingInterfaces): New method used to remove all
5455         the interfaces that are already implemented by our parent
5456         classes from the list of pending methods. 
5457
5458         * interface.cs: Add checks for calls after ResolveTypeExpr.
5459
5460 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
5461
5462         * class.cs (Class.Emit): Report warning 67: event not used if the
5463         warning level is beyond 3.
5464
5465         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
5466         being a NullLiteral.
5467
5468         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
5469         specifiers. 
5470
5471         * class.cs (TypeContainer.GetClassBases): Cover a missing code
5472         path that might fail if a type can not be resolved.
5473
5474         * expression.cs (Binary.Emit): Emit unsigned versions of the
5475         operators. 
5476
5477         * driver.cs: use error 5.
5478
5479 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
5480
5481         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
5482
5483 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
5484
5485         * cs-parser.jay (switch_section): A beautiful patch from Martin
5486         Baulig that fixed 33094.
5487
5488 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
5489
5490         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
5491         Check whether the base is abstract and report an error if so.
5492
5493         * expression.cs (IndexerAccess.DoResolveLValue,
5494         IndexerAccess.DoResolve): ditto. 
5495
5496         (Invocation.DoResolve): ditto.
5497
5498         (Invocation.FullMethodDesc): Improve the report string.
5499
5500         * statement.cs (Block): Eliminate IsVariableDefined as it is
5501         basically just a wrapper for GetVariableInfo.
5502
5503         * ecore.cs (SimpleName): Use new 
5504
5505         * support.cs (ReflectionParamter.ParameterType): We unwrap the
5506         type, as we return the actual parameter ref/unref state on a
5507         different call.
5508
5509 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
5510
5511         * support.cs: Return proper flags REF/OUT fixing the previous
5512         commit.  
5513
5514         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
5515         not used to mean `ref' but `ref or out' in ParameterReference
5516
5517         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
5518         full type signature instead of calling TypeManger.CSharpName
5519         ourselves. 
5520
5521         * support.cs (InternalParameters.ParameterDesc): Do not compare
5522         directly to the modflags, because REF/OUT will actually be bitsets
5523         if set. 
5524
5525         * delegate.cs (VerifyMethod): Check also the modifiers.
5526
5527         * cs-tokenizer.cs: Fix bug where floating point values with an
5528         exponent where a sign was missing was ignored.
5529
5530         * driver.cs: Allow multiple assemblies to be specified in a single
5531         /r: argument
5532
5533 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
5534
5535         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
5536         because identifiers after a parenthesis would end up in this kind
5537         of production, and we needed to desamiguate it for having casts
5538         like:
5539
5540                 (UserDefinedType *) xxx
5541
5542 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
5543
5544         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
5545         we should set on the Bindingflags.NonPublic, but not turn on
5546         private_ok.  private_ok controls whether a Private member is
5547         returned (this is chekced on the filter routine), while the
5548         BindingFlags.NonPublic just controls whether private/protected
5549         will be allowed.   This fixes the problem part of the problem of
5550         private properties being allowed to be used in derived classes.
5551
5552         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
5553         so we can call the children DoResolveLValue method (this will
5554         properly signal errors on lvalue assignments to base properties)
5555
5556         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
5557         getter are null, and we have a property info, we know that this
5558         happened because the lookup failed, so we report an error 122 for
5559         protection level violation.
5560
5561         We also silently return if setter and getter are null in the
5562         resolve functions, this condition only happens if we have flagged
5563         the error before.  This is the other half of the problem. 
5564
5565         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
5566         not have accessibility information, that is why we were returning
5567         true in the filter function in typemanager.cs.
5568
5569         To properly report 122 (property is inaccessible because of its
5570         protection level) correctly, we report this error in ResolveAccess
5571         by failing if both the setter and the getter are lacking (ie, the
5572         lookup failed). 
5573
5574         DoResolve and DoLResolve have been modified to check for both
5575         setter/getter being null and returning silently, the reason being
5576         that I did not want to put the knowledge about this error in upper
5577         layers, like:
5578
5579         int old = Report.Errors;
5580         x = new PropertyExpr (...);
5581         if (old != Report.Errors)
5582                 return null;
5583         else
5584                 return x;
5585
5586         So the property expr is returned, but it is invalid, so the error
5587         will be flagged during the resolve process. 
5588
5589         * class.cs: Remove InheritablePropertySignatureCompare from the
5590         class, as we no longer depend on the property signature to compute
5591         whether it is possible to implement a method or not.
5592
5593         The reason is that calling PropertyInfo.GetGetMethod will return
5594         null (in .NET, in Mono it works, and we should change this), in
5595         cases where the Get Method does not exist in that particular
5596         class.
5597
5598         So this code:
5599
5600         class X { public virtual int A { get { return 1; } } }
5601         class Y : X { }
5602         class Z : Y { public override int A { get { return 2; } } }
5603
5604         Would fail in Z because the parent (Y) would not have the property
5605         defined.  So we avoid this completely now (because the alternative
5606         fix was ugly and slow), and we now depend exclusively on the
5607         method names.
5608
5609         (PropertyBase.CheckBase): Use a method-base mechanism to find our
5610         reference method, instead of using the property.
5611
5612         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
5613         routines are gone now.
5614
5615         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
5616         names, they were incorrectly named.
5617
5618         * cs-tokenizer.cs: Return are more gentle token on failure. 
5619
5620         * pending.cs (PendingImplementation.InterfaceMethod): This routine
5621         had an out-of-sync index variable, which caused it to remove from
5622         the list of pending methods the wrong method sometimes.
5623
5624 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
5625
5626         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
5627         CanWrite, because those refer to this particular instance of the
5628         property, and do not take into account the fact that we can
5629         override single members of a property.
5630
5631         Constructor requires an EmitContext.  The resolution process does
5632         not happen here, but we need to compute the accessors before,
5633         because the resolution does not always happen for properties.
5634
5635         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
5636         subclass, before we did not update this flag, but we did update
5637         bindingflags. 
5638
5639         (GetAccessors): Drop this routine, as it did not work in the
5640         presence of partially overwritten set/get methods. 
5641
5642         Notice that this broke the cs1540 detection, but that will require
5643         more thinking. 
5644
5645 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5646
5647         * class.cs:
5648         * codegen.cs:
5649         * driver.cs: issue a warning instead of an error if we don't support
5650         debugging for the platform. Also ignore a couple of errors that may
5651         arise when trying to write the symbols. Undo my previous patch.
5652
5653 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5654
5655         * driver.cs: ignore /debug switch except for Unix platforms.
5656
5657 2002-10-23  Nick Drochak  <ndrochak@gol.com>
5658
5659         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
5660
5661 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
5662
5663         * driver.cs: Do not make mcs-debug conditional, so we do not break
5664         builds that use it.
5665
5666         * statement.cs (UsageVector.MergeChildren): I would like Martin to
5667         review this patch.  But basically after all the children variables
5668         have been merged, the value of "Breaks" was not being set to
5669         new_breaks for Switch blocks.  I think that it should be set after
5670         it has executed.  Currently I set this to the value of new_breaks,
5671         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
5672         conservative, but I do not understand this code very well.
5673
5674         I did not break anything in the build, so that is good ;-)
5675
5676         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5677
5678 2002-10-20  Mark Crichton  <crichton@gimp.org>
5679
5680         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
5681
5682 2002-10-20  Nick Drochak  <ndrochak@gol.com>
5683
5684         * cfold.cs: Fixed compile blocker.
5685
5686 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
5687
5688         * driver.cs: I was chekcing the key, not the file.
5689
5690 2002-10-19  Ravi Pratap  <ravi@ximian.com>
5691
5692         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
5693         message that we were generating - we just need to silently return
5694         a null.
5695
5696 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
5697
5698         * class.cs (Event.Define): Change my previous commit, as this
5699         breaks the debugger.  This is a temporary hack, as it seems like
5700         the compiler is generating events incorrectly to begin with.
5701
5702         * expression.cs (Binary.ResolveOperator): Added support for 
5703         "U operator - (E x, E y)"
5704
5705         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
5706         y)".
5707
5708         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
5709         init-only variables, but this path did not take into account that
5710         there might be also instance readonly variables.  Correct this
5711         problem. 
5712
5713         This fixes bug 32253
5714
5715         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
5716         delegates as well.
5717
5718         * driver.cs: Change the extension for modules to `netmodule'
5719
5720         * cs-parser.jay: Improved slightly the location tracking for
5721         the debugger symbols.
5722
5723         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
5724         modifiers that were specified instead of the hardcoded value
5725         (FamAndAssem).  This was basically ignoring the static modifier,
5726         and others.  Fixes 32429.
5727
5728         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
5729         fixed a bug in the process (32476)
5730
5731         * expression.cs (ArrayAccess.EmitAssign): Patch from
5732         hwang_rob@yahoo.ca that fixes bug 31834.3
5733
5734 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
5735
5736         * driver.cs: Make the module extension .netmodule.
5737
5738 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
5739
5740         * driver.cs: Report an error if the resource file is not found
5741         instead of crashing.
5742
5743         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
5744         false, like Emit does.
5745
5746 2002-10-16  Nick Drochak  <ndrochak@gol.com>
5747
5748         * typemanager.cs: Remove unused private member.  Also reported mcs
5749         bug to report this as a warning like csc.
5750
5751 2002-10-15  Martin Baulig  <martin@gnome.org>
5752
5753         * statement.cs (Statement.Emit): Made this a virtual method; emits
5754         the line number info and calls DoEmit().
5755         (Statement.DoEmit): New protected abstract method, formerly knows
5756         as Statement.Emit().
5757
5758         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
5759
5760 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
5761
5762         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
5763         have fixed a remaining problem: not every AddXXXX was adding a
5764         fully qualified name.  
5765
5766         Now everyone registers a fully qualified name in the DeclSpace as
5767         being defined instead of the partial name.  
5768
5769         Downsides: we are slower than we need to be due to the excess
5770         copies and the names being registered this way.  
5771
5772         The reason for this is that we currently depend (on the corlib
5773         bootstrap for instance) that types are fully qualified, because
5774         we dump all the types in the namespace, and we should really have
5775         types inserted into the proper namespace, so we can only store the
5776         basenames in the defined_names array.
5777
5778 2002-10-10  Martin Baulig  <martin@gnome.org>
5779
5780         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
5781         from bug #31834, see the bug report for a testcase which is
5782         miscompiled.
5783
5784 2002-10-10  Martin Baulig  <martin@gnome.org>
5785
5786         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
5787         flow analysis code for this.
5788
5789         * statement.cs (Do, While, For): Tell the flow analysis code about
5790         infinite loops.
5791         (FlowBranching.UsageVector): Added support for infinite loops.
5792         (Block.Resolve): Moved the dead code elimination here and use flow
5793         analysis to do it.
5794
5795 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
5796
5797         * class.cs (Field.Define): Catch cycles on struct type
5798         definitions. 
5799
5800         * typemanager.cs (IsUnmanagedtype): Do not recursively check
5801         fields if the fields are static.  We only need to check instance
5802         fields. 
5803
5804         * expression.cs (As.DoResolve): Test for reference type.
5805
5806         * statement.cs (Using.ResolveExpression): Use
5807         ConvertImplicitRequired, not ConvertImplicit which reports an
5808         error on failture
5809         (Using.ResolveLocalVariableDecls): ditto.
5810
5811         * expression.cs (Binary.ResolveOperator): Report errors in a few
5812         places where we had to.
5813
5814         * typemanager.cs (IsUnmanagedtype): Finish implementation.
5815
5816 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
5817
5818         * expression.cs: Use StoreFromPtr instead of extracting the type
5819         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
5820
5821         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
5822         an enumeration value to a System.Enum, but System.Enum is not a
5823         value type, but an class type, so we need to box.
5824
5825         (Expression.ConvertExplicit): One codepath could return
5826         errors but not flag them.  Fix this.  Fixes #31853
5827
5828         * parameter.cs (Resolve): Do not allow void as a parameter type.
5829
5830 2002-10-06  Martin Baulig  <martin@gnome.org>
5831
5832         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
5833         if it's a class type and not a struct.  Fixes #31815.
5834
5835 2002-10-06  Martin Baulig  <martin@gnome.org>
5836
5837         * statement.cs: Reworked the flow analysis code a bit to make it
5838         usable for dead code elimination.
5839
5840 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5841
5842         * cs-parser.jay: allow empty source files. Fixes bug #31781.
5843
5844 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
5845
5846         * expression.cs (ComposedCast.DoResolveType): A quick workaround
5847         to fix the test 165, will investigate deeper.
5848
5849 2002-10-04  Martin Baulig  <martin@gnome.org>
5850
5851         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
5852         finally blocks actually work.
5853         (Try.Resolve): We don't need to create a sibling for `finally' if
5854         there is no finally block.
5855
5856 2002-10-04  Martin Baulig  <martin@gnome.org>
5857
5858         * class.cs (Constructor.Define): The default accessibility for a
5859         non-default constructor is private, not public.
5860
5861 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
5862
5863         * class.cs (Constructor): Make AllowedModifiers public, add
5864         EXTERN.
5865
5866         * cs-parser.jay: Perform the modifiers test here, as the
5867         constructor for the Constructor class usually receives a zero
5868         because of the way we create it (first we create, later we
5869         customize, and we were never checking the modifiers).
5870
5871         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
5872         is a version of LookupTypeReflection that includes the type-name
5873         cache.  This can be used as a fast path for functions that know
5874         the fully qualified name and are only calling into *.GetType() to
5875         obtain a composed type.
5876
5877         This is also used by TypeManager.LookupType during its type
5878         composition.
5879
5880         (LookupType): We now also track the real type name, as sometimes
5881         we can get a quey for the real type name from things like
5882         ComposedCast.  This fixes bug 31422.
5883
5884         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
5885         complete type fullname, it does not have to go through the type
5886         resolution system to obtain the composed version of the type (for
5887         obtaining arrays or pointers).
5888
5889         (Conditional.Emit): Use the EmitBoolExpression to
5890         generate nicer code, as requested by Paolo.
5891
5892         (ArrayCreation.CheckIndices): Use the patch from
5893         hwang_rob@yahoo.ca to validate the array initializers. 
5894
5895 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
5896
5897         * class.cs (ConstructorInitializer.Emit): simplify code by using
5898         Invocation.EmitCall, and at the same time, fix the bugs in calling
5899         parent constructors that took variable arguments. 
5900
5901         * ecore.cs (Expression.ConvertNumericExplicit,
5902         Expression.ImplicitNumericConversion): Remove the code that
5903         manually wrapped decimal (InternalTypeConstructor call is now gone
5904         as well).
5905
5906         * expression.cs (Cast.TryReduce): Also handle decimal types when
5907         trying to perform a constant fold on the type.
5908
5909         * typemanager.cs (IsUnmanagedtype): Partially implemented.
5910
5911         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
5912         that only turned off an error report, and did nothing else. 
5913
5914 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
5915
5916         * driver.cs: Handle and ignore /fullpaths
5917
5918 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
5919
5920         * expression.cs (Binary.ResolveOperator): Catch the case where
5921         DoNumericPromotions returns true, 
5922
5923         (Binary.DoNumericPromotions): Simplify the code, and the tests.
5924
5925 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
5926
5927         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
5928         report error 70.
5929
5930 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
5931
5932         * ecore.cs (ConvertNumericExplicit): It is not enough that the
5933         conversion exists, but it is also required that the conversion be
5934         performed.  This manifested in "(Type64Enum) 2".  
5935
5936         * class.cs (TypeManager.AddMethod): The fix is not to change
5937         AddEnum, because that one was using a fully qualified name (every
5938         DeclSpace derivative does), but to change the AddMethod routine
5939         that was using an un-namespaced name.  This now correctly reports
5940         the duplicated name.
5941
5942         Revert patch until I can properly fix it.  The issue
5943         is that we have a shared Type space across all namespaces
5944         currently, which is wrong.
5945
5946         Options include making the Namespace a DeclSpace, and merge
5947         current_namespace/current_container in the parser.
5948
5949 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
5950
5951         * cs-parser.jay: Improve error reporting when we get a different
5952         kind of expression in local_variable_type and
5953         local_variable_pointer_type. 
5954
5955         Propagate this to avoid missleading errors being reported.
5956
5957         * ecore.cs (ImplicitReferenceConversion): treat
5958         TypeManager.value_type as a target just like object_type.   As
5959         code like this:
5960
5961         ValueType v = 1;
5962
5963         Is valid, and needs to result in the int 1 being boxed before it
5964         is assigned to the value type v.
5965
5966         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
5967         to validate the enumeration name.
5968
5969         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
5970         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
5971         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
5972
5973         * ecore.cs (TryImplicitIntConversion): When doing an
5974         implicit-enumeration-conversion, check if the type is 64-bits and
5975         perform a conversion before passing to EnumConstant.
5976
5977 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
5978
5979         * decl.cs (Error_AmbiguousTypeReference); New routine used to
5980         report ambiguous type references.  Unlike the MS version, we
5981         report what the ambiguity is.   Innovation at work ;-)
5982
5983         (DeclSpace.FindType): Require a location argument to
5984         display when we display an ambiguous error.
5985
5986         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
5987
5988         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
5989
5990         * expression.cs (EmitDynamicInitializers): Apply patch from
5991         hwang_rob@yahoo.ca that fixes the order in which we emit our
5992         initializers. 
5993
5994 2002-09-21  Martin Baulig  <martin@gnome.org>
5995
5996         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
5997         delegate takes no arguments.
5998
5999 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
6000
6001         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
6002         from integers.
6003
6004         * expression.cs: Extract the underlying type.
6005
6006         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
6007
6008         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
6009
6010 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
6011
6012         * class.cs (TypeContainer.DefineType): We can not use the nice
6013         PackingSize with the size set to 1 DefineType method, because it
6014         will not allow us to define the interfaces that the struct
6015         implements.
6016
6017         This completes the fixing of bug 27287
6018
6019         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
6020         means also structs.  This fixes part of the problem. 
6021         (Expresion.ImplicitReferenceConversionExists): ditto.
6022
6023         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
6024         error if there were no errors reported during the type lookup
6025         process, to avoid duplicates or redundant errors.  Without this
6026         you would get an ambiguous errors plus a type not found.  We have
6027         beaten the user enough with the first error.  
6028
6029         (DeclSparce.FindType): Emit a warning if we have an ambiguous
6030         reference. 
6031
6032         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
6033         during the resolution process, stop the lookup, this avoids
6034         repeated error reports (same error twice).
6035
6036         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
6037
6038         * typemanager.cs (LookupType): Redo the type lookup code to match
6039         the needs of System.Reflection.  
6040
6041         The issue is that System.Reflection requires references to nested
6042         types to begin with a "+" sign instead of a dot.  So toplevel
6043         types look like: "NameSpace.TopLevelClass", and nested ones look
6044         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
6045         levels. 
6046
6047 2002-09-19  Martin Baulig  <martin@gnome.org>
6048
6049         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
6050         says that a method always returns or always throws an exception,
6051         don't report the CS0161.
6052
6053         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
6054         set `Returns = new_returns'.
6055
6056 2002-09-19  Martin Baulig  <martin@gnome.org>
6057
6058         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
6059         to an enum constant, check for a CS0176.
6060
6061 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
6062
6063         * class.cs (TypeContainer.CheckPairedOperators): Now we check
6064         for operators that must be in pairs and report errors.
6065
6066         * ecore.cs (SimpleName.DoResolveType): During the initial type
6067         resolution process, when we define types recursively, we must
6068         check first for types in our current scope before we perform
6069         lookups in the enclosing scopes.
6070
6071         * expression.cs (MakeByteBlob): Handle Decimal blobs.
6072
6073         (Invocation.VerifyArgumentsCompat): Call
6074         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
6075         I thought we were supposed to always call this, but there are a
6076         few places in the code where we dont do it.
6077
6078 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
6079
6080         * driver.cs: Add support in -linkres and -resource to specify the
6081         name of the identifier.
6082
6083 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
6084
6085         * ecore.cs (StandardConversionExists): Sync with the conversion
6086         code: allow anything-* to void* conversions.
6087
6088         (FindMostSpecificSource): Use an Expression argument
6089         instead of a Type, because we might be handed over a Literal which
6090         gets a few more implicit conversions that plain types do not.  So
6091         this information was being lost.
6092
6093         Also, we drop the temporary type-holder expression when not
6094         required.
6095
6096 2002-09-17  Martin Baulig  <martin@gnome.org>
6097
6098         * class.cs (PropertyBase.CheckBase): Don't check the base class if
6099         this is an explicit interface implementation.
6100
6101 2002-09-17  Martin Baulig  <martin@gnome.org>
6102
6103         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
6104         different `IndexerName' attributes.
6105
6106         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
6107         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
6108         virtual CommonResolve().
6109
6110 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
6111
6112         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
6113         and convert that to the UnderlyingType.
6114
6115         * statement.cs (Foreach.Resolve): Indexers are just like variables
6116         or PropertyAccesses.
6117
6118         * cs-tokenizer.cs (consume_string): Track line numbers and columns
6119         inside quoted strings, we were not doing this before.
6120
6121 2002-09-16  Martin Baulig  <martin@gnome.org>
6122
6123         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
6124         resolve it.  This is needed for the definite assignment check of the
6125         instance expression, fixes bug #29846.
6126         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
6127
6128 2002-09-16  Nick Drochak  <ndrochak@gol.com>
6129
6130         * parameter.cs: Fix compile error.  Cannot reference static member
6131         from an instance object.  Is this an mcs bug?
6132
6133 2002-09-14  Martin Baulig  <martin@gnome.org>
6134
6135         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
6136         multiple times.  Fixes bug #30295, added test-166.cs.
6137
6138 2002-09-14  Martin Baulig  <martin@gnome.org>
6139
6140         * statement.cs (Block.Emit): Don't emit unreachable code.
6141         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
6142         `break' statements.
6143         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
6144
6145 2002-09-14  Martin Baulig  <martin@gnome.org>
6146
6147         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
6148         is set.
6149
6150 2002-09-14  Martin Baulig  <martin@gnome.org>
6151
6152         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
6153         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
6154         be false on the ms runtime.
6155
6156 2002-09-13  Martin Baulig  <martin@gnome.org>
6157
6158         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
6159         the CS0038 error message.
6160
6161 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
6162
6163         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
6164         constant inside, return it.
6165
6166 2002-09-12  Martin Baulig  <martin@gnome.org>
6167
6168         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
6169         implicit conversion can be done between enum types.
6170
6171         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
6172         check whether an implicit conversion to the current enum's UnderlyingType
6173         exists and report an error if not.
6174
6175         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
6176         without debugging support.
6177
6178         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
6179         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
6180
6181 2002-09-12  Martin Baulig  <martin@gnome.org>
6182
6183         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
6184
6185         * ecore.cs (IMemberExpr.DeclaringType): New property.
6186         (SimpleName.SimpleNameResolve): Check whether we're accessing a
6187         nonstatic member of an outer type (CS0038).
6188
6189 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
6190
6191         * driver.cs: Activate the using-error detector at warning level
6192         4 (at least for MS-compatible APIs).
6193
6194         * namespace.cs (VerifyUsing): Small buglett fix.
6195
6196         * pending.cs (PendingImplementation): pass the container pointer. 
6197
6198         * interface.cs (GetMethods): Allow for recursive definition.  Long
6199         term, I would like to move every type to support recursive
6200         definitions, not the current ordering mechanism that we have right
6201         now.
6202
6203         The situation is this: Attributes are handled before interfaces,
6204         so we can apply attributes to interfaces.  But some attributes
6205         implement interfaces, we will now handle the simple cases
6206         (recursive definitions will just get an error).  
6207
6208         * parameter.cs: Only invalidate types at the end if we fail to
6209         lookup all types.  
6210
6211 2002-09-09  Martin Baulig  <martin@gnome.org>
6212
6213         * ecore.cs (PropertyExpr.Emit): Also check for
6214         TypeManager.system_int_array_get_length so this'll also work when
6215         compiling corlib.  Fixes #30003.
6216
6217 2002-09-09  Martin Baulig  <martin@gnome.org>
6218
6219         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
6220         and throw an exception if we can't get the type's size.  Fixed #30040,
6221         added test-165.cs.
6222
6223 2002-09-09  Martin Baulig  <martin@gnome.org>
6224
6225         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
6226
6227         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
6228         context.  Fixes bug #30027.
6229
6230         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
6231         virtual functions.  Fixes bug #30043, added test-164.cs.
6232
6233 2002-09-08  Ravi Pratap  <ravi@ximian.com>
6234
6235         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
6236
6237 2002-09-08  Nick Drochak  <ndrochak@gol.com>
6238
6239         * driver.cs: Use an object to get the windows codepage since it's not a
6240         static property.
6241
6242 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
6243
6244         * statement.cs (For.Emit): for infinite loops (test == null)
6245         return whether there is a break inside, not always "true".
6246
6247         * namespace.cs (UsingEntry): New struct to hold the name of the
6248         using definition, the location where it is defined, and whether it
6249         has been used in a successful type lookup.
6250
6251         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
6252         strings.
6253
6254         * decl.cs: ditto.
6255
6256 2002-09-06  Ravi Pratap  <ravi@ximian.com>
6257
6258         * attribute.cs : Fix incorrect code which relied on catching
6259         a NullReferenceException to detect a null being passed in
6260         where an object was expected.
6261
6262 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
6263
6264         * statement.cs (Try): flag the catch variable as assigned
6265
6266         * expression.cs (Cast): Simplified by using ResolveType instead of
6267         manually resolving.
6268
6269         * statement.cs (Catch): Fix bug by using ResolveType.
6270
6271 2002-09-06  Ravi Pratap  <ravi@ximian.com>
6272
6273         * expression.cs (BetterConversion): Special case for when we have
6274         a NullLiteral as the argument and we have to choose between string
6275         and object types - we choose string the way csc does.
6276
6277         * attribute.cs (Attribute.Resolve): Catch the
6278         NullReferenceException and report error #182 since the Mono
6279         runtime no more has the bug and having this exception raised means
6280         we tried to select a constructor which takes an object and is
6281         passed a null.
6282
6283 2002-09-05  Ravi Pratap  <ravi@ximian.com>
6284
6285         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
6286         message (1502, 1503) when we can't locate a method after overload
6287         resolution. This is much more informative and closes the bug
6288         Miguel reported.
6289
6290         * interface.cs (PopulateMethod): Return if there are no argument
6291         types. Fixes a NullReferenceException bug.
6292
6293         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
6294         expressions too. Previously we were checking only in one place for
6295         positional arguments leaving out named arguments.
6296
6297         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
6298         type to the enum type is not allowed. Remove code corresponding to
6299         that.
6300
6301         (ConvertNumericExplicit): Allow explicit conversions from
6302         the underlying type to enum type. This precisely follows the spec
6303         and closes a bug filed by Gonzalo.
6304
6305 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6306
6307         * compiler.csproj:
6308         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
6309
6310 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
6311
6312         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
6313         it was important that we stored the right value after the
6314         reduction in `converted'.
6315
6316 2002-09-04  Martin Baulig  <martin@gnome.org>
6317
6318         * location.cs (Location.SymbolDocument): Use full pathnames for the
6319         source files.
6320
6321 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
6322
6323         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
6324         of the expression resolve mechanism, because that will catch the
6325         SimpleName error failures.
6326
6327         (Conditional): If we can not resolve the
6328         expression, return, do not crash.
6329
6330 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6331
6332         * cs-tokenizer.cs:
6333         (location): display token name instead of its number.
6334
6335 2002-08-28  Martin Baulig  <martin@gnome.org>
6336
6337         * expression.cs (Binary.ResolveOperator): Don't silently return
6338         but return an error if an operator cannot be applied between two
6339         enum types.
6340
6341 2002-08-28  Martin Baulig  <martin@gnome.org>
6342
6343         * class.cs (Constructor.Define): Set the permission attributes
6344         correctly instead of making all constructors public.
6345
6346 2002-08-28  Martin Baulig  <martin@gnome.org>
6347
6348         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
6349         for private members before reporting a CS0103; if we find anything,
6350         it's a CS0122.
6351
6352 2002-08-28  Martin Baulig  <martin@gnome.org>
6353
6354         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
6355         to check whether `closure_start_type == closure_invocation_type',
6356         we also need to check whether `m.DeclaringType == closure_invocation_type'
6357         before bypassing the permission checks.  We might be accessing
6358         protected/private members from the base class.
6359         (TypeManager.RealMemberLookup): Only set private_ok if private
6360         members were requested via BindingFlags.NonPublic.
6361
6362         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
6363
6364         * expression.cs (MemberAccess.ResolveMemberAccess): Set
6365         MethodGroupExpr.IsExplicitImpl if appropriate.
6366         (Invocation.DoResolve): Don't report the CS0120 for explicit
6367         interface implementations.
6368
6369 2002-08-27  Martin Baulig  <martin@gnome.org>
6370
6371         * expression.cs (Invocation.DoResolve): If this is a static
6372         method and we don't have an InstanceExpression, we must report
6373         a CS0120.
6374
6375 2002-08-25  Martin Baulig  <martin@gnome.org>
6376
6377         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
6378         `==' between a valuetype and an object.
6379
6380 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
6381
6382         * ecore.cs (TypeExpr): Provide a ToString method.
6383
6384 2002-08-24  Martin Baulig  <martin@gnome.org>
6385
6386         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
6387         now called proggie.dbg and it's a binary file.
6388
6389 2002-08-23  Martin Baulig  <martin@gnome.org>
6390
6391         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
6392
6393 2002-08-23  Martin Baulig  <martin@gnome.org>
6394
6395         * struct.cs (MyStructInfo.ctor): Make this work with empty
6396         structs; it's not allowed to use foreach() on null.
6397
6398 2002-08-23  Martin Baulig  <martin@gnome.org>
6399
6400         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
6401         writer the full pathname of the generated assembly.
6402
6403 2002-08-23  Martin Baulig  <martin@gnome.org>
6404
6405         * statements.cs (FlowBranching.UsageVector.MergeChildren):
6406         A `finally' block never returns or breaks; improved handling of
6407         unreachable code.
6408
6409 2002-08-23  Martin Baulig  <martin@gnome.org>
6410
6411         * statement.cs (Throw.Resolve): Allow `throw null'.
6412
6413 2002-08-23  Martin Baulig  <martin@gnome.org>
6414
6415         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
6416         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
6417         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
6418         MemberLookup would return a wrong event if this is an explicit
6419         interface implementation and the class has an event with the same
6420         name.
6421
6422 2002-08-23  Martin Baulig  <martin@gnome.org>
6423
6424         * statement.cs (Block.AddChildVariableNames): New public method.
6425         (Block.AddChildVariableName): Likewise.
6426         (Block.IsVariableNameUsedInChildBlock): Likewise.
6427         (Block.AddVariable): Check whether a variable name has already
6428         been used in a child block.
6429
6430         * cs-parser.jay (declare_local_variables): Mark all variable names
6431         from the current block as being used in a child block in the
6432         implicit block.
6433
6434 2002-08-23  Martin Baulig  <martin@gnome.org>
6435
6436         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
6437         find the symbol writer.
6438
6439         * driver.cs: csc also allows the arguments to /define being
6440         separated by commas, not only by semicolons.
6441
6442 2002-08-23  Martin Baulig  <martin@gnome.org>
6443
6444         * interface.cs (Interface.GetMembers): Added static check for events.
6445
6446 2002-08-15  Martin Baulig  <martin@gnome.org>
6447
6448         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
6449         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
6450
6451         * ecore.cs (Expression.MemberLookup): Added documentation and explained
6452         why the MethodData.EmitDestructor() change was necessary.
6453
6454 2002-08-20  Martin Baulig  <martin@gnome.org>
6455
6456         * class.cs (TypeContainer.FindMembers): Added static check for events.
6457
6458         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
6459
6460         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
6461         use Type.GetEvents(), not Type.FindMembers().
6462
6463 2002-08-20  Martin Baulig  <martin@gnome.org>
6464
6465         * decl.cs (MemberCache): Added a special method cache which will
6466         be used for method-only searched.  This ensures that a method
6467         search will return a MethodInfo with the correct ReflectedType for
6468         inherited methods.      
6469
6470 2002-08-20  Martin Baulig  <martin@gnome.org>
6471
6472         * decl.cs (DeclSpace.FindMembers): Made this public.
6473
6474 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6475
6476         * delegate.cs: fixed build on windows.
6477         [FIXME:  Filed as bug #29150: MCS must report these errors.]
6478
6479 2002-08-19  Ravi Pratap  <ravi@ximian.com>
6480
6481         * ecore.cs (StandardConversionExists): Return a false
6482         if we are trying to convert the void type to anything else
6483         since that is not allowed.
6484
6485         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
6486         we flag error 70 in the event an event is trying to be accessed
6487         directly from outside the declaring type.
6488
6489 2002-08-20  Martin Baulig  <martin@gnome.org>
6490
6491         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
6492         MemberCache from typemanager.cs to decl.cs.
6493
6494 2002-08-19  Martin Baulig  <martin@gnome.org>
6495
6496         * class.cs (TypeContainer): Implement IMemberContainer.
6497         (TypeContainer.DefineMembers): Create the MemberCache.
6498         (TypeContainer.FindMembers): Do better BindingFlags checking; only
6499         return public members if BindingFlags.Public was given, check
6500         whether members are static.
6501
6502 2002-08-16  Martin Baulig  <martin@gnome.org>
6503
6504         * decl.cs (DeclSpace.Define): Splitted this in Define and
6505         DefineMembers.  DefineMembers is called first and initializes the
6506         MemberCache.
6507
6508         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
6509         DefineMembers() on all our DeclSpaces.
6510
6511         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
6512         but call DefineMembers() on all nested interfaces.  We call their
6513         Define() in our new Define() function.
6514
6515         * interface.cs (Interface): Implement IMemberContainer.
6516         (Interface.Define): Moved all code except the attribute stuf to
6517         DefineMembers().
6518         (Interface.DefineMembers): Initialize the member cache.
6519
6520         * typemanager.cs (IMemberFinder): Removed this interface, we don't
6521         need this anymore since we can use MemberCache.FindMembers directly.
6522
6523 2002-08-19  Martin Baulig  <martin@gnome.org>
6524
6525         * typemanager.cs (MemberCache): When creating the cache for an
6526         interface type, add all inherited members.
6527         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
6528         to `out bool used_cache' and documented it.
6529         (TypeManager.MemberLookup): If we already used the cache in the first
6530         iteration, we don't need to do the interfaces check.
6531
6532 2002-08-19  Martin Baulig  <martin@gnome.org>
6533
6534         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
6535         here from IMemberFinder and don't implement this interface anymore.
6536         (DeclSpace.MemberCache): Moved here from IMemberFinder.
6537
6538         * typemanager.cs (IMemberFinder): This interface is now only used by
6539         classes which actually support the member cache.
6540         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
6541         since we only put DeclSpaces into this Hashtable.
6542         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
6543         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
6544
6545 2002-08-16  Martin Baulig  <martin@gnome.org>
6546
6547         * typemanager.cs (ICachingMemberFinder): Removed.
6548         (IMemberFinder.MemberCache): New property.
6549         (TypeManager.FindMembers): Merged this with RealFindMembers().
6550         This function will never be called from TypeManager.MemberLookup()
6551         so we can't use the cache here, just the IMemberFinder.
6552         (TypeManager.MemberLookup_FindMembers): Check whether the
6553         IMemberFinder has a MemberCache and call the cache's FindMembers
6554         function.
6555         (MemberCache): Rewrote larger parts of this yet another time and
6556         cleaned it up a bit.
6557
6558 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
6559
6560         * driver.cs (LoadArgs): Support quoting.
6561
6562         (Usage): Show the CSC-like command line arguments.
6563
6564         Improved a few error messages.
6565
6566 2002-08-15  Martin Baulig  <martin@gnome.org>
6567
6568         * typemanager.cs (IMemberContainer.Type): New property.
6569         (IMemberContainer.IsInterface): New property.
6570
6571         The following changes are conditional to BROKEN_RUNTIME, which is
6572         defined at the top of the file.
6573
6574         * typemanager.cs (MemberCache.MemberCache): Don't add the base
6575         class'es members, but add all members from TypeHandle.ObjectType
6576         if we're an interface.
6577         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
6578         is the current type.
6579         (MemberCache.CacheEntry.Container): Removed this field.
6580         (TypeHandle.GetMembers): Include inherited members.
6581
6582 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6583
6584         * typemanager.cs: fixed compilation and added a comment on a field that
6585         is never used.
6586
6587 2002-08-15  Martin Baulig  <martin@gnome.org>
6588
6589         * class.cs (ConstructorInitializer.Resolve): In the
6590         Expression.MemberLookup call, use the queried_type as
6591         invocation_type.
6592
6593         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
6594         declared' attribute, it's always true.
6595         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
6596         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
6597         temporary wrapper for FindMembers which tells MemberLookup whether
6598         members from the base classes are included in the return value.
6599         This will go away soon.
6600         (TypeManager.MemberLookup): Use this temporary hack here; once the
6601         new MemberCache is completed, we don't need to do the DeclaredOnly
6602         looping here anymore since the MemberCache will take care of this.
6603         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
6604         (MemberCache): When creating the MemberCache for a class, get
6605         members from the current class and all its base classes.
6606         (MemberCache.CacheEntry.Container): New field.  This is a
6607         temporary hack until the Mono runtime is fixed to distinguish
6608         between ReflectedType and DeclaringType.  It allows us to use MCS
6609         with both the MS runtime and the unfixed Mono runtime without
6610         problems and without accecting performance.
6611         (MemberCache.SearchMembers): The DeclaredOnly looping from
6612         TypeManager.MemberLookup is now done here.      
6613
6614 2002-08-14  Martin Baulig  <martin@gnome.org>
6615
6616         * statement.cs (MyStructInfo.MyStructInfo): Don't call
6617         Type.GetFields on dynamic types but get the fields from the
6618         corresponding TypeContainer.
6619         (MyStructInfo.GetStructInfo): Added check for enum types.
6620
6621         * typemanager.cs (MemberList.IsSynchronized): Implemented.
6622         (MemberList.SyncRoot): Implemented.
6623         (TypeManager.FilterWithClosure): No need to check permissions if
6624         closure_start_type == closure_invocation_type, don't crash if
6625         closure_invocation_type is null.
6626
6627 2002-08-13  Martin Baulig  <martin@gnome.org>
6628
6629         Rewrote TypeContainer.FindMembers to use a member cache.  This
6630         gives us a speed increase of about 35% for the self-hosting MCS
6631         build and of about 15-20% for the class libs (both on GNU/Linux).
6632
6633         * report.cs (Timer): New class to get enhanced profiling.  This
6634         whole class is "TIMER" conditional since it remarkably slows down
6635         compilation speed.
6636
6637         * class.cs (MemberList): New class.  This is an IList wrapper
6638         which we're now using instead of passing MemberInfo[]'s around to
6639         avoid copying this array unnecessarily.
6640         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
6641         (ICachingMemberFinder, IMemberContainer): New interface.
6642         (TypeManager.FilterWithClosure): If `criteria' is null, the name
6643         has already been checked, otherwise use it for the name comparision.
6644         (TypeManager.FindMembers): Renamed to RealMemberFinder and
6645         provided wrapper which tries to use ICachingMemberFinder.FindMembers
6646         if possible.  Returns a MemberList, not a MemberInfo [].
6647         (TypeHandle): New class, implements IMemberContainer.  We create
6648         one instance of this class per type, it contains a MemberCache
6649         which is used to do the member lookups.
6650         (MemberCache): New class.  Each instance of this class contains
6651         all members of a type and a name-based hash table.
6652         (MemberCache.FindMembers): This is our new member lookup
6653         function.  First, it looks up all members of the requested name in
6654         the hash table.  Then, it walks this list and sorts out all
6655         applicable members and returns them.
6656
6657 2002-08-13  Martin Baulig  <martin@gnome.org>
6658
6659         In addition to a nice code cleanup, this gives us a performance
6660         increase of about 1.4% on GNU/Linux - not much, but it's already
6661         half a second for the self-hosting MCS compilation.
6662
6663         * typemanager.cs (IMemberFinder): New interface.  It is used by
6664         TypeManager.FindMembers to call FindMembers on a TypeContainer,
6665         Enum, Delegate or Interface.
6666         (TypeManager.finder_to_member_finder): New PtrHashtable.
6667         (TypeManager.finder_to_container): Removed.
6668         (TypeManager.finder_to_delegate): Removed.
6669         (TypeManager.finder_to_interface): Removed.
6670         (TypeManager.finder_to_enum): Removed.
6671
6672         * interface.cs (Interface): Implement IMemberFinder.
6673
6674         * delegate.cs (Delegate): Implement IMemberFinder.
6675
6676         * enum.cs (Enum): Implement IMemberFinder.
6677
6678         * class.cs (TypeContainer): Implement IMemberFinder.
6679
6680 2002-08-12  Martin Baulig  <martin@gnome.org>
6681
6682         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
6683
6684 2002-08-12  Martin Baulig  <martin@gnome.org>
6685
6686         * ecore.cs (ITypeExpression): New interface for expressions which
6687         resolve to a type.
6688         (TypeExpression): Renamed to TypeLookupExpression.
6689         (Expression.DoResolve): If we're doing a types-only lookup, the
6690         expression must implement the ITypeExpression interface and we
6691         call DoResolveType() on it.
6692         (SimpleName): Implement the new ITypeExpression interface.
6693         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
6694         hack, the situation that we're only looking up types can't happen
6695         anymore when this method is called.  Moved the type lookup code to
6696         DoResolveType() and call it.
6697         (SimpleName.DoResolveType): This ITypeExpression interface method
6698         is now doing the types-only lookup.
6699         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
6700         (ResolveFlags): Added MaskExprClass.
6701
6702         * expression.cs (MemberAccess): Implement the ITypeExpression
6703         interface.
6704         (MemberAccess.DoResolve): Added support for a types-only lookup
6705         when we're called via ITypeExpression.DoResolveType().
6706         (ComposedCast): Implement the ITypeExpression interface.
6707
6708         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
6709         Expression.Resolve() with ResolveFlags.Type instead.
6710
6711 2002-08-12  Martin Baulig  <martin@gnome.org>
6712
6713         * interface.cs (Interface.Define): Apply attributes.
6714
6715         * attribute.cs (Attribute.ApplyAttributes): Added support for
6716         interface attributes.
6717
6718 2002-08-11  Martin Baulig  <martin@gnome.org>
6719
6720         * statement.cs (Block.Emit): Only check the "this" variable if we
6721         do not always throw an exception.
6722
6723         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
6724         whether the property has a set accessor.
6725
6726 2002-08-11  Martin Baulig  <martin@gnome.org>
6727
6728         Added control flow analysis support for structs.
6729
6730         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
6731         with control flow analysis turned off.
6732         (IVariable): New interface.
6733         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
6734         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
6735         (FieldExpr.DoResolve): Resolve the instance expression with flow
6736         analysis turned off and do the definite assignment check after the
6737         resolving when we know what the expression will resolve to.
6738
6739         * expression.cs (LocalVariableReference, ParameterReference):
6740         Implement the new IVariable interface, only call the flow analysis
6741         code if ec.DoFlowAnalysis is true.
6742         (This): Added constructor which takes a Block argument.  Implement
6743         the new IVariable interface.
6744         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
6745         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
6746         This does the definite assignment checks for struct members.
6747
6748         * class.cs (Constructor.Emit): If this is a non-static `struct'
6749         constructor which doesn't have any initializer, call
6750         Block.AddThisVariable() to tell the flow analysis code that all
6751         struct elements must be initialized before control returns from
6752         the constructor.
6753
6754         * statement.cs (MyStructInfo): New public class.
6755         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
6756         argument to this indexer.  If non-zero, check an individual struct
6757         member, not the whole struct.
6758         (FlowBranching.CheckOutParameters): Check struct members.
6759         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
6760         overloaded versions of these methods which take an additional
6761         `int field_idx' argument to check struct members.
6762         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
6763         overloaded versions of these methods which take an additional
6764         `string field_name' argument to check struct member.s
6765         (VariableInfo): Implement the IVariable interface.
6766         (VariableInfo.StructInfo): New public property.  Returns the
6767         MyStructInfo instance of the variable if it's a struct or null.
6768         (Block.AddThisVariable): New public method.  This is called from
6769         Constructor.Emit() for non-static `struct' constructor which do
6770         not have any initializer.  It creates a special variable for the
6771         "this" instance variable which will be checked by the flow
6772         analysis code to ensure that all of the struct's fields are
6773         initialized before control returns from the constructor.
6774         (UsageVector): Added support for struct members.  If a
6775         variable/parameter is a struct with N members, we reserve a slot
6776         in the usage vector for each member.  A struct is considered fully
6777         initialized if either the struct itself (slot 0) or all its
6778         members are initialized.
6779
6780 2002-08-08  Martin Baulig  <martin@gnome.org>
6781
6782         * driver.cs (Driver.MainDriver): Only report an error CS5001
6783         if there were no compilation errors.
6784
6785         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
6786         `UnsafeContext' property to determine whether the parent is in
6787         unsafe context rather than checking the parent's ModFlags:
6788         classes nested in an unsafe class are unsafe as well.
6789
6790 2002-08-08  Martin Baulig  <martin@gnome.org>
6791
6792         * statement.cs (UsageVector.MergeChildren): Distinguish between
6793         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
6794         we return.  Added test17() and test18() to test-154.cs.
6795
6796 2002-08-08  Martin Baulig  <martin@gnome.org>
6797
6798         * typemanager.cs (TypeManager.FilterWithClosure): If we have
6799         Family access, make sure the invoking type isn't a subclass of the
6800         queried type (that'd be a CS1540).
6801
6802         * ecore.cs (Expression.MemberLookup): Added overloaded version of
6803         this method which takes an additional `Type invocation_type'.
6804
6805         * expression.cs (BaseAccess.DoResolve): Use the base type as
6806         invocation and query type.
6807         (MemberAccess.DoResolve): If the lookup failed and we're about to
6808         report a CS0122, try a lookup with the ec.ContainerType - if this
6809         succeeds, we must report a CS1540.
6810
6811 2002-08-08  Martin Baulig  <martin@gnome.org>
6812
6813         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
6814         (MethodGroupExpr): Implement the IMemberExpr interface.
6815
6816         * expression (MemberAccess.ResolveMemberAccess): No need to have
6817         any special code for MethodGroupExprs anymore, they're now
6818         IMemberExprs.   
6819
6820 2002-08-08  Martin Baulig  <martin@gnome.org>
6821
6822         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
6823         Family, FamANDAssem and FamORAssem permissions.
6824         (TypeManager.IsSubclassOrNestedChildOf): New public method.
6825
6826 2002-08-08  Martin Baulig  <martin@gnome.org>
6827
6828         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
6829         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
6830         or loop block.
6831
6832 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
6833
6834         * driver.cs: implemented /resource option to embed managed resources.
6835
6836 2002-08-07  Martin Baulig  <martin@gnome.org>
6837
6838         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
6839         (FieldBase.HasFieldInitializer): New public property.
6840         (FieldBase.GetInitializerExpression): New public method.  Resolves and
6841         returns the field initializer and makes sure it is only resolved once.
6842         (TypeContainer.EmitFieldInitializers): Call
6843         FieldBase.GetInitializerExpression to get the initializer, this ensures
6844         that it isn't resolved multiple times.
6845
6846         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
6847         the resolving process (SimpleName/MemberLookup) that we're currently
6848         emitting a field initializer (which must not access any instance members,
6849         this is an error CS0236).
6850
6851         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
6852         argument, if the `IsFieldInitializer' flag is set, we must report and
6853         error CS0236 and not an error CS0120.   
6854
6855 2002-08-07  Martin Baulig  <martin@gnome.org>
6856
6857         * ecore.cs (IMemberExpr): New public interface.
6858         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
6859         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
6860         if the expression is an IMemberExpr.
6861
6862         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
6863         to be null, implicitly default to `this' if we're non-static in
6864         this case.  Simplified the code a lot by using the new IMemberExpr
6865         interface.  Also fixed bug #28176 here.
6866
6867 2002-08-06  Martin Baulig  <martin@gnome.org>
6868
6869         * cs-parser.jay (SimpleLookup): Removed.  We need to create
6870         ParameterReferences during semantic analysis so that we can do a
6871         type-only search when resolving Cast, TypeOf and SizeOf.
6872         (block): Pass the `current_local_parameters' to the Block's
6873         constructor.
6874
6875         * class.cs (ConstructorInitializer): Added `Parameters parameters'
6876         argument to the constructor.
6877         (ConstructorInitializer.Resolve): Create a temporary implicit
6878         block with the parameters.
6879
6880         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
6881         references here if we aren't doing a type-only search.
6882
6883         * statement.cs (Block): Added constructor which takes a
6884         `Parameters parameters' argument.
6885         (Block.Parameters): New public property.
6886
6887         * support.cs (InternalParameters.Parameters): Renamed `parameters'
6888         to `Parameters' and made it public readonly.
6889
6890 2002-08-06  Martin Baulig  <martin@gnome.org>
6891
6892         * ecore.cs (Expression.Warning): Made this public as well.
6893
6894         * report.cs (Report.Debug): Print the contents of collections.
6895
6896 2002-08-06  Martin Baulig  <martin@gnome.org>
6897
6898         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
6899         used to tell Resolve() which kinds of expressions it may return.
6900         (Expression.Resolve): Added overloaded version of this method which
6901         takes a `ResolveFlags flags' argument.  This can be used to tell
6902         Resolve() which kinds of expressions it may return.  Reports a
6903         CS0118 on error.
6904         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
6905         ResolveFlags.SimpleName.
6906         (Expression.Error118): Added overloaded version of this method which
6907         takes a `ResolveFlags flags' argument.  It uses the flags to determine
6908         which kinds of expressions are allowed.
6909
6910         * expression.cs (Argument.ResolveMethodGroup): New public method.
6911         Resolves an argument, but allows a MethodGroup to be returned.
6912         This is used when invoking a delegate.
6913
6914         * TODO: Updated a bit.
6915
6916 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6917
6918         Fixed compilation with csc.
6919
6920         * ecore.cs: Expression.Error made public. Is this correct? Should
6921         Warning be made public too?
6922
6923         * expression.cs: use ea.Location instead of ea.loc.
6924         [FIXME:  Filed as bug #28607: MCS must report these errors.]
6925
6926 2002-08-06  Martin Baulig  <martin@gnome.org>
6927
6928         * ecore.cs (Expression.loc): Moved the location here instead of
6929         duplicating it in all derived classes.
6930         (Expression.Location): New public property.
6931         (Expression.Error, Expression.Warning): Made them non-static and
6932         removed the location argument.
6933         (Expression.Warning): Added overloaded version which takes an
6934         `int level' argument.
6935         (Expression.Error118): Make this non-static and removed the
6936         expression and location arguments.
6937         (TypeExpr): Added location argument to the constructor.
6938
6939         * expression.cs (StaticCallExpr): Added location argument to
6940         the constructor.
6941         (Indirection, PointerArithmetic): Likewise.
6942         (CheckedExpr, UnCheckedExpr): Likewise.
6943         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
6944         (StringPtr): Likewise.
6945
6946
6947 2002-08-05  Martin Baulig  <martin@gnome.org>
6948
6949         * expression.cs (BaseAccess.DoResolve): Actually report errors.
6950
6951         * assign.cs (Assign.DoResolve): Check whether the source
6952         expression is a value or variable.
6953
6954         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
6955         while resolving the corresponding blocks.
6956
6957         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
6958         an error, don't silently return null.
6959
6960         * statement.cs (Block.AddVariable): Do the error reporting here
6961         and distinguish between CS0128 and CS0136.
6962         (Block.DoResolve): Report all unused labels (warning CS0164).
6963         (LabeledStatement): Pass the location to the constructor.
6964         (LabeledStatement.HasBeenReferenced): New property.
6965         (LabeledStatement.Resolve): Set it to true here.
6966
6967         * statement.cs (Return.Emit): Return success even after reporting
6968         a type mismatch error (CS0126 or CS0127), this is what csc does and
6969         it avoids confusing the users with any consecutive errors.
6970
6971 2002-08-05  Martin Baulig  <martin@gnome.org>
6972
6973         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
6974
6975         * const.cs (Const.LookupConstantValue): Catch circular definitions.
6976
6977         * expression.cs (MemberAccess.DoResolve): Silently return if an
6978         error has already been reported.
6979
6980         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
6981         error has already been reported.
6982
6983 2002-08-05  Martin Baulig  <martin@gnome.org>
6984
6985         * statement.cs (UsageVector): Only initialize the `parameters'
6986         vector if we actually have any "out" parameters.
6987
6988 2002-08-05  Martin Baulig  <martin@gnome.org>
6989
6990         * expression.cs (Binary.ResolveOperator): When combining delegates,
6991         they must have the same type.
6992
6993 2002-08-05  Martin Baulig  <martin@gnome.org>
6994
6995         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
6996         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
6997         work with the ms runtime and we also don't need it: if we're a
6998         PropertyBuilder and not in the `indexer_arguments' hash, then we
6999         are a property and not an indexer.
7000
7001         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
7002         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
7003         since the latter one doesn't work with the ms runtime.
7004
7005 2002-08-03  Martin Baulig  <martin@gnome.org>
7006
7007         Fixed bugs #27998 and #22735.
7008
7009         * class.cs (Method.IsOperator): New public field.
7010         (Method.CheckBase): Report CS0111 if there's already a method
7011         with the same parameters in the current class.  Report CS0508 when
7012         attempting to change the return type of an inherited method.
7013         (MethodData.Emit): Report CS0179 if a method doesn't have a body
7014         and it's not marked abstract or extern.
7015         (PropertyBase): New abstract base class for Property and Indexer.
7016         (PropertyBase.CheckBase): Moved here from Property and made it work
7017         for indexers.
7018         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
7019         the same so we can reuse it there.
7020         (Property, Indexer): Derive from PropertyBase.
7021         (MethodSignature.inheritable_property_signature_filter): New delegate
7022         to find properties and indexers.
7023
7024         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
7025         argument and improved error reporting.
7026
7027         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
7028         EmptyReadOnlyParameters and made it a property.
7029
7030         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
7031         version of this method which takes a `PropertyInfo indexer'.
7032         (TypeManager.RegisterIndexer): New method.
7033
7034         * class.cs: Added myself as author of this file :-)
7035
7036 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7037
7038         * class.cs: fixed compilation on windoze.
7039
7040 2002-08-03  Martin Baulig  <martin@gnome.org>
7041
7042         * interface.cs (Interface.GetInterfaceBases): Check whether all
7043         base interfaces are at least as accessible than the current one.
7044
7045         * class.cs (TypeContainer.GetClassBases): Check whether base types
7046         are at least as accessible than the current type.
7047         (TypeContainer.AsAccessible): Implemented and made non-static.
7048         (MemberBase.CheckParameters): Report errors if the accessibility
7049         checks fail.
7050
7051         * delegate.cs (Delegate.Delegate): The default visibility is
7052         internal for top-level types and private for nested types.
7053         (Delegate.Define): Report errors if the accessibility checks fail.
7054
7055         * enum.cs (Enum.Enum): The default visibility is internal for
7056         top-level types and private for nested types.
7057         (Enum.DefineType): Compute the correct visibility.
7058
7059         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
7060         function which takes a `bool is_toplevel' instead of a TypeContainer.
7061
7062         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
7063         builtin type.
7064
7065 2002-08-02  Martin Baulig  <martin@gnome.org>
7066
7067         * expression.cs (LocalVariableReferenc): Added constructor which
7068         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
7069         (LocalVariableReference.IsReadOnly): New property.
7070         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
7071         variable is readonly, use our own readonly flag to do this; you can
7072         use the new constructor to get a writable reference to a read-only
7073         variable.
7074
7075         * cs-parser.jay (foreach_statement, using_statement): Get a writable
7076         reference to the local variable.
7077
7078 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
7079
7080         * rootcontext.cs (ResolveCore): Also include System.Exception
7081
7082         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
7083         we reach an EmptyStatement.
7084
7085         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
7086         is also fine.
7087
7088         * expression.cs (Binary.ResolveOperator): Check error result in
7089         two places.
7090
7091         use brtrue/brfalse directly and avoid compares to null.
7092
7093 2002-08-02  Martin Baulig  <martin@gnome.org>
7094
7095         * class.cs (TypeContainer.Define): Define all nested interfaces here.
7096         Fixes bug #28407, added test-155.cs.
7097
7098 2002-08-01  Martin Baulig  <martin@gnome.org>
7099
7100         * class.cs (Event.EmitDefaultMethod): Make this work with static
7101         events.  Fixes #28311, added verify-3.cs.
7102
7103 2002-08-01  Martin Baulig  <martin@gnome.org>
7104
7105         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
7106         `is_disposable' fields.
7107         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
7108         `hm.is_disposable' if we're using the collection pattern.
7109         (Foreach.EmitCollectionForeach): Use the correct type for the
7110         enumerator's local variable, only emit the try/finally block if
7111         necessary (fixes #27713).
7112
7113 2002-08-01  Martin Baulig  <martin@gnome.org>
7114
7115         * ecore.cs (Expression.report118): Renamed to Error118 and made
7116         it public static.
7117
7118         * statement.cs (Throw.Resolve): Check whether the expression is of
7119         the correct type (CS0118) and whether the type derives from
7120         System.Exception (CS0155).
7121         (Catch.Resolve): New method.  Do the type lookup here and check
7122         whether it derives from System.Exception (CS0155).
7123         (Catch.CatchType, Catch.IsGeneral): New public properties.
7124
7125         * typemanager.cs (TypeManager.exception_type): Added.
7126
7127 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
7128
7129         * driver.cs: Updated About function.
7130
7131 2002-07-31  Martin Baulig  <martin@gnome.org>
7132
7133         Implemented Control Flow Analysis.
7134
7135         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
7136         (EmitContext.CurrentBranching): Added.
7137         (EmitContext.StartFlowBranching): Added.
7138         (EmitContext.EndFlowBranching): Added.
7139         (EmitContext.KillFlowBranching): Added.
7140         (EmitContext.IsVariableAssigned): Added.
7141         (EmitContext.SetVariableAssigned): Added.
7142         (EmitContext.IsParameterAssigned): Added.
7143         (EmitContext.SetParameterAssigned): Added.
7144         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
7145         Added control flow analysis stuff here.
7146
7147         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
7148         resolve the expression as lvalue.
7149         (LocalVariableReference.DoResolve): Check whether the variable has
7150         already been assigned.
7151         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
7152         the parameter as assigned here.
7153         (ParameterReference.DoResolve): Check whether the parameter has already
7154         been assigned.
7155         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
7156         expression as lvalue.
7157
7158         * statement.cs (FlowBranching): New class for the flow analysis code.
7159         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
7160         (LabeledStatement.IsDefined): New public property.
7161         (LabeledStatement.AddUsageVector): New public method to tell flow
7162         analyis that the label may be reached via a forward jump.
7163         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
7164         flow analysis.
7165         (VariableInfo.Number): New public field.  This is used by flow analysis
7166         to number all locals of a block.
7167         (Block.CountVariables): New public property.  This is the number of
7168         local variables in this block (including the locals from all parent
7169         blocks).
7170         (Block.EmitMeta): Number all the variables.
7171
7172         * statement.cs: Added flow analysis support to all classes.
7173
7174 2002-07-31  Martin Baulig  <martin@gnome.org>
7175
7176         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
7177         To get debugging messages, compile mcs with /define:MCS_DEBUG and
7178         then use this argument.
7179
7180         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
7181
7182         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
7183         use this to specify /define options.
7184
7185 2002-07-29  Martin Baulig  <martin@gnome.org>
7186
7187         * statement.cs (Fixed): Moved all code that does variable lookups
7188         and resolvings from Emit to Resolve.
7189
7190         * statement.cs (For): Moved all code that does variable lookups
7191         and resolvings from Emit to Resolve.
7192
7193         * statement.cs (Using): Moved all code that does variable lookups
7194         and resolvings from Emit to Resolve.
7195
7196 2002-07-29  Martin Baulig  <martin@gnome.org>
7197
7198         * attribute.cs (Attribute.Resolve): Explicitly catch a
7199         System.NullReferenceException when creating the
7200         CustromAttributeBuilder and report a different warning message.
7201
7202 2002-07-29  Martin Baulig  <martin@gnome.org>
7203
7204         * support.cs (ParameterData.ParameterName): Added method to
7205         get the name of a parameter.
7206
7207         * typemanager.cs (TypeManager.IsValueType): New public method.
7208
7209 2002-07-29  Martin Baulig  <martin@gnome.org>
7210
7211         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
7212         is a flag which specifies that it's either ref or out.
7213         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
7214         the out parameter to `out Parameter.Modifier mod', also set the
7215         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
7216
7217         * support.cs (InternalParameters.ParameterModifier): Distinguish
7218         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7219         Parameter.Modifier.ISBYREF flag if it's either ref or out.
7220
7221         * expression.cs (Argument.GetParameterModifier): Distinguish
7222         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
7223         Parameter.Modifier.ISBYREF flag if it's either ref or out.
7224
7225 2002-07-29  Martin Baulig  <martin@gnome.org>
7226
7227         * expression.cs (ParameterReference.ParameterReference): Added
7228         `Location loc' argument to the constructor.
7229
7230         * cs-parser.jay: Pass location to ParameterReference.
7231
7232 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
7233
7234         * statement.cs (Try): Initialize the location.
7235
7236         * cs-parser.jay: pass location to Try.
7237
7238         * expression.cs (Unary.Reduce): Change the prototype to return
7239         whether a constant fold could be performed or not.  The result is
7240         returned in an out parameters.  In the case of Indirection and
7241         AddressOf, we want to perform the full tests.
7242
7243 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
7244
7245         * statement.cs (Statement.Emit): Flag dead code.
7246
7247 2002-07-27  Andrew Birkett  <andy@nobugs.org>
7248
7249         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
7250
7251 2002-07-27  Martin Baulig  <martin@gnome.org>
7252
7253         * class.cs (MethodData.Define): Put back call to
7254         TypeManager.AddMethod(), accidentally commented this out.
7255
7256         * report.cs (Debug): New public method to print debugging information,
7257         this is `[Conditional ("DEBUG")]'.
7258
7259 2002-07-26  Martin Baulig  <martin@gnome.org>
7260
7261         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
7262         (switch_statement): Push the current_block to the switch_stack and
7263         pop it again when we're done with the switch.
7264         (switch_section): The new block is a child of the current_block.
7265         Fixes bug #24007, added test-152.cs.
7266
7267 2002-07-27  Martin Baulig  <martin@gnome.org>
7268
7269         * expression.cs (Invocation.EmitArguments): When calling a varargs
7270         function with only its fixed arguments, we need to pass an empty
7271         array.
7272
7273 2002-07-27  Martin Baulig  <martin@gnome.org>
7274
7275         Mono 0.13 has been released.
7276
7277 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
7278
7279         * driver.cs: Rename --resource to --linkres, because that is what
7280         we do currently, we dont support --resource yet.
7281
7282         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
7283
7284 2002-07-25  Martin Baulig  <martin@gnome.org>
7285
7286         * class.cs (MethodData): New public class.  This is a `method builder'
7287         class for a method or one accessor of a Property/Indexer/Event.
7288         (MethodData.GetMethodFlags): Moved here from MemberBase.
7289         (MethodData.ApplyAttributes): Likewise.
7290         (MethodData.ApplyObsoleteAttribute): Likewise.
7291         (MethodData.ApplyConditionalAttribute): Likewise.
7292         (MethodData.ApplyDllImportAttribute): Likewise.
7293         (MethodData.CheckAbstractAndExternal): Likewise.
7294         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
7295         (MethodData.Emit): Formerly known as Method.Emit().
7296         (MemberBase): Moved everything which was specific to a single
7297         accessor/method to MethodData.
7298         (Method): Create a new MethodData and call Define() and Emit() on it.
7299         (Property, Indexer, Event): Create a new MethodData objects for each
7300         accessor and call Define() and Emit() on them.
7301
7302 2002-07-25  Martin Baulig  <martin@gnome.org>
7303
7304         Made MethodCore derive from MemberBase to reuse the code from there.
7305         MemberBase now also checks for attributes.
7306
7307         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
7308         (MemberBase.GetMethodFlags): Moved here from class Method and marked
7309         as virtual.
7310         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
7311         `CallingConventions cc' and `Attributes opt_attrs' arguments.
7312         (MemberBase.ApplyAttributes): New virtual method; applies the
7313         attributes to a method or accessor.
7314         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
7315         (MemberBase.ApplyConditionalAttribute): Likewise.
7316         (MemberBase.ApplyDllImportAttribute): Likewise.
7317         (MemberBase.CheckAbstractAndExternal): Likewise.
7318         (MethodCore.ParameterTypes): This is now a property instead of a
7319         method, it's initialized from DoDefineParameters().
7320         (MethodCore.ParameterInfo): Removed the set accessor.
7321         (MethodCore.DoDefineParameters): New protected virtual method to
7322         initialize ParameterTypes and ParameterInfo.
7323         (Method.GetReturnType): We can now simply return the MemberType.
7324         (Method.GetMethodFlags): Override the MemberBase version and add
7325         the conditional flags.
7326         (Method.CheckBase): Moved some code from Define() here, call
7327         DoDefineParameters() here.
7328         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
7329         here to avoid some larger code duplication.
7330         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
7331         ensure that abstract and external accessors don't declare a body.
7332
7333         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
7334         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
7335         lookup in the attribute's parent classes, so we need to abort as soon
7336         as we found the first match.
7337         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
7338         the attribute has no arguments.
7339
7340         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
7341         of a Method.
7342
7343 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7344
7345         * cs-parser.jay: reverted previous patch.
7346
7347 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7348
7349         * cs-parser.jay: fixed bug #22119.
7350
7351 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7352
7353         * attribute.cs: fixed compilation. The error was:
7354         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
7355         be assigned to before control leaves the current method."
7356         [FIXME:  Filed as bug #28186: MCS must report this error.]
7357
7358 2002-07-25  Martin Baulig  <martin@gnome.org>
7359
7360         * attribute.cs (Attribute.Conditional_GetConditionName): New static
7361         method to pull the condition name ouf of a Conditional attribute.
7362         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
7363         the obsolete message and error flag out of an Obsolete attribute.
7364
7365         * class.cs (Method.GetMethodFlags): New public method to get the
7366         TypeManager.MethodFlags for this method.
7367         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
7368         private methods.
7369         (Method.Define): Get and apply the Obsolete and Conditional attributes;
7370         if we're overriding a virtual function, set the new private variable
7371         `parent_method'; call the new TypeManager.AddMethod().
7372
7373         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
7374         the MethodBuilder and the Method in a PtrHashtable.
7375         (TypeManager.builder_to_method): Added for this purpose.
7376         (TypeManager.MethodFlags): Added IsObsoleteError.
7377         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
7378         Obsolete and Conditional arguments in MethodBuilders.  If we discover
7379         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
7380         the message from the attribute.
7381
7382 2002-07-24  Martin Baulig  <martin@gnome.org>
7383
7384         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
7385         preprocessor directives, ensure that the argument to #define/#undef is
7386         exactly one identifier and that it's actually an identifier.
7387
7388         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
7389         did not work ....
7390
7391 2002-07-24  Martin Baulig  <martin@gnome.org>
7392
7393         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
7394         initialize it to TypeManager.object_type in the constructor.
7395         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
7396         of the `hm.get_current' method if we're using the collection pattern.
7397         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
7398         for the explicit conversion to make it work when we're using the collection
7399         pattern and the `Current' property has a different return type than `object'.
7400         Fixes #27713.
7401
7402 2002-07-24  Martin Baulig  <martin@gnome.org>
7403
7404         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
7405         does not match, but don't report any errors.  This method is called in
7406         order for all methods in a MethodGroupExpr until a matching method is
7407         found, so we don't want to bail out if the first method doesn't match.
7408         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
7409         matches, report the 123.  Fixes #28070.
7410
7411 2002-07-24  Martin Baulig  <martin@gnome.org>
7412
7413         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
7414         TypeManager.TypeToCoreType() to the top of the method so the
7415         following equality checks will work.  Fixes #28107.
7416
7417 2002-07-24  Martin Baulig  <martin@gnome.org>
7418
7419         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
7420         operand is of type uint, and the other operand is of type sbyte,
7421         short or int, the operands are converted to type long." -
7422         Actually do what this comment already told us.  Fixes bug #28106,
7423         added test-150.cs.
7424
7425 2002-07-24  Martin Baulig  <martin@gnome.org>
7426
7427         * class.cs (MethodBase): New abstract class.  This is now a base
7428         class for Property, Indexer and Event to avoid some code duplication
7429         in their Define() and DefineMethods() methods.
7430         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
7431         generic methods for Define() and DefineMethods().
7432         (FieldBase): Derive from MemberBase, not MemberCore.
7433         (Property): Derive from MemberBase, not MemberCore.
7434         (Property.DefineMethod): Moved all the code from this method to the
7435         new MethodBase.DefineAccessor(), just call it with appropriate
7436         argumetnts.
7437         (Property.Define): Call the new Property.DoDefine(), this does some
7438         sanity checks and we don't need to duplicate the code everywhere.
7439         (Event): Derive from MemberBase, not MemberCore.
7440         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
7441         accessors, this will also make them work with interface events.
7442         (Indexer): Derive from MemberBase, not MemberCore.
7443         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
7444         (Indexer.Define): Use the new MethodBase functions.
7445
7446         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
7447         argument to the constructor.
7448         (Interface.FindMembers): Added support for interface events.
7449         (Interface.PopluateEvent): Implemented.
7450
7451         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
7452
7453 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
7454
7455         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
7456         but this is required to check for a method name being the same as
7457         the containing class.  
7458
7459         Handle this now.
7460
7461 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7462
7463         * interface.cs: initialize variable.
7464
7465 2002-07-23  Martin Baulig  <martin@gnome.org>
7466
7467         Implemented the IndexerName attribute in interfaces.
7468
7469         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
7470         name if this is an explicit interface implementation.
7471         (Indexer.InterfaceIndexerName): New public variable.  If we're
7472         implementing an interface indexer, this is the IndexerName in that
7473         interface.  Otherwise, it's the IndexerName.
7474         (Indexer.DefineMethod): If we're implementing interface indexer,
7475         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
7476         and Pending.ImplementIndexer methods.
7477         (Indexer.Define): Also define the PropertyBuilder if we're
7478         implementing an interface indexer and this is neither an explicit
7479         interface implementation nor do the IndexerName match the one in
7480         the interface.
7481
7482         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
7483         If a method is defined here, then we always need to create a proxy
7484         for it.  This is used when implementing interface indexers.
7485         (Pending.IsInterfaceIndexer): New public method.
7486         (Pending.ImplementIndexer): New public method.
7487         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
7488         This is used when implementing interface indexers to define a proxy
7489         if necessary.
7490         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
7491         define a proxy if necessary.
7492
7493         * interface.cs (Interface.IndexerName): New public variable.
7494         (Interface.PopulateIndexer): Set the IndexerName.
7495         (Interface.DefineIndexers): New private method.  Populate all the
7496         indexers and make sure their IndexerNames match.
7497
7498         * typemanager.cs (IndexerPropertyName): Added support for interface
7499         indexers.
7500
7501 2002-07-22  Martin Baulig  <martin@gnome.org>
7502
7503         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
7504         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
7505         ret if HasReturnLabel.
7506         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
7507         variables.
7508
7509         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
7510         and set the ec.LoopBeginTryCatchLevel.
7511         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
7512         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
7513         the current ec.TryCatchLevel, the branch goes out of an exception
7514         block.  In this case, we need to use Leave and not Br.
7515
7516 2002-07-22  Martin Baulig  <martin@gnome.org>
7517
7518         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
7519         block unless the block does not always return or it is contained in
7520         another try { ... } catch { ... } block.  Fixes bug #26506.
7521         Added verify-1.cs to the test suite.
7522
7523 2002-07-22  Martin Baulig  <martin@gnome.org>
7524
7525         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
7526         then we do not always return.  Fixes bug #24985.
7527
7528 2002-07-22  Martin Baulig  <martin@gnome.org>
7529
7530         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
7531         lookup on a per-class level; ie. walk up the class hierarchy until we
7532         found at least one applicable method, then choose the best among them.
7533         Fixes bug #24463 and test-29.cs.
7534
7535 2002-07-22  Martin Baulig  <martin@gnome.org>
7536
7537         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
7538         return types of the methods.  The return type is not part of the
7539         signature and we must not check it to make the `new' modifier work.
7540         Fixes bug #27999, also added test-147.cs.
7541         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
7542
7543         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
7544         on the method's return type.
7545
7546 2002-07-21  Martin Baulig  <martin@gnome.org>
7547
7548         * assign.cs: Make this work if the rightmost source is a constant and
7549         we need to do an implicit type conversion.  Also adding a few more tests
7550         to test-38.cs which should have caught this.
7551
7552         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
7553         target in the makefile for this.  The makefile.gnu is primarily intended
7554         for end-users who don't want to debug the compiler.
7555
7556 2002-07-21  Martin Baulig  <martin@gnome.org>
7557
7558         * assign.cs: Improved the Assign class so it can now handle embedded
7559         assignments (X = Y = Z = something).  As a side-effect this'll now also
7560         consume less local variables.  test-38.cs now passes with MCS, added
7561         a few new test cases to that test.
7562
7563 2002-07-20  Martin Baulig  <martin@gnome.org>
7564
7565         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
7566         instructions.  Fixes bug #27977, also added test-146.cs.
7567
7568 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7569
7570         * cs-tokenizer.cs: fixed getHex ().
7571
7572 2002-07-19  Martin Baulig  <martin@gnome.org>
7573
7574         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
7575         not Type.GetType() to lookup the array type.  This is needed when
7576         we're constructing an array of a user-defined type.
7577         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
7578         single-dimensional arrays, but also for single-dimensial arrays of
7579         type decimal.
7580
7581 2002-07-19  Martin Baulig  <martin@gnome.org>
7582
7583         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
7584         this function is called, it's not allowed to share LocalBuilders
7585         among ILGenerators.
7586
7587 2002-07-19  Martin Baulig  <martin@gnome.org>
7588
7589         * expression.cs (Argument.Resolve): Report an error 118 when trying
7590         to pass a type as argument.
7591
7592 2002-07-18  Martin Baulig  <martin@gnome.org>
7593
7594         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
7595         Conv_R_Un for the signed `long' type.
7596
7597 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
7598
7599         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
7600         `expr' for the temporary result, as that will fail if we do
7601         multiple resolves on the same expression.
7602
7603 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
7604
7605         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
7606         ec.TypeContainer for looking up aliases. 
7607
7608         * class.cs (TypeContainer): Remove LookupAlias from here.
7609
7610         * decl.cs (DeclSpace); Move here.
7611
7612 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
7613
7614         * class.cs (FindMembers): Only call filter if the constructor
7615         bulider is not null.
7616
7617         Also handle delegates in `NestedTypes' now.  Now we will perform
7618         type lookups using the standard resolution process.  This also
7619         fixes a bug.
7620
7621         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
7622         This uses Expressions (the limited kind that can be parsed by the
7623         tree) instead of strings.
7624
7625         * expression.cs (ComposedCast.ToString): Implement, used to flag
7626         errors since now we have to render expressions.
7627
7628         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
7629         FormArrayType. 
7630
7631         * ecore.cs (SimpleName.ToString): ditto.
7632
7633         * cs-parser.jay: Instead of using strings to assemble types, use
7634         Expressions to assemble the type (using SimpleName, ComposedCast,
7635         MemberAccess).  This should fix the type lookups in declarations,
7636         because we were using a different code path for this.
7637
7638         * statement.cs (Block.Resolve): Continue processing statements
7639         even when there is an error.
7640
7641 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
7642
7643         * class.cs (Event.Define): Also remove the `remove' method from
7644         the list of pending items.
7645
7646         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
7647         generate more compact code. 
7648
7649 2002-07-17  Martin Baulig  <martin@gnome.org>
7650
7651         * const.cs (Const.LookupConstantValue): Add support for constant
7652         `unchecked' and `checked' expressions.
7653         Also adding test case test-140.cs for this.
7654
7655 2002-07-17  Martin Baulig  <martin@gnome.org>
7656
7657         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
7658         check whether mi.ReturnType implements the IEnumerator interface; the
7659         `==' and the IsAssignableFrom() will fail in this situation.
7660
7661 2002-07-16  Ravi Pratap  <ravi@ximian.com>
7662
7663         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
7664         here too.
7665
7666 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7667
7668         * expression.cs: fixed bug #27811.
7669
7670 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
7671
7672         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
7673         Molaro: when we are a ref, the value already contains a pointer
7674         value, do not take the address of it.
7675
7676 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7677         * removed mb-parser.jay and mb-tokenizer.cs
7678
7679 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7680
7681         * expression.cs: check against the building corlib void type.
7682
7683 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
7684
7685         * ecore.cs: fix for valuetype static readonly fields: when 
7686         initializing them, we need their address, not the address of a copy.
7687
7688 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
7689
7690         * typemanager.cs: register also enum_type in corlib.
7691
7692 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7693
7694         * class.cs: allow calling this (but not base) initializers in structs.
7695
7696 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
7697
7698         * ecore.cs: make sure we compare against the building base types
7699         in GetTypeSize ().
7700
7701 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
7702
7703         * typemanager.cs: fix TypeToCoreType() to handle void and object
7704         (corlib gets no more typerefs after this change).
7705
7706 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
7707
7708         * expression.cs (ArrayCreation.EmitArrayArguments): use
7709         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
7710
7711         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
7712         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
7713         array indexes, the runtime actually forbids them.
7714
7715         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
7716         for array arguments here.
7717
7718         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
7719         instead of the default for ValueTypes.
7720
7721         (New.DoEmit): Use IsValueType instead of
7722         IsSubclassOf (value_type)
7723         (New.DoResolve): ditto.
7724         (Invocation.EmitCall): ditto.
7725
7726         * assign.cs (Assign): ditto.
7727
7728         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
7729         Statements *are* currently doing part of their resolution during
7730         Emit.  
7731
7732         Expressions do always resolve during resolve, but statements are
7733         only required to propagate resolution to their children.
7734
7735 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
7736
7737         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
7738
7739         (LoadAssembly): Do not add the dll if it is already specified
7740
7741         (MainDriver): Add the System directory to the link path at the end,
7742         after all the other -L arguments. 
7743
7744         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
7745         wrong opcode for loading bytes and bools (ldelem.i1 instead of
7746         ldelem.u1) and using the opposite for sbytes.
7747
7748         This fixes Digger, and we can finally run it.
7749
7750         * driver.cs (UnixParseOption): Move the option parsing here.  
7751         (CSCParseOption): Implement CSC-like parsing of options.
7752
7753         We now support both modes of operation, the old Unix way, and the
7754         new CSC-like way.  This should help those who wanted to make cross
7755         platform makefiles.
7756
7757         The only thing broken is that /r:, /reference: and /lib: are not
7758         implemented, because I want to make those have the same semantics
7759         as the CSC compiler has, and kill once and for all the confussion
7760         around this.   Will be doing this tomorrow.
7761
7762         * statement.cs (Unsafe.Resolve): The state is checked during
7763         resolve, not emit, so we have to set the flags for IsUnsfe here.
7764
7765 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
7766
7767         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
7768         not catch the Error_ObjectRefRequired in SimpleName (as it is
7769         possible to have a class/instance variable name that later gets
7770         deambiguated), we have to check this here.      
7771
7772 2002-07-10  Ravi Pratap  <ravi@ximian.com>
7773
7774         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
7775         make static and put into Expression.
7776
7777         (Event.Define): Register the private field of the event with the 
7778         TypeManager so that GetFieldFromEvent can get at it.
7779
7780         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
7781         keep track of the private field associated with an event which
7782         has no accessors.
7783
7784         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
7785         private field.
7786
7787         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
7788
7789 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
7790
7791         * expression.cs (Binary.EmitBranchable): this routine emits the
7792         Binary expression in a branchable context.  This basically means:
7793         we need to branch somewhere, not just get the value on the stack.
7794
7795         This works together with Statement.EmitBoolExpression.
7796
7797         * statement.cs (Statement.EmitBoolExpression): Use
7798         EmitBranchable. 
7799
7800 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
7801
7802         * statement.cs (For): Reduce the number of jumps in loops.
7803
7804         (For): Implement loop inversion for the For statement.
7805
7806         (Break): We can be breaking out of a Try/Catch controlled section
7807         (foreach might have an implicit try/catch clause), so we need to
7808         use Leave instead of Br.
7809
7810         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
7811         now).  If the instace expression supports IMemoryLocation, we use
7812         the AddressOf method from the IMemoryLocation to extract the
7813         address instead of emitting the instance.
7814
7815         This showed up with `This', as we were emitting the instance
7816         always (Emit) instead of the Address of This.  Particularly
7817         interesting when This is a value type, as we dont want the Emit
7818         effect (which was to load the object).
7819
7820 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
7821
7822         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
7823
7824         * statement.cs (Checked): Set the CheckedState during the resolve
7825         process too, as the ConvCast operations track the checked state on
7826         the resolve process, and not emit.
7827
7828         * cs-parser.jay (namespace_member_declaration): Flag that we have
7829         found a declaration when we do.  This is used to flag error 1529
7830
7831         * driver.cs: Report ok when we display the help only.
7832
7833 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
7834
7835         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
7836
7837 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
7838
7839         * cs-tokenizer.cs (define): We also have to track locally the
7840         defines.  AllDefines is just used for the Conditional Attribute,
7841         but we also need the local defines for the current source code. 
7842
7843 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
7844
7845         * statement.cs (While, For, Do): These loops can exit through a
7846         Break statement, use this information to tell whether the
7847         statement is the last piece of code.
7848
7849         (Break): Flag that we break.
7850
7851         * codegen.cs (EmitContexts): New `Breaks' state variable.
7852
7853 2002-07-03  Martin Baulig  <martin@gnome.org>
7854
7855         * class.cs (TypeContainer.MethodModifiersValid): Allow override
7856         modifiers in method declarations in structs.  Otherwise, you won't
7857         be able to override things like Object.Equals().
7858
7859 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
7860
7861         * class.cs (Method, Property, Indexer): Do not allow the public
7862         modifier to be used in explicit interface implementations.
7863
7864         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
7865         override modifiers in method declarations in structs
7866
7867 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
7868
7869         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
7870         integer or real overflow, report an error
7871
7872 2002-07-02  Martin Baulig  <martin@gnome.org>
7873
7874         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
7875         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
7876         to tell the runtime about our newly created System.Object and
7877         System.ValueType types.
7878
7879 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
7880
7881         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
7882         struct instead of Ldarg/Starg.
7883
7884 2002-07-02  Martin Baulig  <martin@gnome.org>
7885
7886         * expression.cs (Indirection.Indirection): Call
7887         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
7888
7889 2002-07-02  Martin Baulig  <martin@gnome.org>
7890
7891         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
7892         ValueType, call TypeManager.TypeToCoreType() on it.
7893         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
7894         the OpCodes.Newarr argument.
7895
7896 2002-07-02  Martin Baulig  <martin@gnome.org>
7897
7898         * expression.cs (Invocation.EmitCall): When compiling corlib,
7899         replace all calls to the system's System.Array type to calls to
7900         the newly created one.
7901
7902         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
7903         System.Array methods.
7904         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
7905         from the system's System.Array type which must be replaced.
7906
7907 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
7908
7909         * typemanager.cs: load unverifiable_code_ctor so we can build
7910         corlib using the correct type. Avoid using GetTypeCode() with
7911         TypeBuilders.
7912         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
7913         TypeManager.object_type to allow building corlib.
7914
7915 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
7916
7917         * ecore.cs: handle System.Enum separately in LoadFromPtr().
7918
7919 2002-07-01  Martin Baulig  <martin@gnome.org>
7920
7921         * class.cs: Make the last change actually work, we need to check
7922         whether `ifaces != null' to avoid a crash.
7923
7924 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7925
7926         * class.cs: when we build structs without fields that implement
7927         interfaces, we need to add the interfaces separately, since there is
7928         no API to both set the size and add the interfaces at type creation
7929         time.
7930
7931 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7932
7933         * expression.cs: the dimension arguments to the array constructors
7934         need to be converted if they are a long.
7935
7936 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
7937
7938         * class.cs: don't emit ldarg.0 if there is no parent constructor
7939         (fixes showstopper for corlib).
7940
7941 2002-06-29  Martin Baulig  <martin@gnome.org>
7942
7943         MCS now compiles corlib on GNU/Linux :-)
7944
7945         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
7946         ie. check for MethodImplOptions.InternalCall.
7947
7948         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
7949         and TypeManager.attribute_type are null, so we must explicitly check
7950         whether parent is not null to find out whether it's an attribute type.
7951         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
7952         and SetBuilder, not only if the property is neither abstract nor external.
7953         This is necessary to set the MethodImplOptions on the accessor methods.
7954         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
7955         SetBuilder, see Property.Emit().
7956
7957         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
7958         populate "System.Object", "System.ValueType" and "System.Attribute" since
7959         they've already been populated from BootCorlib_PopulateCoreTypes().
7960
7961 2002-06-29  Martin Baulig  <martin@gnome.org>
7962
7963         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
7964         is the NullLiteral, we also need to make sure that target_type is not
7965         an enum type.   
7966
7967 2002-06-29  Martin Baulig  <martin@gnome.org>
7968
7969         * rootcontext.cs (RootContext.ResolveCore): We must initialize
7970         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
7971         before calling BootstrapCorlib_ResolveDelegate ().
7972
7973 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7974
7975         * statement.cs: fixed build-breaker. All tests passed ok.
7976
7977 2002-06-27  Martin Baulig  <martin@gnome.org>
7978
7979         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
7980         for System.Decimal when compiling corlib.
7981
7982 2002-06-27  Martin Baulig  <martin@gnome.org>
7983
7984         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
7985         switch blocks which contain nothing but a default clause.
7986
7987 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
7988
7989        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
7990
7991 2002-06-27  Martin Baulig  <martin@gnome.org>
7992
7993         * ecore.cs (PropertyExpr.PropertyExpr): Call
7994         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
7995
7996         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
7997         is already a TypeBuilder.
7998
7999 2002-06-27  Martin Baulig  <martin@gnome.org>
8000
8001         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
8002         `target_type == TypeManager.array_type', not IsAssignableFrom() in
8003         the "from an array-type to System.Array" case.  This makes it work
8004         when compiling corlib.
8005
8006 2002-06-27  Martin Baulig  <martin@gnome.org>
8007
8008         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
8009         non-static PropertyExpr, set its InstanceExpression.  This makes
8010         the `ICollection.Count' property work in System/Array.cs.
8011
8012 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
8013
8014         * driver.cs: Made error handling more consistent.  Errors now
8015         tracked by Report class, so many methods which used to return int
8016         now return void.  Main() now prints success/failure and 
8017         errors/warnings message.
8018
8019         Renamed '--probe' compiler argument to '--expect-error'.  Removed
8020         the magic number return values (123 and 124).  Now, if the
8021         expected error occurs, the compiler exits with success (exit value
8022         0).  If the compilation completes without seeing that particular
8023         error, the compiler exits with failure (exit value 1).  The
8024         makefile in mcs/errors has been changed to handle the new behaviour.
8025
8026         * report.cs: Made 'expected error' number a property and renamed
8027         it from 'Probe' to 'ExpectedError'.
8028
8029         * genericparser.cs: Removed error handling support, since it is
8030         now all done by Report class.
8031
8032         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
8033         class, so parse() no longer returns an int.
8034
8035         * namespace.cs: Use Report.Error instead of GenericParser.error
8036
8037 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
8038
8039         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
8040         TypeContainer.AddOperator): At the front of the list put the
8041         explicit implementations, so they get resolved/defined first. 
8042
8043 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
8044
8045         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
8046         interface type is implemented by this TypeContainer.  Used during
8047         explicit interface implementation.
8048
8049         (Property.Define, Indexer.Define, Method.Define): Validate that
8050         the given interface in the explicit implementation is one of the
8051         base classes for the containing type.
8052
8053         Also if we are explicitly implementing an interface, but there is
8054         no match in the pending implementation table, report an error.
8055
8056         (Property.Define): Only define the property if we are
8057         not explicitly implementing a property from an interface.  Use the
8058         correct name also for those properties (the same CSC uses,
8059         although that is really not needed).
8060
8061         (Property.Emit): Do not emit attributes for explicitly implemented
8062         properties, as there is no TypeBuilder.
8063
8064         (Indexer.Emit): ditto.
8065
8066         Hiding then means that we do not really *implement* a pending
8067         implementation, which makes code fail.
8068
8069 2002-06-22  Martin Baulig  <martin@gnome.org>
8070
8071         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
8072         the return value of Object.GetType().  [FIXME: we need to do this whenever
8073         we get a type back from the reflection library].
8074
8075 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
8076
8077         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
8078
8079 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
8080
8081         * attribute.cs: Return null if we can not look up the type.
8082
8083         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
8084         the interface types found.
8085
8086         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
8087         interface types found.
8088
8089         * typemanager.cs (GetInterfaces): Make this routine returns alll
8090         the interfaces and work around the lame differences between
8091         System.Type and System.Reflection.Emit.TypeBuilder in the results
8092         result for GetInterfaces.
8093
8094         (ExpandInterfaces): Given an array of interface types, expand and
8095         eliminate repeated ocurrences of an interface.  This expands in
8096         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
8097         be IA, IB, IC.
8098
8099 2002-06-21  Martin Baulig  <martin@gnome.org>
8100
8101         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
8102         on System.Enum.
8103
8104 2002-06-21  Martin Baulig  <martin@gnome.org>
8105
8106         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
8107         and called with one of the core types, return the corresponding typebuilder for
8108         that type.
8109
8110         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
8111         element type.
8112
8113 2002-06-21  Martin Baulig  <martin@gnome.org>
8114
8115         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
8116         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
8117         (Expression.ConvertReferenceExplicit): Likewise.
8118
8119         * expression.cs (ElementAccess.DoResolve): Likewise.
8120         (ElementAccess.DoResolveLValue): Likewise.
8121
8122 2002-06-10  Martin Baulig  <martin@gnome.org>
8123
8124         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
8125         add the "value" parameter to the parameter list.
8126
8127         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
8128         to our caller.
8129
8130 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
8131
8132         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
8133         the argument to an int, uint, long or ulong, per the spec.  Also
8134         catch negative constants in array creation.
8135
8136 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
8137
8138         * class.cs: do not allow the same interface to appear twice in
8139         the definition list.
8140
8141 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
8142
8143         * ecore.cs: don't use ldlen with System.Array.
8144
8145 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
8146
8147         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
8148
8149 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
8150
8151         * modifiers.cs: produce correct field attributes for protected
8152         internal. Easy fix so miguel can work on ther harder stuff:-)
8153
8154 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
8155
8156         * pending.cs: New file.  Move the code from class.cs here.
8157         Support clearning the pending flag for all methods (when not doing
8158         explicit interface implementation).
8159
8160 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
8161
8162         * rootcontext.cs: added a couple more types needed to bootstrap.
8163
8164 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
8165
8166         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
8167         constructor in the type, instead of any constructor in the type
8168         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
8169         a bug in the Mono runtime when applying the params attribute). 
8170
8171 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
8172         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
8173
8174 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
8175
8176         * expression.cs (Unary.ResolveOperator): Use TypeManager
8177         to resolve the type.
8178
8179 2002-06-13  Ravi Pratap  <ravi@ximian.com>
8180
8181         * cs-parser.jay (enum_member_declaration): Pass in the attributes
8182         attached.
8183
8184         * enum.cs (AddEnumMember): Add support to store the attributes associated 
8185         with each member too.
8186
8187         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
8188         field builders too - this takes care of the enum member case.
8189
8190 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
8191
8192         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
8193         address-of operator on both value types and pointers.
8194
8195 2002-06-10  Martin Baulig  <martin@gnome.org>
8196
8197         * interface.cs (Interface.PopulateIndexer): Add the indexer's
8198         PropertyBuilder to the `property_builders' list.
8199
8200         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
8201         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
8202         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
8203         find any indexers which are inherited from an interface.
8204
8205 2002-06-09  Martin Baulig  <martin@gnome.org>
8206
8207         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
8208         the same type as the constant if necessary.  There's also a test-130.cs
8209         for this.
8210
8211         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
8212
8213         * typemanager.cs (TypeManager.ChangeType): Previously known as
8214         Enum.ChangeEnumType().
8215
8216 2002-06-09  Martin Baulig  <martin@gnome.org>
8217
8218         * expression.cs (Cast.TryReduce): Added support for consts.
8219
8220 2002-06-08  Ravi Pratap  <ravi@ximian.com>
8221
8222         * class.cs (Accessor): Hold attributes information so we can pass
8223         it along.
8224
8225         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
8226         Modify to pass in attributes attached to the methods.
8227
8228         (add_accessor_declaration, remove_accessor_declaration): Ditto.
8229
8230         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
8231         to handle the Accessor kind :-)
8232
8233         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
8234
8235 2002-06-08  Martin Baulig  <martin@gnome.org>
8236
8237         * expression.cs (Unary.TryReduceNegative): Added support for
8238         ULongConstants.
8239
8240 2002-06-08  Martin Baulig  <martin@gnome.org>
8241
8242         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
8243         name can't be found in the `defined_names' - the caller will do a
8244         MemberLookup in this case and thus find methods in System.Enum
8245         such as Enum.IsDefined().
8246
8247 2002-06-08  Martin Baulig  <martin@gnome.org>
8248
8249         * enum.cs (Enum.ChangeEnumType): This is a custom version of
8250         Convert.ChangeType() which works with TypeBuilder created types.
8251         (Enum.LookupEnumValue, Enum.Define): Use it here.
8252
8253         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
8254         `TypeBuilder.BaseType != null' check.
8255         (TypeContainer.FindMembers): Only lookup parent members if we
8256         actually have a parent.
8257         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
8258         (ConstructorInitializer.Resolve): Likewise.
8259
8260         * interface.cs (Interface.FindMembers): Added
8261         `TypeBuilder.BaseType != null' check.
8262
8263         * rootcontext.cs (RootContext.ResolveCore): Added
8264         "System.Runtime.CompilerServices.IndexerNameAttribute" to
8265         classes_second_stage.
8266
8267         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
8268         debug_type and trace_type when compiling with --nostdlib.       
8269
8270 2002-06-07  Martin Baulig  <martin@gnome.org>
8271
8272         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
8273         (AddField): Set it to true when adding a non-static field.
8274         (DefineType): Use `have_nonstatic_fields' to find out whether we
8275         have non-static fields, not `Fields != null'.
8276
8277 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
8278
8279         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
8280         dereferencing a null on the static-field code path)
8281
8282 2002-05-30  Martin Baulig  <martin@gnome.org>
8283
8284         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
8285         to take command line arguments.  Use reflection to call the new
8286         custom `Initialize' function on the symbol writer and pass it the
8287         command line arguments.
8288
8289         * driver.cs (--debug-args): New command line argument to pass command
8290         line arguments to the symbol writer.
8291
8292 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
8293
8294         * assign.cs (DoResolve): Forgot to do the implicit conversion to
8295         the target type for indexers and properties.  Thanks to Joe for
8296         catching this.
8297
8298 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
8299
8300         * typemanager.cs (MethodFlags): returns the method flags
8301         (Obsolete/ShouldIgnore) that control warning emission and whether
8302         the invocation should be made, or ignored. 
8303
8304         * expression.cs (Invocation.Emit): Remove previous hack, we should
8305         not do this on matching a base type, we should do this based on an attribute
8306
8307         Only emit calls to System.Diagnostics.Debug and
8308         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
8309         on the command line.
8310
8311         * rootcontext.cs: Global settings for tracing and debugging.
8312
8313         * cs-tokenizer.cs (define): New utility function to track
8314         defines.   Set the global settings for TRACE and DEBUG if found.
8315
8316 2002-05-25  Ravi Pratap  <ravi@ximian.com>
8317
8318         * interface.cs (Populate*): Pass in the TypeContainer as well as
8319         the DeclSpace as parameters so that we can create EmitContexts and
8320         then use that to apply attributes etc.
8321
8322         (PopulateMethod, PopulateEvent, PopulateProperty)
8323         (PopulateIndexer): Apply attributes everywhere.
8324
8325         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
8326         etc.
8327
8328         (ApplyAttributes): Update accordingly.
8329
8330         We now apply interface attributes for all members too.
8331
8332 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
8333
8334         * class.cs (Indexer.Define); Correctly check if we are explicit
8335         implementation (instead of checking the Name for a ".", we
8336         directly look up if the InterfaceType was specified).
8337
8338         Delay the creation of the PropertyBuilder.
8339
8340         Only create the PropertyBuilder if we are not an explicit
8341         interface implementation.   This means that explicit interface
8342         implementation members do not participate in regular function
8343         lookups, and hence fixes another major ambiguity problem in
8344         overload resolution (that was the visible effect).
8345
8346         (DefineMethod): Return whether we are doing an interface
8347         implementation. 
8348
8349         * typemanager.cs: Temporary hack until we get attributes in
8350         interfaces (Ravi is working on that) and we get IndexerName
8351         support in interfaces.
8352
8353         * interface.cs: Register the indexers as properties.
8354
8355         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
8356         warning, I have verified that this is a bug in the .NET runtime
8357         (JavaScript suffers of the same problem).
8358
8359         * typemanager.cs (MemberLookup): When looking up members for
8360         interfaces, the parent of an interface is the implicit
8361         System.Object (so we succeed in searches of Object methods in an
8362         interface method invocation.  Example:  IEnumerable x;  x.ToString
8363         ()) 
8364
8365 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
8366
8367         * class.cs (Event): Events should also register if they do
8368         implement the methods that an interface requires.
8369
8370         * typemanager.cs (MemberLookup); use the new GetInterfaces
8371         method. 
8372
8373         (GetInterfaces): The code used to lookup interfaces for a type is
8374         used in more than one place, factor it here. 
8375
8376         * driver.cs: Track the errors at the bottom of the file, we kept
8377         on going.
8378
8379         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
8380         instance if the method we are calling is static!
8381
8382 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
8383
8384         * attribute.cs (ApplyAttributes): Make this function filter out
8385         the IndexerName attribute (as that attribute in reality is never
8386         applied) and return the string constant for the IndexerName
8387         attribute. 
8388
8389         * class.cs (TypeContainer.Emit): Validate that all the indexers
8390         have the same IndexerName attribute, and if so, set the
8391         DefaultName attribute on the class. 
8392
8393         * typemanager.cs: The return value might contain other stuff (not
8394         only methods).  For instance, consider a method with an "Item"
8395         property and an Item method.
8396
8397         * class.cs: If there is a problem with the parameter types,
8398         return. 
8399
8400 2002-05-24  Ravi Pratap  <ravi@ximian.com>
8401
8402         * ecore.cs (ImplicitConversionExists): Wrapper function which also
8403         looks at user defined conversion after making a call to 
8404         StandardConversionExists - we need this for overload resolution.
8405
8406         * expression.cs : Update accordingly the various method calls.
8407
8408         This fixes 2 bugs filed against implicit user defined conversions 
8409
8410 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
8411
8412         * statement.cs: Track the result of the assignment.
8413
8414 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
8415
8416         * expression.cs (MemberAccess): Improved error reporting for
8417         inaccessible members.
8418
8419 2002-05-22  Martin Baulig  <martin@gnome.org>
8420
8421         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
8422         itself with debugging support.
8423
8424 2002-05-22  Martin Baulig  <martin@gnome.org>
8425
8426         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
8427         Removed, this isn't needed anymore.
8428
8429 2002-05-20  Martin Baulig  <martin@gnome.org>
8430
8431         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
8432         be underlying type for an enum.
8433
8434 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
8435
8436         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
8437         that splits out the loading of just the core types.
8438
8439         * rootcontext.cs (ResolveCore): Split the struct resolution in
8440         two, so we can load the enumeration underlying types before any
8441         enums are used.
8442
8443         * expression.cs (Is): Bandaid until we fix properly Switch (see
8444         bug #24985 for details).
8445
8446         * typemanager.cs (ImplementsInterface): The hashtable will contain
8447         a null if there are no interfaces implemented.
8448
8449 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
8450
8451         * cs-parser.jay (indexer_declarator): It is fine to have array
8452         parameters
8453
8454 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
8455
8456         * typemanager.cs: (RegisterBuilder): New function used to register
8457         TypeBuilders that implement interfaces.  Since
8458         TypeBuilder.GetInterfaces (as usual) does not work with lame
8459         Reflection.Emit. 
8460         (AddUserType): register interfaces.
8461
8462         (ImplementsInterface): Use the builder_to_ifaces hash if we are
8463         dealing with TypeBuilder.  Also, arrays are showing up as
8464         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
8465         methods can not be invoked on them!
8466
8467         * ecore.cs (ExplicitReferenceConversionExists): Made public.
8468         (ImplicitReferenceConversionExists): Split out from
8469         StandardConversionExists. 
8470
8471         * expression.cs (As): We were only implementing one of the three
8472         cases for the as operator.  We now implement them all.
8473         (Is): Implement the various other cases for Is as well.
8474
8475         * typemanager.cs (CACHE): New define used to control if we want or
8476         not the FindMembers cache.  Seems to have a negative impact on
8477         performance currently
8478
8479         (MemberLookup): Nested types have full acess to
8480         enclosing type members
8481
8482         Remove code that coped with instance/static returns for events, we
8483         now catch this in RealFindMembers.
8484
8485         (RealFindMembers): only perform static lookup if the instance
8486         lookup did not return a type or an event.  
8487
8488 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
8489
8490         * assign.cs (CompoundAssign): We pass more semantic information
8491         now to Compound Assignments than we did before: now we have all
8492         the information at hand, and now we resolve the target *before* we
8493         do the expression expansion, which allows the "CacheValue" method
8494         to have the effect we intended (before, a [x] += 1 would generate
8495         two differen ArrayAccess expressions from the ElementAccess,
8496         during the resolution process).
8497
8498         (CompoundAssign.DoResolve): Resolve target and original_source here.
8499
8500 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
8501
8502         * expression.cs (ArrayAccess): dropped debugging information. 
8503
8504         * typemanager.cs: Small bug fix: I was always returning i_members,
8505         instead of one of i_members or s_members (depending on which had
8506         the content).
8507
8508         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
8509         method is invoked before any code generation takes place, and it
8510         is a mechanism to inform that the expression will be invoked more
8511         than once, and that the method should use temporary values to
8512         avoid having side effects
8513
8514         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
8515
8516         * ecore.cs (Expression.CacheTemporaries): Provide empty default
8517         implementation.
8518
8519         * expression.cs (Indirection, ArrayAccess): Add support for
8520         CacheTemporaries in these two bad boys. 
8521
8522         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
8523         ldobj or ldind_ref.  
8524         (StoreFromPtr): Handle stobj as well.
8525
8526         * expression.cs (UnaryMutator): Share more code.
8527
8528         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
8529         down: I was not tracking the Filter function as well, which
8530         was affecting the results of the cache.
8531
8532 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
8533
8534         * attribute.cs: Remove the hack to handle the CharSet property on
8535         StructLayouts. 
8536
8537 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
8538
8539         * attribute.cs (DoResolve): More uglyness, we now only try to
8540         resolve the attribute partially, to extract the CharSet
8541         information (only if we are a StructLayout attribute).  Otherwise 
8542
8543         (GetExtraTypeInfo): Add some code to conditionally kill in the
8544         future this.   I am more and more convinced that the .NET
8545         framework has special code to handle the attribute setting on
8546         certain elements.
8547
8548         * expression.cs (IsParamsMethodApplicable): Revert my previous
8549         foreach change here, it was wrong.
8550
8551 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
8552
8553         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
8554         (pp_expr): do not abort on unknown input, just return.
8555         (eval): abort if there are pending chars.
8556
8557         * attribute.cs (Attribute.Resolve): Positional parameters are
8558         optional.  Deal with that case.
8559
8560         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
8561         the Ansi/Unicode/Auto information for the type.
8562
8563         (TypeContainer.DefineType): instantiate the EmitContext here, as
8564         we will be using it during the type definition (to resolve
8565         attributes) and during the emit phase.
8566
8567         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
8568         to pull type information out of the attributes
8569
8570         (Attribute.Resolve): track the constructor builder, and allow for
8571         multiple invocations (structs and classes will use this).
8572
8573         * ecore.cs (MemberLookupFinal): new version with all the
8574         parameters customizable.
8575
8576         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
8577         constructors.  Return if the result value is null (as the error
8578         would have been flagged already by MemberLookupFinal)
8579
8580         Do not allow instances of abstract classes or interfaces to be
8581         created.
8582
8583         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
8584         We have to compare the assembly property here when dealing with
8585         FamANDAssem and Assembly access modifiers, because we might be
8586         creating an assembly from *modules* (that means that we are not
8587         getting TypeBuilders for types defined in other modules that are
8588         part of this assembly).
8589
8590         (Method.Emit): If the method is marked abstract and has a body,
8591         emit an error. 
8592
8593         (TypeContainer.DefineMembers): If both the defined member and the
8594         parent name match are methods, then do not emit any warnings: let
8595         the Method.Define routine take care of flagging warnings.  But if
8596         there is a mismatch (method overrides something else, or method is
8597         overriwritten by something, then emit warning).
8598
8599         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
8600         set to null, this means `do not check for the return type on the
8601         signature'. 
8602
8603         (Method.Define): set the return type for the method signature to
8604         null, so that we get methods with the same name and parameters and
8605         different return types.  This is used to flag warning 114 (you are
8606         hiding a method, and you probably want to use the new/override
8607         keywords instead).
8608
8609         * typemanager.cs (MemberLookup): Implemented proper access
8610         control, closing a long standing set of bug reports.  The problem
8611         was that the Framework only has two bits: Public and NonPublic,
8612         and NonPublic includes private and protected methods, but we need
8613         to enforce the FamANDAssem, FamOrAssem and Family. 
8614
8615 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
8616
8617         * statement.cs (GotoCase): Return true: Ammounts to giving up
8618         knowledge on whether we return or not, and letting the other case
8619         be responsible for it.
8620
8621 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
8622
8623         * driver.cs: Do not load directories for each file processed, only
8624         do it if there is a pattern.
8625
8626         * ecore.cs: Report readonly assigns here as well, as we might have
8627         been resolved only by MemberAccess.
8628
8629         (SimpleName.SimpleNameResolve): Also be useful for LValue
8630         resolution.   We need this to propagate assign to local readonly variables
8631
8632         * typemanager.cs: Use a ptrhashtable for the criteria, because we
8633         do not want to reuse potential criteria memory.
8634
8635         * class.cs (MyEventBuilder): Set reflected_type;
8636
8637         * ecore.cs (Constantify): Added support for constifying bools.
8638
8639         (RootContext.LookupType): Added a cache for values looked up in
8640         the declaration space.
8641
8642         * typemanager.cs (FindMembers): Now is a front-end to
8643         RealFindMembers, and provides a two-level hashtable-based cache to
8644         the request.  
8645
8646         15% performance improvement: from 22.5 to 19.2 seconds.
8647
8648         * expression.cs (IsParamsMethodApplicable): use foreach.
8649         (Invocation.DoResolve): ditto.
8650         (New.DoResolve): ditto.
8651         (ArrayCreation.DoResolve): ditto.
8652
8653         * ecore.cs (FindMostEncompassingType): use foreach.
8654
8655         * delegate.cs (NewDelegate.DoResolve): Use foreach
8656
8657         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
8658         (RemoveMethods): use foreach.
8659
8660         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
8661         nested foreach statements instead of for, and also break out of
8662         the inner loop once a match is found.
8663
8664         (Invocation.OverloadResolve): Use foreach, simplify the code. 
8665
8666 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
8667
8668         * cfold.cs (BinaryFold): During an enumeration evaluation context,
8669         we actually unwrap the expression to allow for extra information
8670         to be extracted. 
8671
8672         * expression.cs: Use Shr_Un on unsigned operations. 
8673
8674 2002-05-08  Ravi Pratap  <ravi@ximian.com>
8675
8676         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
8677         applicable operators was not being considered correctly. This closes
8678         the bug Miguel reported.
8679
8680 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
8681
8682         * attribute.cs: check that the type derives from System.Attribute
8683         and report the correct error in that case (moved the duplicate code to
8684         its own method, too).
8685
8686 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
8687
8688         * attribute.cs: lookup attribute type name as the spec says: first the
8689         bare attribute name and then name + "Attribute" (nant compiles with
8690         mcs after this fix).
8691
8692 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
8693
8694         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
8695         Because of the way we parse things, we should try to see if a
8696         UIntConstant can fit in an integer.
8697
8698 2002-05-07  Ravi Pratap  <ravi@ximian.com>
8699
8700         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
8701         when we are in an explicit context.
8702
8703         (ConvertReferenceExplicit): When converting from Iface type S to Class
8704         T make sure the rules are implemented as an OR.
8705
8706         * parameter.cs (ParameterType): Make it a property for now although the
8707         purpose really isn't anything immediate.
8708
8709         * expression.cs (Is*Applicable): Do better checking on the parameter type
8710         of a ref/out parameter. The ones from the system assemblies are already 
8711         marked with the correct type so we don't need to do any correction.
8712
8713         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
8714         the object type is standard too so include that.
8715
8716 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8717
8718         * ecore.cs (StandardConversionExists): Augment with missing code:
8719         deal with IntConstant, LongConstants and Enumerations.
8720
8721         * assign.cs: Report the error, instead of failing silently
8722
8723         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
8724         typecontainer that they are declared, because the
8725         typecontainer/namespace will have the list of using clauses that
8726         need to be applied.
8727
8728         Assembly Attributes were escaping the normal registration
8729         mechanism. 
8730
8731         (EmitCode): Apply attributes within an EmitContext that represents
8732         the container they were declared on.
8733
8734         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
8735
8736 2002-05-06  Ravi Pratap  <ravi@ximian.com>
8737
8738         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
8739         Revamp completely - make much cleaner as we now operate only
8740         on a set of Types.
8741
8742         (FindMostSpecificSource, FindMostSpecificTarget): New methods
8743         to implement the logic detailed in the spec more correctly.
8744
8745         (UserDefinedConversion): Update accordingly.
8746
8747 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8748
8749         * statement.cs: Return flow analysis information up.
8750
8751         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
8752         and the default.
8753
8754         (token): Do not consume an extra character before calling
8755         decimal_digits.
8756
8757 2002-05-06  Piers Haken <piersh@friskit.com>
8758
8759         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
8760
8761 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8762
8763         * class.cs (Constructor.Emit): Set the IsStatic flag in the
8764         EmitContext during the instance constructor initializer
8765         resolution, to stop access to instance variables.
8766
8767         This is mandated by the spec, last paragraph of the `constructor
8768         initializers' section. 
8769
8770 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
8771
8772         * cs-parser.jay, class.cs (Accessor): new class used to represent
8773         an accessor (get or set).  In the past we used `null' to represent
8774         a missing accessor.  But this is ambiguous because there was no
8775         way to tell in abstract indexers/properties if one of them was
8776         specified.
8777
8778         Now there is a way of addressing that.
8779
8780         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
8781         instead of FindMembers.
8782
8783         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
8784         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
8785
8786         * attribute.cs: Treat indexers and properties as the same in terms
8787         of applying attributes
8788
8789         * ecore.cs (FindMostEncompassedType): Use statically initialized
8790         EmptyExpressions()s like we do elsewhere to avoid creating useless
8791         objects (and we take this out of the tight loop).
8792
8793         (GetConversionOperators): Move the code to extract the actual
8794         operators to a separate routine to clean things up.
8795
8796 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
8797
8798         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
8799         events are always registered FieldBuilders.
8800
8801         * class.cs (FieldBase): New class shared by Fields 
8802
8803         * delegate.cs: If we are a toplevel delegate, use our full name.
8804         If we are a nested delegate, then only use our tail name.
8805
8806 2002-05-02  Ravi Pratap  <ravi@ximian.com>
8807
8808         * expression.cs (IsApplicable): Ensure that we add the "&" to
8809         ref/out types before comparing it with the type of the argument.
8810
8811         (IsParamsMethodApplicable): Ditto.
8812
8813         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
8814         silly me ;-)
8815
8816         * delegate.cs : Handle the case when we have more than one applicable
8817         method. Flag an error only when we finish checking all.
8818
8819 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
8820
8821         * expression.cs: Add support for boolean static initializers.
8822
8823 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
8824
8825         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
8826
8827         * parameter.cs (ComputeParameterTypes,
8828         ComputeAndDefineParameterTypes): Better error handling: now we
8829         clear the `types' cache if we fail during any of the type lookups.
8830         We also return the status code correctly to our caller
8831
8832         * delegate.cs: If we fail to define a delegate, abort the extra
8833         steps. 
8834
8835         * expression.cs (Binary.ResolveOperator): for
8836         operator==(object,object) and operator !=(object, object) we also
8837         have to verify that there is an implicit conversion from one to
8838         the other.
8839
8840         (ArrayAccess.DoResolve): Array Access can operate on
8841         non-variables. 
8842
8843 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
8844
8845         * assign.cs (CompoundAssign): A new class used as a "flag" that
8846         the assignment actually is happening as part of a compound
8847         assignment operator.
8848
8849         During compound assignment, a few new rules exist to enable things
8850         like:
8851
8852         byte b |= 1 + 2
8853
8854         From the spec:
8855
8856         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
8857         to the type of x) if y is implicitly convertible to the type of x,
8858         and the operator is a builtin operator and the return type of the
8859         operator is explicitly convertible to the type of x. 
8860
8861         * rootcontext.cs: Reset warning level to 2.  4 catches various
8862         "interesting" features in mcs, we must clean this up at some
8863         point, but currently am trying to kill other bugs ;-)
8864
8865         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
8866         in container classes as well.  
8867
8868         * expression.cs (Binary.ResolveOperator): Handle string case
8869         before anything else (as operator overloading does emit an error
8870         before doing anything else).
8871
8872         This code could go away when we move to a table driven model, but
8873         i could not come up with a good plan last night.
8874
8875 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
8876
8877         * typemanager.cs (CSharpName): reimplementation using regex.
8878         * class.cs: added null check for fields in Emit
8879         * rootcontext.cs: set warninglevel to 4
8880
8881 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
8882
8883         * typemanager.cs (CSharpName): reimplemented with Lupus
8884         suggestion.
8885
8886 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
8887
8888         * statement.cs (If): correclty implement Resolve, because we were
8889         not catching sem errors in there.  The same process is needed
8890         everywhere else. 
8891         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
8892
8893
8894         (Statement.Warning_DeadCodeFound): Factorize code.
8895         (While): Report dead code here too.
8896
8897         (Statement): Added Resolve virtual method to allow
8898         for resolution split from the emit code.
8899
8900 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
8901
8902         * statement.cs (EmitBoolExpression): No longer try to resolve the
8903         expression here.    
8904         (MakeBoolean): New utility function that resolve, implicitly
8905         converts to boolean and tags the expression. 
8906
8907
8908         (If, Do): Implement dead code elimination.
8909         (While): Implement loop inversion
8910
8911         (Do, While, For, If): Resolve the expression prior to calling our
8912         code generation.
8913
8914 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
8915
8916         * class.cs:
8917           - added method Report28 (warning: program has more than one entry point)
8918           - added method IsEntryPoint, implements paragraph 10.1 of the spec
8919           - modified method Method.Define, the part at the end of the method
8920
8921         * rootcontext.cs: added static public Location EntryPointLocation;
8922           
8923         * ../errors/cs0028.cs : Add test case for the above warning.              
8924
8925         * typemanager.cs:
8926           - modified method CSharpName to allow arrays of primitive type to
8927             be printed nicely (e.g. instead of System.Int32[][] it now prints
8928             int[][])
8929           - added method CSharpSignature: returns the signature of a method
8930             in string format to be used in reporting errors, warnings, etc.
8931
8932         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
8933         with String.Empty.
8934
8935 2002-04-26  Ravi Pratap  <ravi@ximian.com>
8936
8937         * delegate.cs (Define): Fix extremely silly bug where I was
8938         setting the type of the 'object' parameter of the BeginInvoke
8939         method to System.IAsyncResult instead of System.Object ;-)
8940
8941 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
8942
8943         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
8944         here. 
8945
8946         (Constructor.Emit): return if we fail to initialize the
8947         constructor.  Another door closed!  
8948
8949         * expression.cs (New.DoResolve): Improve error message (from -6 to
8950         1501).  Use DeclaredOnly lookup to find the exact constructor.
8951
8952         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
8953         loop.  This is useful.
8954
8955         * cs-parser.jay: Adjust the default parameters so that destructors
8956         have the proper signature.
8957
8958 2002-04-26  Martin Baulig  <martin@gnome.org>
8959
8960         * driver.cs (LoadAssembly): If `assembly' contains any characters
8961         which are only valid in path names and not in assembly names
8962         (currently slash, backslash and point), use Assembly.LoadFrom ()
8963         instead of Assembly.Load () on the `assembly' (before iteration
8964         over the link_paths).
8965
8966 2002-04-26  Martin Baulig  <martin@gnome.org>
8967
8968         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
8969
8970 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
8971
8972         * class.cs (Property): use the new typemanager.MemberLookup
8973
8974         (TypeContainer.MemberLookup): Implement using the
8975         TypeManager.MemberLookup now. 
8976
8977         * typemanager.cs: Make MemberLookup a function of the TypeManager,
8978         and return MemberInfos, so that these can be used without an
8979         EmitContext (what we had before).
8980
8981 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
8982
8983         * expression.cs: Fix the case where the argument to params if the
8984         type of the params.  I omitted handling this before.   Fixed
8985
8986 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
8987
8988         * driver.cs: Call BootCorlib_PopulateCoreType
8989
8990         * class.cs (Property.CheckBase): Check for properties only, not
8991         for all members. 
8992
8993         * interface.cs: Temporary hack: try/catch around the
8994         CustomAttributeBuilder, because I am getting an exception that I
8995         do not understand.
8996
8997         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
8998         types whose definitions are required to be there (attributes are
8999         defined before standard types).
9000
9001         Compute definitions as we boot the various types, as they are used
9002         immediately (value_type class will need object_type, but if we do
9003         not initialize object_type, we will pass a null, which will let
9004         the runtime pick the System.Object from the existing corlib, which
9005         is not what we want).
9006
9007 2002-04-22  Patrik Torstensson <totte@labs2.com>
9008
9009         * cs-tokenizer.cs: fixed a number of trim() issues.
9010
9011 2002-04-22  Ravi Pratap  <ravi@ximian.com>
9012
9013         * expression.cs (Argument.Type): Ensure that we return the correct
9014         type when we have out or ref parameters [in which case we 
9015         append a "&"].
9016
9017 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
9018
9019         * class.cs (Property, Indexer): Allow extern modifier in there. 
9020
9021         * typemanager.cs (InitBaseTypes): Initializes object_type and
9022         value_type, since those will be used early on during the bootstrap
9023         process to compile corlib.
9024
9025         (InitCoreTypes): Move code from here to InitBaseTypes.
9026
9027 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
9028
9029         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
9030         single-dimension arrays as using the ldlen opcode.  
9031
9032         Daniel Lewis discovered this optimization.  
9033
9034         * typemanager.cs: Add signature for System.Array::get_Length
9035
9036 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
9037
9038         * statement.cs: report the error when the foreach does not apply to an
9039         array nor a collection.
9040
9041 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
9042
9043         * expression.cs: Add implicit conversions to the operator ~.
9044
9045         * constant.cs (DecimalConstant.Emit): Emit decimal value.
9046
9047         * typemanager.cs: Locate the decimal constructor.
9048
9049 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
9050
9051         * attribute.cs: use the new property of TypeOf.
9052         * expression.cs: added 'get' property around typearg.
9053
9054         These changes fix a build breaker reported by NickD. Is this the
9055         correct way to fix?  If not, please, revert my changes and make it
9056         work :-).
9057
9058 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
9059
9060         * attribute.cs: Add support for typeof in attribute invocations.
9061         I am not sure that this is right though.
9062
9063 2002-04-14  Duncan Mak  <duncan@ximian.com>
9064
9065         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
9066         Binary.Operator.Division case.
9067
9068 2002-04-13  Ravi Pratap  <ravi@ximian.com>
9069
9070         * class.cs (DefineType): Ensure that we do a proper check on
9071         attribute types and also register it with the TypeManager.
9072
9073         (TypeContainer.Targets): The default for attribute types is
9074         AttributeTargets.All.
9075
9076         * attribute.cs (ApplyAttributes): Registering the attribute type
9077         is done elsewhere, not when we discover we have a Usage attribute.
9078
9079 2002-04-12  Ravi Pratap  <ravi@ximian.com>
9080
9081         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
9082         and get rid of is_delegate parameter.
9083
9084         * everywhere : update.
9085
9086 2002-04-12  Ravi Pratap  <ravi@ximian.com>
9087
9088         * cs-parser.jay (compilation_unit): Revamp completely to use
9089         some new ideas that I got from Rhys' grammar to solve the problems
9090         with assembly level attributes.
9091
9092         (outer_declaration): New grammar production.
9093
9094         (attribute_sections): Add.
9095
9096         (opt_attributes): Base on attribute_sections
9097
9098         (namespace_declaration): Allow opt_attributes to tackle the case
9099         when we have assembly level attributes - we are clever in this
9100         regard now ;-)
9101
9102         * attribute.cs (ApplyAttributes): Do not worry about assembly 
9103         attributes in the non-global context.
9104
9105         * rootcontext.cs (AddGlobalAttributes): Go back to using this
9106         instead of SetGlobalAttributes.
9107
9108         * class.cs, rootcontext.cs : Ensure we define and generate 
9109         attribute types before anything else.
9110
9111         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
9112         and flag the new error -20 for the case when the attribute type
9113         does not have valid targets specified. csc does not catch this.
9114
9115         * ../errors/errors.txt : update for error # -20
9116
9117 2002-04-11  Ravi Pratap  <ravi@ximian.com>
9118
9119         * support.cs (InternalParameters.ParameterModifier): Do some null
9120         checking and return sane values.
9121
9122         * class.cs (Method.Define): If we are a PInvoke method, ensure
9123         that we are static and extern. Report error # 601
9124
9125         * ../errors/cs0601.cs : Add test case for the above error.
9126
9127 2002-04-07  Ravi Pratap  <ravi@ximian.com>
9128
9129         * rootcontext.cs (attribute_types): We need to keep type of
9130         all attribute types separately and emit code for them first.
9131
9132         (RegisterAttribute) : Implement.
9133
9134         * class.cs (DefineType): Check if the current Type is a custom
9135         attribute type and register it accordingly.
9136
9137         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
9138         adding the first attribute twice and rename to
9139
9140         (SetGlobalAttributes): this.
9141
9142         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
9143         lookups.
9144
9145         * attribute.cs (ApplyAttributes): Take an additional argument telling us
9146         if we are processing global arguments. Hmm, I am unsure of this.
9147
9148 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
9149
9150         * expression.cs: added static array of strings to avoid calling
9151         Enum.ToString () for Operator in Binary. Significant recover of
9152         performance.
9153
9154 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
9155
9156         * class.cs (FindMembers): Allow the Builders of the various
9157         members to be null.  If they are skip them.  This only happens
9158         during the PInvoke declaration.
9159
9160 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
9161
9162         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
9163         failure, so we do not keep going afterwards.
9164
9165         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
9166         wanted to pass `false' as the `is_delegate' argument.  If this is
9167         the case, why not use delegate_type == null to mean `is_delegate =
9168         false' and anything else as is_delegate = true.
9169
9170 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
9171
9172         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
9173         code for the section, not the beginning of the tests.
9174
9175 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
9176
9177         * cfold.cs: Handle operator + (Enum x, Underlying x) 
9178
9179         * expression.cs (Binary): same.  Warn about errors where we have
9180         Enum/Enum in operator + as well.
9181
9182 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
9183
9184         * statement.cs:
9185                 - added support for switch(bool)
9186                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
9187                 - add TableSwitchEmit() to handle table-based switch statements
9188
9189 2002-04-05  Ravi Pratap  <ravi@ximian.com>
9190
9191         * expression.cs (Invocation.OverloadResolve): Factor out code which
9192         does parameter compatibility checking with arguments so that we can 
9193         re-use the code even from Delegate.VerifyApplicability
9194
9195         (VerifyArgumentsCompat): Move above code here.
9196
9197         * delegate.cs (VerifyApplicability): Get rid of duplicate code
9198         and instead make a call to the above method.
9199
9200 2002-03-31  Ravi Pratap  <ravi@ximian.com>
9201
9202         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
9203         We use it to keep track of classes which are attribute types.
9204
9205 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
9206
9207         * delegate.cs (Delegate.Define): Correctly define the types in the
9208         presence of fixed and array parameters.
9209
9210         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
9211         doing FindMembers.
9212
9213         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
9214         include NonPublic after the first iteration.
9215
9216         * class.cs (Indexer.CheckBase): Only check if both parents are
9217         non-null. 
9218
9219         * cs-parser.jay (accessor_body): If empty, set to null.
9220
9221         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
9222         same code path here to resolve constants names that we did have in
9223         MemberAccess.DoResolve.  There is too much code duplicated here.
9224
9225 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
9226
9227         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
9228
9229         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
9230         to MakeUnionSet.
9231
9232         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
9233         tokens, numbers and strings.
9234
9235         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
9236         parenthesis.
9237
9238         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
9239         asyncronous parameters and the regular parameters.  
9240
9241         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
9242         specify the target directory.
9243
9244         * expression.cs: (This.DoResolve): Simplify
9245         (As.Emit): Optimize, do not generate IsInst if the expression is
9246         always of the given type.
9247
9248         (Is.DoResolve): Bug fix, we were reporting both always/never for
9249         the is expression.
9250
9251         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
9252         creating too many unnecessary arrays.
9253
9254 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
9255
9256         * class.cs (EmitFieldInitializer): Use Assign expression to assign
9257         fields instead of rolling our own initializer.   Takes care of all
9258         implicit conversions, and drops unnecessary static checks/argument.
9259
9260 2002-03-31  Dick Porter  <dick@ximian.com>
9261
9262         * driver.cs: use the GetDirectories() return values properly, and
9263         use "/" as path separator.
9264
9265 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
9266
9267         * expression.cs (Unary): Optimize - - expr into expr.
9268         (Binary): Optimize a + (-b) into a -b.
9269
9270         * codegen.cs (CodeGen): Made all methods static.
9271
9272 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
9273
9274         * rootcontext.cs: 
9275
9276         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
9277         TypeBuilder property.
9278
9279         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
9280         instead. 
9281
9282         * tree.cs: Removed the various RecordXXXX, and replaced with a
9283         single RecordDecl.  Removed all the accessor methods, and just
9284         left a single access point Type 
9285
9286         * enum.cs: Rename DefineEnum to DefineType.
9287
9288         * decl.cs: New abstract method `DefineType' used to unify the
9289         Defines for Enumerations, Interfaces, TypeContainers and
9290         Delegates.
9291
9292         (FindType): Moved LookupInterfaceOrClass here.  Moved the
9293         LookupBaseClasses method that used to live in class.cs and
9294         interface.cs here, and renamed to FindType.
9295
9296         * delegate.cs: Implement DefineType.  Take advantage of the
9297         refactored pattern for locating the parent builder without taking
9298         the parent_builder argument (which we know does not work if we are
9299         nested, and triggering a toplevel definition).
9300
9301 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
9302
9303         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
9304         accessibility of a member has changed during override and report
9305         an error if so.
9306
9307         * class.cs (Method.Define, Property.Define): Only complain on
9308         overrides if the method is private, any other accessibility is
9309         fine (and since we just checked the permission is the same, we are
9310         good to go).
9311
9312         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
9313         and elif are processed always.  The other pre-processing
9314         directives are only processed if we are "taking" the path
9315
9316 2002-03-29  Martin Baulig  <martin@gnome.org>
9317
9318         * class.cs (Method.Emit): Only emit symbolic debugging info if the
9319         current location is not Null.
9320
9321         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
9322         a separate method so we can profile it.
9323
9324         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
9325         `span.Seconds' are just seconds, but no minutes or hours.
9326         (MainDriver): Profile the CodeGen.SaveSymbols calls.
9327
9328 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
9329
9330         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
9331         Remove the gratuitous set of Final:
9332
9333                                 // If an interface implementation, then we can set Final.
9334                                 if (((flags & MethodAttributes.Abstract) == 0) &&
9335                                     implementing.DeclaringType.IsInterface)
9336                                         flags |= MethodAttributes.Final;
9337
9338         I do not know what I was smoking when I used that.
9339
9340
9341         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
9342         step into fixing the name resolution issues for delegates and
9343         unifying the toplevel name resolution.
9344
9345 2002-03-28  Martin Baulig  <martin@gnome.org>
9346
9347         * class.cs (Method.Emit): If we have a symbol writer, call its
9348         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
9349         tell it about the current method.
9350
9351         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
9352         writer that we're going to emit the first byte of IL code for a new
9353         statement (a new source line).
9354         (EmitContext.EmitTopBlock): If we have a symbol writer, call
9355         EmitContext.Mark() before emitting any code.
9356
9357         * location.cs (SymbolDocument): Return null when we're Null.
9358
9359         * statement.cs (Statement): Moved the `Location loc' variable here.
9360         (Statement.EmitBoolExpression): If we have a symbol writer, call
9361         ec.Mark() before emitting any code to tell it that we're at the
9362         beginning of a new statement.
9363         (StatementExpression): Added `Location' argument to the constructor.
9364         (Block): Added public readonly variable `StartLocation' and public
9365         variable `EndLocation'.  The latter is to be set using SetEndLocation().
9366         (Block): Added constructor which takes a start and end location.
9367         (Block.SetEndLocation): New method. This sets the end location.
9368         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
9369         local variables we create.
9370         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
9371         each statement and do also mark the begin and end of the block.
9372
9373         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
9374         tell it the current lexer.Location, use Location.Null for the end of the
9375         block.
9376         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
9377         current block, set its end location using SetEndLocation().
9378         (statement_expression): StatementExpression constructor now takes the
9379         lexer.Location as additional argument.
9380         (for_statement, declare_local_variables): Likewise.
9381         (declare_local_variables): When creating a new implicit block, use the
9382         new Block constructor and pass it the lexer.Location.
9383
9384 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
9385
9386         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
9387         members also on the parent interfaces recursively.
9388
9389 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
9390
9391         * report.cs: Use new formats, since Gonzalo finished the missing
9392         bits. 
9393
9394         * expression.cs (Binary.ResolveOperator): added missing operator|
9395         operator& and operator^ for bool/bool.
9396
9397         * cs-parser.jay: CheckDef now takes a Location argument that is
9398         used to report errors more precisly (instead of reporting the end
9399         of a definition, we try to track something which is a lot closer
9400         to the source of the problem).
9401
9402         * cs-tokenizer.cs: Track global token use, so we can properly flag
9403         the use of #define/#undef after the first token has been seen.
9404
9405         Also, rename the reportXXXX to Error_DescriptiveName
9406
9407         * decl.cs (DeclSpace.IsTopLevel): Move property here from
9408         TypeContainer, so that Enum and Interface can use this too.
9409
9410         * class.cs (TypeContainer.LookupInterfaceOrClass,
9411         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
9412         `builder' argument.  Typically this was used to pass the parent
9413         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
9414         the definition).  
9415
9416         The problem is that a nested class could trigger the definition of
9417         a toplevel class, and the builder would be obviously wrong in that
9418         case. 
9419
9420         So we drop this argument, and we compute dynamically the
9421         TypeBuilder/ModuleBuilder (the correct information was available
9422         to us anyways from DeclSpace.Parent)
9423
9424         * interface.cs (Interface.DefineInterface): Drop builder
9425         parameter cleanup like class.cs
9426
9427         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
9428         like class.cs
9429
9430         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
9431         values. 
9432
9433         (Try.Emit): Propagate the returns value from the statement.
9434
9435         (Return.Emit): Even if we are leavning 
9436
9437         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
9438
9439         * modifiers.cs: Fix the computation of MethodAttributes flags.
9440
9441 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
9442
9443         * driver.cs: allow compilation of files that start with '/'.
9444         Add a default case when checking the argument of --target.
9445
9446 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
9447
9448         * interface.cs: Implement the same search algorithm for types in
9449         the interface code.
9450
9451         * delegate.cs: Do not allow multiple definition.
9452
9453         * Recovered ChangeLog that got accidentally amputated
9454
9455         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
9456
9457         * rootcontext.cs: Load manually enum to allow core classes to
9458         contain enumerations.
9459
9460         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
9461         Update to new static methods in TypeManager.
9462
9463         * typemanager.cs (GetMethod, GetConstructor): Use our
9464         implementation of FindMembers to find the members, since during
9465         corlib compilation, the types are TypeBuilders and GetMethod and
9466         GetConstructor do not work.
9467
9468         Make all methods in TypeManager static.
9469
9470         (InitCodeHelpers): Split the functionality from
9471         the InitCodeTypes function.
9472
9473         * driver.cs: Call InitCodeHelpers after we have populated the
9474         types. 
9475
9476         * cs-parser.jay (delegate_declaration): we did not used to compute
9477         the delegate name correctly for void delegates.
9478
9479 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
9480
9481         * rootcontext.cs (RootContext): Init the interface_resolve_order
9482         and type_container_resolve_order always.
9483
9484         (ResolveCore, BootstrapCorlib_ResolveClass,
9485         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
9486         compiler when compiling with --nostdlib
9487
9488         * class.cs (TypeContainer.DefineType): Check that our parent is
9489         not null.  This test is most important when we are bootstraping
9490         the core types.
9491
9492         * codegen.cs: Split out the symbol writing code.
9493
9494 2002-03-25  Martin Baulig  <martin@gnome.org>
9495
9496         * driver.cs (-g): Made -g an alias for --debug.
9497
9498 2002-03-24  Martin Baulig  <martin@gnome.org>
9499
9500         * codegen.cs (SymbolWriter): New public variable. Returns the
9501         current symbol writer.
9502         (CodeGen): Added `bool want_debugging_support' argument to the
9503          constructor. If true, tell the ModuleBuild that we want debugging
9504         support and ask it for the ISymbolWriter.
9505         (Save): If we have a symbol writer, call it's Close() method after
9506         saving the assembly.
9507
9508         * driver.c (--debug): New command line argument to create a
9509         debugger information file.
9510
9511         * location.cs (SymbolDocument): New public property. Returns an
9512         ISymbolDocumentWriter object for the current source file or null
9513         if we don't have a symbol writer.
9514
9515 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
9516
9517         * driver.cs (LoadAssembly): Correctly return when all the paths
9518         have been tried and not before.
9519
9520         * statement.cs (Switch.Emit): return the actual coverage for this
9521         statement (returns/not-returns)
9522
9523         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
9524         switch of the statement if we are the last switch section.  That
9525         kills two problems: try/catch problems (we used to emit an empty
9526         nop at the end) and switch statements where all branches would
9527         return. 
9528
9529 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
9530
9531         * driver.cs: Add default assemblies (the equivalent to the
9532         Microsoft CSC.RSP file)
9533
9534         * cs-tokenizer.cs: When updating `cols and setting it to zero,
9535         also update tokens_seen and set it to false.
9536
9537         * driver.cs: Implement --recurse for Mike.
9538
9539         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
9540         correctly splitting out the paths.
9541
9542 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
9543
9544         * interface.cs (Interface.PopulateProperty): Instead of using
9545         `parent' as the declaration space for the set parameters, use
9546         `this' 
9547
9548         * support.cs (InternalParameters): InternalParameters constructor
9549         takes a DeclSpace instead of a TypeContainer.
9550
9551         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
9552         types are being initialized, load the address of it before calling
9553         the function.  
9554
9555         (New): Provide a mechanism to disable the generation of local
9556         value type temporaries when the caller will be providing us with
9557         an address to store it.
9558
9559         (ArrayCreation.EmitDynamicInitializers): Use it.
9560
9561 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
9562
9563         * expression.cs (Invocation.EmitArguments): Only probe for array
9564         property if there is more than one argument.  Sorry about that.
9565
9566         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
9567         empty param arrays.
9568
9569         * class.cs (Method.LabelParameters): Fix incorrect code path that
9570         prevented the `ParamArrayAttribute' from being applied to the
9571         params attribute.
9572
9573 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
9574
9575         * support.cs (ReflectionParameters): Correctly compute whether the
9576         last argument is a params array.  Fixes the problem with
9577         string.Split ('a')
9578
9579         * typemanager.cs: Make the assemblies array always be non-null
9580         (empty, but non-null)
9581
9582         * tree.cs (RecordDecl): New function that abstracts the recording
9583         of names.  This reports error 101, and provides a pointer to the
9584         previous declaration.  Fixes a crash in the compiler.
9585
9586         * cs-parser.jay (constructor_declaration): Update to new grammar,
9587         and provide a constructor_body that can be empty.
9588
9589 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
9590
9591         * driver.cs: Add support for --resources.
9592
9593         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
9594         Make all types for the various array helper methods be integer.
9595
9596         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
9597         CheckState to ConvCast.
9598
9599         (ConvCast): Now it takes a `checked' state argument, to avoid
9600         depending on the emit context for the conversion, and just using
9601         the resolve time setting.
9602
9603         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
9604         instead of Invocation.EmitArguments.  We do not emit the original
9605         arguments, instead we emit those which have been converted to
9606         unsigned int expressions.
9607
9608         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
9609
9610         * codegen.cs: ditto.
9611
9612         * expression.cs (LocalVariableReference): Drop the use of the
9613         Store function that depended on the variable index.
9614
9615         * statement.cs (VariableInfo): Drop the `Idx' property from this
9616         class, as this is not taking into account the indexes for
9617         temporaries tat we generate during the execution, getting the
9618         indexes wrong.
9619
9620         * class.cs: First emit class initializers, then call the parent
9621         constructor. 
9622
9623         * expression.cs (Binary): Fix opcode emision.
9624         (UnaryMutator.EmitCode): Support checked code generation
9625
9626         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
9627         matches for events for both the Static and Instance scans,
9628         pointing to the same element.   Fix that.
9629
9630 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
9631
9632         * rootcontext.cs (ResolveTree): Always set the
9633         interface_resolve_order, because nested interfaces will be calling
9634         into us.
9635
9636         * class.cs (GetInterfaceOrClass): Track the same resolution
9637         process used by TypeManager.LookupType.  This fixes the nested
9638         type lookups in class declarations (separate path from
9639         LookupType). 
9640
9641         (TypeContainer.DefineType): Also define nested interfaces.
9642         (TypeContainer.RegisterOrder): New public function used to
9643         register the order in which child interfaces need to be closed.
9644
9645         Nested interfaces need to be closed after their parents have been
9646         created. 
9647
9648         * interface.cs (InterfaceAttr): Put all the logic for computing
9649         the interface attribute here. 
9650
9651         (DefineInterface): Register our interface order with the
9652         RootContext or with the TypeContainer depending on the case.
9653
9654 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
9655
9656         * cs-parser.jay: rework foreach statement to work with the new
9657         changes to the policy on SimpleNames.
9658
9659         * report.cs: support Stacktrace on warnings as well.
9660
9661         * makefile: drop --unsafe and /unsafe from the compile.
9662
9663 2002-03-13  Ravi Pratap  <ravi@ximian.com>
9664
9665         * ecore.cs (StandardConversionExists): Modify to take an Expression
9666         as the first parameter. Ensure we do null -> reference type conversion
9667         checking.
9668
9669         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
9670         temporary Expression objects.
9671
9672 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
9673
9674         * interface.cs: workaround bug in method overloading resolution
9675         (there is already a bugzilla bug for it).
9676
9677 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
9678
9679         We could also solve this problem by having a separate path for
9680         performing type lookups, instead of DoResolve, we could have a
9681         ResolveType entry point, and only participating pieces of the
9682         production (simplename, deref, array) would implement this. 
9683
9684         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
9685         signal SimpleName to only resolve type names and not attempt to
9686         resolve anything else.
9687
9688         * expression.cs (Cast): Set the flag.
9689
9690         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
9691
9692         * class.cs: Only report 108 if there is no `new' modifier.
9693
9694         * cs-parser.jay: rework foreach statement to work with the new
9695         changes to the policy on SimpleNames.
9696
9697         * report.cs: support Stacktrace on warnings as well.
9698
9699         * makefile: drop --unsafe and /unsafe from the compile.
9700
9701 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
9702
9703         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9704         lookups here, instead of doing that at parse time.  This means
9705         that our grammar will not introduce `LocalVariableReferences' as
9706         expressions at this point.  That solves the problem of code like
9707         this:
9708
9709         class X {
9710            static void Main ()
9711            { int X = 1;
9712             { X x = null }}}
9713
9714         This is only half the fix.  The full fix requires parameters to
9715         also be handled in this way.
9716
9717         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
9718         makes the use more obvious of the DeclSpace.  The
9719         ec.TypeContainer.TypeBuilder is now only used to pull the
9720         TypeBuilder for it.
9721
9722         My theory is that I can get rid of the TypeBuilder completely from
9723         the EmitContext, and have typecasts where it is used (from
9724         DeclSpace to where it matters).  
9725
9726         The only pending problem is that the code that implements Aliases
9727         is on TypeContainer, and probably should go in DeclSpace.
9728
9729         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9730         lookups here, instead of doing that at parse time.  This means
9731         that our grammar will not introduce `LocalVariableReferences' as
9732         expressions at this point.  That solves the problem of code like
9733         this:
9734
9735         class X {
9736            static void Main ()
9737            { int X = 1;
9738             { X x = null }}}
9739
9740         This is only half the fix.  The full fix requires parameters to
9741         also be handled in this way.
9742
9743         * class.cs (Property.DefineMethod): When implementing an interface
9744         method, set newslot, when implementing an abstract method, do not
9745         set the flag (before we tried never setting it, or always setting
9746         it, which is the difference).
9747         (Indexer.DefineMethod): same.
9748         (Method.DefineMethod): same.
9749
9750         * ecore.cs: Only set the status used flag if we get back a Field.
9751
9752         * attribute.cs: Temporary hack, so Paolo can keep working.
9753
9754 2002-03-08  Ravi Pratap  <ravi@ximian.com>
9755
9756         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
9757         the unmanaged type in the case we have a MarshalAs attribute.
9758
9759         (Resolve): Handle the case when we are parsing the special MarshalAs
9760         attribute [we need to store the unmanaged type to use later]
9761
9762         * typemanager.cs (marshal_as_attr_type): Built in type for the 
9763         MarshalAs Attribute.
9764
9765         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
9766         on parameters and accordingly set the marshalling info.
9767
9768 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
9769
9770         * class.cs: Optimizing slightly by removing redundant code after
9771         we switched to the `NoTypes' return value.
9772         (Property.DefineMethod): use NoTypes here too.
9773
9774         This fixes the bug I introduced in my last batch of changes.
9775
9776 2002-03-05  Ravi Pratap  <ravi@ximian.com>
9777
9778         * tree.cs (RecordEnum): Add. We now keep track of enums too.
9779
9780         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
9781         Enums since those are types too. 
9782
9783         * cs-parser.jay (enum_declaration): Record enums as we parse them.
9784
9785         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
9786         thanks to a call during the lookup process.
9787
9788 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
9789
9790         * statement.cs (Foreach): Lots of work to accomodate a particular
9791         kind of foreach statement that I had not kept in mind.  It is
9792         possible to have foreachs on classes that provide a GetEnumerator
9793         method that return objects that implement the "pattern" for using
9794         a foreach, there is no need to support GetEnumerator
9795         specifically. 
9796
9797         This is needed to compile nant.
9798
9799         * decl.cs: Only report 114 if the member is not `Finalize' and if
9800         the warning level is at least 2.
9801
9802         * class.cs: Moved the compare function from Method to
9803         MethodSignature. 
9804
9805         (MethodSignature.InheritableMemberSignatureCompare): Add new
9806         filter function that is used to extract inheritable methods from a
9807         class. 
9808
9809         (Method.Define): Use the new `inheritable_method_signature_filter'
9810         delegate
9811
9812         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
9813         command. 
9814
9815 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
9816
9817         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
9818
9819         * cs-parser.jay: Add opt_semicolon to the interface declaration.
9820
9821         * expression.cs: Pass location information to
9822         ConvertImplicitStandard. 
9823
9824         * class.cs: Added debugging code to track return values from
9825         interfaces. 
9826
9827 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
9828
9829         * expression.cs (Is.DoResolve): If either side of the `is' is an
9830         interface, do not flag the warning.
9831
9832         * ecore.cs (ImplicitReferenceConversion): We need a separate test
9833         for interfaces
9834
9835         * report.cs: Allow for --fatal to be used with --probe.
9836
9837         * typemanager.cs (NoTypes): Move the definition for the empty Type
9838         array here. 
9839
9840         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
9841         properties. 
9842         (TypeContainer.DefineProxy): New function used to proxy to parent
9843         implementations when implementing interfaces.
9844         (TypeContainer.ParentImplements): used to lookup if our parent
9845         implements a public function that is required by an interface.
9846         (TypeContainer.VerifyPendingMethods): Hook this up.
9847
9848         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
9849         `modules' and `assemblies' arraylists into arrays.  We only grow
9850         these are the very early start up of the program, so this improves
9851         the speedof LookupType (nicely measured).
9852
9853         * expression.cs (MakeByteBlob): Replaced unsafe code with
9854         BitConverter, as suggested by Paolo.
9855
9856         * cfold.cs (ConstantFold.Binary): Special case: perform constant
9857         folding of string concatenation, but if either side is a string,
9858         and the other is not, then return null, and let the runtime use
9859         the concatenation on the string plus the object (using
9860         `Object.ToString'). 
9861
9862 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
9863
9864         Constant Folding has been implemented now.
9865
9866         * expression.cs (Unary.Reduce): Do not throw an exception, catch
9867         the error instead on types that are not supported in one's
9868         complement. 
9869
9870         * constant.cs (Constant and all children): New set of functions to
9871         perform implict and explicit conversions.
9872
9873         * ecore.cs (EnumConstant): Implement the new functions to perform
9874         conversion by proxying to the child expression.
9875
9876         * codegen.cs: (ConstantCheckState): Constant evaluation has its
9877         own separate setting that can not be turned off from the command
9878         line using --unchecked or --checked and is only controlled using
9879         the checked/unchecked statements and expressions.  This setting is
9880         used by the constant folder to flag errors.
9881
9882         * expression.cs (CheckedExpr, UncheckedExpr): Set the
9883         ConstantCheckState as well.   
9884
9885         During Resolve, they also have to flag the state, because the
9886         constant folder runs completely in the Resolve phase.
9887
9888         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
9889         well.
9890
9891 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
9892
9893         * cfold.cs: New file, this file contains the constant folder.
9894
9895         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
9896         argument to track whether we are using the resulting address to
9897         load or store a value and provide better error messages. 
9898
9899         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
9900         new AddressOf arguments.
9901
9902         * statement.cs (Foreach.EmitCollectionForeach): Update
9903
9904         * expression.cs (Argument.Emit): Call AddressOf with proper
9905         arguments to track usage.
9906
9907         (New.DoEmit): Call AddressOf with new arguments.
9908
9909         (Unary.Emit): Adjust AddressOf call.
9910
9911 2002-03-01  Ravi Pratap  <ravi@ximian.com>
9912
9913         * cs-parser.jay (member_access): Change the case for pre-defined types
9914         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
9915         this suggestion.
9916
9917         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
9918         a method body.
9919
9920         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
9921         essentially like methods and apply attributes like MethodImplOptions to them too.
9922
9923         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
9924         not being null.
9925
9926         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
9927         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
9928         is the DeclSpace.
9929
9930         * Update code everywhere accordingly.
9931
9932         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
9933
9934         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
9935
9936 2002-02-28  Ravi Pratap  <ravi@ximian.com>
9937
9938         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
9939         try performing lookups against those instead of jumping straight into using
9940         the 'using' clauses.
9941
9942         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
9943
9944         (LookupType): Perform lookups in implicit parents too.
9945
9946         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
9947         sequence as RootContext.LookupType. 
9948
9949         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
9950         the various cases of namespace lookups into this method.
9951
9952 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
9953
9954         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
9955         in positional arguments)
9956
9957         * class.cs (Operator): Update the AllowedModifiers to contain
9958         extern. 
9959
9960         * cs-parser.jay: Update operator declaration to allow for the
9961         operator body to be empty.
9962
9963         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
9964         values. 
9965
9966 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
9967
9968         * class.cs (Method.Emit): Label parameters.
9969
9970         * driver.cs: Return 1 or 0 as the program exit code.
9971
9972 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
9973
9974         * expression.cs: Special case the `null' object when trying to
9975         auto-compute the type, as anything can be explicitly converted to
9976         that. 
9977
9978         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
9979         spotting this Paolo.
9980
9981         (Expression.ImplicitNumericConversion): Perform comparissions of
9982         the type using the underlying type in the case of an enumeration
9983         rather than using the enumeration type for the compare.
9984
9985         Cope with the underlying == type case, which is not possible to
9986         catch before. 
9987
9988         (Expression.ConvertNumericExplicit): Perform comparissions of
9989         the type using the underlying type in the case of an enumeration
9990         rather than using the enumeration type for the compare.
9991
9992         * driver.cs: If the user does not supply an extension, assume .exe
9993
9994         * cs-parser.jay (if_statement): Rewrote so that we can track the
9995         location for the if statement.
9996
9997         * expression.cs (Binary.ConstantFold): Only concat strings when
9998         the operation is "+", not everything ;-)
9999
10000         * statement.cs (Statement.EmitBoolExpression): Take a location
10001         argument. 
10002         (If, While, Do): Track location.
10003
10004         * expression.cs (Binary.ResolveOperator): In the object + string
10005         case, I was missing a call to ConvertImplicit
10006
10007 2002-02-25  Ravi Pratap  <ravi@ximian.com>
10008
10009         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
10010         Location arguments. Ensure we use RootContext.LookupType to do our work
10011         and not try to do a direct Type.GetType and ModuleBuilder.GetType
10012
10013         * interface.cs (PopulateMethod): Handle the type of the parameter being
10014         null gracefully.
10015
10016         * expression.cs (Invocation.BetterFunction): Handle the case when we 
10017         have a params method with no fixed arguments and a call is made with no
10018         arguments.
10019
10020 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
10021
10022         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
10023         the verbatim-string-literal
10024
10025         * support.cs (InternalParameters.ParameterModifier): handle null
10026         fixed parameters.
10027         (InternalParameters.ParameterType): ditto.
10028
10029         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
10030         duplicating the name of the variable parameter.
10031         (GetParameterByName): Fix bug where we were not looking up array
10032         paramters if they were the only present (thanks Paolo!).
10033         (GetParameterInfo): We only have an empty set of types if both
10034         fixed and array are set to null.
10035         (GetParameterInfo-idx): Handle FixedParameter == null
10036
10037         * cs-parser.jay: Handle the case where there is no catch
10038         statements (missing null test).
10039
10040 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
10041
10042         * driver.cs (MainDriver): Be conservative on our command line
10043         handling.
10044
10045         Catch DirectoryNotFoundException when calling GetFiles.
10046
10047         (SplitPathAndPattern): Used to split the input specification into
10048         a path and a pattern that we can feed to Directory.GetFiles.
10049
10050 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
10051
10052         * statement.cs (Fixed): Implement the last case of the Fixed
10053         statement (string handling).
10054
10055         * expression.cs (StringPtr): New class used to return a char * to
10056         a string;  Used by the Fixed statement.
10057
10058         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
10059
10060         * expression.cs (Binary.ResolveOperator): Remove redundant
10061         MemberLookup pn parent type.
10062         Optimize union call, we do not need a union if the types are the same.
10063         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
10064         type.
10065
10066         Specialize the use of MemberLookup everywhere, instead of using
10067         the default settings. 
10068
10069         (StackAlloc): Implement stackalloc keyword.
10070
10071         * cs-parser.jay: Add rule to parse stackalloc.
10072
10073         * driver.cs: Handle /h, /help, /?
10074
10075         * expression.cs (MakeByteBlob): Removed the hacks we had in place
10076         before we supported unsafe code.
10077
10078         * makefile: add --unsafe to the self compilation of mcs.
10079
10080 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
10081
10082         * expression.cs (PointerArithmetic): New class that is used to
10083         perform pointer arithmetic.
10084         (Binary.Resolve): Handle pointer arithmetic
10085         Handle pointer comparission.
10086         (ArrayPtr): Utility expression class that is used to take the
10087         address of an array.
10088
10089         (ElementAccess): Implement array access for pointers
10090
10091         * statement.cs (Fixed): Implement fixed statement for arrays, we
10092         are missing one more case before we are done.
10093
10094         * expression.cs (Indirection): Implement EmitAssign and set the
10095         ExprClass to Variable.  This allows pointer dereferences to be
10096         treated as variables, and to have values assigned to them.
10097
10098         * ecore.cs (Expression.StoreFromPtr): New utility function to
10099         store values dereferencing.
10100
10101 2002-02-20  Ravi Pratap  <ravi@ximian.com>
10102
10103         * expression.cs (Binary.ResolveOperator): Ensure that we are
10104         not trying to operate on a void type - this fixes the reported
10105         bug.
10106
10107         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
10108         the parent implementation is sealed.
10109
10110         * ../errors/cs0239.cs : Add.
10111
10112         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
10113
10114         * typemanager.cs (unverifiable_code_type): Corresponds to 
10115         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
10116         which have unsafe code in them.
10117
10118         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
10119         unsafe context.
10120
10121 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
10122
10123         * cs-tokenizer.cs: Add support for @"litreal strings"
10124
10125         Make tokenizer accept pre-processor directives
10126         on any column (remove the old C-like limitation). 
10127
10128         * rootcontext.cs (EmitCode): Emit any global attributes.
10129         (AddGlobalAttributes): Used to keep track of assembly attributes. 
10130
10131         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
10132
10133         * cs-parser.jay: Add support for global attributes.  
10134
10135 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
10136
10137         * expression.cs (Indirection): New helper class.  Unary will
10138         create Indirection classes to be able to implement the
10139         IMemoryLocation interface on it.
10140
10141 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
10142
10143         * cs-parser.jay (fixed_statement): reference the right statement.
10144
10145         * statement.cs (Fixed.Emit): Finish implementing the fixed
10146         statement for the &x case.
10147
10148 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
10149
10150         * class.cs (Property.Define, Method.Define): Remove newslot when
10151         `implementing'.  
10152
10153         * modifiers.cs: My use of NewSlot when `Abstract' was set was
10154         wrong.  NewSlot should only be used if the `new' keyword is present.
10155
10156         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
10157         locating our system dir.  Sorry about this.
10158
10159 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
10160
10161         * driver.cs (GetSystemDir): Compute correctly the location of our
10162         system assemblies.  I was using the compiler directory instead of
10163         the library directory.
10164
10165 2002-02-13  Ravi Pratap  <ravi@ximian.com>
10166
10167         * expression.cs (BetterFunction): Put back in what Miguel commented out
10168         since it is the correct fix. The problem is elsewhere ;-)
10169
10170         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
10171         parameters of the parms method are themselves compatible or not !
10172
10173         (StandardConversionExists): Fix very dangerous bug where we were forgetting
10174         to check that a class implements an interface before saying that an implicit
10175         conversion was allowed. Use ImplementsInterface to do the checking.
10176
10177 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
10178
10179         * class.cs (Method.Define): Track whether we are an explicit
10180         implementation or not.  And only call DefineMethodOverride if we
10181         are an explicit implementation.
10182
10183         (Property.DefineMethod): Ditto.
10184
10185 2002-02-11  Ravi Pratap  <ravi@ximian.com>
10186
10187         * expression.cs (BetterFunction): Catch hideous bug which was
10188          preventing us from detecting ambiguous calls due to implicit casts i.e
10189         cs0121.
10190
10191 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
10192
10193         * support.cs (Pair): Remove un-needed method.  I figured why I was
10194         getting the error in cs-parser.jay, the variable in a foreach loop
10195         is readonly, and the compiler does not really treat this as a variable.
10196
10197         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
10198         instead of EQUALS in grammar.  
10199
10200         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
10201
10202         * expression.cs (Unary.DoResolve): Check whether the argument is
10203         managed or not.
10204
10205 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
10206
10207         * support.cs: Api for Pair to set a value.  Despite the fact that
10208         the variables are public the MS C# compiler refuses to compile
10209         code that accesses the field if the variable is part of a foreach
10210         statement. 
10211
10212         * statement.cs (Fixed): Begin implementation of the fixed
10213         statement.
10214
10215         (Block.AddVariable): Return the VariableInfo on success and null
10216         on failure instead of true/false. 
10217
10218         * cs-parser.jay (foreach): Catch errors on variables already
10219         defined (we were ignoring this value before) and properly unwind
10220         the block hierarchy
10221
10222         (fixed_statement): grammar for the fixed statement.
10223
10224 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
10225
10226         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
10227         pointer types to be incretemented.
10228
10229         (SizeOf): Implement.
10230
10231         * cs-parser.jay (pointer_member_access): Implement
10232         expr->IDENTIFIER production.
10233
10234         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
10235         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
10236         on safe contexts.
10237
10238         (Unary): Implement indirection.
10239
10240         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
10241         use in non-unsafe context).
10242
10243         (SimpleName.DoResolve): Check for pointers in field access on safe
10244         contexts. 
10245
10246         (Expression.LoadFromPtr): Factor the load-indirect code in this
10247         function.  This was duplicated in UnboxCast and ParameterReference
10248
10249 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
10250
10251         * expression.cs (ComposedCast): report an error if a pointer cast
10252         is used in a safe region.
10253
10254         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
10255         pointer type casts in unsafe context.
10256
10257         * codegen.cs (EmitContext): Set up IsUnsafe.
10258
10259         * cs-parser.jay (non_expression_type): Add productions for pointer
10260         casts. 
10261
10262         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
10263         code.  We should not use force into static mode if the method is
10264         not virtual.  Fixes bug in MIS
10265
10266         * statement.cs (Do.Emit, While.Emit, For.Emit,
10267         Statement.EmitBoolExpression): Add support to Do and While to
10268         propagate infinite loop as `I do return' semantics.
10269
10270         Improve the For case to also test for boolean constants.
10271
10272         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
10273         to the list of attributes we can add.
10274
10275         Remove `EmitContext' argument.
10276
10277         * class.cs (Method.Define): Apply parameter attributes.
10278         (Constructor.Define): Apply parameter attributes.
10279         (MethodCore.LabelParameters): Move here the core of labeling
10280         parameters. 
10281
10282         * support.cs (ReflectionParameters.ParameterModifier,
10283         InternalParameters.ParameterModifier): Use IsByRef on the type and
10284         only return the OUT bit for these parameters instead of in/out/ref
10285         flags.
10286
10287         This is because I miss-understood things.  The ParameterInfo.IsIn
10288         and IsOut represent whether the parameter has the [In] and [Out]
10289         attributes set.  
10290
10291 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
10292
10293         * ecore.cs (FieldExpr.Emit): Release temporaries.
10294
10295         * assign.cs (LocalTemporary.Release): new function.
10296
10297         * codegen.cs (EmitContext.GetTemporaryStorage,
10298         EmitContext.FreeTemporaryStorage): Rework the way we deal with
10299         temporary storage.  Now we can "put back" localbuilders when we
10300         are done with them
10301
10302 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
10303
10304         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
10305         need to make a copy of the variable to generate verifiable code.
10306
10307 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
10308
10309         * driver.cs: Compute dynamically the system directory.
10310
10311         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
10312         Slower, but more generally useful.  Used by the abstract
10313         registering implementation. 
10314
10315         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
10316         the rules for the special rule on Type/instances.  First check if
10317         we have the same name, and if so, try that special static path
10318         rather than the instance path.
10319
10320 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
10321
10322         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
10323         for, while and if.
10324
10325         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
10326         Enum, ValueType, Delegate or Array for non-corlib compiles.
10327
10328         * cs-tokenizer.cs: Catch long identifiers (645)
10329
10330         * typemanager.cs (IndexerPropetyName): Ravi never tested this
10331         piece of code.
10332
10333         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
10334         fix, we were returning too early, so we were not registering
10335         pending methods from abstract classes.
10336
10337         Do not register pending methods if the class is abstract.
10338
10339         * expression.cs (Conditional.DoResolve): Report circular implicit
10340         conversions when we neecd to compute it for conditional
10341         expressions. 
10342
10343         (Is.DoResolve): If the expression is always of the provided type,
10344         flag warning 183.  If the expression can not ever be of the
10345         provided type flag warning 184.
10346
10347         * class.cs: Catch 169 as well.
10348
10349         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
10350         read. 
10351
10352 2002-01-18  Nick Drochak  <ndrochak@gol.com>
10353
10354         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
10355
10356 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
10357
10358         * interface.cs: (PopulateMethod): Check for pointers being defined
10359         only if the unsafe context is active.
10360         (PopulateProperty): ditto.
10361         (PopulateIndexer): ditto.
10362
10363         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
10364         specified.  If pointers are present, make sure that they are
10365         present in an unsafe context.
10366         (Constructor, Constructor.Define): ditto.
10367         (Field, Field.Define): ditto.
10368         (Property, Property.Define): ditto.
10369         (Event, Event.Define): ditto.
10370
10371         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
10372         hashtable if there are classes or structs defined.
10373
10374         * expression.cs (LocalVariableReference.DoResolve): Simplify this
10375         code, as the constant resolution moved.
10376
10377         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
10378         the metadata, so we can flag error 133. 
10379
10380         * decl.cs (MemberCore.UnsafeOK): New function to test that a
10381         pointer is being declared in an unsafe context.
10382
10383 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
10384
10385         * modifiers.cs (Modifiers.Check): Require a Location argument.
10386         Report error 227 for Unsafe use.
10387
10388         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
10389
10390         * statement.cs (For.Emit): If the test is null, then report that
10391         we do `return', as we wont reach anything afterwards.
10392
10393         (Switch.SwitchGoverningType): Track the expression that matched
10394         the conversion.
10395
10396         * driver.cs: Allow negative numbers as an error code to flag.
10397
10398         * cs-parser.jay: Handle 1551.
10399
10400         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
10401
10402 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
10403
10404         * cs-parser.jay: Report 1518 (type declaration can only contain
10405         class, struct, interface, enum or delegate)
10406
10407         (switch_label): Report 1523 (keywords `case' or `default' must
10408         preced code)
10409
10410         (opt_switch_sections): Report 1522 (empty switch)
10411
10412         * driver.cs: Report 1515 (response file specified multiple times)
10413         Report 1516 (Source file specified multiple times).
10414
10415         * expression.cs (Argument.Resolve): Signal 1510
10416
10417         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
10418         access not allowed in static code)
10419
10420 2002-01-11  Ravi Pratap  <ravi@ximian.com>
10421
10422         * typemanager.cs (IsPointerType): Utility method which we are going
10423         to need a lot.
10424
10425         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
10426         the object type, so we take care of that.
10427
10428         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
10429
10430         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
10431         added to non-params parameters :-)
10432
10433         * typemanager.cs (CSharpName): Include 'void' type too. 
10434
10435         (void_ptr_type): Include in the set of core types.
10436
10437         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
10438         duplicating code.
10439
10440         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
10441         an unsafe context.
10442
10443         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
10444         completely forgotten about it.
10445
10446 2002-01-10  Ravi Pratap  <ravi@ximian.com>
10447
10448         * cs-parser.jay (pointer_type): Add. This begins our implementation
10449         of parsing rules for unsafe code.
10450
10451         (unsafe_statement): Implement.
10452
10453         (embedded_statement): Modify to include the above.
10454
10455         * statement.cs (Unsafe): Implement new class for unsafe blocks.
10456
10457         * codegen.cs (EmitContext.InUnsafe): Add. This determines
10458         if the current context is an unsafe one.
10459
10460         * cs-parser.jay (local_variable_pointer_type): Since local variable types
10461         are handled differently, we need separate rules for them.
10462
10463         (local_variable_declaration): Update to use local_variable_pointer_type
10464         to allow variable declarations of unmanaged pointer types.
10465
10466         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
10467         in unsafe contexts.
10468
10469         * ../errors/cs0214.cs : Add.
10470
10471 2002-01-16  Nick Drochak  <ndrochak@gol.com>
10472
10473         * makefile: remove 'response' file when cleaning.
10474
10475 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
10476
10477         * cs-parser.jay: Report 1524.
10478
10479 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
10480
10481         * typemanager.cs (RegisterMethod): drop checking if we have
10482         registered this from here
10483
10484 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
10485
10486         * class.cs (Method.EmitDestructor): Implement calling our base
10487         destructor. 
10488
10489         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
10490         value of InFinally.
10491
10492         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
10493         this routine and will wrap the call in a try/catch block.  Deal
10494         with the case.
10495
10496 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
10497
10498         * ecore.cs (Expression.MemberLookup): instead of taking a
10499         parameter `same_type' that was used to tell whether we could
10500         access private members we compute our containing type from the
10501         EmitContext.
10502
10503         (FieldExpr): Added partial support for volatile fields.  This does
10504         not work for volatile fields exposed from assemblies, as I can not
10505         figure out how to extract the modreq from it.
10506
10507         Updated all the source files to use this.
10508
10509         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
10510         because it is referenced by MemberLookup very often. 
10511
10512 2002-01-09  Ravi Pratap  <ravi@ximian.com>
10513
10514         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
10515         TypeBuilder.GetCustomAttributes to retrieve what we need.
10516
10517         Get rid of redundant default_member_attr_type as this is the same as
10518         default_member_type which already exists.
10519
10520         * interface.cs, attribute.cs : Update accordingly.
10521
10522 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
10523
10524         * typemanager.cs: Enable IndexerPropertyName again.  It does not
10525         work for TYpeBuilders though.  Ravi, can you please fix this?
10526
10527         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
10528
10529         * expression.cs (Argument.Emit): Handle the case of ref objects
10530         being passed to ref functions;  
10531
10532         (ParameterReference.EmitLoad): Loads the content of the pointer
10533         without dereferencing.
10534
10535 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
10536
10537         * cs-tokenizer.cs: Implemented the pre-processing expressions.
10538
10539 2002-01-08  Ravi Pratap  <ravi@ximian.com>
10540
10541         * class.cs (Indexer.DefineMethod): Incorporate the interface
10542         type in the name of the method if we are doing explicit interface
10543         implementation.
10544
10545         * expression.cs (ConversionExists): Remove as it is completely obsolete.
10546
10547         (BetterConversion): Fix extremely trivial bug where we were referring to
10548         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
10549         again !
10550
10551         * ../errors/bug16.cs : Add although we have fixed it.
10552
10553 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
10554
10555         * expression.cs (BaseIndexer): Begin implementation.
10556
10557         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
10558
10559         * cs-parser.jay (indexer_declarator): Use qualified_identifier
10560         production directly to remove a shift/reduce, and implement
10561         explicit interface implementation.
10562
10563         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
10564         after a floating point suffix.
10565
10566         * expression.cs (DoNumericPromotions): Improved the conversion for
10567         uint/uint.  If we have a constant, we avoid doing a typecast to a
10568         larger type.
10569
10570         * class.cs (Indexer): Implement explicit interface implementation
10571         for indexers.
10572
10573 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
10574
10575         * class.cs: make the default instance constructor public and hidebysig.
10576
10577 2001-01-03  Ravi Pratap  <ravi@ximian.com>
10578
10579         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
10580         so we can call it from elsewhere.
10581
10582         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
10583         we emit it internally if the class has a defined indexer; otherwise the user
10584         emits it by decorating the class definition with the DefaultMemberAttribute.
10585
10586         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
10587         attribute is not used on a type which defines an indexer.
10588
10589         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
10590         character when we skip whitespace.
10591
10592         * ../errors/cs0646.cs : Add.
10593
10594 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
10595
10596         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
10597         again. 
10598
10599         * makefile: Add practical target `mcs3.exe' which builds the third
10600         generation compiler. 
10601
10602         * expression.cs (New): Fix structures constructor calling.
10603
10604         * class.cs (Property, Method, Indexer): Emit Final flag on the
10605         method if we are an interface implementation and we are not
10606         abstract. 
10607
10608         * ecore.cs (PropertyExpr): New public field `IsBase', tells
10609         whether this property is referencing a `base' method.
10610
10611         * expression.cs (Invocation.EmitCall): take an extra argument:
10612         is_base, this is used to determine whether the `call' or
10613         `callvirt' opcode should be used.
10614
10615
10616         * delegate.cs: update EmitCall.
10617
10618         * class.cs (Method.Define): Set NewSlot for the cases where we are
10619         not implementing an interface method.
10620
10621         (Property.Define): ditto.
10622
10623 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
10624
10625         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
10626         'r'.  Allows mcs to parse itself fully.
10627
10628 2002-01-02  Ravi Pratap  <ravi@ximian.com>
10629
10630         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
10631         of the number of initializers that require the InitializeArray method.
10632
10633         (CheckIndices): Store the Expression in all cases - not the plain value. Also
10634         update the above field where necessary.
10635
10636         (MakeByteBlob): Update accordingly.
10637
10638         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
10639         greater than 2.
10640
10641         (EmitDynamicInitializers): Update in accordance with the new optimization.
10642
10643         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
10644         same OpCode applies.
10645
10646         * cs-parser.jay : Fix some glaring errors I introduced.
10647
10648 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
10649
10650         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
10651         so that we can check for name clashes there too.
10652
10653         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
10654         for interface indexers.
10655
10656         * interfaces.cs (Define): Emit the default member attribute.
10657
10658         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
10659         variable was being referred to while setting the value ;-)
10660
10661 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
10662
10663         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
10664         byte-by-byte information when we know the data is zero.
10665
10666         Make the block always a multiple of 4, because
10667         DefineInitializedData has a bug.
10668
10669         * assign.cs: Fix, we should assign from the temporary, not from
10670         the source. 
10671
10672         * expression.cs (MakeByteBlob): Fix my incorrect code.
10673
10674 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
10675
10676         * typemanager.cs (EnumToUnderlying): This function is used to get
10677         the underlying type from an enumeration, because it does not
10678         always work. 
10679
10680         * constant.cs: Use the I4_S form for values between -128 and 127.
10681
10682         * statement.cs (Block.LookupLabel): Looks up a label.
10683         (Block): Drop support for labeled blocks.
10684
10685         (LabeledStatement): New kind of statement that represents a label
10686         only.
10687
10688         (Goto): Finally implement this bad boy.
10689
10690         * cs-parser.jay: Update to reflect new mechanism to implement
10691         labels.
10692
10693 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
10694
10695         * codegen.cs (EmitContext.This): a codegen property that keeps the
10696         a single instance of this instead of creating many different this
10697         instances. 
10698
10699         * delegate.cs (Delegate.DoResolve): Update to use the property;
10700
10701         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
10702
10703         * expression.cs (BaseAccess.DoResolve): Ditto.
10704
10705 2001-12-29  Ravi Pratap  <ravi@ximian.com>
10706
10707         * typemanager.cs (methodimpl_attr_type): Add to hold the type
10708         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
10709
10710         (InitCoreTypes): Update accordingly.
10711
10712         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
10713         so we can quickly store the state.
10714
10715         (ApplyAttributes): Set the correct implementation flags
10716         for InternalCall methods.
10717
10718 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
10719
10720         * expression.cs (EmitCall): if a method is not virtual, then do
10721         not use callvirt on it.
10722
10723         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
10724         user defined stuff) requires the use of stobj, which takes an
10725         address on the stack instead of an array and an index.  So emit
10726         the Ldelema operation for it.
10727
10728         (EmitStoreOpcode): Use stobj for valuetypes.
10729
10730         (UnaryMutator.EmitCode): Use the right 1 value depending on
10731         whether we are dealing with int64/uint64, float or doubles.
10732
10733         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
10734         constructors that I implemented last night.
10735
10736         (Constructor.IsDefault): Fix to work properly for static
10737         constructors.
10738
10739         * cs-parser.jay (CheckDef): report method signature errors.
10740         Update error number 103 to be 132.
10741
10742         * decl.cs: New AdditionResult enumeration value: MethodExists.
10743         Although we do this check for methods later on in the semantic
10744         analysis, catching repeated default constructors is so easy that
10745         we catch these here. 
10746
10747         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
10748         promotions code.
10749
10750         (ParameterReference.EmitAssign, Emit): handle
10751         bools as bytes.
10752
10753         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
10754         (ArrayAccess.EmitStoreOpcode): ditto.
10755
10756         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
10757
10758         * expression.cs (MakeByteBlob): Complete all the missing types
10759         (uint, short, ushort, byte, sbyte)
10760
10761         * class.cs: Only init instance field initializers on instance
10762         constructors. 
10763
10764         Rename `constructors' to instance_constructors. 
10765
10766         (TypeContainer.AddConstructor): Only add constructors to the list
10767         if it is not static.
10768
10769         Make sure that we handle default_static_constructor independently
10770         everywhere where we handle instance_constructors
10771
10772 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
10773
10774         * class.cs: Do not lookup or create a base initializer for a
10775         static constructor.
10776
10777         (ConstructorInitializer.Resolve): use the proper type to lookup
10778         for constructors.
10779
10780         * cs-parser.jay: Report error 1585 (modifiers between type and name).
10781
10782         * enum.cs, interface.cs: Remove CloseType, this is taken care by
10783         in DeclSpace. 
10784
10785         * decl.cs: CloseType is now an virtual method, the default
10786         implementation just closes this type.
10787
10788 2001-12-28  Ravi Pratap  <ravi@ximian.com>
10789
10790         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
10791         to PreserveSig by default. Also emit HideBySig on such methods.
10792
10793         Basically, set the defaults to standard values.
10794
10795         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
10796         argument, if candidate is better, it can't be worse than the best !
10797
10798         (Invocation): Re-write bits to differentiate between methods being
10799         applicable in their expanded form and their normal form - for params
10800         methods of course.
10801
10802         Get rid of use_standard everywhere as only standard conversions are allowed
10803         in overload resolution. 
10804
10805         More spec conformance.
10806
10807 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
10808
10809         * driver.cs: Add --timestamp, to see where the compiler spends
10810         most of its time.
10811
10812         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
10813         `this' in static code.
10814
10815         (SimpleName.DoResolve): Implement in terms of a helper function
10816         that allows static-references to be passed upstream to
10817         MemberAccess.
10818
10819         (Expression.ResolveWithSimpleName): Resolve specially simple
10820         names when called by MemberAccess to implement the special
10821         semantics. 
10822
10823         (Expression.ImplicitReferenceConversion): Handle conversions from
10824         Null to reference types before others, as Null's type is
10825         System.Object. 
10826
10827         * expression.cs (Invocation.EmitCall): Handle the special case of
10828         calling methods declared on a reference type from a ValueType
10829         (Base classes System.Object and System.Enum)
10830
10831         (MemberAccess.Resolve): Only perform lookups on Enumerations if
10832         the left hand side is a TypeExpr, not on every enumeration. 
10833
10834         (Binary.Resolve): If types are reference types, then do a cast to
10835         object on operators != and == of both arguments.
10836
10837         * typemanager.cs (FindMembers): Extract instance and static
10838         members if requested.
10839
10840         * interface.cs (PopulateProperty): Use void_type instead of null
10841         as the return type for the setter method.
10842
10843         (PopulateIndexer): ditto.
10844
10845 2001-12-27  Ravi Pratap  <ravi@ximian.com>
10846
10847         * support.cs (ReflectionParameters): Fix minor bug where we
10848         were examining the wrong parameter for the ParamArray attribute.
10849
10850         Cope with requests for the type of the parameter at position
10851         greater than the params parameter's. We now return the element
10852         type of the params array as that makes more sense.
10853
10854         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
10855         accordingly as we no longer have to extract the element type
10856         ourselves.
10857
10858         (Invocation.OverloadResolve): Update.
10859
10860 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
10861
10862         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
10863         against IEnumerator, test whether the return value is a descendant
10864         of the IEnumerator interface.
10865
10866         * class.cs (Indexer.Define): Use an auxiliary method to implement
10867         the other bits of the method definition.  Begin support for
10868         explicit interface implementation.
10869
10870         (Property.DefineMethod): Use TypeManager.void_type instead of null
10871         for an empty return value.
10872
10873 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
10874
10875         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
10876         dealing with a FieldExpr which is composed of a FieldBuilder, in
10877         the code path we did extract the constant, but we should have
10878         obtained the underlying value to be able to cast it (otherwise we
10879         end up in an infinite loop, this is what Ravi was running into).
10880
10881         (ArrayCreation.UpdateIndices): Arrays might be empty.
10882
10883         (MemberAccess.ResolveMemberAccess): Add support for section
10884         14.5.4.1 that deals with the special case of E.I when E is a type
10885         and something else, that I can be a reference to a static member.
10886
10887         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
10888         handle a particular array type to create byte blobs, it is just
10889         something we dont generate byteblobs for.
10890
10891         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
10892         arguments. 
10893
10894         * location.cs (Push): remove the key from the hashtable that we
10895         are about to add.   This happens for empty files.
10896
10897         * driver.cs: Dispose files after we have parsed them.
10898
10899         (tokenize): new function that only runs the tokenizer on its
10900         input, for speed testing.
10901
10902 2001-12-26  Ravi Pratap  <ravi@ximian.com>
10903
10904         * class.cs (Event.Define): Define the private field only if there
10905         are no accessors defined.
10906
10907         * expression.cs (ResolveMemberAccess): If there is no associated
10908         field with the event, that means we have an event defined with its
10909         own accessors and we should flag error cs0070 since transforming
10910         ourselves into a field is not valid in that case.
10911
10912         * ecore.cs (SimpleName.DoResolve): Same as above.
10913
10914         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
10915         and charset to sane values.
10916
10917 2001-12-25  Ravi Pratap  <ravi@ximian.com>
10918
10919         * assign.cs (DoResolve): Perform check on events only if they 
10920         are being accessed outside the declaring type.
10921
10922         * cs-parser.jay (event_declarations): Update rules to correctly
10923         set the type of the implicit parameter etc.
10924
10925         (add_accessor, remove_accessor): Set current local parameters.
10926
10927         * expression.cs (Binary): For delegate addition and subtraction,
10928         cast the return value from the method into the appropriate delegate
10929         type.
10930
10931 2001-12-24  Ravi Pratap  <ravi@ximian.com>
10932
10933         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
10934         of these as the workaround is unnecessary.
10935
10936         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
10937         delegate data - none of that is needed at all.
10938
10939         Re-write bits to extract the instance expression and the delegate method
10940         correctly.
10941
10942         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
10943         on delegates too.
10944
10945         * attribute.cs (ApplyAttributes): New method to take care of common tasks
10946         of attaching attributes instead of duplicating code everywhere.
10947
10948         * everywhere : Update code to do attribute emission using the above method.
10949
10950 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
10951
10952         * expression.cs (IsParamsMethodApplicable): if there are not
10953         parameters, return immediately.
10954
10955         * ecore.cs: The 0 literal can be implicity converted to an enum
10956         type. 
10957
10958         (SimpleName.DoResolve): First lookup the type, then lookup the
10959         members. 
10960
10961         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
10962         want to get its address.  If the InstanceExpression is not
10963         addressable, store the result in a temporary variable, then get
10964         the address of it.
10965
10966         * codegen.cs: Only display 219 errors on warning level or above. 
10967
10968         * expression.cs (ArrayAccess): Make it implement the
10969         IMemoryLocation interface.
10970
10971         (Binary.DoResolve): handle the operator == (object a, object b)
10972         and operator != (object a, object b) without incurring into a
10973         BoxedCast (because 5 != o should never be performed).
10974
10975         Handle binary enumerator operators.
10976
10977         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
10978         value type, otherwise use Ldelem_ref.
10979
10980         Use precomputed names;
10981
10982         (AddressOf): Implement address of
10983
10984         * cs-parser.jay (labeled_statement): Fix recursive block
10985         addition by reworking the production.
10986
10987         * expression.cs (New.DoEmit): New has a special case:
10988                 
10989                  If we are dealing with a ValueType, we have a few
10990                  situations to deal with:
10991                 
10992                     * The target of New is a ValueType variable, that is
10993                       easy, we just pass this as the variable reference
10994                 
10995                     * The target of New is being passed as an argument,
10996                       to a boxing operation or a function that takes a
10997                       ValueType.
10998                 
10999                       In this case, we need to create a temporary variable
11000                       that is the argument of New.
11001
11002
11003 2001-12-23  Ravi Pratap  <ravi@ximian.com>
11004
11005         * rootcontext.cs (LookupType): Check that current_type is not null before
11006         going about looking at nested types.
11007
11008         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
11009         not implement the IAssignMethod interface any more.
11010
11011         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
11012         where we tranform them into FieldExprs if they are being resolved from within
11013         the declaring type.
11014
11015         * ecore.cs (SimpleName.DoResolve): Do the same here.
11016
11017         * assign.cs (DoResolve, Emit): Clean up code considerably. 
11018
11019         * ../errors/bug10.cs : Add.
11020
11021         * ../errors/cs0070.cs : Add.
11022
11023         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
11024
11025         * assign.cs : Get rid of EventIsLocal everywhere.
11026
11027 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
11028
11029         * ecore.cs (ConvertIntLiteral): finished the implementation.
11030
11031         * statement.cs (SwitchLabel): Convert the value we are using as a
11032         key before looking up the table.
11033
11034 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
11035
11036         * codegen.cs (EmitTopBlock): Require a Location argument now.
11037
11038         * cs-parser.jay (constructor_declarator): We need to setup
11039         current_local_parameters before we parse the
11040         opt_constructor_initializer, to allow the variables to be bound
11041         to the constructor arguments.
11042
11043         * rootcontext.cs (LookupType): First lookup nested classes in our
11044         class and our parents before we go looking outside our class.
11045
11046         * expression.cs (ConstantFold): Extract/debox the values at the
11047         beginnning. 
11048
11049         * rootcontext.cs (EmitCode): Resolve the constants first before we
11050         resolve the types.  This is not really needed, but it helps debugging.
11051
11052         * statement.cs: report location.
11053
11054         * cs-parser.jay: pass location to throw statement.
11055
11056         * driver.cs: Small bug fix.
11057
11058         * report.cs: Updated format to be 4-zero filled digits.
11059
11060 2001-12-22  Ravi Pratap  <ravi@ximian.com>
11061
11062         * expression.cs (CheckIndices): Fix minor bug where the wrong
11063         variable was being referred to ;-)
11064
11065         (DoEmit): Do not call EmitStaticInitializers when the 
11066         underlying type is System.Object.
11067
11068 2001-12-21  Ravi Pratap  <ravi@ximian.com>
11069
11070         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
11071         and do the usual workaround for SRE.
11072
11073         * class.cs (MyEventBuilder.EventType): New member to get at the type
11074         of the event, quickly.
11075
11076         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
11077
11078         * assign.cs (Assign.DoResolve): Handle the case when the target
11079         is an EventExpr and perform the necessary checks.
11080
11081         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
11082         interface.
11083
11084         (SimpleName.MemberStaticCheck): Include check for EventExpr.
11085
11086         (EventExpr): Set the type in the constructor itself since we 
11087         are meant to be born fully resolved.
11088
11089         (EventExpr.Define): Revert code I wrote earlier.
11090                 
11091         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
11092         instance expression is null. The instance expression is a This in that case
11093         or a null, depending on whether it is a static method or not.
11094
11095         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
11096         refers to more than one method.
11097
11098         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
11099         and accordingly flag errors.
11100
11101 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
11102
11103         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
11104
11105 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
11106
11107         * location.cs (ToString): Provide useful rutine.
11108
11109 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
11110
11111         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
11112         objects, return the actual integral boxed.
11113
11114         * statement.cs (SwitchLabel): define an ILLabel for each
11115         SwitchLabel. 
11116
11117         (Switch.CheckSwitch): If the value is a Literal, extract
11118         the underlying literal.
11119
11120         Also in the unused hashtable we had, add the SwitchLabel so we can
11121         quickly look this value up.
11122
11123         * constant.cs: Implement a bunch of new constants.  Rewrite
11124         Literal based on this.  Made changes everywhere to adapt to this.
11125
11126         * expression.cs (Expression.MakeByteBlob): Optimize routine by
11127         dereferencing array only once, and also copes with enumrations.
11128
11129         bytes are two bytes wide, not one.
11130
11131         (Cast): Perform constant conversions.
11132
11133         * ecore.cs (TryImplicitIntConversion): Return literals instead of
11134         wrappers to the literals here.
11135
11136         * expression.cs (DoNumericPromotions): long literals can converted
11137         to ulong implicity (this is taken care of elsewhere, but I was
11138         missing this spot).
11139
11140         * ecore.cs (Expression.Literalize): Make the return type Literal,
11141         to improve type checking.
11142
11143         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
11144
11145 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
11146
11147         * literal.cs: Revert code from ravi that checked the bounds.  The
11148         bounds are sane by the definition of the type itself. 
11149
11150         * typemanager.cs: Fix implementation of ImplementsInterface.  We
11151         need to actually look up in our parent hierarchy for interfaces
11152         implemented. 
11153
11154         * const.cs: Use the underlying type for enumerations
11155
11156         * delegate.cs: Compute the basename for the delegate creation,
11157         that should fix the delegate test case, and restore the correct
11158         Type Lookup semantics in rootcontext
11159
11160         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
11161         referencing a nested type with the Reflection API is using the "+"
11162         sign. 
11163
11164         * cs-parser.jay: Do not require EOF token at the end.
11165
11166 2001-12-20  Ravi Pratap  <ravi@ximian.com>
11167
11168         * rootcontext.cs (LookupType): Concatenate type names with
11169         a '.' instead of a '+' The test suite passes again.
11170
11171         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
11172         field of the enumeration.
11173
11174         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
11175         the case when the member is an EventExpr.
11176
11177         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
11178         static has an associated instance expression.
11179
11180         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
11181
11182         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
11183
11184         * class.cs (Event.Define): Register event and perform appropriate checks
11185         for error #111.
11186
11187         We define the Add and Remove methods even if the use provides none because
11188         in that case, we provide default implementations ourselves.
11189
11190         Define a private field of the type of the event. This is done by the CSC compiler
11191         and we should be doing it too ;-)
11192
11193         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
11194         More methods we use in code we generate.
11195
11196         (multicast_delegate_type, delegate_type): Two separate types since the distinction
11197         is important.
11198
11199         (InitCoreTypes): Update accordingly for the above.
11200
11201         * class.cs (Event.Emit): Generate code for default accessors that we provide
11202
11203         (EmitDefaultMethod): Do the job in the above.
11204
11205         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
11206         appropriate place.
11207
11208 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
11209
11210         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
11211         builders even if we were missing one.
11212
11213         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
11214         pass the Basename as our class name instead of the Name.  The
11215         basename will be correctly composed for us.
11216
11217         * parameter.cs (Paramters): Now takes a Location argument.
11218
11219         * decl.cs (DeclSpace.LookupType): Removed convenience function and
11220         make all the code call directly LookupType in RootContext and take
11221         this chance to pass the Location information everywhere.
11222
11223         * Everywhere: pass Location information.
11224
11225 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
11226
11227         * class.cs (Constructor.Define): Updated way of detecting the
11228         length of the parameters.
11229
11230         (TypeContainer.DefineType): Use basename as the type name for
11231         nested types.
11232
11233         (TypeContainer.Define): Do not recursively define types here, as
11234         definition is taken care in order by the RootContext.
11235
11236         * tree.cs: Keep track of namespaces in a per-file basis.
11237
11238         * parameter.cs (Parameter.ComputeSignature): Update to use
11239         DeclSpace. 
11240
11241         (Parameters.GetSignature): ditto.
11242
11243         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
11244         instead of a TypeContainer.
11245
11246         (Interface.SemanticAnalysis): Use `this' instead of our parent to
11247         resolve names.  Because we need to be resolve in our context, not
11248         our parents.
11249
11250         * driver.cs: Implement response files.
11251
11252         * class.cs (TypeContainer.DefineType): If we are defined, do not
11253         redefine ourselves.
11254
11255         (Event.Emit): Emit the code for add/remove handlers.
11256         (Event.Define): Save the MethodBuilders for add/remove.
11257
11258         * typemanager.cs: Use pair here too.
11259
11260         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
11261         DictionaryEntry requires the first argument to be non-null.  
11262
11263         (enum_declaration): Compute full name for registering the
11264         enumeration.
11265
11266         (delegate_declaration): Instead of using
11267         formal_parameter_list, use opt_formal_parameter_list as the list
11268         can be empty.
11269
11270         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
11271         (EventParsing): New property that controls whether `add' and
11272         `remove' are returned as tokens or identifiers (for events);
11273
11274 2001-12-19  Ravi Pratap  <ravi@ximian.com>
11275
11276         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
11277         use MyEventBuilder only and let it wrap the real builder for us.
11278
11279         (MyEventBuilder): Revamp constructor etc.
11280
11281         Implement all operations that we perform on EventBuilder in precisely the same
11282         way here too.
11283
11284         (FindMembers): Update to use the EventBuilder member.
11285
11286         (Event.Emit): Update accordingly.
11287
11288 2001-12-18  Ravi Pratap  <ravi@ximian.com>
11289
11290         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
11291         by calling the appropriate methods.
11292
11293         (GetCustomAttributes): Make stubs as they cannot possibly do anything
11294         useful.
11295
11296         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
11297
11298 2001-12-17  Ravi Pratap  <ravi@ximian.com>
11299
11300         * delegate.cs (Delegate.Populate): Check that the return type
11301         and various parameters types are indeed accessible.
11302
11303         * class.cs (Constructor.Define): Same here.
11304
11305         (Field.Define): Ditto.
11306
11307         (Event.Define): Ditto.
11308
11309         (Operator.Define): Check that the underlying Method defined itself
11310         correctly - so it's MethodBuilder should not be null.
11311
11312         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
11313         expression happens to be null.
11314
11315         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
11316         members but as of now we don't seem to be able to do anything really useful with it.
11317
11318         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
11319         not the EventBuilder.
11320
11321 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
11322
11323         * cs-tokenizer.cs: Add support for defines.
11324         Add support for #if, #elif, #else, #endif
11325
11326         (eval_var): evaluates a variable.
11327         (eval): stubbed for evaluating functions.
11328
11329         * cs-parser.jay: Pass the defines information
11330
11331         * driver.cs: Add --define command line option.
11332
11333         * decl.cs: Move MemberCore here.
11334
11335         Make it the base class for DeclSpace.  This allows us to catch and
11336         report 108 and 109 for everything now.
11337
11338         * class.cs (TypeContainer.Define): Extract all the members
11339         before populating and emit the warning 108 (new keyword required
11340         to override) instead of having each member implement this.
11341
11342         (MemberCore.Define): New abstract method, we will be using this in
11343         the warning reporting engine in Populate.
11344
11345         (Operator.Define): Adjust to new MemberCore protocol. 
11346
11347         * const.cs (Const): This does not derive from Expression, it is a
11348         temporary object we use to create fields, it is a MemberCore. 
11349
11350         * class.cs (Method.Define): Allow the entry point to be in a
11351         specific class.
11352
11353         * driver.cs: Rewrite the argument handler to clean it up a bit.
11354
11355         * rootcontext.cs: Made it just an auxiliary namespace feature by
11356         making everything static.
11357
11358         * driver.cs: Adapt code to use RootContext type name instead of
11359         instance variable.
11360
11361         * delegate.cs: Remove RootContext argument.
11362
11363         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
11364         argument. 
11365
11366         * class.cs (Event.Define): The lookup can fail.
11367
11368         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
11369
11370         * expression.cs: Resolve the this instance before invoking the code.
11371
11372 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
11373
11374         * cs-parser.jay: Add a production in element_access that allows
11375         the thing to become a "type" reference.  This way we can parse
11376         things like "(string [])" as a type.
11377
11378         Note that this still does not handle the more complex rules of
11379         casts. 
11380
11381
11382         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
11383
11384         * ecore.cs: (CopyNewMethods): new utility function used to
11385         assemble the list of methods from running FindMembers.
11386
11387         (MemberLookup): Rework FindMembers so that 
11388
11389 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
11390
11391         * class.cs (TypeContainer): Remove Delegates who fail to be
11392         defined.
11393
11394         * delegate.cs (Populate): Verify that we dont get null return
11395         values.   TODO: Check for AsAccessible.
11396
11397         * cs-parser.jay: Use basename to emit error 574 (destructor should
11398         have the same name as container class), not the full name.
11399
11400         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
11401         possible representation.  
11402
11403         Also implements integer type suffixes U and L.
11404
11405 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
11406
11407         * expression.cs (ArrayCreation.DoResolve): We need to do the
11408         argument resolution *always*.
11409
11410         * decl.cs: Make this hold the namespace.  Hold the root context as
11411         well.
11412         (LookupType): Move here.
11413
11414         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
11415
11416         * location.cs (Row, Name): Fixed the code, it was always returning
11417         references to the first file.
11418
11419         * interface.cs: Register properties defined through interfaces.
11420
11421         * driver.cs: Add support for globbing on the command line
11422
11423         * class.cs (Field): Make it derive from MemberCore as well.
11424         (Event): ditto.
11425
11426 2001-12-15  Ravi Pratap  <ravi@ximian.com>
11427
11428         * class.cs (Event::Define): Check that the type of the event is a delegate
11429         type else flag error #66.
11430
11431         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
11432         same.
11433
11434         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
11435         values of EntryPoint, CharSet etc etc.
11436
11437         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
11438
11439         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
11440         be null and we should ignore this. I am not sure if this is really clean. Apparently,
11441         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
11442         which needs this to do its work.
11443
11444         * ../errors/cs0066.cs : Add.
11445
11446 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
11447
11448         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
11449         helper functions.
11450
11451         * class.cs: (MethodSignature.MethodSignature): Removed hack that
11452         clears out the parameters field.
11453         (MemberSignatureCompare): Cleanup
11454
11455         (MemberCore): New base class used to share code between MethodCore
11456         and Property.
11457
11458         (RegisterRequiredImplementations) BindingFlags.Public requires
11459         either BindingFlags.Instace or Static.  Use instance here.
11460
11461         (Property): Refactored code to cope better with the full spec.
11462
11463         * parameter.cs (GetParameterInfo): Return an empty array instead
11464         of null on error.
11465
11466         * class.cs (Property): Abstract or extern properties have no bodies.
11467
11468         * parameter.cs (GetParameterInfo): return a zero-sized array.
11469
11470         * class.cs (TypeContainer.MethodModifiersValid): Move all the
11471         method modifier validation to the typecontainer so we can reuse
11472         this on properties.
11473
11474         (MethodCore.ParameterTypes): return an empty sized array of types.
11475
11476         (Property.Define): Test property modifier validity.
11477
11478         Add tests for sealed/override too.
11479
11480         (Method.Emit): abstract or extern methods have no bodies.
11481
11482 2001-12-14  Ravi Pratap  <ravi@ximian.com>
11483
11484         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
11485         thing.
11486
11487         (Method::Define, ::Emit): Modify accordingly.
11488
11489         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
11490
11491         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
11492
11493         * makefile: Pass in /unsafe.
11494
11495 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
11496
11497         * class.cs (MakeKey): Kill routine.
11498
11499         * class.cs (TypeContainer.Define): Correctly define explicit
11500         method implementations (they require the full interface name plus
11501         the method name).
11502
11503         * typemanager.cs: Deply the PtrHashtable here and stop using the
11504         lame keys.  Things work so much better.
11505
11506         This of course broke everyone who depended on `RegisterMethod' to
11507         do the `test for existance' test.  This has to be done elsewhere.
11508
11509         * support.cs (PtrHashtable): A hashtable that avoid comparing with
11510         the object stupid Equals method (because, that like fails all over
11511         the place).  We still do not use it.
11512
11513         * class.cs (TypeContainer.SetRequiredInterface,
11514         TypeContainer.RequireMethods): Killed these two routines and moved
11515         all the functionality to RegisterRequiredImplementations.
11516
11517         (TypeContainer.RegisterRequiredImplementations): This routine now
11518         registers all the implementations required in an array for the
11519         interfaces and abstract methods.  We use an array of structures
11520         which can be computed ahead of time to reduce memory usage and we
11521         also assume that lookups are cheap as most classes will not
11522         implement too many interfaces.
11523
11524         We also avoid creating too many MethodSignatures.
11525
11526         (TypeContainer.IsInterfaceMethod): Update and optionally does not
11527         clear the "pending" bit if we find that there are problems with
11528         the declaration.
11529
11530         (TypeContainer.VerifyPendingMethods): Update to report errors of
11531         methods that look like implementations but are not.
11532
11533         (TypeContainer.Define): Add support for explicit interface method
11534         implementation. 
11535
11536 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
11537
11538         * typemanager.cs: Keep track of the parameters here instead of
11539         being a feature of the TypeContainer.
11540
11541         * class.cs: Drop the registration of parameters here, as
11542         InterfaceMethods are also interface declarations.
11543
11544         * delegate.cs: Register methods with the TypeManager not only with
11545         the TypeContainer.  This code was buggy.
11546
11547         * interface.cs: Full registation here.
11548
11549 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
11550
11551         * expression.cs: Remove reducer for binary expressions, it can not
11552         be done this way.
11553
11554         * const.cs: Put here the code that used to go into constant.cs
11555
11556         * constant.cs: Put here the code for constants, this is a new base
11557         class for Literals.
11558
11559         * literal.cs: Make Literal derive from Constant.
11560
11561 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
11562
11563         * statement.cs (Return.Emit): Report error 157 if the user
11564         attempts to return from a finally block.
11565
11566         (Return.Emit): Instead of emitting a return, jump to the end of
11567         the function.
11568
11569         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
11570         LocalBuilder to store the result of the function.  ReturnLabel is
11571         the target where we jump.
11572
11573
11574 2001-12-09  Radek Doulik  <rodo@ximian.com>
11575
11576         * cs-parser.jay: remember alias in current namespace
11577
11578         * ecore.cs (SimpleName::DoResolve): use aliases for types or
11579         namespaces
11580
11581         * class.cs (LookupAlias): lookup alias in my_namespace
11582
11583         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
11584         aliases hashtable
11585         (LookupAlias): lookup alias in this and if needed in parent
11586         namespaces
11587
11588 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
11589
11590         * support.cs: 
11591
11592         * rootcontext.cs: (ModuleBuilder) Made static, first step into
11593         making things static.  I need this to avoid passing the
11594         TypeContainer when calling ParameterType.
11595
11596         * support.cs (InternalParameters.ParameterType): Remove ugly hack
11597         that did string manipulation to compute the type and then call
11598         GetType.  Use Parameter.ParameterType instead.
11599
11600         * cs-tokenizer.cs: Consume the suffix for floating values.
11601
11602         * expression.cs (ParameterReference): figure out whether this is a
11603         reference parameter or not.  Kill an extra variable by computing
11604         the arg_idx during emission.
11605
11606         * parameter.cs (Parameters.GetParameterInfo): New overloaded
11607         function that returns whether a parameter is an out/ref value or not.
11608
11609         (Parameter.ParameterType): The type of the parameter (base,
11610         without ref/out applied).
11611
11612         (Parameter.Resolve): Perform resolution here.
11613         (Parameter.ExternalType): The full type (with ref/out applied).
11614
11615         * statement.cs (Using.Emit, Using.EmitExpression): Implement
11616         support for expressions on the using statement.
11617
11618 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
11619
11620         * statement.cs (Using.EmitLocalVariableDecls): Split the
11621         localvariable handling of the using statement.
11622
11623         (Block.EmitMeta): Keep track of variable count across blocks.  We
11624         were reusing slots on separate branches of blocks.
11625
11626         (Try.Emit): Emit the general code block, we were not emitting it. 
11627
11628         Check the type of the declaration to be an IDisposable or
11629         something that can be implicity converted to it. 
11630
11631         Emit conversions if required.
11632
11633         * ecore.cs (EmptyExpression): New utility class.
11634         (Expression.ImplicitConversionExists): New utility function.
11635
11636 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
11637
11638         * statement.cs (Using): Implement.
11639
11640         * expression.cs (LocalVariableReference): Support read only variables.
11641
11642         * statement.cs: Remove the explicit emit for the Leave opcode.
11643         (VariableInfo): Add a readonly field.
11644
11645 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
11646
11647         * ecore.cs (ConvCast): new class used to encapsulate the various
11648         explicit integer conversions that works in both checked and
11649         unchecked contexts.
11650
11651         (Expression.ConvertNumericExplicit): Use new ConvCast class to
11652         properly generate the overflow opcodes.
11653
11654 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
11655
11656         * statement.cs: The correct type for the EmptyExpression is the
11657         element_type, not the variable type.  Ravi pointed this out.
11658
11659 2001-12-04  Ravi Pratap  <ravi@ximian.com>
11660
11661         * class.cs (Method::Define): Handle PInvoke methods specially
11662         by using DefinePInvokeMethod instead of the usual one.
11663
11664         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
11665         above to do the task of extracting information and defining the method.
11666
11667 2001-12-04  Ravi Pratap  <ravi@ximian.com>
11668
11669         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
11670         of the condition for string type.
11671
11672         (Emit): Move that here. 
11673
11674         (ArrayCreation::CheckIndices): Keep string literals in their expression
11675         form.
11676
11677         (EmitDynamicInitializers): Handle strings appropriately.
11678
11679 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
11680
11681         * codegen.cs (EmitContext): Replace multiple variables with a
11682         single pointer to the current Switch statement.
11683
11684         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
11685         EmitContext.
11686
11687 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
11688
11689         * statement.cs 
11690
11691         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
11692         default'.
11693
11694         (Foreach.Emit): Foreach on arrays was not setting
11695         up the loop variables (for break/continue).
11696
11697         (GotoCase): Semi-implented.
11698
11699 2001-12-03  Ravi Pratap  <ravi@ximian.com>
11700
11701         * attribute.cs (CheckAttribute): Handle system attributes by using
11702         Attribute.GetAttributes to examine information we need.
11703
11704         (GetValidPlaces): Same here.
11705
11706         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
11707
11708         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
11709
11710         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
11711
11712         (Method::Define): Set appropriate flags if we have a DllImport attribute.
11713
11714         (Method::Emit): Handle the case when we are a PInvoke method.
11715
11716 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
11717
11718         * expression.cs: Use ResolveWithSimpleName on compound names.
11719
11720 2001-12-02  Ravi Pratap  <ravi@ximian.com>
11721
11722         * constant.cs (EmitConstant): Make sure we resolve the associated expression
11723         before trying to reduce it.
11724
11725         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
11726
11727         * constant.cs (LookupConstantValue): Implement.
11728
11729         (EmitConstant): Use the above in emitting the constant.
11730
11731         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
11732         that are user-defined by doing a LookupConstantValue on them.
11733
11734         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
11735         too, like above.
11736
11737 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
11738
11739         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
11740
11741         (BaseAccess.DoResolve): Implement.
11742
11743         (MemberAccess.DoResolve): Split this routine into a
11744         ResolveMemberAccess routine that can be used independently
11745
11746 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
11747
11748         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
11749         As that share bits of the implementation.  Is returns a boolean,
11750         while As returns the Type that is being probed.
11751
11752 2001-12-01  Ravi Pratap  <ravi@ximian.com>
11753
11754         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
11755         instead of a Literal - much easier.
11756
11757         (EnumInTransit): Remove - utterly useless :-)
11758
11759         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
11760
11761         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
11762
11763         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
11764         chain when we have no associated expression.
11765
11766 2001-11-30  Ravi Pratap  <ravi@ximian.com>
11767
11768         * constant.cs (Define): Use Location while reporting the errror.
11769
11770         Also emit a warning when 'new' is used and there is no inherited
11771         member to hide.
11772
11773         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
11774         populated.
11775
11776         (LookupEnumValue): Implement to lookup an enum member's value and define it
11777         if necessary.
11778
11779         (Populate): Re-write accordingly to use the above routine.
11780
11781 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
11782
11783         * expression.cs (This): Fix prototype for DoResolveLValue to
11784         override the base class DoResolveLValue.
11785
11786         * cs-parser.cs: Report errors cs574 and cs575 (destructor
11787         declarations) 
11788
11789         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
11790         (we need to load the address of the field here).  This fixes
11791         test-22. 
11792
11793         (FieldExpr.DoResolveLValue): Call the DoResolve
11794         function to initialize the Instance expression.
11795
11796         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
11797         correctly the GetEnumerator operation on a value type.
11798
11799         * cs-parser.jay: Add more simple parsing error catches.
11800
11801         * statement.cs (Switch): Add support for string switches.
11802         Handle null specially.
11803
11804         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
11805
11806 2001-11-28  Ravi Pratap  <ravi@ximian.com>
11807
11808         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
11809
11810         (declare_local_constant): New helper function.
11811
11812         * statement.cs (AddConstant): Keep a separate record of constants
11813
11814         (IsConstant): Implement to determine if a variable is a constant.
11815
11816         (GetConstantExpression): Implement.
11817
11818         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
11819
11820         * statement.cs (IsVariableDefined): Re-write.
11821
11822 2001-11-27  Ravi Pratap  <ravi@ximian.com>
11823
11824         * class.cs (TypeContainer::FindMembers): Look for constants
11825         in the case when we are looking for MemberTypes.Field
11826
11827         * expression.cs (MemberAccess::DoResolve): Check that in the
11828         case we are a FieldExpr and a Literal, we are not being accessed
11829         by an instance reference.
11830
11831         * cs-parser.jay (local_constant_declaration): Implement.
11832
11833         (declaration_statement): Implement for constant declarations.
11834
11835 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
11836
11837         * statement.cs (Switch): Catch double defaults.
11838
11839         (Switch): More work on the switch() statement
11840         implementation.  It works for integral values now, need to finish
11841         string support.
11842
11843
11844 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
11845
11846         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
11847         integer literals into other integer literals.  To be used by
11848         switch. 
11849
11850 2001-11-24  Ravi Pratap  <ravi@ximian.com>
11851
11852         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
11853         some memory.
11854
11855         (EmitDynamicInitializers): Cope with the above since we extract data
11856         directly from ArrayData now.
11857
11858         (ExpectInitializers): Keep track of whether initializers are mandatory
11859         or not.
11860
11861         (Bounds): Make it a hashtable to prevent the same dimension being 
11862         recorded for every element in that dimension.
11863
11864         (EmitDynamicInitializers): Fix bug which prevented the Set array method
11865         from being found.
11866
11867         Also fix bug which was causing the indices to be emitted in the reverse
11868         order.
11869
11870 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
11871
11872         * expression.cs (ArrayCreation): Implement the bits that Ravi left
11873         unfinished.  They do not work, because the underlying code is
11874         sloppy.
11875
11876 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11877
11878         * cs-parser.jay: Remove bogus fixme.
11879
11880         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
11881         on Switch statement.
11882
11883 2001-11-23  Ravi Pratap  <ravi@ximian.com>
11884
11885         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
11886         the same. 
11887
11888         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
11889         parameter. Apparently, any expression is allowed. 
11890
11891         (ValidateInitializers): Update accordingly.
11892
11893         (CheckIndices): Fix some tricky bugs thanks to recursion.
11894
11895         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
11896         I was being completely brain-dead.
11897
11898         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
11899         and re-write acordingly.
11900
11901         (DelegateInvocation): Re-write accordingly.
11902
11903         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
11904
11905         (MakeByteBlob): Handle types more correctly.
11906
11907         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
11908         initialization from expressions but it is incomplete because I am a complete
11909         Dodo :-|
11910
11911 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11912
11913         * statement.cs (If.Emit): Fix a bug that generated incorrect code
11914         on If.  Basically, we have to return `true' (ie, we do return to
11915         our caller) only if both branches of the if return.
11916
11917         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
11918         short-circuit operators, handle them as short circuit operators. 
11919
11920         (Cast.DoResolve): Resolve type.
11921         (Cast.Cast): Take an expression as the target type.
11922
11923         * cs-parser.jay (cast_expression): Remove old hack that only
11924         allowed a limited set of types to be handled.  Now we take a
11925         unary_expression and we resolve to a type during semantic
11926         analysis.
11927
11928         Use the grammar productions from Rhys to handle casts (this is
11929         not complete like Rhys syntax yet, we fail to handle that corner
11930         case that C# has regarding (-x), but we will get there.
11931
11932 2001-11-22  Ravi Pratap  <ravi@ximian.com>
11933
11934         * class.cs (EmitFieldInitializer): Take care of the case when we have a
11935         field which is an array type.
11936
11937         * cs-parser.jay (declare_local_variables): Support array initialization too.
11938
11939         * typemanager.cs (MakeKey): Implement.
11940
11941         (everywhere): Use the above appropriately.
11942
11943         * cs-parser.jay (for_statement): Update for array initialization while
11944         declaring variables.
11945
11946         * ecore.cs : The error message was correct, it's the variable's names that
11947         were misleading ;-) Make the code more readable.
11948
11949         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
11950         the correct type etc.
11951
11952         (ConvertExplicit): Handle Enum types by examining the underlying type.
11953
11954 2001-11-21  Ravi Pratap  <ravi@ximian.com>
11955
11956         * parameter.cs (GetCallingConvention): Always return
11957         CallingConventions.Standard for now.
11958
11959 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11960
11961         * expression.cs (Binary.ResolveOperator): Update the values of `l'
11962         and `r' after calling DoNumericPromotions.
11963
11964         * ecore.cs: Fix error message (the types were in the wrong order).
11965
11966         * statement.cs (Foreach.ProbeCollectionType): Need to pass
11967         BindingFlags.Instance as well 
11968
11969         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
11970         implicit int literal conversion in an empty cast so that we
11971         propagate the right type upstream.
11972
11973         (UnboxCast): new class used to unbox value types.
11974         (Expression.ConvertExplicit): Add explicit type conversions done
11975         by unboxing.
11976
11977         (Expression.ImplicitNumericConversion): Oops, forgot to test for
11978         the target type before applying the implicit LongLiterals to ULong
11979         literal cast.
11980
11981 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
11982
11983         * cs-parser.jay (for_statement): Reworked the way For works: now
11984         we declare manually any variables that are introduced in
11985         for_initializer to solve the problem of having out-of-band code
11986         emition (that is what got for broken).
11987
11988         (declaration_statement): Perform the actual variable declaration
11989         that used to be done in local_variable_declaration here.
11990
11991         (local_variable_declaration): Do not declare anything, just pass
11992         the information on a DictionaryEntry
11993
11994 2001-11-20  Ravi Pratap  <ravi@ximian.com>
11995
11996         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
11997         re-write of the logic to now make it recursive.
11998
11999         (UpdateIndices): Re-write accordingly.
12000
12001         Store element data in a separate ArrayData list in the above methods.
12002
12003         (MakeByteBlob): Implement to dump the array data into a byte array.
12004
12005 2001-11-19  Ravi Pratap  <ravi@ximian.com>
12006
12007         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
12008         into CheckIndices.
12009
12010         * constant.cs (Define): Implement.
12011
12012         (EmitConstant): Re-write fully.
12013
12014         Pass in location info.
12015
12016         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
12017         respectively.
12018
12019         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
12020         DictionaryEntry since we need location info too.
12021
12022         (constant_declaration): Update accordingly.
12023
12024         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
12025         code into another method : UpdateIndices.
12026
12027 2001-11-18  Ravi Pratap  <ravi@ximian.com>
12028
12029         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
12030         some type checking etc.
12031
12032 2001-11-17  Ravi Pratap  <ravi@ximian.com>
12033
12034         * expression.cs (ArrayCreation::ValidateInitializers): Implement
12035         bits to provide dimension info if the user skips doing that.
12036
12037         Update second constructor to store the rank correctly.
12038
12039 2001-11-16  Ravi Pratap  <ravi@ximian.com>
12040
12041         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
12042         and try to implement.
12043
12044         * ../errors/cs0150.cs : Add.
12045
12046         * ../errors/cs0178.cs : Add.
12047
12048 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
12049
12050         * statement.cs: Implement foreach on multi-dimensional arrays. 
12051
12052         * parameter.cs (Parameters.GetParameterByName): Also lookup the
12053         name of the params argument.
12054
12055         * expression.cs: Use EmitStoreOpcode to get the right opcode while
12056         initializing the array.
12057
12058         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
12059         we can use this elsewhere.
12060
12061         * statement.cs: Finish implementation of foreach for single
12062         dimension arrays.
12063
12064         * cs-parser.jay: Use an out-of-band stack to pass information
12065         around, I wonder why I need this.
12066
12067         foreach_block: Make the new foreach_block the current_block.
12068
12069         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
12070         function used to return a static Parameters structure.  Used for
12071         empty parameters, as those are created very frequently.
12072
12073         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
12074
12075 2001-11-15  Ravi Pratap  <ravi@ximian.com>
12076
12077         * interface.cs : Default modifier is private, not public. The
12078         make verify test passes again.
12079
12080 2001-11-15  Ravi Pratap  <ravi@ximian.com>
12081
12082         * support.cs (ReflectionParameters): Fix logic to determine
12083         whether the last parameter is a params one. Test 9 passes again.
12084
12085         * delegate.cs (Populate): Register the builders we define with
12086         RegisterParameterForBuilder. Test 19 passes again.
12087
12088         * cs-parser.jay (property_declaration): Reference $6 instead
12089         of $$ to get at the location.
12090
12091         (indexer_declaration): Similar stuff.
12092
12093         (attribute): Ditto.
12094
12095         * class.cs (Property): Register parameters for the Get and Set methods
12096         if they exist. Test 23 passes again.
12097
12098         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
12099         call to EmitArguments as we are sure there aren't any params arguments. 
12100         Test 32 passes again.
12101
12102         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
12103         IndexOutOfRangeException. 
12104
12105         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
12106         Test 33 now passes again.
12107
12108 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
12109
12110         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
12111         broke a bunch of things.  Will have to come up with a better way
12112         of tracking locations.
12113
12114         * statement.cs: Implemented foreach for single dimension arrays.
12115
12116 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
12117
12118         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
12119         an error.  This removes the lookup from the critical path.
12120
12121         * cs-parser.jay: Removed use of temporary_loc, which is completely
12122         broken. 
12123
12124 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
12125
12126         * support.cs (ReflectionParameters.ParameterModifier): Report
12127         whether the argument is a PARAMS argument or not.
12128
12129         * class.cs: Set the attribute `ParamArrayAttribute' on the
12130         parameter argument.
12131
12132         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
12133         and cons_param_array_attribute (ConstructorInfo for
12134         ParamArrayAttribute)., 
12135
12136         * codegen.cs: Emit the return using the `Return' statement, that
12137         way we can report the error correctly for missing return values. 
12138
12139         * class.cs (Method.Emit): Clean up.
12140
12141         * expression.cs (Argument.Resolve): Take another argument: the
12142         location where this argument is used.  Notice that this is not
12143         part of the "Argument" class as to reduce the size of the
12144         structure (we know the approximate location anyways).
12145
12146         Test if the argument is a variable-reference, if not, then
12147         complain with a 206.
12148
12149         (Argument.Emit): Emit addresses of variables.
12150
12151         (Argument.FullDesc): Simplify.
12152
12153         (Invocation.DoResolve): Update for Argument.Resolve.
12154
12155         (ElementAccess.DoResolve): ditto.
12156
12157         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
12158         method should be virtual, as this method is always virtual.
12159
12160         (NewDelegate.DoResolve): Update for Argument.Resolve.
12161
12162         * class.cs (ConstructorInitializer.DoResolve): ditto.
12163
12164         * attribute.cs (Attribute.Resolve): ditto.
12165
12166 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
12167
12168         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
12169
12170         * expression.cs (ParameterReference): Drop IStackStorage and implement
12171         IAssignMethod instead. 
12172
12173         (LocalVariableReference): ditto.
12174
12175         * ecore.cs (FieldExpr): Drop IStackStorage and implement
12176         IAssignMethod instead. 
12177
12178 2001-11-13  Miguel de Icaza <miguel@ximian.com>
12179
12180         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
12181         enumerations that are used in heavily used structures derive from
12182         byte in a laughable and pathetic attempt to reduce memory usage.
12183         This is the kind of pre-optimzations that you should not do at
12184         home without adult supervision.
12185
12186         * expression.cs (UnaryMutator): New class, used to handle ++ and
12187         -- separatedly from the other unary operators.  Cleans up the
12188         code, and kills the ExpressionStatement dependency in Unary.
12189
12190         (Unary): Removed `method' and `Arguments' from this class, making
12191         it smaller, and moving it all to SimpleCall, so I can reuse this
12192         code in other locations and avoid creating a lot of transient data
12193         strucutres when not required.
12194
12195         * cs-parser.jay: Adjust for new changes.
12196
12197 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
12198
12199         * enum.cs (Enum.Populate): If there is a failure during
12200         definition, return
12201
12202         * cs-parser.jay (opt_enum_base): we used to catch type errors
12203         here, but this is really incorrect.  The type error should be
12204         catched during semantic analysis.
12205
12206 2001-12-11  Ravi Pratap  <ravi@ximian.com>
12207
12208         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
12209         current_local_parameters as expected since I, in my stupidity, had forgotten
12210         to do this :-)
12211
12212         * attribute.cs (GetValidPlaces): Fix stupid bug.
12213
12214         * class.cs (Method::Emit): Perform check on applicability of attributes.
12215
12216         (Constructor::Emit): Ditto.
12217
12218         (Field::Emit): Ditto.
12219
12220         (Field.Location): Store location information.
12221
12222         (Property, Event, Indexer, Operator): Ditto.
12223
12224         * cs-parser.jay (field_declaration): Pass in location for each field.
12225
12226         * ../errors/cs0592.cs : Add.
12227
12228 2001-11-12  Ravi Pratap  <ravi@ximian.com>
12229
12230         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
12231
12232         (InitCoreTypes): Update accordingly.
12233
12234         (RegisterAttrType, LookupAttr): Implement.
12235
12236         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
12237         info about the same.
12238
12239         (Resolve): Update to populate the above as necessary.
12240
12241         (Error592): Helper.
12242
12243         (GetValidPlaces): Helper to the above.
12244
12245         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
12246
12247         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
12248
12249 2001-11-12  Ravi Pratap  <ravi@ximian.com>
12250
12251         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
12252
12253         * ../errors/cs0617.cs : Add.
12254
12255 2001-11-11  Ravi Pratap  <ravi@ximian.com>
12256
12257         * enum.cs (Emit): Rename to Populate to be more consistent with what
12258         we expect it to do and when exactly it is called.
12259
12260         * class.cs, rootcontext.cs : Update accordingly.
12261
12262         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
12263         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
12264
12265         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
12266
12267         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
12268         of a fieldinfo using the above, when dealing with a FieldBuilder.
12269
12270 2001-11-10  Ravi Pratap  <ravi@ximian.com>
12271
12272         * ../errors/cs0031.cs : Add.
12273
12274         * ../errors/cs1008.cs : Add.
12275
12276         * ../errrors/cs0543.cs : Add.
12277
12278         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
12279         enum type.
12280
12281         (FindMembers): Implement.
12282
12283         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
12284         enums and delegates too.
12285
12286         (enum_types): Rename to builder_to_enum.
12287
12288         (delegate_types): Rename to builder_to_delegate.
12289
12290         * delegate.cs (FindMembers): Implement.
12291
12292 2001-11-09  Ravi Pratap  <ravi@ximian.com>
12293
12294         * typemanager.cs (IsEnumType): Implement.
12295
12296         * enum.cs (Emit): Re-write parts to account for the underlying type
12297         better and perform checking etc.
12298
12299         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
12300         of the underlying type.
12301
12302         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
12303         value
12304
12305         * enum.cs (error31): Helper to report error #31.
12306
12307         * cs-parser.jay (enum_declaration): Store location of each member too.
12308
12309         * enum.cs (member_to_location): New hashtable. 
12310
12311         (AddEnumMember): Update location hashtable.
12312
12313         (Emit): Use the location of each member while reporting errors.
12314
12315 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
12316
12317         * cs-parser.jay: A for_initializer if is a
12318         local_variable_declaration really ammount to have an implicit
12319         block with the variable declaration and no initializer for for.
12320
12321         * statement.cs (For.Emit): Cope with null initializers.
12322
12323         This fixes the infinite loop on for initializers.
12324
12325 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
12326
12327         * enum.cs: More cleanup.
12328
12329         * ecore.cs: Remove dead code.
12330
12331         * class.cs (Property.Emit): More simplification.
12332         (Event.Emit): ditto.
12333
12334         Reworked to have less levels of indentation.
12335
12336 2001-11-08  Ravi Pratap  <ravi@ximian.com>
12337
12338         * class.cs (Property): Emit attributes.
12339
12340         (Field): Ditto.
12341
12342         (Event): Ditto.
12343
12344         (Indexer): Ditto.
12345
12346         (Operator): Ditto.
12347
12348         * enum.cs (Emit): Ditto.
12349
12350         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
12351         Enums too.
12352
12353         * class.cs (Field, Event, etc.): Move attribute generation into the
12354         Emit method everywhere.
12355
12356         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
12357         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
12358         as we had no way of defining nested enums !
12359
12360         * rootcontext.cs : Adjust code accordingly.
12361
12362         * typemanager.cs (AddEnumType): To keep track of enum types separately.
12363
12364 2001-11-07  Ravi Pratap  <ravi@ximian.com>
12365
12366         * expression.cs (EvalConstantExpression): Move into ecore.cs
12367
12368         * enum.cs (Enum): Rename some members and make them public and readonly
12369         according to our convention.
12370
12371         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
12372         nothing else.
12373
12374         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
12375
12376         (Enum::Emit): Write a simple version for now which doesn't try to compute
12377         expressions. I shall modify this to be more robust in just a while.
12378
12379         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
12380
12381         (TypeContainer::CloseType): Create the Enum types too.
12382
12383         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
12384
12385         * expression.cs (EvalConstantExpression): Get rid of completely.
12386
12387         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
12388         user-defined values and other cases.
12389
12390         (IsValidEnumLiteral): Helper function.
12391
12392         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
12393         out there in the case we had a literal FieldExpr.
12394
12395         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
12396
12397         (Literalize): Revamp a bit to take two arguments.
12398
12399         (EnumLiteral): New class which derives from Literal to wrap enum literals.
12400
12401 2001-11-06  Ravi Pratap  <ravi@ximian.com>
12402
12403         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
12404
12405         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
12406
12407         (Resolve): Use the above to ensure we have proper initializers.
12408
12409 2001-11-05  Ravi Pratap  <ravi@ximian.com>
12410
12411         * expression.cs (Expression::EvalConstantExpression): New method to 
12412         evaluate constant expressions.
12413
12414         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
12415
12416 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
12417
12418         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
12419         in an array.
12420
12421         (Binary.ResolveOperator): Handle operator != (object a, object b)
12422         and operator == (object a, object b);
12423
12424         (Binary.DoNumericPromotions): Indicate whether the numeric
12425         promotion was possible.
12426
12427         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
12428         Implement.  
12429
12430         Made the ArrayAccess implement interface IAssignMethod instead of
12431         IStackStore as the order in which arguments are passed reflects
12432         this.
12433
12434         * assign.cs: Instead of using expr.ExprClass to select the way of
12435         assinging, probe for the IStackStore/IAssignMethod interfaces.
12436
12437         * typemanager.cs: Load InitializeArray definition.
12438
12439         * rootcontext.cs (RootContext.MakeStaticData): Used to define
12440         static data that can be used to initialize arrays. 
12441
12442 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
12443
12444         * expression.cs: Handle operator== and operator!= for booleans.
12445
12446         (Conditioal.Reduce): Implement reducer for the ?: operator.
12447
12448         (Conditional.Resolve): Implement dead code elimination.
12449
12450         (Binary.Resolve): Catch string literals and return a new
12451         concatenated string.
12452
12453         (Unary.Reduce): Implement reduction of unary expressions.
12454
12455         * ecore.cs: Split out the expression core handling here.
12456
12457         (Expression.Reduce): New method used to perform constant folding
12458         and CSE.  This is needed to support constant-expressions. 
12459
12460         * statement.cs (Statement.EmitBoolExpression): Pass true and false
12461         targets, and optimize for !x.
12462
12463 2001-11-04  Ravi Pratap  <ravi@ximian.com>
12464
12465         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
12466         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
12467         set custom atttributes.
12468
12469         * literal.cs (Literal::GetValue): New abstract method to return the actual
12470         value of the literal, cast as an object.
12471
12472         (*Literal): Implement GetValue method.
12473
12474         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
12475         expressions to the arraylist but objects of type Argument.
12476
12477         * class.cs (TypeContainer::Emit): Emit our attributes too.
12478
12479         (Method::Emit, Constructor::Emit): Ditto.
12480
12481         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
12482         to be ignoring earlier.
12483
12484 2001-11-03  Ravi Pratap  <ravi@ximian.com>
12485
12486         * attribute.cs (AttributeSection::Define): Implement to do the business
12487         of constructing a CustomAttributeBuilder.
12488
12489         (Attribute): New trivial class. Increases readability of code.  
12490
12491         * cs-parser.jay : Update accordingly.
12492
12493         (positional_argument_list, named_argument_list, named_argument): New rules
12494
12495         (attribute_arguments): Use the above so that we are more correct.
12496
12497 2001-11-02  Ravi Pratap  <ravi@ximian.com>
12498
12499         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
12500         to perform all checks for a method with a params parameter.
12501
12502         (Invocation::OverloadResolve): Update to use the above method and therefore
12503         cope correctly with params method invocations.
12504
12505         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
12506         params too.
12507
12508         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
12509         constructors in our parent too because we can't afford to miss out on 
12510         protected ones ;-)
12511
12512         * attribute.cs (AttributeSection): New name for the class Attribute
12513
12514         Other trivial changes to improve readability.
12515
12516         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
12517         use the new class names.
12518
12519 2001-11-01  Ravi Pratap  <ravi@ximian.com>
12520
12521         * class.cs (Method::Define): Complete definition for params types too
12522
12523         (Indexer::Define): Ditto.
12524
12525         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
12526         Cope everywhere with a request for info about the array parameter.
12527
12528 2001-11-01  Ravi Pratap  <ravi@ximian.com>
12529
12530         * tree.cs (RecordNamespace): Fix up to check for the correct key.
12531
12532         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
12533         local_variable_type to extract the string corresponding to the type.
12534
12535         (local_variable_type): Fixup the action to use the new helper method.
12536
12537         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
12538         go.
12539
12540         * expression.cs : Clean out code which uses the above.
12541
12542 2001-10-31  Ravi Pratap  <ravi@ximian.com>
12543
12544         * typemanager.cs (RegisterMethod): Check if we already have an existing key
12545         and bale out if necessary by returning a false.
12546
12547         (RegisterProperty): Ditto.
12548
12549         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
12550         and print out appropriate error messages.
12551
12552         * interface.cs (everywhere): Ditto.
12553
12554         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
12555         location to constructor.
12556
12557         * class.cs (Property, Event, Indexer): Update accordingly.
12558
12559         * ../errors/cs111.cs : Added.
12560
12561         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
12562         of a method, as laid down by the spec.
12563
12564         (Invocation::OverloadResolve): Use the above method.
12565
12566 2001-10-31  Ravi Pratap  <ravi@ximian.com>
12567
12568         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
12569         now take a TypeContainer and a Parameters object.
12570
12571         (ParameterData): Modify return type of ParameterModifier method to be 
12572         Parameter.Modifier and not a string.
12573
12574         (ReflectionParameters, InternalParameters): Update accordingly.
12575
12576         * expression.cs (Argument::GetParameterModifier): Same here.
12577
12578         * support.cs (InternalParameters::ParameterType): Find a better way of determining
12579         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
12580         symbol in it at all so maybe this is only for now.
12581
12582 2001-10-30  Ravi Pratap  <ravi@ximian.com>
12583
12584         * support.cs (InternalParameters): Constructor now takes an extra argument 
12585         which is the actual Parameters class.
12586
12587         (ParameterDesc): Update to provide info on ref/out modifiers.
12588
12589         * class.cs (everywhere): Update call to InternalParameters to pass in
12590         the second argument too.
12591
12592         * support.cs (ParameterData): Add ParameterModifier, which is a method 
12593         to return the modifier info [ref/out etc]
12594
12595         (InternalParameters, ReflectionParameters): Implement the above.
12596
12597         * expression.cs (Argument::ParameterModifier): Similar function to return
12598         info about the argument's modifiers.
12599
12600         (Invocation::OverloadResolve): Update to take into account matching modifiers 
12601         too.
12602
12603         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
12604         a new SetFormalParameters object which we pass to InternalParameters.
12605
12606 2001-10-30  Ravi Pratap  <ravi@ximian.com>
12607
12608         * expression.cs (NewArray): Merge into the ArrayCreation class.
12609
12610 2001-10-29  Ravi Pratap  <ravi@ximian.com>
12611
12612         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
12613         NewUserdefinedArray into one as there wasn't much of a use in having
12614         two separate ones.
12615
12616         * expression.cs (Argument): Change field's name to ArgType from Type.
12617
12618         (Type): New readonly property which returns the proper type, taking into 
12619         account ref/out modifiers.
12620
12621         (everywhere): Adjust code accordingly for the above.
12622
12623         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
12624         whether we are emitting for a ref or out parameter.
12625
12626         * expression.cs (Argument::Emit): Use the above field to set the state.
12627
12628         (LocalVariableReference::Emit): Update to honour the flag and emit the
12629         right stuff.
12630
12631         * parameter.cs (Attributes): Set the correct flags for ref parameters.
12632
12633         * expression.cs (Argument::FullDesc): New function to provide a full desc.
12634
12635         * support.cs (ParameterData): Add method ParameterDesc to the interface.
12636
12637         (ReflectionParameters, InternalParameters): Implement the above method.
12638
12639         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
12640         reporting errors.
12641
12642         (Invocation::FullMethodDesc): Ditto. 
12643
12644 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
12645
12646         * cs-parser.jay: Add extra production for the second form of array
12647         creation. 
12648
12649         * expression.cs (ArrayCreation): Update to reflect the above
12650         change. 
12651
12652         * Small changes to prepare for Array initialization.
12653
12654 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
12655
12656         * typemanager.cs (ImplementsInterface): interface might be null;
12657         Deal with this problem;
12658
12659         Also, we do store negative hits on the cache (null values), so use
12660         this instead of calling t.GetInterfaces on the type everytime.
12661
12662 2001-10-28  Ravi Pratap  <ravi@ximian.com>
12663
12664         * typemanager.cs (IsBuiltinType): New method to help determine the same.
12665
12666         * expression.cs (New::DoResolve): Get rid of array creation code and instead
12667         split functionality out into different classes.
12668
12669         (New::FormArrayType): Move into NewBuiltinArray.
12670
12671         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
12672         quite useless.
12673
12674         (NewBuiltinArray): New class to handle creation of built-in arrays.
12675
12676         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
12677         account creation of one-dimensional arrays.
12678
12679         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
12680
12681         (NewUserdefinedArray::DoResolve): Implement.
12682
12683         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
12684
12685         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
12686         we maintain inside the TypeManager. This is necessary to perform lookups on the
12687         module builder.
12688
12689         (LookupType): Update to perform GetType on the module builders too.     
12690
12691         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
12692
12693         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
12694
12695 2001-10-23  Ravi Pratap  <ravi@ximian.com>
12696
12697         * expression.cs (New::DoResolve): Implement guts of array creation.
12698
12699         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
12700
12701 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
12702
12703         * expression.cs: Fix bug I introduced lsat night that broke
12704         Delegates. 
12705
12706         (Expression.Resolve): Report a 246 error (can not resolve name)
12707         if we find a SimpleName in the stream.
12708
12709         (Expression.ResolveLValue): Ditto.
12710
12711         (Expression.ResolveWithSimpleName): This function is a variant of
12712         ResolveName, this one allows SimpleNames to be returned without a
12713         warning.  The only consumer of SimpleNames is MemberAccess
12714
12715 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
12716
12717         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
12718         might arrive here.  I have my doubts that this is correct.
12719
12720         * statement.cs (Lock): Implement lock statement.
12721
12722         * cs-parser.jay: Small fixes to support `lock' and `using'
12723
12724         * cs-tokenizer.cs: Remove extra space
12725
12726         * driver.cs: New flag --checked, allows to turn on integer math
12727         checking. 
12728
12729         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
12730         Threading.Monitor.Exit 
12731
12732 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
12733
12734         * expression.cs (IndexerAccess::DoResolveLValue): Set the
12735         Expression Class to be IndexerAccess.
12736
12737         Notice that Indexer::DoResolve sets the eclass to Value.
12738
12739 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
12740
12741         * class.cs (TypeContainer::Emit): Emit code for indexers.
12742
12743         * assign.cs (IAssignMethod): New interface implemented by Indexers
12744         and Properties for handling assignment.
12745
12746         (Assign::Emit): Simplify and reuse code. 
12747
12748         * expression.cs (IndexerAccess, PropertyExpr): Implement
12749         IAssignMethod, clean up old code. 
12750
12751 2001-10-22  Ravi Pratap  <ravi@ximian.com>
12752
12753         * typemanager.cs (ImplementsInterface): New method to determine if a type
12754         implements a given interface. Provides a nice cache too.
12755
12756         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
12757         method.
12758
12759         (ConvertReferenceExplicit): Ditto.
12760
12761         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
12762         various methods, with correct names etc.
12763
12764         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
12765         Operator.UnaryNegation.
12766
12767         * cs-parser.jay (operator_declarator): Be a little clever in the case where
12768         we have a unary plus or minus operator.
12769
12770         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
12771         UnaryMinus.
12772
12773         * everywhere : update accordingly.
12774
12775         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
12776         respectively.
12777
12778         * class.cs (Method::Define): For the case where we are implementing a method
12779         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
12780         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
12781
12782 2001-10-21  Ravi Pratap  <ravi@ximian.com>
12783
12784         * interface.cs (FindMembers): Implement to work around S.R.E
12785         lameness.
12786
12787         * typemanager.cs (IsInterfaceType): Implement.
12788
12789         (FindMembers): Update to handle interface types too.
12790
12791         * expression.cs (ImplicitReferenceConversion): Re-write bits which
12792         use IsAssignableFrom as that is not correct - it doesn't work.
12793
12794         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
12795         and accordingly override EmitStatement.
12796
12797         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
12798         using the correct logic :-)
12799
12800 2001-10-19  Ravi Pratap  <ravi@ximian.com>
12801
12802         * ../errors/cs-11.cs : Add to demonstrate error -11 
12803
12804 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
12805
12806         * assign.cs (Assign::Resolve): Resolve right hand side first, and
12807         then pass this as a hint to ResolveLValue.
12808
12809         * expression.cs (FieldExpr): Add Location information
12810
12811         (FieldExpr::LValueResolve): Report assignment to readonly
12812         variable. 
12813
12814         (Expression::ExprClassFromMemberInfo): Pass location information.
12815
12816         (Expression::ResolveLValue): Add new method that resolves an
12817         LValue. 
12818
12819         (Expression::DoResolveLValue): Default invocation calls
12820         DoResolve. 
12821
12822         (Indexers): New class used to keep track of indexers in a given
12823         Type. 
12824
12825         (IStackStore): Renamed from LValue, as it did not really describe
12826         what this did.  Also ResolveLValue is gone from this interface and
12827         now is part of Expression.
12828
12829         (ElementAccess): Depending on the element access type
12830
12831         * typemanager.cs: Add `indexer_name_type' as a Core type
12832         (System.Runtime.CompilerServices.IndexerNameAttribute)
12833
12834         * statement.cs (Goto): Take a location.
12835
12836 2001-10-18  Ravi Pratap  <ravi@ximian.com>
12837
12838         * delegate.cs (Delegate::VerifyDelegate): New method to verify
12839         if two delegates are compatible.
12840
12841         (NewDelegate::DoResolve): Update to take care of the case when
12842         we instantiate a delegate from another delegate.
12843
12844         * typemanager.cs (FindMembers): Don't even try to look up members
12845         of Delegate types for now.
12846
12847 2001-10-18  Ravi Pratap  <ravi@ximian.com>
12848
12849         * delegate.cs (NewDelegate): New class to take care of delegate
12850         instantiation.
12851
12852         * expression.cs (New): Split the delegate related code out into 
12853         the NewDelegate class.
12854
12855         * delegate.cs (DelegateInvocation): New class to handle delegate 
12856         invocation.
12857
12858         * expression.cs (Invocation): Split out delegate related code into
12859         the DelegateInvocation class.
12860
12861 2001-10-17  Ravi Pratap  <ravi@ximian.com>
12862
12863         * expression.cs (New::DoResolve): Implement delegate creation fully
12864         and according to the spec.
12865
12866         (New::DoEmit): Update to handle delegates differently.
12867
12868         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
12869         because of which we were printing out arguments in reverse order !
12870
12871         * delegate.cs (VerifyMethod): Implement to check if the given method
12872         matches the delegate.
12873
12874         (FullDelegateDesc): Implement.
12875
12876         (VerifyApplicability): Implement.
12877
12878         * expression.cs (Invocation::DoResolve): Update to accordingly handle
12879         delegate invocations too.
12880
12881         (Invocation::Emit): Ditto.
12882
12883         * ../errors/cs1593.cs : Added.
12884
12885         * ../errors/cs1594.cs : Added.
12886
12887         * delegate.cs (InstanceExpression, TargetMethod): New properties.
12888
12889 2001-10-16  Ravi Pratap  <ravi@ximian.com>
12890
12891         * typemanager.cs (intptr_type): Core type for System.IntPtr
12892
12893         (InitCoreTypes): Update for the same.
12894
12895         (iasyncresult_type, asynccallback_type): Ditto.
12896
12897         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
12898         correct.
12899
12900         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
12901         too.
12902
12903         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
12904         the builders for the 4 members of a delegate type :-)
12905
12906         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
12907         type.
12908
12909         * expression.cs (New::DoResolve): Implement guts for delegate creation.
12910
12911         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
12912
12913 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
12914
12915         * statement.cs (Break::Emit): Implement.   
12916         (Continue::Emit): Implement.
12917
12918         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12919         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12920         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12921         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
12922         end loop
12923
12924         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
12925         properties that track the label for the current loop (begin of the
12926         loop and end of the loop).
12927
12928 2001-10-15  Ravi Pratap  <ravi@ximian.com>
12929
12930         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
12931         use of emitting anything at all.
12932
12933         * class.cs, rootcontext.cs : Get rid of calls to the same.
12934
12935         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
12936
12937         (Populate): Define the constructor correctly and set the implementation
12938         attributes.
12939
12940         * typemanager.cs (delegate_types): New hashtable to hold delegates that
12941         have been defined.
12942
12943         (AddDelegateType): Implement.
12944
12945         (IsDelegateType): Implement helper method.
12946
12947         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
12948
12949         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
12950         and accordingly handle it.
12951
12952         * delegate.cs (Populate): Take TypeContainer argument.
12953         Implement bits to define the Invoke method. However, I still haven't figured out
12954         how to take care of the native int bit :-(
12955
12956         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
12957         Qualify the name of the delegate, not its return type !
12958
12959         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
12960         conversion.
12961
12962         (StandardConversionExists): Checking for array types turns out to be recursive.
12963
12964         (ConvertReferenceExplicit): Implement array conversion.
12965
12966         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
12967
12968 2001-10-12  Ravi Pratap  <ravi@ximian.com>
12969
12970         * cs-parser.jay (delegate_declaration): Store the fully qualified
12971         name as it is a type declaration.
12972
12973         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
12974         readonly.
12975
12976         (DefineDelegate): Renamed from Define. Does the same thing essentially,
12977         as TypeContainer::DefineType.
12978
12979         (Populate): Method in which all the definition of the various methods (Invoke)
12980         etc is done.
12981
12982         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
12983         see.
12984
12985         (CloseDelegate): Finally creates the delegate.
12986
12987         * class.cs (TypeContainer::DefineType): Update to define delegates.
12988         (Populate, Emit and CloseType): Do the same thing here too.
12989
12990         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
12991         delegates in all these operations.
12992
12993 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
12994
12995         * expression.cs: LocalTemporary: a new expression used to
12996         reference a temporary that has been created.
12997
12998         * assign.cs: Handle PropertyAccess back here, so that we can
12999         provide the proper semantic access to properties.
13000
13001         * expression.cs (Expression::ConvertReferenceExplicit): Implement
13002         a few more explicit conversions. 
13003
13004         * modifiers.cs: `NEW' modifier maps to HideBySig.
13005
13006         * expression.cs (PropertyExpr): Make this into an
13007         ExpressionStatement, and support the EmitStatement code path. 
13008
13009         Perform get/set error checking, clean up the interface.
13010
13011         * assign.cs: recognize PropertyExprs as targets, and if so, turn
13012         them into toplevel access objects.
13013
13014 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
13015
13016         * expression.cs: PropertyExpr::PropertyExpr: use work around the
13017         SRE.
13018
13019         * typemanager.cs: Keep track here of our PropertyBuilders again to
13020         work around lameness in SRE.
13021
13022 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
13023
13024         * expression.cs (LValue::LValueResolve): New method in the
13025         interface, used to perform a second resolution pass for LValues. 
13026
13027         (This::DoResolve): Catch the use of this in static methods.
13028
13029         (This::LValueResolve): Implement.
13030
13031         (This::Store): Remove warning, assigning to `this' in structures
13032         is 
13033
13034         (Invocation::Emit): Deal with invocation of
13035         methods on value types.  We need to pass the address to structure
13036         methods rather than the object itself.  (The equivalent code to
13037         emit "this" for structures leaves the entire structure on the
13038         stack instead of a pointer to it). 
13039
13040         (ParameterReference::DoResolve): Compute the real index for the
13041         argument based on whether the method takes or not a `this' pointer
13042         (ie, the method is static).
13043
13044         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
13045         value types returned from functions when we need to invoke a
13046         method on the sturcture.
13047
13048
13049 2001-10-11  Ravi Pratap  <ravi@ximian.com>
13050
13051         * class.cs (TypeContainer::DefineType): Method to actually do the business of
13052         defining the type in the Modulebuilder or Typebuilder. This is to take
13053         care of nested types which need to be defined on the TypeBuilder using
13054         DefineNestedMethod.
13055
13056         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
13057         methods in RootContext, only ported to be part of TypeContainer.
13058
13059         (TypeContainer::GetInterfaceOrClass): Ditto.
13060
13061         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
13062
13063         * interface.cs (Interface::DefineInterface): New method. Does exactly
13064         what RootContext.CreateInterface did earlier, only it takes care of nested types 
13065         too.
13066
13067         (Interface::GetInterfaces): Move from RootContext here and port.
13068
13069         (Interface::GetInterfaceByName): Same here.
13070
13071         * rootcontext.cs (ResolveTree): Re-write.
13072
13073         (PopulateTypes): Re-write.
13074
13075         * class.cs (TypeContainer::Populate): Populate nested types too.
13076         (TypeContainer::Emit): Emit nested members too.
13077
13078         * typemanager.cs (AddUserType): Do not make use of the FullName property,
13079         instead just use the name argument passed in as it is already fully
13080         qualified.
13081
13082         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
13083         to TypeContainer mapping to see if a type is user-defined.
13084
13085         * class.cs (TypeContainer::CloseType): Implement. 
13086
13087         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
13088         the default constructor.
13089
13090         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
13091         twice.
13092
13093         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
13094
13095         * interface.cs (CloseType): Create the type here.
13096
13097         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
13098         the hierarchy.
13099
13100         Remove all the methods which are now in TypeContainer.
13101
13102 2001-10-10  Ravi Pratap  <ravi@ximian.com>
13103
13104         * delegate.cs (Define): Re-write bits to define the delegate
13105         correctly.
13106
13107 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
13108
13109         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
13110
13111         * expression.cs (ImplicitReferenceConversion): handle null as well
13112         as a source to convert to any reference type.
13113
13114         * statement.cs (Return): Perform any implicit conversions to
13115         expected return type.  
13116
13117         Validate use of return statement.  
13118
13119         * codegen.cs (EmitContext): Pass the expected return type here.
13120
13121         * class.cs (Method, Constructor, Property): Pass expected return
13122         type to EmitContext.
13123
13124 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
13125
13126         * expression.cs: Make DoResolve take an EmitContext instead of a
13127         TypeContainer.
13128
13129         Replaced `l' and `location' for `loc', for consistency.
13130
13131         (Error, Warning): Remove unneeded Tc argument.
13132
13133         * assign.cs, literal.cs, constant.cs: Update to new calling
13134         convention. 
13135
13136         * codegen.cs: EmitContext now contains a flag indicating whether
13137         code is being generated in a static method or not.
13138
13139         * cs-parser.jay: DecomposeQI, new function that replaces the old
13140         QualifiedIdentifier.  Now we always decompose the assembled
13141         strings from qualified_identifier productions into a group of
13142         memberaccesses.
13143
13144 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
13145
13146         * rootcontext.cs: Deal with field-less struct types correctly now
13147         by passing the size option to Define Type.
13148
13149         * class.cs: Removed hack that created one static field. 
13150
13151 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
13152
13153         * statement.cs: Moved most of the code generation here. 
13154
13155 2001-10-09  Ravi Pratap  <ravi@ximian.com>
13156
13157         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
13158         seem very right.
13159
13160         (ElementAccess): Remove useless bits for now - keep checks as the spec
13161         says.
13162
13163 2001-10-08  Ravi Pratap  <ravi@ximian.com>
13164
13165         * expression.cs (ElementAccess::DoResolve): Remove my crap code
13166         and start performing checks according to the spec.
13167
13168 2001-10-07  Ravi Pratap  <ravi@ximian.com>
13169
13170         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
13171         rank_specifiers instead.
13172
13173         (rank_specifiers): Change the order in which the rank specifiers are stored
13174
13175         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
13176
13177         * expression.cs (ElementAccess): Implement the LValue interface too.
13178
13179 2001-10-06  Ravi Pratap  <ravi@ximian.com>
13180
13181         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
13182         except that user defined conversions are not included.
13183
13184         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
13185         perform the conversion of the return type, if necessary.
13186
13187         (New::DoResolve): Check whether we are creating an array or an object
13188         and accordingly do the needful.
13189
13190         (New::Emit): Same here.
13191
13192         (New::DoResolve): Implement guts of array creation.
13193
13194         (New::FormLookupType): Helper function.
13195
13196 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
13197
13198         * codegen.cs: Removed most of the code generation here, and move the
13199         corresponding code generation bits to the statement classes. 
13200
13201         Added support for try/catch/finalize and throw.
13202
13203         * cs-parser.jay: Added support for try/catch/finalize.
13204
13205         * class.cs: Catch static methods having the flags override,
13206         virtual or abstract.
13207
13208         * expression.cs (UserCast): This user cast was not really doing
13209         what it was supposed to do.  Which is to be born in fully resolved
13210         state.  Parts of the resolution were being performed at Emit time! 
13211
13212         Fixed this code.
13213
13214 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
13215
13216         * expression.cs: Implicity convert the result from UserCast.
13217
13218 2001-10-05  Ravi Pratap  <ravi@ximian.com>
13219
13220         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
13221         prevented it from working correctly. 
13222
13223         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
13224         merely ConvertImplicit.
13225
13226 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
13227
13228         * typemanager.cs: Make the LookupTypeContainer function static,
13229         and not per-instance.  
13230
13231         * class.cs: Make static FindMembers (the one that takes a Type
13232         argument). 
13233
13234         * codegen.cs: Add EmitForeach here.
13235
13236         * cs-parser.jay: Make foreach a toplevel object instead of the
13237         inline expansion, as we need to perform semantic analysis on it. 
13238
13239 2001-10-05  Ravi Pratap  <ravi@ximian.com>
13240
13241         * expression.cs (Expression::ImplicitUserConversion): Rename to
13242         UserDefinedConversion.
13243
13244         (Expression::UserDefinedConversion): Take an extra argument specifying 
13245         whether we look for explicit user conversions too.
13246
13247         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
13248
13249         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
13250
13251         (ExplicitUserConversion): Make it a call to UserDefinedConversion
13252         with the appropriate arguments.
13253
13254         * cs-parser.jay (cast_expression): Record location too.
13255
13256         * expression.cs (Cast): Record location info.
13257
13258         (Expression::ConvertExplicit): Take location argument.
13259
13260         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
13261         to determine if we are doing explicit conversions.
13262
13263         (UserCast::Emit): Update accordingly.
13264
13265         (Expression::ConvertExplicit): Report an error if everything fails.
13266
13267         * ../errors/cs0030.cs : Add.
13268
13269 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
13270
13271         * modifiers.cs: If the ABSTRACT keyword is present, also set the
13272         virtual and newslot bits. 
13273
13274         * class.cs (TypeContainer::RegisterRequiredImplementations):
13275         Record methods we need.
13276
13277         (TypeContainer::MakeKey): Helper function to make keys for
13278         MethodBases, since the Methodbase key is useless.
13279
13280         (TypeContainer::Populate): Call RegisterRequiredImplementations
13281         before defining the methods.   
13282
13283         Create a mapping for method_builders_to_methods ahead of time
13284         instead of inside a tight loop.
13285
13286         (::RequireMethods):  Accept an object as the data to set into the
13287         hashtable so we can report interface vs abstract method mismatch.
13288
13289 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
13290
13291         * report.cs: Make all of it static.
13292
13293         * rootcontext.cs: Drop object_type and value_type computations, as
13294         we have those in the TypeManager anyways.
13295
13296         Drop report instance variable too, now it is a global.
13297
13298         * driver.cs: Use try/catch on command line handling.
13299
13300         Add --probe option to debug the error reporting system with a test
13301         suite. 
13302
13303         * report.cs: Add support for exiting program when a probe
13304         condition is reached.
13305
13306 2001-10-03  Ravi Pratap  <ravi@ximian.com>
13307
13308         * expression.cs (Binary::DoNumericPromotions): Fix the case when
13309         we do a forcible conversion regardless of type, to check if 
13310         ForceConversion returns a null.
13311
13312         (Binary::error19): Use location to report error.
13313
13314         (Unary::error23): Use location here too.
13315
13316         * ../errors/cs0019.cs : Check in.
13317
13318         * ../errors/cs0023.cs : Check in.
13319
13320         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
13321         case of a non-null MethodInfo object with a length of 0 !
13322
13323         (Binary::ResolveOperator): Flag error if overload resolution fails to find
13324         an applicable member - according to the spec :-)
13325         Also fix logic to find members in base types.
13326
13327         (Unary::ResolveOperator): Same here.
13328
13329         (Unary::report23): Change name to error23 and make first argument a TypeContainer
13330         as I was getting thoroughly confused between this and error19 :-)
13331
13332         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
13333         (::FindMostEncompassedType): Implement.
13334         (::FindMostEncompassingType): Implement.
13335         (::StandardConversionExists): Implement.
13336
13337         (UserImplicitCast): Re-vamp. We now need info about most specific
13338         source and target types so that we can do the necessary conversions.
13339
13340         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
13341         mathematical union with no duplicates.
13342
13343 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
13344
13345         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
13346         in order from base classes to child classes, so that we can in
13347         child classes look up in our parent for method names and
13348         attributes (required for handling abstract, virtual, new, override
13349         constructs: we need to instrospect our base class, and if we dont
13350         populate the classes in order, the introspection might be
13351         incorrect.  For example, a method could query its parent before
13352         the parent has any methods and would determine that the parent has
13353         no abstract methods (while it could have had them)).
13354
13355         (RootContext::CreateType): Record the order in which we define the
13356         classes.
13357
13358 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
13359
13360         * class.cs (TypeContainer::Populate): Also method definitions can
13361         fail now, keep track of this.
13362
13363         (TypeContainer::FindMembers): Implement support for
13364         DeclaredOnly/noDeclaredOnly flag.
13365
13366         (Constructor::Emit) Return the ConstructorBuilder.
13367
13368         (Method::Emit) Return the MethodBuilder. 
13369         Check for abstract or virtual methods to be public.
13370
13371         * rootcontext.cs (RootContext::CreateType): Register all the
13372         abstract methods required for the class to be complete and the
13373         interface methods that must be implemented. 
13374
13375         * cs-parser.jay: Report error 501 (method requires body if it is
13376         not marked abstract or extern).
13377
13378         * expression.cs (TypeOf::Emit): Implement.
13379
13380         * typemanager.cs: runtime_handle_type, new global type.
13381
13382         * class.cs (Property::Emit): Generate code for properties.
13383
13384 2001-10-02  Ravi Pratap  <ravi@ximian.com>
13385
13386         * expression.cs (Unary::ResolveOperator): Find operators on base type
13387         too - we now conform exactly to the spec.
13388
13389         (Binary::ResolveOperator): Same here.
13390
13391         * class.cs (Operator::Define): Fix minor quirk in the tests.
13392
13393         * ../errors/cs0215.cs : Added.
13394
13395         * ../errors/cs0556.cs : Added.
13396
13397         * ../errors/cs0555.cs : Added.
13398
13399 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
13400
13401         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
13402         single integer which is really efficient
13403
13404 2001-10-01  Ravi Pratap  <ravi@ximian.com>
13405
13406         *  expression.cs (Expression::ImplicitUserConversion): Use location
13407         even in the case when we are examining True operators.
13408  
13409         * class.cs (Operator::Define): Perform extensive checks to conform
13410         with the rules for operator overloading in the spec.
13411
13412         * expression.cs (Expression::ImplicitReferenceConversion): Implement
13413         some of the other conversions mentioned in the spec.
13414
13415         * typemanager.cs (array_type): New static member for the System.Array built-in
13416         type.
13417
13418         (cloneable_interface): For System.ICloneable interface.
13419
13420         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
13421         we start resolving the tree and populating types.
13422
13423         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
13424  
13425 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
13426
13427         * expression.cs (Expression::ExprClassFromMemberInfo,
13428         Expression::Literalize): Create literal expressions from
13429         FieldInfos which are literals.
13430
13431         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
13432         type casts, because they were wrong.  The test suite in tests
13433         caught these ones.
13434
13435         (ImplicitNumericConversion): ushort to ulong requires a widening
13436         cast. 
13437
13438         Int32 constant to long requires widening cast as well.
13439
13440         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
13441         for integers because the type on the stack is not i4.
13442
13443 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
13444
13445         * expression.cs (report118): require location argument. 
13446
13447         * parameter.cs: Do not dereference potential null value.
13448
13449         * class.cs: Catch methods that lack the `new' keyword when
13450         overriding a name.  Report warnings when `new' is used without
13451         anything being there to override.
13452
13453         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
13454
13455         * class.cs: Only add constructor to hashtable if it is non-null
13456         (as now constructors can fail on define).
13457
13458         (TypeManager, Class, Struct): Take location arguments.
13459
13460         Catch field instance initialization in structs as errors.
13461
13462         accepting_filter: a new filter for FindMembers that is static so
13463         that we dont create an instance per invocation.
13464
13465         (Constructor::Define): Catch errors where a struct constructor is
13466         parameterless 
13467
13468         * cs-parser.jay: Pass location information for various new
13469         constructs. 
13470
13471         * delegate.cs (Delegate): take a location argument.
13472
13473         * driver.cs: Do not call EmitCode if there were problesm in the
13474         Definition of the types, as many Builders wont be there. 
13475
13476         * decl.cs (Decl::Decl): Require a location argument.
13477
13478         * cs-tokenizer.cs: Handle properly hex constants that can not fit
13479         into integers, and find the most appropiate integer for it.
13480
13481         * literal.cs: Implement ULongLiteral.
13482
13483         * rootcontext.cs: Provide better information about the location of
13484         failure when CreateType fails.
13485
13486 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
13487
13488         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
13489         as well.
13490
13491         * expression.cs (Binary::CheckShiftArguments): Add missing type
13492         computation.
13493         (Binary::ResolveOperator): Add type to the logical and and logical
13494         or, Bitwise And/Or and Exclusive Or code paths, it was missing
13495         before.
13496
13497         (Binary::DoNumericPromotions): In the case where either argument
13498         is ulong (and most signed types combined with ulong cause an
13499         error) perform implicit integer constant conversions as well.
13500
13501 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
13502
13503         * expression.cs (UserImplicitCast): Method should always be
13504         non-null. 
13505         (Invocation::BetterConversion): Simplified test for IntLiteral.
13506
13507         (Expression::ImplicitNumericConversion): Split this routine out.
13508         Put the code that performs implicit constant integer conversions
13509         here. 
13510
13511         (Expression::Resolve): Become a wrapper around DoResolve so we can
13512         check eclass and type being set after resolve.
13513
13514         (Invocation::Badness): Remove this dead function
13515
13516         (Binary::ResolveOperator): Do not compute the expensive argumnets
13517         unless we have a union for it.
13518
13519         (Probe::Emit): Is needs to do an isinst and then
13520         compare against null.
13521
13522         (::CanConvert): Added Location argument.  If the Location argument
13523         is null (Location.Null), then we do not report errors.  This is
13524         used by the `probe' mechanism of the Explicit conversion.  We do
13525         not want to generate an error for something that the user
13526         explicitly requested to be casted.  But the pipeline for an
13527         explicit cast first tests for potential implicit casts.
13528
13529         So for now, if the Location is null, it means `Probe only' to
13530         avoid adding another argument.   Might have to revise this
13531         strategy later.
13532
13533         (ClassCast): New class used to type cast objects into arbitrary
13534         classes (used in Explicit Reference Conversions).
13535
13536         Implement `as' as well.
13537
13538         Reverted all the patches from Ravi below: they were broken:
13539
13540                 * The use of `level' as a mechanism to stop recursive
13541                   invocations is wrong.  That was there just to catch the
13542                   bug with a strack trace but not as a way of addressing
13543                   the problem.
13544
13545                   To fix the problem we have to *understand* what is going
13546                   on and the interactions and come up with a plan, not
13547                   just get things going.
13548
13549                 * The use of the type conversion cache that I proposed
13550                   last night had an open topic: How does this work across
13551                   protection domains.  A user defined conversion might not
13552                   be public in the location where we are applying the
13553                   conversion, a different conversion might be selected
13554                   (ie, private A->B (better) but public B->A (worse),
13555                   inside A, A->B applies, but outside it, B->A will
13556                   apply).
13557
13558                 * On top of that (ie, even if the above is solved),
13559                   conversions in a cache need to be abstract.  Ie, `To
13560                   convert from an Int to a Short use an OpcodeCast', not
13561                   `To convert from an Int to a Short use the OpcodeCast on
13562                   the variable 5' (which is what this patch was doing).
13563
13564 2001-09-28  Ravi Pratap  <ravi@ximian.com>
13565
13566         * expression.cs (Invocation::ConversionExists): Re-write to use
13567         the conversion cache
13568
13569         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
13570         cache all conversions done, not just user-defined ones.
13571
13572         (Invocation::BetterConversion): The real culprit. Use ConversionExists
13573         to determine if a conversion exists instead of acutually trying to 
13574         perform the conversion. It's faster too.
13575
13576         (Expression::ConvertExplicit): Modify to use ConversionExists to check
13577         and only then attempt the implicit conversion.
13578
13579 2001-09-28  Ravi Pratap  <ravi@ximian.com>
13580
13581         * expression.cs (ConvertImplicit): Use a cache for conversions
13582         already found. Check level of recursion and bail out if necessary.
13583
13584 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
13585
13586         * typemanager.cs (string_concat_string_string, string_concat_object_object):
13587         Export standard methods that we expect for string operations.
13588
13589         * statement.cs (Block::UsageWarning): Track usage of variables and
13590         report the errors for not used variables.
13591
13592         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
13593         operator. 
13594
13595 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
13596
13597         * codegen.cs: remove unnneded code 
13598
13599         * expression.cs: Removed BuiltinTypeAccess class
13600
13601         Fix the order in which implicit conversions are
13602         done.  
13603
13604         The previous fixed dropped support for boxed conversions (adding a
13605         test to the test suite now)
13606
13607         (UserImplicitCast::CanConvert): Remove test for source being null,
13608         that code is broken.  We should not feed a null to begin with, if
13609         we do, then we should track the bug where the problem originates
13610         and not try to cover it up here.
13611
13612         Return a resolved expression of type UserImplicitCast on success
13613         rather than true/false.  Ravi: this is what I was talking about,
13614         the pattern is to use a static method as a "constructor" for
13615         objects. 
13616
13617         Also, do not create arguments until the very last minute,
13618         otherwise we always create the arguments even for lookups that
13619         will never be performed. 
13620
13621         (UserImplicitCast::Resolve): Eliminate, objects of type
13622         UserImplicitCast are born in a fully resolved state. 
13623
13624         * typemanager.cs (InitCoreTypes): Init also value_type
13625         (System.ValueType). 
13626
13627         * expression.cs (Cast::Resolve): First resolve the child expression.
13628
13629         (LValue): Add new method AddressOf to be used by
13630         the `&' operator.  
13631
13632         Change the argument of Store to take an EmitContext instead of an
13633         ILGenerator, because things like FieldExpr need to be able to call
13634         their children expression to generate the instance code. 
13635
13636         (Expression::Error, Expression::Warning): Sugar functions for
13637         reporting errors.
13638
13639         (Expression::MemberLookup): Accept a TypeContainer instead of a
13640         Report as the first argument.
13641
13642         (Expression::ResolvePrimary): Killed.  I still want to improve
13643         this as currently the code is just not right.
13644
13645         (Expression::ResolveMemberAccess): Simplify, but it is still
13646         wrong. 
13647
13648         (Unary::Resolve): Catch errors in AddressOf operators.
13649
13650         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
13651         index to a byte for the short-version, or the compiler will choose
13652         the wrong Emit call, which generates the wrong data.
13653
13654         (ParameterReference::Emit, ::Store): same.
13655
13656         (FieldExpr::AddressOf): Implement.
13657
13658         * typemanager.cs: TypeManager: made public variable instead of
13659         property.
13660
13661         * driver.cs: document --fatal.
13662
13663         * report.cs (ErrorMessage, WarningMessage): new names for the old
13664         Error and Warning classes.
13665
13666         * cs-parser.jay (member_access): Turn built-in access to types
13667         into a normal simplename
13668
13669 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13670
13671         * expression.cs (Invocation::BetterConversion): Fix to cope
13672         with q being null, since this was introducing a bug.
13673
13674         * expression.cs (ConvertImplicit): Do built-in conversions first.
13675
13676 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13677
13678         * expression.cs (UserImplicitCast::Resolve): Fix bug.
13679
13680 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13681
13682         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
13683         I had introduced long ago (what's new ?).
13684
13685         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
13686         the work of all the checking. 
13687         (ConvertImplicit): Call CanConvert and only then create object if necessary.
13688         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
13689
13690         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
13691         that is the right way. 
13692
13693         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
13694         overloading resolution. Use everywhere instead of cutting and pasting code.
13695
13696         (Binary::ResolveOperator): Use MakeUnionSet.
13697
13698         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
13699         we have to convert to bool types. Not complete yet.
13700
13701 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
13702
13703         * typemanager.cs (TypeManager::CSharpName): support ushort.
13704
13705         * expression.cs (Expression::TryImplicitIntConversion): Attempts
13706         to provide an expression that performsn an implicit constant int
13707         conversion (section 6.1.6).
13708         (Expression::ConvertImplicitRequired): Reworked to include
13709         implicit constant expression conversions.
13710
13711         (Expression::ConvertNumericExplicit): Finished.
13712
13713         (Invocation::Emit): If InstanceExpression is null, then it means
13714         that we perform a call on this.
13715
13716 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
13717
13718         * expression.cs (Unary::Emit): Remove some dead code.
13719         (Probe): Implement Resolve and Emit for `is'.
13720         (Expression::ConvertImplicitRequired): Attempt to do constant
13721         expression conversions here.  Maybe should be moved to
13722         ConvertImplicit, but I am not sure.
13723         (Expression::ImplicitLongConstantConversionPossible,
13724         Expression::ImplicitIntConstantConversionPossible): New functions
13725         that tell whether is it possible to apply an implicit constant
13726         expression conversion.
13727
13728         (ConvertNumericExplicit): Started work on explicit numeric
13729         conversions.
13730
13731         * cs-parser.jay: Update operator constants.
13732
13733         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
13734         (Parameters::GetSignature): Hook up VerifyArgs here.
13735         (Parameters::VerifyArgs): Verifies that no two arguments have the
13736         same name. 
13737
13738         * class.cs (Operator): Update the operator names to reflect the
13739         ones that the spec expects (as we are just stringizing the
13740         operator names).
13741
13742         * expression.cs (Unary::ResolveOperator): Fix bug: Use
13743         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
13744         previous usage did only work for our methods.
13745         (Expression::ConvertImplicit): Handle decimal implicit numeric
13746         conversions as well.
13747         (Expression::InternalTypeConstructor): Used to invoke constructors
13748         on internal types for default promotions.
13749
13750         (Unary::Emit): Implement special handling for the pre/post
13751         increment/decrement for overloaded operators, as they need to have
13752         the same semantics as the other operators.
13753
13754         (Binary::ResolveOperator): ditto.
13755         (Invocation::ConversionExists): ditto.
13756         (UserImplicitCast::Resolve): ditto.
13757
13758 2001-09-26  Ravi Pratap  <ravi@ximian.com>
13759
13760         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
13761         operator, return after emitting body. Regression tests pass again !
13762
13763         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
13764         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
13765         (Invocation::OverloadResolve): Ditto.
13766         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
13767
13768         * everywhere : update calls to the above methods accordingly.
13769
13770 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
13771
13772         * assign.cs (Assign): Make it inherit from ExpressionStatement.
13773
13774         * expression.cs (ExpressionStatement): New base class used for
13775         expressions that can appear in statements, so that we can provide
13776         an alternate path to generate expression that do not leave a value
13777         on the stack.
13778
13779         (Expression::Emit, and all the derivatives): We no longer return
13780         whether a value is left on the stack or not.  Every expression
13781         after being emitted leaves a single value on the stack.
13782
13783         * codegen.cs (EmitContext::EmitStatementExpression): Use the
13784         facilties of ExpressionStatement if possible.
13785
13786         * cs-parser.jay: Update statement_expression.
13787
13788 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
13789
13790         * driver.cs: Change the wording of message
13791
13792 2001-09-25  Ravi Pratap  <ravi@ximian.com>
13793
13794         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
13795         the type of the expression to the return type of the method if
13796         we have an overloaded operator match ! The regression tests pass again !
13797         (Unary::ResolveOperator): Ditto.
13798
13799         * expression.cs (Invocation::ConversionExists): Correct the member lookup
13800         to find "op_Implicit", not "implicit" ;-)
13801         (UserImplicitCast): New class to take care of user-defined implicit conversions.
13802         (ConvertImplicit, ForceConversion): Take TypeContainer argument
13803
13804         * everywhere : Correct calls to the above accordingly.
13805
13806         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
13807         (ConvertImplicit): Do user-defined conversion if it exists.
13808
13809 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
13810
13811         * assign.cs: track location.
13812         (Resolve): Use implicit conversions on assignment.
13813
13814         * literal.cs: Oops.  Not good, Emit of short access values should
13815         pass (Bytes) or the wrong argument will be selected.
13816
13817         * expression.cs (Unary::Emit): Emit code for -expr.
13818
13819         (Unary::ResolveOperator): Handle `Substract' for non-constants
13820         (substract from zero from the non-constants).
13821         Deal with Doubles as well. 
13822
13823         (Expression::ConvertImplicitRequired): New routine that reports an
13824         error if no implicit conversion exists. 
13825
13826         (Invocation::OverloadResolve): Store the converted implicit
13827         expressions if we make them
13828
13829 2001-09-24  Ravi Pratap  <ravi@ximian.com>
13830
13831         * class.cs (ConstructorInitializer): Take a Location argument.
13832         (ConstructorBaseInitializer): Same here.
13833         (ConstructorThisInitializer): Same here.
13834
13835         * cs-parser.jay : Update all calls accordingly.
13836
13837         * expression.cs (Unary, Binary, New): Take location argument.
13838         Update accordingly everywhere.
13839
13840         * cs-parser.jay : Update all calls to the above to take a location
13841         argument.
13842
13843         * class.cs : Ditto.
13844
13845 2001-09-24  Ravi Pratap  <ravi@ximian.com>
13846
13847         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
13848         (Invocation::BetterConversion): Same here
13849         (Invocation::ConversionExists): Ditto.
13850
13851         (Invocation::ConversionExists): Implement.
13852
13853 2001-09-22  Ravi Pratap  <ravi@ximian.com>
13854
13855         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
13856         Also take an additional TypeContainer argument.
13857
13858         * All over : Pass in TypeContainer as argument to OverloadResolve.
13859
13860         * typemanager.cs (CSharpName): Update to check for the string type and return
13861         that too.
13862
13863         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
13864         a given method.
13865
13866 2001-09-21  Ravi Pratap  <ravi@ximian.com>
13867
13868         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
13869         (Invocation::BetterFunction): Implement.
13870         (Invocation::BetterConversion): Implement.
13871         (Invocation::ConversionExists): Skeleton, no implementation yet.
13872
13873         Okay, things work fine !
13874
13875 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
13876
13877         * typemanager.cs: declare and load enum_type, delegate_type and
13878         void_type. 
13879
13880         * expression.cs (Expression::Emit): Now emit returns a value that
13881         tells whether a value is left on the stack or not.  This strategy
13882         might be reveted tomorrow with a mechanism that would address
13883         multiple assignments.
13884         (Expression::report118): Utility routine to report mismatches on
13885         the ExprClass.
13886
13887         (Unary::Report23): Report impossible type/operator combination
13888         utility function.
13889
13890         (Unary::IsIncrementableNumber): Whether the type can be
13891         incremented or decremented with add.
13892         (Unary::ResolveOperator): Also allow enumerations to be bitwise
13893         complemented. 
13894         (Unary::ResolveOperator): Implement ++, !, ~,
13895
13896         (Invocation::Emit): Deal with new Emit convetion.
13897
13898         * All Expression derivatives: Updated their Emit method to return
13899         whether they leave values on the stack or not.
13900
13901         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
13902         stack for expressions that are statements. 
13903
13904 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
13905
13906         * expression.cs (LValue): New interface.  Must be implemented by
13907         LValue objects.
13908         (LocalVariableReference, ParameterReference, FieldExpr): Implement
13909         LValue interface.
13910
13911         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
13912         interface for generating code, simplifies the code.
13913
13914 2001-09-20  Ravi Pratap  <ravi@ximian.com>
13915
13916         * expression.cs (everywhere): Comment out return statements in ::Resolve
13917         methods to avoid the warnings.
13918
13919 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
13920
13921         * driver.cs (parse): Report error 2001 if we can not open the
13922         source file.
13923
13924         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
13925         not resolve it.
13926
13927         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
13928         object. 
13929
13930         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
13931         otherwise nested blocks end up with the same index.
13932
13933         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
13934
13935         * expression.cs:  Instead of having FIXMEs in the Resolve
13936         functions, throw exceptions so it is obvious that we are facing a
13937         bug. 
13938
13939         * cs-parser.jay (invocation_expression): Pass Location information.
13940
13941         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
13942         Use a basename for those routines because .NET does not like paths
13943         on them. 
13944
13945         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
13946         already defined.
13947
13948 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
13949
13950         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
13951         are loading the correct data types (throws an exception if not).
13952         (TypeManager::InitCoreTypes): Use CoreLookupType
13953
13954         * expression.cs (Unary::ResolveOperator): return the child
13955         expression for expressions which are just +expr.
13956         (Unary::ResolveOperator): Return negative literals for -LITERAL
13957         expressions (otherwise they are Unary {Literal}).
13958         (Invocation::Badness): Take into account `Implicit constant
13959         expression conversions'.
13960
13961         * literal.cs (LongLiteral): Implement long literal class.
13962         (IntLiteral): export the `Value' of the intliteral. 
13963
13964 2001-09-19  Ravi Pratap  <ravi@ximian.com>
13965
13966         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
13967
13968         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
13969         instead of 'Operator'
13970
13971         * expression.cs (Binary::ResolveOperator): Update accordingly.
13972         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
13973         and 'Minus'
13974
13975         * cs-parser.jay (unary_expression): Update to use the new names.
13976
13977         * gen-treedump.cs (GetUnary): Same here.
13978
13979         * expression.cs (Unary::Resolve): Implement.
13980         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
13981         operators are found instead of making noise ;-)
13982         (Unary::ResolveOperator): New method to do precisely the same thing which
13983         Binary::ResolveOperator does for Binary expressions.
13984         (Unary.method, .Arguments): Add.
13985         (Unary::OperName): Implement.   
13986         (Unary::ForceConversion): Copy and Paste !
13987
13988         * class.cs (Operator::Define): Fix a small bug for the case when we have 
13989         a unary operator.
13990
13991         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
13992         for the inbuilt operators. Only overloading works for now ;-)
13993
13994 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
13995
13996         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
13997         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
13998
13999         * expression.cs (This::Emit): Implement. 
14000         (This::Resolve): Implement.
14001         (TypeOf:Resolve): Implement.
14002         (Expression::ResolveSimpleName): Add an implicit this to instance
14003         field references. 
14004         (MemberAccess::Resolve): Deal with Parameters and Fields. 
14005         Bind instance variable to Field expressions.
14006         (FieldExpr::Instance): New field used to track the expression that
14007         represents the object instance.
14008         (FieldExpr::Resolve): Track potential errors from MemberLookup not
14009         binding 
14010         (FieldExpr::Emit): Implement.
14011
14012         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
14013         the last instruction contains a return opcode to avoid generating
14014         the last `ret' instruction (this generates correct code, and it is
14015         nice to pass the peverify output).
14016
14017         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
14018         initializer for static and instance variables.
14019         (Constructor::Emit): Allow initializer to be null in the case of
14020         static constructors.  Only emit initializer for instance
14021         constructors. 
14022
14023         (TypeContainer::FindMembers): Return a null array if there are no
14024         matches.
14025
14026         Also fix the code for the MemberTypes.Method branch, as it was not
14027         scanning that for operators (or tried to access null variables before).
14028
14029         * assign.cs (Assign::Emit): Handle instance and static fields. 
14030
14031         * TODO: Updated.
14032
14033         * driver.cs: Stop compilation if there are parse errors.
14034
14035         * cs-parser.jay (constructor_declaration): Provide default base
14036         initializer for non-static constructors.
14037         (constructor_declarator): Do not provide a default base
14038         initializers if none was specified.
14039         Catch the fact that constructors should not have parameters.
14040
14041         * class.cs: Do not emit parent class initializers for static
14042         constructors, that should be flagged as an error.
14043
14044 2001-09-18  Ravi Pratap  <ravi@ximian.com>
14045
14046         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
14047         Move back code into TypeContainer::Populate.
14048
14049 2001-09-18  Ravi Pratap  <ravi@ximian.com>
14050
14051         * class.cs (TypeContainer::AddConstructor): Fix the check to
14052         compare against Name, not Basename. 
14053         (Operator::OpType): Change Plus and Minus to Add and Subtract.
14054
14055         * cs-parser.jay : Update accordingly.
14056
14057         * class.cs (TypeContainer::FindMembers): For the case where we are searching
14058         for methods, don't forget to look into the operators too.
14059         (RegisterMethodBuilder): Helper method to take care of this for
14060         methods, constructors and operators.
14061         (Operator::Define): Completely revamp.
14062         (Operator.OperatorMethod, MethodName): New fields.
14063         (TypeContainer::Populate): Move the registering of builders into
14064         RegisterMethodBuilder.
14065         (Operator::Emit): Re-write.
14066
14067         * expression.cs (Binary::Emit): Comment out code path to emit method
14068         invocation stuff for the case when we have a user defined operator. I am
14069         just not able to get it right !
14070
14071 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
14072
14073         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
14074         argument. 
14075
14076         (Expression::MemberLookup): Provide a version that allows to
14077         specify the MemberTypes and BindingFlags. 
14078
14079         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
14080         so it was not fetching variable information from outer blocks.
14081
14082         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
14083         Beforefieldinit as it was buggy.
14084
14085         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
14086         that Ravi put here.  
14087
14088         * class.cs (Constructor::Emit): Only emit if block is not null.
14089         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
14090         deal with this by semantically definining it as if the user had
14091         done it.
14092
14093         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
14094         constructors as we now "emit" them at a higher level.
14095
14096         (TypeContainer::DefineDefaultConstructor): Used to define the
14097         default constructors if none was provided.
14098
14099         (ConstructorInitializer): Add methods Resolve and Emit. 
14100
14101         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
14102
14103 2001-09-17  Ravi Pratap  <ravi@ximian.com>
14104
14105         * class.cs (TypeContainer::EmitDefaultConstructor): Register
14106         the default constructor builder with our hashtable for methodbuilders
14107         to methodcores.
14108
14109         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
14110         and argument_count is 0 in which case we have a match.
14111         (Binary::ResolveOperator): More null checking and miscellaneous coding
14112         style cleanup.
14113
14114 2001-09-17  Ravi Pratap  <ravi@ximian.com>
14115
14116         * rootcontext.cs (IsNameSpace): Compare against null.
14117
14118         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
14119
14120         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
14121         and Unary::Operator.
14122
14123         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
14124         accordingly.
14125
14126         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
14127         we have overloaded operators.
14128         (Binary::ResolveOperator): Implement the part which does the operator overload
14129         resolution.
14130
14131         * class.cs (Operator::Emit): Implement.
14132         (TypeContainer::Emit): Emit the operators we have too.
14133
14134         * expression.cs (Binary::Emit): Update to emit the appropriate code for
14135         the case when we have a user-defined operator.
14136
14137 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
14138
14139         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
14140
14141 2001-09-16  Ravi Pratap  <ravi@ximian.com>
14142
14143         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
14144         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
14145         (Constructor::Emit): Implement.
14146         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
14147         if we have no work to do. 
14148         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
14149         Emit method.
14150
14151         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
14152         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
14153
14154         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
14155         of parent.parent.
14156
14157 2001-09-15  Ravi Pratap  <ravi@ximian.com>
14158
14159         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
14160         in the source.
14161         (Tree::RecordNamespace): Method to do what the name says ;-)
14162         (Tree::Namespaces): Property to get at the namespaces hashtable.
14163
14164         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
14165         keep track.
14166
14167         * rootcontext.cs (IsNamespace): Fixed it :-)
14168
14169 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
14170
14171         * class.cs (TypeContainer::FindMembers): Add support for
14172         constructors. 
14173         (MethodCore): New class that encapsulates both the shared aspects
14174         of a Constructor and a Method.  
14175         (Method, Constructor): Factored pieces into MethodCore.
14176
14177         * driver.cs: Added --fatal which makes errors throw exceptions.
14178         Load System assembly as well as part of the standard library.
14179
14180         * report.cs: Allow throwing exceptions on errors for debugging.
14181
14182         * modifiers.cs: Do not use `parent', instead use the real type
14183         container to evaluate permission settings.
14184
14185         * class.cs: Put Ravi's patch back in.  He is right, and we will
14186         have to cope with the
14187
14188 2001-09-14  Ravi Pratap  <ravi@ximian.com>
14189
14190         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
14191         FamORAssem, not FamANDAssem.
14192
14193 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
14194
14195         * driver.cs: Added --parse option that only parses its input files
14196         and terminates.
14197
14198         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
14199         incorrect.  IsTopLevel is not used to tell whether an object is
14200         root_types or not (that can be achieved by testing this ==
14201         root_types).  But to see if this is a top-level *class* (not
14202         necessarly our "toplevel" container). 
14203
14204 2001-09-14  Ravi Pratap  <ravi@ximian.com>
14205
14206         * enum.cs (Enum::Define): Modify to call the Lookup method on the
14207         parent instead of a direct call to GetType.
14208
14209 2001-09-14  Ravi Pratap  <ravi@ximian.com>
14210
14211         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
14212         Modifiers.TypeAttr. This should just be a call to that method.
14213
14214         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
14215         object so that we can determine if we are top-level or not.
14216
14217         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
14218         TypeContainer too.
14219
14220         * enum.cs (Enum::Define): Ditto.
14221
14222         * modifiers.cs (FieldAttr): Re-write.
14223
14224         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
14225         (TypeContainer::HaveStaticConstructor): New property to provide access
14226         to precisely that info.
14227
14228         * modifiers.cs (MethodAttr): Re-write.
14229         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
14230
14231         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
14232         of top-level types as claimed.
14233
14234 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
14235
14236         * expression.cs (MemberLookup): Fruitless attempt to lookup
14237         constructors.  Maybe I need to emit default constructors?  That
14238         might be it (currently .NET emits this for me automatically).
14239         (Invocation::OverloadResolve): Cope with Arguments == null.
14240         (Invocation::EmitArguments): new function, shared by the new
14241         constructor and us.
14242         (Invocation::Emit): Handle static and instance methods.  Emit
14243         proper call instruction for virtual or non-virtual invocations.
14244         (New::Emit): Implement.
14245         (New::Resolve): Implement.
14246         (MemberAccess:Resolve): Implement.
14247         (MethodGroupExpr::InstanceExpression): used conforming to the spec
14248         to track instances.
14249         (FieldExpr::Resolve): Set type.
14250
14251         * support.cs: Handle empty arguments.
14252                 
14253         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
14254         SimpleLookup): Auxiliary routines to help parse a qualifier
14255         identifier.  
14256
14257         Update qualifier_identifier rule.
14258
14259         * codegen.cs: Removed debugging messages.
14260
14261         * class.cs: Make this a global thing, this acts just as a "key" to
14262         objects that we might have around.
14263
14264         (Populate): Only initialize method_builders_to_methods once.
14265
14266         * expression.cs (PropertyExpr): Initialize type from the
14267         PropertyType. 
14268
14269         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
14270         Resolve pattern.  Attempt to implicitly convert value to boolean.
14271         Emit code.
14272
14273         * expression.cs: Set the type for the int32/int32 argument case.
14274         (Binary::ResolveOperator): Set the return type to boolean for
14275         comparission operators
14276
14277         * typemanager.cs: Remove debugging print code.
14278
14279         (Invocation::Resolve): resolve type.
14280
14281         * class.cs: Allocate a MemberInfo of the correct size, as the code
14282         elsewhere depends on the test to reflect the correct contents.
14283
14284         (Method::) Keep track of parameters, due to System.Reflection holes
14285
14286         (TypeContainer::Populate): Keep track of MethodBuilders to Method
14287         mapping here.
14288
14289         (TypeContainer::FindMembers): Use ArrayList and then copy an array
14290         of the exact size and return that.
14291
14292         (Class::LookupMethodByBuilder): New function that maps
14293         MethodBuilders to its methods.  Required to locate the information
14294         on methods because System.Reflection bit us again.
14295
14296         * support.cs: New file, contains an interface ParameterData and
14297         two implementations: ReflectionParameters and InternalParameters
14298         used to access Parameter information.  We will need to grow this
14299         as required.
14300
14301         * expression.cs (Invocation::GetParameterData): implement a cache
14302         and a wrapper around the ParameterData creation for methods. 
14303         (Invocation::OverloadResolve): Use new code.
14304
14305 2001-09-13  Ravi Pratap  <ravi@ximian.com>
14306
14307         * class.cs (TypeContainer::EmitField): Remove and move into 
14308         (Field::Define): here and modify accordingly.
14309         (Field.FieldBuilder): New member.
14310         (TypeContainer::Populate): Update accordingly.
14311         (TypeContainer::FindMembers): Implement.
14312
14313 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
14314
14315         * statement.cs: (VariableInfo::VariableType): New field to be
14316         initialized with the full type once it is resolved. 
14317
14318 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
14319
14320         * parameter.cs (GetParameterInfo): Use a type cache to compute
14321         things only once, and to reuse this information
14322
14323         * expression.cs (LocalVariableReference::Emit): Implement.
14324         (OpcodeCast::Emit): fix.
14325
14326         (ParameterReference::Resolve): Implement.
14327         (ParameterReference::Emit): Implement.
14328
14329         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
14330         that are expressions need to stay as Expressions.
14331
14332         * typemanager.cs (CSharpName): Returns the C# name of a type if
14333         possible. 
14334
14335         * expression.cs (Expression::ConvertImplicit): New function that
14336         implements implicit type conversions.
14337
14338         (Expression::ImplicitReferenceConversion): Implements implicit
14339         reference conversions.
14340
14341         (EmptyCast): New type for transparent casts.
14342
14343         (OpcodeCast): New type for casts of types that are performed with
14344         a sequence of bytecodes.
14345
14346         (BoxedCast): New type used for casting value types into reference
14347         types.  Emits a box opcode.
14348
14349         (Binary::DoNumericPromotions): Implements numeric promotions of
14350         and computation of the Binary::Type.
14351
14352         (Binary::EmitBranchable): Optimization.
14353
14354         (Binary::Emit): Implement code emission for expressions.
14355
14356         * typemanager.cs (TypeManager): Added two new core types: sbyte
14357         and byte.
14358
14359 2001-09-12  Ravi Pratap  <ravi@ximian.com>
14360
14361         * class.cs (TypeContainer::FindMembers): Method which does exactly
14362         what Type.FindMembers does, only we don't have to use reflection. No
14363         implementation yet.
14364
14365         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
14366         typecontainer objects as we need to get at them.
14367         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
14368
14369         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
14370         typecontainer object.
14371
14372         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
14373         of just a Report object.
14374
14375 2001-09-11  Ravi Pratap  <ravi@ximian.com>
14376
14377         * class.cs (Event::Define): Go back to using the prefixes "add_" and
14378         "remove_"
14379         (TypeContainer::Populate): Now define the delegates of the type too.
14380         (TypeContainer.Delegates): Property to access the list of delegates defined
14381         in the type.
14382
14383         * delegates.cs (Delegate::Define): Implement partially.
14384
14385         * modifiers.cs (TypeAttr): Handle more flags.
14386
14387 2001-09-11  Ravi Pratap  <ravi@ximian.com>
14388
14389         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
14390         and not <=
14391         (Operator::Define): Re-write logic to get types by using the LookupType method
14392         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
14393         (Indexer::Define): Ditto.
14394         (Event::Define): Ditto.
14395         (Property::Define): Ditto.
14396
14397 2001-09-10  Ravi Pratap  <ravi@ximian.com>
14398
14399         * class.cs (TypeContainer::Populate): Now define operators too. 
14400         (TypeContainer.Operators): New property to access the list of operators
14401         in a type.
14402         (Operator.OperatorMethodBuilder): New member to hold the method builder
14403         for the operator we are defining.
14404         (Operator::Define): Implement.
14405
14406 2001-09-10  Ravi Pratap  <ravi@ximian.com>
14407
14408         * class.cs (Event::Define): Make the prefixes of the accessor methods
14409         addOn_ and removeOn_ 
14410
14411         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
14412         of the location being passed in too. Ideally, this should go later since all
14413         error reporting should be done through the Report object.
14414
14415         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
14416         (Populate): Iterate thru the indexers we have and define them too.
14417         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
14418         for the get and set accessors.
14419         (Indexer::Define): Implement.
14420
14421 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
14422
14423         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
14424         my previous implementation, did not work.
14425
14426         * typemanager.cs: Add a couple of missing types (the longs).
14427
14428         * literal.cs: Use TypeManager.bool_type instead of getting it.
14429
14430         * expression.cs (EventExpr): New kind of expressions.
14431         (Expressio::ExprClassFromMemberInfo): finish
14432
14433 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
14434
14435         * assign.cs: Emit stores to static fields differently.
14436
14437 2001-09-08  Ravi Pratap  <ravi@ximian.com>
14438
14439         * Merge in changes and adjust code to tackle conflicts. Backed out my
14440         code in Assign::Resolve ;-) 
14441
14442 2001-09-08  Ravi Pratap  <ravi@ximian.com>
14443
14444         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
14445         instead Report.Error and also pass in the location.
14446         (CSharpParser::Lexer): New readonly property to return the reference
14447         to the Tokenizer object.
14448         (declare_local_variables): Use Report.Error with location instead of plain 
14449         old error.
14450         (CheckDef): Ditto.
14451
14452         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
14453         (Operator.CheckBinaryOperator): Ditto.
14454
14455         * cs-parser.jay (operator_declarator): Update accordingly.
14456
14457         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
14458         (CheckBinaryOperator): Same here.
14459
14460         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
14461         on the name without any prefixes of namespace names etc. This is because we
14462         already might have something already fully qualified like 
14463         'System.Console.WriteLine'
14464
14465         * assign.cs (Resolve): Begin implementation. Stuck ;-)
14466
14467 2001-09-07  Ravi Pratap  <ravi@ximian.com>
14468
14469         * cs-tokenizer.cs (location): Return a string which also contains
14470         the file name.
14471
14472         * expression.cs (ElementAccess): New class for expressions of the
14473         type 'element access.'
14474         (BaseAccess): New class for expressions of the type 'base access.'
14475         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
14476         respectively.
14477
14478         * cs-parser.jay (element_access): Implement action.
14479         (base_access): Implement actions.
14480         (checked_expression, unchecked_expression): Implement.
14481
14482         * cs-parser.jay (local_variable_type): Correct and implement.
14483         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
14484
14485         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
14486
14487         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
14488         name and the specifiers.
14489
14490         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
14491
14492         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
14493         making them all public ;-)
14494
14495         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
14496         class anyways.
14497
14498 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
14499
14500         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
14501         PropertyExprs.
14502         (FieldExpr, PropertyExprs): New resolved expressions.
14503         (SimpleName::MemberStaticCheck): Perform static checks for access
14504         to non-static fields on static methods. Maybe this should be
14505         generalized for MemberAccesses. 
14506         (SimpleName::ResolveSimpleName): More work on simple name
14507         resolution. 
14508
14509         * cs-parser.jay (primary_expression/qualified_identifier): track
14510         the parameter index.
14511
14512         * codegen.cs (CodeGen::Save): Catch save exception, report error.
14513         (EmitContext::EmitBoolExpression): Chain to expression generation
14514         instead of temporary hack.
14515         (::EmitStatementExpression): Put generic expression code generation.
14516
14517         * assign.cs (Assign::Emit): Implement variable assignments to
14518         local variables, parameters and fields.
14519
14520 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
14521
14522         * statement.cs (Block::GetVariableInfo): New method, returns the
14523         VariableInfo for a variable name in a block.
14524         (Block::GetVariableType): Implement in terms of GetVariableInfo
14525
14526         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
14527         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
14528
14529 2001-09-06  Ravi Pratap  <ravi@ximian.com>
14530
14531         * cs-parser.jay (operator_declaration): Continue on my quest : update
14532         to take attributes argument.
14533         (event_declaration): Ditto.
14534         (enum_declaration): Ditto.
14535         (indexer_declaration): Ditto.
14536
14537         * class.cs (Operator::Operator): Update constructor accordingly.
14538         (Event::Event): Ditto.
14539
14540         * delegate.cs (Delegate::Delegate): Same here.
14541
14542         * enum.cs (Enum::Enum): Same here.
14543
14544 2001-09-05  Ravi Pratap  <ravi@ximian.com>
14545
14546         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
14547
14548         * ../tests/cs0658.cs : New file to demonstrate error 0658.
14549
14550         * attribute.cs (Attributes): New class to encapsulate all attributes which were
14551         being passed around as an arraylist.
14552         (Attributes::AddAttribute): Method to add attribute sections.
14553
14554         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
14555         (struct_declaration): Update accordingly.
14556         (constant_declaration): Update.
14557         (field_declaration): Update.
14558         (method_header): Update.
14559         (fixed_parameter): Update.
14560         (parameter_array): Ditto.
14561         (property_declaration): Ditto.
14562         (destructor_declaration): Ditto.
14563
14564         * class.cs (Struct::Struct): Update constructors accordingly.
14565         (Class::Class): Ditto.
14566         (Field::Field): Ditto.
14567         (Method::Method): Ditto.
14568         (Property::Property): Ditto.
14569         (TypeContainer::OptAttribute): update property's return type.
14570
14571         * interface.cs (Interface.opt_attributes): New member.
14572         (Interface::Interface): Update to take the extra Attributes argument.
14573
14574         * parameter.cs (Parameter::Parameter): Ditto.
14575
14576         * constant.cs (Constant::Constant): Ditto.
14577
14578         * interface.cs (InterfaceMemberBase): New OptAttributes field.
14579         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
14580         the attributes as a parameter.
14581         (InterfaceProperty): Update constructor call.
14582         (InterfaceEvent): Ditto.
14583         (InterfaceMethod): Ditto.
14584         (InterfaceIndexer): Ditto.
14585
14586         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
14587         pass the attributes too.
14588         (interface_event_declaration): Ditto.
14589         (interface_property_declaration): Ditto.
14590         (interface_method_declaration): Ditto.
14591         (interface_declaration): Ditto.
14592
14593 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
14594
14595         * class.cs (Method::Define): Track the "static Main" definition to
14596         create an entry point. 
14597
14598         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
14599         EntryPoint if we find it. 
14600
14601         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
14602         (EmitContext::ig): Make this variable public.
14603
14604         * driver.cs: Make the default output file be the first file name
14605         with the .exe extension.  
14606
14607         Detect empty compilations
14608
14609         Handle various kinds of output targets.  Handle --target and
14610         rename -t to --dumper.
14611
14612         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
14613         methods inherited from Expression return now an Expression.  This
14614         will is used during the tree rewriting as we resolve them during
14615         semantic analysis.
14616
14617         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
14618         the spec.  Missing entirely is the information about
14619         accessability of elements of it.
14620
14621         (Expression::ExprClassFromMemberInfo): New constructor for
14622         Expressions that creates a fully initialized Expression based on
14623         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
14624         a Type.
14625
14626         (Invocation::Resolve): Begin implementing resolution of invocations.
14627
14628         * literal.cs (StringLiteral):  Implement Emit.
14629
14630 2001-09-05  Ravi Pratap  <ravi@ximian.com>
14631
14632         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
14633         member.
14634
14635 2001-09-04  Ravi Pratap  <ravi@ximian.com>
14636
14637         * cs-parser.jay (attribute_arguments): Implement actions.
14638         (attribute): Fix bug in production. Implement action.
14639         (attribute_list): Implement.
14640         (attribute_target): Implement.
14641         (attribute_target_specifier, opt_target_specifier): Implement
14642         (CheckAttributeTarget): New method to check if the attribute target
14643         is valid.
14644         (attribute_section): Implement.
14645         (opt_attributes): Implement.
14646
14647         * attribute.cs : New file to handle attributes.
14648         (Attribute): Class to hold attribute info.
14649
14650         * cs-parser.jay (opt_attribute_target_specifier): Remove production
14651         (attribute_section): Modify production to use 2 different rules to 
14652         achieve the same thing. 1 s/r conflict down !
14653         Clean out commented, useless, non-reducing dimension_separator rules.
14654
14655         * class.cs (TypeContainer.attributes): New member to hold list
14656         of attributes for a type.
14657         (Struct::Struct): Modify to take one more argument, the attribute list.
14658         (Class::Class): Ditto.
14659         (Field::Field): Ditto.
14660         (Method::Method): Ditto.
14661         (Property::Property): Ditto.
14662
14663         * cs-parser.jay (struct_declaration): Update constructor call to
14664         pass in the attributes too.
14665         (class_declaration): Ditto.
14666         (constant_declaration): Ditto.
14667         (field_declaration): Ditto.
14668         (method_header): Ditto.
14669         (fixed_parameter): Ditto.
14670         (parameter_array): Ditto.
14671         (property_declaration): Ditto.
14672
14673         * constant.cs (Constant::Constant): Update constructor similarly.
14674         Use System.Collections.
14675
14676         * parameter.cs (Parameter::Parameter): Update as above.
14677
14678 2001-09-02  Ravi Pratap  <ravi@ximian.com>
14679
14680         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
14681         (TypeContainer.delegates): New member to hold list of delegates.
14682
14683         * cs-parser.jay (delegate_declaration): Implement the action correctly 
14684         this time as I seem to be on crack ;-)
14685
14686 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
14687
14688         * rootcontext.cs (RootContext::IsNamespace): new function, used to
14689         tell whether an identifier represents a namespace.
14690
14691         * expression.cs (NamespaceExpr): A namespace expression, used only
14692         temporarly during expression resolution.
14693         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
14694         utility functions to resolve names on expressions.
14695
14696 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
14697
14698         * codegen.cs: Add hook for StatementExpressions. 
14699
14700         * class.cs: Fix inverted test for static flag in methods.
14701
14702 2001-09-02  Ravi Pratap  <ravi@ximian.com>
14703
14704         * class.cs (Operator::CheckUnaryOperator): Correct error number used
14705         to make it coincide with MS' number.
14706         (Operator::CheckBinaryOperator): Ditto.
14707
14708         * ../errors/errors.txt : Remove error numbers added earlier.
14709
14710         * ../errors/cs1019.cs : Test case for error # 1019
14711
14712         * ../errros/cs1020.cs : Test case for error # 1020
14713
14714         * cs-parser.jay : Clean out commented cruft.
14715         (dimension_separators, dimension_separator): Comment out. Ostensibly not
14716         used anywhere - non-reducing rule.
14717         (namespace_declarations): Non-reducing rule - comment out.
14718
14719         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
14720         with TypeContainer::AddEnum.
14721
14722         * delegate.cs : New file for delegate handling classes.
14723         (Delegate): Class for declaring delegates.
14724
14725         * makefile : Update.
14726
14727         * cs-parser.jay (delegate_declaration): Implement.
14728
14729 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
14730
14731         * class.cs (Event::Define): Implement.
14732         (Event.EventBuilder): New member.
14733
14734         * class.cs (TypeContainer::Populate): Update to define all enums and events
14735         we have.
14736         (Events): New property for the events arraylist we hold. Shouldn't we move to using
14737         readonly fields for all these cases ?
14738
14739 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
14740
14741         * class.cs (Property): Revamp to use the convention of making fields readonly.
14742         Accordingly modify code elsewhere.
14743
14744         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
14745         the Define method of the Property class.
14746
14747         * class.cs : Clean up applied patch and update references to variables etc. Fix 
14748         trivial bug.
14749         (TypeContainer::Populate): Update to define all the properties we have. Also
14750         define all enumerations.
14751
14752         * enum.cs (Define): Implement.
14753
14754 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
14755
14756         * cs-parser.jay (overloadable_operator): The semantic value is an
14757         enum of the Operator class.
14758         (operator_declarator): Implement actions.
14759         (operator_declaration): Implement.
14760
14761         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
14762         validity of definitions.
14763         (Operator::CheckBinaryOperator): Static method to check for binary operators
14764         (TypeContainer::AddOperator): New method to add an operator to a type.
14765
14766         * cs-parser.jay (indexer_declaration): Added line to actually call the
14767         AddIndexer method so it gets added ;-)
14768
14769         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
14770         already taken care of by the MS compiler ?  
14771
14772 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
14773
14774         * class.cs (Operator): New class for operator declarations.
14775         (Operator::OpType): Enum for the various operators.
14776
14777 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
14778
14779         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
14780         ostensibly handle this in semantic analysis.
14781
14782         * cs-parser.jay (general_catch_clause): Comment out
14783         (specific_catch_clauses, specific_catch_clause): Ditto.
14784         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
14785         (catch_args, opt_catch_args): New productions.
14786         (catch_clause): Rewrite to use the new productions above
14787         (catch_clauses): Modify accordingly.
14788         (opt_catch_clauses): New production to use in try_statement
14789         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
14790         and re-write the code in the actions to extract the specific and
14791         general catch clauses by being a little smart ;-)
14792
14793         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
14794         Hooray, try and catch statements parse fine !
14795
14796 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14797
14798         * statement.cs (Block::GetVariableType): Fix logic to extract the type
14799         string from the hashtable of variables.
14800
14801         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
14802         I end up making that mistake ;-)
14803         (catch_clauses): Fixed gross error which made Key and Value of the 
14804         DictionaryEntry the same : $1 !!
14805
14806 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14807
14808         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
14809
14810         * cs-parser.jay (event_declaration): Correct to remove the semicolon
14811         when the add and remove accessors are specified. 
14812
14813 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14814
14815         * cs-parser.jay (IndexerDeclaration): New helper class to hold
14816         information about indexer_declarator.
14817         (indexer_declarator): Implement actions.
14818         (parsing_indexer): New local boolean used to keep track of whether
14819         we are parsing indexers or properties. This is necessary because 
14820         implicit_parameters come into picture even for the get accessor in the 
14821         case of an indexer.
14822         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
14823
14824         * class.cs (Indexer): New class for indexer declarations.
14825         (TypeContainer::AddIndexer): New method to add an indexer to a type.
14826         (TypeContainer::indexers): New member to hold list of indexers for the
14827         type.
14828
14829 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
14830
14831         * cs-parser.jay (add_accessor_declaration): Implement action.
14832         (remove_accessor_declaration): Implement action.
14833         (event_accessors_declaration): Implement
14834         (variable_declarators): swap statements for first rule - trivial.
14835
14836         * class.cs (Event): New class to hold information about event
14837         declarations.
14838         (TypeContainer::AddEvent): New method to add an event to a type
14839         (TypeContainer::events): New member to hold list of events.
14840
14841         * cs-parser.jay (event_declaration): Implement actions.
14842
14843 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
14844
14845         * cs-parser.jay (dim_separators): Implement. Make it a string
14846         concatenating all the commas together, just as they appear.
14847         (opt_dim_separators): Modify accordingly
14848         (rank_specifiers): Update accordingly. Basically do the same
14849         thing - instead, collect the brackets here.
14850         (opt_rank_sepcifiers): Modify accordingly.
14851         (array_type): Modify to actually return the complete type string
14852         instead of ignoring the rank_specifiers.
14853         (expression_list): Implement to collect the expressions
14854         (variable_initializer): Implement. We make it a list of expressions
14855         essentially so that we can handle the array_initializer case neatly too.
14856         (variable_initializer_list): Implement.
14857         (array_initializer): Make it a list of variable_initializers
14858         (opt_array_initializer): Modify accordingly.
14859
14860         * expression.cs (New::NType): Add enumeration to help us
14861         keep track of whether we have an object/delegate creation
14862         or an array creation.
14863         (New:NewType, New::Rank, New::Indices, New::Initializers): New
14864         members to hold data about array creation.
14865         (New:New): Modify to update NewType
14866         (New:New): New Overloaded contructor for the array creation
14867         case.
14868
14869         * cs-parser.jay (array_creation_expression): Implement to call
14870         the overloaded New constructor.
14871
14872 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
14873
14874         * class.cs (TypeContainer::Constructors): Return member
14875         constructors instead of returning null.
14876
14877 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
14878
14879         * typemanager.cs (InitCoreTypes): Initialize the various core
14880         types after we have populated the type manager with the user
14881         defined types (this distinction will be important later while
14882         compiling corlib.dll)
14883
14884         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
14885         on Expression Classification.  Now all expressions have a method
14886         `Resolve' and a method `Emit'.
14887
14888         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
14889         generation from working.     Also add some temporary debugging
14890         code. 
14891
14892 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
14893
14894         * codegen.cs: Lots of code generation pieces.  This is only the
14895         beginning, will continue tomorrow with more touches of polish.  We
14896         handle the fundamentals of if, while, do, for, return.  Others are
14897         trickier and I need to start working on invocations soon.
14898
14899         * gen-treedump.cs: Bug fix, use s.Increment here instead of
14900         s.InitStatement. 
14901
14902         * codegen.cs (EmitContext): New struct, used during code
14903         emission to keep a context.   Most of the code generation will be
14904         here. 
14905
14906         * cs-parser.jay: Add embedded blocks to the list of statements of
14907         this block.  So code generation proceeds in a top down fashion.
14908
14909 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
14910
14911         * statement.cs: Add support for multiple child blocks.
14912
14913 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
14914
14915         * codegen.cs (EmitCode): New function, will emit the code for a
14916         Block of code given a TypeContainer and its ILGenerator. 
14917
14918         * statement.cs (Block): Standard public readonly optimization.
14919         (Block::Block constructors): Link children. 
14920         (Block::Child): Child Linker.
14921         (Block::EmitVariables): Emits IL variable declarations.
14922
14923         * class.cs: Drop support for MethodGroups here, delay until
14924         Semantic Analysis.
14925         (Method::): Applied the same simplification that I did before, and
14926         move from Properties to public readonly fields.
14927         (Method::ParameterTypes): Returns the parameter types for the
14928         function, and implements a cache that will be useful later when I
14929         do error checking and the semantic analysis on the methods is
14930         performed.
14931         (Constructor::GetCallingConvention): Renamed from CallingConvetion
14932         and made a method, optional argument tells whether this is a class
14933         or a structure to apply the `has-this' bit.
14934         (Method::GetCallingConvention): Implement, returns the calling
14935         convention. 
14936         (Method::Define): Defines the type, a second pass is performed
14937         later to populate the methods.
14938
14939         (Constructor::ParameterTypes): implement a cache similar to the
14940         one on Method::ParameterTypes, useful later when we do semantic
14941         analysis. 
14942
14943         (TypeContainer::EmitMethod):  New method.  Emits methods.
14944
14945         * expression.cs: Removed MethodGroup class from here.
14946
14947         * parameter.cs (Parameters::GetCallingConvention): new method.
14948
14949 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
14950
14951         * class.cs (TypeContainer::Populate): Drop RootContext from the
14952         argument. 
14953
14954         (Constructor::CallingConvention): Returns the calling convention.
14955         (Constructor::ParameterTypes): Returns the constructor parameter
14956         types. 
14957
14958         (TypeContainer::AddConstructor): Keep track of default constructor
14959         and the default static constructor.
14960
14961         (Constructor::) Another class that starts using `public readonly'
14962         instead of properties. 
14963
14964         (Constructor::IsDefault): Whether this is a default constructor. 
14965
14966         (Field::) use readonly public fields instead of properties also.
14967
14968         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
14969         track of static constructors;  If none is used, turn on
14970         BeforeFieldInit in the TypeAttributes. 
14971
14972         * cs-parser.jay (opt_argument_list): now the return can be null
14973         for the cases where there are no arguments. 
14974
14975         (constructor_declarator): If there is no implicit `base' or
14976         `this', then invoke the default parent constructor. 
14977
14978         * modifiers.cs (MethodAttr): New static function maps a set of
14979         modifiers flags into a MethodAttributes enum
14980         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
14981         MethodAttr, TypeAttr to represent the various mappings where the
14982         modifiers are used.
14983         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
14984
14985 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
14986
14987         * parameter.cs (GetParameterInfo): Fix bug where there would be no
14988         method arguments.
14989
14990         * interface.cs (PopulateIndexer): Implemented the code generator
14991         for interface indexers.
14992
14993 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
14994
14995         * interface.cs (InterfaceMemberBase): Now we track the new status
14996         here.  
14997
14998         (PopulateProperty): Implement property population.  Woohoo!  Got
14999         Methods and Properties going today. 
15000
15001         Removed all the properties for interfaces, and replaced them with
15002         `public readonly' fields. 
15003
15004 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
15005
15006         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
15007         initialize their hashtables/arraylists only when they are needed
15008         instead of doing this always.
15009
15010         * parameter.cs: Handle refs and out parameters.
15011
15012         * cs-parser.jay: Use an ArrayList to construct the arguments
15013         instead of the ParameterCollection, and then cast that to a
15014         Parameter[] array.
15015
15016         * parameter.cs: Drop the use of ParameterCollection and use
15017         instead arrays of Parameters.
15018
15019         (GetParameterInfo): Use the Type, not the Name when resolving
15020         types. 
15021
15022 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
15023
15024         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
15025         and instead use public readonly fields.
15026
15027         * class.cs: Put back walking code for type containers.
15028
15029 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
15030
15031         * class.cs (MakeConstant): Code to define constants.
15032
15033         * rootcontext.cs (LookupType): New function.  Used to locate types 
15034
15035
15036 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
15037
15038         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
15039         this System.Reflection code is.  Kudos to Microsoft
15040
15041         * typemanager.cs: Implement a type cache and avoid loading all
15042         types at boot time.  Wrap in LookupType the internals.  This made
15043         the compiler so much faster.  Wow.  I rule!
15044
15045         * driver.cs: Make sure we always load mscorlib first (for
15046         debugging purposes, nothing really important).
15047
15048         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
15049         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
15050
15051         * rootcontext.cs: Lookup types on their namespace;  Lookup types
15052         on namespaces that have been imported using the `using' keyword.
15053
15054         * class.cs (TypeContainer::TypeAttr): Virtualize.
15055         (Class::TypeAttr): Return attributes suitable for this bad boy.
15056         (Struct::TypeAttr): ditto.
15057         Handle nested classes.
15058         (TypeContainer::) Remove all the type visiting code, it is now
15059         replaced with the rootcontext.cs code
15060
15061         * rootcontext.cs (GetClassBases): Added support for structs. 
15062
15063 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
15064
15065         * interface.cs, statement.cs, class.cs, parameter.cs,
15066         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
15067         Drop use of TypeRefs, and use strings instead.
15068
15069 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
15070
15071         * rootcontext.cs: 
15072
15073         * class.cs (Struct::Struct): set the SEALED flags after
15074         checking the modifiers.
15075         (TypeContainer::TypeAttr): new property, returns the
15076         TypeAttributes for a class.  
15077
15078         * cs-parser.jay (type_list): Oops, list production was creating a
15079         new list of base types.
15080
15081         * rootcontext.cs (StdLib): New property.
15082         (GetInterfaceTypeByName): returns an interface by type name, and
15083         encapsulates error handling here.
15084         (GetInterfaces): simplified.
15085         (ResolveTree): Encapsulated all the tree resolution here.
15086         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
15087         types. 
15088
15089         * driver.cs: Add support for --nostdlib, to avoid loading the
15090         default assemblies.
15091         (Main): Do not put tree resolution here. 
15092
15093         * rootcontext.cs: Beginning of the class resolution.
15094
15095 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
15096
15097         * rootcontext.cs: Provide better error reporting. 
15098
15099         * cs-parser.jay (interface_base): set our $$ to be interfaces.
15100
15101         * rootcontext.cs (CreateInterface): Handle the case where there
15102         are no parent interfaces.
15103
15104         (CloseTypes): Routine to flush types at the end.
15105         (CreateInterface): Track types.
15106         (GetInterfaces): Returns an array of Types from the list of
15107         defined interfaces.
15108
15109         * typemanager.c (AddUserType): Mechanism to track user types (puts
15110         the type on the global type hash, and allows us to close it at the
15111         end). 
15112
15113 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
15114
15115         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
15116         RecordInterface instead.
15117
15118         * cs-parser.jay: Updated to reflect changes above.
15119
15120         * decl.cs (Definition): Keep track of the TypeBuilder type that
15121         represents this type here.  Not sure we will use it in the long
15122         run, but wont hurt for now.
15123
15124         * driver.cs: Smaller changes to accomodate the new code.
15125
15126         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
15127         when done. 
15128
15129         * rootcontext.cs (CreateInterface):  New method, used to create
15130         the System.TypeBuilder type for interfaces.
15131         (ResolveInterfaces): new entry point to resolve the interface
15132         hierarchy. 
15133         (CodeGen): Property, used to keep track of the code generator.
15134
15135 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
15136
15137         * cs-parser.jay: Add a second production for delegate_declaration
15138         with `VOID'.
15139
15140         (enum_body): Put an opt_comma here instead of putting it on
15141         enum_body or enum_member_declarations so we can handle trailing
15142         commas on enumeration members.  Gets rid of a shift/reduce.
15143
15144         (type_list): Need a COMMA in the middle.
15145
15146         (indexer_declaration): Tell tokenizer to recognize get/set
15147
15148         * Remove old targets.
15149
15150         * Re-add the parser target.
15151
15152 2001-07-13  Simon Cozens <simon@simon-cozens.org>
15153
15154         * cs-parser.jay: Add precendence rules for a number of operators
15155         ot reduce the number of shift/reduce conflicts in the grammar.
15156
15157 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
15158
15159         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
15160         and put it here.
15161
15162         Get rid of old crufty code.
15163
15164         * rootcontext.cs: Use this to keep track of the parsed
15165         representation and the defined types available to the program. 
15166
15167         * gen-treedump.cs: adjust for new convention.
15168
15169         * type.cs: Split out the type manager, and the assembly builder
15170         from here. 
15171
15172         * typemanager.cs: the type manager will live here now.
15173
15174         * cil-codegen.cs: And the code generator here. 
15175
15176 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
15177
15178         * makefile: Fixed up for easy making.
15179
15180 2001-07-13  Simon Cozens <simon@simon-cozens.org>
15181
15182         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
15183         the 
15184
15185         (unary_expression): Expand pre_increment_expression and
15186         post_decrement_expression to reduce a shift/reduce.
15187
15188 2001-07-11  Simon Cozens
15189
15190         * cs-tokenizer.cs: Hex numbers should begin with a 0.
15191
15192         Improve allow_keyword_as_indent name.
15193
15194 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
15195
15196         * Adjustments for Beta2. 
15197
15198 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
15199
15200         * decl.cs: Added `Define' abstract method.
15201         (InTransit): new property, used to catch recursive definitions. 
15202
15203         * interface.cs: Implement `Define'. 
15204
15205         * modifiers.cs: Map Modifiers.constants to
15206         System.Reflection.TypeAttribute flags.
15207
15208         * class.cs: Keep track of types and user-defined types.
15209         (BuilderInit): New method for creating an assembly
15210         (ResolveType): New function to launch the resolution process, only
15211         used by interfaces for now.
15212
15213         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
15214         that are inserted into the name space. 
15215
15216 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
15217
15218         * ARGH.  I have screwed up my tree so many times due to the use of
15219         rsync rather than using CVS.  Going to fix this at once. 
15220
15221         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
15222         load types.
15223
15224 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
15225
15226         * Experiment successful: Use System.Type rather that our own
15227         version of Type.  
15228
15229 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
15230
15231         * cs-parser.jay: Removed nsAliases from here.
15232
15233         Use new namespaces, handle `using XXX;' 
15234
15235         * namespace.cs: Reimplemented namespace handling, use a recursive
15236         definition of the class.  Now we can keep track of using clauses
15237         and catch invalid using clauses.
15238
15239 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
15240
15241         * gen-treedump.cs: Adapted for all the renaming.
15242
15243         * expression.cs (Expression): this class now has a Type property
15244         which returns an expression Type.
15245
15246         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
15247         `Type', as this has a different meaning now in the base
15248
15249 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
15250
15251         * interface.cs, class.cs: Removed from all the sources the
15252         references to signature computation, as we can not do method
15253         signature computation during the parsing time, as we are not
15254         trying to solve at that point distinguishing:
15255
15256         class X {
15257                 void a (Blah x) {}
15258                 void a (NS.Blah x) {}
15259         }
15260
15261         Which depending on the context might be valid or not, as we do not
15262         know if Blah is the same thing as NS.Blah at that point.
15263
15264         * Redid everything so the code uses TypeRefs now instead of
15265         Types.  TypeRefs are just temporary type placeholders, that need
15266         to be resolved.  They initially have a pointer to a string and the
15267         current scope in which they are used.  This is used later by the
15268         compiler to resolve the reference to an actual Type. 
15269
15270         * DeclSpace is no longer a CIR.Type, and neither are
15271         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
15272         are all DeclSpaces, but no Types. 
15273
15274         * type.cs (TypeRefManager): This implements the TypeRef manager,
15275         which keeps track of all the types that need to be resolved after
15276         the parsing has finished. 
15277
15278 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
15279
15280         * ARGH.  We are going to have to store `foreach' as a class rather
15281         than resolving it, as we need to verify error 1579 after name
15282         resolution.   *OR* we could keep a flag that says `This request to
15283         IEnumerator comes from a foreach statement' which we can then use
15284         to generate the error.
15285
15286 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
15287
15288         * class.cs (TypeContainer.AddMethod): we now add methods to the
15289         MethodGroup instead of the method hashtable.  
15290
15291         * expression.cs: Add MethodGroup abstraction, which gets us one
15292         step closer to the specification in the way we handle method
15293         declarations.  
15294
15295         * cs-parser.jay (primary_expression): qualified_identifier now
15296         tried to match up an identifier to a local variable reference or
15297         to a parameter reference.
15298
15299         current_local_parameters is now a parser global variable that
15300         points to the current parameters for the block, used during name
15301         lookup.
15302
15303         (property_declaration): Now creates an implicit `value' argument to
15304         the set accessor.
15305
15306 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
15307
15308         * parameter.cs: Do not use `param' arguments as part of the
15309         signature, per the spec.
15310
15311 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
15312
15313         * decl.cs: Base class for classes, structs and interfaces.  This
15314         is the "Declaration Space" 
15315
15316         * cs-parser.jay: Use CheckDef for checking declaration errors
15317         instead of having one on each function.
15318
15319         * class.cs: Factor out some code for handling error handling in
15320         accordance to the "Declarations" section in the "Basic Concepts"
15321         chapter in the ECMA C# spec.
15322
15323         * interface.cs: Make all interface member classes derive from
15324         InterfaceMemberBase.
15325
15326 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
15327
15328         * Many things: all interfaces are parsed and generated in
15329         gen-treedump.  Support for member variables, constructors,
15330         destructors, properties, constants is there.
15331
15332         Beginning of the IL backend, but very little done, just there for
15333         testing purposes. 
15334
15335 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
15336
15337         * cs-parser.jay: Fix labeled statement.
15338
15339         * cs-tokenizer.cs (escape): Escape " and ' always.
15340         ref_line, ref_name: keep track of the line/filename as instructed
15341         by #line by the compiler.
15342         Parse #line.
15343
15344 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
15345
15346         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
15347         to match the values in System.CodeDOM.
15348
15349         Divid renamed to Divide.
15350
15351         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
15352         statements. 
15353         (Statements.set): remove.
15354
15355         * System.CodeDOM/CodeCatchClause.cs: always have a valid
15356         statements. 
15357
15358         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
15359         falseStatements always have valid values. 
15360
15361         * cs-parser.jay: Use System.CodeDOM now.
15362