A type parameter can never be optional.
[mono.git] / mcs / gmcs / ChangeLog
1 2004-06-03  Martin Baulig  <martin@ximian.com>
2
3         * generic.cs (ConstructedType.GetMemberAccess): Renamed to
4         GetSimpleName() and return a SimpleName.
5
6         * ecore.cs (SimpleName.Arguments): New public field.
7         (SimpleName): Added overloaded ctor which takes an additional
8         TypeArguments argument.
9         (SimpleName.SimpleNameResolve): Added support for generic methods.
10         (MethodGroupExpr.ResolveGeneric): New public method.  The code was
11         formerly in MemberAccess.DoResolve(), but we also need it in
12         SimpleNameResolve().
13
14         * expression.cs (MemberAccess.DoResolve): Use the new
15         MethodGroupExpr.ResolveGeneric().       
16
17 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
18
19         * decl.cs: If possible, use lookuptypedirect here. We can only do
20         this if there is no `.' after the namespace. Avoids using
21         LookupType, which does lots of slow processing.
22         (FindNestedType) New method, does what it says :-).
23         * namespace.cs: use LookupTypeDirect.
24         * rootcontext.cs: use membercache, if possible.
25         * typemanager.cs (LookupTypeDirect): Cache negative hits too.
26
27 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
28
29         * expression.cs:
30         According to the spec, 
31
32         In a member access of the form E.I, if E is a single identifier,
33         and if the meaning of E as a simple-name (§7.5.2) is a constant,
34         field, property, localvariable, or parameter with the same type as
35         the meaning of E as a type-name (§3.8), then both possible
36         meanings of E are permitted.
37
38         We did not check that E as a simple-name had the same type as E as
39         a type name.
40
41         This trivial check gives us 5-7% on bootstrap time.
42
43 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
44
45         * expression.cs (Invocation.OverloadResolve): Avoid the
46         use of hashtables and boxing here by allocating on demand.
47
48 2004-05-30  Martin Baulig  <martin@ximian.com>
49
50         * rootcontext.cs (RootContext.LookupType): Don't cache things if
51         we're doing a silent lookup.  Don't try to lookup nested types in
52         TypeManager.object_type (thanks to Ben Maurer).
53
54 2004-05-30  Martin Baulig  <martin@ximian.com>
55
56         Committing a patch from Ben Maurer.
57
58         * rootcontext.cs (RootContext.LookupType): Cache negative results.
59
60 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
61
62         * convert.cs: add a trivial cache for overload operator resolution.
63
64 2004-05-31  Marek Safar  <marek.safar@seznam.cz>
65
66         * attribute.cs
67         (AttributeTester.GetObsoleteAttribute): Returns instance of
68         ObsoleteAttribute when type is obsolete.
69
70         * class.cs
71         (TypeContainer.VerifyObsoleteAttribute): Override.
72         (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
73         (MethodCode.VerifyObsoleteAttribute): Override.
74         (MemberBase.VerifyObsoleteAttribute): Override.
75
76         * decl.cs
77         (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
78         and report proper error.
79
80         *delegate.cs
81         (Delegate.VerifyObsoleteAttribute): Override.
82
83         * ecore.cs
84         (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
85         and report proper error.
86         (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
87
88         * enum.cs
89         (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
90         and enum member.
91
92         * expression.cs
93         (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
94         New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
95         Added test for ObsoleteAttribute.
96
97         * statement.cs
98         (Catch): Derived from Statement.
99
100 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
101
102         * decl.cs: If possible, use lookuptypedirect here. We can only do
103         this if there is no `.' after the namespace. Avoids using
104         LookupType, which does lots of slow processing.
105         (FindNestedType) New method, does what it says :-).
106         * namespace.cs: use LookupTypeDirect.
107         * rootcontext.cs: use membercache, if possible.
108         * typemanager.cs (LookupTypeDirect): Cache negative hits too.
109
110 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
111
112         * expression.cs:
113         According to the spec, 
114
115         In a member access of the form E.I, if E is a single identifier,
116         and if the meaning of E as a simple-name (§7.5.2) is a constant,
117         field, property, localvariable, or parameter with the same type as
118         the meaning of E as a type-name (§3.8), then both possible
119         meanings of E are permitted.
120
121         We did not check that E as a simple-name had the same type as E as
122         a type name.
123
124         This trivial check gives us 5-7% on bootstrap time.
125
126 2004-05-30  Marek Safar  <marek.safar@seznam.cz>
127
128         Fixed bug #59071 & cs0160.cs
129         * statement.cs (Try.Resolve): Check here whether order of catch
130         clauses matches their dependencies.
131
132 2004-05-30  Marek Safar  <marek.safar@seznam.cz>
133
134         Fixed bug #58624
135         * ecore.cs (SimpleName.SimpleNameResolve): Added test for
136         unsafe type.
137
138 2004-05-30 Ben Maurer  <bmaurer@users.sourceforge.net>
139
140         * expression.cs (Invocation.OverloadResolve): Avoid the
141         use of hashtables and boxing here by allocating on demand.
142
143 2004-05-30  Martin Baulig  <martin@ximian.com>
144
145         * rootcontext.cs (RootContext.LookupType): Don't cache things if
146         we're doing a silent lookup.  Don't try to lookup nested types in
147         TypeManager.object_type (thanks to Ben Maurer).
148
149 2004-05-30  Martin Baulig  <martin@ximian.com>
150
151         Committing a patch from Ben Maurer.
152
153         * rootcontext.cs (RootContext.LookupType): Cache negative results.      
154
155 2004-05-29  Martin Baulig  <martin@ximian.com>
156
157         * class.cs (IMethodData.ShouldIgnore): New method.
158
159         * typemanager.cs (TypeManager.MethodFlags): Don't take a
160         `Location' argument, we don't need it anywhere.  Use
161         `IMethodData.ShouldIgnore ()' instead of
162         `MethodData.GetMethodFlags ()'.
163         (TypeManager.AddMethod): Removed.
164         (TypeManager.AddMethod2): Renamed to AddMethod.
165
166 2004-05-29  Martin Baulig  <martin@ximian.com>
167
168         Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
169
170         * convert.cs (Convert.ImplicitReferenceConversion): If we're
171         converting from a class type S to an interface type and we already
172         have an object on the stack, don't box it again.  Fixes #52578.
173
174 2004-05-29  Martin Baulig  <martin@ximian.com>
175
176         * class.cs (ConstructorInitializer.GetOverloadedConstructor):
177         Added support for `params' parameters.  Fixes #59267.
178
179 2004-05-29  Martin Baulig  <martin@ximian.com>
180
181         * literal.cs (NullPointer): Provide a private .ctor which sets
182         `type' to TypeManager.object_type.  Fixes #59048.
183
184 2004-05-29  Martin Baulig  <martin@ximian.com>
185
186         * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
187         EventExpr, set `ee.InstanceExpression = left'.  Fixes #59188.
188
189         * ecore.cs (EventExpr.instance_expr): Make the field private.
190
191 2004-05-26  Marek Safar  <marek.safar@seznam.cz>
192
193         Fixed bug #50080 & cs0214-2.cs
194         * expression.cs (Cast.DoResolve): Check unsafe context here.
195         
196         * statement.cs (Resolve.DoResolve): Likewise.
197
198 2004-05-26  Martin Baulig  <martin@ximian.com>
199
200         * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
201
202         * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
203         (RootContext.LookupType): Pass down the `silent' flag.
204
205 2004-05-25  Martin Baulig  <martin@ximian.com>
206
207         * expression.cs
208         (MethodGroupExpr.IdenticalTypeName): New public property.
209         (Invocation.DoResolve): Don't report a CS0176 if the "instance"
210         expression actually refers to a type.
211
212 2004-05-25  Martin Baulig  <martin@ximian.com>
213
214         * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
215         for #56176 and made it actually work.
216
217 2004-05-25  Martin Baulig  <martin@ximian.com>
218
219         * ecore.cs (Expression.CacheTemporaries): Make this virtual.
220         (FieldExpr, PropertyExpr): Override and implement
221         CacheTemporaries.  Fixes #52279.
222
223 2004-05-25  Miguel de Icaza  <miguel@ximian.com>
224
225         * location.cs: In the new compiler listing a file twice is a
226         warning, not an error.
227
228 2004-05-24  Martin Baulig  <martin@ximian.com>
229
230         * enum.cs (Enum.DefineType): For the `BaseType' to be a
231         TypeLookupExpression; otherwise, report a CS1008.  Fixes #58571.
232
233 2004-05-24  Martin Baulig  <martin@ximian.com>
234
235         * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
236         walking the `using' list.  Fixes #53921.
237
238 2004-05-24  Martin Baulig  <martin@ximian.com>
239
240         * const.cs (Const.LookupConstantValue): Added support for
241         EmptyCast's; fixes #55251.
242
243 2004-05-24  Martin Baulig  <martin@ximian.com>
244
245         * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
246         DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
247         which does the CS0135 check.  The reason is that we first need to
248         check whether the variable actually exists.
249
250 2004-05-24  Martin Baulig  <martin@ximian.com>
251
252         * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
253         than RootContext.LookupType() to find the explicit interface
254         type.  Fixes #58584.
255
256 2004-05-24  Raja R Harinath  <rharinath@novell.com>
257
258         * Makefile: Simplify.  Use executable.make.
259         * mcs.exe.sources: New file.  List of sources of mcs.exe.
260
261 2004-05-24  Anders Carlsson  <andersca@gnome.org>
262
263         * decl.cs:
264         * enum.cs:
265         Use the invariant culture when doing String.Compare for CLS case
266         sensitivity.
267         
268 2004-05-23  Martin Baulig  <martin@ximian.com>
269
270         * decl.cs (DeclSpace.FindType): Only check the `using' list if we
271         don't have any dots.  Fixes #52622, added cs0246-8.cs.
272
273         * namespace.cs (NamespaceEntry.Lookup): Likewise.
274
275 2004-05-23  Marek Safar  <marek.safar@seznam.cz>
276
277         * class.cs (MemberBase.Define): Reuse MemberType member for 
278         resolved type. Other methods can use it too.
279
280 2004-05-23  Martin Baulig  <martin@ximian.com>
281
282         * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
283         the variable also exists in the current block (otherwise, we need
284         to report a CS0103).  Fixes #58670.
285
286 2004-05-23  Martin Baulig  <martin@ximian.com>
287
288         * flowanalysis.cs (Reachability.Reachable): Compute this
289         on-the-fly rather than storing it as a field.
290
291 2004-05-23  Martin Baulig  <martin@ximian.com>
292
293         * flowanalysis.cs (Reachability.And): Manually compute the
294         resulting `barrier' from the reachability.      
295        
296 2004-05-23  Marek Safar  <marek.safar@seznam.cz>
297
298         Fix bug #57835
299         * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
300         instance of ObsoleteAttribute when symbol is obsolete.
301
302         * class.cs
303         (IMethodData): Extended interface for ObsoleteAttribute support.
304
305 2004-05-22  Marek Safar  <marek.safar@seznam.cz>
306
307         * attribute.cs: Fix bug #55970
308
309 2004-05-22  Marek Safar  <marek.safar@seznam.cz>
310
311         Fix bug #52705
312         * attribute.cs
313         (GetObsoleteAttribute): New method. Creates the instance of
314         ObsoleteAttribute.
315         (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
316         ObsoleteAttribute when member is obsolete.
317         (AttributeTester.Report_ObsoleteMessage): Common method for
318         Obsolete error/warning reporting.
319
320         * class.cs
321         (TypeContainer.base_classs_type): New member for storing parent type.
322
323         * decl.cs
324         (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
325         for this MemberCore.
326
327 2004-05-21  Marek Safar  <marek.safar@seznam.cz>
328
329         * attribute.cs, const.cs: Fix bug #58590
330
331 2004-05-21  Martin Baulig  <martin@ximian.com>
332
333         * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
334         out parameters if the end of the method is unreachable.  Fixes
335         #58098. 
336
337 2004-05-21  Marek Safar  <marek.safar@seznam.cz>
338
339         * codegen.cs, cs-parser.jay: Removed SetAttributes method.
340         Hari was right, why extra method.
341
342 2004-05-21  Marek Safar  <marek.safar@seznam.cz>
343
344         * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
345
346 2004-05-20  Martin Baulig  <martin@ximian.com>
347
348         * delegate.cs: Convert this file to Unix mode - like the original
349         version in mcs is.
350
351 2004-05-20  Martin Baulig  <martin@ximian.com>
352
353         * attribute.cs: Convert this file to Unix mode - like the original
354         version in mcs is.
355
356 2004-05-19  Marek Safar  <marek.safar@seznam.cz>
357
358        Fix bug #58688 (MCS does not report error when the same attribute
359        is assigned twice)
360
361        * attribute.cs (Attribute.Emit): Distinction between null and default.
362
363 2004-05-19  Raja R Harinath  <rharinath@novell.com>
364
365        * cs-parser.jay (attribute): Create a GlobalAttribute for the case
366        of a top-level attribute without an attribute target.
367        * attribute.cs (Attribute.Error_AttributeConstructorMismatch): 
368        Make non-static.
369        (Attribute.Conditional_GetConditionName), 
370        (Attribute.Obsolete_GetObsoleteMessage): Update.
371        (Attribute.IndexerName_GetIndexerName): New.  Attribute-specific
372        part of ScanForIndexerName.
373        (Attribute.CanIgnoreInvalidAttribute): New function.
374        (Attribute.ScanForIndexerName): Move to ...
375        (Attributes.ScanForIndexerName): ... here.
376        (Attributes.Attrs): Rename from now-misnamed AttributeSections.
377        (Attributes.Search): New internal variant that can choose not to
378        complain if types aren't resolved.  The original signature now
379        complains.
380        (Attributes.GetClsCompliantAttribute): Use internal variant, with
381        complaints suppressed.
382        (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
383        only if it not useful.
384        (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
385        top-level for attributes that are shared between the assembly
386        and a top-level class.
387        * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
388        * class.cs: Update to reflect changes.
389        (DefineIndexers): Fuse loops.
390        * codegen.cs (GetAssemblyName): Update to reflect changes.  Accept
391        a couple more variants of attribute names.
392
393 2004-05-18  Marek Safar  <marek.safar@seznam.cz>
394
395         Fix bug #52585 (Implemented explicit attribute declaration)
396
397         * attribute.cs:
398         (Attributable.ValidAttributeTargets): New abstract method. It gets
399         list of valid attribute targets for explicit target declaration.
400         (Attribute.Target): It holds target itself.
401         (AttributeSection): Removed.
402         (Attribute.CheckTargets): New method. It checks whether attribute
403         target is valid for the current element.
404
405         * class.cs:
406         (EventProperty): New class. For events that are declared like
407         property (with add and remove accessors).
408         (EventField): New class. For events that are declared like field.
409         class.cs
410
411         * cs-parser.jay: Implemented explicit attribute target declaration.
412
413         * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:        
414         Override ValidAttributeTargets.
415
416         * parameter.cs:
417         (ReturnParameter): Class for applying custom attributes on 
418         the return type.
419         (ParameterAtribute): New class. Class for applying custom
420         attributes on the parameter type.
421
422 2004-05-17  Miguel de Icaza  <miguel@ximian.com>
423
424         * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
425         definitions. 
426
427         (Method): Allow UNSAFE here.
428
429         * modifiers.cs: Support unsafe reporting.
430
431 2004-05-17  Marek Safar  <marek.safar@seznam.cz>
432
433         * decl.cs: Fix bug #58478.
434
435 2004-05-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
436
437         * statement.cs: When checking for unreachable code on an EmptyStatement,
438         set the location. Fixes bug #58488.
439
440 2004-05-13  Miguel de Icaza  <miguel@ximian.com>
441
442         * driver.cs: Add -pkg handling.
443
444         From Gonzalo: UseShelLExecute=false
445
446 2004-05-12  Marek Safar  <marek.safar@seznam.cz>
447
448         * attribute.cs:
449         (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
450         for attribute.
451         (Attribute.IsClsCompliaceRequired): Moved to base for better
452         accesibility.
453         (Attribute.UsageAttribute): New property for AttributeUsageAttribute
454         when attribute is AttributeUsageAttribute.
455         (Attribute.GetValidTargets): Simplified.
456         (Attribute.GetAttributeUsage): New method returns AttributeUsage
457         attribute for this type.
458         (Attribute.ApplyAttributes): Method renamed to Emit and make
459         non-static.
460         (GlobalAttributeSection): New class for special handling of global
461         attributes (assembly, module).
462         (AttributeSection.Emit): New method.
463
464         * class.cs: Implemented Attributable abstract methods.
465         (MethodCore.LabelParameters): Moved to Parameter class.
466         (Accessor): Is back simple class.
467         (PropertyMethod): Implemented Attributable abstract class.
468         (DelegateMethod): Implemented Attributable abstract class.
469         (Event): New constructor for disctintion between normal Event
470         and Event with accessors.
471
472         * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
473
474         * codegen.cs, const.cs, decl.cs, delegate.cs:
475         (CommonAssemblyModulClass): Implemented Attributable abstract class
476         and simplified.
477
478         * enum.cs: Implement IAttributeSupport interface.
479         (EnumMember): New class for emum members. Implemented Attributable
480         abstract class
481
482         * parameter.cs:
483         (ParameterBase): Is abstract.
484         (ReturnParameter): New class for easier [return:] attribute handling.
485
486         * typemanager.cs: Removed builder_to_attr.
487
488 2004-05-11  Raja R Harinath  <rharinath@novell.com>
489
490         Fix bug #57151.
491         * attribute.cs (Attribute.GetPositionalValue): New function.
492         * class.cs (TypeContainer.VerifyMembers): New function.
493         (TypeContainer.Emit): Use it.
494         (ClassOrStruct): New base class for Class and Struct.
495         (ClassOrStruct.ApplyAttributeBuilder): New function.  Note if 
496         StructLayout(LayoutKind.Explicit) was ascribed to the struct or
497         class.
498         (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
499         then each non-static field should have a FieldOffset attribute.
500         Otherwise, none of the fields should have a FieldOffset attribute.
501         * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout 
502         and FieldOffset attributes.
503         * typemanager.cs (TypeManager.struct_layout_attribute_type)
504         (TypeManager.field_offset_attribute_type): New core types.
505         (TypeManager.InitCoreTypes): Initialize them.
506
507 2004-05-11  Michal Moskal  <malekith@pld-linux.org>
508
509         * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
510         Return correct type.
511         From bug #58270.
512
513 2004-05-09  Miguel de Icaza  <miguel@ximian.com>
514
515         * expression.cs (Binary.DoNumericPromotions): 0 long constant can
516         be implicitly converted to ulong.
517         
518         * expression.cs: The logic for allowing operator &, | and ^ worked
519         was wrong, it worked before because we did not report an error in
520         an else branch.  Fixes 57895.
521
522         * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
523         allow volatile fields to be reference types.
524
525 2004-05-07  Miguel de Icaza  <miguel@ximian.com>
526
527         * driver.cs: Add support for /debug-
528
529 2004-05-07  Raja R Harinath  <rharinath@novell.com>
530
531         * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType): 
532         Add a 'complain' parameter to silence errors.
533         (Attribute.Resolve): Update to changes.  Put in sanity check to catch
534         silently overlooked type-resolutions.
535         (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
536         to reflect changes.
537         (Attributes.Search): New function.
538         (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
539         (Attributes.GetAttributeFullName): Remove hack.
540         * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes): 
541         Update to reflect changes.
542         * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
543         Use Attributes.Search instead of nested loops.
544
545 2004-05-07  Marek Safar  <marek.safar@seznam.cz>
546
547         * decl.cs:
548         (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
549         (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
550         (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
551
552         * report.cs: (Report.Warning): Renamed to Warning_T because of
553         parameter collision.
554
555 2004-05-05  Raja R Harinath  <rharinath@novell.com>
556
557         * expression.cs (MemberAccess.ResolveMemberAccess):
558         Exit with non-zero status after Report.Error.
559         * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
560         Likewise.
561         * typemanager.cs (TypeManager.CoreLookupType): Likewise.
562
563 2004-05-04  Lluis Sanchez Gual  <lluis@ximian.com>
564
565         * support.cs: Don't hang when the file is empty.
566
567 2004-05-04  Lluis Sanchez Gual  <lluis@ximian.com>
568
569         * support.cs: In SeekableStreamReader, compute the preamble size of the
570           underlying stream. Position changes should take into account that initial
571           count of bytes.
572
573 2004-05-03  Todd Berman  <tberman@sevenl.net>
574
575         * driver.cs: remove unused GetSysVersion function.
576
577 2004-05-03  Todd Berman  <tberman@sevenl.net>
578
579         * driver.cs: Remove the hack from saturday, as well as the hack
580         from jackson (LoadAssemblyFromGac), also adds the CWD to the
581         link_paths to get that bit proper.
582
583 2004-05-01  Todd Berman  <tberman@sevenl.net>
584
585         * driver.cs: Try a LoadFrom before a Load, this checks the current
586         path. This is currently a bug in mono that is be fixed, however, this
587         provides a workaround for now. This will be removed when the bug
588         is fixed.
589
590 2004-05-01  Sebastien Pouliot  <sebastien@ximian.com>
591
592         * CryptoConvert.cs: Updated to latest version. Fix issue with 
593         incomplete key pairs (#57941).
594
595 2004-05-01  Todd Berman  <tberman@sevenl.net>
596
597         * driver.cs: Remove '.' from path_chars, now System.* loads properly
598         from the GAC
599
600 2004-04-30  Jackson Harper  <jackson@ximian.com>
601
602         * codegen.cs: Open keys readonly.
603         
604 2004-04-30  Gonzalo Paniagua Javier <gonzalo@ximian.com>
605
606         * typemanager.cs: don't report cyclic struct layout when a struct
607         contains 2 or more fields of the same type. Failed for Pango.AttrShape
608         which has 2 Pango.Rectangle fields.
609
610 2004-04-29 Ben Maurer  <bmaurer@users.sourceforge.net>
611
612         * expression.cs: Handle IntPtr comparisons with IL code
613         rather than a method call.
614
615 2004-04-29  Martin Baulig  <martin@ximian.com>
616
617         * ecore.cs (PropertyExpr.FindAccessor): New private method.  Walk
618         the list of PropertyInfo's in class hierarchy and find the
619         accessor.  Fixes #56013.
620
621 2004-04-29  Martin Baulig  <martin@ximian.com>
622
623         * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
624
625 2004-04-29  Martin Baulig  <martin@ximian.com>
626
627         Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
628
629         * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
630
631 2004-04-29  Martin Baulig  <martin@ximian.com>
632
633         * class.cs (ConstructorInitializer.Resolve): Check whether the
634         parent .ctor is accessible.  Fixes #52146.
635
636 2004-04-29  Martin Baulig  <martin@ximian.com>
637
638         Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
639
640         * statement.cs (Using.EmitLocalVariableDecls): Use
641         TypeManager.idisposable_type, not typeof (IDisposable).
642         (Foreach.EmitCollectionForeach): Added support for valuetypes.
643
644 2004-04-29  Martin Baulig  <martin@ximian.com>
645
646         * class.cs (Event.Define): Don't emit the field and don't set
647         RTSpecialName and SpecialName for events on interfaces.  Fixes
648         #57703. 
649
650 2004-04-29  Raja R Harinath  <rharinath@novell.com>
651
652         Refactor Attribute.ApplyAttributes.
653         * attribute.cs (Attributable): New base class for objects that can
654         have Attributes applied on them.
655         (Attribute): Make AttributeUsage fields public.
656         (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
657         (Attribute.IsInternalCall): New property.
658         (Attribute.UsageAttr): Convert to a public read-only property.
659         (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
660         (Attribute.ResolveType, Attribute.Resolve)
661         (Attribute.ScanForIndexerName): Update to reflect changes.
662         (Attribute.CheckAttributeTarget): Re-format.
663         (Attribute.ApplyAttributes): Refactor, to various
664         Attributable.ApplyAttributeBuilder methods.
665         * decl.cs (MemberCore): Make Attributable.
666         * class.cs (Accessor): Make Attributable.
667         (MethodData.ApplyAttributes): Use proper attribute types, not
668         attribute names.
669         (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
670         (TypeContainer.ApplyAttributeBuilder)
671         (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
672         (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)   
673         (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
674         (Operator.ApplyAttributeBuilder): New factored-out methods.
675         * const.cs (Const.ApplyAttributeBuilder): Likewise.
676         * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
677         * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
678         * parameter.cs (ParameterBase): New Attributable base class
679         that can also represent Return types.
680         (Parameter): Update to the changes.
681
682 2004-04-29  Jackson Harper  <jackson@ximian.com>
683
684         * driver.cs: Prefer the corlib system version when looking for
685         assemblies in the GAC. This is still a hack, but its a better hack
686         now.
687         
688 2004-04-29  Marek Safar  <marek.safar@seznam.cz>
689
690         * decl.cs, enum.cs: Improved error 3005 reporting.
691   
692         * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
693         (related_symbols): New private member for list of symbols
694         related to reported error/warning.
695         
696         * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
697
698 2004-04-29  Martin Baulig  <martin@ximian.com>
699
700         * ecore.cs (Expression.Constantify): If we're an enum and
701         TypeManager.TypeToCoreType() doesn't give us another type, use
702         t.UnderlyingSystemType.  Fixes #56178.  
703
704 2004-04-29  Martin Baulig  <martin@ximian.com>
705
706         * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
707         interfaces and for each interface, only add members directly
708         declared in that interface.  Fixes #53255.
709
710 2004-04-28  Martin Baulig  <martin@ximian.com>
711
712         * expression.cs (ConditionalLogicalOperator): Use a temporary
713         variable for `left' to avoid that we evaluate it more than once;
714         bug #52588.
715
716 2004-04-28  Martin Baulig  <martin@ximian.com>
717
718         * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
719         `void[]' (CS1547).
720
721 2004-04-28  Martin Baulig  <martin@ximian.com>
722
723         * statement.cs (LocalInfo.Resolve): Check whether the type is not
724         void (CS1547).
725
726         * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
727         whether the type is not void (CS1547).
728
729 2004-04-28  Martin Baulig  <martin@ximian.com>
730
731         * expression.cs (Unary.DoResolveLValue): Override this and report
732         CS0131 for anything but Operator.Indirection.
733
734 2004-04-28  Martin Baulig  <martin@ximian.com>
735
736         Committing a patch from Ben Maurer; see bug #50820.
737
738         * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
739         check for classes.
740
741         * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
742         classes.        
743
744 2004-04-28  Martin Baulig  <martin@ximian.com>
745
746         Committing a patch from Ben Maurer; see bug #50820.
747
748         * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
749         check for classes.
750
751         * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
752         classes.        
753
754 2004-04-28  Martin Baulig  <martin@ximian.com>
755
756         * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
757         (Block.AddLabel): Call DoLookupLabel() to only search in the
758         current block.
759
760 2004-04-28  Martin Baulig  <martin@ximian.com>
761
762         * cfold.cs (ConstantFold.BinaryFold): Added special support for
763         comparing StringConstants and NullLiterals in Equality and Inequality.
764
765 2004-04-28  Jackson Harper  <jackson@ximian.com>
766
767         * driver.cs: Attempt to load referenced assemblies from the
768         GAC. This is the quick and dirty version of this method that
769         doesnt take into account versions and just takes the first
770         canidate found. Will be good enough for now as we will not have more
771         then one version installed into the GAC until I update this method.
772
773 2004-04-28  Martin Baulig  <martin@ximian.com>
774
775         * typemanager.cs (TypeManager.CheckStructCycles): New public
776         static method to check for cycles in the struct layout.
777
778         * rootcontext.cs (RootContext.PopulateTypes): Call
779         TypeManager.CheckStructCycles() for each TypeContainer.
780         [Note: We only need to visit each type once.]
781
782 2004-04-28  Martin Baulig  <martin@ximian.com>
783
784         * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
785
786         * const.cs (Const.LookupConstantValue): Return a `bool' signalling
787         success and added `out object value'.  Use a `bool resolved' field
788         to check whether we've already been called rather than
789         `ConstantValue != null' since this breaks for NullLiterals.
790
791 2004-04-28  Raja R Harinath  <rharinath@novell.com>
792
793         * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
794         setting of this flag, since the 'set' method may be non-public.
795
796 2004-04-28  Raja R Harinath  <rharinath@novell.com>
797
798         * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
799         check on current_vector.Block.
800
801 2004-04-27  Martin Baulig  <martin@ximian.com>
802
803         * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
804         a field initializer.  Fixes #56459.
805
806 2004-04-27  Martin Baulig  <martin@ximian.com>
807
808         * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
809         we're not attempting to use an indexer.  Fixes #52154.
810
811 2004-04-27  Martin Baulig  <martin@ximian.com>
812
813         * statement.cs (Return): Don't create a return label if we don't
814         need it; reverts my change from January 20th.  Thanks to Ben
815         Maurer for this.
816
817 2004-04-27  Martin Baulig  <martin@ximian.com>
818
819         According to the spec, `goto' can only leave a nested scope, but
820         never enter it.
821
822         * statement.cs (Block.LookupLabel): Only lookup in the current
823         block, don't recurse into parent or child blocks.
824         (Block.AddLabel): Check in parent and child blocks, report
825         CS0140/CS0158 if we find a duplicate.
826         (Block): Removed this indexer for label lookups.
827         (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
828         this already does the error reporting for us.
829
830         * flowanalysis.cs
831         (FlowBranching.UsageVector.Block): New public variable; may be null.
832         (FlowBranching.CreateSibling): Added `Block' argument.
833         (FlowBranching.LookupLabel): New public virtual method.  Lookup a
834         label for the target of a `goto' and check whether we're not
835         leaving a `finally'.
836
837 2004-04-27  Martin Baulig  <martin@ximian.com>
838
839         * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
840         a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
841         just for returns).
842
843 2004-04-27  Martin Baulig  <martin@ximian.com>
844
845         * statement.cs (Block.AddLabel): Also check for implicit blocks
846         and added a CS0158 check.
847
848 2004-04-27  Martin Baulig  <martin@ximian.com>
849
850         * flowanalysis.cs (FlowBranchingLoop): New class.
851         (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
852         UsageVector's instead of an ArrayList.
853         (FlowBranching.Label): Likewise.
854         (FlowBranching.UsageVector.MergeBreakOrigins): New method.
855         (FlowBranching.AddBreakVector): New method.
856
857 2004-04-27  Miguel de Icaza  <miguel@ximian.com>
858
859         * attribute.cs: Small regression fix: only convert the type if we
860         the type is different, fixes System.Drawing build.
861
862 2004-04-27  Martin Baulig  <martin@ximian.com>
863
864         * attribute.cs (Attribute.Resolve): If we have a constant value
865         for a named field or property, implicity convert it to the correct
866         type.
867
868 2004-04-27  Raja R Harinath  <rharinath@novell.com>
869
870         * statement.cs (Block.Block): Implicit blocks share
871         'child_variable_names' fields with parent blocks.
872         (Block.AddChildVariableNames): Remove.
873         (Block.AddVariable): Mark variable as "used by a child block" in
874         every surrounding block.
875         * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
876         been used in a child block, complain about violation of "Invariant
877         meaning in blocks" rule.
878         * cs-parser.jay (declare_local_variables): Don't use
879         AddChildVariableNames.
880         (foreach_statement): Don't create an implicit block: 'foreach'
881         introduces a scope.
882
883 2004-04-23  Miguel de Icaza  <miguel@ximian.com>
884
885         * convert.cs (ImplicitNumericConversion): 0 is also positive when
886         converting from 0L to ulong.  Fixes 57522.
887
888 2004-04-22  Marek Safar  <marek.safar@seznam.cz>
889
890         * decl.cs (FindMemberToOverride): Fix wrong warning for case when
891         derived class hides via 'new' keyword field from base class (test-242.cs).
892         TODO: Handle this in the more general way.
893         
894         * class.cs (CheckBase): Ditto.
895
896 2004-04-22  Marek Safar  <marek.safar@seznam.cz>
897
898         * decl.cs (caching_flags): New member for storing cached values
899         as bit flags.
900         (MemberCore.Flags): New enum where bit flags for caching_flags
901         are defined.
902         (MemberCore.cls_compliance): Moved to caching_flags.
903         (DeclSpace.Created): Moved to caching_flags.
904
905         * class.cs: Use caching_flags instead of DeclSpace.Created
906         
907 2004-04-21  Miguel de Icaza  <miguel@ximian.com>
908
909         * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
910         if we are only a derived class, not a nested class.
911
912         * typemanager.cs: Same as above, but do this at the MemberLookup
913         level (used by field and methods, properties are handled in
914         PropertyExpr).   Allow for the qualified access if we are a nested
915         method. 
916
917 2004-04-21  Marek Safar  <marek.safar@seznam.cz>
918
919         * class.cs: Refactoring.
920         (IMethodData): New inteface; Holds links to parent members
921         to avoid member duplication (reduced memory allocation).
922         (Method): Implemented IMethodData interface.
923         (PropertyBase): New inner classes for get/set methods.
924         (PropertyBase.PropertyMethod): Implemented IMethodData interface
925         (Event): New inner classes for add/remove methods.
926         (Event.DelegateMethod): Implemented IMethodData interface.
927
928         * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
929         EmitContext (related to class.cs refactoring).
930
931 2004-04-21  Raja R Harinath  <rharinath@novell.com>
932
933         * delegate.cs (Delegate.VerifyApplicability): If the number of
934         arguments are the same as the number of parameters, first try to
935         verify applicability ignoring  any 'params' modifier on the last
936         parameter.
937         Fixes #56442.
938
939 2004-04-08  Martin Baulig  <martin@ximian.com>
940
941         Merged latest changes into gmcs.  Please keep this comment in
942         here, it makes it easier for me to see what changed in MCS since
943         the last time I merged.
944
945 2004-04-16  Raja R Harinath  <rharinath@novell.com>
946
947         * class.cs (TypeContainer.AddIndexer): Use
948         'ExplicitInterfaceName' to determine if interface name was
949         explicitly specified.  'InterfaceType' is not initialized at this time.
950         (TypeContainer.DefineIndexers): Remove use of temporary list.  The
951         Indexers array is already in the required order.  Initialize
952         'IndexerName' only if there are normal indexers.
953         (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
954         (TypeContainer.Emit): Emit DefaultMember attribute only if
955         IndexerName is initialized.
956         Fixes #56300.
957
958 2004-04-15  Benjamin Jemlich  <pcgod@gmx.net>
959
960         * enum.cs (Enum.DefineType): Don't allow char as type for enum.
961         Fixes #57007
962
963 2004-04-15  Raja R Harinath  <rharinath@novell.com>
964
965         * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
966         attributes.
967         Fix for #56456.
968
969         * attribute.cs (Attribute.Resolve): Check for duplicate named
970         attributes.
971         Fix for #56463.
972
973 2004-04-15  Miguel de Icaza  <miguel@ximian.com>
974
975         * iterators.cs (MarkYield): track whether we are in an exception,
976         and generate code accordingly.  Use a temporary value to store the
977         result for our state.
978
979         I had ignored a bit the interaction of try/catch with iterators
980         since their behavior was not entirely obvious, but now it is
981         possible to verify that our behavior is the same as MS .NET 2.0
982
983         Fixes 54814
984
985 2004-04-14  Miguel de Icaza  <miguel@ximian.com>
986
987         * iterators.cs: Avoid creating temporaries if there is no work to
988         do. 
989
990         * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
991         Enumerations, use TypeManager.EnumToUnderlying and call
992         recursively. 
993
994         Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
995         bug #57013
996
997         (This.Emit): Use EmitContext.EmitThis to emit our
998         instance variable.
999
1000         (This.EmitAssign): Ditto.
1001
1002         * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
1003         codepaths, we will move all the functionality into
1004         Mono.CSharp.This 
1005
1006         (FieldExpr.EmitAssign): Ditto.
1007
1008         This fixes several hidden bugs that I uncovered while doing a code
1009         review of this today.
1010
1011         * codegen.cs (EmitThis): reworked so the semantics are more clear
1012         and also support value types "this" instances.
1013
1014         * iterators.cs: Changed so that for iterators in value types, we
1015         do not pass the value type as a parameter.  
1016
1017         Initialization of the enumerator helpers is now done in the caller
1018         instead of passing the parameters to the constructors and having
1019         the constructor set the fields.
1020
1021         The fields have now `assembly' visibility instead of private.
1022
1023 2004-04-11  Miguel de Icaza  <miguel@ximian.com>
1024
1025         * expression.cs (Argument.Resolve): Check if fields passed as ref
1026         or out are contained in a MarshalByRefObject.
1027
1028         * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
1029         another compiler type.
1030
1031 2004-04-06 Ben Maurer  <bmaurer@users.sourceforge.net>
1032
1033         * class.cs (Indexer.Define): use the new name checking method.
1034         Also, return false on an error.
1035         * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
1036         (is_identifier_[start/part]_character): make static.
1037
1038 2004-04-10  Miguel de Icaza  <miguel@ximian.com>
1039
1040         * expression.cs (Binary.ResolveOperator): Do no append strings
1041         twice: since we can be invoked more than once (array evaluation)
1042         on the same concatenation, take care of this here.  Based on a fix
1043         from Ben (bug #56454)
1044
1045 2004-04-08  Sebastien Pouliot  <sebastien@ximian.com>
1046
1047         * codegen.cs: Fix another case where CS1548 must be reported (when 
1048         delay-sign isn't specified and no private is available #56564). Fix
1049         loading the ECMA "key" to delay-sign an assembly. Report a CS1548 
1050         error when MCS is used on the MS runtime and we need to delay-sign 
1051         (which seems unsupported by AssemblyBuilder - see #56621).
1052
1053 2004-04-08  Marek Safar  <marek.safar@seznam.cz>
1054
1055         * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
1056         (TypeManager.ComputeNamespaces): Faster implementation for
1057         Microsoft runtime.
1058
1059         * compiler.csproj: Updated AssemblyName to mcs.
1060
1061 2004-05-11  Jackson Harper  <jackson@ximian.com>
1062
1063         * Makefile: Preserve MONO_PATH
1064         
1065 2004-05-11  Jackson Harper  <jackson@ximian.com>
1066
1067         * Makefile: Use mono and mcs to build gmcs
1068         
1069 2004-05-03  Miguel de Icaza  <miguel@ximian.com>
1070
1071         * codegen.cs: Add patch from Robert Shade
1072         <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
1073         sync with mcs.
1074
1075 2004-05-02  Sebastien Pouliot  <sebastien@ximian.com>
1076
1077         * CryptoConvert.cs: Updated to latest version. Fix issue with 
1078         incomplete key pairs (#57941).
1079
1080 2004-04-08  Sebastien Pouliot  <sebastien@ximian.com>
1081
1082         * codegen.cs: Fix another case where CS1548 must be reported (when 
1083         delay-sign isn't specified and no private is available #56564). Fix
1084         loading the ECMA "key" to delay-sign an assembly. Report a CS1548 
1085         error when MCS is used on the MS runtime and we need to delay-sign 
1086         (which seems unsupported by AssemblyBuilder - see #56621).
1087
1088 2004-04-29  Jackson Harper  <jackson@ximian.com>
1089
1090         * Makefile: Set MONO_PATH to use the bootstrap corlib
1091         * driver.cs: Check the GAC for referenced assemblies.
1092                 
1093 2004-04-29  Martin Baulig  <martin@ximian.com>
1094
1095         * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
1096
1097 2004-04-07  Martin Baulig  <martin@ximian.com>
1098
1099         * expression.cs (Binary.ResolveOperator): Added special case for
1100         Equality/Inequality between a type parameter and a null literal.
1101
1102 2004-04-07  Martin Baulig  <martin@ximian.com>
1103
1104         * convert.cs: Check null literal -> type parameter conversions.
1105
1106 2004-04-07  Martin Baulig  <martin@ximian.com>
1107
1108         * generic.cs (ConstructedType.CheckConstraints): Enforce the
1109         `class' and `struct' constraints.
1110
1111 2004-04-07  Martin Baulig  <martin@ximian.com>
1112
1113         * generic.cs (SpecialConstraint): New public enum.
1114         (Constraints.Resolve): Added support for the `class' and `struct'
1115         constraints.
1116
1117         * cs-parser.jay (type_parameter_constraint): Added support for the
1118         `class' and `struct' constraints.
1119
1120 2004-04-07  Martin Baulig  <martin@ximian.com>
1121
1122         * support.cs (GenericConstraints): Replaced `Types' by
1123         `ClassConstraint' and `InterfaceConstraints'; added
1124         `HasClassConstraint'.   
1125
1126 2004-04-07  Martin Baulig  <martin@ximian.com>
1127
1128         * generic.cs
1129         (Constraints.InterfaceConstraints): New public property.
1130         (Constraints.Types): Make this property public
1131         (TypeParameter): Implement IMemberContainer.
1132         (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
1133         instead of a TypeBuilder/MethodBuilder; pass the interface
1134         constraints to TypeManager.AddTypeParameter().
1135         (TypeParameter.DefineType): Just take an EmitContext and no
1136         TypeBuilder/MethodBuilder.  Use the new public API.
1137
1138         * typemanager.cs (TypeManager.AddTypeParameter): Added
1139         `TypeExpr[]' argument; add the interfaces to the
1140         `builder_to_ifaces' hash.
1141         (TypeManager.LookupMemberContainer): For
1142         GenericTypeParameterBuilders, get the TypeParameter from the
1143         `builder_to_type_param'.
1144         (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
1145         the TypeParameter and call FindMembers on it.
1146
1147 2004-04-07  Martin Baulig  <martin@ximian.com>
1148
1149         * class.cs
1150         (MethodCore.GenericMethod): Moved this field here from Method.
1151         (MethodCore.IsDuplicateImplementation): Take the number of type
1152         parameters into account if we're a generic method.
1153
1154         * expression.cs (Invocation.InferTypeArguments): Don't return true
1155         if `arguments' is null; we still need to check whether we actually
1156         don't need to infer anything in this case.
1157         (MemberAccess): Merged the functionality from GenericMemberAccess
1158         into this class.
1159
1160         * generic.cs (GenericMemberAccess): Removed.
1161
1162 2004-04-05  Martin Baulig  <martin@ximian.com>
1163
1164         * decl.cs (MemberCore): For generic classes, interfaces and
1165         structs, `Name' now includes the number of type parameters
1166         ("Stack!1.Node!1").
1167         (DeclSpace.FindType): Removed the `num_type_args' argument; we now
1168         encode the number of type arguments in the type name.
1169
1170         * expression.cs (Expression.MemberLookup): Removed the
1171         `num_type_args' argument; we now encode the number of type
1172         arguments in the type name.
1173
1174         * ecore.cs (SimpleName): Encode the number of type arguments in
1175         the type name itself.
1176
1177         * generic.cs (ConstructedType): Likewise.
1178
1179         * tree.cs (Tree.RecordDecl): Take a `string' instead of a
1180         `MemberName'; we now include the number of type parameters in the
1181         type name.
1182
1183         * typemanager.cs (TypeManager.CheckGeneric): Removed.
1184         (TypeManager.MemberLookup): Removed the
1185         `num_type_args' argument; we now encode the number of type
1186         arguments in the type name.     
1187
1188 2004-04-03  Martin Baulig  <martin@ximian.com>
1189
1190         * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
1191         (MemberCore.MemberName): Moved here from MemberBase.
1192         (DeclSpace.SetParameterInfo): Just take the constraints as an
1193         ArrayList; we already have the type parameters in our
1194         `MemberName'; also do the CS0080 reporting here.
1195
1196         * cs-parser.jay (struct_declaration): Use `member_name' instead of
1197         `IDENTIFIER opt_type_parameter_list'; when constructing our
1198         `MemberName', it'll already include our type parameters.
1199         (class_declaration, interface_declaration): Likewise.
1200         (delegate_declaration): Likewise.
1201         (MakeName): Take a MemberName and return a MemberName.
1202         The following two changes are required to avoid shift/reduce conflicts:
1203         (member_name): Don't include a TypeName anymore; ie. this is now
1204         just 'IDENTIFIER opt_type_parameter_list'.
1205         (property_declaration, event_declaration): Use a
1206         `namespace_or_type_name' instead of a `member_name'.            
1207
1208 2004-04-03  Martin Baulig  <martin@ximian.com>
1209
1210         * decl.cs (MemberName): Renamed to `TypeName' and created a new
1211         `MemberName' class.
1212         (TypeName): Formerly known as MemberName.
1213
1214         * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
1215         instead of a `MemberName'.
1216
1217         * cs-parser.jay (namespace_or_type_name): Create a TypeName.
1218         (member_name): New rule; create a MemberName.
1219
1220 2004-04-02  Martin Baulig  <martin@ximian.com>
1221
1222         * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
1223         (CS0305 and CS0308).
1224
1225 2004-04-02  Martin Baulig  <martin@ximian.com>
1226
1227         * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
1228         support for nested types.
1229
1230 2004-04-02  Martin Baulig  <martin@ximian.com>
1231
1232         * ecore.cs (IAlias): New public interface.
1233         (TypeExpr, TypeExpression): Implement IAlias.
1234         (TypeAliasExpression): New public class.
1235
1236         * namespace.cs (Namespace): Implement IAlias.
1237         (Namespace.Lookup): Return an IAlias instead on an object.
1238         (Namespace.DefineName): Take an IAlias instead of an object.
1239         (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
1240         an object.
1241         (NamespaceEntry.UsingAlias): Take a Membername instead of an
1242         Expression.
1243         (NamespaceEntry.LookupAlias): Return an IAlias instead on an
1244         object.
1245         (NamespaceEntry.Lookup): Likewise.
1246
1247         * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
1248         instead of a Type.      
1249
1250         * decl.cs (DeclSpace): Implement IAlias.
1251         (DeclSpace.LookupAlias): Return an IAlias instead of a string.
1252
1253         * generic.cs (ConstructedType): Improved error checking.
1254
1255 2004-04-02  Martin Baulig  <martin@ximian.com>
1256
1257         * convert.cs: Added type parameter conversions.
1258
1259         * ecore.cs
1260         (UnboxCast.Emit): Emit an `unbox.any' for type params.
1261         (ClassCast.Emit): If the source type is a type parameter, box it.
1262         If the target type is a type parameter, emit an `unbox.any'
1263         instead of a `classcast'.1      
1264
1265 2004-04-01  Martin Baulig  <martin@ximian.com>
1266
1267         * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
1268
1269 2004-04-01  Martin Baulig  <martin@ximian.com>
1270
1271         * expression.cs (Invocation.EmitCall): If we're invoking a method
1272         on a type parameter, use the new `Constrained' prefix opcode.
1273
1274 2004-04-01  Martin Baulig  <martin@ximian.com>
1275
1276         * generic.cs (ConstructedType.CheckConstraints): Use
1277         Convert.ImplicitStandardConversionExists(); user-defined implicit
1278         conversions are not allowed according to the spec.
1279
1280 2004-03-30  Martin Baulig  <martin@ximian.com>
1281
1282         * expression.cs (New): Added support for type parameters.
1283
1284         * typemanager.cs
1285         (TypeManager.activator_type): New public static field.
1286         (TypeManager.activator_create_instance): Likewise.
1287
1288 2004-03-30  Martin Baulig  <martin@ximian.com>
1289
1290         * typemanager.cs (TypeManager.HasConstructorConstraint): New
1291         public method.
1292
1293 2004-03-30  Martin Baulig  <martin@ximian.com>
1294
1295         * generic.cs (ConstructedType.CheckConstraints): Actually follow
1296         the spec here: the argument type must be convertible to the
1297         constraints.
1298
1299 2004-03-30  Martin Baulig  <martin@ximian.com>
1300
1301         * generic.cs
1302         (TypeParameter.Define, TypeParameter.DefineMethod): Call
1303         TypeManager.AddTypeParameter().
1304         (ConstructedType.CheckConstraints): Re-enable this and actually
1305         check whether we have a constructor constraint.
1306
1307         * typemanager.cs
1308         (TypeManager.builder_to_type_param): New static field.
1309         (TypeManager.AddTypeParameter): New static method.
1310         (TypeManager.LookupTypeParameter): New public method.
1311
1312 2004-03-30  Martin Baulig  <martin@ximian.com>
1313
1314         * generic.cs (TypeParameter.DefineType): Return a boolean and use
1315         the new API to actually define the constructor constraint.
1316
1317         * typemanager.cs
1318         (TypeManager.new_constraint_attr_type): New static field.
1319         (TypeManager.InitCoreTypes): Initialize it.
1320
1321 2004-03-30  Martin Baulig  <martin@ximian.com>
1322
1323         * generic.cs (Constraints): Completed error checking, use correct
1324         error numbers.
1325
1326 2004-03-29  Martin Baulig  <martin@ximian.com>
1327
1328         * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
1329
1330         * expression.cs (Invocation.InferTypeArguments): Added overloaded
1331         public version which takes a `ParameterData pd' instead of an
1332         `ArrayList args'.
1333
1334 2004-03-29  Martin Baulig  <martin@ximian.com>
1335
1336         * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
1337         not a MethodInfo.       
1338
1339 2004-03-29  Martin Baulig  <martin@ximian.com>
1340
1341         * expression.cs (Argument.ResolveMethodGroup): If we're a
1342         ConstructedType, call GetMemberAccess() on it.  
1343
1344 2004-03-29  Martin Baulig  <martin@ximian.com>
1345
1346         * class.cs (MethodBase.CheckGenericOverride): New abstract method.
1347         (MethodCore.CheckGenericOverride): When overriding a generic
1348         method, check whether the constraints match.
1349
1350         * support.cs (GenericConstraints): New public interface.
1351         (ParameterData.GenericConstraints): New public method.
1352
1353         * parameter.cs (Parameter.Resolve): Check whether we're a generic
1354         method parameter and compute our constraints if appropriate.
1355         (Parameter.GenericConstraints): New public property.
1356
1357         * generic.cs (Constraints): Implement GenericConstraints.
1358
1359 2004-03-29  Martin Baulig  <martin@ximian.com>
1360
1361         * decl.cs (MemberCache.FindMemberToOverride): Use
1362         `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
1363
1364 2004-03-29  Martin Baulig  <martin@ximian.com>
1365
1366         * generic.cs (GenericMethod.Define): Resolve our type parameters.
1367
1368 2004-03-29  Martin Baulig  <martin@ximian.com>
1369
1370         * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
1371         not allowed on non-generic declarations").
1372
1373 2004-03-29  Martin Baulig  <martin@ximian.com>
1374
1375         * expression.cs (Invocation.InferTypeArguments): Added overloaded
1376         public version of this method.
1377
1378         * class.cs (MethodCore.IsDuplicateImplementation): Use
1379         Invocation.InferTypeArguments() to check this.
1380
1381 2004-03-29  Martin Baulig  <martin@ximian.com>
1382
1383         * convert.cs: Use TypeManager.IsDelegateType() instead of
1384         comparing types correctly.
1385
1386 2004-03-29  Martin Baulig  <martin@ximian.com>
1387
1388         * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
1389         types directly to make it work for generic instances.
1390
1391         * typemanager.cs (TypeManager.IsSubclassOf): New static method.
1392
1393 2004-03-29  Martin Baulig  <martin@ximian.com>
1394
1395         * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
1396         support for arrays.     
1397
1398 2004-03-24  Martin Baulig  <martin@ximian.com>
1399
1400         * decl.cs (DeclSpace.FindType): Also use
1401         TypeManager.CheckGeneric() for types from the using clauses.
1402
1403 2004-03-23  Martin Baulig  <martin@ximian.com>
1404
1405         * expression.cs (Invocation.OverloadResolve): Added `bool
1406         may_fail' argument and use it instead of the Location.IsNull() hack.
1407
1408 2004-03-23  Martin Baulig  <martin@ximian.com>
1409
1410         * expression.cs (Invocation.InferType): Use correct type inference
1411         rules here.     
1412
1413 2004-03-23  Martin Baulig  <martin@ximian.com>
1414
1415         * ecore.cs (MethodGroupExpr.Name): Use
1416         TypeManager.CSharpSignature() instead of just the name.
1417
1418         * expression.cs (Invocation.OverloadResolve): Provide better error
1419         reporting.
1420         (Invocation.DoResolve): OverloadResolve() never returns null
1421         without reporting an error, so removed the error -6 reporting here.
1422
1423 2004-03-23  Martin Baulig  <martin@ximian.com>
1424
1425         * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
1426         generic methods.
1427
1428         * cs-parser.jay (delegate_declaration): Support generic delegates.
1429
1430         * delegate.cs: Support generic delegates.
1431
1432 2004-03-22  Martin Baulig  <martin@ximian.com>
1433
1434         * expression.cs (Invocation.InferParamsTypeArguments): New static
1435         method; does type inference for params arguments.
1436
1437 2004-03-21  Martin Baulig  <martin@ximian.com>
1438
1439         * typemanager.cs (TypeManager.IsGenericMethod): New public static
1440         method; checks whether a method is a generic method.    
1441
1442         * expression.cs (Invocation.InferTypeArguments): New static method;
1443         infer type arguments for generic method invocation.
1444
1445         * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
1446         property; we set this to true if we're resolving a generic method
1447         invocation and the user specified type arguments, ie. we're not
1448         doing type inference.
1449
1450 2004-03-20  Martin Baulig  <martin@ximian.com>
1451
1452         * class.cs (MethodData.DeclaringType): New public property.
1453         (MethodData.Define): Set DeclaringType here.
1454         (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
1455         instead of OperatorMethodBuilder.DeclaringType.
1456
1457 2004-03-20  Martin Baulig  <martin@ximian.com>
1458
1459         * cs-tokenizer.cs (xtoken): Return a special
1460         Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
1461
1462         * cs-parser.jay (default_value_expression): Switch to the new
1463         syntax (14.5.13).
1464
1465 2004-03-19  Martin Baulig  <martin@ximian.com>
1466
1467         * decl.cs (MemberName): New class.  We use this to "construct"
1468         namespace_or_type_name's.
1469
1470         * generics.cs (TypeArguments.GetDeclarations): New public method;
1471         returns the type arguments as a string[] and reports a CS0081 if
1472         one of them is not an identifier.
1473
1474         * class.cs (MemberBase): The .ctor now takes the name as a
1475         MemberName instead of a string.
1476         (MemberBase.ExplicitInterfaceName): Changed type from string to
1477         Expression.
1478         (MemberBase.DoDefine): If we're an explicit implementation, the
1479         InterfaceType may be a generic instance.
1480
1481         * cs-parser.jay (namespace_or_type_name): Return a MemberName.
1482         (namespace_name): Call MemberName.GetName () to transform the
1483         MemberName into a string and ensure we don't have any type
1484         arguments.
1485         (type_name): Call MemberName.GetTypeExpression() to transfrom the
1486         MemberName into an expression.
1487         (method_header): Use namespace_or_type_name instead of member_name.     
1488
1489 2004-04-07  Miguel de Icaza  <miguel@ximian.com>
1490
1491         * rootcontext.cs: Add new types to the boot resolution.
1492
1493         * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
1494         MulticastDelegate is not allowed.
1495
1496         * typemanager.cs: Add new types to lookup: System.TypedReference
1497         and ArgIterator.
1498
1499         * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
1500         check for TypedReference or ArgIterator, they are not allowed. 
1501
1502         * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
1503         makes us properly catch 1510 in some conditions (see bug 56016 for
1504         details). 
1505
1506 2004-04-06  Bernie Solomon  <bernard@ugsolutions.com>
1507
1508         * CryptoConvert.cs: update from corlib version
1509         with endian fixes.
1510
1511 2004-04-05  Miguel de Icaza  <miguel@ximian.com>
1512
1513         * class.cs (Indexer.Define): Check indexername declaration
1514
1515 2004-04-05  Marek Safar  <marek.safar@seznam.cz>
1516
1517         * attribute.cs (IsClsCompliant): Fixed problem with handling
1518         all three states (compliant, not-compliant, undetected).
1519
1520 2004-03-30  Marek Safar  <marek.safar@seznam.cz>
1521
1522         * attribute.cs (Attribute): Location is now public.
1523         (Resolve): Store resolved arguments (pos_values) in attribute class.
1524         Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
1525         (GetClsCompliantAttributeValue): New method that gets
1526         CLSCompliantAttribute value.
1527         (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
1528         if exists else null.
1529         (AttributeTester): New class for CLS-Compliant verification routines.
1530
1531         * class.cs (Emit): Add CLS-Compliant verification.
1532         (Method.GetSignatureForError): Implemented.
1533         (Constructor.GetSignatureForError): Implemented
1534         (Constructor.HasCompliantArgs): Returns if constructor has
1535         CLS-Compliant arguments.
1536         (Constructor.Emit): Override.
1537         (Construcor.IsIdentifierClsCompliant): New method; For constructors
1538         is needed to test only parameters.
1539         (FieldBase.GetSignatureForError): Implemented.
1540         (TypeContainer): New member for storing base interfaces.
1541         (TypeContainer.FindMembers): Search in base interfaces too.
1542
1543         * codegen.cs (GetClsComplianceAttribute): New method that gets
1544         assembly or module CLSCompliantAttribute value.
1545         (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
1546         for assembly.
1547         (ModuleClass.Emit): Add error 3012 test.
1548
1549         * const.cs (Emit): Override and call base for CLS-Compliant tests.
1550
1551         * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
1552         state for all decl types.
1553         (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
1554         if CLS-Compliant tests are required.
1555         (IsClsCompliaceRequired): New method. Analyze whether code
1556         must be CLS-Compliant.
1557         (IsExposedFromAssembly): New method. Returns true when MemberCore
1558         is exposed from assembly.
1559         (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
1560         value or gets cached value.
1561         (HasClsCompliantAttribute): New method. Returns true if MemberCore
1562         is explicitly marked with CLSCompliantAttribute.
1563         (IsIdentifierClsCompliant): New abstract method. This method is
1564         used to testing error 3005.
1565         (IsIdentifierAndParamClsCompliant): New method. Common helper method
1566         for identifier and parameters CLS-Compliant testing.
1567         (VerifyClsCompliance): New method. The main virtual method for
1568         CLS-Compliant verifications.
1569         (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
1570         null. I don't know why is null (too many public members !).
1571         (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
1572         and get value of first CLSCompliantAttribute that found.
1573
1574         * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
1575         (VerifyClsCompliance): Override and add extra tests.
1576
1577         * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
1578         clscheck- disable CLS-Compliant verification event if assembly is has
1579         CLSCompliantAttribute(true).
1580
1581         * enum.cs (Emit): Override and call base for CLS-Compliant tests.
1582         ApllyAttribute is now called in emit section as in the other cases.
1583         Possible future Emit integration.
1584         (IsIdentifierClsCompliant): New override.
1585         (VerifyClsCompliance): New override.
1586         (GetEnumeratorName): Returns full enum name.
1587
1588         * parameter.cs (GetSignatureForError): Implemented.
1589
1590         * report.cs (WarningData): New struct for Warning message information.
1591         (LocationOfPreviousError): New method.
1592         (Warning): New method. Reports warning based on the warning table.
1593         (Error_T): New method. Reports error based on the error table.
1594
1595         * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
1596         verifications are done here.
1597
1598         * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
1599
1600         * typemanager.cs (cls_compliant_attribute_type): New member thath holds
1601         CLSCompliantAttribute.
1602         (all_imported_types): New member holds all imported types from other
1603         assemblies.
1604         (LoadAllImportedTypes): New method fills static table with exported types
1605         from all referenced assemblies.
1606         (Modules): New property returns all assembly modules.
1607
1608 2004-03-30  Miguel de Icaza  <miguel@ximian.com>
1609
1610         * cs-parser.jay: Add a rule to catch wrong event syntax instead of
1611         throwing a parser error.
1612
1613         * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
1614         which removes the hardcoded get_/set_ prefixes for properties, as
1615         IL allows for the properties to be named something else.  
1616
1617         Bug #56013
1618
1619         * expression.cs: Do not override operand before we know if it is
1620         non-null.  Fix 56207
1621
1622 2004-03-29 Ben Maurer  <bmaurer@users.sourceforge.net>
1623
1624         * typemanager.cs: support for pinned variables.
1625
1626 2004-03-29 Ben Maurer  <bmaurer@users.sourceforge.net>
1627
1628         * decl.cs, typemanager.cs: Avoid using an arraylist
1629         as a buffer if there is only one result set.
1630
1631 2004-03-29 Ben Maurer  <bmaurer@users.sourceforge.net>
1632
1633         * expression.cs: Make sure you cant call a static method
1634         with an instance expression, bug #56174.
1635
1636 2004-03-29  Miguel de Icaza  <miguel@ximian.com>
1637
1638         * class.cs (IsDuplicateImplementation): Improve error reporting to
1639         flag 663 (method only differs in parameter modifier).
1640
1641         * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
1642         in preprocessor directives.
1643
1644         * location.cs (LookupFile): Allow for the empty path.
1645
1646         * attribute.cs (DefinePInvokeMethod): Fix 56148;  I would like a
1647         better approach for some of that patch, but its failing with the
1648         CharSet enumeration.  For now try/catch will do.
1649
1650         * typemanager.cs: Do not crash if a struct does not have fields.
1651         Fixes 56150.
1652
1653 2004-03-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1654
1655         * expression.cs: cs0213, cant fix a fixed expression.
1656         fixes 50231.
1657
1658 2004-03-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1659
1660         * cs-parser.jay: detect invalid embeded statements gracefully.
1661         bug #51113.
1662
1663 2004-03-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1664
1665         * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
1666         As a regex:
1667         s/
1668         the invocation type may not be a subclass of the tye of the item/
1669         The type of the item must be a subclass of the invocation item.
1670         /g
1671
1672         Fixes bug #50820.
1673
1674 2004-03-25  Sebastien Pouliot  <sebastien@ximian.com>
1675
1676         * attribute.cs: Added methods to get a string and a bool from an
1677         attribute. Required to information from AssemblyKeyFileAttribute,
1678         AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
1679         * codegen.cs: Modified AssemblyName creation to include support for
1680         strongnames. Catch additional exceptions to report them as CS1548.
1681         * compiler.csproj: Updated include CryptoConvert.cs.
1682         * compiler.csproj.user: Removed file - user specific configuration.
1683         * CryptoConvert.cs: New. A COPY of the class CryptoConvert from 
1684         Mono.Security assembly. The original class is maintained and tested in
1685         /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
1686         * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
1687         like CSC 8.0 (C# v2) supports.
1688         * Makefile: Added CryptoConvert.cs to mcs sources.
1689         * rootcontext.cs: Added new options for strongnames.
1690
1691 2004-03-24 Ben Maurer  <bmaurer@users.sourceforge.net>
1692
1693         * driver.cs: For --expect-error, report error code `2'
1694         if the program compiled with no errors, error code `1' if
1695         it compiled with an error other than the one expected.
1696
1697 2004-03-24  Sebastien Pouliot  <sebastien@ximian.com>
1698
1699         * compiler.csproj: Updated for Visual Studio .NET 2003.
1700         * compiler.csproj.user: Updated for Visual Studio .NET 2003.
1701         * compiler.sln: Updated for Visual Studio .NET 2003.
1702
1703 2004-03-24  Ravi Pratap M  <ravi@ximian.com>
1704
1705         * expression.cs: Fix bug #47234. We basically need to apply the
1706         rule that we prefer the conversion of null to a reference type
1707         when faced with a conversion to 'object' (csc behaviour).
1708
1709 2004-03-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1710
1711         * statement.cs: Shorter form for foreach, eliminates
1712         a local variable. r=Martin.
1713
1714 2004-03-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1715
1716         * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
1717         checks if we can use brtrue/brfalse to test for 0.
1718         * expression.cs: use the above in the test for using brtrue/brfalse.
1719         cleanup code a bit.
1720
1721 2004-03-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1722
1723         * expression.cs: Rewrite string concat stuff. Benefits:
1724
1725         - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
1726         - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
1727         rather than a concat chain.
1728
1729         * typemanager.cs: Add lookups for more concat overloads.
1730
1731 2004-03-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1732
1733         * expression.cs: Emit shorter il code for array init.
1734
1735         newarr
1736         dup
1737         // set 1
1738
1739         // set 2
1740
1741         newarr
1742         stloc.x
1743
1744         ldloc.x
1745         // set 1
1746
1747         ldloc.x
1748         // set 2
1749
1750 2004-03-22 Ben Maurer  <bmaurer@users.sourceforge.net>
1751
1752         * statement.cs: Before, two switch blocks would be merged if the
1753         total size of the blocks (end_item - begin_item + 1) was less than
1754         two times the combined sizes of the blocks.
1755
1756         Now, it will only merge if after the merge at least half of the
1757         slots are filled.
1758
1759         fixes 55885.
1760
1761 2004-03-20  Atsushi Enomoto  <atsushi@ximian.com>
1762
1763         * class.cs : csc build fix for GetMethods(). See bug #52503.
1764
1765 2004-03-20 Ben Maurer  <bmaurer@users.sourceforge.net>
1766
1767         * expression.cs: Make sure fp comparisons work with NaN.
1768         This fixes bug #54303. Mig approved this patch a long
1769         time ago, but we were not able to test b/c the runtime
1770         had a related bug.
1771
1772 2004-03-19  Miguel de Icaza  <miguel@ximian.com>
1773
1774         * ecore.cs (TypExpr.GetHashCode): implement this overload. 
1775
1776 2004-03-19  Martin Baulig  <martin@ximian.com>
1777
1778         * class.cs (MemberCore.IsDuplicateImplementation): Check whether
1779         two overloads may unify for some type parameter substitutions and
1780         report a CS0408 if appropriate.
1781
1782 2004-03-19  Martin Baulig  <martin@ximian.com>
1783
1784         * class.cs (MemberCore.IsDuplicateImplementation): Report the
1785         error here and not in our caller.
1786
1787 2004-03-19  Martin Baulig  <martin@ximian.com>
1788
1789         * interface.cs: Completely killed this file.
1790         (Interface): We're now a TypeContainer and live in class.cs.
1791
1792         * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
1793         argument; we're now also called for interfaces.
1794         (TypeContainer.DefineMembers): Allow this method being called
1795         multiple times.
1796         (TypeContainer.GetMethods): New public method; formerly known as
1797         Interface.GetMethod().  This is used by PendingImplementation.
1798         (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
1799         it's now private and non-static.
1800         (Interface): Moved this here; it's now implemented similar to
1801         Class and Struct.
1802         (Method, Property, Event, Indexer): Added `bool is_interface'
1803         argument to their .ctor's.
1804         (MemberBase.IsInterface): New public field.
1805
1806         * cs-parser.jay: Create normal Method, Property, Event, Indexer
1807         instances instead of InterfaceMethod, InterfaceProperty, etc.
1808         (opt_interface_base): Removed; we now use `opt_class_base' instead.
1809         (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
1810
1811 2004-03-19  Martin Baulig  <martin@ximian.com>
1812
1813         * class.cs (MethodCore.IsDuplicateImplementation): New private
1814         method which does the CS0111 checking.
1815         (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
1816         Use IsDuplicateImplementation().
1817
1818 2004-03-17 Ben Maurer  <bmaurer@users.sourceforge.net>
1819
1820         * decl.cs (FindMemberToOverride): New method to find the correct
1821         method or property to override in the base class.
1822         * class.cs
1823             - Make Method/Property use the above method to find the
1824               version in the base class.
1825             - Remove the InheritableMemberSignatureCompare as it is now
1826               dead code.
1827
1828         This patch makes large code bases much faster to compile, as it is
1829         O(n) rather than O(n^2) to do this validation.
1830
1831         Also, it fixes bug 52458 which is that nested classes are not
1832         taken into account when finding the base class member.
1833
1834         Reviewed/Approved by Martin.
1835
1836 2004-03-17  Martin Baulig  <martin@ximian.com>
1837
1838         * expression.cs (MemberAccess.DoResolve): Take the parent's number
1839         of type arguments into account; use the `real_num_type_args'
1840         approach like in DoResolveAsTypeStep().
1841
1842         * generic.cs (GenericMemberAccess.DoResolve): Make this work for
1843         nested types.
1844
1845 2004-03-17  Marek Safar  <marek.safar@seznam.cz>
1846
1847         * interface.cs: In all interface classes removed redundant
1848         member initialization.
1849
1850 2004-03-16  Martin Baulig  <martin@ximian.com>
1851
1852         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
1853
1854 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
1855
1856         * decl.cs (DefineTypeAndParents): New helper method to define a
1857         type's containers before the type itself is defined;  This is a
1858         bug exposed by the recent changes to Windows.Forms when an
1859         implemented interface was defined inside a class that had not been
1860         built yet.   
1861
1862         * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
1863
1864         (Check): Loop correctly to report errors modifiers
1865         (UNSAFE was not in the loop, since it was the same as TOP).
1866
1867         * interface.cs: Every interface member now takes a ModFlags,
1868         instead of a "is_new" bool, which we set on the base MemberCore. 
1869
1870         Every place where we called "UnsafeOk" in the interface, now we
1871         call the proper member (InterfaceMethod.UnsafeOK) instead to get
1872         the unsafe settings from the member declaration instead of the
1873         container interface. 
1874
1875         * cs-parser.jay (opt_new): Allow unsafe here per the spec. 
1876
1877         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
1878         `set_indexer_name' to the pending bits (one per type).
1879
1880         We fixed a bug today that was picking the wrong method to
1881         override, since for properties the existing InterfaceMethod code
1882         basically ignored the method name.  Now we make sure that the
1883         method name is one of the valid indexer names.
1884
1885 2004-03-14  Gustavo Giráldez  <gustavo.giraldez@gmx.net>
1886  
1887         * support.cs (SeekableStreamReader): Keep track of stream byte
1888         positions and don't mix them with character offsets to the buffer.
1889
1890         Patch from Gustavo Giráldez
1891
1892 2004-03-15  Marek Safar  <marek.safar@seznam.cz>
1893
1894         * interface.cs (InterfaceSetGetBase): Removed double member
1895         initialization, base class does it as well.
1896
1897 2004-03-13  Martin Baulig  <martin@ximian.com>
1898
1899         * class.cs: Reverted Miguel's latest commit; it makes mcs crash
1900         when compiling corlib.
1901
1902 2004-03-13  Miguel de Icaza  <miguel@ximian.com>
1903
1904         * convert.cs (ExplicitConversion): We were reporting an error on
1905         certain conversions (object_type source to a value type, when the
1906         expression was `null') before we had a chance to pass it through
1907         the user defined conversions.
1908
1909         * driver.cs: Replace / and \ in resource specifications to dots.
1910         Fixes 50752
1911
1912         * class.cs: Add check for duplicate operators.  Fixes 52477
1913
1914 2004-03-11  Miguel de Icaza  <miguel@ximian.com>
1915
1916         * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
1917         that are in the middle of the statements, not only at the end.
1918         Fixes #54987
1919
1920         * class.cs (TypeContainer.AddField): No longer set the
1921         `HaveStaticConstructor' flag, now we call it
1922         `UserDefineStaticConstructor' to diferentiate the slightly
1923         semantic difference.
1924
1925         The situation is that we were not adding BeforeFieldInit (from
1926         Modifiers.TypeAttr) to classes that could have it.
1927         BeforeFieldInit should be set to classes that have no static
1928         constructor. 
1929
1930         See:
1931
1932         http://www.yoda.arachsys.com/csharp/beforefieldinit.html
1933
1934         And most importantly Zoltan's comment:
1935
1936         http://bugzilla.ximian.com/show_bug.cgi?id=44229
1937
1938         "I think beforefieldinit means 'it's ok to initialize the type sometime 
1939          before its static fields are used', i.e. initialization does not need
1940          to be triggered by the first access to the type. Setting this flag
1941          helps the JIT to compile better code, since it can run the static
1942          constructor at JIT time, and does not need to generate code to call it
1943          (possibly lots of times) at runtime. Unfortunately, mcs does not set
1944          this flag for lots of classes like String. 
1945          
1946          csc sets this flag if the type does not have an explicit static 
1947          constructor. The reasoning seems to be that if there are only static
1948          initalizers for a type, and no static constructor, then the programmer
1949          does not care when this initialization happens, so beforefieldinit
1950          can be used.
1951          
1952          This bug prevents the AOT compiler from being usable, since it 
1953          generates so many calls to mono_runtime_class_init that the AOT code
1954          is much slower than the JITted code. The JITted code is faster, 
1955          because it does not generate these calls if the vtable is type is
1956          already initialized, which is true in the majority of cases. But the
1957          AOT compiler can't do this."
1958
1959 2004-03-10  Miguel de Icaza  <miguel@ximian.com>
1960
1961         * class.cs (MethodData.Emit): Refactor the code so symbolic
1962         information is generated for destructors;  For some reasons we
1963         were taking a code path that did not generate symbolic information
1964         before. 
1965
1966 2004-03-11 Ben Maurer  <bmaurer@users.sourceforge.net>
1967
1968         * class.cs: Create a Constructor.CheckBase method that
1969         takes care of all validation type code. The method
1970         contains some code that was moved from Define.
1971
1972         It also includes new code that checks for duplicate ctors.
1973         This fixes bug #55148.
1974
1975 2004-03-09  Joshua Tauberer <tauberer@for.net>
1976
1977         * expression.cs (ArrayCreation): Fix: More than 6 nulls in
1978         a { ... }-style array creation invokes EmitStaticInitializers
1979         which is not good for reference-type arrays.  String, decimal
1980         and now null constants (NullCast) are not counted toward
1981         static initializers.
1982
1983 2004-03-05  Martin Baulig  <martin@ximian.com>
1984
1985         * location.cs (SourceFile.HasLineDirective): New public field;
1986         specifies whether the file contains or is referenced by a "#line"
1987         directive.
1988         (Location.DefineSymbolDocuments): Ignore source files which
1989         either contain or are referenced by a "#line" directive.        
1990
1991 2004-02-29  Ben Maurer <bmaurer@users.sourceforge.net>
1992
1993         * class.cs (Method.CheckBase): Avoid using FindMembers, we have
1994         direct access to our parent, so check the method inline there.
1995
1996 2004-02-27 Ben Maurer  <bmaurer@users.sourceforge.net>
1997
1998         * expression.cs (Invocation.EmitCall): Miguel's last commit
1999         caused a regression. If you had:
2000
2001             T t = null;
2002             t.Foo ();
2003
2004         In Foo the implict this would be null.
2005
2006 2004-02-27  Miguel de Icaza  <miguel@ximian.com>
2007
2008         * expression.cs (Invocation.EmitCall): If the method is not
2009         virtual, do not emit a CallVirt to it, use Call.
2010
2011         * typemanager.cs (GetFullNameSignature): Improve the method to
2012         cope with ".ctor" and replace it with the type name.
2013
2014         * class.cs (ConstructorInitializer.Resolve): Now the method takes
2015         as an argument the ConstructorBuilder where it is being defined,
2016         to catch the recursive constructor invocations.
2017
2018 2004-03-16  Martin Baulig  <martin@ximian.com>
2019
2020         * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
2021         ConstructedType, call ResolveType() on it to get the type rather
2022         than just using `expr.Type'.
2023
2024 2004-03-16  Martin Baulig  <martin@ximian.com>
2025
2026         * generics.cs (ConstructedType.GetMemberAccess): Take the
2027         EmitContext instead on the TypeExpr and use
2028         ec.TypeContainer.CurrentType/ec.ContainerType.
2029
2030 2004-03-16  Martin Baulig  <martin@ximian.com>
2031
2032         * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
2033         parameters before aliases.
2034
2035 2004-03-16  Martin Baulig  <martin@ximian.com>
2036
2037         * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
2038         New oublic function; checks whether two generic instances may become
2039         equal under some instantiations (26.3.1).
2040
2041         * class.cs (TypeContainer.Define): Call
2042         TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
2043         error.
2044
2045 2004-03-16  Martin Baulig  <martin@ximian.com>
2046
2047         * class.cs (TypeContainer.GetClassBases): Moved
2048         Error_TypeParameterAsBase() here and also check whether the base
2049         class is not an attribute.
2050
2051 2004-03-16  Martin Baulig  <martin@ximian.com>
2052
2053         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
2054
2055 2004-03-16  Martin Baulig  <martin@ximian.com>
2056
2057         * class.cs (Error_TypeParameterAsBase): Use correct error number
2058         here (CS0689).  
2059
2060 2004-03-16  Martin Baulig  <martin@ximian.com>
2061
2062         * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
2063         for generics.
2064
2065         * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
2066         error reporting.
2067
2068 2004-03-15  Martin Baulig  <martin@ximian.com>
2069
2070         * typemanager.cs (TypeManager.GetFullName): New public method.
2071         (TypeManager.MemberLookup): Added `int_num_type_arguments'
2072         argument; only return members with the correct number of type
2073         arguments.
2074         (TypeManager.CheckGeneric): Allow -1 to bypass the check.
2075         (TypeManager.FilterWithClosure): Call CheckGeneric() to check
2076         whether the number of type arguments matches.
2077
2078         * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
2079         not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
2080
2081         * expression.cs (MemberAccess): Added public `NumTypeArguments'
2082         field; it's set by the protected .ctor when we're actually a
2083         GenericMemberAccess.
2084         (MemberAccess.ResolveAsTypeStep): Compute the total number of type
2085         arguments and pass it to MemberLookupFinal ().
2086
2087         * ecore.cs (Expression.MemberLookup): Added `int
2088         num_type_arguments' argument; only return members with the correct
2089         number of type arguments.
2090         (Expression.MemberLookupFailed): Check whether the MemberLookup
2091         failed because we did not have the correct number of type
2092         arguments; report CS0305 in this case.
2093
2094         * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
2095         `e.ResolveAsTypeTerminal()' already did so.
2096
2097 2004-03-15  Martin Baulig  <martin@ximian.com>
2098
2099         * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
2100         we're a ConstructedType; in this case, the caller must report an
2101         error (for instance CS0131).
2102
2103         * generic.cs (TypeArguments): Added Location argument to the .ctor.
2104         (TypeArguments.Resolve): Actually report errors here.
2105
2106 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
2107
2108         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
2109         `set_indexer_name' to the pending bits (one per type).
2110
2111         We fixed a bug today that was picking the wrong method to
2112         override, since for properties the existing InterfaceMethod code
2113         basically ignored the method name.  Now we make sure that the
2114         method name is one of the valid indexer names.
2115
2116 2004-03-15  Martin Baulig  <martin@ximian.com>
2117
2118         * typemanager.cs (TypeManager.IndexerPropertyName): Added support
2119         for generic instances.
2120
2121 2004-03-13  Martin Baulig  <martin@ximian.com>
2122
2123         * class.cs (TypeContainer.DefineType): Call
2124         TypeManager.AddUserType() immediately after creating the
2125         TypeBuilder; pass all type parameters when creating the
2126         CurrentType.
2127
2128         * decl.cs (DeclSpace.FindNestedType): New public method.
2129         (DeclSpace.FindType): Added `int num_type_args' argument; only
2130         return types with the correct number of type parameters.
2131         (DeclSpace.CountTypeParams): New public property.
2132
2133         * ecore.cs (SimpleName.ctor): Added overloaded version which takes
2134         the number of type parameters; defaults to zero.
2135
2136         * generic.cs (TypeArguments.Count): New public property.
2137         (ConstructedType.DoResolveAsTypeStep): First call
2138         ds.FindNestedType() to find out whether we're nested in the
2139         current generic type; in this case, we inherit all type parameters
2140         from the current class.
2141
2142         * rootcontext.cs (RootContext.NamespaceLookup): Added `int
2143         num_type_args' argument.
2144         (RootContext.LookupType): Added overloaded version which takes the
2145         number of type arguments; only return types with the correct
2146         number of type arguments.
2147
2148         * typemanager.cs (TypeManager.CheckGeneric): New public function;
2149         checks whether `Type t' has `int num_type_args'.
2150
2151 2004-03-13  Martin Baulig  <martin@ximian.com>
2152
2153         * generic.cs (GenericMethod.DefineType): New method; calls
2154         DefineType() on all the type parameters.
2155
2156         * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
2157         (MethodData.Define): If we're a generic method, call
2158         GenericMethod.DefineType() to define the type parameters.       
2159
2160 2004-03-10  Martin Baulig  <martin@ximian.com>
2161
2162         * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
2163         instead of IsAssignableFrom.    
2164
2165 2004-03-10  Martin Baulig  <martin@ximian.com>
2166
2167         * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
2168
2169         * support.cs (ParameterData.HasArrayParameter): New property.
2170         (ReflectionParameters.ctor): Take a MethodBase instead of a
2171         ParameterInfo[].  If we have any type parameters, get the generic
2172         method definition and ask it whether we have variable arguments.
2173
2174 2004-02-26  Miguel de Icaza  <miguel@ximian.com>
2175
2176         * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
2177         routines to check if a type is an enumerable/enumerator allow
2178         classes that implement the IEnumerable or IEnumerator interfaces.
2179
2180         * class.cs (Property, Operator): Implement IIteratorContainer, and
2181         implement SetYields.
2182
2183         (Property.Define): Do the block swapping for get_methods in the
2184         context of iterators.   We need to check if Properties also
2185         include indexers or not.
2186
2187         (Operator): Assign the Block before invoking the
2188         OperatorMethod.Define, so we can trigger the Iterator code
2189         replacement. 
2190
2191         * cs-parser.jay (SimpleIteratorContainer): new helper class.  Both
2192         Property and Operator classes are not created when we parse the
2193         declarator but until we have the block completed, so we use a
2194         singleton SimpleIteratorContainer.Simple to flag whether the
2195         SetYields has been invoked.
2196
2197         We propagate this setting then to the Property or the Operator to
2198         allow the `yield' to function.
2199
2200 2004-02-25  Marek Safar  <marek.safar@seznam.cz>
2201
2202         * codegen.cs: Implemented attribute support for modules.
2203         New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
2204         Assembly/Module functionality.
2205
2206         * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
2207         interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
2208         Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
2209
2210 2004-02-16  Marek Safar  <marek.safar@seznam.cz>
2211
2212         * interface.cs (FindMembers): The operation is performed on all base
2213         interfaces and not only on the first. It is required for future CLS Compliance patch.
2214
2215 2004-02-12 Ben Maurer  <bmaurer@users.sourceforge.net>
2216
2217         * statement.cs, codegen.cs:
2218         This patch deals with patterns such as:
2219
2220         public class List : IEnumerable {
2221
2222                 public MyEnumerator GetEnumerator () {
2223                         return new MyEnumerator(this);
2224                 }
2225
2226                 IEnumerator IEnumerable.GetEnumerator () {
2227                         ...
2228                 }
2229                 
2230                 public struct MyEnumerator : IEnumerator {
2231                         ...
2232                 }
2233         }
2234
2235         Before, there were a few things we did wrong:
2236         1) we would emit callvirt on a struct, which is illegal
2237         2) we emited ldarg when we needed to emit ldarga
2238         3) we would mistakenly call the interface methods on an enumerator
2239         type that derived from IEnumerator and was in another assembly. For example:
2240
2241         public class MyEnumerator : IEnumerator
2242
2243         Would have the interface methods called, even if there were public impls of the
2244         method. In a struct, this lead to invalid IL code.
2245
2246 2004-02-11  Marek Safar  <marek.safar@seznam.cz>
2247
2248         * const.cs: Const is now derived from FieldBase. Method EmitConstant name
2249           renamed to Emit.
2250
2251         * delegate.cs (Define): Fixed crash when delegate type is undefined.
2252
2253 2004-02-11  Miguel de Icaza  <miguel@ximian.com>
2254
2255         * cs-parser.jay: Fix small regression: we were not testing V2
2256         compiler features correctly.
2257
2258         * interface.cs: If the emit context is null, then create one
2259
2260 2004-02-09  Marek Safar  <marek.safar@seznam.cz>
2261
2262         * decl.cs (GetSignatureForError): New virtual method to get full name
2263           for error messages.
2264
2265         * attribute.cs (IAttributeSupport): New interface for attribute setting.
2266           Now it is possible to rewrite ApplyAttributes method to be less if/else.
2267
2268         * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
2269           Duplicated members and code in these classes has been removed.
2270           Better encapsulation in these classes.
2271
2272 2004-02-07  Miguel de Icaza  <miguel@ximian.com>
2273
2274         * assign.cs (Assign.DoResolve): When dealing with compound
2275         assignments, there is a new rule in ECMA C# 2.4 (might have been
2276         there before, but it is documented here) that states that in:
2277
2278         a op= b;
2279
2280         If b is of type int, and the `op' is a shift-operator, then the
2281         above is evaluated as:
2282
2283         a = (int) a op b 
2284
2285         * expression.cs (Binary.ResolveOperator): Instead of testing for
2286         int/uint/long/ulong, try to implicitly convert to any of those
2287         types and use that in pointer arithmetic.
2288
2289         * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
2290         method to print information for from the type, not from the
2291         null-method we were given.
2292
2293 2004-02-01  Duncan Mak  <duncan@ximian.com>
2294
2295         * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
2296         parsing for cmd, fixes bug #53694.
2297
2298 2004-02-04  Marek Safar  <marek.safar@seznam.cz>
2299
2300         * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
2301         in the member name duplication tests. Property and operator name duplication
2302         was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
2303
2304 2004-02-03  Marek Safar  <marek.safar@seznam.cz>
2305
2306         * interface.cs (PopulateMethod): Fixed crash when interface method
2307         returns not existing type (error test cs0246-3.cs).
2308
2309 2004-02-02  Ravi Pratap M <ravi@ximian.com>
2310
2311         * cs-parser.jay (interface_accessors): Re-write actions to also
2312         store attributes attached to get and set methods. Fix spelling
2313         while at it.
2314
2315         (inteface_property_declaration): Modify accordingly.
2316
2317         (InterfaceAccessorInfo): New helper class to store information to pass
2318         around between rules that use interface_accessors.
2319
2320         * interface.cs (Emit): Apply attributes on the get and set
2321         accessors of properties and indexers too.
2322
2323         * attribute.cs (ApplyAttributes): Modify accordingly to use the
2324         right MethodBuilder when applying attributes to the get and set accessors.
2325
2326 2004-01-31  Miguel de Icaza  <miguel@ximian.com>
2327
2328         * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
2329
2330 2004-01-26  Miguel de Icaza  <miguel@ximian.com>
2331
2332         * cs-tokenizer.cs: Handle #line hidden from PDC bits.
2333
2334 2004-01-25  Miguel de Icaza  <miguel@ximian.com>
2335
2336         * cs-parser.jay: Remove YIELD token, instead use the new grammar
2337         changes that treat `yield' specially when present before `break'
2338         or `return' tokens.
2339
2340         * cs-tokenizer.cs: yield is no longer a keyword.
2341
2342 2004-01-23  Marek Safar  <marek.safar@seznam.cz>
2343
2344         * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
2345         setting for default constructors.
2346         For default constructors are almost every time set wrong Modifier. The
2347         generated IL code has been alright. But inside mcs this values was
2348         wrong and this was reason why several of my CLS Compliance tests
2349         failed.
2350
2351 2004-02-27  Martin Baulig  <martin@ximian.com>
2352
2353         * generics.cs (ConstructedType.ResolveType): Make the nested type
2354         stuff actually work.
2355
2356 2004-02-25  Martin Baulig  <martin@ximian.com>
2357
2358         * decl.cs (DeclSpace.CurrentTypeParameters): New protected
2359         property; returns the type parameters just from the current type,
2360         ie. with the ones from outer classes.
2361         (DeclSpace.LookupGeneric): First search in the current class, then
2362         in outer classes.
2363         (DeclSpace.initialize_type_params): When hiding a type parameter
2364         from an outer class, put it into the `type_param_list' anyways.
2365
2366         * expression.cs (MemberAccess.expr): Made this field protected.
2367
2368         * class.cs (TypeContainer.Define): The `CurrentType' just contains
2369         the type parameters from the current class.
2370
2371         * generic.cs (ConstructedType.ResolveType): Support nested generic
2372         types by taking the type parameters which we inherit from outer
2373         classes into account.
2374         (GenericMemberAccess.ResolveAsTypeStep): Override this and added
2375         support for nested generic types.
2376
2377 2004-02-23  Martin Baulig  <martin@ximian.com>
2378
2379         * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
2380         field and check whether we're nested inside a generic type.
2381         (DeclSpace.ResolveType): If we're resolving to a generic type
2382         definition, create a ConstructedType and return its resolved type.
2383         (DeclSpace.initialize_type_params): New private method;
2384         initializes the `type_param_list' field from the type parameters
2385         from this and all enclosing classes.
2386         (DeclSpace.TypeParameters): Call initialize_type_params() unless
2387         we're already initialized.
2388
2389 2004-02-23  Martin Baulig  <martin@ximian.com>
2390
2391         * class.cs (Method.Define): Create the generic method before
2392         calling DoDefine().
2393         (Memberbase.DoDefine): Added DeclSpace argument (in addition to
2394         the TypeContainer one); we use this for generic methods.
2395
2396         * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
2397         parent's TypeBuilder.
2398
2399 2004-02-18  Martin Baulig  <martin@ximian.com>
2400
2401         * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
2402         to check for equality.
2403
2404 2004-02-05  Martin Baulig  <martin@ximian.com>
2405
2406         * ecore.cs (FieldExpr.DoResolveLValue): If we have an
2407         `ec.TypeContainer.CurrentType', use it instead of
2408         `ec.ContainerType' to check whether we're in the type's ctor.
2409
2410 2004-01-29  Martin Baulig  <martin@ximian.com>
2411
2412         * expression.cs (Invocation.DoResolve): If we're a
2413         `ConstructedType', then we're actually a generic method, so
2414         rewrite the expr as a GenericMemberAccess.
2415
2416         * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
2417         here; manually parse it into a string.
2418
2419 2004-01-28  Martin Baulig  <martin@ximian.com>
2420
2421         * typemanager.cs (TypeManager.IsEqual): New static method.
2422         (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
2423         check for equality instead of using `=='.
2424
2425 2004-01-26  Martin Baulig  <martin@ximian.com>
2426
2427         * decl.cs (DeclSpace.CurrentType): New public field.
2428
2429         * expression.cs (This.ResolveBase): If we have an
2430         `ec.TypeContainer.CurrentType', use it instead of
2431         `ec.ContainerType'.
2432
2433         * class.cs (TypeContainer.DefineType): If we're a generic type,
2434         create the `CurrentType' (unresolved).
2435         (TypeContainer.GenericType): New private field.
2436         (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
2437         it and store it in `GenericType' before creating the MemberCache.
2438         (TypeContainer.GetMembers): If we have a `GenericType', call
2439         TypeManager.FindMembers() on it.
2440
2441         * interface.cs (Interface.GenericType): New private field.
2442         (Interface.DefineType): If we're a generic type, create the
2443         `CurrentType' (unresolved).
2444         (Interface.DefineMembers): If we have a `CurrentType', resolve it
2445         and store it in `GenericType' before creating the MemberCache.
2446         (Interface.GetMembers): If we have a `GenericType', call
2447         TypeManager.FindMembers() on it.
2448
2449 2004-01-22  Martin Baulig  <martin@ximian.com>
2450
2451         * cs-parser.jay (namespace_or_type_name): Return an Expression,
2452         not a QualifiedIdentifier.  This is what `type_name_expression'
2453         was previously doing.
2454         (type_name_expression): Removed; the code is now in
2455         `namespace_or_type_name'.
2456         (qualified_identifier): Removed, use `namespace_or_type_name'
2457         instead.
2458         (QualifiedIdentifier): Removed this class.      
2459
2460 2004-01-22  Martin Baulig  <martin@ximian.com>
2461
2462         * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
2463         not a string as alias name.
2464
2465 2004-01-21  Miguel de Icaza  <miguel@ximian.com>
2466
2467         * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
2468         #52730 bug, and instead compute correctly the need to use a
2469         temporary variable when requesting an address based on the
2470         static/instace modified of the field and the constructor.
2471  
2472 2004-01-21  Martin Baulig  <martin@ximian.com>
2473
2474         * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
2475         class and namespace before looking up aliases.  Fixes #52517.
2476
2477 2004-01-21  Martin Baulig  <martin@ximian.com>
2478
2479         * flowanalysis.cs (UsageVector.Merge): Allow variables being
2480         assinged in a 'try'; fixes exception4.cs.
2481
2482 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
2483         * class.cs : Implemented parameter-less constructor for TypeContainer
2484
2485         * decl.cs: Attributes are now stored here. New property OptAttributes
2486
2487         * delegate.cs, enum.cs, interface.cs: Removed attribute member.
2488
2489         * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
2490
2491 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
2492
2493         * typemanager.cs (CSharpSignature): Now reports also inner class name.
2494           (CSharpSignature): New method for indexer and property signature.
2495
2496 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
2497
2498         * pending.cs (IsVirtualFilter): Faster implementation.
2499
2500 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
2501
2502         * typemanager.cs: Avoid inclusion of same assembly more than once.
2503
2504 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
2505
2506         * cs-parser.jay: Fixed problem where the last assembly attribute
2507           has been applied also to following declaration (class, struct, etc.)
2508           
2509 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
2510
2511         * class.cs: Added error CS0538, CS0539 reporting.
2512         Fixed crash on Microsoft runtime when field type is void.
2513
2514         * cs-parser.jay: Added error CS0537 reporting.
2515
2516         * pending.cs: Added error CS0535 reporting.
2517         Improved error report for errors CS0536, CS0534.
2518
2519 2004-01-20  Miguel de Icaza  <miguel@ximian.com>
2520
2521         Merge a few bits from the Anonymous Method MCS tree.
2522
2523         * statement.cs (ToplevelBlock): New class for toplevel methods,
2524         will hold anonymous methods, lifted variables.
2525
2526         * cs-parser.jay: Create toplevel blocks for delegates and for
2527         regular blocks of code. 
2528
2529 2004-01-20  Martin Baulig  <martin@ximian.com>
2530
2531         * codegen.cs (EmitContext): Removed `InTry', `InCatch',
2532         `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
2533         and `NeedExplicitReturn'; added `IsLastStatement'.
2534         (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
2535         have a `ReturnLabel' or we're not unreachable.
2536
2537         * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
2538         child's reachability; don't just override ours with it.  Fixes
2539         #58058 (lluis's example).
2540         (FlowBranching): Added public InTryOrCatch(), InCatch(),
2541         InFinally(), InLoop(), InSwitch() and
2542         BreakCrossesTryCatchBoundary() methods.
2543
2544         * statement.cs (Return): Do all error checking in Resolve().
2545         Unless we are the last statement in a top-level block, always
2546         create a return label and jump to it.
2547         (Break, Continue): Do all error checking in Resolve(); also make
2548         sure we aren't leaving a `finally'.
2549         (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
2550         statement in a top-level block.
2551         (Block.Flags): Added `IsDestructor'.
2552         (Block.IsDestructor): New public property.
2553
2554 2004-01-20  Martin Baulig  <martin@ximian.com>
2555
2556         * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
2557
2558 2004-01-20  Martin Baulig  <martin@ximian.com>
2559
2560         * statement.cs (Statement.ResolveUnreachable): New public method.
2561         (If, While): Do the dead-code elimination in Resolve(), not in Emit().
2562         (Block.Resolve): Resolve unreachable statements.
2563
2564 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
2565
2566         * expression.cs: We need to fix the case where we do
2567         not have a temp variable here.
2568
2569         * assign.cs: Only expression compound assignments need
2570         temporary variables.
2571
2572 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
2573
2574         * flowanalysis.cs: Reduce memory allocation in a few ways:
2575           - A block with no variables should not allocate a bit
2576             vector for itself.
2577           - A method with no out parameters does not need any tracking
2578             for assignment of the parameters, so we need not allocate
2579             any data for it.
2580           - The arrays:
2581                 public readonly Type[] VariableTypes;
2582                 public readonly string[] VariableNames;
2583             Are redundant. The data is already stored in the variable
2584             map, so we need not allocate another array for it.
2585           - We need to add alot of checks for if (params | locals) == null
2586             due to the first two changes.
2587
2588 2004-01-18  Miguel de Icaza  <miguel@ximian.com>
2589
2590         * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
2591         implement IMemoryLocation, we store a copy on a local variable and
2592         take the address of it.  Patch from Benjamin Jemlich
2593
2594         * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
2595         to use a special "type_name_expression" rule which reduces the
2596         number of "QualifiedIdentifier" classes created, and instead
2597         directly creates MemberAccess expressions.
2598
2599 2004-01-17  Miguel de Icaza  <miguel@ximian.com>
2600
2601         * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
2602         that fixes #52853.  Null literal assignment to ValueType
2603
2604         * class.cs (MethodData.Emit): Instead of checking the name of the
2605         method to determine if its a destructor, create a new derived
2606         class from Method called Destructor, and test for that.  
2607
2608         * cs-parser.jay: Create a Destructor object instead of a Method.  
2609
2610         Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
2611
2612         Fixes: 52933
2613
2614 2004-01-16  Miguel de Icaza  <miguel@ximian.com>
2615
2616         * expression.cs (Binary.ResolveOperator): Perform an implicit
2617         conversion from MethodGroups to their delegate types on the
2618         Addition operation.
2619
2620         * delegate.cs: Introduce a new class DelegateCreation that is the
2621         base class for `NewDelegate' and `ImplicitDelegateCreation',
2622         factor some code in here.
2623
2624         * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
2625         conversion from MethodGroups to compatible delegate types. 
2626
2627         * ecore.cs (Expression.Resolve): Do not flag error 654
2628         (Methodgroupd needs parenthesis) if running on the V2 compiler, as
2629         we allow conversions from MethodGroups to delegate types now.
2630
2631         * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
2632         assignments in v2 either.
2633
2634 2004-01-10  Miguel de Icaza  <miguel@ximian.com>
2635
2636         * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
2637         static read-only fields in ctors.
2638
2639         Applied patch from Benjamin Jemlich 
2640
2641         * expression.cs (UnaryMutator): Avoid leaking local variables. 
2642
2643 2004-01-09  Miguel de Icaza  <miguel@ximian.com>
2644
2645         * cs-tokenizer.cs (IsCastToken): Allow the various native types
2646         here to return true, as they can be used like this:
2647
2648                 (XXX) int.MEMBER ()
2649
2650         Fixed 49836 and all the other dups
2651
2652 2004-01-09  Zoltan Varga  <vargaz@freemail.hu>
2653
2654         * driver.cs: Implement /win32res and /win32icon.
2655
2656 2004-01-08  Miguel de Icaza  <miguel@ximian.com>
2657
2658         * cs-parser.jay: Add a rule to improve error handling for the
2659         common mistake of placing modifiers after the type.
2660
2661 2004-01-07  Miguel de Icaza  <miguel@ximian.com>
2662
2663         * cs-parser.jay (interface_event_declaration): Catch
2664         initialization of events on interfaces, and report cs0068
2665
2666         * cs-parser.jay (interface_event_declaration): Catch
2667         initialization of events. 
2668
2669         * ecore.cs: Better report missing constructors.
2670
2671         * expression.cs (Binary.ResolveOperator): My previous bug fix had
2672         the error reporting done in the wrong place.  Fix.
2673
2674         * expression.cs (Binary.ResolveOperator): Catch the 
2675         operator + (E x, E y) error earlier, and later allow for implicit
2676         conversions in operator +/- (E e, U x) from U to the underlying
2677         type of E.
2678
2679         * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
2680         52596, if the container class is abstract, the default constructor
2681         is protected otherwise its public (before, we were always public).
2682
2683         * statement.cs (Fixed.Resolve): Catch a couple more errors in the
2684         fixed statement.
2685
2686         (Using.EmitLocalVariableDecls): Applied patch from Benjamin
2687         Jemlich that fixes bug #52597, MCS was generating invalid code for
2688         idisposable structs.   Thanks to Ben for following up with this
2689         bug as well.
2690
2691 2004-01-06  Miguel de Icaza  <miguel@ximian.com>
2692
2693         * driver.cs: Allow assemblies without code to be generated, fixes
2694         52230.
2695
2696 2004-01-07  Nick Drochak <ndrochak@gol.com>
2697
2698         * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
2699
2700 2004-01-05  Miguel de Icaza  <miguel@ximian.com>
2701
2702         * cs-parser.jay: Add rules to improve error reporting if fields or
2703         methods are declared at the namespace level (error 116)
2704
2705         * Add rules to catch event add/remove
2706
2707 2004-01-04  David Sheldon <dave-mono@earth.li>
2708
2709   * expression.cs: Added matching ")" to error message for 
2710   CS0077
2711
2712 2004-01-03 Todd Berman <tberman@gentoo.org>
2713
2714         * ecore.cs, attribute.cs:
2715         Applying fix from #52429.
2716
2717 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
2718
2719         * ecore.cs, expression.cs, statement.cs:
2720         Total rewrite of how we handle branching. We
2721         now handle complex boolean expressions with fewer
2722         jumps. As well if (x == 0) no longer emits a ceq.
2723
2724         if (x is Foo) is much faster now, because we generate
2725         better code.
2726
2727         Overall, we get a pretty big improvement on our benchmark
2728         tests. The code we generate is smaller and more readable.
2729
2730         I did a full two-stage bootstrap. The patch was reviewed
2731         by Martin and Miguel.
2732
2733 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
2734
2735         * cs-parser.jay: Make primary_expression not take a QI.
2736         we dont need this because the member_access rule covers
2737         us here. So we replace the rule with just IDENTIFIER.
2738
2739         This has two good effects. First, we remove a s/r conflict.
2740         Second, we allocate many fewer QualifiedIdentifier objects.
2741
2742 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
2743
2744         * attribute.cs: Handle MarshalAs attributes as pseudo, and
2745         set the correct information via SRE. This prevents
2746         hanging on the MS runtime. Fixes #29374.
2747
2748 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
2749
2750         * convert.cs: correctly handle conversions to value types
2751         from Enum and ValueType as unboxing conversions.
2752
2753         Fixes bug #52569. Patch by Benjamin Jemlich.
2754
2755 2004-01-02  Ravi Pratap  <ravi@ximian.com>
2756
2757         * expression.cs (BetterConversion): Prefer int -> uint
2758         over int -> ulong (csc's behaviour). This fixed bug #52046.
2759
2760 2004-01-02 Ben Maurer  <bmaurer@users.sourceforge.net>
2761
2762         * decl.cs (MemberCache.FindMembers): now returns a
2763         MemberInfo [].
2764
2765         * typemanager.cs: In general, go with with ^^.
2766         (CopyNewMethods): take an IList.
2767         (RealMemberLookup): Only allocate an arraylist
2768         if we copy from two sets of methods.
2769
2770         This change basically does two things:
2771         1) Fewer array lists allocated due to CopyNewMethods.
2772         2) the explicit cast in MemberList costed ALOT.
2773
2774 2004-01-02  Zoltan Varga  <vargaz@freemail.hu>
2775
2776         * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
2777         a hashtable to avoid needless string allocations when an identifier is
2778         used more than once (the common case).
2779
2780 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
2781
2782         * pending.cs: MS's TypeBuilder.GetInterfaces ()
2783         is broken, it will not return anything. So, we
2784         have to use the information we have in mcs to
2785         do the task.
2786
2787         * typemanager.cs: Add a cache for GetInterfaces,
2788         since this will now be used more often (due to ^^)
2789
2790         (GetExplicitInterfaces) New method that gets the
2791         declared, not effective, interfaces on a type
2792         builder (eg, if you have interface IFoo, interface
2793         IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
2794         { IBar }.
2795
2796         This patch makes MCS able to bootstrap itself on
2797         Windows again.
2798
2799 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
2800
2801         * expression.cs: Remove the Nop's that Miguel put
2802         in by mistake.
2803
2804 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
2805
2806         * report.cs, codegen.cs: Give the real stack trace to
2807         the error when an exception is thrown.
2808
2809 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
2810
2811         * decl.cs: only allocate hashtables for ifaces if 
2812         it is an iface!
2813
2814 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
2815
2816         * expression.cs: fix the error from cs0121-2.cs
2817         (a parent interface has two child interfaces that
2818         have a function with the same name and 0 params
2819         and the function is called through the parent).
2820
2821 2003-12-30 Ben Maurer  <bmaurer@users.sourceforge.net>
2822
2823         * class.cs, rootcontext.cs, typmanager.cs: do not
2824         leak pointers.
2825
2826 2003-12-28 Ben Maurer  <bmaurer@users.sourceforge.net>
2827
2828         * codegen.cs: remove stack for the ec flow branching.
2829         It is already a linked list, so no need.
2830
2831 2003-12-27 Ben Maurer  <bmaurer@users.sourceforge.net>
2832
2833         * Makefile: Allow custom profiler here.
2834
2835 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
2836
2837         * typemanager.cs (LookupType):
2838           - Use a static char [], because split takes
2839             a param array for args, so it was allocating
2840             every time.
2841           - Do not store true in a hashtable, it boxes.
2842
2843 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
2844
2845         * flowanalysis.cs: bytify common enums.
2846
2847 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
2848
2849         * modifiers.cs: Add a new set of flags for the
2850         flags allowed on explicit interface impls.
2851         * cs-parser.jay: catch the use of modifiers in
2852         interfaces correctly.
2853         * class.cs: catch private void IFoo.Blah ().
2854
2855         All related to bug #50572.
2856
2857 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
2858
2859         * decl.cs: Rewrite the consistant accessability checking.
2860         Accessability is not linear, it must be implemented in
2861         a tableish way. Fixes #49704.
2862
2863 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
2864
2865         * expression.cs: Handle negation in a checked context.
2866         We must use subtraction from zero. Fixes #38674.
2867
2868 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
2869
2870         * class.cs: Ignore static void main in DLLs.
2871         * rootcontext.cs: Handle the target type here,
2872         since we are have to access it from class.cs
2873         * driver.cs: account for the above.
2874
2875 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
2876
2877         * report.cs: Give line numbers and files if available.
2878
2879 2003-12-20  Zoltan Varga  <vargaz@freemail.hu>
2880
2881         * driver.cs: Implement /addmodule.
2882
2883         * typemanager.cs:  Change 'modules' field so it now contains Modules not
2884         ModuleBuilders.
2885
2886 2003-12-20  Martin Baulig  <martin@ximian.com>
2887
2888         * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
2889         (FieldBase.IsAssigned): Removed this field.
2890         (FieldBase.SetAssigned): New public method.
2891         (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
2892
2893 2003-12-20  Martin Baulig  <martin@ximian.com>
2894
2895         * expression.cs (LocalVariableReference.DoResolve): Don't set
2896         `vi.Used' if we're called from DoResolveLValue().
2897
2898         * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
2899         returns the usage vector it just merged into the current one -
2900         pass this one to UsageWarning().
2901         (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
2902         of the `EmitContext', don't call this recursively on our children.
2903
2904 2003-12-19  Zoltan Varga  <vargaz@freemail.hu>
2905
2906         * driver.cs: Implement /target:module.
2907
2908 2003-12-18  Zoltan Varga  <vargaz@freemail.hu>
2909
2910         * support.cs (CharArrayHashtable): New helper class.
2911
2912         * cs-tokenizer.cs: Store keywords in a hashtable indexed by 
2913         char arrays, not strings, so we can avoid creating a string in
2914         consume_identifier if the identifier is a keyword.
2915
2916 2003-12-16  Martin Baulig  <martin@ximian.com>
2917
2918         * statement.cs (LocalInfo.Assigned): Removed this property.
2919         (LocalInfo.Flags): Removed `Assigned'.
2920         (LocalInfo.IsAssigned): New public method; takes the EmitContext
2921         and uses flow analysis.
2922         (Block.UsageWarning): Made this method private.
2923         (Block.Resolve): Call UsageWarning() if appropriate.
2924
2925         * expression.cs (LocalVariableReference.DoResolve): Always set
2926         LocalInfo.Used here.
2927
2928 2003-12-13  Martin Baulig  <martin@ximian.com>
2929
2930         * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
2931         any value here; we're now using flow analysis to figure out
2932         whether a statement/block returns a value.
2933
2934 2003-12-13  Martin Baulig  <martin@ximian.com>
2935
2936         * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
2937         working again.
2938         (FlowBranching.MergeFinally): Don't call
2939         `branching.CheckOutParameters()' here, this is called in
2940         MergeTopBlock().
2941         (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
2942         when adding the `finally' vector.       
2943
2944 2003-12-13  Martin Baulig  <martin@ximian.com>
2945
2946         * flowanalysis.cs
2947         (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
2948         actually work and also fix #48962.
2949
2950 2003-12-12 Ben Maurer  <bmaurer@users.sourceforge.net>
2951
2952         * decl.cs: Do not check System.Object for nested types,
2953         since we know it does not have any. Big bang for buck:
2954
2955         BEFORE:
2956            Run 1:   8.35 seconds
2957            Run 2:   8.32 seconds
2958            corlib:  17.99 seconds
2959         AFTER:
2960            Run 1:   8.17 seconds
2961            Run 2:   8.17 seconds
2962            corlib:  17.39 seconds
2963
2964 2003-12-11 Ben Maurer  <bmaurer@users.sourceforge.net>
2965
2966         * class.cs (FindMembers): Allocate arraylists on demand. Most of the
2967         time we are returning 0 members, so we save alot here.
2968
2969 2003-12-11  Martin Baulig  <martin@ximian.com>
2970
2971         * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
2972         `MergeChild()', also just take the `FlowBranching' as argument;
2973         call Merge() on it and return the result.
2974         (FlowBranching.Merge): We don't need to do anything if we just
2975         have one sibling.
2976
2977 2003-12-11  Martin Baulig  <martin@ximian.com>
2978
2979         * flowanalysis.cs: Use a list of `UsageVector's instead of storing
2980         them in an `ArrayList' to reduce memory usage.  Thanks to Ben
2981         Maurer for this idea.
2982
2983 2003-12-11  Martin Baulig  <martin@ximian.com>
2984
2985         * flowanalysis.cs (MergeResult): This class is now gone; we now
2986         use the `UsageVector' for this.  The reason for this is that if a
2987         branching just has one sibling, we don't need to "merge" them at
2988         all - that's the next step to do.
2989         (FlowBranching.Merge): We now return a `UsageVector' instead of a
2990         `MergeResult'.
2991
2992 2003-12-11  Martin Baulig  <martin@ximian.com>
2993
2994         Reworked flow analyis and made it more precise and bug-free.  The
2995         most important change is that we're now using a special `Reachability'
2996         class instead of having "magic" meanings of `FlowReturns'.  I'll
2997         do some more cleanups and optimizations and also add some more
2998         documentation this week.
2999
3000         * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
3001         largely reworked this class.
3002         (FlowReturns): Removed `Unreachable' and `Exception'; we now use
3003         the new `Reachability' class instead of having "magic" values here.
3004         (FlowBranching): We're now using an instance of `Reachability'
3005         instead of having separate `Returns', `Breaks' etc. fields.
3006
3007         * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
3008         based on flow analysis; ignore the return value of block.Emit ().
3009
3010 2003-12-10  Zoltan Varga  <vargaz@freemail.hu>
3011
3012         * driver.cs typemanager.cs: Find the mono extensions to corlib even
3013         if they are private.
3014
3015 2003-12-09  Martin Baulig  <martin@ximian.com>
3016
3017         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
3018         call them directly on the UsageVector.
3019
3020 2003-12-09  Martin Baulig  <martin@ximian.com>
3021
3022         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
3023         Changed return type from `FlowReturns' to `Reachability'.
3024
3025 2003-12-09  Martin Baulig  <martin@ximian.com>
3026
3027         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
3028         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
3029         `Reachable' fields with a single `Reachability' one.
3030
3031 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
3032
3033         * class.cs (FindMembers): Remove foreach's.
3034
3035         Bootstrap times:
3036
3037         BEFORE
3038                 Run 1:   8.74 seconds
3039                 Run 2:   8.71 seconds
3040
3041         AFTER
3042                 Run 1:   8.64 seconds
3043                 Run 2:   8.58 seconds
3044
3045
3046 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
3047
3048         * cs-parser.jay:
3049         * gen-treedump.cs:
3050         * statement.cs:
3051         This patch does a few things:
3052                 1. EmptyStatement is now a singleton, so it is never reallocated.
3053                 2. All blah is EmptyStatement constructs have been changed to
3054                    blah == EmptyStatement.Value, which is much faster and valid
3055                    now that EmptyStatement is a singleton.
3056                 3. When resolving a block, rather than allocating a new array for
3057                    the non-empty statements, empty statements are replaced with
3058                    EmptyStatement.Value
3059                 4. Some recursive functions have been made non-recursive.
3060         Mainly the performance impact is from (3), however (1) and (2) are needed for
3061         this to work. (4) does not make a big difference in normal situations, however
3062         it makes the profile look saner.
3063
3064         Bootstrap times:
3065
3066         BEFORE
3067         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
3068         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
3069         Total memory allocated: 56397 KB
3070
3071         AFTER
3072         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
3073         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
3074         Total memory allocated: 55666 KB
3075
3076 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
3077
3078         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
3079         than the hashtable in a hashtable version
3080
3081         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
3082         we always end up concating a string. This results in a huge perf
3083         loss, because many strings have to be tracked by the GC. In this
3084         patch, we first use a hashtable that works with two keys, so that
3085         the strings do not need to be concat'ed.
3086
3087         Bootstrap times:
3088         BEFORE
3089                 Run 1:   8.74 seconds
3090                 Run 2:   8.71 seconds
3091
3092         AFTER
3093                 Run 1:   8.65 seconds
3094                 Run 2:   8.56 seconds
3095
3096 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
3097
3098         * Makefile: Add a new target `do-time' that does a quick and simple
3099         profile, leaving easy to parse output.
3100
3101 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
3102
3103         * codegen.cs (Init): Create the dynamic assembly with 
3104         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
3105
3106 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
3107
3108         * support.cs: Make the PtrHashtable use only one
3109         instance of its comparer.
3110
3111 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
3112
3113         * typemanager.cs: Fix lookup of GetNamespaces.
3114
3115 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
3116
3117         * expression.cs: Removed redundant line.
3118
3119         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
3120         ArrayLists, use for loops with bounds.  
3121
3122         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
3123         arraylist.
3124
3125         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
3126         arraylists, use for loop with bounds.
3127
3128         The above three changes give us a 0.071 second performance
3129         improvement out of 3.294 seconds down to 3.223.  On my machine
3130         the above changes reduced the memory usage by 1,387 KB during
3131         compiler bootstrap.
3132
3133         * cs-parser.jay (QualifiedIdentifier): New class used to represent
3134         QualifiedIdentifiers.  Before we created a new string through
3135         concatenation, and mostly later on, the result would be
3136         manipulated by DecomposeQI through string manipulation.
3137
3138         This reduced the compiler memory usage for bootstrapping from
3139         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
3140         compile times in 0.05 seconds.
3141
3142 2003-11-28  Dick Porter  <dick@ximian.com>
3143
3144         * support.cs: Do string compares with the Invariant culture.
3145
3146         * rootcontext.cs: 
3147         * gen-treedump.cs: 
3148         * expression.cs: 
3149         * driver.cs: 
3150         * decl.cs: 
3151         * codegen.cs: 
3152         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
3153         the comparison is done with the Invariant culture.
3154
3155 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
3156
3157         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
3158         GetEnumerator method.
3159
3160         (ProbeCollectionType): Iterate starting at the most specific type
3161         upwards looking for a GetEnumerator
3162
3163         * expression.cs: Shift count can be up to 31 for int/uint and 63
3164         for long/ulong.
3165
3166 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
3167
3168         * statement.cs (Block.LookupLabel): Also look for the label on the
3169         children blocks.  Use a hash table to keep track of visited
3170         nodes. 
3171
3172         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
3173         we actually did transform the other operand, otherwise fall back
3174         to the common codepath that casts to long.
3175
3176         * cs-tokenizer.cs: Use the same code pattern as the int case.
3177         Maybe I should do the parsing myself, and avoid depending on the
3178         Parse routines to get this done.
3179
3180 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
3181
3182         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
3183         which fixes bug 51347.  This time test it.
3184
3185         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
3186         attributes for example can not tell the difference between these.
3187         The difference was only a syntax feature of the language. 
3188
3189         * attribute.cs: Apply attributes to delegates.
3190
3191         * delegate.cs: Call the apply attributes method.
3192
3193 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
3194
3195         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
3196         comparing 0 vs Byte.MinValue, not the value
3197
3198         (ImplicitConversionRequired): When reporting a conversion error,
3199         use error 31 to print out the constant error instead of the
3200         simpler 29.
3201
3202         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
3203         which fixes bug 51347.
3204
3205 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
3206
3207         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
3208         which fixes the -warnaserror command line option.
3209
3210 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
3211
3212         * cfold.cs (DoNumericPromotions): During constant folding of
3213         additions on UIntConstant, special case intconstants with
3214         IntConstants like we do on the expression binary operator. 
3215
3216 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
3217
3218         * convert.cs (ImplicitReferenceConversion): We were missing a case
3219         (System.Enum are not value types or class types, so we need to
3220         classify them separatedly).
3221
3222         * driver.cs: We do not support error 2007.
3223
3224 2003-11-12 Jackson Harper <jackson@ximian.com>
3225
3226         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
3227         system directory. Also use the full file name so users can
3228         libraries names mscorlib-o-tron.dll in a non system dir.
3229         
3230 2004-01-04  David Sheldon <dave-mono@earth.li>
3231
3232         * expression.cs: Added matching ")" to error message for CS0077.
3233
3234 2003-12-19  Martin Baulig  <martin@ximian.com>
3235
3236         * typemanager.cs (TypeManager.IsEqualGenericType): New public
3237         static method; see documentation in the method.
3238         (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
3239
3240         * convert.cs (Convert.ImplicitReferenceConversion,
3241         Convert.ImplicitReferenceConversionExists): Add support for
3242         generic type declarations; see gen-36.cs.
3243
3244 2003-12-19  Martin Baulig  <martin@ximian.com>
3245
3246         * pending.cs (Pending.InterfaceMethod): Use
3247         `Type.IsAssignableFrom()' instead of `=='.
3248
3249 2003-12-18  Martin Baulig  <martin@ximian.com>
3250
3251         * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
3252         byref types first.
3253
3254         * convert.cs (Convert.ImplicitStandardConversionExists): Use
3255         `expr_type.Equals (target_type)' instead of `=='.
3256
3257 2003-12-08  Martin Baulig  <martin@ximian.com>
3258
3259         * generics.cs (Constraints.Types): Removed.
3260         (Constraints.Resolve): Just resolve everything to TypeExpr's, not
3261         to Type's.
3262         (Constraints.ResolveTypes): New public method; resolves the
3263         TypeExpr's to Type's.
3264         (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
3265         longer takes the constraints.
3266         (TypeParameter.DefineMethod): Likewise.
3267         (TypeParameter.DefineType): New public method.  Calls
3268         `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
3269         the constraints.
3270
3271 2003-12-08  Martin Baulig  <martin@ximian.com>
3272
3273         * convert.cs (Convert.ImplicitConversionStandard): Use
3274         `expr_type.Equals (target_type)' instead of `=='.
3275
3276 2003-12-08  Martin Baulig  <martin@ximian.com>
3277
3278         * typemanager.cs (TypeManager.GetReferenceType): Call
3279         `Type.MakeByRefType ()'.
3280
3281 2003-12-08  Martin Baulig  <martin@ximian.com>
3282
3283         * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
3284         just has some special meaning in some situations.  For instance,
3285         it is allowed to use `where' as the name of a variable etc.
3286
3287 2003-12-04  Martin Baulig  <martin@ximian.com>
3288
3289         * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
3290         `Type.MakeArrayType()' for array types.
3291
3292 2003-11-18  Miguel de Icaza  <miguel@ximian.com>
3293
3294         * expression.cs (Invocation.VerifyArgumentsCompat): Remove
3295         debugging message.
3296
3297         (SizeOf.DoResolve): assign the `type_queried' field.  This gets
3298         corlib to compile.
3299
3300 2003-11-16  Martin Baulig  <martin@ximian.com>
3301
3302         * codegen.cs (EmitContext.IsGeneric): Removed.
3303
3304         * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
3305         ResolveGeneric() on the DeclSpace.
3306
3307 2003-11-16  Martin Baulig  <martin@ximian.com>
3308
3309         * generic.cs (TypeArguments.Resolve):
3310         `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
3311         `ResolveType()' on it to get the Type.
3312
3313 2003-11-15  Martin Baulig  <martin@ximian.com>
3314
3315         * generic.cs (ConstructedType.GetInterfaces): Override this.
3316
3317 2003-11-14  Martin Baulig  <martin@ximian.com>
3318
3319         * interface.cs (Interface.DefineType): Define all type parameters
3320         before adding the interfaces we inherit.
3321
3322 2003-11-11  Martin Baulig  <martin@ximian.com>
3323
3324         * generic.cs (ConstructedType.ResolveType): Always call
3325         `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
3326
3327 2003-11-10  Martin Baulig  <martin@ximian.com>
3328
3329         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
3330         (TypeManager.InitCoreTypes): Initialize them here, but instead of
3331         calling `ResolveType()' on them, directly assign their `Type'.
3332
3333 2003-11-08  Martin Baulig  <martin@ximian.com>
3334
3335         * generic.cs (ConstructedType): Override `IsClass' etc.
3336
3337 2003-11-08  Martin Baulig  <martin@ximian.com>
3338
3339         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
3340         return value and the `out parent' parameter.
3341         (TypeContainer.DefineType): Moved the CS0644 check into
3342         GetClassBases().  Don't pass the interface types to the
3343         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
3344         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
3345
3346         * ecore.cs (TypeExpr.IsAttribute): New property.
3347         (TypeExpr.GetInterfaces): New method.
3348
3349         * interface.cs (Interface.GetInterfaceTypeByName): Return a
3350         TypeExpr instead of a Type.
3351         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
3352         (Interface.DefineType): Don't pass the interface types to the
3353         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
3354         them later and then call `TypeBulider.AddInterfaceImplementation()'.
3355
3356         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
3357         instead of a `Type[]'.
3358         (TypeManager.RegisterBuilder): Likewise.
3359         (TypeManager.AddUserInterface): Likewise.
3360         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
3361         `Type[]' and also return a `TypeExpr[]'.
3362         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
3363
3364 2003-11-08  Martin Baulig  <martin@ximian.com>
3365
3366         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
3367         Expression.     
3368
3369 2003-11-08  Martin Baulig  <martin@ximian.com>
3370
3371         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
3372         TypeManager.ResolveExpressionTypes().
3373
3374         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
3375         instead of an Expression.
3376         (TypeExpr): This is now an abstract base class for `TypeExpression'.
3377         (TypeExpression): New public class; formerly known as `TypeExpr'.
3378
3379         * expression.cs (ComposedCast): Derive from TypeExpr.
3380
3381         * typemanager.cs (TypeManager.system_*_expr): These are now
3382         TypExpr's instead of Expression's.
3383         (TypeManager.ResolveExpressionTypes): New public static function;
3384         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
3385         of them.        
3386
3387 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
3388
3389         * expression.cs (New.DoResolve): Do not dereference value that
3390         might be a null return.
3391
3392         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
3393         sure that the constant value has the right type.  Fixes an
3394         unreported bug, similar to 50425.
3395
3396         * const.cs (Const.LookupConstantValue): Call
3397         ImplicitStandardConversionExists before doing a conversion to
3398         avoid havng the TypeManager.ChangeType do conversions.
3399
3400         Reduced the number of casts used
3401
3402         (Const.ChangeType): New routine to enable reuse of the constant
3403         type changing code from statement.
3404
3405         * typemanager.cs (ChangeType): Move common initialization to
3406         static global variables.
3407
3408         Fixes #50425.
3409
3410         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
3411         every value type to go through, even if it was void.  Fix that. 
3412
3413         * cs-tokenizer.cs: Use is_identifier_start_character on the start
3414         character of the define, and the is_identifier_part_character for
3415         the rest of the string.
3416
3417 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
3418
3419         * expression.cs (UnaryMutator.EmitCode): When I updated
3420         LocalVariableReference.DoResolve, I overdid it, and dropped an
3421         optimization done on local variable references.
3422
3423 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
3424
3425         * ecore.cs: Convert the return from Ldlen into an int.
3426
3427 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
3428
3429         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
3430         the accessibility, this is a special case for toplevel non-public
3431         classes (internal for instance).
3432
3433 2003-10-20  Nick Drochak <ndrochak@gol.com>
3434
3435         * ecore.cs: Fix typo and build.  Needed another right paren.
3436
3437 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
3438
3439         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
3440         `internal' case regular and protected, but not allowing protected
3441         to be evaluated later.  Bug 49840
3442
3443 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
3444
3445         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
3446         to kb.Nlast, and not the kb.nFirst to isolate the switch
3447         statement.
3448
3449         Extract the underlying type, so enumerations of long/ulong are
3450         treated like long/ulong.
3451
3452 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
3453
3454         * expression.cs (New): Overload the meaning of RequestedType to
3455         track the possible creation of the NewDelegate type, since
3456         DoResolve is invoked more than once for new constructors on field
3457         initialization.
3458
3459         See bugs: #48800 and #37014
3460
3461         * cs-parser.jay (declare_local_constants): Take an arraylist
3462         instead of a single constant.
3463
3464         (local_constant_declaration): It should take a
3465         constant_declarators, not a constant_declarator.  Fixes 49487
3466
3467         * convert.cs: Fix error report.
3468
3469 2003-10-13 Jackson Harper <jackson@ximian.com>
3470
3471         * typemanager.cs (TypeToCoreType): Add float and double this fixes
3472         bug #49611
3473         
3474 2003-11-03  Martin Baulig  <martin@ximian.com>
3475
3476         * expression.cs (ArrayAccess.GetStoreOpcode): Added
3477         `out bool has_type_arg'; if set, we need to pass the type to
3478         ig.Emit().
3479         (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
3480         Stelem_Any/Ldelem_Any for generic parameters.   
3481
3482 2003-11-02  Martin Baulig  <martin@ximian.com>
3483
3484         * expression.cs (Invocation.EmitCall): Use
3485         `TypeManager.IsValueType()' to check whether it's a value type.
3486         Don't set `struct_call' when calling a method on a type parameter.
3487
3488 2003-11-02  Martin Baulig  <martin@ximian.com>
3489
3490         * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
3491         and removed the TypeBuilder argument.
3492
3493         * typemanager.cs (TypeManager.IsValueType): Return
3494         `t.IsGenericParameter || t.IsValueType'.
3495
3496 2003-10-25  Martin Baulig  <martin@ximian.com>
3497
3498         * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
3499         call ConstructedType.Resolve() on it.
3500
3501         * generic.cs (ConstructedType.Resolve): Set `type' on success.
3502
3503 2003-10-25  Martin Baulig  <martin@ximian.com>
3504
3505         * class.cs (TypeContainer.GetClassBases): Changed
3506         `out Type parent' into `out TypeExpr parent'.  Moved CS0644 and
3507         CS8214 reporting here.
3508         (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
3509         instead of a `Type' for our parent.  In case of a recursive
3510         declaration (see tests/gen-23.cs for an example), our parent is a
3511         ConstructedType and it doesn't have its type set.  So, first
3512         create our own TypeBuilder, then call constructed.Resolve() to get
3513         the parent's type and finally TypeBuilder.SetParent() it.
3514
3515         * ecore.cs (TypeExpr.Name): New public virtual property.
3516
3517         * generic.cs
3518         (ConstructedType): We're now a TypeExpr and not just an Expression.
3519         (ConstructedType.ResolveAsTypeStep): Don't resolve our type
3520         arguments here; this is done later.
3521         (ConstructedType.Resolve): New public method to resolve the type
3522         arguments and bind them.
3523
3524 2003-10-21  Martin Baulig  <martin@ximian.com>
3525
3526         * convert.cs: Use `TypeManager.IsValueType' instead of
3527         'type.IsValueType' everywhere.
3528
3529         * typemanager.cs (TypeManager.IsValueType): Return true for type
3530         parameters.  The reason for this is that we need to box a type
3531         parameter when converting it to a reference type.
3532
3533         * cs-parser.jay: Added support for default value expressions.
3534
3535         * generics.cs (DefaultValueExpression): New public class.       
3536
3537 2003-10-17  Martin Baulig  <martin@ximian.com>
3538
3539         * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
3540         TypeContainer so we can also use this for Interfaces.
3541         (TypeParameter.Resolve): Likewise.
3542
3543         * interface.cs (Interface.DefineType): Added support for generic
3544         interfaces.
3545
3546         * cs-parser.jay: Added support for generic structs and interfaces.
3547
3548 2003-10-17  Martin Baulig  <martin@ximian.com>
3549
3550         * generic.cs (GenericMemberAccess.DoResolve): We can now actually
3551         call generic methods :-)
3552
3553 2003-10-16  Martin Baulig  <martin@ximian.com>
3554
3555         * cs-parser.jay (namespace_or_type_name): Only create a
3556         GenericMemberAccess if we actually have type arguments.
3557
3558 2003-10-13  Martin Baulig  <martin@ximian.com>
3559
3560         * class.cs (Method.Define): If we're a generic method, call
3561         TypeBuilder.DefineGenericMethod () before resolving
3562         the parameters.
3563         (MethodData): Added .ctor which takes an additional MethodBuilder
3564         argument; this is used for generic methods.
3565         (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
3566         we already have a MethodBuilder.
3567
3568 2003-10-10  Martin Baulig  <martin@ximian.com>
3569
3570         * class.cs (Method): Added .ctor which takes a `GenericMethod'
3571         instead of a `DeclSpace'.  This is used for generic methods.
3572
3573         * cs-parser.jay (method_header): Added support for generic
3574         methods; create a `GenericMethod' instance and pass it to the
3575         `Method's .ctor; it'll be used as the `DeclSpace' to lookup
3576         parameters and locals.
3577
3578         * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
3579         since we already have the location.  Check whether we're a generic
3580         type declaration or a generic method and create the correct type
3581         parameter.
3582
3583         * generic.cs (TypeParameter.DefineMethod): New public method.
3584         (GenericMethod): New public class; derives from DeclSpace and is
3585         used for generic methods.       
3586
3587 2003-10-09  Martin Baulig  <martin@ximian.com>
3588
3589         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
3590         to the .ctor.
3591         (MethodCore.DoDefineParameters): Removed the TypeContainer
3592         argument; use the DeclSpace which was passed to the .ctor instead.
3593         (MethodCore.CheckParameter): Take a DeclSpace instead of a
3594         TypeContainer; we only need a DeclSpace here.
3595
3596 2003-10-09  Martin Baulig  <martin@ximian.com>
3597
3598         * class.cs (MethodData): Added additional `DeclSpace ds' argument
3599         to the .ctor.
3600         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
3601         EmitContext's .ctor.    
3602
3603 2003-10-09  Martin Baulig  <martin@ximian.com>
3604
3605         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
3606         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
3607         AsAccessible(), moved them as well.
3608
3609         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
3610
3611 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
3612
3613         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
3614         generation for >=, as spotted by Paolo, bug 48679.  
3615         Patch from David Waite.
3616
3617         * cs-tokenizer.cs: Add handling for #pragma.
3618
3619         * cs-parser.jay: Allow for both yield and yield return in the
3620         syntax.  The anti-cobolization of C# fight will go on!
3621
3622         * class.cs (TypeBuilder.DefineType): Catch error condition here
3623         (Parent.DefineType erroring out and returning null).
3624
3625         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3626         coping with enumerations variables, we were mistakenly processing
3627         them as a regular value type instead of built-in types.  Fixes the
3628         bug #48063
3629
3630         * typemanager.cs (IsBuiltinOrEnum): New method.
3631
3632 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
3633
3634         * cs-parser.jay: Upgrade: yield now needs the return clause.
3635
3636 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
3637
3638         * cs-parser.jay : Renamed yyName to yyNames related to jay.
3639
3640 2003-09-29  Martin Baulig  <martin@ximian.com>
3641
3642         * typemanager.cs (TypeManager.GetMethodFlags): Added support for
3643         inflated generic methods.
3644
3645         * generics.cs (ConstructedType): Distinguish between open and
3646         closed constructed types; correctly resolve the arguments.
3647
3648 2003-09-22  Martin Baulig  <martin@ximian.com>
3649
3650         * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
3651         all type arguments meet their constraints.
3652
3653 2003-09-19  Martin Baulig  <martin@ximian.com>
3654
3655         * decl.cs (MemberCache.SetupCacheForInterface): Take a
3656         `MemberCache parent' argument.  Normally, an interface doesn't
3657         have a parent type except System.Object, but we use this in gmcs
3658         for generic type parameters.
3659
3660 2003-09-18  Martin Baulig  <martin@ximian.com>
3661
3662         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
3663         on `type.IsInterface'; don't check whether the type has a parent
3664         to determine whether it's an interface.
3665
3666 2003-09-17  Martin Baulig  <martin@ximian.com>
3667
3668         * generic.cs (ConstructedType.ToString): Always use `name' as the
3669         type name.
3670
3671 2003-09-15  Martin Baulig  <martin@ximian.com>
3672
3673         * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
3674
3675         * generic.cs (Constraints.Resolve): New public method; this is
3676         called to resolve the constraint types and to check whether all
3677         the constraints are correct.
3678         (Constraints.Types): New public property.
3679         (TypeParameter.Resolve): New public method; resolves all the
3680         type's constraints.
3681
3682         * class.cs (TypeContainer.DefineType): Call
3683         TypeParameter.Resolve() before actually defining the type.
3684
3685 2003-09-15  Martin Baulig  <martin@ximian.com>
3686
3687         * class.cs (TypeContainer.DefineType): Added an error flag to
3688         avoid reporting duplicate CS0146's ("class definition is
3689         circular.").
3690
3691         * driver.cs (Driver.MainDriver): Abort if
3692         RootContext.ResolveTree() reported any errors.
3693
3694 2003-09-07  Martin Baulig  <martin@ximian.com>
3695
3696         * report.cs (Error, Warning): Added overloaded versions which take
3697         a `params object[] args' and call String.Format().
3698
3699 2003-09-07  Martin Baulig  <martin@ximian.com>
3700
3701         * decl.cs (DeclSpace..ctor): Don't call
3702         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
3703         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
3704         (DeclSpace.RecordDecl): New method.
3705
3706         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
3707
3708 2003-09-02  Ravi Pratap  <ravi@ximian.com>
3709
3710         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
3711         value attributes to be applied to ParameterBuilders.
3712
3713         * class.cs (MethodCore.LabelParameters): Make static and more
3714         generic so that it can be used from other places - like interface
3715         methods, for instance.
3716
3717         * interface.cs (Interface.Emit): Call LabelParameters before
3718         emitting attributes on the InterfaceMethod.
3719
3720 2003-09-07  Martin Baulig  <martin@ximian.com>
3721
3722         * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
3723         if the number of type parameters doesn't match.
3724
3725 2003-09-04  Martin Baulig  <martin@ximian.com>
3726
3727         * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
3728         for arrays of generic type params (ie. `!0[]').
3729
3730 2003-09-04  Martin Baulig  <martin@ximian.com>
3731
3732         * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
3733         for the moment.
3734
3735 2003-09-04  Martin Baulig  <martin@ximian.com>
3736
3737         * decl.cs (DeclSpace.LookupGeneric): New method.
3738         (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
3739         moment.
3740
3741         * generic.cs (TypeParameterExpr): Take a TypeParameter as
3742         argument, not just a string.
3743         (TypeParameter.Define): New public method; this is called to
3744         actually define the generic parameter; after this, you can use the
3745         new `Type' property to get the type.
3746
3747 2003-09-04  Martin Baulig  <martin@ximian.com>
3748
3749         * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
3750         is now an ArrayList; initialize the result of the `TypeParameters'
3751         property here.
3752         (DeclSpace.GetGenericData): Removed.
3753         (DeclSpace.LookupGeneric): Temporarily removed; we need to
3754         implement this in a different way.
3755         (DeclSpace.GetTypeParameters): Removed; there's now a
3756         `TypeParameters' property.
3757         (DeclSpace.TypeParameters): New public property.
3758
3759         * generic.cs (Constraints): Make this class public.
3760         (TypeParameter): New public class.
3761
3762 2003-09-04  Martin Baulig  <martin@ximian.com>
3763
3764         * decl.cs (DeclSpace.GetTypeParameters): New method to return the
3765         generic parameters.
3766
3767         * class.cs (TypeContainer.DefineType): Call
3768         TypeBuilder.DefineGenericParameter () on all generic parameters if
3769         this is a generic type.
3770
3771 2003-08-28  Martin Baulig  <martin@ximian.com>
3772
3773         * sample-stack.il: Compile this with ilasm: "ilasm /dll
3774         sample-stack.il".
3775
3776         * sample-hello.cs: Compile this with gmcs: "gmcs
3777         /r:sample-stack.dll sample-hello.cs".
3778
3779 2003-08-28  Martin Baulig  <martin@ximian.com>
3780
3781         * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
3782         the parameters to the generic type.
3783
3784 2003-08-28  Martin Baulig  <martin@ximian.com>
3785
3786         * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
3787
3788 2003-08-28  Martin Baulig  <martin@ximian.com>
3789
3790         * cs-parser.jay (opt_type_argument_list): Use
3791         `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
3792         (primary_expression): Replace `qualified_identifier' with `type_name'.
3793         (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
3794
3795         * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
3796         parser to check whether it is syntactically a type parameter list;
3797         return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
3798         this case.
3799
3800 2003-08-26  Martin Baulig  <martin@ximian.com>
3801
3802         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
3803         resolving aliases; fixes #47927.
3804
3805 2003-08-26  Martin Baulig  <martin@ximian.com>
3806
3807         * statement.cs (Using.DoResolve): This is internally emitting a
3808         try/finally clause, so we need to set ec.NeedExplicitReturn if we
3809         do not always return.  Fixes #47681.
3810
3811 2003-08-26  Martin Baulig  <martin@ximian.com>
3812
3813         * decl.cs (MemberCore): Moved WarningNotHiding(),
3814         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
3815         into MemberBase.
3816         (AdditionResult): Make this nested in DeclSpace.
3817         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
3818         argument; call NamespaceEntry.Define() unless we're nested in a
3819         class or struct.
3820
3821         * namespace.cs (Namespace.DefineName): New public function.  This
3822         is called from DeclSpace's .ctor to add 
3823         (Namespace.Lookup): Include DeclSpaces in the lookup.
3824
3825         * class.cs (Operator): Derive from MemberBase, not MemberCore.
3826
3827         * const.cs (Const): Derive from MemberBase, not MemberCore.     
3828
3829 2003-08-25  Martin Baulig  <martin@ximian.com>
3830
3831         * convert.cs (Convert.ExplicitReferenceConversion): When
3832         converting from an interface type to a class, unbox if the target
3833         type is a struct type.  Fixes #47822.
3834
3835 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3836
3837         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
3838         #47854.
3839
3840 2003-08-22  Martin Baulig  <martin@ximian.com>
3841
3842         * class.cs (TypeManager.DefineType): When defining a nested type,
3843         call DefineType() on our parent; fixes #47801.
3844
3845 2003-08-22  Martin Baulig  <martin@ximian.com>
3846
3847         * class.cs (MethodData.Define): While checking if a method is an
3848         interface implementation, improve the test a bit more to fix #47654.
3849
3850 2003-08-22  Martin Baulig  <martin@ximian.com>
3851
3852         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
3853         correctly; fixes #47722.
3854
3855 2003-08-22  Martin Baulig  <martin@ximian.com>
3856
3857         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
3858         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
3859
3860         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
3861
3862 2003-08-22  Martin Baulig  <martin@ximian.com>
3863
3864         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
3865         can only be assigned in static constructors.  Fixes #47161.
3866
3867 2003-08-22  Martin Baulig  <martin@ximian.com>
3868
3869         Rewrote and improved the flow analysis code.
3870
3871         * flowbranching.cs (FlowBranching): Make this class abstract.
3872         (FlowBranching.CreateBranching): New static function to create a
3873         new flow branching.
3874         (FlowBranchingBlock, FlowBranchingException): New classes.
3875         (FlowBranching.UsageVector.Type): New public readonly field.
3876         (FlowBranching.UsageVector.Breaks): Removed the setter.
3877         (FlowBranching.UsageVector.Returns): Removed the setter.
3878         (FlowBranching.UsageVector): Added Break(), Return(),
3879         NeverReachable() and Throw() methods to modify the reachability.
3880         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
3881         done by FlowBranching.Merge().
3882         (FlowBranching.UsageVector.MergeChild): New method; merges the
3883         merge result into the current vector.
3884         (FlowBranching.Merge): New abstract method to merge a branching.
3885
3886 2003-08-12  Martin Baulig  <martin@ximian.com>
3887
3888         * expression.cs (Indirection.CacheTemporaries): Create the
3889         LocalTemporary with the pointer type, not its element type.
3890
3891 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
3892
3893         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
3894         token was a keyword or not.
3895
3896         Add `error' options where an IDENTIFIER was expected;  Provide
3897         CheckToken and CheckIdentifierToken convenience error reporting
3898         functions. 
3899
3900         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
3901
3902         * decl.cs: Rename `NamespaceEntry Namespace' public field into
3903         NameSpaceEntry NameSpaceEntry.
3904
3905         (LookupInterfaceOrClass): Avoid creating a full qualified name
3906         from namespace and name: avoid doing lookups when we know the
3907         namespace is non-existant.   Use new Tree.LookupByNamespace which
3908         looks up DeclSpaces based on their namespace, name pair.
3909
3910         * driver.cs: Provide a new `parser verbose' to display the
3911         exception thrown during parsing.  This is turned off by default
3912         now, so the output of a failure from mcs is more graceful.
3913
3914         * namespace.cs: Track all the namespaces defined in a hashtable
3915         for quick lookup.
3916
3917         (IsNamespace): New method
3918
3919 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
3920
3921         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
3922         we know that we need to concatenate (full typename can never be
3923         null). 
3924
3925         * class.cs: ditto.
3926
3927         * statement.cs: Use a bitfield;  Do not initialize to null things
3928         which are done by the constructor by default.
3929
3930         * cs-parser.jay: bug fix, parameter was 4, not 3.
3931
3932         * expression.cs: Just use the property;
3933
3934         * statement.cs: No need for GetVariableInfo method.
3935
3936 2003-08-08  Martin Baulig  <martin@ximian.com>
3937
3938         * flowanalysis.cs (FlowReturns): This is now nested in the
3939         `FlowBranching' class.
3940         (MyBitVector): Moved this here from statement.cs.
3941         (FlowBranching.SiblingType): New enum type.
3942         (FlowBranching.CreateSibling): Added `SiblingType' argument.
3943
3944 2003-08-07  Martin Baulig  <martin@ximian.com>
3945
3946         * flowanalysis.cs (FlowBranchingType): This is now nested in the
3947         `FlowBranching' class and called `BranchingType'.
3948
3949 2003-08-07  Martin Baulig  <martin@ximian.com>
3950
3951         * flowanalysis.cs: Moved all the control flow analysis code into
3952         its own file.
3953
3954 2003-08-07  Martin Baulig  <martin@ximian.com>
3955
3956         * assign.cs (Assign.DoResolve): `target' must either be an
3957         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
3958         #37319.
3959
3960 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
3961
3962         * expression.cs (BinaryMethod): This kind of expression is created by the
3963         Binary class if it determines that the operator has to be handled
3964         by a method.
3965
3966         (BinaryDelegate): This kind of expression is created if we are
3967         dealing with a + or - operator on delegates.
3968
3969         (Binary): remove method, argumetns, and DelegateOperator: when
3970         dealing with methods, 
3971
3972         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
3973
3974         * statement.cs (Block): use bitfields for the three extra booleans
3975         we had in use.   Remove unused topblock parameter.
3976
3977         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
3978
3979         * assign.cs: Drop extra unneeded tests.
3980
3981 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
3982
3983         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
3984
3985         * statement.cs (Foreach): Use VariableStorage instead of
3986         LocalBuilders.   
3987
3988         * codegen.cs (VariableStorage): New class used by clients that
3989         require a variable stored: locals or fields for variables that
3990         need to live across yield.
3991
3992         Maybe provide a convenience api for EmitThis+EmitLoad?
3993
3994         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
3995         these bad boys.
3996
3997 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
3998
3999         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
4000         RemapParameterLValue): New methods that are used to turn a
4001         precomputed FieldInfo into an expression like this:
4002
4003                 instance.FieldInfo
4004
4005         The idea is to use this instead of making LocalVariableReference
4006         have more than one meaning.
4007
4008         * cs-parser.jay: Add error production to BASE.
4009
4010         * ecore.cs: Deal with TypeManager.GetField returning null, which
4011         is now a valid return value.
4012
4013         (FieldExprNoAddress): New expression for Fields whose address can
4014         not be taken.
4015
4016         * expression.cs (LocalVariableReference): During the resolve
4017         phases, create new expressions if we are in a remapping context.
4018         Remove code that dealt with remapping here.
4019
4020         (ParameterReference): same.
4021
4022         (ProxyInstance): New expression, like the `This' expression, but
4023         it is born fully resolved.  We know what we are doing, so remove
4024         the errors that are targeted to user-provided uses of `this'.
4025
4026         * statement.cs (Foreach): our variable is now stored as an
4027         Expression;  During resolution, follow the protocol, dont just
4028         assume it will return this.
4029
4030 2003-08-06  Martin Baulig  <martin@ximian.com>
4031
4032         * support.cs (SeekableStreamReader.cs): New public class.
4033
4034         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
4035         SeekableStreamReader instead of the normal StreamReader.
4036
4037 2003-08-04  Martin Baulig  <martin@ximian.com>
4038
4039         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
4040         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
4041         deambiguate casts and delegate invocations.
4042         (parenthesized_expression): Use the new tokens to ensure this is
4043         not a cast of method invocation.
4044
4045         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
4046         when reading a `)' and Deambiguate_CloseParens () was previously
4047         called.
4048
4049         * expression.cs (ParenthesizedExpression): New class.  This is
4050         just used for the CS0075 test.
4051         (Binary.DoResolve): Check for CS0075.   
4052
4053 2003-07-29  Ravi Pratap  <ravi@ximian.com>
4054
4055         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
4056         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
4057         reference comparison.
4058
4059         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
4060         examine the ReturnType for equality - this is necessary in the
4061         cases of implicit and explicit operators whose signature also
4062         includes the return type.
4063
4064 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
4065
4066         * namespace.cs: Cache the result of the namespace computation,
4067         instead of computing it every time.
4068
4069 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
4070
4071         * decl.cs: Use a global arraylist that we reuse over invocations
4072         to avoid excesive memory consumption.  Reduces memory usage on an
4073         mcs compile by one meg (45 average).
4074
4075         * typemanager.cs (LookupTypeReflection): In .NET pointers are
4076         private, work around that.
4077
4078 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
4079
4080         * literal.cs (IntLiteral): Define Zero and One static literals. 
4081
4082         * cs-parser.jay (integer_literal): use static literals to reduce
4083         memory usage for the most used literals (0, 1 and -1).  211kb
4084         reduced in memory usage.
4085
4086         Replace all calls to `new ArrayList' with `new
4087         ArrayList(4)' which is a good average number for most allocations,
4088         and also requires only 16 bytes of memory for its buffer by
4089         default. 
4090
4091         This reduced MCS memory usage in seven megabytes for the RSS after
4092         bootstrapping.
4093
4094 2003-07-28  Ravi Pratap  <ravi@ximian.com>
4095
4096         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
4097         handle params methods the correct way by forming only one
4098         applicable set with params and normal methods in them. Earlier we
4099         were looking at params methods only if we found no normal methods
4100         which was not the correct thing to do.
4101
4102         (Invocation.BetterFunction): Take separate arguments indicating
4103         when candidate and the best method are params methods in their
4104         expanded form.
4105
4106         This fixes bugs #43367 and #46199.
4107
4108         * attribute.cs: Documentation updates.
4109
4110         (CheckAttribute): Rename to CheckAttributeTarget.
4111         (GetValidPlaces): Rename to GetValidTargets.
4112
4113         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
4114         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
4115
4116         Fixes bug #44468.
4117
4118 2003-07-28  Miguel de Icaza  <miguel@ximian.com>
4119
4120         * codegen.cs: Compute IsGeneric correctly.
4121
4122         * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
4123         resolution. 
4124
4125         Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
4126         OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN.  There were too many
4127         regressions, and I was chasing more bugs than I required.
4128
4129         * interface.cs: Use expressions for base type names (like classes
4130         and structs have been doing for a while now), and resolve that.
4131         This patch should probably go into head as well.
4132
4133         This makes it one less user of FindType.
4134
4135 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
4136
4137         This compiler can not self host currently.  Need to fix that.
4138         
4139         * Makefile: compile to `gmcs.exe'
4140
4141         * driver.cs: Turn on v2 by default on gmcs.
4142
4143         * generic.cs (ConstructedType): Does no longer take a container
4144         type argument;  That will be taken care of later.
4145
4146         (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
4147         Use SimpleName to resolve for now, so we can continue the work on
4148         the parser, until we get Type.GetType that understands generics.
4149
4150         (ConstructedType.ToString): Implement
4151
4152         (TypeArguments.Resolve): Resolve the child expressions as types. 
4153         
4154         * cs-parser.jay: Rename interface_constraints to
4155         type_parameter_constraints
4156
4157         (namespace_or_type_name): Only use constructed types for the basic
4158         construction, we will deal with identifier<...> later.
4159
4160         (type/type_name): No longer call DecomposeQI, as
4161         namespace_or_type_name is always decoded now.
4162         
4163 2003-07-22  Ravi Pratap  <ravi@ximian.com>
4164
4165         * expression.cs (Invocation.OverloadResolve): Follow the spec more
4166         closely: we eliminate methods in base types when we have an
4167         applicable method in a top-level type.
4168
4169         Please see section 14.5.5.1 for an exact description of what goes
4170         on. 
4171
4172         This fixes bug #45127 and a host of other related to corlib compilation.
4173
4174         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
4175         array is the method corresponding to the top-level type (this is
4176         because of the changes made to icall.c) so we change this
4177         accordingly.
4178
4179         (MethodGroupExpr.Name): This too.
4180
4181         * typemanager.cs (GetElementType): New method which does the right
4182         thing when compiling corlib. 
4183
4184         * everywhere: Make use of the above in the relevant places.
4185
4186 2003-07-22  Martin Baulig  <martin@ximian.com>
4187
4188         * cs-parser.jay (invocation_expression): Moved
4189         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
4190         `cast_expression', but create a InvocationOrCast which later
4191         resolves to either an Invocation or a Cast.
4192
4193         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
4194         method; call this before EmitStatement() to make sure that this
4195         expression can be used as a statement.
4196
4197         * expression.cs (InvocationOrCast): New class; resolves to either
4198         an Invocation or a Cast.
4199
4200         * statement.cs (StatementExpression): Call ResolveStatement() on
4201         the ExpressionStatement before emitting it.
4202
4203 2003-07-21  Martin Baulig  <martin@ximian.com>
4204
4205         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
4206         `ref' and `out' attributes match; fixes #46220.
4207         (MemberAccess.ResolveMemberAccess): You can't reference a type
4208         through an expression; fixes #33180.
4209         (Indexers.GetIndexersForType): Don't return the indexers from
4210         interfaces the class implements; fixes #46502.
4211
4212 2003-07-21  Martin Baulig  <martin@ximian.com>
4213
4214         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
4215         CS0661 checks; fixes bug #30442.
4216
4217 2003-07-21  Martin Baulig  <martin@ximian.com>
4218
4219         * decl.cs (AdditionResult): Added `Error'.
4220
4221         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
4222
4223         * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
4224         cs0031.cs actually work.
4225
4226  2003-07-20  Miguel de Icaza  <miguel@ximian.com>
4227  
4228         * cs-parser.jay (namespace_name): do not use
4229         namespace_or_type_name, use qualified_identifier, because
4230         namespace_or_type_name will soon return a composed expression
4231         instead of a string.
4232  
4233         (namespace_or_type_name): Instead of returning a string, now this
4234         production returns an expression.
4235  
4236         * codegen.cs (EmitContext): Setup IsGeneric property based on
4237         whether our DeclSpace is generic, our the method is generic.
4238  
4239         * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
4240         the method is generic.
4241  
4242         * cs-parser.jay (type_arguments, opt_type_argument_list,
4243         type_parameters, type_parameter_list, opt_type_parameter_list,
4244         type_parameter,, opt_type_parameter_constraints_clauses,
4245         type_parameter_constraints_clauses,
4246         type_parameter_constraint_clause, type_parameter_constraint,
4247         interface_constraints): Add new production
4248  
4249         * decl.cs (DeclSpace): IsGeneric, flag to track whether this
4250         DeclSpace is generic or not.
4251  
4252         (DeclSpace.SetParameterInfo): New routine, used to set the
4253         parameter info for a type.
4254  
4255         (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
4256         returns a GenericTypeExpr
4257  
4258         * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
4259         generic, lookup the generic argument.
4260  
4261         * attribute.cs: Do not allow TypeParameterExpressions in
4262         Attributes.
4263  
4264         * class.cs: Do not allow the Main method to be defined in a
4265         Generic container.
4266  
4267         * expression.cs (SizeOf): Do not allow generic types to be used as
4268         arguments to sizeof.
4269  
4270         * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
4271         it: whether a type is generic or not.  Only works for types we are
4272         currently building for now.
4273         
4274 2003-07-20  Martin Baulig  <martin@ximian.com>
4275
4276         * namespace.cs: Fixed that bug which caused a crash when compiling
4277         the debugger's GUI.
4278
4279 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
4280
4281         * typemanager.cs (LookupTypeReflection): Never expose types which
4282         are NotPublic, NestedPrivate, NestedAssembly, or
4283         NestedFamANDAssem.  We used to return these, and later do a check
4284         that would report a meaningful error, but the problem is that we
4285         would not get the real match, if there was a name override.
4286
4287 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
4288
4289         * namespace.cs (Namespace, Name): Do not compute the namespace
4290         name dynamically, compute it in the constructor.  This reduced
4291         memory usage by 1697 KB.
4292
4293         * driver.cs: Use --pause to pause at the end.
4294
4295 2003-07-17  Peter Williams  <peter@newton.cx>
4296
4297         * Makefile: Change the name of the test target so that it doesn't
4298         conflict with the recursive test target.
4299
4300 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
4301
4302         * expression.cs (LocalVariableReference.Emit, EmitAssign,
4303         AddressOf): Do not use EmitThis, that was wrong, use the actual
4304         this pointer.
4305
4306 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
4307
4308         * class.cs (MethodData.Define): While checking if a method is an
4309         interface implementation, improve the test: If we are not public
4310         (use new test here: use the computed MethodAttributes directly,
4311         instead of the parsed modifier flags) check if the `implementing'
4312         method comes from an interface or not.
4313
4314         * pending.cs (VerifyPendingMethods): Slightly better error
4315         message.
4316
4317         * makefile: add test target that does the mcs bootstrap.
4318
4319 2003-07-16  Ravi Pratap  <ravi@ximian.com>
4320
4321         * interface.cs (Define): Do nothing here since there are no
4322         members to populate etc. Move the attribute emission out of here
4323         since this was just totally the wrong place to put it. Attribute
4324         application happens during the 'Emit' phase, not in the 'Define'
4325         phase.
4326
4327         (Emit): Add this method and move the attribute emission here
4328
4329         * rootcontext.cs (EmitCode): Call the Emit method on interface
4330         types too.
4331
4332 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
4333
4334         * expression.cs (OverloadResolve): Report error only if Location
4335         is not 'Null' which means that there was a probe going on.
4336
4337 2003-07-14  Martin Baulig  <martin@ximian.com>
4338
4339         * expression.cs (ConditionalLogicalOperator): New public class to
4340         implement user defined conditional logical operators.
4341         This is section 14.11.2 in the spec and bug #40505.
4342
4343 2003-07-14  Martin Baulig  <martin@ximian.com>
4344
4345         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
4346
4347 2003-07-14  Martin Baulig  <martin@ximian.com>
4348
4349         * codegen.cs (EmitContext.InFixedInitializer): New public field.
4350
4351         * ecore.cs (IVariable.VerifyFixed): New interface method.
4352
4353         * expression.cs (Unary.ResolveOperator): When resolving the `&'
4354         operator, check whether the variable is actually fixed.  Fixes bug
4355         #36055.  Set a variable definitely assigned when taking its
4356         address as required by the spec.
4357
4358         * statement.cs (LocalInfo.IsFixed): New field.
4359         (LocalInfo.MakePinned): Set `IsFixed' to true.
4360
4361 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
4362
4363         * attribute.cs (Attribute.Resolve): While doing a Member lookup
4364         for .ctors, ensure that we only ask for members declared in the
4365         attribute type (BindingFlags.DeclaredOnly).
4366
4367         Fixes bug #43632.
4368
4369         * expression.cs (Error_WrongNumArguments): Report error 1501
4370         correctly the way CSC does.
4371
4372 2003-07-13  Martin Baulig  <martin@ximian.com>
4373
4374         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
4375         lookup on the fully qualified name, to make things like "X.X" work
4376         where "X.X" is a fully qualified type name, but we also have a
4377         namespace "X" in the using list.  Fixes #41975.
4378
4379 2003-07-13  Martin Baulig  <martin@ximian.com>
4380
4381         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
4382         function. If we're a CompoundAssign, we need to create an embedded
4383         CompoundAssign, not an embedded Assign.
4384         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
4385         Fixes #45854.
4386
4387 2003-07-13  Martin Baulig  <martin@ximian.com>
4388
4389         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
4390         work to fix bug #46088.
4391
4392 2003-07-13  Ravi Pratap <ravi@ximian.com>
4393
4394         * class.cs (Operator.Emit): Do not emit attributes here - it is
4395         taken care of by the Method class that we delegate too. This takes
4396         care of bug #45876.
4397
4398 2003-07-10  Martin Baulig  <martin@ximian.com>
4399
4400         * expression.cs (TypeOfVoid): New class.
4401         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
4402
4403 2003-07-10  Martin Baulig  <martin@ximian.com>
4404
4405         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
4406         bug #35957.
4407
4408 2003-07-10  Martin Baulig  <martin@ximian.com>
4409
4410         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
4411         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
4412
4413         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
4414
4415         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
4416
4417 2003-07-10  Martin Baulig  <martin@ximian.com>
4418
4419         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
4420         of decimal.  Fixes #42850.
4421
4422         NOTE: I also fixed the created byte blob, but this doesn't work on
4423         the MS runtime and csc never produces any byte blobs for decimal
4424         arrays.
4425
4426 2003-07-10  Martin Baulig  <martin@ximian.com>
4427
4428         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
4429         structs; fixes #32068.
4430         (Block.AddChildVariableNames): Fixed #44302.
4431
4432 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4433
4434         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
4435
4436 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
4437
4438         * attribute.cs: And this test is onger needed.
4439
4440 2003-07-08  Martin Baulig  <martin@ximian.com>
4441
4442         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
4443         inaccessible types.  Fixes #36313.
4444
4445         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
4446
4447         * namespace.cs (NamespaceEntry): Create implicit entries for all
4448         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
4449         implicit entries for N1.N2 and N1.
4450
4451 2003-07-08  Martin Baulig  <martin@ximian.com>
4452
4453         Rewrote the handling of namespaces to fix a lot of the issues
4454         wrt. `using' aliases etc.
4455
4456         * namespace.cs (Namespace): Splitted this class into a
4457         per-assembly `Namespace' and a per-file `NamespaceEntry'.
4458
4459         * typemanager.cs (TypeManager.IsNamespace): Removed.
4460         (TypeManager.ComputeNamespaces): Only compute namespaces from
4461         loaded assemblies here, not the namespaces from the assembly we're
4462         currently compiling.
4463
4464 2003-07-08  Martin Baulig  <martin@ximian.com>
4465
4466         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
4467
4468 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
4469
4470         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
4471         already fixed it.  
4472
4473         I thought about the memory savings here, but LookupTypeReflection
4474         is used under already very constrained scenarios.  Compiling
4475         corlib or mcs only exposes one hit, so it would not really reduce
4476         any memory consumption.
4477
4478 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4479
4480         * typemanager.cs: fixes bug #45889 by only adding public types from
4481         other assemblies to the list of known types.
4482
4483 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
4484
4485         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
4486         on the type we resolved.
4487
4488 2003-07-05  Martin Baulig  <martin@ximian.com>
4489
4490         * pending.cs (PendingImplementation.ParentImplements): Don't
4491         create the proxy if the parent is abstract.
4492
4493         * class.cs (TypeContainer.DefineIndexers): Process explicit
4494         interface implementations first.  Fixes #37714.
4495
4496 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
4497
4498         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
4499         defined recursively;  but since we modify the input parameters
4500         (left is set to `this' temporarily), we reset this value if the
4501         left_is_explicit is false, which gives the original semantics to
4502         the code.  
4503
4504         * literal.cs (NullPointer): new class used to represent a null
4505         literal in a pointer context.
4506
4507         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
4508         type is a pointer, use a NullPointer object instead of a
4509         NullLiteral.   Closes 43687
4510
4511         (ExplicitConversion): Convert pointer values using
4512         the conv opcode to the proper type.
4513
4514         * ecore.cs (New): change ValueTypeVariable property into a method,
4515         that returns whether the valuetype is suitable for being used.
4516
4517         * expression.cs (Binary.DoNumericPromotions): Only return if we
4518         the int constant was a valid uint, and we can return both left and
4519         right as uints.  If not, we continue processing, to trigger the
4520         type conversion.  This fixes 39018.
4521
4522         * statement.cs (Block.EmitMeta): During constant resolution, set
4523         the CurrentBlock property on the emitcontext, so that we resolve
4524         constants propertly.
4525
4526 2003-07-02  Martin Baulig  <martin@ximian.com>
4527
4528         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
4529         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
4530
4531         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
4532         than emitting it here.
4533
4534         * statement.cs: Fixed some more flow analysis bugs.
4535
4536 2003-07-02  Martin Baulig  <martin@ximian.com>
4537
4538         * class.cs (MethodData.Define): When implementing interface
4539         methods, set Final unless we're Virtual.
4540
4541         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
4542         check work for interface methods.
4543
4544 2003-07-01  Martin Baulig  <martin@ximian.com>
4545
4546         * ecore.cs (EmitContext.This): Replaced this property with a
4547         GetThis() method which takes a Location argument.  This ensures
4548         that we get the correct error location for a CS0188.
4549
4550 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
4551
4552         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
4553         ImplicitStandardConversion.
4554
4555         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
4556
4557 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
4558
4559         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
4560         optimization.
4561
4562 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
4563
4564         * class.cs (Constructor.Define): Turn off initlocals for unsafe
4565         constructors.
4566
4567         (MethodData.Define): Turn off initlocals for unsafe methods.
4568
4569 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
4570
4571         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
4572         complete;  Fixes #37521.
4573
4574         * delegate.cs: Use Modifiers.TypeAttr to compute the
4575         TypeAttributes, instead of rolling our own.  This makes the flags
4576         correct for the delegates.
4577
4578 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
4579
4580         * class.cs (Constructor.Define): Set the private flag for static
4581         constructors as well.
4582
4583         * cs-parser.jay (statement_expression): Set the return value to
4584         null, to avoid a crash when we catch an error.
4585
4586 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
4587
4588         * cs-parser.jay: Applied patch from Jackson that adds support for
4589         extern and unsafe modifiers to destructor declarations.
4590
4591         * expression.cs: Report error 21 if the user is trying to index a
4592         System.Array.
4593
4594         * driver.cs: Add an error message, suggested by the bug report.
4595
4596         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
4597         if we do not have a ": this ()" constructor initializer.  Fixes 45149
4598
4599 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
4600
4601         * namespace.cs: Add some information to reduce FAQs.
4602
4603 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
4604
4605         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
4606         underlying enumeration types.  Fixes #43915.
4607
4608         * expression.cs: Treat ushort/short as legal values to be used in
4609         bitwise operations.
4610
4611 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
4612
4613         * delegate.cs: transfer custom attributes for paramenters from
4614         the delegate declaration to Invoke and BeginInvoke.
4615
4616 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
4617
4618         * attribute.cs: handle custom marshalers and emit marshal info
4619         for fields, too.
4620
4621 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
4622
4623         * makefile.gnu: Added anonymous.cs to the compiler sources.
4624
4625 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
4626
4627         * iterators.cs: Change the name of the proxy class to include two
4628         underscores.
4629
4630         * cs-parser.jay: Update grammar to include anonymous methods.
4631
4632         * anonymous.cs: new file.
4633
4634 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
4635
4636         * class.cs (Field.Define): Add missing test for pointers and
4637         safety. 
4638
4639 2003-05-27  Ravi Pratap  <ravi@ximian.com>
4640
4641         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
4642         we use the stobj opcode.
4643
4644         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
4645         since it wasn't the correct fix. 
4646
4647         It still is puzzling that we are required to use stobj for IntPtr
4648         which seems to be a ValueType.
4649
4650 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
4651
4652         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
4653         during regular simple name resolution.   Now, the trick is that
4654         instead of returning for processing the simplename, we do a
4655         TypeManager.LookupType (ie, a rooted lookup as opposed to a
4656         contextual lookup type).   If a match is found, return that, if
4657         not, return for further composition.
4658
4659         This fixes long-standing 30485.
4660
4661         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4662         using the address to initialize an object, do an Stobj instead of
4663         using the regular Stelem.
4664
4665         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
4666         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
4667         Because if we are a BaseIndexerAccess that value will be true.
4668         Fixes 43643.
4669
4670         * statement.cs (GotoCase.Resolve): Return after reporting an
4671         error, do not attempt to continue. 
4672
4673         * expression.cs (PointerArithmetic.Emit): If our operand is a
4674         long, convert our constants to match the operand before
4675         multiplying.  Convert to I type before adding.   Fixes 43670.
4676
4677 2003-05-14  Ravi Pratap  <ravi@ximian.com>
4678
4679         * enum.cs (ImplicitConversionExists) : Rename to
4680         ImplicitEnumConversionExists to remove ambiguity. 
4681
4682         * ecore.cs (NullCast): New type of cast expression class which
4683         basically is very similar to EmptyCast with the difference being
4684         it still is a constant since it is used only to cast a null to
4685         something else
4686         (eg. (string) null)
4687
4688         * convert.cs (ImplicitReferenceConversion): When casting a null
4689         literal, we return a NullCast.
4690
4691         * literal.cs (NullLiteralTyped): Remove - I don't see why this
4692         should be around anymore.
4693
4694         The renaming (reported was slightly wrong). Corrections:
4695
4696         ConvertImplicitStandard -> ImplicitConversionStandard
4697         ConvertExplicitStandard -> ExplicitConversionStandard
4698
4699         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
4700         before passing them in !
4701
4702         * convert.cs (ImplicitConversionStandard): When comparing for
4703         equal expr and target types, ensure that expr is not a
4704         NullLiteral.
4705
4706         In general, we must not be checking (expr_type ==
4707         target_type) in the top level conversion methods
4708         (ImplicitConversion, ExplicitConversion etc). This checking is
4709         done in the methods that they delegate to.
4710
4711 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
4712
4713         * convert.cs: Move Error_CannotConvertType,
4714         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
4715         ImplicitNumericConversion, ImplicitConversionExists,
4716         ImplicitUserConversionExists, StandardConversionExists,
4717         FindMostEncompassedType, FindMostSpecificSource,
4718         FindMostSpecificTarget, ImplicitUserConversion,
4719         ExplicitUserConversion, GetConversionOperators,
4720         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
4721         TryImplicitIntConversion, Error_CannotConvertImplicit,
4722         ConvertImplicitRequired, ConvertNumericExplicit,
4723         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
4724         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
4725         its own file.
4726
4727         Perform the following renames:
4728
4729         StandardConversionExists -> ImplicitStandardConversionExists
4730         ConvertImplicit -> ImplicitConversion
4731         ConvertImplicitStandard -> ImplicitStandardConversion
4732         TryImplicitIntConversion -> ImplicitIntConversion
4733         ConvertImplicitRequired -> ImplicitConversionRequired
4734         ConvertNumericExplicit -> ExplicitNumericConversion
4735         ConvertReferenceExplicit -> ExplicitReferenceConversion
4736         ConvertExplicit -> ExplicitConversion
4737         ConvertExplicitStandard -> ExplicitStandardConversion
4738
4739 2003-05-19  Martin Baulig  <martin@ximian.com>
4740
4741         * statement.cs (TypeInfo.StructInfo): Made this type protected.
4742         (TypeInfo): Added support for structs having structs as fields.
4743
4744         * ecore.cs (FieldExpr): Implement IVariable.
4745         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
4746         VariableInfo for the field.
4747
4748 2003-05-18  Martin Baulig  <martin@ximian.com>
4749
4750         * expression.cs (This.DoResolve): Report a CS0027 if we're
4751         emitting a field initializer.
4752
4753 2003-05-18  Martin Baulig  <martin@ximian.com>
4754
4755         * expression.cs (This.ResolveBase): New public function.
4756         (This.DoResolve): Check for CS0188.
4757
4758         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
4759         This.Resolve().
4760
4761         * ecore.cs (MethodGroupExpr.DoResolve): Set the
4762         `instance_expression' to null if we don't have any non-static
4763         methods.
4764
4765 2003-05-18  Martin Baulig  <martin@ximian.com>
4766
4767         Reworked the way how local variables and parameters are handled by
4768         the flow analysis code.
4769
4770         * statement.cs (TypeInfo, VariableMap): New public classes.
4771         (VariableInfo): New public class.  This is now responsible for
4772         checking whether a variable has been assigned.  It is used for
4773         parameters and local variables.
4774         (Block.EmitMeta): Take the InternalParameters as argument; compute
4775         the layout of the flow vectors here.
4776         (Block.LocalMap, Block.ParameterMap): New public properties.
4777         (FlowBranching): The .ctor doesn't get the InternalParameters
4778         anymore since Block.EmitMeta() now computes the layout of the flow
4779         vector.
4780         (MyStructInfo): This class is now known as `StructInfo' and nested
4781         in `TypeInfo'; we don't access this directly anymore.
4782
4783         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
4784         property and removed IsAssigned(), IsFieldAssigned(),
4785         SetAssigned() and SetFieldAssigned(); we now call them on the
4786         VariableInfo so we don't need to duplicate this code everywhere.
4787
4788         * expression.cs (ParameterReference): Added `Block block' argument
4789         to the .ctor.
4790         (LocalVariableReference, ParameterReference, This): The new
4791         VariableInfo class is now responsible for all the definite
4792         assignment stuff.
4793
4794         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
4795         IsParameterAssigned, SetParameterAssigned): Removed.
4796
4797 2003-05-18  Martin Baulig  <martin@ximian.com>
4798
4799         * typemanager.cs (InitCoreTypes): Try calling
4800         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
4801         the 3-args-version.  Corlib now also needs our `void_type'.
4802         (GetMethod): Added overloaded version which takes an optional
4803         `bool report_errors' to allow lookups of optional methods.
4804
4805 2003-05-12  Martin Baulig  <martin@ximian.com>
4806
4807         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
4808         only used for locals and not for parameters.
4809
4810 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
4811
4812         * support.cs (InternalParameters.ParameterType): Return the
4813         ExternalType of the parameter.
4814
4815         * parameter.cs (Parameter.ExternalType): drop the two arguments,
4816         they were unused.
4817
4818 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
4819
4820         * class.cs (MethodData.Define): Do not set the `newslot' on
4821         interface members, if they are also flagged as "override".
4822
4823         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
4824         better code for ++i and i++.  This only works for static fields
4825         and local variables.
4826
4827         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
4828         want to pull the DeclSpace out of the builder_to_declspace instead
4829         of the TypeBuilder (like in TypeContainer.FindMembers).
4830
4831         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
4832         instead of LookupTypeContainer.  Fixes the crash on .NET for
4833         looking up interface members.
4834
4835         * const.cs: Create our own emit context during the Definition
4836         stage, so that constants are evaluated in the proper context, when
4837         a recursive definition happens.
4838
4839 2003-05-11  Martin Baulig  <martin@ximian.com>
4840
4841         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
4842         new block for a switch section.
4843         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
4844         the adding/lookup in the switch block.  Fixes #39828.
4845
4846 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
4847
4848         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
4849         functionality: I needed to convert the data after I had performed
4850         the add/sub operation into the operands type size.
4851
4852         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
4853         pass the type for the box operation, otherwise the resulting
4854         object would have been of type object.
4855
4856         (BoxedCast): Add constructor to specify the type to box as.
4857
4858 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
4859
4860         * iterators.cs: I was reusing the `count' variable inadvertently,
4861         take steps to not allow this to happen.
4862
4863 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
4864
4865         * attribute.cs (Attribute.Resolve): Params attributes are encoded
4866         by creating an array at the point where the params starts and
4867         putting all those arguments there, then adjusting the size of the
4868         array.
4869
4870 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
4871
4872         * expression.cs (New.AddressOf): Implement interface
4873         IMemoryLocation.  This is used when the `new' operator is used in
4874         the context of an invocation to a method on a value type.
4875
4876         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
4877         example. 
4878
4879         * namespace.cs: Also check the using aliases here.
4880
4881         * driver.cs: Move the test for using validity after the types have
4882         been entered, so we do a single pass that also includes the using
4883         aliases. 
4884
4885         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
4886         in the regular case.   CreateSiblingForFinally is doing extra
4887         error checking.
4888
4889         * attribute.cs (GetAttributeArgumentExpression): Store the result
4890         on an out value, and use the return value to indicate failure
4891         instead of using null (which is a valid return for Constant.GetValue).
4892
4893         * statement.cs: Perform the analysis flow for the increment
4894         portion after the statement, because this will be the real flow of
4895         execution.  Fixes #42385
4896
4897         * codegen.cs (EmitContext.EmitArgument,
4898         EmitContext.EmitStoreArgument): New helper functions when the
4899         RemapToProxy flag is set.
4900
4901         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
4902         function.
4903
4904         Add support for remapping parameters. 
4905
4906         * iterators.cs: Propagate parameter values;  Store parameter
4907         values in the proxy classes.
4908
4909 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
4910
4911         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
4912         need a proxy reference;  I do not know what I was thinking
4913
4914         * cs-parser.jay (constructor_initializer): catch another error,
4915         and display nice message.
4916
4917         (field_declaration): catch void field declaration
4918         to flag a better error. 
4919
4920         * class.cs (MemberBase.CheckBase): Report an error instead of a
4921         warning if a new protected member is declared in a struct. 
4922         (Field.Define): catch the error of readonly/volatile.
4923
4924         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
4925
4926         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
4927         volatile variable is taken
4928
4929 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
4930
4931         * statement.cs (Fixed.Resolve): Report an error if we are not in
4932         an unsafe context.
4933
4934 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
4935
4936         * typemanager.cs: reuse the code that handles type clashes for
4937         delegates and enumerations.
4938
4939         * class.cs (Report28): Always report.
4940
4941         * expression.cs (EncodeAsAttribute): Allow nulls here.
4942
4943 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
4944
4945         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
4946         the functionality for testing whether an expression is valid for
4947         an attribute here.  Also handle the case of arrays of elements
4948         being stored. 
4949
4950         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
4951         encoding a linear array into an array of objects that are suitable
4952         to be passed to an CustomAttributeBuilder.
4953
4954         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
4955
4956         * ecore.cs: (FieldExpr): Handle field remapping here.
4957
4958         * iteratators.cs: Pass the instance variable (if the method is an
4959         instance method) to the constructors, so we can access the field
4960         variables on the class.
4961
4962         TODO: Test this with structs.  I think the THIS variable on
4963         structs might have to be a pointer, and not a refenrece
4964
4965 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
4966
4967         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
4968         local variables to fields in a proxy class.
4969
4970         * iterators.cs (PopulateProxy): Rename our internal fields to
4971         <XXX>.  
4972         Create a <THIS> field if we are an instance method, so we can
4973         reference our parent container variables.
4974         (MapVariable): Called back from the EmitContext code to enter a
4975         new variable to field mapping into the proxy class (we just create
4976         a FieldBuilder).
4977
4978         * expression.cs
4979         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
4980         for using the remapped locals to fields.
4981
4982         I placed the code here, because that gives the same semantics to
4983         local variables, and only changes the Emit code.
4984
4985         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
4986         statements inside iterators.
4987         (VariableInfo): Add a FieldBuilder for the cases when we are
4988         remapping local variables to fields in a proxy class
4989
4990         * ecore.cs (SimpleNameResolve): Avoid testing two times for
4991         current_block != null.
4992
4993         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
4994         not cope with strings, as it has been moved to the
4995         TableSwitchEmit.  Fixed bug in switch generation.
4996
4997         * expression.cs (New.DoResolve): Provide more context for the user
4998         when reporting an error.
4999
5000         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
5001         pointers. 
5002
5003         * expression.cs (MemberAccess.DoResolve): When we get a type back,
5004         check the permissions for it.  Note than in a type-resolution
5005         context the check was already present in DeclSpace.ResolveType,
5006         but was missing from the MemberAccess.
5007
5008         (ArrayCreation.CheckIndices): warn if the user has
5009         more nested levels of expressions, but there are no more
5010         dimensions specified.  Avoids crash on bug 41906.
5011
5012 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
5013
5014         * statement.cs (Block): replace Implicit bool, for a generic
5015         flags.   
5016         New flag: `Unchecked'.  This is used during the EmitMeta phase
5017         (which is out-of-line with the regular Resolve/Emit process for a
5018         statement, as this is done ahead of time, but still gets a chance
5019         to call constant resolve).
5020
5021         (Block.Flags): new enum for adding a new flag.
5022
5023         (Block.EmitMeta): track the state of unchecked.
5024
5025         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
5026         to enable constant resolution to work there as well.
5027
5028 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
5029
5030         * typemanager.cs (ienumerable_type): Also look up
5031         System.Collections.IEnumerable. 
5032
5033 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
5034
5035         TODO: Test more than one conditional per method.
5036
5037         * class.cs (Indexer.Define): Report the location where the user is
5038         referencing the unsupported feature.
5039
5040         (MethodData): Overload the use of `conditionals' to
5041         minimize the creation of needless ArrayLists.   This saves roughly
5042         212kb on my machine.
5043
5044         (Method): Implement the new IIteratorContainer interface.
5045         (Method.SetYields): Implement the method by setting the ModFlags
5046         to contain METHOD_YIELDS.
5047
5048         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
5049         which just got set to null.
5050
5051         * iterators.cs: New file.
5052
5053         (Yield, YieldBreak): New statements.
5054
5055         * statement.cs (Return.Resolve): Flag an error if we are used in
5056         an iterator method.
5057
5058         * codegen.cs (InIterator): New flag set if the code is being
5059         compiled in an iterator method.
5060
5061         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
5062         internal modifier, and we just use it to avoid adding extra
5063         fields, as this is seldom used.  
5064
5065         * cs-parser.jay: Add yield_statement (yield and yield break).
5066
5067         * driver.cs: New flag -v2 to turn on version 2 features. 
5068
5069         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
5070         hashtable when v2 is enabled.
5071
5072 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
5073
5074         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
5075         there is already a namespace defined with this name.
5076
5077         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
5078         people upgraded their corlibs.
5079
5080         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
5081         always use fully qualified types, no need to use the compiler
5082         front end.
5083
5084         (TypeManager.IsNamespace): Use binarysearch.
5085
5086         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
5087         AddDelegate): I did not quite use the new IsValid API properly: I
5088         have to pass the short-name and the fullname.  I was passing only
5089         the basename instead of the fullname sometimes. 
5090
5091         (TypeContainer.DefineType): call NamespaceClash.
5092
5093         * interface.cs (Interface.DefineType): use NamespaceClash before
5094         defining the type.
5095
5096         * delegate.cs (Delegate.DefineType): use NamespaceClash before
5097         defining the type.
5098
5099         * enum.cs: (Enum.DefineType): use NamespaceClash before
5100         defining the type.
5101
5102         * typemanager.cs (: 3-line patch that gives us some tasty 11%
5103         speed increase.  First, use the negative_hits cache when we get a
5104         negative.  Second, add the type with its full original name
5105         instead of the new . and + encoded name (reflection uses + to
5106         separate type from a nested type).  Use LookupTypeReflection
5107         directly which bypasses the type->name hashtable (that we already
5108         know does not contain the type.
5109
5110         * decl.cs (DeclSpace.ResolveTypeExpr): track the
5111         location/container type. 
5112
5113         * driver.cs: When passing utf8, use directly the UTF8Encoding.
5114
5115 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
5116
5117         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
5118
5119         * delegate.cs (NewDelegate.Resolve): Test whether an instance
5120         method is being referenced in the method group from a static
5121         context, and report error 120 if so.
5122
5123         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
5124         Error118. 
5125
5126         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
5127         is created, we create the A namespace).
5128
5129         * cs-parser.jay: A namespace also introduces a DeclarationFound.
5130         Fixes #41591
5131
5132 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
5133
5134         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
5135         invocation to ModuleBuilder.GetType with the same values will
5136         return a new type instance, so we need to cache its return
5137         values. 
5138
5139         * expression.cs (Binary.ResolveOperator): Only allow the compare
5140         operators on enums if they are of the same type.
5141
5142         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
5143         types of ValueType on their own case.  Before we were giving them
5144         the same treatment as objects.
5145
5146         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
5147         fullname.  Short name is used to compare against container name.
5148         Fullname is used to check against defined namespace names.
5149
5150         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
5151         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
5152
5153         (Method.CheckBase): Call parent.
5154         (MemberBase.CheckBase): Check for protected members on sealed
5155         classes.
5156         (PropertyBase.CheckBase): Call parent.
5157         (Field.Define): Call parent.
5158
5159         * report.cs: Negative error codes are now mapped to 8000 - code,
5160         so that the display is render more nicely.
5161
5162         * typemanager.cs: Do not use try/catch, instead report a regular
5163         error. 
5164
5165         (GetPointerType, GetReferenceType): These methods provide
5166         mechanisms to obtain the T* and T& from a T.  We had the code
5167         previously scattered around the code base, and it also used
5168         TypeManager.LookupType that would go through plenty of caches.
5169         This one goes directly to the type source.
5170
5171         In some places we did the Type.GetType followed by
5172         ModuleBuilder.GetType, but not in others, so this unifies the
5173         processing as well.
5174
5175         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
5176         statements now that we have namespace information.
5177
5178         * typemanager.cs (IsNamespace): New method, returns whether the
5179         string presented is a namespace or not.
5180
5181         (ComputeNamespaces): New public entry point, computes the list of
5182         available namespaces, using the GetNamespaces API call in Mono, or
5183         the slower version in MS.NET.   
5184
5185         Now before we start the semantic analysis phase, we have a
5186         complete list of namespaces including everything that the user has
5187         provided.
5188
5189         Deleted old code to cache namespaces in .nsc files.
5190
5191 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
5192
5193         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
5194         class/struct location definition Location for the implicit
5195         constructor location.
5196
5197         (Operator.Define): Use the location of the operator for the
5198         implicit Method definition.
5199
5200         (Constructor.Emit): use the constructor location for the implicit
5201         base initializer constructor.
5202
5203         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
5204         and the Expression class now contains two new methods:
5205
5206         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
5207         isolate type lookup from the rest of the resolution process.
5208
5209         Since we use Expressions to hold type definitions due to the way
5210         we parse the input we have historically overloaded Resolve to
5211         perform the Type lookups if a special flag is passed.  Now this is
5212         eliminated and two methods take their place. 
5213
5214         The differences in the two methods between xStep and xTerminal is
5215         that xStep is involved in our current lookup system that uses
5216         SimpleNames to compose a name, while xTerminal is used just to
5217         catch the case where the simplename lookup failed.
5218
5219 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
5220
5221         * expression.cs (ResolveMemberAccess): Remove redundant code.
5222         TypeExpr expressions are always born fully resolved.
5223
5224         * interface.cs (PopulateMethod): Do not lookup the types twice.
5225         We were doing it once during SemanticAnalysis and once during
5226         PopulateMethod.
5227
5228         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
5229         in local variable type definitions, were being returned as a
5230         SimpleName (we decomposed everything into a string), that is
5231         because primary_expression was being used instead of a type in the
5232         grammar (reduce/reduce conflicts).
5233
5234         The part that was wrong is that we converted the expression into a
5235         string (an oversimplification in one hand, compounded with primary
5236         expressions doing string concatenation).
5237
5238         So things like:
5239
5240         A.B.C [] x;
5241
5242         Would return "A.B.C[]" as a SimpleName.  This stopped things like
5243         using clauses from working on this particular context.  And a type
5244         was being matched directly against "A.B.C[]".
5245
5246         We now use the correct approach, and allow for ComposedCast to be
5247         part of the unary expression.  So the "A.B.C []" become a composed
5248         cast of "A.B.C" (as a nested group of MemberAccess with a
5249         SimpleName at the end) plus the rank composition "[]". 
5250
5251         Also fixes 35567
5252
5253 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
5254
5255         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
5256         for the access level checking.
5257
5258         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
5259         `TypeContainer container', because I kept getting confused when I
5260         was debugging this code.
5261
5262         * expression.cs (Indexers): Instead of tracking getters/setters,
5263         we now track them in parallel.  We create one arraylist less, but
5264         most importantly it is possible now for the LValue code to find a
5265         matching get for a set.
5266
5267         (IndexerAccess.DoResolveLValue): Update the code.
5268         GetIndexersForType has been modified already to extract all the
5269         indexers from a type.  The code assumed it did not.
5270
5271         Also make the code set the correct return type for the indexer.
5272         This was fixed a long time ago for properties, but was missing for
5273         indexers.  It used to be void_type.
5274
5275         (Binary.Emit): Test first for doubles instead of
5276         floats, as they are more common.
5277
5278         (Binary.EmitBranchable): Use the .un version of the branch opcodes
5279         when dealing with floats and the <=, >= operators.  This fixes bug
5280         #39314 
5281
5282         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
5283         to load the array value by emitting a load on the foreach variable
5284         type.  This was incorrect.  
5285
5286         We now emit the code to load an element using the the array
5287         variable type, and then we emit the conversion operator.
5288
5289         Fixed #40176
5290
5291 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
5292
5293         * attribute.cs: Avoid allocation of ArrayLists in the common case.
5294
5295 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
5296
5297         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
5298         test for protection before we test for signatures. 
5299
5300         (MethodSignature.ToString): implement.
5301
5302         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
5303         to the case where we reduced into a LongConstant.
5304
5305         * decl.cs (CheckAccessLevel): If the type is an array, we can not
5306         depend on whether the information is acurrate, because the
5307         Microsoft runtime will always claim that the array type is public,
5308         regardless of the real state.
5309
5310         If the type is a pointer, another problem happens: the type is
5311         reported as non-public in Microsoft.  
5312
5313         In both cases we have to call CheckAccessLevel recursively with
5314         the underlying type as the argument to be tested.
5315
5316 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
5317
5318         * assign.cs (Assign.Emit): If we are dealing with a compound
5319         assignment expression, we should use the code path that stores the
5320         intermediate result in a temporary value.  This fixes #40903.
5321
5322         *expression.cs (Indirection.ToString): Provide ToString method for
5323         debugging. 
5324
5325 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
5326
5327         * class.cs: Null out fields holding references to Block objects so
5328         they can be garbage collected.
5329
5330         * expression.cs (OverloadResolve): Remove unused local.
5331
5332 2003-04-07  Martin Baulig  <martin@ximian.com>
5333
5334         * codegen.cs (EmitContext.CurrentFile): New public field.
5335         (EmitContext.Mark): Use the CurrentFile to check whether the
5336         location is in the correct file.
5337         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
5338
5339 2003-04-07  Martin Baulig  <martin@ximian.com>
5340
5341         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
5342
5343         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
5344         location.  [FIXME: The location argument which gets passed to this
5345         method is sometimes wrong!]
5346
5347 2003-04-07  Nick Drochak <ndrochak@gol.com>
5348
5349         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
5350
5351 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
5352
5353         * expression.cs (Indirection.EmitAssign): We were using the
5354         temporary, but returning immediately instead of continuing the
5355         EmitAssing flow.
5356
5357 2003-04-06  Martin Baulig  <martin@ximian.com>
5358
5359         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
5360         if it's a nested child, but also deriving from the outer class.
5361         See test 190.cs.
5362
5363         * typemanager.cs (IsNestedChildOf): Make this work if it's a
5364         nested child, but also deriving from the outer class.  See
5365         test-190.cs.
5366         (FilterWithClosure): We may access private members of the outer
5367         class if we're a nested child and deriving from the outer class.
5368         (RealMemberLookup): Only set `closure_private_ok' if the
5369         `original_bf' contained BindingFlags.NonPublic.
5370
5371 2003-04-05  Martin Baulig  <martin@ximian.com>
5372
5373         * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
5374         probe if its a type parameter, and if so, flag an error.
5375
5376         * decl.cs: Move here the SetParameterInfo code from class.cs.
5377         Handle IsGeneric here.
5378
5379         Handle a variety of errors in the parameter info definition.
5380
5381         * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
5382         type parameters here.
5383
5384         * cs-parser.jay (class_declaration): report errors for parameters
5385         here as well.
5386
5387 2003-01-21  Miguel de Icaza  <miguel@ximian.com>
5388
5389         * generic.cs: New file, contains support code for generics.
5390
5391         * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
5392         OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
5393
5394         Update parser for the above removals.
5395
5396         * cs-tokenizer.cs: Do not handle <<= or >>= specially.  This is
5397         now taken care of in the parser.
5398
5399 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
5400
5401         * class.cs (Event.Define): Do not allow abstract events to have
5402         initializers. 
5403
5404 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
5405
5406         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
5407         block in event declarations.
5408
5409         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
5410         value type, get its address.
5411
5412         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
5413         leaving a class on the stack instead of a boolean value (int
5414         0/1).  Change the code so we compare against null, and then the
5415         result against zero.
5416
5417         * class.cs (TypeContainer.GetClassBases): We were checking for the
5418         parent class being sealed too late.
5419
5420         * expression.cs (Binary.Emit): For <= and >= when dealing with
5421         floating point values, use cgt.un and clt.un instead of cgt and
5422         clt alone.
5423
5424 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
5425
5426         * statement.cs: Apply the same optimization as MS: skip the 
5427         GetEnumerator returning an IEnumerator, and use the one returning a 
5428         CharEnumerator instead. This allows us to avoid the try-finally block 
5429         and the boxing.
5430
5431 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
5432
5433         * cs-parser.jay: Attributes cannot be applied to
5434                          namespaces. Fixes #40473
5435
5436 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5437
5438         * class.cs:
5439         (Add*): check if the name is valid using the full name for constants,
5440         fields, properties and events.
5441
5442 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
5443
5444         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
5445         char constants to be part of the enumeration.
5446
5447         * expression.cs (Conditional.DoResolve): Add support for operator
5448         true. Implements the missing functionality from 14.12
5449
5450         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
5451         operator true/false as required by the spec.
5452
5453         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
5454         implicit conversion to boolean.
5455
5456         * statement.cs (Statement.ResolveBoolean): A boolean expression is
5457         also one where the type implements `operator true'. 
5458
5459         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
5460         get an expression that will invoke operator true based on an
5461         expression.  
5462
5463         (GetConversionOperators): Removed the hack that called op_True
5464         here.  
5465
5466         (Expression.ResolveBoolean): Move this from Statement.
5467
5468 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
5469
5470         * ecore.cs (FieldExpr): do not allow initialization of initonly
5471         fields on derived classes
5472
5473 2003-03-13  Martin Baulig  <martin@ximian.com>
5474
5475         * statement.cs (Block.Emit): Call ig.BeginScope() and
5476         ig.EndScope() when compiling with debugging info; call
5477         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
5478
5479 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
5480
5481         * expression.cs (Indexers): Do not construct immediately, allow
5482         for new members to be appended as we go.  Fixes 38143
5483
5484 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5485
5486         * expression.cs: save/restore context when resolving an unchecked
5487         expression.
5488
5489 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
5490
5491         * cfold.cs: Catch division by zero in modulus operator during
5492         constant folding.
5493
5494 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
5495
5496         * interface.cs (Interface.DefineMembers): Avoid defining members
5497         twice. 
5498
5499 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
5500
5501         * driver.cs: handle the +/- options for -noconfig
5502
5503         * statement.cs (Unckeched.Resolve): Also track the state of
5504         unchecked in the Resolve phase.
5505
5506 2003-02-27  Martin Baulig  <martin@ximian.com>
5507
5508         * ecore.cs (Expression.MemberLookup): Don't create a
5509         MethodGroupExpr for something which is not a method.  Fixes #38291.
5510
5511 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
5512
5513         * class.cs (MemberBase.CheckParameters): Also check that the type
5514         is unmanaged if it is a pointer.
5515
5516         * expression.cs (SizeOf.Resolve): Add location information.
5517
5518         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
5519         a managed type is declared.
5520
5521         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
5522         parameter modifiers as well.  Fixes bug 38606
5523
5524         * class.cs: Very sad.  Am backing out the speed up changes
5525         introduced by the ArrayList -> Array in the TypeContainer, as they
5526         were not actually that much faster, and introduced a bug (no error
5527         reports on duplicated methods).
5528
5529         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
5530         source first, this will guarantee that we have a valid expression
5531         before calling in lower levels functions that will require a
5532         resolved object.  Then use this original_source in the
5533         target.ResolveLValue instead of the original source that was
5534         passed to us.
5535
5536         Another change.  Use target.Resolve instead of LValueResolve.
5537         Although we are resolving for LValues, we will let the Assign code
5538         take care of that (it will be called again from Resolve).  This
5539         basically allows code like this:
5540
5541         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
5542         class Y { void A (X x) { x [0] += o; }
5543
5544         The problem was that the indexer was trying to resolve for
5545         set_Item (idx, object o) and never finding one.  The real set_Item
5546         was set_Item (idx, X).  By delaying the process we get the right
5547         semantics. 
5548
5549         Fixes bug 36505
5550
5551 2003-02-23  Martin Baulig  <martin@ximian.com>
5552
5553         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
5554         while calling DoEmit ().
5555
5556         * codegen.cs (EmitContext.Mark): Don't mark locations in other
5557         source files; if you use the #line directive inside a method, the
5558         compiler stops emitting line numbers for the debugger until it
5559         reaches the end of the method or another #line directive which
5560         restores the original file.
5561
5562 2003-02-23  Martin Baulig  <martin@ximian.com>
5563
5564         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
5565
5566 2003-02-23  Martin Baulig  <martin@ximian.com>
5567
5568         * statement.cs (Block.AddChildVariableNames): We need to call this
5569         recursively, not just for our immediate children.
5570
5571 2003-02-23  Martin Baulig  <martin@ximian.com>
5572
5573         * class.cs (Event.Define): Always make the field private, like csc does.
5574
5575         * typemanager.cs (TypeManager.RealMemberLookup): Make events
5576         actually work, fixes bug #37521.
5577
5578 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
5579
5580         * delegate.cs: When creating the various temporary "Parameters"
5581         classes, make sure that we call the ComputeAndDefineParameterTypes
5582         on those new parameters (just like we do with the formal ones), to
5583         allow them to be resolved in the context of the DeclSpace.
5584
5585         This fixes the bug that Dick observed in Bugzilla #38530.
5586
5587 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
5588
5589         * expression.cs (ResolveMemberAccess): When resolving a constant,
5590         do not attempt to pull a constant if the value was not able to
5591         generate a valid constant.
5592
5593         * const.cs (LookupConstantValue): Do not report more errors than required.
5594
5595 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5596
5597         * expression.cs: fixes bug #38328.
5598
5599 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
5600
5601         * class.cs: Changed all the various members that can be part of a
5602         class from being an ArrayList to be an Array of the right type.
5603         During the DefineType type_list, interface_list, delegate_list and
5604         enum_list are turned into types, interfaces, delegates and enums
5605         arrays.  
5606
5607         And during the member population, indexer_list, event_list,
5608         constant_list, field_list, instance_constructor_list, method_list,
5609         operator_list and property_list are turned into their real arrays.
5610
5611         Although we could probably perform this operation earlier, for
5612         good error reporting we need to keep the lists and remove the
5613         lists for longer than required.
5614
5615         This optimization was triggered by Paolo profiling the compiler
5616         speed on the output of `gen-sample-program.pl' perl script. 
5617
5618         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
5619         not crash in methods like MemberLookupFailed that use this field.  
5620
5621         This problem arises when the compiler fails to resolve a type
5622         during interface type definition for example.
5623
5624 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
5625
5626         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
5627         inherit from System.Object, so we have to stop at null, not only
5628         when reaching System.Object.
5629
5630 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
5631
5632         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
5633         DeclaredOnly because the parent indexer might have had a different
5634         name, but did not loop until the top of the hierarchy was reached.
5635
5636         The problem this one fixes is 35492: when a class implemented an
5637         indexer from an interface, we were getting the interface method
5638         (which was abstract) and we were flagging an error (can not invoke
5639         abstract method).
5640
5641         This also keeps bug 33089 functioning, and test-148 functioning.
5642
5643         * typemanager.cs (IsSpecialMethod): The correct way of figuring
5644         out if a method is special is to see if it is declared in a
5645         property or event, or whether it is one of the predefined operator
5646         names.   This should fix correctly #36804.
5647
5648 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
5649
5650         The goal here is to remove the dependency on EmptyCast.Peel ().
5651         Killing it completely.
5652
5653         The problem is that currently in a number of places where
5654         constants are expected, we have to "probe" for an EmptyCast, and
5655         Peel, which is not the correct thing to do, as this will be
5656         repetitive and will likely lead to errors. 
5657
5658         The idea is to remove any EmptyCasts that are used in casts that
5659         can be reduced to constants, so we only have to cope with
5660         constants. 
5661
5662         This bug hunt was triggered by Bug 37363 and the desire to remove
5663         the duplicate pattern where we were "peeling" emptycasts to check
5664         whether they were constants.  Now constants will always be
5665         constants.
5666
5667         * ecore.cs: Use an enumconstant here instead of wrapping with
5668         EmptyCast.  
5669
5670         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
5671         throwing me off.  By handling this we can get rid of a few hacks.
5672
5673         * statement.cs (Switch): Removed Peel() code.
5674
5675 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
5676
5677         * class.cs: Location information for error 508
5678
5679         * expression.cs (New.DoResolve): Add a guard against double
5680         resolution of an expression.  
5681
5682         The New DoResolve might be called twice when initializing field
5683         expressions (see EmitFieldInitializers, the call to
5684         GetInitializerExpression will perform a resolve on the expression,
5685         and later the assign will trigger another resolution
5686
5687         This leads to bugs (#37014)
5688
5689         * delegate.cs: The signature for EndInvoke should contain any ref
5690         or out parameters as well.  We were not doing this in the past. 
5691
5692         * class.cs (Field.Define): Do not overwrite the type definition
5693         inside the `volatile' group.  Turns out that volatile enumerations
5694         were changing the type here to perform a validity test, which
5695         broke conversions. 
5696
5697 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
5698
5699         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
5700         and structs, we do not want to load the instance variable
5701
5702         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
5703         enum_type has to be handled like an object reference (implicit
5704         conversions exists from this to object), but the regular IsClass
5705         and IsValueType tests will never return true for this one.
5706
5707         Also we use TypeManager.IsValueType instead of type.IsValueType,
5708         just for consistency with the rest of the code (this is only
5709         needed if we ever use the construct exposed by test-180.cs inside
5710         corlib, which we dont today).
5711
5712 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
5713
5714         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
5715         just InternalCall.
5716
5717 2003-02-09  Martin Baulig  <martin@ximian.com>
5718
5719         * namespace.cs (Namespace..ctor): Added SourceFile argument.
5720         (Namespace.DefineNamespaces): New static public method; this is
5721         called when we're compiling with debugging to add all namespaces
5722         to the symbol file.
5723
5724         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
5725         pass it to the Namespace's .ctor.
5726
5727         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
5728         and MethodBase arguments; pass the namespace ID to the symwriter;
5729         pass the MethodBase instead of the token to the symwriter.
5730         (SymbolWriter.DefineNamespace): New method to add a namespace to
5731         the symbol file.
5732
5733 2003-02-09  Martin Baulig  <martin@ximian.com>
5734
5735         * symbolwriter.cs: New file.  This is a wrapper around
5736         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
5737         methods here in near future.
5738
5739 2003-02-09  Martin Baulig  <martin@ximian.com>
5740
5741         * codegen.cs (EmitContext.Mark): Just pass the arguments to
5742         ILGenerator.MarkSequencePoint() which are actually used by the
5743         symbol writer.
5744
5745 2003-02-09  Martin Baulig  <martin@ximian.com>
5746
5747         * location.cs (SourceFile): New public sealed class.  This
5748         contains the name and an index which is used in the location's token.
5749         (Location): Reserve an appropriate number of bits in the token for
5750         the source file instead of walking over that list, this gives us a
5751         really huge performance improvement when compiling with debugging.
5752
5753         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
5754         `SourceFile' argument instead of a string.
5755         (Driver.ProcessFile): Add all the files via Location.AddFile(),
5756         but don't parse/tokenize here, we need to generate the list of all
5757         source files before we do that.
5758         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
5759         the files.
5760
5761         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
5762         instead of a string.
5763
5764         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
5765         of a string.
5766
5767 2003-02-09  Martin Baulig  <martin@ximian.com>
5768
5769         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
5770         filename on `#line default'.
5771
5772 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
5773
5774         * statement.cs: don't clear the pinned var when the fixed statement
5775         returns from the method (fixes bug#37752).
5776
5777 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
5778
5779         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
5780         to IsValueType.
5781
5782 2003-02-07  Martin Baulig  <martin@ximian.com>
5783
5784         * driver.cs: Removed the `--debug-args' command line argument.
5785
5786         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
5787         automatically by the AsssemblyBuilder.
5788         (CodeGen.InitializeSymbolWriter): We don't need to call any
5789         initialization function on the symbol writer anymore.  This method
5790         doesn't take any arguments.
5791
5792 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
5793
5794         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
5795         from referenced assemblies as well.
5796
5797 2003-02-02  Martin Baulig  <martin@ximian.com>
5798
5799         * class.cs (MethodData.Emit): Generate debugging info for external methods.
5800
5801 2003-02-02  Martin Baulig  <martin@ximian.com>
5802
5803         * class.cs (Constructor.Emit): Open the symbol writer before
5804         emitting the constructor initializer.
5805         (ConstructorInitializer.Emit): Call ec.Mark() to allow
5806         single-stepping through constructor initializers.
5807
5808 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
5809
5810         * class.cs: Handle error 549: do not allow virtual methods in
5811         sealed classes. 
5812
5813 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
5814
5815         * decl.cs: Check access levels when resolving types
5816
5817 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
5818
5819         * statement.cs: Add parameters and locals set in catch blocks that might 
5820         return to set vector
5821
5822 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
5823
5824         * class.cs (Operator): Set the SpecialName flags for operators.
5825
5826         * expression.cs (Invocation.DoResolve): Only block calls to
5827         accessors and operators on SpecialName methods.
5828
5829         (Cast.TryReduce): Handle conversions from char constants.
5830
5831
5832 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
5833
5834         * statement.cs: small memory and time optimization in FlowBranching.
5835
5836 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
5837
5838         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
5839         problem that the last fix but in the other sid (Set).
5840
5841         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
5842         access when there is no indexer in the hierarchy.
5843
5844 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
5845
5846         * class.cs: Combine some if statements.
5847
5848 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5849
5850         * driver.cs: fixed bug #37187.
5851
5852 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
5853
5854         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
5855         any indexer, it's needed to build a list with all the indexers in the
5856         hierarchy (AllGetters), else we have problems. Fixes #35653.
5857
5858 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
5859
5860         * class.cs (MethodData.Define): It is wrong for an interface
5861         implementation to be static in both cases: explicit and implicit.
5862         We were only handling this in one case.
5863
5864         Improve the if situation there to not have negations.
5865
5866         * class.cs (Field.Define): Turns out that we do not need to check
5867         the unsafe bit on field definition, only on usage.  Remove the test.
5868
5869 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5870
5871         * driver.cs: use assembly.Location instead of Codebase (the latest
5872         patch made mcs fail when using MS assemblies).
5873
5874 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
5875
5876         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
5877         get the path to *corlib.dll.
5878
5879 2003-01-21  Nick Drochak <ndrochak@gol.com>
5880
5881         * cs-tokenizer.cs:
5882         * pending.cs:
5883         * typemanager.cs: Remove compiler warnings
5884
5885 2003-01-20  Duncan Mak  <duncan@ximian.com>
5886
5887         * AssemblyInfo.cs: Bump the version number to 0.19.
5888
5889 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5890
5891         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
5892
5893 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
5894
5895         * class.cs (Constructor::Emit): Emit debugging info for constructors.
5896
5897 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
5898
5899         * cs-parser.jay: Small fix: we were not comparing the constructor
5900         name correctly.   Thanks to Zoltan for the initial pointer.
5901
5902 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
5903
5904         * cs-tokenizer.cs: Set file name when specified with #line
5905
5906 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
5907
5908         * cs-parser.jay: Only perform the constructor checks here if we
5909         are named like the class;  This will help provider a better
5910         error.  The constructor path is taken when a type definition is
5911         not found, but most likely the user forgot to add the type, so
5912         report that rather than the constructor error.
5913
5914 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
5915
5916         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
5917         allocations.
5918
5919 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
5920
5921         * cs-parser.jay: Add cleanup call.
5922
5923 2003-01-13  Duncan Mak  <duncan@ximian.com>
5924
5925         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
5926         consistent with other methods.
5927
5928 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
5929
5930         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
5931
5932 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
5933
5934         * attribute.cs: only set GuidAttr to true when we have a
5935         GuidAttribute.
5936
5937 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5938
5939         * ecore.cs:
5940         * expression.cs:
5941         * typemanager.cs: fixes to allow mcs compile corlib with the new
5942         Type.IsSubclassOf fix.
5943
5944 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
5945
5946         * expression.cs (LocalVariableReference.DoResolve): Classify a
5947         constant as a value, not as a variable.   Also, set the type for
5948         the variable.
5949
5950         * cs-parser.jay (fixed_statement): take a type instead of a
5951         pointer_type, so we can produce a better error message later.
5952
5953         * statement.cs (Fixed.Resolve): Flag types that are not pointers
5954         as an error.  
5955
5956         (For.DoEmit): Make inifinite loops have a
5957         non-conditional branch back.
5958
5959         (Fixed.DoEmit): First populate the pinned variables, then emit the
5960         statement, then clear the variables.  Before I was emitting the
5961         code once for each fixed piece.
5962
5963
5964 2003-01-08  Martin Baulig  <martin@ximian.com>
5965
5966         * statement.cs (FlowBranching.MergeChild): A break in a
5967         SWITCH_SECTION does not leave a loop.  Fixes #36155.
5968
5969 2003-01-08  Martin Baulig  <martin@ximian.com>
5970
5971         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
5972         lives in the same number space than `param_map'.  Fixes #36154.
5973
5974 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
5975
5976         * cs-parser.jay (constructor_declaration): Set the
5977         Constructor.ModFlags before probing for it.  This makes the
5978         compiler report 514, 515 and 132 (the code was there, but got
5979         broken). 
5980
5981         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
5982         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
5983         (GotoCase.Resolve): Set `Returns' to ALWAYS.
5984
5985 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
5986
5987         * enum.cs: create the enum static fields using the enum type.
5988
5989 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
5990
5991         * class.cs: don't try to create the ParamBuilder for the return
5992         type if it's not needed (and handle it breaking for the ms runtime
5993         anyway).
5994
5995 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
5996
5997         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
5998
5999 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
6000
6001         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
6002         the command.   This showed up while compiling the JANET source
6003         code, which used \r as its only newline separator.
6004
6005 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
6006
6007         * class.cs (Method.Define): If we are an operator (because it
6008         reuses our code), then set the SpecialName and HideBySig.  #36128
6009
6010 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
6011
6012         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
6013         exception, report error 120 `object reference required'.
6014
6015         * driver.cs: Add --pause option, used during to measure the size
6016         of the process as it goes with --timestamp.
6017
6018         * expression.cs (Invocation.DoResolve): Do not allow methods with
6019         SpecialName to be invoked.
6020
6021 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
6022
6023         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
6024         number before adding it.
6025
6026 2002-12-21  Ravi Pratap  <ravi@ximian.com>
6027
6028         * ecore.cs (StandardImplicitConversion): When in an unsafe
6029         context, we allow conversion between void * to any other pointer
6030         type. This fixes bug #35973.
6031
6032 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
6033
6034         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
6035         is not thrown when extensionless outputs are used 
6036
6037 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6038
6039         * rootcontext.cs: fixed compilation of corlib.
6040
6041 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
6042
6043         * attribute.cs (Attributes.Contains): Add new method.
6044
6045         * class.cs (MethodCore.LabelParameters): if the parameter is an
6046         `out' parameter, check that no attribute `[In]' has been passed.
6047
6048         * enum.cs: Handle the `value__' name in an enumeration.
6049
6050 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
6051
6052         * decl.cs: Added special case to allow overrides on "protected
6053         internal" methods
6054
6055 2002-12-18  Ravi Pratap  <ravi@ximian.com>
6056
6057         * attribute.cs (Attributes.AddAttributeSection): Rename to this
6058         since it makes much more sense.
6059
6060         (Attributes.ctor): Don't require a Location parameter.
6061
6062         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
6063
6064         * attribute.cs (ApplyAttributes): Remove extra Location parameters
6065         since we already have that information per attribute.
6066
6067         * everywhere : make appropriate changes.
6068
6069         * class.cs (LabelParameters): Write the code which actually
6070         applies attributes to the return type. We can't do this on the MS
6071         .NET runtime so we flag a warning in the case an exception is
6072         thrown.
6073
6074 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
6075
6076         * const.cs: Handle implicit null conversions here too.
6077
6078 2002-12-17  Ravi Pratap  <ravi@ximian.com>
6079
6080         * class.cs (MethodCore.LabelParameters): Remove the extra
6081         Type [] parameter since it is completely unnecessary. Instead
6082         pass in the method's attributes so that we can extract
6083         the "return" attribute.
6084
6085 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
6086
6087         * cs-parser.jay (parse): Use Report.Error to flag errors instead
6088         of ignoring it and letting the compile continue.
6089
6090         * typemanager.cs (ChangeType): use an extra argument to return an
6091         error condition instead of throwing an exception.
6092
6093 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
6094
6095         * expression.cs (Unary.TryReduce): mimic the code for the regular
6096         code path.  Perform an implicit cast in the cases where we can
6097         implicitly convert to one of the integral types, and then reduce
6098         based on that constant.   This fixes bug #35483.
6099
6100 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6101
6102         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
6103
6104 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6105
6106         * namespace.cs: fixed bug #35489.
6107
6108 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
6109
6110         * class.cs: Remove some dead code.
6111
6112         * cs-parser.jay: Estimate the number of methods needed
6113         (RootContext.MethodCount);
6114
6115         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
6116         numbers instead of StringBuilders.
6117
6118         * support.cs (PtrHashtable): Add constructor with initial size;
6119         We can now reduce reallocations of the method table.
6120
6121 2002-12-10  Ravi Pratap  <ravi@ximian.com>
6122
6123         * attribute.cs (ApplyAttributes): Keep track of the emitted
6124         attributes on a per-target basis. This fixes bug #35413.
6125
6126 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
6127
6128         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
6129         default to the Windows 1252 encoding.
6130
6131         (UnixParseOption): Support version, thanks to Alp for the missing
6132         pointer. 
6133
6134         * AssemblyInfo.cs: Add nice assembly information.
6135
6136         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
6137         (bug 35169).
6138
6139         * cs-parser.jay: Allow a trailing comma before the close bracked
6140         in the attribute_section production.
6141
6142         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
6143         address of the instance was being taken, I will take this out,
6144         because we take the address of the object immediately here.
6145
6146 2002-12-09  Ravi Pratap  <ravi@ximian.com>
6147
6148         * typemanager.cs (AreMultipleAllowed): Take care of the most
6149         obvious case where attribute type is not in the current assembly -
6150         stupid me ;-)
6151
6152 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
6153
6154         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
6155         definitions, instead of doing that afterwards.  
6156
6157         Also we use a nice little hack, depending on the constructor, we
6158         know if we are a "composed" name or a simple name.  Hence, we
6159         avoid the IndexOf test, and we avoid 
6160
6161         * codegen.cs: Add code to assist in a bug reporter to track down
6162         the source of a compiler crash. 
6163
6164 2002-12-07  Ravi Pratap  <ravi@ximian.com>
6165
6166         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
6167         types have been emitted for a given element and flag an error
6168         if something which does not have AllowMultiple set is used more
6169         than once.
6170
6171         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
6172         attribute types and their corresponding AllowMultiple properties
6173
6174         (AreMultipleAllowed): Check the property for a given type.
6175
6176         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
6177         property in the case we have a TypeContainer.
6178
6179         (Attributes.AddAttribute): Detect duplicates and just skip on
6180         adding them. This trivial fix catches a pretty gross error in our
6181         attribute emission - global attributes were being emitted twice!
6182
6183         Bugzilla bug #33187 is now fixed.
6184
6185 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
6186
6187         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
6188         instead of pp_and).
6189
6190         * expression.cs (Binary.ResolveOperator): I can only use the
6191         Concat (string, string, string) and Concat (string, string,
6192         string, string) if the child is actually a concatenation of
6193         strings. 
6194
6195 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
6196
6197         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
6198         context where we need a 2-character lookahead.
6199
6200         * pending.cs (PendingImplementation): Rework so we can keep track
6201         of interface types all the time, and flag those which were
6202         implemented by parents as optional.
6203
6204 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
6205
6206         * expression.cs (Binary.ResolveOperator): Use
6207         String.Concat(string,string,string) or
6208         String.Concat(string,string,string,string) when possible. 
6209
6210         * typemanager: More helper methods.
6211
6212
6213 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
6214
6215         * pending.cs: remove the bogus return from GetMissingInterfaces()
6216         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
6217
6218 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6219
6220         * namespace.cs: avoid duplicated 'using xxx' being added to
6221         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
6222         when we get more than one 'using' statement for the same namespace.
6223         Report a CS0105 warning for it.
6224
6225 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
6226
6227         * cs-tokenizer.cs (consume_identifier): use read directly, instead
6228         of calling getChar/putback, uses internal knowledge of it.    
6229
6230         (xtoken): Reorder tokenizer so most common patterns are checked
6231         first.  This reduces the compilation time in another 5% (from 8.11s
6232         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
6233
6234         The parsing time is 22% of the compilation in mcs, and from that
6235         64% is spent on the tokenization process.  
6236
6237         I tried using a binary search for keywords, but this is slower
6238         than the hashtable.  Another option would be to do a couple of
6239         things:
6240
6241                 * Not use a StringBuilder, instead use an array of chars,
6242                   with a set value.  Notice that this way we could catch
6243                   the 645 error without having to do it *afterwards*.
6244
6245                 * We could write a hand-parser to avoid the hashtable
6246                   compares altogether.
6247
6248         The identifier consumption process takes 37% of the tokenization
6249         time.  Another 15% is spent on is_number.  56% of the time spent
6250         on is_number is spent on Int64.Parse:
6251
6252                 * We could probably choose based on the string length to
6253                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
6254                   computations. 
6255
6256         Another 3% is spend on wrapping `xtoken' in the `token' function.
6257
6258         Handle 0xa0 as whitespace (#34752)
6259
6260 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
6261
6262         * typemanager.cs (IsCLRType): New routine to tell whether a type
6263         is one of the builtin types.  
6264
6265         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
6266         typecode in more places instead of doing pointer comparissions.
6267         We could leverage some knowledge about the way the typecodes are
6268         laid out.
6269
6270         New code to cache namespaces in assemblies, it is currently not
6271         invoked, to be used soon.
6272
6273         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
6274
6275         * expression.cs (Binary.ResolveOperator): specially handle
6276         strings, and do not perform user-defined operator overloading for
6277         built-in types.
6278
6279 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
6280
6281         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
6282         internalcall as it is a pretty simple operation;  Avoid whenever
6283         possible to call Char.IsLetter.
6284
6285         (consume_identifier): Cut by half the number of
6286         hashtable calls by merging the is_keyword and GetKeyword behavior.
6287
6288         Do not short-circuit, because if we do, we
6289         report errors (ie, #if false && true would produce an invalid
6290         directive error);
6291
6292
6293 2002-11-24  Martin Baulig  <martin@ximian.com>
6294
6295         * expression.cs (Cast.TryReduce): If we're in checked syntax,
6296         check constant ranges and report a CS0221.  Fixes #33186.
6297
6298 2002-11-24  Martin Baulig  <martin@ximian.com>
6299
6300         * cs-parser.jay: Make this work for uninitialized variable
6301         declarations in the `for' initializer.  Fixes #32416.
6302
6303 2002-11-24  Martin Baulig  <martin@ximian.com>
6304
6305         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
6306         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
6307
6308 2002-11-24  Martin Baulig  <martin@ximian.com>
6309
6310         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
6311         argument; if true, we also check for user-defined conversions.
6312         This is only needed if both arguments are of a user-defined type.
6313         Fixes #30443, added test-175.cs.
6314         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
6315
6316         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
6317
6318 2002-11-24  Martin Baulig  <martin@ximian.com>
6319
6320         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
6321         function to get the store opcode.
6322         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
6323         only emit the Ldelema if the store opcode is Stobj.  You must run
6324         both test-34 and test-167 to test this.  Fixes #34529.
6325
6326 2002-11-23  Martin Baulig  <martin@ximian.com>
6327
6328         * ecore.cs (Expression.MemberLookup): Added additional
6329         `qualifier_type' argument which is used when we're being called
6330         from MemberAccess.DoResolve() and null if we're called from a
6331         SimpleName lookup.
6332         (Expression.MemberLookupFailed): New method to report errors; this
6333         does the CS1540 check and reports the correct error message.
6334
6335         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
6336         argument for the CS1540 check and redone the way how we're dealing
6337         with private members.  See the comment in the source code for details.
6338         (FilterWithClosure): Reverted this back to revision 1.197; renamed
6339         `closure_start_type' to `closure_qualifier_type' and check whether
6340         it's not null.  It was not this filter being broken, it was just
6341         being called with the wrong arguments.
6342
6343         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
6344         and pass it the correct `qualifier_type'; this also does the error
6345         handling for us.
6346
6347 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
6348
6349         * expression.cs (Invocation.EmitParams): If the we are dealing
6350         with a non-built-in value type, load its address as well.
6351
6352         (ArrayCreation): Use a a pretty constant instead
6353         of the hardcoded value 2.   Use 6 instead of 2 for the number of
6354         static initializers.  
6355
6356         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
6357         because they are not really value types, just glorified integers. 
6358
6359         * driver.cs: Do not append .exe, the CSC compiler does not do it.
6360
6361         * ecore.cs: Remove redundant code for enumerations, make them use
6362         the same code path as everything else, fixes the casting issue
6363         with enumerations in Windows.Forms.
6364
6365         * attribute.cs: Do only cast to string if it is a string, the
6366         validation happens later.
6367
6368         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
6369         people upgrade their corlibs.
6370
6371         * ecore.cs: Oops, enumerations were not following the entire code path
6372
6373 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
6374
6375         * typemanager.cs (FilterWithClosure): Commented out the test for
6376         1540 in typemanager.cs, as it has problems when accessing
6377         protected methods from a parent class (see test-174.cs). 
6378
6379         * attribute.cs (Attribute.ValidateGuid): new method.
6380         (Attribute.Resolve): Use above.
6381
6382 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
6383
6384         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
6385
6386         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
6387         handling for enumerations, as we only needed the TypeContainer
6388         functionality to begin with (this is required for the fix below to
6389         work for enums that reference constants in a container class for
6390         example). 
6391
6392         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
6393
6394         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
6395         a valid TypeBuilder to perform lookups on.o
6396
6397         * class.cs (InheritableMemberSignatureCompare): Use true in the
6398         call to GetGetMethod and GetSetMethod, because we are comparing
6399         the signature, and we need to get the methods *even* if they are
6400         private. 
6401
6402         (PropertyBase.CheckBase): ditto.
6403
6404         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
6405         GotoCase.Resolve): Use Peel on EmpytCasts.
6406
6407         * ecore.cs (EmptyCast): drop child, add Peel method.
6408
6409 2002-11-17  Martin Baulig  <martin@ximian.com>
6410
6411         * ecore.cs (EmptyCast.Child): New public property.
6412
6413         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
6414         label resolved to an EmptyCast.  Fixes #34162.
6415         (GotoCase.Resolve): Likewise.
6416         (Block.EmitMeta): Likewise.
6417
6418 2002-11-17  Martin Baulig  <martin@ximian.com>
6419
6420         * expression.cs (Invocation.BetterConversion): Prefer int over
6421         uint; short over ushort; long over ulong for integer literals.
6422         Use ImplicitConversionExists instead of StandardConversionExists
6423         since we also need to check for user-defined implicit conversions.
6424         Fixes #34165.  Added test-173.cs.
6425
6426 2002-11-16  Martin Baulig  <martin@ximian.com>
6427
6428         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
6429         with the `true' and `false' literals.  Fixes #33151.
6430
6431 2002-11-16  Martin Baulig  <martin@ximian.com>
6432
6433         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
6434         October 22nd; don't do the cs1540 check for static members.
6435
6436         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
6437         now using our own filter here and doing the cs1540 check again.
6438
6439 2002-11-16  Martin Baulig  <martin@ximian.com>
6440
6441         * support.cs (InternalParameters): Don't crash if we don't have
6442         any fixed parameters.  Fixes #33532.
6443
6444 2002-11-16  Martin Baulig  <martin@ximian.com>
6445
6446         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
6447         when looking up static methods to make this work on Windows.
6448         Fixes #33773.
6449
6450 2002-11-16  Martin Baulig  <martin@ximian.com>
6451
6452         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
6453         a setter rather than using PropertyInfo.CanWrite.
6454
6455 2002-11-15  Nick Drochak  <ndrochak@gol.com>
6456
6457         * class.cs: Allow acces to block member by subclasses. Fixes build
6458         breaker.
6459
6460 2002-11-14  Martin Baulig  <martin@ximian.com>
6461
6462         * class.cs (Constructor.Emit): Added the extern/block check.
6463         Fixes bug #33678.
6464
6465 2002-11-14  Martin Baulig  <martin@ximian.com>
6466
6467         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
6468         iteration while looking for indexers, this is needed because the
6469         indexer may have a different name in our base classes.  Fixed the
6470         error reporting (no indexers at all, not get accessor, no
6471         overloaded match).  Fixes bug #33089.
6472         (IndexerAccess.DoResolveLValue): Likewise.
6473
6474 2002-11-14  Martin Baulig  <martin@ximian.com>
6475
6476         * class.cs (PropertyBase.CheckBase): Make this work for multiple
6477         indexers.  Fixes the first part of bug #33089.
6478         (MethodSignature.InheritableMemberSignatureCompare): Added support
6479         for properties.
6480
6481 2002-11-13  Ravi Pratap  <ravi@ximian.com>
6482
6483         * attribute.cs (Attribute.Resolve): Catch the
6484         NullReferenceException and report it since it isn't supposed to
6485         happen. 
6486
6487 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
6488
6489         * expression.cs (Binary.EmitBranchable): Also handle the cases for
6490         LogicalOr and LogicalAnd that can benefit from recursively
6491         handling EmitBranchable.  The code now should be nice for Paolo.
6492
6493 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
6494
6495         * typemanager.cs (LookupType): Added a negative-hit hashtable for
6496         the Type lookups, as we perform quite a number of lookups on
6497         non-Types.  This can be removed once we can deterministically tell
6498         whether we have a type or a namespace in advance.
6499
6500         But this might require special hacks from our corlib.
6501
6502         * TODO: updated.
6503
6504         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
6505         and double which avoids a conversion from an integer to a double.
6506
6507         * expression.cs: tiny optimization, avoid calling IsConstant,
6508         because it effectively performs the lookup twice.
6509
6510 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
6511
6512         But a bogus return here to keep the semantics of the old code
6513         until the Mono runtime is fixed.
6514
6515         * pending.cs (GetMissingInterfaces): New method used to remove all
6516         the interfaces that are already implemented by our parent
6517         classes from the list of pending methods. 
6518
6519         * interface.cs: Add checks for calls after ResolveTypeExpr.
6520
6521 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
6522
6523         * class.cs (Class.Emit): Report warning 67: event not used if the
6524         warning level is beyond 3.
6525
6526         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
6527         being a NullLiteral.
6528
6529         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
6530         specifiers. 
6531
6532         * class.cs (TypeContainer.GetClassBases): Cover a missing code
6533         path that might fail if a type can not be resolved.
6534
6535         * expression.cs (Binary.Emit): Emit unsigned versions of the
6536         operators. 
6537
6538         * driver.cs: use error 5.
6539
6540 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
6541
6542         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
6543
6544 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
6545
6546         * cs-parser.jay (switch_section): A beautiful patch from Martin
6547         Baulig that fixed 33094.
6548
6549 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
6550
6551         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
6552         Check whether the base is abstract and report an error if so.
6553
6554         * expression.cs (IndexerAccess.DoResolveLValue,
6555         IndexerAccess.DoResolve): ditto. 
6556
6557         (Invocation.DoResolve): ditto.
6558
6559         (Invocation.FullMethodDesc): Improve the report string.
6560
6561         * statement.cs (Block): Eliminate IsVariableDefined as it is
6562         basically just a wrapper for GetVariableInfo.
6563
6564         * ecore.cs (SimpleName): Use new 
6565
6566         * support.cs (ReflectionParamter.ParameterType): We unwrap the
6567         type, as we return the actual parameter ref/unref state on a
6568         different call.
6569
6570 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
6571
6572         * support.cs: Return proper flags REF/OUT fixing the previous
6573         commit.  
6574
6575         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
6576         not used to mean `ref' but `ref or out' in ParameterReference
6577
6578         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
6579         full type signature instead of calling TypeManger.CSharpName
6580         ourselves. 
6581
6582         * support.cs (InternalParameters.ParameterDesc): Do not compare
6583         directly to the modflags, because REF/OUT will actually be bitsets
6584         if set. 
6585
6586         * delegate.cs (VerifyMethod): Check also the modifiers.
6587
6588         * cs-tokenizer.cs: Fix bug where floating point values with an
6589         exponent where a sign was missing was ignored.
6590
6591         * driver.cs: Allow multiple assemblies to be specified in a single
6592         /r: argument
6593
6594 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
6595
6596         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
6597         because identifiers after a parenthesis would end up in this kind
6598         of production, and we needed to desamiguate it for having casts
6599         like:
6600
6601                 (UserDefinedType *) xxx
6602
6603 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
6604
6605         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
6606         we should set on the Bindingflags.NonPublic, but not turn on
6607         private_ok.  private_ok controls whether a Private member is
6608         returned (this is chekced on the filter routine), while the
6609         BindingFlags.NonPublic just controls whether private/protected
6610         will be allowed.   This fixes the problem part of the problem of
6611         private properties being allowed to be used in derived classes.
6612
6613         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
6614         so we can call the children DoResolveLValue method (this will
6615         properly signal errors on lvalue assignments to base properties)
6616
6617         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
6618         getter are null, and we have a property info, we know that this
6619         happened because the lookup failed, so we report an error 122 for
6620         protection level violation.
6621
6622         We also silently return if setter and getter are null in the
6623         resolve functions, this condition only happens if we have flagged
6624         the error before.  This is the other half of the problem. 
6625
6626         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
6627         not have accessibility information, that is why we were returning
6628         true in the filter function in typemanager.cs.
6629
6630         To properly report 122 (property is inaccessible because of its
6631         protection level) correctly, we report this error in ResolveAccess
6632         by failing if both the setter and the getter are lacking (ie, the
6633         lookup failed). 
6634
6635         DoResolve and DoLResolve have been modified to check for both
6636         setter/getter being null and returning silently, the reason being
6637         that I did not want to put the knowledge about this error in upper
6638         layers, like:
6639
6640         int old = Report.Errors;
6641         x = new PropertyExpr (...);
6642         if (old != Report.Errors)
6643                 return null;
6644         else
6645                 return x;
6646
6647         So the property expr is returned, but it is invalid, so the error
6648         will be flagged during the resolve process. 
6649
6650         * class.cs: Remove InheritablePropertySignatureCompare from the
6651         class, as we no longer depend on the property signature to compute
6652         whether it is possible to implement a method or not.
6653
6654         The reason is that calling PropertyInfo.GetGetMethod will return
6655         null (in .NET, in Mono it works, and we should change this), in
6656         cases where the Get Method does not exist in that particular
6657         class.
6658
6659         So this code:
6660
6661         class X { public virtual int A { get { return 1; } } }
6662         class Y : X { }
6663         class Z : Y { public override int A { get { return 2; } } }
6664
6665         Would fail in Z because the parent (Y) would not have the property
6666         defined.  So we avoid this completely now (because the alternative
6667         fix was ugly and slow), and we now depend exclusively on the
6668         method names.
6669
6670         (PropertyBase.CheckBase): Use a method-base mechanism to find our
6671         reference method, instead of using the property.
6672
6673         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
6674         routines are gone now.
6675
6676         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
6677         names, they were incorrectly named.
6678
6679         * cs-tokenizer.cs: Return are more gentle token on failure. 
6680
6681         * pending.cs (PendingImplementation.InterfaceMethod): This routine
6682         had an out-of-sync index variable, which caused it to remove from
6683         the list of pending methods the wrong method sometimes.
6684
6685 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
6686
6687         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
6688         CanWrite, because those refer to this particular instance of the
6689         property, and do not take into account the fact that we can
6690         override single members of a property.
6691
6692         Constructor requires an EmitContext.  The resolution process does
6693         not happen here, but we need to compute the accessors before,
6694         because the resolution does not always happen for properties.
6695
6696         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
6697         subclass, before we did not update this flag, but we did update
6698         bindingflags. 
6699
6700         (GetAccessors): Drop this routine, as it did not work in the
6701         presence of partially overwritten set/get methods. 
6702
6703         Notice that this broke the cs1540 detection, but that will require
6704         more thinking. 
6705
6706 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6707
6708         * class.cs:
6709         * codegen.cs:
6710         * driver.cs: issue a warning instead of an error if we don't support
6711         debugging for the platform. Also ignore a couple of errors that may
6712         arise when trying to write the symbols. Undo my previous patch.
6713
6714 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6715
6716         * driver.cs: ignore /debug switch except for Unix platforms.
6717
6718 2002-10-23  Nick Drochak  <ndrochak@gol.com>
6719
6720         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
6721
6722 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
6723
6724         * driver.cs: Do not make mcs-debug conditional, so we do not break
6725         builds that use it.
6726
6727         * statement.cs (UsageVector.MergeChildren): I would like Martin to
6728         review this patch.  But basically after all the children variables
6729         have been merged, the value of "Breaks" was not being set to
6730         new_breaks for Switch blocks.  I think that it should be set after
6731         it has executed.  Currently I set this to the value of new_breaks,
6732         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
6733         conservative, but I do not understand this code very well.
6734
6735         I did not break anything in the build, so that is good ;-)
6736
6737         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
6738
6739 2002-10-20  Mark Crichton  <crichton@gimp.org>
6740
6741         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
6742
6743 2002-10-20  Nick Drochak  <ndrochak@gol.com>
6744
6745         * cfold.cs: Fixed compile blocker.
6746
6747 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
6748
6749         * driver.cs: I was chekcing the key, not the file.
6750
6751 2002-10-19  Ravi Pratap  <ravi@ximian.com>
6752
6753         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
6754         message that we were generating - we just need to silently return
6755         a null.
6756
6757 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
6758
6759         * class.cs (Event.Define): Change my previous commit, as this
6760         breaks the debugger.  This is a temporary hack, as it seems like
6761         the compiler is generating events incorrectly to begin with.
6762
6763         * expression.cs (Binary.ResolveOperator): Added support for 
6764         "U operator - (E x, E y)"
6765
6766         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
6767         y)".
6768
6769         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
6770         init-only variables, but this path did not take into account that
6771         there might be also instance readonly variables.  Correct this
6772         problem. 
6773
6774         This fixes bug 32253
6775
6776         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
6777         delegates as well.
6778
6779         * driver.cs: Change the extension for modules to `netmodule'
6780
6781         * cs-parser.jay: Improved slightly the location tracking for
6782         the debugger symbols.
6783
6784         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
6785         modifiers that were specified instead of the hardcoded value
6786         (FamAndAssem).  This was basically ignoring the static modifier,
6787         and others.  Fixes 32429.
6788
6789         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
6790         fixed a bug in the process (32476)
6791
6792         * expression.cs (ArrayAccess.EmitAssign): Patch from
6793         hwang_rob@yahoo.ca that fixes bug 31834.3
6794
6795 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
6796
6797         * driver.cs: Make the module extension .netmodule.
6798
6799 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
6800
6801         * driver.cs: Report an error if the resource file is not found
6802         instead of crashing.
6803
6804         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
6805         false, like Emit does.
6806
6807 2002-10-16  Nick Drochak  <ndrochak@gol.com>
6808
6809         * typemanager.cs: Remove unused private member.  Also reported mcs
6810         bug to report this as a warning like csc.
6811
6812 2002-10-15  Martin Baulig  <martin@gnome.org>
6813
6814         * statement.cs (Statement.Emit): Made this a virtual method; emits
6815         the line number info and calls DoEmit().
6816         (Statement.DoEmit): New protected abstract method, formerly knows
6817         as Statement.Emit().
6818
6819         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
6820
6821 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
6822
6823         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
6824         have fixed a remaining problem: not every AddXXXX was adding a
6825         fully qualified name.  
6826
6827         Now everyone registers a fully qualified name in the DeclSpace as
6828         being defined instead of the partial name.  
6829
6830         Downsides: we are slower than we need to be due to the excess
6831         copies and the names being registered this way.  
6832
6833         The reason for this is that we currently depend (on the corlib
6834         bootstrap for instance) that types are fully qualified, because
6835         we dump all the types in the namespace, and we should really have
6836         types inserted into the proper namespace, so we can only store the
6837         basenames in the defined_names array.
6838
6839 2002-10-10  Martin Baulig  <martin@gnome.org>
6840
6841         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
6842         from bug #31834, see the bug report for a testcase which is
6843         miscompiled.
6844
6845 2002-10-10  Martin Baulig  <martin@gnome.org>
6846
6847         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
6848         flow analysis code for this.
6849
6850         * statement.cs (Do, While, For): Tell the flow analysis code about
6851         infinite loops.
6852         (FlowBranching.UsageVector): Added support for infinite loops.
6853         (Block.Resolve): Moved the dead code elimination here and use flow
6854         analysis to do it.
6855
6856 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
6857
6858         * class.cs (Field.Define): Catch cycles on struct type
6859         definitions. 
6860
6861         * typemanager.cs (IsUnmanagedtype): Do not recursively check
6862         fields if the fields are static.  We only need to check instance
6863         fields. 
6864
6865         * expression.cs (As.DoResolve): Test for reference type.
6866
6867         * statement.cs (Using.ResolveExpression): Use
6868         ConvertImplicitRequired, not ConvertImplicit which reports an
6869         error on failture
6870         (Using.ResolveLocalVariableDecls): ditto.
6871
6872         * expression.cs (Binary.ResolveOperator): Report errors in a few
6873         places where we had to.
6874
6875         * typemanager.cs (IsUnmanagedtype): Finish implementation.
6876
6877 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
6878
6879         * expression.cs: Use StoreFromPtr instead of extracting the type
6880         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
6881
6882         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
6883         an enumeration value to a System.Enum, but System.Enum is not a
6884         value type, but an class type, so we need to box.
6885
6886         (Expression.ConvertExplicit): One codepath could return
6887         errors but not flag them.  Fix this.  Fixes #31853
6888
6889         * parameter.cs (Resolve): Do not allow void as a parameter type.
6890
6891 2002-10-06  Martin Baulig  <martin@gnome.org>
6892
6893         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
6894         if it's a class type and not a struct.  Fixes #31815.
6895
6896 2002-10-06  Martin Baulig  <martin@gnome.org>
6897
6898         * statement.cs: Reworked the flow analysis code a bit to make it
6899         usable for dead code elimination.
6900
6901 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6902
6903         * cs-parser.jay: allow empty source files. Fixes bug #31781.
6904
6905 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
6906
6907         * expression.cs (ComposedCast.DoResolveType): A quick workaround
6908         to fix the test 165, will investigate deeper.
6909
6910 2002-10-04  Martin Baulig  <martin@gnome.org>
6911
6912         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
6913         finally blocks actually work.
6914         (Try.Resolve): We don't need to create a sibling for `finally' if
6915         there is no finally block.
6916
6917 2002-10-04  Martin Baulig  <martin@gnome.org>
6918
6919         * class.cs (Constructor.Define): The default accessibility for a
6920         non-default constructor is private, not public.
6921
6922 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
6923
6924         * class.cs (Constructor): Make AllowedModifiers public, add
6925         EXTERN.
6926
6927         * cs-parser.jay: Perform the modifiers test here, as the
6928         constructor for the Constructor class usually receives a zero
6929         because of the way we create it (first we create, later we
6930         customize, and we were never checking the modifiers).
6931
6932         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
6933         is a version of LookupTypeReflection that includes the type-name
6934         cache.  This can be used as a fast path for functions that know
6935         the fully qualified name and are only calling into *.GetType() to
6936         obtain a composed type.
6937
6938         This is also used by TypeManager.LookupType during its type
6939         composition.
6940
6941         (LookupType): We now also track the real type name, as sometimes
6942         we can get a quey for the real type name from things like
6943         ComposedCast.  This fixes bug 31422.
6944
6945         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
6946         complete type fullname, it does not have to go through the type
6947         resolution system to obtain the composed version of the type (for
6948         obtaining arrays or pointers).
6949
6950         (Conditional.Emit): Use the EmitBoolExpression to
6951         generate nicer code, as requested by Paolo.
6952
6953         (ArrayCreation.CheckIndices): Use the patch from
6954         hwang_rob@yahoo.ca to validate the array initializers. 
6955
6956 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
6957
6958         * class.cs (ConstructorInitializer.Emit): simplify code by using
6959         Invocation.EmitCall, and at the same time, fix the bugs in calling
6960         parent constructors that took variable arguments. 
6961
6962         * ecore.cs (Expression.ConvertNumericExplicit,
6963         Expression.ImplicitNumericConversion): Remove the code that
6964         manually wrapped decimal (InternalTypeConstructor call is now gone
6965         as well).
6966
6967         * expression.cs (Cast.TryReduce): Also handle decimal types when
6968         trying to perform a constant fold on the type.
6969
6970         * typemanager.cs (IsUnmanagedtype): Partially implemented.
6971
6972         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
6973         that only turned off an error report, and did nothing else. 
6974
6975 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
6976
6977         * driver.cs: Handle and ignore /fullpaths
6978
6979 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
6980
6981         * expression.cs (Binary.ResolveOperator): Catch the case where
6982         DoNumericPromotions returns true, 
6983
6984         (Binary.DoNumericPromotions): Simplify the code, and the tests.
6985
6986 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
6987
6988         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
6989         report error 70.
6990
6991 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
6992
6993         * ecore.cs (ConvertNumericExplicit): It is not enough that the
6994         conversion exists, but it is also required that the conversion be
6995         performed.  This manifested in "(Type64Enum) 2".  
6996
6997         * class.cs (TypeManager.AddMethod): The fix is not to change
6998         AddEnum, because that one was using a fully qualified name (every
6999         DeclSpace derivative does), but to change the AddMethod routine
7000         that was using an un-namespaced name.  This now correctly reports
7001         the duplicated name.
7002
7003         Revert patch until I can properly fix it.  The issue
7004         is that we have a shared Type space across all namespaces
7005         currently, which is wrong.
7006
7007         Options include making the Namespace a DeclSpace, and merge
7008         current_namespace/current_container in the parser.
7009
7010 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
7011
7012         * cs-parser.jay: Improve error reporting when we get a different
7013         kind of expression in local_variable_type and
7014         local_variable_pointer_type. 
7015
7016         Propagate this to avoid missleading errors being reported.
7017
7018         * ecore.cs (ImplicitReferenceConversion): treat
7019         TypeManager.value_type as a target just like object_type.   As
7020         code like this:
7021
7022         ValueType v = 1;
7023
7024         Is valid, and needs to result in the int 1 being boxed before it
7025         is assigned to the value type v.
7026
7027         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
7028         to validate the enumeration name.
7029
7030         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
7031         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
7032         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
7033
7034         * ecore.cs (TryImplicitIntConversion): When doing an
7035         implicit-enumeration-conversion, check if the type is 64-bits and
7036         perform a conversion before passing to EnumConstant.
7037
7038 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
7039
7040         * decl.cs (Error_AmbiguousTypeReference); New routine used to
7041         report ambiguous type references.  Unlike the MS version, we
7042         report what the ambiguity is.   Innovation at work ;-)
7043
7044         (DeclSpace.FindType): Require a location argument to
7045         display when we display an ambiguous error.
7046
7047         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
7048
7049         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
7050
7051         * expression.cs (EmitDynamicInitializers): Apply patch from
7052         hwang_rob@yahoo.ca that fixes the order in which we emit our
7053         initializers. 
7054
7055 2002-09-21  Martin Baulig  <martin@gnome.org>
7056
7057         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
7058         delegate takes no arguments.
7059
7060 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
7061
7062         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
7063         from integers.
7064
7065         * expression.cs: Extract the underlying type.
7066
7067         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
7068
7069         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
7070
7071 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
7072
7073         * class.cs (TypeContainer.DefineType): We can not use the nice
7074         PackingSize with the size set to 1 DefineType method, because it
7075         will not allow us to define the interfaces that the struct
7076         implements.
7077
7078         This completes the fixing of bug 27287
7079
7080         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
7081         means also structs.  This fixes part of the problem. 
7082         (Expresion.ImplicitReferenceConversionExists): ditto.
7083
7084         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
7085         error if there were no errors reported during the type lookup
7086         process, to avoid duplicates or redundant errors.  Without this
7087         you would get an ambiguous errors plus a type not found.  We have
7088         beaten the user enough with the first error.  
7089
7090         (DeclSparce.FindType): Emit a warning if we have an ambiguous
7091         reference. 
7092
7093         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
7094         during the resolution process, stop the lookup, this avoids
7095         repeated error reports (same error twice).
7096
7097         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
7098
7099         * typemanager.cs (LookupType): Redo the type lookup code to match
7100         the needs of System.Reflection.  
7101
7102         The issue is that System.Reflection requires references to nested
7103         types to begin with a "+" sign instead of a dot.  So toplevel
7104         types look like: "NameSpace.TopLevelClass", and nested ones look
7105         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
7106         levels. 
7107
7108 2002-09-19  Martin Baulig  <martin@gnome.org>
7109
7110         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
7111         says that a method always returns or always throws an exception,
7112         don't report the CS0161.
7113
7114         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
7115         set `Returns = new_returns'.
7116
7117 2002-09-19  Martin Baulig  <martin@gnome.org>
7118
7119         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
7120         to an enum constant, check for a CS0176.
7121
7122 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
7123
7124         * class.cs (TypeContainer.CheckPairedOperators): Now we check
7125         for operators that must be in pairs and report errors.
7126
7127         * ecore.cs (SimpleName.DoResolveType): During the initial type
7128         resolution process, when we define types recursively, we must
7129         check first for types in our current scope before we perform
7130         lookups in the enclosing scopes.
7131
7132         * expression.cs (MakeByteBlob): Handle Decimal blobs.
7133
7134         (Invocation.VerifyArgumentsCompat): Call
7135         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
7136         I thought we were supposed to always call this, but there are a
7137         few places in the code where we dont do it.
7138
7139 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
7140
7141         * driver.cs: Add support in -linkres and -resource to specify the
7142         name of the identifier.
7143
7144 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
7145
7146         * ecore.cs (StandardConversionExists): Sync with the conversion
7147         code: allow anything-* to void* conversions.
7148
7149         (FindMostSpecificSource): Use an Expression argument
7150         instead of a Type, because we might be handed over a Literal which
7151         gets a few more implicit conversions that plain types do not.  So
7152         this information was being lost.
7153
7154         Also, we drop the temporary type-holder expression when not
7155         required.
7156
7157 2002-09-17  Martin Baulig  <martin@gnome.org>
7158
7159         * class.cs (PropertyBase.CheckBase): Don't check the base class if
7160         this is an explicit interface implementation.
7161
7162 2002-09-17  Martin Baulig  <martin@gnome.org>
7163
7164         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
7165         different `IndexerName' attributes.
7166
7167         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
7168         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
7169         virtual CommonResolve().
7170
7171 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
7172
7173         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
7174         and convert that to the UnderlyingType.
7175
7176         * statement.cs (Foreach.Resolve): Indexers are just like variables
7177         or PropertyAccesses.
7178
7179         * cs-tokenizer.cs (consume_string): Track line numbers and columns
7180         inside quoted strings, we were not doing this before.
7181
7182 2002-09-16  Martin Baulig  <martin@gnome.org>
7183
7184         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
7185         resolve it.  This is needed for the definite assignment check of the
7186         instance expression, fixes bug #29846.
7187         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
7188
7189 2002-09-16  Nick Drochak  <ndrochak@gol.com>
7190
7191         * parameter.cs: Fix compile error.  Cannot reference static member
7192         from an instance object.  Is this an mcs bug?
7193
7194 2002-09-14  Martin Baulig  <martin@gnome.org>
7195
7196         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
7197         multiple times.  Fixes bug #30295, added test-166.cs.
7198
7199 2002-09-14  Martin Baulig  <martin@gnome.org>
7200
7201         * statement.cs (Block.Emit): Don't emit unreachable code.
7202         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
7203         `break' statements.
7204         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
7205
7206 2002-09-14  Martin Baulig  <martin@gnome.org>
7207
7208         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
7209         is set.
7210
7211 2002-09-14  Martin Baulig  <martin@gnome.org>
7212
7213         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
7214         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
7215         be false on the ms runtime.
7216
7217 2002-09-13  Martin Baulig  <martin@gnome.org>
7218
7219         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
7220         the CS0038 error message.
7221
7222 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
7223
7224         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
7225         constant inside, return it.
7226
7227 2002-09-12  Martin Baulig  <martin@gnome.org>
7228
7229         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
7230         implicit conversion can be done between enum types.
7231
7232         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
7233         check whether an implicit conversion to the current enum's UnderlyingType
7234         exists and report an error if not.
7235
7236         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
7237         without debugging support.
7238
7239         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
7240         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
7241
7242 2002-09-12  Martin Baulig  <martin@gnome.org>
7243
7244         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
7245
7246         * ecore.cs (IMemberExpr.DeclaringType): New property.
7247         (SimpleName.SimpleNameResolve): Check whether we're accessing a
7248         nonstatic member of an outer type (CS0038).
7249
7250 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
7251
7252         * driver.cs: Activate the using-error detector at warning level
7253         4 (at least for MS-compatible APIs).
7254
7255         * namespace.cs (VerifyUsing): Small buglett fix.
7256
7257         * pending.cs (PendingImplementation): pass the container pointer. 
7258
7259         * interface.cs (GetMethods): Allow for recursive definition.  Long
7260         term, I would like to move every type to support recursive
7261         definitions, not the current ordering mechanism that we have right
7262         now.
7263
7264         The situation is this: Attributes are handled before interfaces,
7265         so we can apply attributes to interfaces.  But some attributes
7266         implement interfaces, we will now handle the simple cases
7267         (recursive definitions will just get an error).  
7268
7269         * parameter.cs: Only invalidate types at the end if we fail to
7270         lookup all types.  
7271
7272 2002-09-09  Martin Baulig  <martin@gnome.org>
7273
7274         * ecore.cs (PropertyExpr.Emit): Also check for
7275         TypeManager.system_int_array_get_length so this'll also work when
7276         compiling corlib.  Fixes #30003.
7277
7278 2002-09-09  Martin Baulig  <martin@gnome.org>
7279
7280         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
7281         and throw an exception if we can't get the type's size.  Fixed #30040,
7282         added test-165.cs.
7283
7284 2002-09-09  Martin Baulig  <martin@gnome.org>
7285
7286         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
7287
7288         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
7289         context.  Fixes bug #30027.
7290
7291         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
7292         virtual functions.  Fixes bug #30043, added test-164.cs.
7293
7294 2002-09-08  Ravi Pratap  <ravi@ximian.com>
7295
7296         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
7297
7298 2002-09-08  Nick Drochak  <ndrochak@gol.com>
7299
7300         * driver.cs: Use an object to get the windows codepage since it's not a
7301         static property.
7302
7303 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
7304
7305         * statement.cs (For.Emit): for infinite loops (test == null)
7306         return whether there is a break inside, not always "true".
7307
7308         * namespace.cs (UsingEntry): New struct to hold the name of the
7309         using definition, the location where it is defined, and whether it
7310         has been used in a successful type lookup.
7311
7312         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
7313         strings.
7314
7315         * decl.cs: ditto.
7316
7317 2002-09-06  Ravi Pratap  <ravi@ximian.com>
7318
7319         * attribute.cs : Fix incorrect code which relied on catching
7320         a NullReferenceException to detect a null being passed in
7321         where an object was expected.
7322
7323 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
7324
7325         * statement.cs (Try): flag the catch variable as assigned
7326
7327         * expression.cs (Cast): Simplified by using ResolveType instead of
7328         manually resolving.
7329
7330         * statement.cs (Catch): Fix bug by using ResolveType.
7331
7332 2002-09-06  Ravi Pratap  <ravi@ximian.com>
7333
7334         * expression.cs (BetterConversion): Special case for when we have
7335         a NullLiteral as the argument and we have to choose between string
7336         and object types - we choose string the way csc does.
7337
7338         * attribute.cs (Attribute.Resolve): Catch the
7339         NullReferenceException and report error #182 since the Mono
7340         runtime no more has the bug and having this exception raised means
7341         we tried to select a constructor which takes an object and is
7342         passed a null.
7343
7344 2002-09-05  Ravi Pratap  <ravi@ximian.com>
7345
7346         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
7347         message (1502, 1503) when we can't locate a method after overload
7348         resolution. This is much more informative and closes the bug
7349         Miguel reported.
7350
7351         * interface.cs (PopulateMethod): Return if there are no argument
7352         types. Fixes a NullReferenceException bug.
7353
7354         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
7355         expressions too. Previously we were checking only in one place for
7356         positional arguments leaving out named arguments.
7357
7358         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
7359         type to the enum type is not allowed. Remove code corresponding to
7360         that.
7361
7362         (ConvertNumericExplicit): Allow explicit conversions from
7363         the underlying type to enum type. This precisely follows the spec
7364         and closes a bug filed by Gonzalo.
7365
7366 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7367
7368         * compiler.csproj:
7369         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
7370
7371 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
7372
7373         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
7374         it was important that we stored the right value after the
7375         reduction in `converted'.
7376
7377 2002-09-04  Martin Baulig  <martin@gnome.org>
7378
7379         * location.cs (Location.SymbolDocument): Use full pathnames for the
7380         source files.
7381
7382 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
7383
7384         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
7385         of the expression resolve mechanism, because that will catch the
7386         SimpleName error failures.
7387
7388         (Conditional): If we can not resolve the
7389         expression, return, do not crash.
7390
7391 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7392
7393         * cs-tokenizer.cs:
7394         (location): display token name instead of its number.
7395
7396 2002-08-28  Martin Baulig  <martin@gnome.org>
7397
7398         * expression.cs (Binary.ResolveOperator): Don't silently return
7399         but return an error if an operator cannot be applied between two
7400         enum types.
7401
7402 2002-08-28  Martin Baulig  <martin@gnome.org>
7403
7404         * class.cs (Constructor.Define): Set the permission attributes
7405         correctly instead of making all constructors public.
7406
7407 2002-08-28  Martin Baulig  <martin@gnome.org>
7408
7409         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
7410         for private members before reporting a CS0103; if we find anything,
7411         it's a CS0122.
7412
7413 2002-08-28  Martin Baulig  <martin@gnome.org>
7414
7415         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
7416         to check whether `closure_start_type == closure_invocation_type',
7417         we also need to check whether `m.DeclaringType == closure_invocation_type'
7418         before bypassing the permission checks.  We might be accessing
7419         protected/private members from the base class.
7420         (TypeManager.RealMemberLookup): Only set private_ok if private
7421         members were requested via BindingFlags.NonPublic.
7422
7423         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
7424
7425         * expression.cs (MemberAccess.ResolveMemberAccess): Set
7426         MethodGroupExpr.IsExplicitImpl if appropriate.
7427         (Invocation.DoResolve): Don't report the CS0120 for explicit
7428         interface implementations.
7429
7430 2002-08-27  Martin Baulig  <martin@gnome.org>
7431
7432         * expression.cs (Invocation.DoResolve): If this is a static
7433         method and we don't have an InstanceExpression, we must report
7434         a CS0120.
7435
7436 2002-08-25  Martin Baulig  <martin@gnome.org>
7437
7438         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
7439         `==' between a valuetype and an object.
7440
7441 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
7442
7443         * ecore.cs (TypeExpr): Provide a ToString method.
7444
7445 2002-08-24  Martin Baulig  <martin@gnome.org>
7446
7447         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
7448         now called proggie.dbg and it's a binary file.
7449
7450 2002-08-23  Martin Baulig  <martin@gnome.org>
7451
7452         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
7453
7454 2002-08-23  Martin Baulig  <martin@gnome.org>
7455
7456         * struct.cs (MyStructInfo.ctor): Make this work with empty
7457         structs; it's not allowed to use foreach() on null.
7458
7459 2002-08-23  Martin Baulig  <martin@gnome.org>
7460
7461         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
7462         writer the full pathname of the generated assembly.
7463
7464 2002-08-23  Martin Baulig  <martin@gnome.org>
7465
7466         * statements.cs (FlowBranching.UsageVector.MergeChildren):
7467         A `finally' block never returns or breaks; improved handling of
7468         unreachable code.
7469
7470 2002-08-23  Martin Baulig  <martin@gnome.org>
7471
7472         * statement.cs (Throw.Resolve): Allow `throw null'.
7473
7474 2002-08-23  Martin Baulig  <martin@gnome.org>
7475
7476         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
7477         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
7478         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
7479         MemberLookup would return a wrong event if this is an explicit
7480         interface implementation and the class has an event with the same
7481         name.
7482
7483 2002-08-23  Martin Baulig  <martin@gnome.org>
7484
7485         * statement.cs (Block.AddChildVariableNames): New public method.
7486         (Block.AddChildVariableName): Likewise.
7487         (Block.IsVariableNameUsedInChildBlock): Likewise.
7488         (Block.AddVariable): Check whether a variable name has already
7489         been used in a child block.
7490
7491         * cs-parser.jay (declare_local_variables): Mark all variable names
7492         from the current block as being used in a child block in the
7493         implicit block.
7494
7495 2002-08-23  Martin Baulig  <martin@gnome.org>
7496
7497         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
7498         find the symbol writer.
7499
7500         * driver.cs: csc also allows the arguments to /define being
7501         separated by commas, not only by semicolons.
7502
7503 2002-08-23  Martin Baulig  <martin@gnome.org>
7504
7505         * interface.cs (Interface.GetMembers): Added static check for events.
7506
7507 2002-08-15  Martin Baulig  <martin@gnome.org>
7508
7509         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
7510         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
7511
7512         * ecore.cs (Expression.MemberLookup): Added documentation and explained
7513         why the MethodData.EmitDestructor() change was necessary.
7514
7515 2002-08-20  Martin Baulig  <martin@gnome.org>
7516
7517         * class.cs (TypeContainer.FindMembers): Added static check for events.
7518
7519         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
7520
7521         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
7522         use Type.GetEvents(), not Type.FindMembers().
7523
7524 2002-08-20  Martin Baulig  <martin@gnome.org>
7525
7526         * decl.cs (MemberCache): Added a special method cache which will
7527         be used for method-only searched.  This ensures that a method
7528         search will return a MethodInfo with the correct ReflectedType for
7529         inherited methods.      
7530
7531 2002-08-20  Martin Baulig  <martin@gnome.org>
7532
7533         * decl.cs (DeclSpace.FindMembers): Made this public.
7534
7535 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7536
7537         * delegate.cs: fixed build on windows.
7538         [FIXME:  Filed as bug #29150: MCS must report these errors.]
7539
7540 2002-08-19  Ravi Pratap  <ravi@ximian.com>
7541
7542         * ecore.cs (StandardConversionExists): Return a false
7543         if we are trying to convert the void type to anything else
7544         since that is not allowed.
7545
7546         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
7547         we flag error 70 in the event an event is trying to be accessed
7548         directly from outside the declaring type.
7549
7550 2002-08-20  Martin Baulig  <martin@gnome.org>
7551
7552         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
7553         MemberCache from typemanager.cs to decl.cs.
7554
7555 2002-08-19  Martin Baulig  <martin@gnome.org>
7556
7557         * class.cs (TypeContainer): Implement IMemberContainer.
7558         (TypeContainer.DefineMembers): Create the MemberCache.
7559         (TypeContainer.FindMembers): Do better BindingFlags checking; only
7560         return public members if BindingFlags.Public was given, check
7561         whether members are static.
7562
7563 2002-08-16  Martin Baulig  <martin@gnome.org>
7564
7565         * decl.cs (DeclSpace.Define): Splitted this in Define and
7566         DefineMembers.  DefineMembers is called first and initializes the
7567         MemberCache.
7568
7569         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
7570         DefineMembers() on all our DeclSpaces.
7571
7572         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
7573         but call DefineMembers() on all nested interfaces.  We call their
7574         Define() in our new Define() function.
7575
7576         * interface.cs (Interface): Implement IMemberContainer.
7577         (Interface.Define): Moved all code except the attribute stuf to
7578         DefineMembers().
7579         (Interface.DefineMembers): Initialize the member cache.
7580
7581         * typemanager.cs (IMemberFinder): Removed this interface, we don't
7582         need this anymore since we can use MemberCache.FindMembers directly.
7583
7584 2002-08-19  Martin Baulig  <martin@gnome.org>
7585
7586         * typemanager.cs (MemberCache): When creating the cache for an
7587         interface type, add all inherited members.
7588         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
7589         to `out bool used_cache' and documented it.
7590         (TypeManager.MemberLookup): If we already used the cache in the first
7591         iteration, we don't need to do the interfaces check.
7592
7593 2002-08-19  Martin Baulig  <martin@gnome.org>
7594
7595         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
7596         here from IMemberFinder and don't implement this interface anymore.
7597         (DeclSpace.MemberCache): Moved here from IMemberFinder.
7598
7599         * typemanager.cs (IMemberFinder): This interface is now only used by
7600         classes which actually support the member cache.
7601         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
7602         since we only put DeclSpaces into this Hashtable.
7603         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
7604         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
7605
7606 2002-08-16  Martin Baulig  <martin@gnome.org>
7607
7608         * typemanager.cs (ICachingMemberFinder): Removed.
7609         (IMemberFinder.MemberCache): New property.
7610         (TypeManager.FindMembers): Merged this with RealFindMembers().
7611         This function will never be called from TypeManager.MemberLookup()
7612         so we can't use the cache here, just the IMemberFinder.
7613         (TypeManager.MemberLookup_FindMembers): Check whether the
7614         IMemberFinder has a MemberCache and call the cache's FindMembers
7615         function.
7616         (MemberCache): Rewrote larger parts of this yet another time and
7617         cleaned it up a bit.
7618
7619 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
7620
7621         * driver.cs (LoadArgs): Support quoting.
7622
7623         (Usage): Show the CSC-like command line arguments.
7624
7625         Improved a few error messages.
7626
7627 2002-08-15  Martin Baulig  <martin@gnome.org>
7628
7629         * typemanager.cs (IMemberContainer.Type): New property.
7630         (IMemberContainer.IsInterface): New property.
7631
7632         The following changes are conditional to BROKEN_RUNTIME, which is
7633         defined at the top of the file.
7634
7635         * typemanager.cs (MemberCache.MemberCache): Don't add the base
7636         class'es members, but add all members from TypeHandle.ObjectType
7637         if we're an interface.
7638         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
7639         is the current type.
7640         (MemberCache.CacheEntry.Container): Removed this field.
7641         (TypeHandle.GetMembers): Include inherited members.
7642
7643 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7644
7645         * typemanager.cs: fixed compilation and added a comment on a field that
7646         is never used.
7647
7648 2002-08-15  Martin Baulig  <martin@gnome.org>
7649
7650         * class.cs (ConstructorInitializer.Resolve): In the
7651         Expression.MemberLookup call, use the queried_type as
7652         invocation_type.
7653
7654         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
7655         declared' attribute, it's always true.
7656         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
7657         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
7658         temporary wrapper for FindMembers which tells MemberLookup whether
7659         members from the base classes are included in the return value.
7660         This will go away soon.
7661         (TypeManager.MemberLookup): Use this temporary hack here; once the
7662         new MemberCache is completed, we don't need to do the DeclaredOnly
7663         looping here anymore since the MemberCache will take care of this.
7664         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
7665         (MemberCache): When creating the MemberCache for a class, get
7666         members from the current class and all its base classes.
7667         (MemberCache.CacheEntry.Container): New field.  This is a
7668         temporary hack until the Mono runtime is fixed to distinguish
7669         between ReflectedType and DeclaringType.  It allows us to use MCS
7670         with both the MS runtime and the unfixed Mono runtime without
7671         problems and without accecting performance.
7672         (MemberCache.SearchMembers): The DeclaredOnly looping from
7673         TypeManager.MemberLookup is now done here.      
7674
7675 2002-08-14  Martin Baulig  <martin@gnome.org>
7676
7677         * statement.cs (MyStructInfo.MyStructInfo): Don't call
7678         Type.GetFields on dynamic types but get the fields from the
7679         corresponding TypeContainer.
7680         (MyStructInfo.GetStructInfo): Added check for enum types.
7681
7682         * typemanager.cs (MemberList.IsSynchronized): Implemented.
7683         (MemberList.SyncRoot): Implemented.
7684         (TypeManager.FilterWithClosure): No need to check permissions if
7685         closure_start_type == closure_invocation_type, don't crash if
7686         closure_invocation_type is null.
7687
7688 2002-08-13  Martin Baulig  <martin@gnome.org>
7689
7690         Rewrote TypeContainer.FindMembers to use a member cache.  This
7691         gives us a speed increase of about 35% for the self-hosting MCS
7692         build and of about 15-20% for the class libs (both on GNU/Linux).
7693
7694         * report.cs (Timer): New class to get enhanced profiling.  This
7695         whole class is "TIMER" conditional since it remarkably slows down
7696         compilation speed.
7697
7698         * class.cs (MemberList): New class.  This is an IList wrapper
7699         which we're now using instead of passing MemberInfo[]'s around to
7700         avoid copying this array unnecessarily.
7701         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
7702         (ICachingMemberFinder, IMemberContainer): New interface.
7703         (TypeManager.FilterWithClosure): If `criteria' is null, the name
7704         has already been checked, otherwise use it for the name comparision.
7705         (TypeManager.FindMembers): Renamed to RealMemberFinder and
7706         provided wrapper which tries to use ICachingMemberFinder.FindMembers
7707         if possible.  Returns a MemberList, not a MemberInfo [].
7708         (TypeHandle): New class, implements IMemberContainer.  We create
7709         one instance of this class per type, it contains a MemberCache
7710         which is used to do the member lookups.
7711         (MemberCache): New class.  Each instance of this class contains
7712         all members of a type and a name-based hash table.
7713         (MemberCache.FindMembers): This is our new member lookup
7714         function.  First, it looks up all members of the requested name in
7715         the hash table.  Then, it walks this list and sorts out all
7716         applicable members and returns them.
7717
7718 2002-08-13  Martin Baulig  <martin@gnome.org>
7719
7720         In addition to a nice code cleanup, this gives us a performance
7721         increase of about 1.4% on GNU/Linux - not much, but it's already
7722         half a second for the self-hosting MCS compilation.
7723
7724         * typemanager.cs (IMemberFinder): New interface.  It is used by
7725         TypeManager.FindMembers to call FindMembers on a TypeContainer,
7726         Enum, Delegate or Interface.
7727         (TypeManager.finder_to_member_finder): New PtrHashtable.
7728         (TypeManager.finder_to_container): Removed.
7729         (TypeManager.finder_to_delegate): Removed.
7730         (TypeManager.finder_to_interface): Removed.
7731         (TypeManager.finder_to_enum): Removed.
7732
7733         * interface.cs (Interface): Implement IMemberFinder.
7734
7735         * delegate.cs (Delegate): Implement IMemberFinder.
7736
7737         * enum.cs (Enum): Implement IMemberFinder.
7738
7739         * class.cs (TypeContainer): Implement IMemberFinder.
7740
7741 2002-08-12  Martin Baulig  <martin@gnome.org>
7742
7743         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
7744
7745 2002-08-12  Martin Baulig  <martin@gnome.org>
7746
7747         * ecore.cs (ITypeExpression): New interface for expressions which
7748         resolve to a type.
7749         (TypeExpression): Renamed to TypeLookupExpression.
7750         (Expression.DoResolve): If we're doing a types-only lookup, the
7751         expression must implement the ITypeExpression interface and we
7752         call DoResolveType() on it.
7753         (SimpleName): Implement the new ITypeExpression interface.
7754         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
7755         hack, the situation that we're only looking up types can't happen
7756         anymore when this method is called.  Moved the type lookup code to
7757         DoResolveType() and call it.
7758         (SimpleName.DoResolveType): This ITypeExpression interface method
7759         is now doing the types-only lookup.
7760         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
7761         (ResolveFlags): Added MaskExprClass.
7762
7763         * expression.cs (MemberAccess): Implement the ITypeExpression
7764         interface.
7765         (MemberAccess.DoResolve): Added support for a types-only lookup
7766         when we're called via ITypeExpression.DoResolveType().
7767         (ComposedCast): Implement the ITypeExpression interface.
7768
7769         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
7770         Expression.Resolve() with ResolveFlags.Type instead.
7771
7772 2002-08-12  Martin Baulig  <martin@gnome.org>
7773
7774         * interface.cs (Interface.Define): Apply attributes.
7775
7776         * attribute.cs (Attribute.ApplyAttributes): Added support for
7777         interface attributes.
7778
7779 2002-08-11  Martin Baulig  <martin@gnome.org>
7780
7781         * statement.cs (Block.Emit): Only check the "this" variable if we
7782         do not always throw an exception.
7783
7784         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
7785         whether the property has a set accessor.
7786
7787 2002-08-11  Martin Baulig  <martin@gnome.org>
7788
7789         Added control flow analysis support for structs.
7790
7791         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
7792         with control flow analysis turned off.
7793         (IVariable): New interface.
7794         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
7795         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
7796         (FieldExpr.DoResolve): Resolve the instance expression with flow
7797         analysis turned off and do the definite assignment check after the
7798         resolving when we know what the expression will resolve to.
7799
7800         * expression.cs (LocalVariableReference, ParameterReference):
7801         Implement the new IVariable interface, only call the flow analysis
7802         code if ec.DoFlowAnalysis is true.
7803         (This): Added constructor which takes a Block argument.  Implement
7804         the new IVariable interface.
7805         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
7806         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
7807         This does the definite assignment checks for struct members.
7808
7809         * class.cs (Constructor.Emit): If this is a non-static `struct'
7810         constructor which doesn't have any initializer, call
7811         Block.AddThisVariable() to tell the flow analysis code that all
7812         struct elements must be initialized before control returns from
7813         the constructor.
7814
7815         * statement.cs (MyStructInfo): New public class.
7816         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
7817         argument to this indexer.  If non-zero, check an individual struct
7818         member, not the whole struct.
7819         (FlowBranching.CheckOutParameters): Check struct members.
7820         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
7821         overloaded versions of these methods which take an additional
7822         `int field_idx' argument to check struct members.
7823         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
7824         overloaded versions of these methods which take an additional
7825         `string field_name' argument to check struct member.s
7826         (VariableInfo): Implement the IVariable interface.
7827         (VariableInfo.StructInfo): New public property.  Returns the
7828         MyStructInfo instance of the variable if it's a struct or null.
7829         (Block.AddThisVariable): New public method.  This is called from
7830         Constructor.Emit() for non-static `struct' constructor which do
7831         not have any initializer.  It creates a special variable for the
7832         "this" instance variable which will be checked by the flow
7833         analysis code to ensure that all of the struct's fields are
7834         initialized before control returns from the constructor.
7835         (UsageVector): Added support for struct members.  If a
7836         variable/parameter is a struct with N members, we reserve a slot
7837         in the usage vector for each member.  A struct is considered fully
7838         initialized if either the struct itself (slot 0) or all its
7839         members are initialized.
7840
7841 2002-08-08  Martin Baulig  <martin@gnome.org>
7842
7843         * driver.cs (Driver.MainDriver): Only report an error CS5001
7844         if there were no compilation errors.
7845
7846         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
7847         `UnsafeContext' property to determine whether the parent is in
7848         unsafe context rather than checking the parent's ModFlags:
7849         classes nested in an unsafe class are unsafe as well.
7850
7851 2002-08-08  Martin Baulig  <martin@gnome.org>
7852
7853         * statement.cs (UsageVector.MergeChildren): Distinguish between
7854         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
7855         we return.  Added test17() and test18() to test-154.cs.
7856
7857 2002-08-08  Martin Baulig  <martin@gnome.org>
7858
7859         * typemanager.cs (TypeManager.FilterWithClosure): If we have
7860         Family access, make sure the invoking type isn't a subclass of the
7861         queried type (that'd be a CS1540).
7862
7863         * ecore.cs (Expression.MemberLookup): Added overloaded version of
7864         this method which takes an additional `Type invocation_type'.
7865
7866         * expression.cs (BaseAccess.DoResolve): Use the base type as
7867         invocation and query type.
7868         (MemberAccess.DoResolve): If the lookup failed and we're about to
7869         report a CS0122, try a lookup with the ec.ContainerType - if this
7870         succeeds, we must report a CS1540.
7871
7872 2002-08-08  Martin Baulig  <martin@gnome.org>
7873
7874         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
7875         (MethodGroupExpr): Implement the IMemberExpr interface.
7876
7877         * expression (MemberAccess.ResolveMemberAccess): No need to have
7878         any special code for MethodGroupExprs anymore, they're now
7879         IMemberExprs.   
7880
7881 2002-08-08  Martin Baulig  <martin@gnome.org>
7882
7883         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
7884         Family, FamANDAssem and FamORAssem permissions.
7885         (TypeManager.IsSubclassOrNestedChildOf): New public method.
7886
7887 2002-08-08  Martin Baulig  <martin@gnome.org>
7888
7889         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
7890         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
7891         or loop block.
7892
7893 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
7894
7895         * driver.cs: implemented /resource option to embed managed resources.
7896
7897 2002-08-07  Martin Baulig  <martin@gnome.org>
7898
7899         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
7900         (FieldBase.HasFieldInitializer): New public property.
7901         (FieldBase.GetInitializerExpression): New public method.  Resolves and
7902         returns the field initializer and makes sure it is only resolved once.
7903         (TypeContainer.EmitFieldInitializers): Call
7904         FieldBase.GetInitializerExpression to get the initializer, this ensures
7905         that it isn't resolved multiple times.
7906
7907         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
7908         the resolving process (SimpleName/MemberLookup) that we're currently
7909         emitting a field initializer (which must not access any instance members,
7910         this is an error CS0236).
7911
7912         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
7913         argument, if the `IsFieldInitializer' flag is set, we must report and
7914         error CS0236 and not an error CS0120.   
7915
7916 2002-08-07  Martin Baulig  <martin@gnome.org>
7917
7918         * ecore.cs (IMemberExpr): New public interface.
7919         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
7920         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
7921         if the expression is an IMemberExpr.
7922
7923         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
7924         to be null, implicitly default to `this' if we're non-static in
7925         this case.  Simplified the code a lot by using the new IMemberExpr
7926         interface.  Also fixed bug #28176 here.
7927
7928 2002-08-06  Martin Baulig  <martin@gnome.org>
7929
7930         * cs-parser.jay (SimpleLookup): Removed.  We need to create
7931         ParameterReferences during semantic analysis so that we can do a
7932         type-only search when resolving Cast, TypeOf and SizeOf.
7933         (block): Pass the `current_local_parameters' to the Block's
7934         constructor.
7935
7936         * class.cs (ConstructorInitializer): Added `Parameters parameters'
7937         argument to the constructor.
7938         (ConstructorInitializer.Resolve): Create a temporary implicit
7939         block with the parameters.
7940
7941         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
7942         references here if we aren't doing a type-only search.
7943
7944         * statement.cs (Block): Added constructor which takes a
7945         `Parameters parameters' argument.
7946         (Block.Parameters): New public property.
7947
7948         * support.cs (InternalParameters.Parameters): Renamed `parameters'
7949         to `Parameters' and made it public readonly.
7950
7951 2002-08-06  Martin Baulig  <martin@gnome.org>
7952
7953         * ecore.cs (Expression.Warning): Made this public as well.
7954
7955         * report.cs (Report.Debug): Print the contents of collections.
7956
7957 2002-08-06  Martin Baulig  <martin@gnome.org>
7958
7959         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
7960         used to tell Resolve() which kinds of expressions it may return.
7961         (Expression.Resolve): Added overloaded version of this method which
7962         takes a `ResolveFlags flags' argument.  This can be used to tell
7963         Resolve() which kinds of expressions it may return.  Reports a
7964         CS0118 on error.
7965         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
7966         ResolveFlags.SimpleName.
7967         (Expression.Error118): Added overloaded version of this method which
7968         takes a `ResolveFlags flags' argument.  It uses the flags to determine
7969         which kinds of expressions are allowed.
7970
7971         * expression.cs (Argument.ResolveMethodGroup): New public method.
7972         Resolves an argument, but allows a MethodGroup to be returned.
7973         This is used when invoking a delegate.
7974
7975         * TODO: Updated a bit.
7976
7977 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7978
7979         Fixed compilation with csc.
7980
7981         * ecore.cs: Expression.Error made public. Is this correct? Should
7982         Warning be made public too?
7983
7984         * expression.cs: use ea.Location instead of ea.loc.
7985         [FIXME:  Filed as bug #28607: MCS must report these errors.]
7986
7987 2002-08-06  Martin Baulig  <martin@gnome.org>
7988
7989         * ecore.cs (Expression.loc): Moved the location here instead of
7990         duplicating it in all derived classes.
7991         (Expression.Location): New public property.
7992         (Expression.Error, Expression.Warning): Made them non-static and
7993         removed the location argument.
7994         (Expression.Warning): Added overloaded version which takes an
7995         `int level' argument.
7996         (Expression.Error118): Make this non-static and removed the
7997         expression and location arguments.
7998         (TypeExpr): Added location argument to the constructor.
7999
8000         * expression.cs (StaticCallExpr): Added location argument to
8001         the constructor.
8002         (Indirection, PointerArithmetic): Likewise.
8003         (CheckedExpr, UnCheckedExpr): Likewise.
8004         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
8005         (StringPtr): Likewise.
8006
8007
8008 2002-08-05  Martin Baulig  <martin@gnome.org>
8009
8010         * expression.cs (BaseAccess.DoResolve): Actually report errors.
8011
8012         * assign.cs (Assign.DoResolve): Check whether the source
8013         expression is a value or variable.
8014
8015         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
8016         while resolving the corresponding blocks.
8017
8018         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
8019         an error, don't silently return null.
8020
8021         * statement.cs (Block.AddVariable): Do the error reporting here
8022         and distinguish between CS0128 and CS0136.
8023         (Block.DoResolve): Report all unused labels (warning CS0164).
8024         (LabeledStatement): Pass the location to the constructor.
8025         (LabeledStatement.HasBeenReferenced): New property.
8026         (LabeledStatement.Resolve): Set it to true here.
8027
8028         * statement.cs (Return.Emit): Return success even after reporting
8029         a type mismatch error (CS0126 or CS0127), this is what csc does and
8030         it avoids confusing the users with any consecutive errors.
8031
8032 2002-08-05  Martin Baulig  <martin@gnome.org>
8033
8034         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
8035
8036         * const.cs (Const.LookupConstantValue): Catch circular definitions.
8037
8038         * expression.cs (MemberAccess.DoResolve): Silently return if an
8039         error has already been reported.
8040
8041         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
8042         error has already been reported.
8043
8044 2002-08-05  Martin Baulig  <martin@gnome.org>
8045
8046         * statement.cs (UsageVector): Only initialize the `parameters'
8047         vector if we actually have any "out" parameters.
8048
8049 2002-08-05  Martin Baulig  <martin@gnome.org>
8050
8051         * expression.cs (Binary.ResolveOperator): When combining delegates,
8052         they must have the same type.
8053
8054 2002-08-05  Martin Baulig  <martin@gnome.org>
8055
8056         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
8057         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
8058         work with the ms runtime and we also don't need it: if we're a
8059         PropertyBuilder and not in the `indexer_arguments' hash, then we
8060         are a property and not an indexer.
8061
8062         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
8063         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
8064         since the latter one doesn't work with the ms runtime.
8065
8066 2002-08-03  Martin Baulig  <martin@gnome.org>
8067
8068         Fixed bugs #27998 and #22735.
8069
8070         * class.cs (Method.IsOperator): New public field.
8071         (Method.CheckBase): Report CS0111 if there's already a method
8072         with the same parameters in the current class.  Report CS0508 when
8073         attempting to change the return type of an inherited method.
8074         (MethodData.Emit): Report CS0179 if a method doesn't have a body
8075         and it's not marked abstract or extern.
8076         (PropertyBase): New abstract base class for Property and Indexer.
8077         (PropertyBase.CheckBase): Moved here from Property and made it work
8078         for indexers.
8079         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
8080         the same so we can reuse it there.
8081         (Property, Indexer): Derive from PropertyBase.
8082         (MethodSignature.inheritable_property_signature_filter): New delegate
8083         to find properties and indexers.
8084
8085         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
8086         argument and improved error reporting.
8087
8088         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
8089         EmptyReadOnlyParameters and made it a property.
8090
8091         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
8092         version of this method which takes a `PropertyInfo indexer'.
8093         (TypeManager.RegisterIndexer): New method.
8094
8095         * class.cs: Added myself as author of this file :-)
8096
8097 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8098
8099         * class.cs: fixed compilation on windoze.
8100
8101 2002-08-03  Martin Baulig  <martin@gnome.org>
8102
8103         * interface.cs (Interface.GetInterfaceBases): Check whether all
8104         base interfaces are at least as accessible than the current one.
8105
8106         * class.cs (TypeContainer.GetClassBases): Check whether base types
8107         are at least as accessible than the current type.
8108         (TypeContainer.AsAccessible): Implemented and made non-static.
8109         (MemberBase.CheckParameters): Report errors if the accessibility
8110         checks fail.
8111
8112         * delegate.cs (Delegate.Delegate): The default visibility is
8113         internal for top-level types and private for nested types.
8114         (Delegate.Define): Report errors if the accessibility checks fail.
8115
8116         * enum.cs (Enum.Enum): The default visibility is internal for
8117         top-level types and private for nested types.
8118         (Enum.DefineType): Compute the correct visibility.
8119
8120         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
8121         function which takes a `bool is_toplevel' instead of a TypeContainer.
8122
8123         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
8124         builtin type.
8125
8126 2002-08-02  Martin Baulig  <martin@gnome.org>
8127
8128         * expression.cs (LocalVariableReferenc): Added constructor which
8129         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
8130         (LocalVariableReference.IsReadOnly): New property.
8131         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
8132         variable is readonly, use our own readonly flag to do this; you can
8133         use the new constructor to get a writable reference to a read-only
8134         variable.
8135
8136         * cs-parser.jay (foreach_statement, using_statement): Get a writable
8137         reference to the local variable.
8138
8139 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
8140
8141         * rootcontext.cs (ResolveCore): Also include System.Exception
8142
8143         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
8144         we reach an EmptyStatement.
8145
8146         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
8147         is also fine.
8148
8149         * expression.cs (Binary.ResolveOperator): Check error result in
8150         two places.
8151
8152         use brtrue/brfalse directly and avoid compares to null.
8153
8154 2002-08-02  Martin Baulig  <martin@gnome.org>
8155
8156         * class.cs (TypeContainer.Define): Define all nested interfaces here.
8157         Fixes bug #28407, added test-155.cs.
8158
8159 2002-08-01  Martin Baulig  <martin@gnome.org>
8160
8161         * class.cs (Event.EmitDefaultMethod): Make this work with static
8162         events.  Fixes #28311, added verify-3.cs.
8163
8164 2002-08-01  Martin Baulig  <martin@gnome.org>
8165
8166         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
8167         `is_disposable' fields.
8168         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
8169         `hm.is_disposable' if we're using the collection pattern.
8170         (Foreach.EmitCollectionForeach): Use the correct type for the
8171         enumerator's local variable, only emit the try/finally block if
8172         necessary (fixes #27713).
8173
8174 2002-08-01  Martin Baulig  <martin@gnome.org>
8175
8176         * ecore.cs (Expression.report118): Renamed to Error118 and made
8177         it public static.
8178
8179         * statement.cs (Throw.Resolve): Check whether the expression is of
8180         the correct type (CS0118) and whether the type derives from
8181         System.Exception (CS0155).
8182         (Catch.Resolve): New method.  Do the type lookup here and check
8183         whether it derives from System.Exception (CS0155).
8184         (Catch.CatchType, Catch.IsGeneral): New public properties.
8185
8186         * typemanager.cs (TypeManager.exception_type): Added.
8187
8188 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
8189
8190         * driver.cs: Updated About function.
8191
8192 2002-07-31  Martin Baulig  <martin@gnome.org>
8193
8194         Implemented Control Flow Analysis.
8195
8196         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
8197         (EmitContext.CurrentBranching): Added.
8198         (EmitContext.StartFlowBranching): Added.
8199         (EmitContext.EndFlowBranching): Added.
8200         (EmitContext.KillFlowBranching): Added.
8201         (EmitContext.IsVariableAssigned): Added.
8202         (EmitContext.SetVariableAssigned): Added.
8203         (EmitContext.IsParameterAssigned): Added.
8204         (EmitContext.SetParameterAssigned): Added.
8205         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
8206         Added control flow analysis stuff here.
8207
8208         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
8209         resolve the expression as lvalue.
8210         (LocalVariableReference.DoResolve): Check whether the variable has
8211         already been assigned.
8212         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
8213         the parameter as assigned here.
8214         (ParameterReference.DoResolve): Check whether the parameter has already
8215         been assigned.
8216         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
8217         expression as lvalue.
8218
8219         * statement.cs (FlowBranching): New class for the flow analysis code.
8220         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
8221         (LabeledStatement.IsDefined): New public property.
8222         (LabeledStatement.AddUsageVector): New public method to tell flow
8223         analyis that the label may be reached via a forward jump.
8224         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
8225         flow analysis.
8226         (VariableInfo.Number): New public field.  This is used by flow analysis
8227         to number all locals of a block.
8228         (Block.CountVariables): New public property.  This is the number of
8229         local variables in this block (including the locals from all parent
8230         blocks).
8231         (Block.EmitMeta): Number all the variables.
8232
8233         * statement.cs: Added flow analysis support to all classes.
8234
8235 2002-07-31  Martin Baulig  <martin@gnome.org>
8236
8237         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
8238         To get debugging messages, compile mcs with /define:MCS_DEBUG and
8239         then use this argument.
8240
8241         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
8242
8243         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
8244         use this to specify /define options.
8245
8246 2002-07-29  Martin Baulig  <martin@gnome.org>
8247
8248         * statement.cs (Fixed): Moved all code that does variable lookups
8249         and resolvings from Emit to Resolve.
8250
8251         * statement.cs (For): Moved all code that does variable lookups
8252         and resolvings from Emit to Resolve.
8253
8254         * statement.cs (Using): Moved all code that does variable lookups
8255         and resolvings from Emit to Resolve.
8256
8257 2002-07-29  Martin Baulig  <martin@gnome.org>
8258
8259         * attribute.cs (Attribute.Resolve): Explicitly catch a
8260         System.NullReferenceException when creating the
8261         CustromAttributeBuilder and report a different warning message.
8262
8263 2002-07-29  Martin Baulig  <martin@gnome.org>
8264
8265         * support.cs (ParameterData.ParameterName): Added method to
8266         get the name of a parameter.
8267
8268         * typemanager.cs (TypeManager.IsValueType): New public method.
8269
8270 2002-07-29  Martin Baulig  <martin@gnome.org>
8271
8272         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
8273         is a flag which specifies that it's either ref or out.
8274         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
8275         the out parameter to `out Parameter.Modifier mod', also set the
8276         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
8277
8278         * support.cs (InternalParameters.ParameterModifier): Distinguish
8279         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
8280         Parameter.Modifier.ISBYREF flag if it's either ref or out.
8281
8282         * expression.cs (Argument.GetParameterModifier): Distinguish
8283         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
8284         Parameter.Modifier.ISBYREF flag if it's either ref or out.
8285
8286 2002-07-29  Martin Baulig  <martin@gnome.org>
8287
8288         * expression.cs (ParameterReference.ParameterReference): Added
8289         `Location loc' argument to the constructor.
8290
8291         * cs-parser.jay: Pass location to ParameterReference.
8292
8293 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
8294
8295         * statement.cs (Try): Initialize the location.
8296
8297         * cs-parser.jay: pass location to Try.
8298
8299         * expression.cs (Unary.Reduce): Change the prototype to return
8300         whether a constant fold could be performed or not.  The result is
8301         returned in an out parameters.  In the case of Indirection and
8302         AddressOf, we want to perform the full tests.
8303
8304 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
8305
8306         * statement.cs (Statement.Emit): Flag dead code.
8307
8308 2002-07-27  Andrew Birkett  <andy@nobugs.org>
8309
8310         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
8311
8312 2002-07-27  Martin Baulig  <martin@gnome.org>
8313
8314         * class.cs (MethodData.Define): Put back call to
8315         TypeManager.AddMethod(), accidentally commented this out.
8316
8317         * report.cs (Debug): New public method to print debugging information,
8318         this is `[Conditional ("DEBUG")]'.
8319
8320 2002-07-26  Martin Baulig  <martin@gnome.org>
8321
8322         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
8323         (switch_statement): Push the current_block to the switch_stack and
8324         pop it again when we're done with the switch.
8325         (switch_section): The new block is a child of the current_block.
8326         Fixes bug #24007, added test-152.cs.
8327
8328 2002-07-27  Martin Baulig  <martin@gnome.org>
8329
8330         * expression.cs (Invocation.EmitArguments): When calling a varargs
8331         function with only its fixed arguments, we need to pass an empty
8332         array.
8333
8334 2002-07-27  Martin Baulig  <martin@gnome.org>
8335
8336         Mono 0.13 has been released.
8337
8338 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
8339
8340         * driver.cs: Rename --resource to --linkres, because that is what
8341         we do currently, we dont support --resource yet.
8342
8343         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
8344
8345 2002-07-25  Martin Baulig  <martin@gnome.org>
8346
8347         * class.cs (MethodData): New public class.  This is a `method builder'
8348         class for a method or one accessor of a Property/Indexer/Event.
8349         (MethodData.GetMethodFlags): Moved here from MemberBase.
8350         (MethodData.ApplyAttributes): Likewise.
8351         (MethodData.ApplyObsoleteAttribute): Likewise.
8352         (MethodData.ApplyConditionalAttribute): Likewise.
8353         (MethodData.ApplyDllImportAttribute): Likewise.
8354         (MethodData.CheckAbstractAndExternal): Likewise.
8355         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
8356         (MethodData.Emit): Formerly known as Method.Emit().
8357         (MemberBase): Moved everything which was specific to a single
8358         accessor/method to MethodData.
8359         (Method): Create a new MethodData and call Define() and Emit() on it.
8360         (Property, Indexer, Event): Create a new MethodData objects for each
8361         accessor and call Define() and Emit() on them.
8362
8363 2002-07-25  Martin Baulig  <martin@gnome.org>
8364
8365         Made MethodCore derive from MemberBase to reuse the code from there.
8366         MemberBase now also checks for attributes.
8367
8368         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
8369         (MemberBase.GetMethodFlags): Moved here from class Method and marked
8370         as virtual.
8371         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
8372         `CallingConventions cc' and `Attributes opt_attrs' arguments.
8373         (MemberBase.ApplyAttributes): New virtual method; applies the
8374         attributes to a method or accessor.
8375         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
8376         (MemberBase.ApplyConditionalAttribute): Likewise.
8377         (MemberBase.ApplyDllImportAttribute): Likewise.
8378         (MemberBase.CheckAbstractAndExternal): Likewise.
8379         (MethodCore.ParameterTypes): This is now a property instead of a
8380         method, it's initialized from DoDefineParameters().
8381         (MethodCore.ParameterInfo): Removed the set accessor.
8382         (MethodCore.DoDefineParameters): New protected virtual method to
8383         initialize ParameterTypes and ParameterInfo.
8384         (Method.GetReturnType): We can now simply return the MemberType.
8385         (Method.GetMethodFlags): Override the MemberBase version and add
8386         the conditional flags.
8387         (Method.CheckBase): Moved some code from Define() here, call
8388         DoDefineParameters() here.
8389         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
8390         here to avoid some larger code duplication.
8391         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
8392         ensure that abstract and external accessors don't declare a body.
8393
8394         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
8395         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
8396         lookup in the attribute's parent classes, so we need to abort as soon
8397         as we found the first match.
8398         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
8399         the attribute has no arguments.
8400
8401         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
8402         of a Method.
8403
8404 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8405
8406         * cs-parser.jay: reverted previous patch.
8407
8408 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8409
8410         * cs-parser.jay: fixed bug #22119.
8411
8412 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8413
8414         * attribute.cs: fixed compilation. The error was:
8415         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
8416         be assigned to before control leaves the current method."
8417         [FIXME:  Filed as bug #28186: MCS must report this error.]
8418
8419 2002-07-25  Martin Baulig  <martin@gnome.org>
8420
8421         * attribute.cs (Attribute.Conditional_GetConditionName): New static
8422         method to pull the condition name ouf of a Conditional attribute.
8423         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
8424         the obsolete message and error flag out of an Obsolete attribute.
8425
8426         * class.cs (Method.GetMethodFlags): New public method to get the
8427         TypeManager.MethodFlags for this method.
8428         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
8429         private methods.
8430         (Method.Define): Get and apply the Obsolete and Conditional attributes;
8431         if we're overriding a virtual function, set the new private variable
8432         `parent_method'; call the new TypeManager.AddMethod().
8433
8434         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
8435         the MethodBuilder and the Method in a PtrHashtable.
8436         (TypeManager.builder_to_method): Added for this purpose.
8437         (TypeManager.MethodFlags): Added IsObsoleteError.
8438         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
8439         Obsolete and Conditional arguments in MethodBuilders.  If we discover
8440         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
8441         the message from the attribute.
8442
8443 2002-07-24  Martin Baulig  <martin@gnome.org>
8444
8445         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
8446         preprocessor directives, ensure that the argument to #define/#undef is
8447         exactly one identifier and that it's actually an identifier.
8448
8449         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
8450         did not work ....
8451
8452 2002-07-24  Martin Baulig  <martin@gnome.org>
8453
8454         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
8455         initialize it to TypeManager.object_type in the constructor.
8456         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
8457         of the `hm.get_current' method if we're using the collection pattern.
8458         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
8459         for the explicit conversion to make it work when we're using the collection
8460         pattern and the `Current' property has a different return type than `object'.
8461         Fixes #27713.
8462
8463 2002-07-24  Martin Baulig  <martin@gnome.org>
8464
8465         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
8466         does not match, but don't report any errors.  This method is called in
8467         order for all methods in a MethodGroupExpr until a matching method is
8468         found, so we don't want to bail out if the first method doesn't match.
8469         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
8470         matches, report the 123.  Fixes #28070.
8471
8472 2002-07-24  Martin Baulig  <martin@gnome.org>
8473
8474         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
8475         TypeManager.TypeToCoreType() to the top of the method so the
8476         following equality checks will work.  Fixes #28107.
8477
8478 2002-07-24  Martin Baulig  <martin@gnome.org>
8479
8480         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
8481         operand is of type uint, and the other operand is of type sbyte,
8482         short or int, the operands are converted to type long." -
8483         Actually do what this comment already told us.  Fixes bug #28106,
8484         added test-150.cs.
8485
8486 2002-07-24  Martin Baulig  <martin@gnome.org>
8487
8488         * class.cs (MethodBase): New abstract class.  This is now a base
8489         class for Property, Indexer and Event to avoid some code duplication
8490         in their Define() and DefineMethods() methods.
8491         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
8492         generic methods for Define() and DefineMethods().
8493         (FieldBase): Derive from MemberBase, not MemberCore.
8494         (Property): Derive from MemberBase, not MemberCore.
8495         (Property.DefineMethod): Moved all the code from this method to the
8496         new MethodBase.DefineAccessor(), just call it with appropriate
8497         argumetnts.
8498         (Property.Define): Call the new Property.DoDefine(), this does some
8499         sanity checks and we don't need to duplicate the code everywhere.
8500         (Event): Derive from MemberBase, not MemberCore.
8501         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
8502         accessors, this will also make them work with interface events.
8503         (Indexer): Derive from MemberBase, not MemberCore.
8504         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
8505         (Indexer.Define): Use the new MethodBase functions.
8506
8507         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
8508         argument to the constructor.
8509         (Interface.FindMembers): Added support for interface events.
8510         (Interface.PopluateEvent): Implemented.
8511
8512         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
8513
8514 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
8515
8516         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
8517         but this is required to check for a method name being the same as
8518         the containing class.  
8519
8520         Handle this now.
8521
8522 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8523
8524         * interface.cs: initialize variable.
8525
8526 2002-07-23  Martin Baulig  <martin@gnome.org>
8527
8528         Implemented the IndexerName attribute in interfaces.
8529
8530         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
8531         name if this is an explicit interface implementation.
8532         (Indexer.InterfaceIndexerName): New public variable.  If we're
8533         implementing an interface indexer, this is the IndexerName in that
8534         interface.  Otherwise, it's the IndexerName.
8535         (Indexer.DefineMethod): If we're implementing interface indexer,
8536         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
8537         and Pending.ImplementIndexer methods.
8538         (Indexer.Define): Also define the PropertyBuilder if we're
8539         implementing an interface indexer and this is neither an explicit
8540         interface implementation nor do the IndexerName match the one in
8541         the interface.
8542
8543         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
8544         If a method is defined here, then we always need to create a proxy
8545         for it.  This is used when implementing interface indexers.
8546         (Pending.IsInterfaceIndexer): New public method.
8547         (Pending.ImplementIndexer): New public method.
8548         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
8549         This is used when implementing interface indexers to define a proxy
8550         if necessary.
8551         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
8552         define a proxy if necessary.
8553
8554         * interface.cs (Interface.IndexerName): New public variable.
8555         (Interface.PopulateIndexer): Set the IndexerName.
8556         (Interface.DefineIndexers): New private method.  Populate all the
8557         indexers and make sure their IndexerNames match.
8558
8559         * typemanager.cs (IndexerPropertyName): Added support for interface
8560         indexers.
8561
8562 2002-07-22  Martin Baulig  <martin@gnome.org>
8563
8564         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
8565         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
8566         ret if HasReturnLabel.
8567         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
8568         variables.
8569
8570         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
8571         and set the ec.LoopBeginTryCatchLevel.
8572         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
8573         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
8574         the current ec.TryCatchLevel, the branch goes out of an exception
8575         block.  In this case, we need to use Leave and not Br.
8576
8577 2002-07-22  Martin Baulig  <martin@gnome.org>
8578
8579         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
8580         block unless the block does not always return or it is contained in
8581         another try { ... } catch { ... } block.  Fixes bug #26506.
8582         Added verify-1.cs to the test suite.
8583
8584 2002-07-22  Martin Baulig  <martin@gnome.org>
8585
8586         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
8587         then we do not always return.  Fixes bug #24985.
8588
8589 2002-07-22  Martin Baulig  <martin@gnome.org>
8590
8591         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
8592         lookup on a per-class level; ie. walk up the class hierarchy until we
8593         found at least one applicable method, then choose the best among them.
8594         Fixes bug #24463 and test-29.cs.
8595
8596 2002-07-22  Martin Baulig  <martin@gnome.org>
8597
8598         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
8599         return types of the methods.  The return type is not part of the
8600         signature and we must not check it to make the `new' modifier work.
8601         Fixes bug #27999, also added test-147.cs.
8602         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
8603
8604         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
8605         on the method's return type.
8606
8607 2002-07-21  Martin Baulig  <martin@gnome.org>
8608
8609         * assign.cs: Make this work if the rightmost source is a constant and
8610         we need to do an implicit type conversion.  Also adding a few more tests
8611         to test-38.cs which should have caught this.
8612
8613         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
8614         target in the makefile for this.  The makefile.gnu is primarily intended
8615         for end-users who don't want to debug the compiler.
8616
8617 2002-07-21  Martin Baulig  <martin@gnome.org>
8618
8619         * assign.cs: Improved the Assign class so it can now handle embedded
8620         assignments (X = Y = Z = something).  As a side-effect this'll now also
8621         consume less local variables.  test-38.cs now passes with MCS, added
8622         a few new test cases to that test.
8623
8624 2002-07-20  Martin Baulig  <martin@gnome.org>
8625
8626         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
8627         instructions.  Fixes bug #27977, also added test-146.cs.
8628
8629 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8630
8631         * cs-tokenizer.cs: fixed getHex ().
8632
8633 2002-07-19  Martin Baulig  <martin@gnome.org>
8634
8635         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
8636         not Type.GetType() to lookup the array type.  This is needed when
8637         we're constructing an array of a user-defined type.
8638         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
8639         single-dimensional arrays, but also for single-dimensial arrays of
8640         type decimal.
8641
8642 2002-07-19  Martin Baulig  <martin@gnome.org>
8643
8644         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
8645         this function is called, it's not allowed to share LocalBuilders
8646         among ILGenerators.
8647
8648 2002-07-19  Martin Baulig  <martin@gnome.org>
8649
8650         * expression.cs (Argument.Resolve): Report an error 118 when trying
8651         to pass a type as argument.
8652
8653 2002-07-18  Martin Baulig  <martin@gnome.org>
8654
8655         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
8656         Conv_R_Un for the signed `long' type.
8657
8658 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
8659
8660         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
8661         `expr' for the temporary result, as that will fail if we do
8662         multiple resolves on the same expression.
8663
8664 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
8665
8666         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
8667         ec.TypeContainer for looking up aliases. 
8668
8669         * class.cs (TypeContainer): Remove LookupAlias from here.
8670
8671         * decl.cs (DeclSpace); Move here.
8672
8673 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
8674
8675         * class.cs (FindMembers): Only call filter if the constructor
8676         bulider is not null.
8677
8678         Also handle delegates in `NestedTypes' now.  Now we will perform
8679         type lookups using the standard resolution process.  This also
8680         fixes a bug.
8681
8682         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
8683         This uses Expressions (the limited kind that can be parsed by the
8684         tree) instead of strings.
8685
8686         * expression.cs (ComposedCast.ToString): Implement, used to flag
8687         errors since now we have to render expressions.
8688
8689         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
8690         FormArrayType. 
8691
8692         * ecore.cs (SimpleName.ToString): ditto.
8693
8694         * cs-parser.jay: Instead of using strings to assemble types, use
8695         Expressions to assemble the type (using SimpleName, ComposedCast,
8696         MemberAccess).  This should fix the type lookups in declarations,
8697         because we were using a different code path for this.
8698
8699         * statement.cs (Block.Resolve): Continue processing statements
8700         even when there is an error.
8701
8702 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
8703
8704         * class.cs (Event.Define): Also remove the `remove' method from
8705         the list of pending items.
8706
8707         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
8708         generate more compact code. 
8709
8710 2002-07-17  Martin Baulig  <martin@gnome.org>
8711
8712         * const.cs (Const.LookupConstantValue): Add support for constant
8713         `unchecked' and `checked' expressions.
8714         Also adding test case test-140.cs for this.
8715
8716 2002-07-17  Martin Baulig  <martin@gnome.org>
8717
8718         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
8719         check whether mi.ReturnType implements the IEnumerator interface; the
8720         `==' and the IsAssignableFrom() will fail in this situation.
8721
8722 2002-07-16  Ravi Pratap  <ravi@ximian.com>
8723
8724         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
8725         here too.
8726
8727 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8728
8729         * expression.cs: fixed bug #27811.
8730
8731 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
8732
8733         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
8734         Molaro: when we are a ref, the value already contains a pointer
8735         value, do not take the address of it.
8736
8737 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
8738         * removed mb-parser.jay and mb-tokenizer.cs
8739
8740 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
8741
8742         * expression.cs: check against the building corlib void type.
8743
8744 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
8745
8746         * ecore.cs: fix for valuetype static readonly fields: when 
8747         initializing them, we need their address, not the address of a copy.
8748
8749 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
8750
8751         * typemanager.cs: register also enum_type in corlib.
8752
8753 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
8754
8755         * class.cs: allow calling this (but not base) initializers in structs.
8756
8757 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
8758
8759         * ecore.cs: make sure we compare against the building base types
8760         in GetTypeSize ().
8761
8762 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
8763
8764         * typemanager.cs: fix TypeToCoreType() to handle void and object
8765         (corlib gets no more typerefs after this change).
8766
8767 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
8768
8769         * expression.cs (ArrayCreation.EmitArrayArguments): use
8770         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
8771
8772         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
8773         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
8774         array indexes, the runtime actually forbids them.
8775
8776         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
8777         for array arguments here.
8778
8779         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
8780         instead of the default for ValueTypes.
8781
8782         (New.DoEmit): Use IsValueType instead of
8783         IsSubclassOf (value_type)
8784         (New.DoResolve): ditto.
8785         (Invocation.EmitCall): ditto.
8786
8787         * assign.cs (Assign): ditto.
8788
8789         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
8790         Statements *are* currently doing part of their resolution during
8791         Emit.  
8792
8793         Expressions do always resolve during resolve, but statements are
8794         only required to propagate resolution to their children.
8795
8796 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
8797
8798         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
8799
8800         (LoadAssembly): Do not add the dll if it is already specified
8801
8802         (MainDriver): Add the System directory to the link path at the end,
8803         after all the other -L arguments. 
8804
8805         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
8806         wrong opcode for loading bytes and bools (ldelem.i1 instead of
8807         ldelem.u1) and using the opposite for sbytes.
8808
8809         This fixes Digger, and we can finally run it.
8810
8811         * driver.cs (UnixParseOption): Move the option parsing here.  
8812         (CSCParseOption): Implement CSC-like parsing of options.
8813
8814         We now support both modes of operation, the old Unix way, and the
8815         new CSC-like way.  This should help those who wanted to make cross
8816         platform makefiles.
8817
8818         The only thing broken is that /r:, /reference: and /lib: are not
8819         implemented, because I want to make those have the same semantics
8820         as the CSC compiler has, and kill once and for all the confussion
8821         around this.   Will be doing this tomorrow.
8822
8823         * statement.cs (Unsafe.Resolve): The state is checked during
8824         resolve, not emit, so we have to set the flags for IsUnsfe here.
8825
8826 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
8827
8828         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
8829         not catch the Error_ObjectRefRequired in SimpleName (as it is
8830         possible to have a class/instance variable name that later gets
8831         deambiguated), we have to check this here.      
8832
8833 2002-07-10  Ravi Pratap  <ravi@ximian.com>
8834
8835         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
8836         make static and put into Expression.
8837
8838         (Event.Define): Register the private field of the event with the 
8839         TypeManager so that GetFieldFromEvent can get at it.
8840
8841         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
8842         keep track of the private field associated with an event which
8843         has no accessors.
8844
8845         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
8846         private field.
8847
8848         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
8849
8850 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
8851
8852         * expression.cs (Binary.EmitBranchable): this routine emits the
8853         Binary expression in a branchable context.  This basically means:
8854         we need to branch somewhere, not just get the value on the stack.
8855
8856         This works together with Statement.EmitBoolExpression.
8857
8858         * statement.cs (Statement.EmitBoolExpression): Use
8859         EmitBranchable. 
8860
8861 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
8862
8863         * statement.cs (For): Reduce the number of jumps in loops.
8864
8865         (For): Implement loop inversion for the For statement.
8866
8867         (Break): We can be breaking out of a Try/Catch controlled section
8868         (foreach might have an implicit try/catch clause), so we need to
8869         use Leave instead of Br.
8870
8871         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
8872         now).  If the instace expression supports IMemoryLocation, we use
8873         the AddressOf method from the IMemoryLocation to extract the
8874         address instead of emitting the instance.
8875
8876         This showed up with `This', as we were emitting the instance
8877         always (Emit) instead of the Address of This.  Particularly
8878         interesting when This is a value type, as we dont want the Emit
8879         effect (which was to load the object).
8880
8881 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
8882
8883         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
8884
8885         * statement.cs (Checked): Set the CheckedState during the resolve
8886         process too, as the ConvCast operations track the checked state on
8887         the resolve process, and not emit.
8888
8889         * cs-parser.jay (namespace_member_declaration): Flag that we have
8890         found a declaration when we do.  This is used to flag error 1529
8891
8892         * driver.cs: Report ok when we display the help only.
8893
8894 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
8895
8896         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
8897
8898 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
8899
8900         * cs-tokenizer.cs (define): We also have to track locally the
8901         defines.  AllDefines is just used for the Conditional Attribute,
8902         but we also need the local defines for the current source code. 
8903
8904 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
8905
8906         * statement.cs (While, For, Do): These loops can exit through a
8907         Break statement, use this information to tell whether the
8908         statement is the last piece of code.
8909
8910         (Break): Flag that we break.
8911
8912         * codegen.cs (EmitContexts): New `Breaks' state variable.
8913
8914 2002-07-03  Martin Baulig  <martin@gnome.org>
8915
8916         * class.cs (TypeContainer.MethodModifiersValid): Allow override
8917         modifiers in method declarations in structs.  Otherwise, you won't
8918         be able to override things like Object.Equals().
8919
8920 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
8921
8922         * class.cs (Method, Property, Indexer): Do not allow the public
8923         modifier to be used in explicit interface implementations.
8924
8925         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
8926         override modifiers in method declarations in structs
8927
8928 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
8929
8930         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
8931         integer or real overflow, report an error
8932
8933 2002-07-02  Martin Baulig  <martin@gnome.org>
8934
8935         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
8936         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
8937         to tell the runtime about our newly created System.Object and
8938         System.ValueType types.
8939
8940 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
8941
8942         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
8943         struct instead of Ldarg/Starg.
8944
8945 2002-07-02  Martin Baulig  <martin@gnome.org>
8946
8947         * expression.cs (Indirection.Indirection): Call
8948         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
8949
8950 2002-07-02  Martin Baulig  <martin@gnome.org>
8951
8952         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
8953         ValueType, call TypeManager.TypeToCoreType() on it.
8954         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
8955         the OpCodes.Newarr argument.
8956
8957 2002-07-02  Martin Baulig  <martin@gnome.org>
8958
8959         * expression.cs (Invocation.EmitCall): When compiling corlib,
8960         replace all calls to the system's System.Array type to calls to
8961         the newly created one.
8962
8963         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
8964         System.Array methods.
8965         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
8966         from the system's System.Array type which must be replaced.
8967
8968 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
8969
8970         * typemanager.cs: load unverifiable_code_ctor so we can build
8971         corlib using the correct type. Avoid using GetTypeCode() with
8972         TypeBuilders.
8973         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
8974         TypeManager.object_type to allow building corlib.
8975
8976 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
8977
8978         * ecore.cs: handle System.Enum separately in LoadFromPtr().
8979
8980 2002-07-01  Martin Baulig  <martin@gnome.org>
8981
8982         * class.cs: Make the last change actually work, we need to check
8983         whether `ifaces != null' to avoid a crash.
8984
8985 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
8986
8987         * class.cs: when we build structs without fields that implement
8988         interfaces, we need to add the interfaces separately, since there is
8989         no API to both set the size and add the interfaces at type creation
8990         time.
8991
8992 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
8993
8994         * expression.cs: the dimension arguments to the array constructors
8995         need to be converted if they are a long.
8996
8997 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
8998
8999         * class.cs: don't emit ldarg.0 if there is no parent constructor
9000         (fixes showstopper for corlib).
9001
9002 2002-06-29  Martin Baulig  <martin@gnome.org>
9003
9004         MCS now compiles corlib on GNU/Linux :-)
9005
9006         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
9007         ie. check for MethodImplOptions.InternalCall.
9008
9009         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
9010         and TypeManager.attribute_type are null, so we must explicitly check
9011         whether parent is not null to find out whether it's an attribute type.
9012         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
9013         and SetBuilder, not only if the property is neither abstract nor external.
9014         This is necessary to set the MethodImplOptions on the accessor methods.
9015         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
9016         SetBuilder, see Property.Emit().
9017
9018         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
9019         populate "System.Object", "System.ValueType" and "System.Attribute" since
9020         they've already been populated from BootCorlib_PopulateCoreTypes().
9021
9022 2002-06-29  Martin Baulig  <martin@gnome.org>
9023
9024         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
9025         is the NullLiteral, we also need to make sure that target_type is not
9026         an enum type.   
9027
9028 2002-06-29  Martin Baulig  <martin@gnome.org>
9029
9030         * rootcontext.cs (RootContext.ResolveCore): We must initialize
9031         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
9032         before calling BootstrapCorlib_ResolveDelegate ().
9033
9034 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
9035
9036         * statement.cs: fixed build-breaker. All tests passed ok.
9037
9038 2002-06-27  Martin Baulig  <martin@gnome.org>
9039
9040         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
9041         for System.Decimal when compiling corlib.
9042
9043 2002-06-27  Martin Baulig  <martin@gnome.org>
9044
9045         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
9046         switch blocks which contain nothing but a default clause.
9047
9048 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
9049
9050        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
9051
9052 2002-06-27  Martin Baulig  <martin@gnome.org>
9053
9054         * ecore.cs (PropertyExpr.PropertyExpr): Call
9055         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
9056
9057         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
9058         is already a TypeBuilder.
9059
9060 2002-06-27  Martin Baulig  <martin@gnome.org>
9061
9062         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
9063         `target_type == TypeManager.array_type', not IsAssignableFrom() in
9064         the "from an array-type to System.Array" case.  This makes it work
9065         when compiling corlib.
9066
9067 2002-06-27  Martin Baulig  <martin@gnome.org>
9068
9069         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
9070         non-static PropertyExpr, set its InstanceExpression.  This makes
9071         the `ICollection.Count' property work in System/Array.cs.
9072
9073 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
9074
9075         * driver.cs: Made error handling more consistent.  Errors now
9076         tracked by Report class, so many methods which used to return int
9077         now return void.  Main() now prints success/failure and 
9078         errors/warnings message.
9079
9080         Renamed '--probe' compiler argument to '--expect-error'.  Removed
9081         the magic number return values (123 and 124).  Now, if the
9082         expected error occurs, the compiler exits with success (exit value
9083         0).  If the compilation completes without seeing that particular
9084         error, the compiler exits with failure (exit value 1).  The
9085         makefile in mcs/errors has been changed to handle the new behaviour.
9086
9087         * report.cs: Made 'expected error' number a property and renamed
9088         it from 'Probe' to 'ExpectedError'.
9089
9090         * genericparser.cs: Removed error handling support, since it is
9091         now all done by Report class.
9092
9093         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
9094         class, so parse() no longer returns an int.
9095
9096         * namespace.cs: Use Report.Error instead of GenericParser.error
9097
9098 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
9099
9100         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
9101         TypeContainer.AddOperator): At the front of the list put the
9102         explicit implementations, so they get resolved/defined first. 
9103
9104 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
9105
9106         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
9107         interface type is implemented by this TypeContainer.  Used during
9108         explicit interface implementation.
9109
9110         (Property.Define, Indexer.Define, Method.Define): Validate that
9111         the given interface in the explicit implementation is one of the
9112         base classes for the containing type.
9113
9114         Also if we are explicitly implementing an interface, but there is
9115         no match in the pending implementation table, report an error.
9116
9117         (Property.Define): Only define the property if we are
9118         not explicitly implementing a property from an interface.  Use the
9119         correct name also for those properties (the same CSC uses,
9120         although that is really not needed).
9121
9122         (Property.Emit): Do not emit attributes for explicitly implemented
9123         properties, as there is no TypeBuilder.
9124
9125         (Indexer.Emit): ditto.
9126
9127         Hiding then means that we do not really *implement* a pending
9128         implementation, which makes code fail.
9129
9130 2002-06-22  Martin Baulig  <martin@gnome.org>
9131
9132         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
9133         the return value of Object.GetType().  [FIXME: we need to do this whenever
9134         we get a type back from the reflection library].
9135
9136 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
9137
9138         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
9139
9140 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
9141
9142         * attribute.cs: Return null if we can not look up the type.
9143
9144         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
9145         the interface types found.
9146
9147         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
9148         interface types found.
9149
9150         * typemanager.cs (GetInterfaces): Make this routine returns alll
9151         the interfaces and work around the lame differences between
9152         System.Type and System.Reflection.Emit.TypeBuilder in the results
9153         result for GetInterfaces.
9154
9155         (ExpandInterfaces): Given an array of interface types, expand and
9156         eliminate repeated ocurrences of an interface.  This expands in
9157         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
9158         be IA, IB, IC.
9159
9160 2002-06-21  Martin Baulig  <martin@gnome.org>
9161
9162         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
9163         on System.Enum.
9164
9165 2002-06-21  Martin Baulig  <martin@gnome.org>
9166
9167         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
9168         and called with one of the core types, return the corresponding typebuilder for
9169         that type.
9170
9171         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
9172         element type.
9173
9174 2002-06-21  Martin Baulig  <martin@gnome.org>
9175
9176         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
9177         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
9178         (Expression.ConvertReferenceExplicit): Likewise.
9179
9180         * expression.cs (ElementAccess.DoResolve): Likewise.
9181         (ElementAccess.DoResolveLValue): Likewise.
9182
9183 2002-06-10  Martin Baulig  <martin@gnome.org>
9184
9185         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
9186         add the "value" parameter to the parameter list.
9187
9188         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
9189         to our caller.
9190
9191 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
9192
9193         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
9194         the argument to an int, uint, long or ulong, per the spec.  Also
9195         catch negative constants in array creation.
9196
9197 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
9198
9199         * class.cs: do not allow the same interface to appear twice in
9200         the definition list.
9201
9202 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
9203
9204         * ecore.cs: don't use ldlen with System.Array.
9205
9206 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
9207
9208         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
9209
9210 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
9211
9212         * modifiers.cs: produce correct field attributes for protected
9213         internal. Easy fix so miguel can work on ther harder stuff:-)
9214
9215 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
9216
9217         * pending.cs: New file.  Move the code from class.cs here.
9218         Support clearning the pending flag for all methods (when not doing
9219         explicit interface implementation).
9220
9221 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
9222
9223         * rootcontext.cs: added a couple more types needed to bootstrap.
9224
9225 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
9226
9227         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
9228         constructor in the type, instead of any constructor in the type
9229         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
9230         a bug in the Mono runtime when applying the params attribute). 
9231
9232 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
9233         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
9234
9235 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
9236
9237         * expression.cs (Unary.ResolveOperator): Use TypeManager
9238         to resolve the type.
9239
9240 2002-06-13  Ravi Pratap  <ravi@ximian.com>
9241
9242         * cs-parser.jay (enum_member_declaration): Pass in the attributes
9243         attached.
9244
9245         * enum.cs (AddEnumMember): Add support to store the attributes associated 
9246         with each member too.
9247
9248         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
9249         field builders too - this takes care of the enum member case.
9250
9251 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
9252
9253         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
9254         address-of operator on both value types and pointers.
9255
9256 2002-06-10  Martin Baulig  <martin@gnome.org>
9257
9258         * interface.cs (Interface.PopulateIndexer): Add the indexer's
9259         PropertyBuilder to the `property_builders' list.
9260
9261         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
9262         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
9263         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
9264         find any indexers which are inherited from an interface.
9265
9266 2002-06-09  Martin Baulig  <martin@gnome.org>
9267
9268         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
9269         the same type as the constant if necessary.  There's also a test-130.cs
9270         for this.
9271
9272         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
9273
9274         * typemanager.cs (TypeManager.ChangeType): Previously known as
9275         Enum.ChangeEnumType().
9276
9277 2002-06-09  Martin Baulig  <martin@gnome.org>
9278
9279         * expression.cs (Cast.TryReduce): Added support for consts.
9280
9281 2002-06-08  Ravi Pratap  <ravi@ximian.com>
9282
9283         * class.cs (Accessor): Hold attributes information so we can pass
9284         it along.
9285
9286         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
9287         Modify to pass in attributes attached to the methods.
9288
9289         (add_accessor_declaration, remove_accessor_declaration): Ditto.
9290
9291         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
9292         to handle the Accessor kind :-)
9293
9294         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
9295
9296 2002-06-08  Martin Baulig  <martin@gnome.org>
9297
9298         * expression.cs (Unary.TryReduceNegative): Added support for
9299         ULongConstants.
9300
9301 2002-06-08  Martin Baulig  <martin@gnome.org>
9302
9303         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
9304         name can't be found in the `defined_names' - the caller will do a
9305         MemberLookup in this case and thus find methods in System.Enum
9306         such as Enum.IsDefined().
9307
9308 2002-06-08  Martin Baulig  <martin@gnome.org>
9309
9310         * enum.cs (Enum.ChangeEnumType): This is a custom version of
9311         Convert.ChangeType() which works with TypeBuilder created types.
9312         (Enum.LookupEnumValue, Enum.Define): Use it here.
9313
9314         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
9315         `TypeBuilder.BaseType != null' check.
9316         (TypeContainer.FindMembers): Only lookup parent members if we
9317         actually have a parent.
9318         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
9319         (ConstructorInitializer.Resolve): Likewise.
9320
9321         * interface.cs (Interface.FindMembers): Added
9322         `TypeBuilder.BaseType != null' check.
9323
9324         * rootcontext.cs (RootContext.ResolveCore): Added
9325         "System.Runtime.CompilerServices.IndexerNameAttribute" to
9326         classes_second_stage.
9327
9328         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
9329         debug_type and trace_type when compiling with --nostdlib.       
9330
9331 2002-06-07  Martin Baulig  <martin@gnome.org>
9332
9333         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
9334         (AddField): Set it to true when adding a non-static field.
9335         (DefineType): Use `have_nonstatic_fields' to find out whether we
9336         have non-static fields, not `Fields != null'.
9337
9338 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
9339
9340         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
9341         dereferencing a null on the static-field code path)
9342
9343 2002-05-30  Martin Baulig  <martin@gnome.org>
9344
9345         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
9346         to take command line arguments.  Use reflection to call the new
9347         custom `Initialize' function on the symbol writer and pass it the
9348         command line arguments.
9349
9350         * driver.cs (--debug-args): New command line argument to pass command
9351         line arguments to the symbol writer.
9352
9353 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
9354
9355         * assign.cs (DoResolve): Forgot to do the implicit conversion to
9356         the target type for indexers and properties.  Thanks to Joe for
9357         catching this.
9358
9359 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
9360
9361         * typemanager.cs (MethodFlags): returns the method flags
9362         (Obsolete/ShouldIgnore) that control warning emission and whether
9363         the invocation should be made, or ignored. 
9364
9365         * expression.cs (Invocation.Emit): Remove previous hack, we should
9366         not do this on matching a base type, we should do this based on an attribute
9367
9368         Only emit calls to System.Diagnostics.Debug and
9369         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
9370         on the command line.
9371
9372         * rootcontext.cs: Global settings for tracing and debugging.
9373
9374         * cs-tokenizer.cs (define): New utility function to track
9375         defines.   Set the global settings for TRACE and DEBUG if found.
9376
9377 2002-05-25  Ravi Pratap  <ravi@ximian.com>
9378
9379         * interface.cs (Populate*): Pass in the TypeContainer as well as
9380         the DeclSpace as parameters so that we can create EmitContexts and
9381         then use that to apply attributes etc.
9382
9383         (PopulateMethod, PopulateEvent, PopulateProperty)
9384         (PopulateIndexer): Apply attributes everywhere.
9385
9386         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
9387         etc.
9388
9389         (ApplyAttributes): Update accordingly.
9390
9391         We now apply interface attributes for all members too.
9392
9393 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
9394
9395         * class.cs (Indexer.Define); Correctly check if we are explicit
9396         implementation (instead of checking the Name for a ".", we
9397         directly look up if the InterfaceType was specified).
9398
9399         Delay the creation of the PropertyBuilder.
9400
9401         Only create the PropertyBuilder if we are not an explicit
9402         interface implementation.   This means that explicit interface
9403         implementation members do not participate in regular function
9404         lookups, and hence fixes another major ambiguity problem in
9405         overload resolution (that was the visible effect).
9406
9407         (DefineMethod): Return whether we are doing an interface
9408         implementation. 
9409
9410         * typemanager.cs: Temporary hack until we get attributes in
9411         interfaces (Ravi is working on that) and we get IndexerName
9412         support in interfaces.
9413
9414         * interface.cs: Register the indexers as properties.
9415
9416         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
9417         warning, I have verified that this is a bug in the .NET runtime
9418         (JavaScript suffers of the same problem).
9419
9420         * typemanager.cs (MemberLookup): When looking up members for
9421         interfaces, the parent of an interface is the implicit
9422         System.Object (so we succeed in searches of Object methods in an
9423         interface method invocation.  Example:  IEnumerable x;  x.ToString
9424         ()) 
9425
9426 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
9427
9428         * class.cs (Event): Events should also register if they do
9429         implement the methods that an interface requires.
9430
9431         * typemanager.cs (MemberLookup); use the new GetInterfaces
9432         method. 
9433
9434         (GetInterfaces): The code used to lookup interfaces for a type is
9435         used in more than one place, factor it here. 
9436
9437         * driver.cs: Track the errors at the bottom of the file, we kept
9438         on going.
9439
9440         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
9441         instance if the method we are calling is static!
9442
9443 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
9444
9445         * attribute.cs (ApplyAttributes): Make this function filter out
9446         the IndexerName attribute (as that attribute in reality is never
9447         applied) and return the string constant for the IndexerName
9448         attribute. 
9449
9450         * class.cs (TypeContainer.Emit): Validate that all the indexers
9451         have the same IndexerName attribute, and if so, set the
9452         DefaultName attribute on the class. 
9453
9454         * typemanager.cs: The return value might contain other stuff (not
9455         only methods).  For instance, consider a method with an "Item"
9456         property and an Item method.
9457
9458         * class.cs: If there is a problem with the parameter types,
9459         return. 
9460
9461 2002-05-24  Ravi Pratap  <ravi@ximian.com>
9462
9463         * ecore.cs (ImplicitConversionExists): Wrapper function which also
9464         looks at user defined conversion after making a call to 
9465         StandardConversionExists - we need this for overload resolution.
9466
9467         * expression.cs : Update accordingly the various method calls.
9468
9469         This fixes 2 bugs filed against implicit user defined conversions 
9470
9471 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
9472
9473         * statement.cs: Track the result of the assignment.
9474
9475 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
9476
9477         * expression.cs (MemberAccess): Improved error reporting for
9478         inaccessible members.
9479
9480 2002-05-22  Martin Baulig  <martin@gnome.org>
9481
9482         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
9483         itself with debugging support.
9484
9485 2002-05-22  Martin Baulig  <martin@gnome.org>
9486
9487         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
9488         Removed, this isn't needed anymore.
9489
9490 2002-05-20  Martin Baulig  <martin@gnome.org>
9491
9492         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
9493         be underlying type for an enum.
9494
9495 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
9496
9497         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
9498         that splits out the loading of just the core types.
9499
9500         * rootcontext.cs (ResolveCore): Split the struct resolution in
9501         two, so we can load the enumeration underlying types before any
9502         enums are used.
9503
9504         * expression.cs (Is): Bandaid until we fix properly Switch (see
9505         bug #24985 for details).
9506
9507         * typemanager.cs (ImplementsInterface): The hashtable will contain
9508         a null if there are no interfaces implemented.
9509
9510 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
9511
9512         * cs-parser.jay (indexer_declarator): It is fine to have array
9513         parameters
9514
9515 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
9516
9517         * typemanager.cs: (RegisterBuilder): New function used to register
9518         TypeBuilders that implement interfaces.  Since
9519         TypeBuilder.GetInterfaces (as usual) does not work with lame
9520         Reflection.Emit. 
9521         (AddUserType): register interfaces.
9522
9523         (ImplementsInterface): Use the builder_to_ifaces hash if we are
9524         dealing with TypeBuilder.  Also, arrays are showing up as
9525         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
9526         methods can not be invoked on them!
9527
9528         * ecore.cs (ExplicitReferenceConversionExists): Made public.
9529         (ImplicitReferenceConversionExists): Split out from
9530         StandardConversionExists. 
9531
9532         * expression.cs (As): We were only implementing one of the three
9533         cases for the as operator.  We now implement them all.
9534         (Is): Implement the various other cases for Is as well.
9535
9536         * typemanager.cs (CACHE): New define used to control if we want or
9537         not the FindMembers cache.  Seems to have a negative impact on
9538         performance currently
9539
9540         (MemberLookup): Nested types have full acess to
9541         enclosing type members
9542
9543         Remove code that coped with instance/static returns for events, we
9544         now catch this in RealFindMembers.
9545
9546         (RealFindMembers): only perform static lookup if the instance
9547         lookup did not return a type or an event.  
9548
9549 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
9550
9551         * assign.cs (CompoundAssign): We pass more semantic information
9552         now to Compound Assignments than we did before: now we have all
9553         the information at hand, and now we resolve the target *before* we
9554         do the expression expansion, which allows the "CacheValue" method
9555         to have the effect we intended (before, a [x] += 1 would generate
9556         two differen ArrayAccess expressions from the ElementAccess,
9557         during the resolution process).
9558
9559         (CompoundAssign.DoResolve): Resolve target and original_source here.
9560
9561 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
9562
9563         * expression.cs (ArrayAccess): dropped debugging information. 
9564
9565         * typemanager.cs: Small bug fix: I was always returning i_members,
9566         instead of one of i_members or s_members (depending on which had
9567         the content).
9568
9569         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
9570         method is invoked before any code generation takes place, and it
9571         is a mechanism to inform that the expression will be invoked more
9572         than once, and that the method should use temporary values to
9573         avoid having side effects
9574
9575         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
9576
9577         * ecore.cs (Expression.CacheTemporaries): Provide empty default
9578         implementation.
9579
9580         * expression.cs (Indirection, ArrayAccess): Add support for
9581         CacheTemporaries in these two bad boys. 
9582
9583         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
9584         ldobj or ldind_ref.  
9585         (StoreFromPtr): Handle stobj as well.
9586
9587         * expression.cs (UnaryMutator): Share more code.
9588
9589         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
9590         down: I was not tracking the Filter function as well, which
9591         was affecting the results of the cache.
9592
9593 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
9594
9595         * attribute.cs: Remove the hack to handle the CharSet property on
9596         StructLayouts. 
9597
9598 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
9599
9600         * attribute.cs (DoResolve): More uglyness, we now only try to
9601         resolve the attribute partially, to extract the CharSet
9602         information (only if we are a StructLayout attribute).  Otherwise 
9603
9604         (GetExtraTypeInfo): Add some code to conditionally kill in the
9605         future this.   I am more and more convinced that the .NET
9606         framework has special code to handle the attribute setting on
9607         certain elements.
9608
9609         * expression.cs (IsParamsMethodApplicable): Revert my previous
9610         foreach change here, it was wrong.
9611
9612 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
9613
9614         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
9615         (pp_expr): do not abort on unknown input, just return.
9616         (eval): abort if there are pending chars.
9617
9618         * attribute.cs (Attribute.Resolve): Positional parameters are
9619         optional.  Deal with that case.
9620
9621         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
9622         the Ansi/Unicode/Auto information for the type.
9623
9624         (TypeContainer.DefineType): instantiate the EmitContext here, as
9625         we will be using it during the type definition (to resolve
9626         attributes) and during the emit phase.
9627
9628         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
9629         to pull type information out of the attributes
9630
9631         (Attribute.Resolve): track the constructor builder, and allow for
9632         multiple invocations (structs and classes will use this).
9633
9634         * ecore.cs (MemberLookupFinal): new version with all the
9635         parameters customizable.
9636
9637         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
9638         constructors.  Return if the result value is null (as the error
9639         would have been flagged already by MemberLookupFinal)
9640
9641         Do not allow instances of abstract classes or interfaces to be
9642         created.
9643
9644         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
9645         We have to compare the assembly property here when dealing with
9646         FamANDAssem and Assembly access modifiers, because we might be
9647         creating an assembly from *modules* (that means that we are not
9648         getting TypeBuilders for types defined in other modules that are
9649         part of this assembly).
9650
9651         (Method.Emit): If the method is marked abstract and has a body,
9652         emit an error. 
9653
9654         (TypeContainer.DefineMembers): If both the defined member and the
9655         parent name match are methods, then do not emit any warnings: let
9656         the Method.Define routine take care of flagging warnings.  But if
9657         there is a mismatch (method overrides something else, or method is
9658         overriwritten by something, then emit warning).
9659
9660         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
9661         set to null, this means `do not check for the return type on the
9662         signature'. 
9663
9664         (Method.Define): set the return type for the method signature to
9665         null, so that we get methods with the same name and parameters and
9666         different return types.  This is used to flag warning 114 (you are
9667         hiding a method, and you probably want to use the new/override
9668         keywords instead).
9669
9670         * typemanager.cs (MemberLookup): Implemented proper access
9671         control, closing a long standing set of bug reports.  The problem
9672         was that the Framework only has two bits: Public and NonPublic,
9673         and NonPublic includes private and protected methods, but we need
9674         to enforce the FamANDAssem, FamOrAssem and Family. 
9675
9676 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
9677
9678         * statement.cs (GotoCase): Return true: Ammounts to giving up
9679         knowledge on whether we return or not, and letting the other case
9680         be responsible for it.
9681
9682 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
9683
9684         * driver.cs: Do not load directories for each file processed, only
9685         do it if there is a pattern.
9686
9687         * ecore.cs: Report readonly assigns here as well, as we might have
9688         been resolved only by MemberAccess.
9689
9690         (SimpleName.SimpleNameResolve): Also be useful for LValue
9691         resolution.   We need this to propagate assign to local readonly variables
9692
9693         * typemanager.cs: Use a ptrhashtable for the criteria, because we
9694         do not want to reuse potential criteria memory.
9695
9696         * class.cs (MyEventBuilder): Set reflected_type;
9697
9698         * ecore.cs (Constantify): Added support for constifying bools.
9699
9700         (RootContext.LookupType): Added a cache for values looked up in
9701         the declaration space.
9702
9703         * typemanager.cs (FindMembers): Now is a front-end to
9704         RealFindMembers, and provides a two-level hashtable-based cache to
9705         the request.  
9706
9707         15% performance improvement: from 22.5 to 19.2 seconds.
9708
9709         * expression.cs (IsParamsMethodApplicable): use foreach.
9710         (Invocation.DoResolve): ditto.
9711         (New.DoResolve): ditto.
9712         (ArrayCreation.DoResolve): ditto.
9713
9714         * ecore.cs (FindMostEncompassingType): use foreach.
9715
9716         * delegate.cs (NewDelegate.DoResolve): Use foreach
9717
9718         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
9719         (RemoveMethods): use foreach.
9720
9721         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
9722         nested foreach statements instead of for, and also break out of
9723         the inner loop once a match is found.
9724
9725         (Invocation.OverloadResolve): Use foreach, simplify the code. 
9726
9727 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
9728
9729         * cfold.cs (BinaryFold): During an enumeration evaluation context,
9730         we actually unwrap the expression to allow for extra information
9731         to be extracted. 
9732
9733         * expression.cs: Use Shr_Un on unsigned operations. 
9734
9735 2002-05-08  Ravi Pratap  <ravi@ximian.com>
9736
9737         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
9738         applicable operators was not being considered correctly. This closes
9739         the bug Miguel reported.
9740
9741 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
9742
9743         * attribute.cs: check that the type derives from System.Attribute
9744         and report the correct error in that case (moved the duplicate code to
9745         its own method, too).
9746
9747 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
9748
9749         * attribute.cs: lookup attribute type name as the spec says: first the
9750         bare attribute name and then name + "Attribute" (nant compiles with
9751         mcs after this fix).
9752
9753 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
9754
9755         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
9756         Because of the way we parse things, we should try to see if a
9757         UIntConstant can fit in an integer.
9758
9759 2002-05-07  Ravi Pratap  <ravi@ximian.com>
9760
9761         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
9762         when we are in an explicit context.
9763
9764         (ConvertReferenceExplicit): When converting from Iface type S to Class
9765         T make sure the rules are implemented as an OR.
9766
9767         * parameter.cs (ParameterType): Make it a property for now although the
9768         purpose really isn't anything immediate.
9769
9770         * expression.cs (Is*Applicable): Do better checking on the parameter type
9771         of a ref/out parameter. The ones from the system assemblies are already 
9772         marked with the correct type so we don't need to do any correction.
9773
9774         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
9775         the object type is standard too so include that.
9776
9777 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
9778
9779         * ecore.cs (StandardConversionExists): Augment with missing code:
9780         deal with IntConstant, LongConstants and Enumerations.
9781
9782         * assign.cs: Report the error, instead of failing silently
9783
9784         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
9785         typecontainer that they are declared, because the
9786         typecontainer/namespace will have the list of using clauses that
9787         need to be applied.
9788
9789         Assembly Attributes were escaping the normal registration
9790         mechanism. 
9791
9792         (EmitCode): Apply attributes within an EmitContext that represents
9793         the container they were declared on.
9794
9795         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
9796
9797 2002-05-06  Ravi Pratap  <ravi@ximian.com>
9798
9799         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
9800         Revamp completely - make much cleaner as we now operate only
9801         on a set of Types.
9802
9803         (FindMostSpecificSource, FindMostSpecificTarget): New methods
9804         to implement the logic detailed in the spec more correctly.
9805
9806         (UserDefinedConversion): Update accordingly.
9807
9808 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
9809
9810         * statement.cs: Return flow analysis information up.
9811
9812         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
9813         and the default.
9814
9815         (token): Do not consume an extra character before calling
9816         decimal_digits.
9817
9818 2002-05-06  Piers Haken <piersh@friskit.com>
9819
9820         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
9821
9822 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
9823
9824         * class.cs (Constructor.Emit): Set the IsStatic flag in the
9825         EmitContext during the instance constructor initializer
9826         resolution, to stop access to instance variables.
9827
9828         This is mandated by the spec, last paragraph of the `constructor
9829         initializers' section. 
9830
9831 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
9832
9833         * cs-parser.jay, class.cs (Accessor): new class used to represent
9834         an accessor (get or set).  In the past we used `null' to represent
9835         a missing accessor.  But this is ambiguous because there was no
9836         way to tell in abstract indexers/properties if one of them was
9837         specified.
9838
9839         Now there is a way of addressing that.
9840
9841         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
9842         instead of FindMembers.
9843
9844         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
9845         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
9846
9847         * attribute.cs: Treat indexers and properties as the same in terms
9848         of applying attributes
9849
9850         * ecore.cs (FindMostEncompassedType): Use statically initialized
9851         EmptyExpressions()s like we do elsewhere to avoid creating useless
9852         objects (and we take this out of the tight loop).
9853
9854         (GetConversionOperators): Move the code to extract the actual
9855         operators to a separate routine to clean things up.
9856
9857 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
9858
9859         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
9860         events are always registered FieldBuilders.
9861
9862         * class.cs (FieldBase): New class shared by Fields 
9863
9864         * delegate.cs: If we are a toplevel delegate, use our full name.
9865         If we are a nested delegate, then only use our tail name.
9866
9867 2002-05-02  Ravi Pratap  <ravi@ximian.com>
9868
9869         * expression.cs (IsApplicable): Ensure that we add the "&" to
9870         ref/out types before comparing it with the type of the argument.
9871
9872         (IsParamsMethodApplicable): Ditto.
9873
9874         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
9875         silly me ;-)
9876
9877         * delegate.cs : Handle the case when we have more than one applicable
9878         method. Flag an error only when we finish checking all.
9879
9880 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
9881
9882         * expression.cs: Add support for boolean static initializers.
9883
9884 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
9885
9886         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
9887
9888         * parameter.cs (ComputeParameterTypes,
9889         ComputeAndDefineParameterTypes): Better error handling: now we
9890         clear the `types' cache if we fail during any of the type lookups.
9891         We also return the status code correctly to our caller
9892
9893         * delegate.cs: If we fail to define a delegate, abort the extra
9894         steps. 
9895
9896         * expression.cs (Binary.ResolveOperator): for
9897         operator==(object,object) and operator !=(object, object) we also
9898         have to verify that there is an implicit conversion from one to
9899         the other.
9900
9901         (ArrayAccess.DoResolve): Array Access can operate on
9902         non-variables. 
9903
9904 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
9905
9906         * assign.cs (CompoundAssign): A new class used as a "flag" that
9907         the assignment actually is happening as part of a compound
9908         assignment operator.
9909
9910         During compound assignment, a few new rules exist to enable things
9911         like:
9912
9913         byte b |= 1 + 2
9914
9915         From the spec:
9916
9917         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
9918         to the type of x) if y is implicitly convertible to the type of x,
9919         and the operator is a builtin operator and the return type of the
9920         operator is explicitly convertible to the type of x. 
9921
9922         * rootcontext.cs: Reset warning level to 2.  4 catches various
9923         "interesting" features in mcs, we must clean this up at some
9924         point, but currently am trying to kill other bugs ;-)
9925
9926         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
9927         in container classes as well.  
9928
9929         * expression.cs (Binary.ResolveOperator): Handle string case
9930         before anything else (as operator overloading does emit an error
9931         before doing anything else).
9932
9933         This code could go away when we move to a table driven model, but
9934         i could not come up with a good plan last night.
9935
9936 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
9937
9938         * typemanager.cs (CSharpName): reimplementation using regex.
9939         * class.cs: added null check for fields in Emit
9940         * rootcontext.cs: set warninglevel to 4
9941
9942 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
9943
9944         * typemanager.cs (CSharpName): reimplemented with Lupus
9945         suggestion.
9946
9947 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
9948
9949         * statement.cs (If): correclty implement Resolve, because we were
9950         not catching sem errors in there.  The same process is needed
9951         everywhere else. 
9952         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
9953
9954
9955         (Statement.Warning_DeadCodeFound): Factorize code.
9956         (While): Report dead code here too.
9957
9958         (Statement): Added Resolve virtual method to allow
9959         for resolution split from the emit code.
9960
9961 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
9962
9963         * statement.cs (EmitBoolExpression): No longer try to resolve the
9964         expression here.    
9965         (MakeBoolean): New utility function that resolve, implicitly
9966         converts to boolean and tags the expression. 
9967
9968
9969         (If, Do): Implement dead code elimination.
9970         (While): Implement loop inversion
9971
9972         (Do, While, For, If): Resolve the expression prior to calling our
9973         code generation.
9974
9975 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
9976
9977         * class.cs:
9978           - added method Report28 (warning: program has more than one entry point)
9979           - added method IsEntryPoint, implements paragraph 10.1 of the spec
9980           - modified method Method.Define, the part at the end of the method
9981
9982         * rootcontext.cs: added static public Location EntryPointLocation;
9983           
9984         * ../errors/cs0028.cs : Add test case for the above warning.              
9985
9986         * typemanager.cs:
9987           - modified method CSharpName to allow arrays of primitive type to
9988             be printed nicely (e.g. instead of System.Int32[][] it now prints
9989             int[][])
9990           - added method CSharpSignature: returns the signature of a method
9991             in string format to be used in reporting errors, warnings, etc.
9992
9993         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
9994         with String.Empty.
9995
9996 2002-04-26  Ravi Pratap  <ravi@ximian.com>
9997
9998         * delegate.cs (Define): Fix extremely silly bug where I was
9999         setting the type of the 'object' parameter of the BeginInvoke
10000         method to System.IAsyncResult instead of System.Object ;-)
10001
10002 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
10003
10004         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
10005         here. 
10006
10007         (Constructor.Emit): return if we fail to initialize the
10008         constructor.  Another door closed!  
10009
10010         * expression.cs (New.DoResolve): Improve error message (from -6 to
10011         1501).  Use DeclaredOnly lookup to find the exact constructor.
10012
10013         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
10014         loop.  This is useful.
10015
10016         * cs-parser.jay: Adjust the default parameters so that destructors
10017         have the proper signature.
10018
10019 2002-04-26  Martin Baulig  <martin@gnome.org>
10020
10021         * driver.cs (LoadAssembly): If `assembly' contains any characters
10022         which are only valid in path names and not in assembly names
10023         (currently slash, backslash and point), use Assembly.LoadFrom ()
10024         instead of Assembly.Load () on the `assembly' (before iteration
10025         over the link_paths).
10026
10027 2002-04-26  Martin Baulig  <martin@gnome.org>
10028
10029         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
10030
10031 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
10032
10033         * class.cs (Property): use the new typemanager.MemberLookup
10034
10035         (TypeContainer.MemberLookup): Implement using the
10036         TypeManager.MemberLookup now. 
10037
10038         * typemanager.cs: Make MemberLookup a function of the TypeManager,
10039         and return MemberInfos, so that these can be used without an
10040         EmitContext (what we had before).
10041
10042 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
10043
10044         * expression.cs: Fix the case where the argument to params if the
10045         type of the params.  I omitted handling this before.   Fixed
10046
10047 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
10048
10049         * driver.cs: Call BootCorlib_PopulateCoreType
10050
10051         * class.cs (Property.CheckBase): Check for properties only, not
10052         for all members. 
10053
10054         * interface.cs: Temporary hack: try/catch around the
10055         CustomAttributeBuilder, because I am getting an exception that I
10056         do not understand.
10057
10058         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
10059         types whose definitions are required to be there (attributes are
10060         defined before standard types).
10061
10062         Compute definitions as we boot the various types, as they are used
10063         immediately (value_type class will need object_type, but if we do
10064         not initialize object_type, we will pass a null, which will let
10065         the runtime pick the System.Object from the existing corlib, which
10066         is not what we want).
10067
10068 2002-04-22  Patrik Torstensson <totte@labs2.com>
10069
10070         * cs-tokenizer.cs: fixed a number of trim() issues.
10071
10072 2002-04-22  Ravi Pratap  <ravi@ximian.com>
10073
10074         * expression.cs (Argument.Type): Ensure that we return the correct
10075         type when we have out or ref parameters [in which case we 
10076         append a "&"].
10077
10078 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
10079
10080         * class.cs (Property, Indexer): Allow extern modifier in there. 
10081
10082         * typemanager.cs (InitBaseTypes): Initializes object_type and
10083         value_type, since those will be used early on during the bootstrap
10084         process to compile corlib.
10085
10086         (InitCoreTypes): Move code from here to InitBaseTypes.
10087
10088 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
10089
10090         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
10091         single-dimension arrays as using the ldlen opcode.  
10092
10093         Daniel Lewis discovered this optimization.  
10094
10095         * typemanager.cs: Add signature for System.Array::get_Length
10096
10097 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
10098
10099         * statement.cs: report the error when the foreach does not apply to an
10100         array nor a collection.
10101
10102 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
10103
10104         * expression.cs: Add implicit conversions to the operator ~.
10105
10106         * constant.cs (DecimalConstant.Emit): Emit decimal value.
10107
10108         * typemanager.cs: Locate the decimal constructor.
10109
10110 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
10111
10112         * attribute.cs: use the new property of TypeOf.
10113         * expression.cs: added 'get' property around typearg.
10114
10115         These changes fix a build breaker reported by NickD. Is this the
10116         correct way to fix?  If not, please, revert my changes and make it
10117         work :-).
10118
10119 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
10120
10121         * attribute.cs: Add support for typeof in attribute invocations.
10122         I am not sure that this is right though.
10123
10124 2002-04-14  Duncan Mak  <duncan@ximian.com>
10125
10126         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
10127         Binary.Operator.Division case.
10128
10129 2002-04-13  Ravi Pratap  <ravi@ximian.com>
10130
10131         * class.cs (DefineType): Ensure that we do a proper check on
10132         attribute types and also register it with the TypeManager.
10133
10134         (TypeContainer.Targets): The default for attribute types is
10135         AttributeTargets.All.
10136
10137         * attribute.cs (ApplyAttributes): Registering the attribute type
10138         is done elsewhere, not when we discover we have a Usage attribute.
10139
10140 2002-04-12  Ravi Pratap  <ravi@ximian.com>
10141
10142         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
10143         and get rid of is_delegate parameter.
10144
10145         * everywhere : update.
10146
10147 2002-04-12  Ravi Pratap  <ravi@ximian.com>
10148
10149         * cs-parser.jay (compilation_unit): Revamp completely to use
10150         some new ideas that I got from Rhys' grammar to solve the problems
10151         with assembly level attributes.
10152
10153         (outer_declaration): New grammar production.
10154
10155         (attribute_sections): Add.
10156
10157         (opt_attributes): Base on attribute_sections
10158
10159         (namespace_declaration): Allow opt_attributes to tackle the case
10160         when we have assembly level attributes - we are clever in this
10161         regard now ;-)
10162
10163         * attribute.cs (ApplyAttributes): Do not worry about assembly 
10164         attributes in the non-global context.
10165
10166         * rootcontext.cs (AddGlobalAttributes): Go back to using this
10167         instead of SetGlobalAttributes.
10168
10169         * class.cs, rootcontext.cs : Ensure we define and generate 
10170         attribute types before anything else.
10171
10172         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
10173         and flag the new error -20 for the case when the attribute type
10174         does not have valid targets specified. csc does not catch this.
10175
10176         * ../errors/errors.txt : update for error # -20
10177
10178 2002-04-11  Ravi Pratap  <ravi@ximian.com>
10179
10180         * support.cs (InternalParameters.ParameterModifier): Do some null
10181         checking and return sane values.
10182
10183         * class.cs (Method.Define): If we are a PInvoke method, ensure
10184         that we are static and extern. Report error # 601
10185
10186         * ../errors/cs0601.cs : Add test case for the above error.
10187
10188 2002-04-07  Ravi Pratap  <ravi@ximian.com>
10189
10190         * rootcontext.cs (attribute_types): We need to keep type of
10191         all attribute types separately and emit code for them first.
10192
10193         (RegisterAttribute) : Implement.
10194
10195         * class.cs (DefineType): Check if the current Type is a custom
10196         attribute type and register it accordingly.
10197
10198         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
10199         adding the first attribute twice and rename to
10200
10201         (SetGlobalAttributes): this.
10202
10203         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
10204         lookups.
10205
10206         * attribute.cs (ApplyAttributes): Take an additional argument telling us
10207         if we are processing global arguments. Hmm, I am unsure of this.
10208
10209 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
10210
10211         * expression.cs: added static array of strings to avoid calling
10212         Enum.ToString () for Operator in Binary. Significant recover of
10213         performance.
10214
10215 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
10216
10217         * class.cs (FindMembers): Allow the Builders of the various
10218         members to be null.  If they are skip them.  This only happens
10219         during the PInvoke declaration.
10220
10221 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
10222
10223         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
10224         failure, so we do not keep going afterwards.
10225
10226         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
10227         wanted to pass `false' as the `is_delegate' argument.  If this is
10228         the case, why not use delegate_type == null to mean `is_delegate =
10229         false' and anything else as is_delegate = true.
10230
10231 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
10232
10233         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
10234         code for the section, not the beginning of the tests.
10235
10236 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
10237
10238         * cfold.cs: Handle operator + (Enum x, Underlying x) 
10239
10240         * expression.cs (Binary): same.  Warn about errors where we have
10241         Enum/Enum in operator + as well.
10242
10243 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
10244
10245         * statement.cs:
10246                 - added support for switch(bool)
10247                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
10248                 - add TableSwitchEmit() to handle table-based switch statements
10249
10250 2002-04-05  Ravi Pratap  <ravi@ximian.com>
10251
10252         * expression.cs (Invocation.OverloadResolve): Factor out code which
10253         does parameter compatibility checking with arguments so that we can 
10254         re-use the code even from Delegate.VerifyApplicability
10255
10256         (VerifyArgumentsCompat): Move above code here.
10257
10258         * delegate.cs (VerifyApplicability): Get rid of duplicate code
10259         and instead make a call to the above method.
10260
10261 2002-03-31  Ravi Pratap  <ravi@ximian.com>
10262
10263         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
10264         We use it to keep track of classes which are attribute types.
10265
10266 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
10267
10268         * delegate.cs (Delegate.Define): Correctly define the types in the
10269         presence of fixed and array parameters.
10270
10271         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
10272         doing FindMembers.
10273
10274         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
10275         include NonPublic after the first iteration.
10276
10277         * class.cs (Indexer.CheckBase): Only check if both parents are
10278         non-null. 
10279
10280         * cs-parser.jay (accessor_body): If empty, set to null.
10281
10282         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
10283         same code path here to resolve constants names that we did have in
10284         MemberAccess.DoResolve.  There is too much code duplicated here.
10285
10286 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
10287
10288         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
10289
10290         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
10291         to MakeUnionSet.
10292
10293         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
10294         tokens, numbers and strings.
10295
10296         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
10297         parenthesis.
10298
10299         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
10300         asyncronous parameters and the regular parameters.  
10301
10302         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
10303         specify the target directory.
10304
10305         * expression.cs: (This.DoResolve): Simplify
10306         (As.Emit): Optimize, do not generate IsInst if the expression is
10307         always of the given type.
10308
10309         (Is.DoResolve): Bug fix, we were reporting both always/never for
10310         the is expression.
10311
10312         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
10313         creating too many unnecessary arrays.
10314
10315 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
10316
10317         * class.cs (EmitFieldInitializer): Use Assign expression to assign
10318         fields instead of rolling our own initializer.   Takes care of all
10319         implicit conversions, and drops unnecessary static checks/argument.
10320
10321 2002-03-31  Dick Porter  <dick@ximian.com>
10322
10323         * driver.cs: use the GetDirectories() return values properly, and
10324         use "/" as path separator.
10325
10326 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
10327
10328         * expression.cs (Unary): Optimize - - expr into expr.
10329         (Binary): Optimize a + (-b) into a -b.
10330
10331         * codegen.cs (CodeGen): Made all methods static.
10332
10333 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
10334
10335         * rootcontext.cs: 
10336
10337         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
10338         TypeBuilder property.
10339
10340         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
10341         instead. 
10342
10343         * tree.cs: Removed the various RecordXXXX, and replaced with a
10344         single RecordDecl.  Removed all the accessor methods, and just
10345         left a single access point Type 
10346
10347         * enum.cs: Rename DefineEnum to DefineType.
10348
10349         * decl.cs: New abstract method `DefineType' used to unify the
10350         Defines for Enumerations, Interfaces, TypeContainers and
10351         Delegates.
10352
10353         (FindType): Moved LookupInterfaceOrClass here.  Moved the
10354         LookupBaseClasses method that used to live in class.cs and
10355         interface.cs here, and renamed to FindType.
10356
10357         * delegate.cs: Implement DefineType.  Take advantage of the
10358         refactored pattern for locating the parent builder without taking
10359         the parent_builder argument (which we know does not work if we are
10360         nested, and triggering a toplevel definition).
10361
10362 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
10363
10364         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
10365         accessibility of a member has changed during override and report
10366         an error if so.
10367
10368         * class.cs (Method.Define, Property.Define): Only complain on
10369         overrides if the method is private, any other accessibility is
10370         fine (and since we just checked the permission is the same, we are
10371         good to go).
10372
10373         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
10374         and elif are processed always.  The other pre-processing
10375         directives are only processed if we are "taking" the path
10376
10377 2002-03-29  Martin Baulig  <martin@gnome.org>
10378
10379         * class.cs (Method.Emit): Only emit symbolic debugging info if the
10380         current location is not Null.
10381
10382         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
10383         a separate method so we can profile it.
10384
10385         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
10386         `span.Seconds' are just seconds, but no minutes or hours.
10387         (MainDriver): Profile the CodeGen.SaveSymbols calls.
10388
10389 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
10390
10391         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
10392         Remove the gratuitous set of Final:
10393
10394                                 // If an interface implementation, then we can set Final.
10395                                 if (((flags & MethodAttributes.Abstract) == 0) &&
10396                                     implementing.DeclaringType.IsInterface)
10397                                         flags |= MethodAttributes.Final;
10398
10399         I do not know what I was smoking when I used that.
10400
10401
10402         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
10403         step into fixing the name resolution issues for delegates and
10404         unifying the toplevel name resolution.
10405
10406 2002-03-28  Martin Baulig  <martin@gnome.org>
10407
10408         * class.cs (Method.Emit): If we have a symbol writer, call its
10409         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
10410         tell it about the current method.
10411
10412         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
10413         writer that we're going to emit the first byte of IL code for a new
10414         statement (a new source line).
10415         (EmitContext.EmitTopBlock): If we have a symbol writer, call
10416         EmitContext.Mark() before emitting any code.
10417
10418         * location.cs (SymbolDocument): Return null when we're Null.
10419
10420         * statement.cs (Statement): Moved the `Location loc' variable here.
10421         (Statement.EmitBoolExpression): If we have a symbol writer, call
10422         ec.Mark() before emitting any code to tell it that we're at the
10423         beginning of a new statement.
10424         (StatementExpression): Added `Location' argument to the constructor.
10425         (Block): Added public readonly variable `StartLocation' and public
10426         variable `EndLocation'.  The latter is to be set using SetEndLocation().
10427         (Block): Added constructor which takes a start and end location.
10428         (Block.SetEndLocation): New method. This sets the end location.
10429         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
10430         local variables we create.
10431         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
10432         each statement and do also mark the begin and end of the block.
10433
10434         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
10435         tell it the current lexer.Location, use Location.Null for the end of the
10436         block.
10437         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
10438         current block, set its end location using SetEndLocation().
10439         (statement_expression): StatementExpression constructor now takes the
10440         lexer.Location as additional argument.
10441         (for_statement, declare_local_variables): Likewise.
10442         (declare_local_variables): When creating a new implicit block, use the
10443         new Block constructor and pass it the lexer.Location.
10444
10445 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
10446
10447         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
10448         members also on the parent interfaces recursively.
10449
10450 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
10451
10452         * report.cs: Use new formats, since Gonzalo finished the missing
10453         bits. 
10454
10455         * expression.cs (Binary.ResolveOperator): added missing operator|
10456         operator& and operator^ for bool/bool.
10457
10458         * cs-parser.jay: CheckDef now takes a Location argument that is
10459         used to report errors more precisly (instead of reporting the end
10460         of a definition, we try to track something which is a lot closer
10461         to the source of the problem).
10462
10463         * cs-tokenizer.cs: Track global token use, so we can properly flag
10464         the use of #define/#undef after the first token has been seen.
10465
10466         Also, rename the reportXXXX to Error_DescriptiveName
10467
10468         * decl.cs (DeclSpace.IsTopLevel): Move property here from
10469         TypeContainer, so that Enum and Interface can use this too.
10470
10471         * class.cs (TypeContainer.LookupInterfaceOrClass,
10472         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
10473         `builder' argument.  Typically this was used to pass the parent
10474         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
10475         the definition).  
10476
10477         The problem is that a nested class could trigger the definition of
10478         a toplevel class, and the builder would be obviously wrong in that
10479         case. 
10480
10481         So we drop this argument, and we compute dynamically the
10482         TypeBuilder/ModuleBuilder (the correct information was available
10483         to us anyways from DeclSpace.Parent)
10484
10485         * interface.cs (Interface.DefineInterface): Drop builder
10486         parameter cleanup like class.cs
10487
10488         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
10489         like class.cs
10490
10491         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
10492         values. 
10493
10494         (Try.Emit): Propagate the returns value from the statement.
10495
10496         (Return.Emit): Even if we are leavning 
10497
10498         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
10499
10500         * modifiers.cs: Fix the computation of MethodAttributes flags.
10501
10502 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
10503
10504         * driver.cs: allow compilation of files that start with '/'.
10505         Add a default case when checking the argument of --target.
10506
10507 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
10508
10509         * interface.cs: Implement the same search algorithm for types in
10510         the interface code.
10511
10512         * delegate.cs: Do not allow multiple definition.
10513
10514         * Recovered ChangeLog that got accidentally amputated
10515
10516         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
10517
10518         * rootcontext.cs: Load manually enum to allow core classes to
10519         contain enumerations.
10520
10521         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
10522         Update to new static methods in TypeManager.
10523
10524         * typemanager.cs (GetMethod, GetConstructor): Use our
10525         implementation of FindMembers to find the members, since during
10526         corlib compilation, the types are TypeBuilders and GetMethod and
10527         GetConstructor do not work.
10528
10529         Make all methods in TypeManager static.
10530
10531         (InitCodeHelpers): Split the functionality from
10532         the InitCodeTypes function.
10533
10534         * driver.cs: Call InitCodeHelpers after we have populated the
10535         types. 
10536
10537         * cs-parser.jay (delegate_declaration): we did not used to compute
10538         the delegate name correctly for void delegates.
10539
10540 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
10541
10542         * rootcontext.cs (RootContext): Init the interface_resolve_order
10543         and type_container_resolve_order always.
10544
10545         (ResolveCore, BootstrapCorlib_ResolveClass,
10546         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
10547         compiler when compiling with --nostdlib
10548
10549         * class.cs (TypeContainer.DefineType): Check that our parent is
10550         not null.  This test is most important when we are bootstraping
10551         the core types.
10552
10553         * codegen.cs: Split out the symbol writing code.
10554
10555 2002-03-25  Martin Baulig  <martin@gnome.org>
10556
10557         * driver.cs (-g): Made -g an alias for --debug.
10558
10559 2002-03-24  Martin Baulig  <martin@gnome.org>
10560
10561         * codegen.cs (SymbolWriter): New public variable. Returns the
10562         current symbol writer.
10563         (CodeGen): Added `bool want_debugging_support' argument to the
10564          constructor. If true, tell the ModuleBuild that we want debugging
10565         support and ask it for the ISymbolWriter.
10566         (Save): If we have a symbol writer, call it's Close() method after
10567         saving the assembly.
10568
10569         * driver.c (--debug): New command line argument to create a
10570         debugger information file.
10571
10572         * location.cs (SymbolDocument): New public property. Returns an
10573         ISymbolDocumentWriter object for the current source file or null
10574         if we don't have a symbol writer.
10575
10576 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
10577
10578         * driver.cs (LoadAssembly): Correctly return when all the paths
10579         have been tried and not before.
10580
10581         * statement.cs (Switch.Emit): return the actual coverage for this
10582         statement (returns/not-returns)
10583
10584         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
10585         switch of the statement if we are the last switch section.  That
10586         kills two problems: try/catch problems (we used to emit an empty
10587         nop at the end) and switch statements where all branches would
10588         return. 
10589
10590 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
10591
10592         * driver.cs: Add default assemblies (the equivalent to the
10593         Microsoft CSC.RSP file)
10594
10595         * cs-tokenizer.cs: When updating `cols and setting it to zero,
10596         also update tokens_seen and set it to false.
10597
10598         * driver.cs: Implement --recurse for Mike.
10599
10600         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
10601         correctly splitting out the paths.
10602
10603 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
10604
10605         * interface.cs (Interface.PopulateProperty): Instead of using
10606         `parent' as the declaration space for the set parameters, use
10607         `this' 
10608
10609         * support.cs (InternalParameters): InternalParameters constructor
10610         takes a DeclSpace instead of a TypeContainer.
10611
10612         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
10613         types are being initialized, load the address of it before calling
10614         the function.  
10615
10616         (New): Provide a mechanism to disable the generation of local
10617         value type temporaries when the caller will be providing us with
10618         an address to store it.
10619
10620         (ArrayCreation.EmitDynamicInitializers): Use it.
10621
10622 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
10623
10624         * expression.cs (Invocation.EmitArguments): Only probe for array
10625         property if there is more than one argument.  Sorry about that.
10626
10627         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
10628         empty param arrays.
10629
10630         * class.cs (Method.LabelParameters): Fix incorrect code path that
10631         prevented the `ParamArrayAttribute' from being applied to the
10632         params attribute.
10633
10634 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
10635
10636         * support.cs (ReflectionParameters): Correctly compute whether the
10637         last argument is a params array.  Fixes the problem with
10638         string.Split ('a')
10639
10640         * typemanager.cs: Make the assemblies array always be non-null
10641         (empty, but non-null)
10642
10643         * tree.cs (RecordDecl): New function that abstracts the recording
10644         of names.  This reports error 101, and provides a pointer to the
10645         previous declaration.  Fixes a crash in the compiler.
10646
10647         * cs-parser.jay (constructor_declaration): Update to new grammar,
10648         and provide a constructor_body that can be empty.
10649
10650 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
10651
10652         * driver.cs: Add support for --resources.
10653
10654         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
10655         Make all types for the various array helper methods be integer.
10656
10657         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
10658         CheckState to ConvCast.
10659
10660         (ConvCast): Now it takes a `checked' state argument, to avoid
10661         depending on the emit context for the conversion, and just using
10662         the resolve time setting.
10663
10664         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
10665         instead of Invocation.EmitArguments.  We do not emit the original
10666         arguments, instead we emit those which have been converted to
10667         unsigned int expressions.
10668
10669         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
10670
10671         * codegen.cs: ditto.
10672
10673         * expression.cs (LocalVariableReference): Drop the use of the
10674         Store function that depended on the variable index.
10675
10676         * statement.cs (VariableInfo): Drop the `Idx' property from this
10677         class, as this is not taking into account the indexes for
10678         temporaries tat we generate during the execution, getting the
10679         indexes wrong.
10680
10681         * class.cs: First emit class initializers, then call the parent
10682         constructor. 
10683
10684         * expression.cs (Binary): Fix opcode emision.
10685         (UnaryMutator.EmitCode): Support checked code generation
10686
10687         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
10688         matches for events for both the Static and Instance scans,
10689         pointing to the same element.   Fix that.
10690
10691 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
10692
10693         * rootcontext.cs (ResolveTree): Always set the
10694         interface_resolve_order, because nested interfaces will be calling
10695         into us.
10696
10697         * class.cs (GetInterfaceOrClass): Track the same resolution
10698         process used by TypeManager.LookupType.  This fixes the nested
10699         type lookups in class declarations (separate path from
10700         LookupType). 
10701
10702         (TypeContainer.DefineType): Also define nested interfaces.
10703         (TypeContainer.RegisterOrder): New public function used to
10704         register the order in which child interfaces need to be closed.
10705
10706         Nested interfaces need to be closed after their parents have been
10707         created. 
10708
10709         * interface.cs (InterfaceAttr): Put all the logic for computing
10710         the interface attribute here. 
10711
10712         (DefineInterface): Register our interface order with the
10713         RootContext or with the TypeContainer depending on the case.
10714
10715 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
10716
10717         * cs-parser.jay: rework foreach statement to work with the new
10718         changes to the policy on SimpleNames.
10719
10720         * report.cs: support Stacktrace on warnings as well.
10721
10722         * makefile: drop --unsafe and /unsafe from the compile.
10723
10724 2002-03-13  Ravi Pratap  <ravi@ximian.com>
10725
10726         * ecore.cs (StandardConversionExists): Modify to take an Expression
10727         as the first parameter. Ensure we do null -> reference type conversion
10728         checking.
10729
10730         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
10731         temporary Expression objects.
10732
10733 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
10734
10735         * interface.cs: workaround bug in method overloading resolution
10736         (there is already a bugzilla bug for it).
10737
10738 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
10739
10740         We could also solve this problem by having a separate path for
10741         performing type lookups, instead of DoResolve, we could have a
10742         ResolveType entry point, and only participating pieces of the
10743         production (simplename, deref, array) would implement this. 
10744
10745         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
10746         signal SimpleName to only resolve type names and not attempt to
10747         resolve anything else.
10748
10749         * expression.cs (Cast): Set the flag.
10750
10751         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
10752
10753         * class.cs: Only report 108 if there is no `new' modifier.
10754
10755         * cs-parser.jay: rework foreach statement to work with the new
10756         changes to the policy on SimpleNames.
10757         
10758         * report.cs: support Stacktrace on warnings as well.
10759
10760         * makefile: drop --unsafe and /unsafe from the compile.
10761
10762 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
10763
10764         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
10765         lookups here, instead of doing that at parse time.  This means
10766         that our grammar will not introduce `LocalVariableReferences' as
10767         expressions at this point.  That solves the problem of code like
10768         this:
10769
10770         class X {
10771            static void Main ()
10772            { int X = 1;
10773             { X x = null }}}
10774
10775         This is only half the fix.  The full fix requires parameters to
10776         also be handled in this way.
10777
10778         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
10779         makes the use more obvious of the DeclSpace.  The
10780         ec.TypeContainer.TypeBuilder is now only used to pull the
10781         TypeBuilder for it.
10782
10783         My theory is that I can get rid of the TypeBuilder completely from
10784         the EmitContext, and have typecasts where it is used (from
10785         DeclSpace to where it matters).  
10786
10787         The only pending problem is that the code that implements Aliases
10788         is on TypeContainer, and probably should go in DeclSpace.
10789
10790         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
10791         lookups here, instead of doing that at parse time.  This means
10792         that our grammar will not introduce `LocalVariableReferences' as
10793         expressions at this point.  That solves the problem of code like
10794         this:
10795
10796         class X {
10797            static void Main ()
10798            { int X = 1;
10799             { X x = null }}}
10800
10801         This is only half the fix.  The full fix requires parameters to
10802         also be handled in this way.
10803
10804         * class.cs (Property.DefineMethod): When implementing an interface
10805         method, set newslot, when implementing an abstract method, do not
10806         set the flag (before we tried never setting it, or always setting
10807         it, which is the difference).
10808         (Indexer.DefineMethod): same.
10809         (Method.DefineMethod): same.
10810
10811         * ecore.cs: Only set the status used flag if we get back a Field.
10812
10813         * attribute.cs: Temporary hack, so Paolo can keep working.
10814
10815 2002-03-08  Ravi Pratap  <ravi@ximian.com>
10816
10817         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
10818         the unmanaged type in the case we have a MarshalAs attribute.
10819
10820         (Resolve): Handle the case when we are parsing the special MarshalAs
10821         attribute [we need to store the unmanaged type to use later]
10822
10823         * typemanager.cs (marshal_as_attr_type): Built in type for the 
10824         MarshalAs Attribute.
10825
10826         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
10827         on parameters and accordingly set the marshalling info.
10828
10829 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
10830
10831         * class.cs: Optimizing slightly by removing redundant code after
10832         we switched to the `NoTypes' return value.
10833         (Property.DefineMethod): use NoTypes here too.
10834
10835         This fixes the bug I introduced in my last batch of changes.
10836
10837 2002-03-05  Ravi Pratap  <ravi@ximian.com>
10838
10839         * tree.cs (RecordEnum): Add. We now keep track of enums too.
10840
10841         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
10842         Enums since those are types too. 
10843
10844         * cs-parser.jay (enum_declaration): Record enums as we parse them.
10845
10846         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
10847         thanks to a call during the lookup process.
10848
10849 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
10850
10851         * statement.cs (Foreach): Lots of work to accomodate a particular
10852         kind of foreach statement that I had not kept in mind.  It is
10853         possible to have foreachs on classes that provide a GetEnumerator
10854         method that return objects that implement the "pattern" for using
10855         a foreach, there is no need to support GetEnumerator
10856         specifically. 
10857
10858         This is needed to compile nant.
10859
10860         * decl.cs: Only report 114 if the member is not `Finalize' and if
10861         the warning level is at least 2.
10862
10863         * class.cs: Moved the compare function from Method to
10864         MethodSignature. 
10865
10866         (MethodSignature.InheritableMemberSignatureCompare): Add new
10867         filter function that is used to extract inheritable methods from a
10868         class. 
10869
10870         (Method.Define): Use the new `inheritable_method_signature_filter'
10871         delegate
10872
10873         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
10874         command. 
10875
10876 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
10877
10878         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
10879
10880         * cs-parser.jay: Add opt_semicolon to the interface declaration.
10881
10882         * expression.cs: Pass location information to
10883         ConvertImplicitStandard. 
10884
10885         * class.cs: Added debugging code to track return values from
10886         interfaces. 
10887
10888 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
10889
10890         * expression.cs (Is.DoResolve): If either side of the `is' is an
10891         interface, do not flag the warning.
10892
10893         * ecore.cs (ImplicitReferenceConversion): We need a separate test
10894         for interfaces
10895
10896         * report.cs: Allow for --fatal to be used with --probe.
10897
10898         * typemanager.cs (NoTypes): Move the definition for the empty Type
10899         array here. 
10900
10901         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
10902         properties. 
10903         (TypeContainer.DefineProxy): New function used to proxy to parent
10904         implementations when implementing interfaces.
10905         (TypeContainer.ParentImplements): used to lookup if our parent
10906         implements a public function that is required by an interface.
10907         (TypeContainer.VerifyPendingMethods): Hook this up.
10908
10909         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
10910         `modules' and `assemblies' arraylists into arrays.  We only grow
10911         these are the very early start up of the program, so this improves
10912         the speedof LookupType (nicely measured).
10913
10914         * expression.cs (MakeByteBlob): Replaced unsafe code with
10915         BitConverter, as suggested by Paolo.
10916
10917         * cfold.cs (ConstantFold.Binary): Special case: perform constant
10918         folding of string concatenation, but if either side is a string,
10919         and the other is not, then return null, and let the runtime use
10920         the concatenation on the string plus the object (using
10921         `Object.ToString'). 
10922
10923 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
10924
10925         Constant Folding has been implemented now.
10926
10927         * expression.cs (Unary.Reduce): Do not throw an exception, catch
10928         the error instead on types that are not supported in one's
10929         complement. 
10930
10931         * constant.cs (Constant and all children): New set of functions to
10932         perform implict and explicit conversions.
10933
10934         * ecore.cs (EnumConstant): Implement the new functions to perform
10935         conversion by proxying to the child expression.
10936
10937         * codegen.cs: (ConstantCheckState): Constant evaluation has its
10938         own separate setting that can not be turned off from the command
10939         line using --unchecked or --checked and is only controlled using
10940         the checked/unchecked statements and expressions.  This setting is
10941         used by the constant folder to flag errors.
10942
10943         * expression.cs (CheckedExpr, UncheckedExpr): Set the
10944         ConstantCheckState as well.   
10945
10946         During Resolve, they also have to flag the state, because the
10947         constant folder runs completely in the Resolve phase.
10948
10949         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
10950         well.
10951
10952 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
10953
10954         * cfold.cs: New file, this file contains the constant folder.
10955
10956         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
10957         argument to track whether we are using the resulting address to
10958         load or store a value and provide better error messages. 
10959
10960         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
10961         new AddressOf arguments.
10962
10963         * statement.cs (Foreach.EmitCollectionForeach): Update
10964
10965         * expression.cs (Argument.Emit): Call AddressOf with proper
10966         arguments to track usage.
10967
10968         (New.DoEmit): Call AddressOf with new arguments.
10969
10970         (Unary.Emit): Adjust AddressOf call.
10971
10972 2002-03-01  Ravi Pratap  <ravi@ximian.com>
10973
10974         * cs-parser.jay (member_access): Change the case for pre-defined types
10975         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
10976         this suggestion.
10977
10978         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
10979         a method body.
10980
10981         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
10982         essentially like methods and apply attributes like MethodImplOptions to them too.
10983
10984         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
10985         not being null.
10986
10987         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
10988         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
10989         is the DeclSpace.
10990
10991         * Update code everywhere accordingly.
10992
10993         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
10994
10995         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
10996
10997 2002-02-28  Ravi Pratap  <ravi@ximian.com>
10998
10999         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
11000         try performing lookups against those instead of jumping straight into using
11001         the 'using' clauses.
11002
11003         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
11004
11005         (LookupType): Perform lookups in implicit parents too.
11006
11007         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
11008         sequence as RootContext.LookupType. 
11009
11010         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
11011         the various cases of namespace lookups into this method.
11012
11013 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
11014
11015         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
11016         in positional arguments)
11017
11018         * class.cs (Operator): Update the AllowedModifiers to contain
11019         extern. 
11020
11021         * cs-parser.jay: Update operator declaration to allow for the
11022         operator body to be empty.
11023
11024         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
11025         values. 
11026
11027 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
11028
11029         * class.cs (Method.Emit): Label parameters.
11030
11031         * driver.cs: Return 1 or 0 as the program exit code.
11032
11033 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
11034
11035         * expression.cs: Special case the `null' object when trying to
11036         auto-compute the type, as anything can be explicitly converted to
11037         that. 
11038
11039         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
11040         spotting this Paolo.
11041
11042         (Expression.ImplicitNumericConversion): Perform comparissions of
11043         the type using the underlying type in the case of an enumeration
11044         rather than using the enumeration type for the compare.
11045
11046         Cope with the underlying == type case, which is not possible to
11047         catch before. 
11048
11049         (Expression.ConvertNumericExplicit): Perform comparissions of
11050         the type using the underlying type in the case of an enumeration
11051         rather than using the enumeration type for the compare.
11052
11053         * driver.cs: If the user does not supply an extension, assume .exe
11054
11055         * cs-parser.jay (if_statement): Rewrote so that we can track the
11056         location for the if statement.
11057
11058         * expression.cs (Binary.ConstantFold): Only concat strings when
11059         the operation is "+", not everything ;-)
11060
11061         * statement.cs (Statement.EmitBoolExpression): Take a location
11062         argument. 
11063         (If, While, Do): Track location.
11064
11065         * expression.cs (Binary.ResolveOperator): In the object + string
11066         case, I was missing a call to ConvertImplicit
11067
11068 2002-02-25  Ravi Pratap  <ravi@ximian.com>
11069
11070         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
11071         Location arguments. Ensure we use RootContext.LookupType to do our work
11072         and not try to do a direct Type.GetType and ModuleBuilder.GetType
11073
11074         * interface.cs (PopulateMethod): Handle the type of the parameter being
11075         null gracefully.
11076
11077         * expression.cs (Invocation.BetterFunction): Handle the case when we 
11078         have a params method with no fixed arguments and a call is made with no
11079         arguments.
11080
11081 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
11082
11083         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
11084         the verbatim-string-literal
11085
11086         * support.cs (InternalParameters.ParameterModifier): handle null
11087         fixed parameters.
11088         (InternalParameters.ParameterType): ditto.
11089
11090         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
11091         duplicating the name of the variable parameter.
11092         (GetParameterByName): Fix bug where we were not looking up array
11093         paramters if they were the only present (thanks Paolo!).
11094         (GetParameterInfo): We only have an empty set of types if both
11095         fixed and array are set to null.
11096         (GetParameterInfo-idx): Handle FixedParameter == null
11097
11098         * cs-parser.jay: Handle the case where there is no catch
11099         statements (missing null test).
11100
11101 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
11102
11103         * driver.cs (MainDriver): Be conservative on our command line
11104         handling.
11105
11106         Catch DirectoryNotFoundException when calling GetFiles.
11107
11108         (SplitPathAndPattern): Used to split the input specification into
11109         a path and a pattern that we can feed to Directory.GetFiles.
11110
11111 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
11112
11113         * statement.cs (Fixed): Implement the last case of the Fixed
11114         statement (string handling).
11115
11116         * expression.cs (StringPtr): New class used to return a char * to
11117         a string;  Used by the Fixed statement.
11118
11119         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
11120
11121         * expression.cs (Binary.ResolveOperator): Remove redundant
11122         MemberLookup pn parent type.
11123         Optimize union call, we do not need a union if the types are the same.
11124         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
11125         type.
11126
11127         Specialize the use of MemberLookup everywhere, instead of using
11128         the default settings. 
11129
11130         (StackAlloc): Implement stackalloc keyword.
11131
11132         * cs-parser.jay: Add rule to parse stackalloc.
11133
11134         * driver.cs: Handle /h, /help, /?
11135
11136         * expression.cs (MakeByteBlob): Removed the hacks we had in place
11137         before we supported unsafe code.
11138
11139         * makefile: add --unsafe to the self compilation of mcs.
11140
11141 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
11142
11143         * expression.cs (PointerArithmetic): New class that is used to
11144         perform pointer arithmetic.
11145         (Binary.Resolve): Handle pointer arithmetic
11146         Handle pointer comparission.
11147         (ArrayPtr): Utility expression class that is used to take the
11148         address of an array.
11149
11150         (ElementAccess): Implement array access for pointers
11151
11152         * statement.cs (Fixed): Implement fixed statement for arrays, we
11153         are missing one more case before we are done.
11154
11155         * expression.cs (Indirection): Implement EmitAssign and set the
11156         ExprClass to Variable.  This allows pointer dereferences to be
11157         treated as variables, and to have values assigned to them.
11158
11159         * ecore.cs (Expression.StoreFromPtr): New utility function to
11160         store values dereferencing.
11161
11162 2002-02-20  Ravi Pratap  <ravi@ximian.com>
11163
11164         * expression.cs (Binary.ResolveOperator): Ensure that we are
11165         not trying to operate on a void type - this fixes the reported
11166         bug.
11167
11168         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
11169         the parent implementation is sealed.
11170
11171         * ../errors/cs0239.cs : Add.
11172
11173         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
11174
11175         * typemanager.cs (unverifiable_code_type): Corresponds to 
11176         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
11177         which have unsafe code in them.
11178
11179         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
11180         unsafe context.
11181
11182 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
11183
11184         * cs-tokenizer.cs: Add support for @"litreal strings"
11185
11186         Make tokenizer accept pre-processor directives
11187         on any column (remove the old C-like limitation). 
11188
11189         * rootcontext.cs (EmitCode): Emit any global attributes.
11190         (AddGlobalAttributes): Used to keep track of assembly attributes. 
11191
11192         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
11193
11194         * cs-parser.jay: Add support for global attributes.  
11195
11196 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
11197
11198         * expression.cs (Indirection): New helper class.  Unary will
11199         create Indirection classes to be able to implement the
11200         IMemoryLocation interface on it.
11201
11202 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
11203
11204         * cs-parser.jay (fixed_statement): reference the right statement.
11205
11206         * statement.cs (Fixed.Emit): Finish implementing the fixed
11207         statement for the &x case.
11208
11209 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
11210
11211         * class.cs (Property.Define, Method.Define): Remove newslot when
11212         `implementing'.  
11213
11214         * modifiers.cs: My use of NewSlot when `Abstract' was set was
11215         wrong.  NewSlot should only be used if the `new' keyword is present.
11216
11217         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
11218         locating our system dir.  Sorry about this.
11219
11220 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
11221
11222         * driver.cs (GetSystemDir): Compute correctly the location of our
11223         system assemblies.  I was using the compiler directory instead of
11224         the library directory.
11225
11226 2002-02-13  Ravi Pratap  <ravi@ximian.com>
11227
11228         * expression.cs (BetterFunction): Put back in what Miguel commented out
11229         since it is the correct fix. The problem is elsewhere ;-)
11230
11231         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
11232         parameters of the parms method are themselves compatible or not !
11233
11234         (StandardConversionExists): Fix very dangerous bug where we were forgetting
11235         to check that a class implements an interface before saying that an implicit
11236         conversion was allowed. Use ImplementsInterface to do the checking.
11237
11238 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
11239
11240         * class.cs (Method.Define): Track whether we are an explicit
11241         implementation or not.  And only call DefineMethodOverride if we
11242         are an explicit implementation.
11243
11244         (Property.DefineMethod): Ditto.
11245
11246 2002-02-11  Ravi Pratap  <ravi@ximian.com>
11247
11248         * expression.cs (BetterFunction): Catch hideous bug which was
11249          preventing us from detecting ambiguous calls due to implicit casts i.e
11250         cs0121.
11251
11252 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
11253
11254         * support.cs (Pair): Remove un-needed method.  I figured why I was
11255         getting the error in cs-parser.jay, the variable in a foreach loop
11256         is readonly, and the compiler does not really treat this as a variable.
11257
11258         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
11259         instead of EQUALS in grammar.  
11260
11261         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
11262
11263         * expression.cs (Unary.DoResolve): Check whether the argument is
11264         managed or not.
11265
11266 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
11267
11268         * support.cs: Api for Pair to set a value.  Despite the fact that
11269         the variables are public the MS C# compiler refuses to compile
11270         code that accesses the field if the variable is part of a foreach
11271         statement. 
11272
11273         * statement.cs (Fixed): Begin implementation of the fixed
11274         statement.
11275
11276         (Block.AddVariable): Return the VariableInfo on success and null
11277         on failure instead of true/false. 
11278
11279         * cs-parser.jay (foreach): Catch errors on variables already
11280         defined (we were ignoring this value before) and properly unwind
11281         the block hierarchy
11282
11283         (fixed_statement): grammar for the fixed statement.
11284
11285 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
11286
11287         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
11288         pointer types to be incretemented.
11289
11290         (SizeOf): Implement.
11291
11292         * cs-parser.jay (pointer_member_access): Implement
11293         expr->IDENTIFIER production.
11294
11295         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
11296         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
11297         on safe contexts.
11298
11299         (Unary): Implement indirection.
11300
11301         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
11302         use in non-unsafe context).
11303
11304         (SimpleName.DoResolve): Check for pointers in field access on safe
11305         contexts. 
11306
11307         (Expression.LoadFromPtr): Factor the load-indirect code in this
11308         function.  This was duplicated in UnboxCast and ParameterReference
11309
11310 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
11311
11312         * expression.cs (ComposedCast): report an error if a pointer cast
11313         is used in a safe region.
11314
11315         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
11316         pointer type casts in unsafe context.
11317
11318         * codegen.cs (EmitContext): Set up IsUnsafe.
11319
11320         * cs-parser.jay (non_expression_type): Add productions for pointer
11321         casts. 
11322
11323         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
11324         code.  We should not use force into static mode if the method is
11325         not virtual.  Fixes bug in MIS
11326
11327         * statement.cs (Do.Emit, While.Emit, For.Emit,
11328         Statement.EmitBoolExpression): Add support to Do and While to
11329         propagate infinite loop as `I do return' semantics.
11330
11331         Improve the For case to also test for boolean constants.
11332
11333         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
11334         to the list of attributes we can add.
11335
11336         Remove `EmitContext' argument.
11337
11338         * class.cs (Method.Define): Apply parameter attributes.
11339         (Constructor.Define): Apply parameter attributes.
11340         (MethodCore.LabelParameters): Move here the core of labeling
11341         parameters. 
11342
11343         * support.cs (ReflectionParameters.ParameterModifier,
11344         InternalParameters.ParameterModifier): Use IsByRef on the type and
11345         only return the OUT bit for these parameters instead of in/out/ref
11346         flags.
11347
11348         This is because I miss-understood things.  The ParameterInfo.IsIn
11349         and IsOut represent whether the parameter has the [In] and [Out]
11350         attributes set.  
11351
11352 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
11353
11354         * ecore.cs (FieldExpr.Emit): Release temporaries.
11355
11356         * assign.cs (LocalTemporary.Release): new function.
11357
11358         * codegen.cs (EmitContext.GetTemporaryStorage,
11359         EmitContext.FreeTemporaryStorage): Rework the way we deal with
11360         temporary storage.  Now we can "put back" localbuilders when we
11361         are done with them
11362
11363 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
11364
11365         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
11366         need to make a copy of the variable to generate verifiable code.
11367
11368 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
11369
11370         * driver.cs: Compute dynamically the system directory.
11371
11372         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
11373         Slower, but more generally useful.  Used by the abstract
11374         registering implementation. 
11375
11376         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
11377         the rules for the special rule on Type/instances.  First check if
11378         we have the same name, and if so, try that special static path
11379         rather than the instance path.
11380
11381 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
11382
11383         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
11384         for, while and if.
11385
11386         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
11387         Enum, ValueType, Delegate or Array for non-corlib compiles.
11388
11389         * cs-tokenizer.cs: Catch long identifiers (645)
11390
11391         * typemanager.cs (IndexerPropetyName): Ravi never tested this
11392         piece of code.
11393
11394         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
11395         fix, we were returning too early, so we were not registering
11396         pending methods from abstract classes.
11397
11398         Do not register pending methods if the class is abstract.
11399
11400         * expression.cs (Conditional.DoResolve): Report circular implicit
11401         conversions when we neecd to compute it for conditional
11402         expressions. 
11403
11404         (Is.DoResolve): If the expression is always of the provided type,
11405         flag warning 183.  If the expression can not ever be of the
11406         provided type flag warning 184.
11407
11408         * class.cs: Catch 169 as well.
11409
11410         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
11411         read. 
11412
11413 2002-01-18  Nick Drochak  <ndrochak@gol.com>
11414
11415         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
11416
11417 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
11418
11419         * interface.cs: (PopulateMethod): Check for pointers being defined
11420         only if the unsafe context is active.
11421         (PopulateProperty): ditto.
11422         (PopulateIndexer): ditto.
11423
11424         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
11425         specified.  If pointers are present, make sure that they are
11426         present in an unsafe context.
11427         (Constructor, Constructor.Define): ditto.
11428         (Field, Field.Define): ditto.
11429         (Property, Property.Define): ditto.
11430         (Event, Event.Define): ditto.
11431
11432         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
11433         hashtable if there are classes or structs defined.
11434
11435         * expression.cs (LocalVariableReference.DoResolve): Simplify this
11436         code, as the constant resolution moved.
11437
11438         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
11439         the metadata, so we can flag error 133. 
11440
11441         * decl.cs (MemberCore.UnsafeOK): New function to test that a
11442         pointer is being declared in an unsafe context.
11443
11444 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
11445
11446         * modifiers.cs (Modifiers.Check): Require a Location argument.
11447         Report error 227 for Unsafe use.
11448
11449         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
11450
11451         * statement.cs (For.Emit): If the test is null, then report that
11452         we do `return', as we wont reach anything afterwards.
11453
11454         (Switch.SwitchGoverningType): Track the expression that matched
11455         the conversion.
11456
11457         * driver.cs: Allow negative numbers as an error code to flag.
11458
11459         * cs-parser.jay: Handle 1551.
11460
11461         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
11462
11463 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
11464
11465         * cs-parser.jay: Report 1518 (type declaration can only contain
11466         class, struct, interface, enum or delegate)
11467
11468         (switch_label): Report 1523 (keywords `case' or `default' must
11469         preced code)
11470
11471         (opt_switch_sections): Report 1522 (empty switch)
11472
11473         * driver.cs: Report 1515 (response file specified multiple times)
11474         Report 1516 (Source file specified multiple times).
11475
11476         * expression.cs (Argument.Resolve): Signal 1510
11477
11478         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
11479         access not allowed in static code)
11480
11481 2002-01-11  Ravi Pratap  <ravi@ximian.com>
11482
11483         * typemanager.cs (IsPointerType): Utility method which we are going
11484         to need a lot.
11485
11486         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
11487         the object type, so we take care of that.
11488
11489         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
11490
11491         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
11492         added to non-params parameters :-)
11493
11494         * typemanager.cs (CSharpName): Include 'void' type too. 
11495
11496         (void_ptr_type): Include in the set of core types.
11497
11498         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
11499         duplicating code.
11500
11501         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
11502         an unsafe context.
11503
11504         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
11505         completely forgotten about it.
11506
11507 2002-01-10  Ravi Pratap  <ravi@ximian.com>
11508
11509         * cs-parser.jay (pointer_type): Add. This begins our implementation
11510         of parsing rules for unsafe code.
11511
11512         (unsafe_statement): Implement.
11513
11514         (embedded_statement): Modify to include the above.
11515
11516         * statement.cs (Unsafe): Implement new class for unsafe blocks.
11517
11518         * codegen.cs (EmitContext.InUnsafe): Add. This determines
11519         if the current context is an unsafe one.
11520
11521         * cs-parser.jay (local_variable_pointer_type): Since local variable types
11522         are handled differently, we need separate rules for them.
11523
11524         (local_variable_declaration): Update to use local_variable_pointer_type
11525         to allow variable declarations of unmanaged pointer types.
11526
11527         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
11528         in unsafe contexts.
11529
11530         * ../errors/cs0214.cs : Add.
11531
11532 2002-01-16  Nick Drochak  <ndrochak@gol.com>
11533
11534         * makefile: remove 'response' file when cleaning.
11535
11536 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
11537
11538         * cs-parser.jay: Report 1524.
11539
11540 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
11541
11542         * typemanager.cs (RegisterMethod): drop checking if we have
11543         registered this from here
11544
11545 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
11546
11547         * class.cs (Method.EmitDestructor): Implement calling our base
11548         destructor. 
11549
11550         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
11551         value of InFinally.
11552
11553         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
11554         this routine and will wrap the call in a try/catch block.  Deal
11555         with the case.
11556
11557 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
11558
11559         * ecore.cs (Expression.MemberLookup): instead of taking a
11560         parameter `same_type' that was used to tell whether we could
11561         access private members we compute our containing type from the
11562         EmitContext.
11563
11564         (FieldExpr): Added partial support for volatile fields.  This does
11565         not work for volatile fields exposed from assemblies, as I can not
11566         figure out how to extract the modreq from it.
11567
11568         Updated all the source files to use this.
11569
11570         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
11571         because it is referenced by MemberLookup very often. 
11572
11573 2002-01-09  Ravi Pratap  <ravi@ximian.com>
11574
11575         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
11576         TypeBuilder.GetCustomAttributes to retrieve what we need.
11577
11578         Get rid of redundant default_member_attr_type as this is the same as
11579         default_member_type which already exists.
11580
11581         * interface.cs, attribute.cs : Update accordingly.
11582
11583 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
11584
11585         * typemanager.cs: Enable IndexerPropertyName again.  It does not
11586         work for TYpeBuilders though.  Ravi, can you please fix this?
11587
11588         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
11589
11590         * expression.cs (Argument.Emit): Handle the case of ref objects
11591         being passed to ref functions;  
11592
11593         (ParameterReference.EmitLoad): Loads the content of the pointer
11594         without dereferencing.
11595
11596 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
11597
11598         * cs-tokenizer.cs: Implemented the pre-processing expressions.
11599
11600 2002-01-08  Ravi Pratap  <ravi@ximian.com>
11601
11602         * class.cs (Indexer.DefineMethod): Incorporate the interface
11603         type in the name of the method if we are doing explicit interface
11604         implementation.
11605
11606         * expression.cs (ConversionExists): Remove as it is completely obsolete.
11607
11608         (BetterConversion): Fix extremely trivial bug where we were referring to
11609         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
11610         again !
11611
11612         * ../errors/bug16.cs : Add although we have fixed it.
11613
11614 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
11615
11616         * expression.cs (BaseIndexer): Begin implementation.
11617
11618         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
11619
11620         * cs-parser.jay (indexer_declarator): Use qualified_identifier
11621         production directly to remove a shift/reduce, and implement
11622         explicit interface implementation.
11623
11624         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
11625         after a floating point suffix.
11626
11627         * expression.cs (DoNumericPromotions): Improved the conversion for
11628         uint/uint.  If we have a constant, we avoid doing a typecast to a
11629         larger type.
11630
11631         * class.cs (Indexer): Implement explicit interface implementation
11632         for indexers.
11633
11634 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
11635
11636         * class.cs: make the default instance constructor public and hidebysig.
11637
11638 2001-01-03  Ravi Pratap  <ravi@ximian.com>
11639
11640         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
11641         so we can call it from elsewhere.
11642
11643         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
11644         we emit it internally if the class has a defined indexer; otherwise the user
11645         emits it by decorating the class definition with the DefaultMemberAttribute.
11646
11647         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
11648         attribute is not used on a type which defines an indexer.
11649
11650         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
11651         character when we skip whitespace.
11652
11653         * ../errors/cs0646.cs : Add.
11654
11655 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
11656
11657         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
11658         again. 
11659
11660         * makefile: Add practical target `mcs3.exe' which builds the third
11661         generation compiler. 
11662
11663         * expression.cs (New): Fix structures constructor calling.
11664
11665         * class.cs (Property, Method, Indexer): Emit Final flag on the
11666         method if we are an interface implementation and we are not
11667         abstract. 
11668
11669         * ecore.cs (PropertyExpr): New public field `IsBase', tells
11670         whether this property is referencing a `base' method.
11671
11672         * expression.cs (Invocation.EmitCall): take an extra argument:
11673         is_base, this is used to determine whether the `call' or
11674         `callvirt' opcode should be used.
11675
11676
11677         * delegate.cs: update EmitCall.
11678
11679         * class.cs (Method.Define): Set NewSlot for the cases where we are
11680         not implementing an interface method.
11681
11682         (Property.Define): ditto.
11683
11684 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
11685
11686         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
11687         'r'.  Allows mcs to parse itself fully.
11688
11689 2002-01-02  Ravi Pratap  <ravi@ximian.com>
11690
11691         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
11692         of the number of initializers that require the InitializeArray method.
11693
11694         (CheckIndices): Store the Expression in all cases - not the plain value. Also
11695         update the above field where necessary.
11696
11697         (MakeByteBlob): Update accordingly.
11698
11699         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
11700         greater than 2.
11701
11702         (EmitDynamicInitializers): Update in accordance with the new optimization.
11703
11704         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
11705         same OpCode applies.
11706
11707         * cs-parser.jay : Fix some glaring errors I introduced.
11708
11709 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
11710
11711         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
11712         so that we can check for name clashes there too.
11713
11714         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
11715         for interface indexers.
11716
11717         * interfaces.cs (Define): Emit the default member attribute.
11718
11719         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
11720         variable was being referred to while setting the value ;-)
11721
11722 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
11723
11724         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
11725         byte-by-byte information when we know the data is zero.
11726
11727         Make the block always a multiple of 4, because
11728         DefineInitializedData has a bug.
11729
11730         * assign.cs: Fix, we should assign from the temporary, not from
11731         the source. 
11732
11733         * expression.cs (MakeByteBlob): Fix my incorrect code.
11734
11735 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
11736
11737         * typemanager.cs (EnumToUnderlying): This function is used to get
11738         the underlying type from an enumeration, because it does not
11739         always work. 
11740
11741         * constant.cs: Use the I4_S form for values between -128 and 127.
11742
11743         * statement.cs (Block.LookupLabel): Looks up a label.
11744         (Block): Drop support for labeled blocks.
11745
11746         (LabeledStatement): New kind of statement that represents a label
11747         only.
11748
11749         (Goto): Finally implement this bad boy.
11750
11751         * cs-parser.jay: Update to reflect new mechanism to implement
11752         labels.
11753
11754 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
11755
11756         * codegen.cs (EmitContext.This): a codegen property that keeps the
11757         a single instance of this instead of creating many different this
11758         instances. 
11759
11760         * delegate.cs (Delegate.DoResolve): Update to use the property;
11761
11762         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
11763
11764         * expression.cs (BaseAccess.DoResolve): Ditto.
11765
11766 2001-12-29  Ravi Pratap  <ravi@ximian.com>
11767
11768         * typemanager.cs (methodimpl_attr_type): Add to hold the type
11769         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
11770
11771         (InitCoreTypes): Update accordingly.
11772
11773         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
11774         so we can quickly store the state.
11775
11776         (ApplyAttributes): Set the correct implementation flags
11777         for InternalCall methods.
11778
11779 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
11780
11781         * expression.cs (EmitCall): if a method is not virtual, then do
11782         not use callvirt on it.
11783
11784         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
11785         user defined stuff) requires the use of stobj, which takes an
11786         address on the stack instead of an array and an index.  So emit
11787         the Ldelema operation for it.
11788
11789         (EmitStoreOpcode): Use stobj for valuetypes.
11790
11791         (UnaryMutator.EmitCode): Use the right 1 value depending on
11792         whether we are dealing with int64/uint64, float or doubles.
11793
11794         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
11795         constructors that I implemented last night.
11796
11797         (Constructor.IsDefault): Fix to work properly for static
11798         constructors.
11799
11800         * cs-parser.jay (CheckDef): report method signature errors.
11801         Update error number 103 to be 132.
11802
11803         * decl.cs: New AdditionResult enumeration value: MethodExists.
11804         Although we do this check for methods later on in the semantic
11805         analysis, catching repeated default constructors is so easy that
11806         we catch these here. 
11807
11808         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
11809         promotions code.
11810
11811         (ParameterReference.EmitAssign, Emit): handle
11812         bools as bytes.
11813
11814         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
11815         (ArrayAccess.EmitStoreOpcode): ditto.
11816
11817         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
11818
11819         * expression.cs (MakeByteBlob): Complete all the missing types
11820         (uint, short, ushort, byte, sbyte)
11821
11822         * class.cs: Only init instance field initializers on instance
11823         constructors. 
11824
11825         Rename `constructors' to instance_constructors. 
11826
11827         (TypeContainer.AddConstructor): Only add constructors to the list
11828         if it is not static.
11829
11830         Make sure that we handle default_static_constructor independently
11831         everywhere where we handle instance_constructors
11832
11833 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
11834
11835         * class.cs: Do not lookup or create a base initializer for a
11836         static constructor.
11837
11838         (ConstructorInitializer.Resolve): use the proper type to lookup
11839         for constructors.
11840
11841         * cs-parser.jay: Report error 1585 (modifiers between type and name).
11842
11843         * enum.cs, interface.cs: Remove CloseType, this is taken care by
11844         in DeclSpace. 
11845
11846         * decl.cs: CloseType is now an virtual method, the default
11847         implementation just closes this type.
11848
11849 2001-12-28  Ravi Pratap  <ravi@ximian.com>
11850
11851         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
11852         to PreserveSig by default. Also emit HideBySig on such methods.
11853
11854         Basically, set the defaults to standard values.
11855
11856         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
11857         argument, if candidate is better, it can't be worse than the best !
11858
11859         (Invocation): Re-write bits to differentiate between methods being
11860         applicable in their expanded form and their normal form - for params
11861         methods of course.
11862
11863         Get rid of use_standard everywhere as only standard conversions are allowed
11864         in overload resolution. 
11865
11866         More spec conformance.
11867
11868 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
11869
11870         * driver.cs: Add --timestamp, to see where the compiler spends
11871         most of its time.
11872
11873         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
11874         `this' in static code.
11875
11876         (SimpleName.DoResolve): Implement in terms of a helper function
11877         that allows static-references to be passed upstream to
11878         MemberAccess.
11879
11880         (Expression.ResolveWithSimpleName): Resolve specially simple
11881         names when called by MemberAccess to implement the special
11882         semantics. 
11883
11884         (Expression.ImplicitReferenceConversion): Handle conversions from
11885         Null to reference types before others, as Null's type is
11886         System.Object. 
11887
11888         * expression.cs (Invocation.EmitCall): Handle the special case of
11889         calling methods declared on a reference type from a ValueType
11890         (Base classes System.Object and System.Enum)
11891
11892         (MemberAccess.Resolve): Only perform lookups on Enumerations if
11893         the left hand side is a TypeExpr, not on every enumeration. 
11894
11895         (Binary.Resolve): If types are reference types, then do a cast to
11896         object on operators != and == of both arguments.
11897
11898         * typemanager.cs (FindMembers): Extract instance and static
11899         members if requested.
11900
11901         * interface.cs (PopulateProperty): Use void_type instead of null
11902         as the return type for the setter method.
11903
11904         (PopulateIndexer): ditto.
11905
11906 2001-12-27  Ravi Pratap  <ravi@ximian.com>
11907
11908         * support.cs (ReflectionParameters): Fix minor bug where we
11909         were examining the wrong parameter for the ParamArray attribute.
11910
11911         Cope with requests for the type of the parameter at position
11912         greater than the params parameter's. We now return the element
11913         type of the params array as that makes more sense.
11914
11915         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
11916         accordingly as we no longer have to extract the element type
11917         ourselves.
11918
11919         (Invocation.OverloadResolve): Update.
11920
11921 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
11922
11923         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
11924         against IEnumerator, test whether the return value is a descendant
11925         of the IEnumerator interface.
11926
11927         * class.cs (Indexer.Define): Use an auxiliary method to implement
11928         the other bits of the method definition.  Begin support for
11929         explicit interface implementation.
11930
11931         (Property.DefineMethod): Use TypeManager.void_type instead of null
11932         for an empty return value.
11933
11934 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
11935
11936         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
11937         dealing with a FieldExpr which is composed of a FieldBuilder, in
11938         the code path we did extract the constant, but we should have
11939         obtained the underlying value to be able to cast it (otherwise we
11940         end up in an infinite loop, this is what Ravi was running into).
11941
11942         (ArrayCreation.UpdateIndices): Arrays might be empty.
11943
11944         (MemberAccess.ResolveMemberAccess): Add support for section
11945         14.5.4.1 that deals with the special case of E.I when E is a type
11946         and something else, that I can be a reference to a static member.
11947
11948         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
11949         handle a particular array type to create byte blobs, it is just
11950         something we dont generate byteblobs for.
11951
11952         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
11953         arguments. 
11954
11955         * location.cs (Push): remove the key from the hashtable that we
11956         are about to add.   This happens for empty files.
11957
11958         * driver.cs: Dispose files after we have parsed them.
11959
11960         (tokenize): new function that only runs the tokenizer on its
11961         input, for speed testing.
11962
11963 2001-12-26  Ravi Pratap  <ravi@ximian.com>
11964
11965         * class.cs (Event.Define): Define the private field only if there
11966         are no accessors defined.
11967
11968         * expression.cs (ResolveMemberAccess): If there is no associated
11969         field with the event, that means we have an event defined with its
11970         own accessors and we should flag error cs0070 since transforming
11971         ourselves into a field is not valid in that case.
11972
11973         * ecore.cs (SimpleName.DoResolve): Same as above.
11974
11975         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
11976         and charset to sane values.
11977
11978 2001-12-25  Ravi Pratap  <ravi@ximian.com>
11979
11980         * assign.cs (DoResolve): Perform check on events only if they 
11981         are being accessed outside the declaring type.
11982
11983         * cs-parser.jay (event_declarations): Update rules to correctly
11984         set the type of the implicit parameter etc.
11985
11986         (add_accessor, remove_accessor): Set current local parameters.
11987
11988         * expression.cs (Binary): For delegate addition and subtraction,
11989         cast the return value from the method into the appropriate delegate
11990         type.
11991
11992 2001-12-24  Ravi Pratap  <ravi@ximian.com>
11993
11994         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
11995         of these as the workaround is unnecessary.
11996
11997         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
11998         delegate data - none of that is needed at all.
11999
12000         Re-write bits to extract the instance expression and the delegate method
12001         correctly.
12002
12003         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
12004         on delegates too.
12005
12006         * attribute.cs (ApplyAttributes): New method to take care of common tasks
12007         of attaching attributes instead of duplicating code everywhere.
12008
12009         * everywhere : Update code to do attribute emission using the above method.
12010
12011 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
12012
12013         * expression.cs (IsParamsMethodApplicable): if there are not
12014         parameters, return immediately.
12015
12016         * ecore.cs: The 0 literal can be implicity converted to an enum
12017         type. 
12018
12019         (SimpleName.DoResolve): First lookup the type, then lookup the
12020         members. 
12021
12022         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
12023         want to get its address.  If the InstanceExpression is not
12024         addressable, store the result in a temporary variable, then get
12025         the address of it.
12026
12027         * codegen.cs: Only display 219 errors on warning level or above. 
12028
12029         * expression.cs (ArrayAccess): Make it implement the
12030         IMemoryLocation interface.
12031
12032         (Binary.DoResolve): handle the operator == (object a, object b)
12033         and operator != (object a, object b) without incurring into a
12034         BoxedCast (because 5 != o should never be performed).
12035
12036         Handle binary enumerator operators.
12037
12038         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
12039         value type, otherwise use Ldelem_ref.
12040
12041         Use precomputed names;
12042
12043         (AddressOf): Implement address of
12044
12045         * cs-parser.jay (labeled_statement): Fix recursive block
12046         addition by reworking the production.
12047
12048         * expression.cs (New.DoEmit): New has a special case:
12049                 
12050                  If we are dealing with a ValueType, we have a few
12051                  situations to deal with:
12052                 
12053                     * The target of New is a ValueType variable, that is
12054                       easy, we just pass this as the variable reference
12055                 
12056                     * The target of New is being passed as an argument,
12057                       to a boxing operation or a function that takes a
12058                       ValueType.
12059                 
12060                       In this case, we need to create a temporary variable
12061                       that is the argument of New.
12062
12063
12064 2001-12-23  Ravi Pratap  <ravi@ximian.com>
12065
12066         * rootcontext.cs (LookupType): Check that current_type is not null before
12067         going about looking at nested types.
12068
12069         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
12070         not implement the IAssignMethod interface any more.
12071
12072         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
12073         where we tranform them into FieldExprs if they are being resolved from within
12074         the declaring type.
12075
12076         * ecore.cs (SimpleName.DoResolve): Do the same here.
12077
12078         * assign.cs (DoResolve, Emit): Clean up code considerably. 
12079
12080         * ../errors/bug10.cs : Add.
12081
12082         * ../errors/cs0070.cs : Add.
12083
12084         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
12085
12086         * assign.cs : Get rid of EventIsLocal everywhere.
12087
12088 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
12089
12090         * ecore.cs (ConvertIntLiteral): finished the implementation.
12091
12092         * statement.cs (SwitchLabel): Convert the value we are using as a
12093         key before looking up the table.
12094
12095 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
12096
12097         * codegen.cs (EmitTopBlock): Require a Location argument now.
12098
12099         * cs-parser.jay (constructor_declarator): We need to setup
12100         current_local_parameters before we parse the
12101         opt_constructor_initializer, to allow the variables to be bound
12102         to the constructor arguments.
12103
12104         * rootcontext.cs (LookupType): First lookup nested classes in our
12105         class and our parents before we go looking outside our class.
12106
12107         * expression.cs (ConstantFold): Extract/debox the values at the
12108         beginnning. 
12109
12110         * rootcontext.cs (EmitCode): Resolve the constants first before we
12111         resolve the types.  This is not really needed, but it helps debugging.
12112
12113         * statement.cs: report location.
12114
12115         * cs-parser.jay: pass location to throw statement.
12116
12117         * driver.cs: Small bug fix.
12118
12119         * report.cs: Updated format to be 4-zero filled digits.
12120
12121 2001-12-22  Ravi Pratap  <ravi@ximian.com>
12122
12123         * expression.cs (CheckIndices): Fix minor bug where the wrong
12124         variable was being referred to ;-)
12125
12126         (DoEmit): Do not call EmitStaticInitializers when the 
12127         underlying type is System.Object.
12128
12129 2001-12-21  Ravi Pratap  <ravi@ximian.com>
12130
12131         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
12132         and do the usual workaround for SRE.
12133
12134         * class.cs (MyEventBuilder.EventType): New member to get at the type
12135         of the event, quickly.
12136
12137         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
12138
12139         * assign.cs (Assign.DoResolve): Handle the case when the target
12140         is an EventExpr and perform the necessary checks.
12141
12142         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
12143         interface.
12144
12145         (SimpleName.MemberStaticCheck): Include check for EventExpr.
12146
12147         (EventExpr): Set the type in the constructor itself since we 
12148         are meant to be born fully resolved.
12149
12150         (EventExpr.Define): Revert code I wrote earlier.
12151                 
12152         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
12153         instance expression is null. The instance expression is a This in that case
12154         or a null, depending on whether it is a static method or not.
12155
12156         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
12157         refers to more than one method.
12158
12159         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
12160         and accordingly flag errors.
12161
12162 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
12163
12164         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
12165
12166 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
12167
12168         * location.cs (ToString): Provide useful rutine.
12169
12170 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
12171
12172         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
12173         objects, return the actual integral boxed.
12174
12175         * statement.cs (SwitchLabel): define an ILLabel for each
12176         SwitchLabel. 
12177
12178         (Switch.CheckSwitch): If the value is a Literal, extract
12179         the underlying literal.
12180
12181         Also in the unused hashtable we had, add the SwitchLabel so we can
12182         quickly look this value up.
12183
12184         * constant.cs: Implement a bunch of new constants.  Rewrite
12185         Literal based on this.  Made changes everywhere to adapt to this.
12186
12187         * expression.cs (Expression.MakeByteBlob): Optimize routine by
12188         dereferencing array only once, and also copes with enumrations.
12189
12190         bytes are two bytes wide, not one.
12191
12192         (Cast): Perform constant conversions.
12193
12194         * ecore.cs (TryImplicitIntConversion): Return literals instead of
12195         wrappers to the literals here.
12196
12197         * expression.cs (DoNumericPromotions): long literals can converted
12198         to ulong implicity (this is taken care of elsewhere, but I was
12199         missing this spot).
12200
12201         * ecore.cs (Expression.Literalize): Make the return type Literal,
12202         to improve type checking.
12203
12204         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
12205
12206 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
12207
12208         * literal.cs: Revert code from ravi that checked the bounds.  The
12209         bounds are sane by the definition of the type itself. 
12210
12211         * typemanager.cs: Fix implementation of ImplementsInterface.  We
12212         need to actually look up in our parent hierarchy for interfaces
12213         implemented. 
12214
12215         * const.cs: Use the underlying type for enumerations
12216
12217         * delegate.cs: Compute the basename for the delegate creation,
12218         that should fix the delegate test case, and restore the correct
12219         Type Lookup semantics in rootcontext
12220
12221         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
12222         referencing a nested type with the Reflection API is using the "+"
12223         sign. 
12224
12225         * cs-parser.jay: Do not require EOF token at the end.
12226
12227 2001-12-20  Ravi Pratap  <ravi@ximian.com>
12228
12229         * rootcontext.cs (LookupType): Concatenate type names with
12230         a '.' instead of a '+' The test suite passes again.
12231
12232         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
12233         field of the enumeration.
12234
12235         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
12236         the case when the member is an EventExpr.
12237
12238         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
12239         static has an associated instance expression.
12240
12241         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
12242
12243         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
12244
12245         * class.cs (Event.Define): Register event and perform appropriate checks
12246         for error #111.
12247
12248         We define the Add and Remove methods even if the use provides none because
12249         in that case, we provide default implementations ourselves.
12250
12251         Define a private field of the type of the event. This is done by the CSC compiler
12252         and we should be doing it too ;-)
12253
12254         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
12255         More methods we use in code we generate.
12256
12257         (multicast_delegate_type, delegate_type): Two separate types since the distinction
12258         is important.
12259
12260         (InitCoreTypes): Update accordingly for the above.
12261
12262         * class.cs (Event.Emit): Generate code for default accessors that we provide
12263
12264         (EmitDefaultMethod): Do the job in the above.
12265
12266         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
12267         appropriate place.
12268
12269 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
12270
12271         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
12272         builders even if we were missing one.
12273
12274         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
12275         pass the Basename as our class name instead of the Name.  The
12276         basename will be correctly composed for us.
12277
12278         * parameter.cs (Paramters): Now takes a Location argument.
12279
12280         * decl.cs (DeclSpace.LookupType): Removed convenience function and
12281         make all the code call directly LookupType in RootContext and take
12282         this chance to pass the Location information everywhere.
12283
12284         * Everywhere: pass Location information.
12285
12286 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
12287
12288         * class.cs (Constructor.Define): Updated way of detecting the
12289         length of the parameters.
12290
12291         (TypeContainer.DefineType): Use basename as the type name for
12292         nested types.
12293
12294         (TypeContainer.Define): Do not recursively define types here, as
12295         definition is taken care in order by the RootContext.
12296
12297         * tree.cs: Keep track of namespaces in a per-file basis.
12298
12299         * parameter.cs (Parameter.ComputeSignature): Update to use
12300         DeclSpace. 
12301
12302         (Parameters.GetSignature): ditto.
12303
12304         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
12305         instead of a TypeContainer.
12306
12307         (Interface.SemanticAnalysis): Use `this' instead of our parent to
12308         resolve names.  Because we need to be resolve in our context, not
12309         our parents.
12310
12311         * driver.cs: Implement response files.
12312
12313         * class.cs (TypeContainer.DefineType): If we are defined, do not
12314         redefine ourselves.
12315
12316         (Event.Emit): Emit the code for add/remove handlers.
12317         (Event.Define): Save the MethodBuilders for add/remove.
12318
12319         * typemanager.cs: Use pair here too.
12320
12321         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
12322         DictionaryEntry requires the first argument to be non-null.  
12323
12324         (enum_declaration): Compute full name for registering the
12325         enumeration.
12326
12327         (delegate_declaration): Instead of using
12328         formal_parameter_list, use opt_formal_parameter_list as the list
12329         can be empty.
12330
12331         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
12332         (EventParsing): New property that controls whether `add' and
12333         `remove' are returned as tokens or identifiers (for events);
12334
12335 2001-12-19  Ravi Pratap  <ravi@ximian.com>
12336
12337         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
12338         use MyEventBuilder only and let it wrap the real builder for us.
12339
12340         (MyEventBuilder): Revamp constructor etc.
12341
12342         Implement all operations that we perform on EventBuilder in precisely the same
12343         way here too.
12344
12345         (FindMembers): Update to use the EventBuilder member.
12346
12347         (Event.Emit): Update accordingly.
12348
12349 2001-12-18  Ravi Pratap  <ravi@ximian.com>
12350
12351         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
12352         by calling the appropriate methods.
12353
12354         (GetCustomAttributes): Make stubs as they cannot possibly do anything
12355         useful.
12356
12357         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
12358
12359 2001-12-17  Ravi Pratap  <ravi@ximian.com>
12360
12361         * delegate.cs (Delegate.Populate): Check that the return type
12362         and various parameters types are indeed accessible.
12363
12364         * class.cs (Constructor.Define): Same here.
12365
12366         (Field.Define): Ditto.
12367
12368         (Event.Define): Ditto.
12369
12370         (Operator.Define): Check that the underlying Method defined itself
12371         correctly - so it's MethodBuilder should not be null.
12372
12373         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
12374         expression happens to be null.
12375
12376         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
12377         members but as of now we don't seem to be able to do anything really useful with it.
12378
12379         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
12380         not the EventBuilder.
12381
12382 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
12383
12384         * cs-tokenizer.cs: Add support for defines.
12385         Add support for #if, #elif, #else, #endif
12386
12387         (eval_var): evaluates a variable.
12388         (eval): stubbed for evaluating functions.
12389
12390         * cs-parser.jay: Pass the defines information
12391
12392         * driver.cs: Add --define command line option.
12393
12394         * decl.cs: Move MemberCore here.
12395
12396         Make it the base class for DeclSpace.  This allows us to catch and
12397         report 108 and 109 for everything now.
12398
12399         * class.cs (TypeContainer.Define): Extract all the members
12400         before populating and emit the warning 108 (new keyword required
12401         to override) instead of having each member implement this.
12402
12403         (MemberCore.Define): New abstract method, we will be using this in
12404         the warning reporting engine in Populate.
12405
12406         (Operator.Define): Adjust to new MemberCore protocol. 
12407
12408         * const.cs (Const): This does not derive from Expression, it is a
12409         temporary object we use to create fields, it is a MemberCore. 
12410
12411         * class.cs (Method.Define): Allow the entry point to be in a
12412         specific class.
12413
12414         * driver.cs: Rewrite the argument handler to clean it up a bit.
12415
12416         * rootcontext.cs: Made it just an auxiliary namespace feature by
12417         making everything static.
12418
12419         * driver.cs: Adapt code to use RootContext type name instead of
12420         instance variable.
12421
12422         * delegate.cs: Remove RootContext argument.
12423
12424         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
12425         argument. 
12426
12427         * class.cs (Event.Define): The lookup can fail.
12428
12429         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
12430
12431         * expression.cs: Resolve the this instance before invoking the code.
12432
12433 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
12434
12435         * cs-parser.jay: Add a production in element_access that allows
12436         the thing to become a "type" reference.  This way we can parse
12437         things like "(string [])" as a type.
12438
12439         Note that this still does not handle the more complex rules of
12440         casts. 
12441
12442
12443         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
12444
12445         * ecore.cs: (CopyNewMethods): new utility function used to
12446         assemble the list of methods from running FindMembers.
12447
12448         (MemberLookup): Rework FindMembers so that 
12449
12450 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
12451
12452         * class.cs (TypeContainer): Remove Delegates who fail to be
12453         defined.
12454
12455         * delegate.cs (Populate): Verify that we dont get null return
12456         values.   TODO: Check for AsAccessible.
12457
12458         * cs-parser.jay: Use basename to emit error 574 (destructor should
12459         have the same name as container class), not the full name.
12460
12461         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
12462         possible representation.  
12463
12464         Also implements integer type suffixes U and L.
12465
12466 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
12467
12468         * expression.cs (ArrayCreation.DoResolve): We need to do the
12469         argument resolution *always*.
12470
12471         * decl.cs: Make this hold the namespace.  Hold the root context as
12472         well.
12473         (LookupType): Move here.
12474
12475         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
12476
12477         * location.cs (Row, Name): Fixed the code, it was always returning
12478         references to the first file.
12479
12480         * interface.cs: Register properties defined through interfaces.
12481
12482         * driver.cs: Add support for globbing on the command line
12483
12484         * class.cs (Field): Make it derive from MemberCore as well.
12485         (Event): ditto.
12486
12487 2001-12-15  Ravi Pratap  <ravi@ximian.com>
12488
12489         * class.cs (Event::Define): Check that the type of the event is a delegate
12490         type else flag error #66.
12491
12492         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
12493         same.
12494
12495         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
12496         values of EntryPoint, CharSet etc etc.
12497
12498         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
12499
12500         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
12501         be null and we should ignore this. I am not sure if this is really clean. Apparently,
12502         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
12503         which needs this to do its work.
12504
12505         * ../errors/cs0066.cs : Add.
12506
12507 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
12508
12509         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
12510         helper functions.
12511
12512         * class.cs: (MethodSignature.MethodSignature): Removed hack that
12513         clears out the parameters field.
12514         (MemberSignatureCompare): Cleanup
12515
12516         (MemberCore): New base class used to share code between MethodCore
12517         and Property.
12518
12519         (RegisterRequiredImplementations) BindingFlags.Public requires
12520         either BindingFlags.Instace or Static.  Use instance here.
12521
12522         (Property): Refactored code to cope better with the full spec.
12523
12524         * parameter.cs (GetParameterInfo): Return an empty array instead
12525         of null on error.
12526
12527         * class.cs (Property): Abstract or extern properties have no bodies.
12528
12529         * parameter.cs (GetParameterInfo): return a zero-sized array.
12530
12531         * class.cs (TypeContainer.MethodModifiersValid): Move all the
12532         method modifier validation to the typecontainer so we can reuse
12533         this on properties.
12534
12535         (MethodCore.ParameterTypes): return an empty sized array of types.
12536
12537         (Property.Define): Test property modifier validity.
12538
12539         Add tests for sealed/override too.
12540
12541         (Method.Emit): abstract or extern methods have no bodies.
12542
12543 2001-12-14  Ravi Pratap  <ravi@ximian.com>
12544
12545         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
12546         thing.
12547
12548         (Method::Define, ::Emit): Modify accordingly.
12549
12550         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
12551
12552         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
12553
12554         * makefile: Pass in /unsafe.
12555
12556 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
12557
12558         * class.cs (MakeKey): Kill routine.
12559
12560         * class.cs (TypeContainer.Define): Correctly define explicit
12561         method implementations (they require the full interface name plus
12562         the method name).
12563
12564         * typemanager.cs: Deply the PtrHashtable here and stop using the
12565         lame keys.  Things work so much better.
12566
12567         This of course broke everyone who depended on `RegisterMethod' to
12568         do the `test for existance' test.  This has to be done elsewhere.
12569
12570         * support.cs (PtrHashtable): A hashtable that avoid comparing with
12571         the object stupid Equals method (because, that like fails all over
12572         the place).  We still do not use it.
12573
12574         * class.cs (TypeContainer.SetRequiredInterface,
12575         TypeContainer.RequireMethods): Killed these two routines and moved
12576         all the functionality to RegisterRequiredImplementations.
12577
12578         (TypeContainer.RegisterRequiredImplementations): This routine now
12579         registers all the implementations required in an array for the
12580         interfaces and abstract methods.  We use an array of structures
12581         which can be computed ahead of time to reduce memory usage and we
12582         also assume that lookups are cheap as most classes will not
12583         implement too many interfaces.
12584
12585         We also avoid creating too many MethodSignatures.
12586
12587         (TypeContainer.IsInterfaceMethod): Update and optionally does not
12588         clear the "pending" bit if we find that there are problems with
12589         the declaration.
12590
12591         (TypeContainer.VerifyPendingMethods): Update to report errors of
12592         methods that look like implementations but are not.
12593
12594         (TypeContainer.Define): Add support for explicit interface method
12595         implementation. 
12596
12597 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
12598
12599         * typemanager.cs: Keep track of the parameters here instead of
12600         being a feature of the TypeContainer.
12601
12602         * class.cs: Drop the registration of parameters here, as
12603         InterfaceMethods are also interface declarations.
12604
12605         * delegate.cs: Register methods with the TypeManager not only with
12606         the TypeContainer.  This code was buggy.
12607
12608         * interface.cs: Full registation here.
12609
12610 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
12611
12612         * expression.cs: Remove reducer for binary expressions, it can not
12613         be done this way.
12614
12615         * const.cs: Put here the code that used to go into constant.cs
12616
12617         * constant.cs: Put here the code for constants, this is a new base
12618         class for Literals.
12619
12620         * literal.cs: Make Literal derive from Constant.
12621
12622 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
12623
12624         * statement.cs (Return.Emit): Report error 157 if the user
12625         attempts to return from a finally block.
12626
12627         (Return.Emit): Instead of emitting a return, jump to the end of
12628         the function.
12629
12630         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
12631         LocalBuilder to store the result of the function.  ReturnLabel is
12632         the target where we jump.
12633
12634
12635 2001-12-09  Radek Doulik  <rodo@ximian.com>
12636
12637         * cs-parser.jay: remember alias in current namespace
12638
12639         * ecore.cs (SimpleName::DoResolve): use aliases for types or
12640         namespaces
12641
12642         * class.cs (LookupAlias): lookup alias in my_namespace
12643
12644         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
12645         aliases hashtable
12646         (LookupAlias): lookup alias in this and if needed in parent
12647         namespaces
12648
12649 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
12650
12651         * support.cs: 
12652
12653         * rootcontext.cs: (ModuleBuilder) Made static, first step into
12654         making things static.  I need this to avoid passing the
12655         TypeContainer when calling ParameterType.
12656
12657         * support.cs (InternalParameters.ParameterType): Remove ugly hack
12658         that did string manipulation to compute the type and then call
12659         GetType.  Use Parameter.ParameterType instead.
12660
12661         * cs-tokenizer.cs: Consume the suffix for floating values.
12662
12663         * expression.cs (ParameterReference): figure out whether this is a
12664         reference parameter or not.  Kill an extra variable by computing
12665         the arg_idx during emission.
12666
12667         * parameter.cs (Parameters.GetParameterInfo): New overloaded
12668         function that returns whether a parameter is an out/ref value or not.
12669
12670         (Parameter.ParameterType): The type of the parameter (base,
12671         without ref/out applied).
12672
12673         (Parameter.Resolve): Perform resolution here.
12674         (Parameter.ExternalType): The full type (with ref/out applied).
12675
12676         * statement.cs (Using.Emit, Using.EmitExpression): Implement
12677         support for expressions on the using statement.
12678
12679 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
12680
12681         * statement.cs (Using.EmitLocalVariableDecls): Split the
12682         localvariable handling of the using statement.
12683
12684         (Block.EmitMeta): Keep track of variable count across blocks.  We
12685         were reusing slots on separate branches of blocks.
12686
12687         (Try.Emit): Emit the general code block, we were not emitting it. 
12688
12689         Check the type of the declaration to be an IDisposable or
12690         something that can be implicity converted to it. 
12691
12692         Emit conversions if required.
12693
12694         * ecore.cs (EmptyExpression): New utility class.
12695         (Expression.ImplicitConversionExists): New utility function.
12696
12697 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
12698
12699         * statement.cs (Using): Implement.
12700
12701         * expression.cs (LocalVariableReference): Support read only variables.
12702
12703         * statement.cs: Remove the explicit emit for the Leave opcode.
12704         (VariableInfo): Add a readonly field.
12705
12706 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
12707
12708         * ecore.cs (ConvCast): new class used to encapsulate the various
12709         explicit integer conversions that works in both checked and
12710         unchecked contexts.
12711
12712         (Expression.ConvertNumericExplicit): Use new ConvCast class to
12713         properly generate the overflow opcodes.
12714
12715 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
12716
12717         * statement.cs: The correct type for the EmptyExpression is the
12718         element_type, not the variable type.  Ravi pointed this out.
12719
12720 2001-12-04  Ravi Pratap  <ravi@ximian.com>
12721
12722         * class.cs (Method::Define): Handle PInvoke methods specially
12723         by using DefinePInvokeMethod instead of the usual one.
12724
12725         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
12726         above to do the task of extracting information and defining the method.
12727
12728 2001-12-04  Ravi Pratap  <ravi@ximian.com>
12729
12730         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
12731         of the condition for string type.
12732
12733         (Emit): Move that here. 
12734
12735         (ArrayCreation::CheckIndices): Keep string literals in their expression
12736         form.
12737
12738         (EmitDynamicInitializers): Handle strings appropriately.
12739
12740 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
12741
12742         * codegen.cs (EmitContext): Replace multiple variables with a
12743         single pointer to the current Switch statement.
12744
12745         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
12746         EmitContext.
12747
12748 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
12749
12750         * statement.cs 
12751
12752         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
12753         default'.
12754
12755         (Foreach.Emit): Foreach on arrays was not setting
12756         up the loop variables (for break/continue).
12757
12758         (GotoCase): Semi-implented.
12759
12760 2001-12-03  Ravi Pratap  <ravi@ximian.com>
12761
12762         * attribute.cs (CheckAttribute): Handle system attributes by using
12763         Attribute.GetAttributes to examine information we need.
12764
12765         (GetValidPlaces): Same here.
12766
12767         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
12768
12769         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
12770
12771         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
12772
12773         (Method::Define): Set appropriate flags if we have a DllImport attribute.
12774
12775         (Method::Emit): Handle the case when we are a PInvoke method.
12776
12777 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
12778
12779         * expression.cs: Use ResolveWithSimpleName on compound names.
12780
12781 2001-12-02  Ravi Pratap  <ravi@ximian.com>
12782
12783         * constant.cs (EmitConstant): Make sure we resolve the associated expression
12784         before trying to reduce it.
12785
12786         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
12787
12788         * constant.cs (LookupConstantValue): Implement.
12789
12790         (EmitConstant): Use the above in emitting the constant.
12791
12792         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
12793         that are user-defined by doing a LookupConstantValue on them.
12794
12795         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
12796         too, like above.
12797
12798 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
12799
12800         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
12801
12802         (BaseAccess.DoResolve): Implement.
12803
12804         (MemberAccess.DoResolve): Split this routine into a
12805         ResolveMemberAccess routine that can be used independently
12806
12807 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
12808
12809         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
12810         As that share bits of the implementation.  Is returns a boolean,
12811         while As returns the Type that is being probed.
12812
12813 2001-12-01  Ravi Pratap  <ravi@ximian.com>
12814
12815         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
12816         instead of a Literal - much easier.
12817
12818         (EnumInTransit): Remove - utterly useless :-)
12819
12820         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
12821
12822         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
12823
12824         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
12825         chain when we have no associated expression.
12826
12827 2001-11-30  Ravi Pratap  <ravi@ximian.com>
12828
12829         * constant.cs (Define): Use Location while reporting the errror.
12830
12831         Also emit a warning when 'new' is used and there is no inherited
12832         member to hide.
12833
12834         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
12835         populated.
12836
12837         (LookupEnumValue): Implement to lookup an enum member's value and define it
12838         if necessary.
12839
12840         (Populate): Re-write accordingly to use the above routine.
12841
12842 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
12843
12844         * expression.cs (This): Fix prototype for DoResolveLValue to
12845         override the base class DoResolveLValue.
12846
12847         * cs-parser.cs: Report errors cs574 and cs575 (destructor
12848         declarations) 
12849
12850         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
12851         (we need to load the address of the field here).  This fixes
12852         test-22. 
12853
12854         (FieldExpr.DoResolveLValue): Call the DoResolve
12855         function to initialize the Instance expression.
12856
12857         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
12858         correctly the GetEnumerator operation on a value type.
12859
12860         * cs-parser.jay: Add more simple parsing error catches.
12861
12862         * statement.cs (Switch): Add support for string switches.
12863         Handle null specially.
12864
12865         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
12866
12867 2001-11-28  Ravi Pratap  <ravi@ximian.com>
12868
12869         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
12870
12871         (declare_local_constant): New helper function.
12872
12873         * statement.cs (AddConstant): Keep a separate record of constants
12874
12875         (IsConstant): Implement to determine if a variable is a constant.
12876
12877         (GetConstantExpression): Implement.
12878
12879         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
12880
12881         * statement.cs (IsVariableDefined): Re-write.
12882
12883 2001-11-27  Ravi Pratap  <ravi@ximian.com>
12884
12885         * class.cs (TypeContainer::FindMembers): Look for constants
12886         in the case when we are looking for MemberTypes.Field
12887
12888         * expression.cs (MemberAccess::DoResolve): Check that in the
12889         case we are a FieldExpr and a Literal, we are not being accessed
12890         by an instance reference.
12891
12892         * cs-parser.jay (local_constant_declaration): Implement.
12893
12894         (declaration_statement): Implement for constant declarations.
12895
12896 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
12897
12898         * statement.cs (Switch): Catch double defaults.
12899
12900         (Switch): More work on the switch() statement
12901         implementation.  It works for integral values now, need to finish
12902         string support.
12903
12904
12905 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
12906
12907         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
12908         integer literals into other integer literals.  To be used by
12909         switch. 
12910
12911 2001-11-24  Ravi Pratap  <ravi@ximian.com>
12912
12913         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
12914         some memory.
12915
12916         (EmitDynamicInitializers): Cope with the above since we extract data
12917         directly from ArrayData now.
12918
12919         (ExpectInitializers): Keep track of whether initializers are mandatory
12920         or not.
12921
12922         (Bounds): Make it a hashtable to prevent the same dimension being 
12923         recorded for every element in that dimension.
12924
12925         (EmitDynamicInitializers): Fix bug which prevented the Set array method
12926         from being found.
12927
12928         Also fix bug which was causing the indices to be emitted in the reverse
12929         order.
12930
12931 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
12932
12933         * expression.cs (ArrayCreation): Implement the bits that Ravi left
12934         unfinished.  They do not work, because the underlying code is
12935         sloppy.
12936
12937 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
12938
12939         * cs-parser.jay: Remove bogus fixme.
12940
12941         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
12942         on Switch statement.
12943
12944 2001-11-23  Ravi Pratap  <ravi@ximian.com>
12945
12946         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
12947         the same. 
12948
12949         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
12950         parameter. Apparently, any expression is allowed. 
12951
12952         (ValidateInitializers): Update accordingly.
12953
12954         (CheckIndices): Fix some tricky bugs thanks to recursion.
12955
12956         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
12957         I was being completely brain-dead.
12958
12959         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
12960         and re-write acordingly.
12961
12962         (DelegateInvocation): Re-write accordingly.
12963
12964         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
12965
12966         (MakeByteBlob): Handle types more correctly.
12967
12968         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
12969         initialization from expressions but it is incomplete because I am a complete
12970         Dodo :-|
12971
12972 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
12973
12974         * statement.cs (If.Emit): Fix a bug that generated incorrect code
12975         on If.  Basically, we have to return `true' (ie, we do return to
12976         our caller) only if both branches of the if return.
12977
12978         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
12979         short-circuit operators, handle them as short circuit operators. 
12980
12981         (Cast.DoResolve): Resolve type.
12982         (Cast.Cast): Take an expression as the target type.
12983
12984         * cs-parser.jay (cast_expression): Remove old hack that only
12985         allowed a limited set of types to be handled.  Now we take a
12986         unary_expression and we resolve to a type during semantic
12987         analysis.
12988
12989         Use the grammar productions from Rhys to handle casts (this is
12990         not complete like Rhys syntax yet, we fail to handle that corner
12991         case that C# has regarding (-x), but we will get there.
12992
12993 2001-11-22  Ravi Pratap  <ravi@ximian.com>
12994
12995         * class.cs (EmitFieldInitializer): Take care of the case when we have a
12996         field which is an array type.
12997
12998         * cs-parser.jay (declare_local_variables): Support array initialization too.
12999
13000         * typemanager.cs (MakeKey): Implement.
13001
13002         (everywhere): Use the above appropriately.
13003
13004         * cs-parser.jay (for_statement): Update for array initialization while
13005         declaring variables.
13006
13007         * ecore.cs : The error message was correct, it's the variable's names that
13008         were misleading ;-) Make the code more readable.
13009
13010         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
13011         the correct type etc.
13012
13013         (ConvertExplicit): Handle Enum types by examining the underlying type.
13014
13015 2001-11-21  Ravi Pratap  <ravi@ximian.com>
13016
13017         * parameter.cs (GetCallingConvention): Always return
13018         CallingConventions.Standard for now.
13019
13020 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
13021
13022         * expression.cs (Binary.ResolveOperator): Update the values of `l'
13023         and `r' after calling DoNumericPromotions.
13024
13025         * ecore.cs: Fix error message (the types were in the wrong order).
13026
13027         * statement.cs (Foreach.ProbeCollectionType): Need to pass
13028         BindingFlags.Instance as well 
13029
13030         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
13031         implicit int literal conversion in an empty cast so that we
13032         propagate the right type upstream.
13033
13034         (UnboxCast): new class used to unbox value types.
13035         (Expression.ConvertExplicit): Add explicit type conversions done
13036         by unboxing.
13037
13038         (Expression.ImplicitNumericConversion): Oops, forgot to test for
13039         the target type before applying the implicit LongLiterals to ULong
13040         literal cast.
13041
13042 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
13043
13044         * cs-parser.jay (for_statement): Reworked the way For works: now
13045         we declare manually any variables that are introduced in
13046         for_initializer to solve the problem of having out-of-band code
13047         emition (that is what got for broken).
13048
13049         (declaration_statement): Perform the actual variable declaration
13050         that used to be done in local_variable_declaration here.
13051
13052         (local_variable_declaration): Do not declare anything, just pass
13053         the information on a DictionaryEntry
13054
13055 2001-11-20  Ravi Pratap  <ravi@ximian.com>
13056
13057         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
13058         re-write of the logic to now make it recursive.
13059
13060         (UpdateIndices): Re-write accordingly.
13061
13062         Store element data in a separate ArrayData list in the above methods.
13063
13064         (MakeByteBlob): Implement to dump the array data into a byte array.
13065
13066 2001-11-19  Ravi Pratap  <ravi@ximian.com>
13067
13068         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
13069         into CheckIndices.
13070
13071         * constant.cs (Define): Implement.
13072
13073         (EmitConstant): Re-write fully.
13074
13075         Pass in location info.
13076
13077         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
13078         respectively.
13079
13080         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
13081         DictionaryEntry since we need location info too.
13082
13083         (constant_declaration): Update accordingly.
13084
13085         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
13086         code into another method : UpdateIndices.
13087
13088 2001-11-18  Ravi Pratap  <ravi@ximian.com>
13089
13090         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
13091         some type checking etc.
13092
13093 2001-11-17  Ravi Pratap  <ravi@ximian.com>
13094
13095         * expression.cs (ArrayCreation::ValidateInitializers): Implement
13096         bits to provide dimension info if the user skips doing that.
13097
13098         Update second constructor to store the rank correctly.
13099
13100 2001-11-16  Ravi Pratap  <ravi@ximian.com>
13101
13102         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
13103         and try to implement.
13104
13105         * ../errors/cs0150.cs : Add.
13106
13107         * ../errors/cs0178.cs : Add.
13108
13109 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
13110
13111         * statement.cs: Implement foreach on multi-dimensional arrays. 
13112
13113         * parameter.cs (Parameters.GetParameterByName): Also lookup the
13114         name of the params argument.
13115
13116         * expression.cs: Use EmitStoreOpcode to get the right opcode while
13117         initializing the array.
13118
13119         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
13120         we can use this elsewhere.
13121
13122         * statement.cs: Finish implementation of foreach for single
13123         dimension arrays.
13124
13125         * cs-parser.jay: Use an out-of-band stack to pass information
13126         around, I wonder why I need this.
13127
13128         foreach_block: Make the new foreach_block the current_block.
13129
13130         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
13131         function used to return a static Parameters structure.  Used for
13132         empty parameters, as those are created very frequently.
13133
13134         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
13135
13136 2001-11-15  Ravi Pratap  <ravi@ximian.com>
13137
13138         * interface.cs : Default modifier is private, not public. The
13139         make verify test passes again.
13140
13141 2001-11-15  Ravi Pratap  <ravi@ximian.com>
13142
13143         * support.cs (ReflectionParameters): Fix logic to determine
13144         whether the last parameter is a params one. Test 9 passes again.
13145
13146         * delegate.cs (Populate): Register the builders we define with
13147         RegisterParameterForBuilder. Test 19 passes again.
13148
13149         * cs-parser.jay (property_declaration): Reference $6 instead
13150         of $$ to get at the location.
13151
13152         (indexer_declaration): Similar stuff.
13153
13154         (attribute): Ditto.
13155
13156         * class.cs (Property): Register parameters for the Get and Set methods
13157         if they exist. Test 23 passes again.
13158
13159         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
13160         call to EmitArguments as we are sure there aren't any params arguments. 
13161         Test 32 passes again.
13162
13163         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
13164         IndexOutOfRangeException. 
13165
13166         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
13167         Test 33 now passes again.
13168
13169 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
13170
13171         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
13172         broke a bunch of things.  Will have to come up with a better way
13173         of tracking locations.
13174
13175         * statement.cs: Implemented foreach for single dimension arrays.
13176
13177 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
13178
13179         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
13180         an error.  This removes the lookup from the critical path.
13181
13182         * cs-parser.jay: Removed use of temporary_loc, which is completely
13183         broken. 
13184
13185 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
13186
13187         * support.cs (ReflectionParameters.ParameterModifier): Report
13188         whether the argument is a PARAMS argument or not.
13189
13190         * class.cs: Set the attribute `ParamArrayAttribute' on the
13191         parameter argument.
13192
13193         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
13194         and cons_param_array_attribute (ConstructorInfo for
13195         ParamArrayAttribute)., 
13196
13197         * codegen.cs: Emit the return using the `Return' statement, that
13198         way we can report the error correctly for missing return values. 
13199
13200         * class.cs (Method.Emit): Clean up.
13201
13202         * expression.cs (Argument.Resolve): Take another argument: the
13203         location where this argument is used.  Notice that this is not
13204         part of the "Argument" class as to reduce the size of the
13205         structure (we know the approximate location anyways).
13206
13207         Test if the argument is a variable-reference, if not, then
13208         complain with a 206.
13209
13210         (Argument.Emit): Emit addresses of variables.
13211
13212         (Argument.FullDesc): Simplify.
13213
13214         (Invocation.DoResolve): Update for Argument.Resolve.
13215
13216         (ElementAccess.DoResolve): ditto.
13217
13218         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
13219         method should be virtual, as this method is always virtual.
13220
13221         (NewDelegate.DoResolve): Update for Argument.Resolve.
13222
13223         * class.cs (ConstructorInitializer.DoResolve): ditto.
13224
13225         * attribute.cs (Attribute.Resolve): ditto.
13226
13227 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
13228
13229         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
13230
13231         * expression.cs (ParameterReference): Drop IStackStorage and implement
13232         IAssignMethod instead. 
13233
13234         (LocalVariableReference): ditto.
13235
13236         * ecore.cs (FieldExpr): Drop IStackStorage and implement
13237         IAssignMethod instead. 
13238
13239 2001-11-13  Miguel de Icaza <miguel@ximian.com>
13240
13241         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
13242         enumerations that are used in heavily used structures derive from
13243         byte in a laughable and pathetic attempt to reduce memory usage.
13244         This is the kind of pre-optimzations that you should not do at
13245         home without adult supervision.
13246
13247         * expression.cs (UnaryMutator): New class, used to handle ++ and
13248         -- separatedly from the other unary operators.  Cleans up the
13249         code, and kills the ExpressionStatement dependency in Unary.
13250
13251         (Unary): Removed `method' and `Arguments' from this class, making
13252         it smaller, and moving it all to SimpleCall, so I can reuse this
13253         code in other locations and avoid creating a lot of transient data
13254         strucutres when not required.
13255
13256         * cs-parser.jay: Adjust for new changes.
13257
13258 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
13259
13260         * enum.cs (Enum.Populate): If there is a failure during
13261         definition, return
13262
13263         * cs-parser.jay (opt_enum_base): we used to catch type errors
13264         here, but this is really incorrect.  The type error should be
13265         catched during semantic analysis.
13266
13267 2001-12-11  Ravi Pratap  <ravi@ximian.com>
13268
13269         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
13270         current_local_parameters as expected since I, in my stupidity, had forgotten
13271         to do this :-)
13272
13273         * attribute.cs (GetValidPlaces): Fix stupid bug.
13274
13275         * class.cs (Method::Emit): Perform check on applicability of attributes.
13276
13277         (Constructor::Emit): Ditto.
13278
13279         (Field::Emit): Ditto.
13280
13281         (Field.Location): Store location information.
13282
13283         (Property, Event, Indexer, Operator): Ditto.
13284
13285         * cs-parser.jay (field_declaration): Pass in location for each field.
13286
13287         * ../errors/cs0592.cs : Add.
13288
13289 2001-11-12  Ravi Pratap  <ravi@ximian.com>
13290
13291         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
13292
13293         (InitCoreTypes): Update accordingly.
13294
13295         (RegisterAttrType, LookupAttr): Implement.
13296
13297         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
13298         info about the same.
13299
13300         (Resolve): Update to populate the above as necessary.
13301
13302         (Error592): Helper.
13303
13304         (GetValidPlaces): Helper to the above.
13305
13306         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
13307
13308         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
13309
13310 2001-11-12  Ravi Pratap  <ravi@ximian.com>
13311
13312         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
13313
13314         * ../errors/cs0617.cs : Add.
13315
13316 2001-11-11  Ravi Pratap  <ravi@ximian.com>
13317
13318         * enum.cs (Emit): Rename to Populate to be more consistent with what
13319         we expect it to do and when exactly it is called.
13320
13321         * class.cs, rootcontext.cs : Update accordingly.
13322
13323         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
13324         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
13325
13326         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
13327
13328         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
13329         of a fieldinfo using the above, when dealing with a FieldBuilder.
13330
13331 2001-11-10  Ravi Pratap  <ravi@ximian.com>
13332
13333         * ../errors/cs0031.cs : Add.
13334
13335         * ../errors/cs1008.cs : Add.
13336
13337         * ../errrors/cs0543.cs : Add.
13338
13339         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
13340         enum type.
13341
13342         (FindMembers): Implement.
13343
13344         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
13345         enums and delegates too.
13346
13347         (enum_types): Rename to builder_to_enum.
13348
13349         (delegate_types): Rename to builder_to_delegate.
13350
13351         * delegate.cs (FindMembers): Implement.
13352
13353 2001-11-09  Ravi Pratap  <ravi@ximian.com>
13354
13355         * typemanager.cs (IsEnumType): Implement.
13356
13357         * enum.cs (Emit): Re-write parts to account for the underlying type
13358         better and perform checking etc.
13359
13360         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
13361         of the underlying type.
13362
13363         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
13364         value
13365
13366         * enum.cs (error31): Helper to report error #31.
13367
13368         * cs-parser.jay (enum_declaration): Store location of each member too.
13369
13370         * enum.cs (member_to_location): New hashtable. 
13371
13372         (AddEnumMember): Update location hashtable.
13373
13374         (Emit): Use the location of each member while reporting errors.
13375
13376 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
13377
13378         * cs-parser.jay: A for_initializer if is a
13379         local_variable_declaration really ammount to have an implicit
13380         block with the variable declaration and no initializer for for.
13381
13382         * statement.cs (For.Emit): Cope with null initializers.
13383
13384         This fixes the infinite loop on for initializers.
13385
13386 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
13387
13388         * enum.cs: More cleanup.
13389
13390         * ecore.cs: Remove dead code.
13391
13392         * class.cs (Property.Emit): More simplification.
13393         (Event.Emit): ditto.
13394
13395         Reworked to have less levels of indentation.
13396
13397 2001-11-08  Ravi Pratap  <ravi@ximian.com>
13398
13399         * class.cs (Property): Emit attributes.
13400
13401         (Field): Ditto.
13402
13403         (Event): Ditto.
13404
13405         (Indexer): Ditto.
13406
13407         (Operator): Ditto.
13408
13409         * enum.cs (Emit): Ditto.
13410
13411         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
13412         Enums too.
13413
13414         * class.cs (Field, Event, etc.): Move attribute generation into the
13415         Emit method everywhere.
13416
13417         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
13418         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
13419         as we had no way of defining nested enums !
13420
13421         * rootcontext.cs : Adjust code accordingly.
13422
13423         * typemanager.cs (AddEnumType): To keep track of enum types separately.
13424
13425 2001-11-07  Ravi Pratap  <ravi@ximian.com>
13426
13427         * expression.cs (EvalConstantExpression): Move into ecore.cs
13428
13429         * enum.cs (Enum): Rename some members and make them public and readonly
13430         according to our convention.
13431
13432         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
13433         nothing else.
13434
13435         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
13436
13437         (Enum::Emit): Write a simple version for now which doesn't try to compute
13438         expressions. I shall modify this to be more robust in just a while.
13439
13440         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
13441
13442         (TypeContainer::CloseType): Create the Enum types too.
13443
13444         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
13445
13446         * expression.cs (EvalConstantExpression): Get rid of completely.
13447
13448         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
13449         user-defined values and other cases.
13450
13451         (IsValidEnumLiteral): Helper function.
13452
13453         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
13454         out there in the case we had a literal FieldExpr.
13455
13456         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
13457
13458         (Literalize): Revamp a bit to take two arguments.
13459
13460         (EnumLiteral): New class which derives from Literal to wrap enum literals.
13461
13462 2001-11-06  Ravi Pratap  <ravi@ximian.com>
13463
13464         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
13465
13466         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
13467
13468         (Resolve): Use the above to ensure we have proper initializers.
13469
13470 2001-11-05  Ravi Pratap  <ravi@ximian.com>
13471
13472         * expression.cs (Expression::EvalConstantExpression): New method to 
13473         evaluate constant expressions.
13474
13475         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
13476
13477 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
13478
13479         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
13480         in an array.
13481
13482         (Binary.ResolveOperator): Handle operator != (object a, object b)
13483         and operator == (object a, object b);
13484
13485         (Binary.DoNumericPromotions): Indicate whether the numeric
13486         promotion was possible.
13487
13488         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
13489         Implement.  
13490
13491         Made the ArrayAccess implement interface IAssignMethod instead of
13492         IStackStore as the order in which arguments are passed reflects
13493         this.
13494
13495         * assign.cs: Instead of using expr.ExprClass to select the way of
13496         assinging, probe for the IStackStore/IAssignMethod interfaces.
13497
13498         * typemanager.cs: Load InitializeArray definition.
13499
13500         * rootcontext.cs (RootContext.MakeStaticData): Used to define
13501         static data that can be used to initialize arrays. 
13502
13503 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
13504
13505         * expression.cs: Handle operator== and operator!= for booleans.
13506
13507         (Conditioal.Reduce): Implement reducer for the ?: operator.
13508
13509         (Conditional.Resolve): Implement dead code elimination.
13510
13511         (Binary.Resolve): Catch string literals and return a new
13512         concatenated string.
13513
13514         (Unary.Reduce): Implement reduction of unary expressions.
13515
13516         * ecore.cs: Split out the expression core handling here.
13517
13518         (Expression.Reduce): New method used to perform constant folding
13519         and CSE.  This is needed to support constant-expressions. 
13520
13521         * statement.cs (Statement.EmitBoolExpression): Pass true and false
13522         targets, and optimize for !x.
13523
13524 2001-11-04  Ravi Pratap  <ravi@ximian.com>
13525
13526         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
13527         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
13528         set custom atttributes.
13529
13530         * literal.cs (Literal::GetValue): New abstract method to return the actual
13531         value of the literal, cast as an object.
13532
13533         (*Literal): Implement GetValue method.
13534
13535         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
13536         expressions to the arraylist but objects of type Argument.
13537
13538         * class.cs (TypeContainer::Emit): Emit our attributes too.
13539
13540         (Method::Emit, Constructor::Emit): Ditto.
13541
13542         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
13543         to be ignoring earlier.
13544
13545 2001-11-03  Ravi Pratap  <ravi@ximian.com>
13546
13547         * attribute.cs (AttributeSection::Define): Implement to do the business
13548         of constructing a CustomAttributeBuilder.
13549
13550         (Attribute): New trivial class. Increases readability of code.  
13551
13552         * cs-parser.jay : Update accordingly.
13553
13554         (positional_argument_list, named_argument_list, named_argument): New rules
13555
13556         (attribute_arguments): Use the above so that we are more correct.
13557
13558 2001-11-02  Ravi Pratap  <ravi@ximian.com>
13559
13560         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
13561         to perform all checks for a method with a params parameter.
13562
13563         (Invocation::OverloadResolve): Update to use the above method and therefore
13564         cope correctly with params method invocations.
13565
13566         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
13567         params too.
13568
13569         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
13570         constructors in our parent too because we can't afford to miss out on 
13571         protected ones ;-)
13572
13573         * attribute.cs (AttributeSection): New name for the class Attribute
13574
13575         Other trivial changes to improve readability.
13576
13577         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
13578         use the new class names.
13579
13580 2001-11-01  Ravi Pratap  <ravi@ximian.com>
13581
13582         * class.cs (Method::Define): Complete definition for params types too
13583
13584         (Indexer::Define): Ditto.
13585
13586         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
13587         Cope everywhere with a request for info about the array parameter.
13588
13589 2001-11-01  Ravi Pratap  <ravi@ximian.com>
13590
13591         * tree.cs (RecordNamespace): Fix up to check for the correct key.
13592
13593         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
13594         local_variable_type to extract the string corresponding to the type.
13595
13596         (local_variable_type): Fixup the action to use the new helper method.
13597
13598         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
13599         go.
13600
13601         * expression.cs : Clean out code which uses the above.
13602
13603 2001-10-31  Ravi Pratap  <ravi@ximian.com>
13604
13605         * typemanager.cs (RegisterMethod): Check if we already have an existing key
13606         and bale out if necessary by returning a false.
13607
13608         (RegisterProperty): Ditto.
13609
13610         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
13611         and print out appropriate error messages.
13612
13613         * interface.cs (everywhere): Ditto.
13614
13615         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
13616         location to constructor.
13617
13618         * class.cs (Property, Event, Indexer): Update accordingly.
13619
13620         * ../errors/cs111.cs : Added.
13621
13622         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
13623         of a method, as laid down by the spec.
13624
13625         (Invocation::OverloadResolve): Use the above method.
13626
13627 2001-10-31  Ravi Pratap  <ravi@ximian.com>
13628
13629         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
13630         now take a TypeContainer and a Parameters object.
13631
13632         (ParameterData): Modify return type of ParameterModifier method to be 
13633         Parameter.Modifier and not a string.
13634
13635         (ReflectionParameters, InternalParameters): Update accordingly.
13636
13637         * expression.cs (Argument::GetParameterModifier): Same here.
13638
13639         * support.cs (InternalParameters::ParameterType): Find a better way of determining
13640         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
13641         symbol in it at all so maybe this is only for now.
13642
13643 2001-10-30  Ravi Pratap  <ravi@ximian.com>
13644
13645         * support.cs (InternalParameters): Constructor now takes an extra argument 
13646         which is the actual Parameters class.
13647
13648         (ParameterDesc): Update to provide info on ref/out modifiers.
13649
13650         * class.cs (everywhere): Update call to InternalParameters to pass in
13651         the second argument too.
13652
13653         * support.cs (ParameterData): Add ParameterModifier, which is a method 
13654         to return the modifier info [ref/out etc]
13655
13656         (InternalParameters, ReflectionParameters): Implement the above.
13657
13658         * expression.cs (Argument::ParameterModifier): Similar function to return
13659         info about the argument's modifiers.
13660
13661         (Invocation::OverloadResolve): Update to take into account matching modifiers 
13662         too.
13663
13664         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
13665         a new SetFormalParameters object which we pass to InternalParameters.
13666
13667 2001-10-30  Ravi Pratap  <ravi@ximian.com>
13668
13669         * expression.cs (NewArray): Merge into the ArrayCreation class.
13670
13671 2001-10-29  Ravi Pratap  <ravi@ximian.com>
13672
13673         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
13674         NewUserdefinedArray into one as there wasn't much of a use in having
13675         two separate ones.
13676
13677         * expression.cs (Argument): Change field's name to ArgType from Type.
13678
13679         (Type): New readonly property which returns the proper type, taking into 
13680         account ref/out modifiers.
13681
13682         (everywhere): Adjust code accordingly for the above.
13683
13684         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
13685         whether we are emitting for a ref or out parameter.
13686
13687         * expression.cs (Argument::Emit): Use the above field to set the state.
13688
13689         (LocalVariableReference::Emit): Update to honour the flag and emit the
13690         right stuff.
13691
13692         * parameter.cs (Attributes): Set the correct flags for ref parameters.
13693
13694         * expression.cs (Argument::FullDesc): New function to provide a full desc.
13695
13696         * support.cs (ParameterData): Add method ParameterDesc to the interface.
13697
13698         (ReflectionParameters, InternalParameters): Implement the above method.
13699
13700         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
13701         reporting errors.
13702
13703         (Invocation::FullMethodDesc): Ditto. 
13704
13705 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
13706
13707         * cs-parser.jay: Add extra production for the second form of array
13708         creation. 
13709
13710         * expression.cs (ArrayCreation): Update to reflect the above
13711         change. 
13712
13713         * Small changes to prepare for Array initialization.
13714
13715 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
13716
13717         * typemanager.cs (ImplementsInterface): interface might be null;
13718         Deal with this problem;
13719
13720         Also, we do store negative hits on the cache (null values), so use
13721         this instead of calling t.GetInterfaces on the type everytime.
13722
13723 2001-10-28  Ravi Pratap  <ravi@ximian.com>
13724
13725         * typemanager.cs (IsBuiltinType): New method to help determine the same.
13726
13727         * expression.cs (New::DoResolve): Get rid of array creation code and instead
13728         split functionality out into different classes.
13729
13730         (New::FormArrayType): Move into NewBuiltinArray.
13731
13732         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
13733         quite useless.
13734
13735         (NewBuiltinArray): New class to handle creation of built-in arrays.
13736
13737         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
13738         account creation of one-dimensional arrays.
13739
13740         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
13741
13742         (NewUserdefinedArray::DoResolve): Implement.
13743
13744         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
13745
13746         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
13747         we maintain inside the TypeManager. This is necessary to perform lookups on the
13748         module builder.
13749
13750         (LookupType): Update to perform GetType on the module builders too.     
13751
13752         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
13753
13754         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
13755
13756 2001-10-23  Ravi Pratap  <ravi@ximian.com>
13757
13758         * expression.cs (New::DoResolve): Implement guts of array creation.
13759
13760         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
13761
13762 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
13763
13764         * expression.cs: Fix bug I introduced lsat night that broke
13765         Delegates. 
13766
13767         (Expression.Resolve): Report a 246 error (can not resolve name)
13768         if we find a SimpleName in the stream.
13769
13770         (Expression.ResolveLValue): Ditto.
13771
13772         (Expression.ResolveWithSimpleName): This function is a variant of
13773         ResolveName, this one allows SimpleNames to be returned without a
13774         warning.  The only consumer of SimpleNames is MemberAccess
13775
13776 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
13777
13778         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
13779         might arrive here.  I have my doubts that this is correct.
13780
13781         * statement.cs (Lock): Implement lock statement.
13782
13783         * cs-parser.jay: Small fixes to support `lock' and `using'
13784
13785         * cs-tokenizer.cs: Remove extra space
13786
13787         * driver.cs: New flag --checked, allows to turn on integer math
13788         checking. 
13789
13790         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
13791         Threading.Monitor.Exit 
13792
13793 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
13794
13795         * expression.cs (IndexerAccess::DoResolveLValue): Set the
13796         Expression Class to be IndexerAccess.
13797
13798         Notice that Indexer::DoResolve sets the eclass to Value.
13799
13800 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
13801
13802         * class.cs (TypeContainer::Emit): Emit code for indexers.
13803
13804         * assign.cs (IAssignMethod): New interface implemented by Indexers
13805         and Properties for handling assignment.
13806
13807         (Assign::Emit): Simplify and reuse code. 
13808
13809         * expression.cs (IndexerAccess, PropertyExpr): Implement
13810         IAssignMethod, clean up old code. 
13811
13812 2001-10-22  Ravi Pratap  <ravi@ximian.com>
13813
13814         * typemanager.cs (ImplementsInterface): New method to determine if a type
13815         implements a given interface. Provides a nice cache too.
13816
13817         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
13818         method.
13819
13820         (ConvertReferenceExplicit): Ditto.
13821
13822         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
13823         various methods, with correct names etc.
13824
13825         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
13826         Operator.UnaryNegation.
13827
13828         * cs-parser.jay (operator_declarator): Be a little clever in the case where
13829         we have a unary plus or minus operator.
13830
13831         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
13832         UnaryMinus.
13833
13834         * everywhere : update accordingly.
13835
13836         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
13837         respectively.
13838
13839         * class.cs (Method::Define): For the case where we are implementing a method
13840         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
13841         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
13842
13843 2001-10-21  Ravi Pratap  <ravi@ximian.com>
13844
13845         * interface.cs (FindMembers): Implement to work around S.R.E
13846         lameness.
13847
13848         * typemanager.cs (IsInterfaceType): Implement.
13849
13850         (FindMembers): Update to handle interface types too.
13851
13852         * expression.cs (ImplicitReferenceConversion): Re-write bits which
13853         use IsAssignableFrom as that is not correct - it doesn't work.
13854
13855         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
13856         and accordingly override EmitStatement.
13857
13858         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
13859         using the correct logic :-)
13860
13861 2001-10-19  Ravi Pratap  <ravi@ximian.com>
13862
13863         * ../errors/cs-11.cs : Add to demonstrate error -11 
13864
13865 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
13866
13867         * assign.cs (Assign::Resolve): Resolve right hand side first, and
13868         then pass this as a hint to ResolveLValue.
13869
13870         * expression.cs (FieldExpr): Add Location information
13871
13872         (FieldExpr::LValueResolve): Report assignment to readonly
13873         variable. 
13874
13875         (Expression::ExprClassFromMemberInfo): Pass location information.
13876
13877         (Expression::ResolveLValue): Add new method that resolves an
13878         LValue. 
13879
13880         (Expression::DoResolveLValue): Default invocation calls
13881         DoResolve. 
13882
13883         (Indexers): New class used to keep track of indexers in a given
13884         Type. 
13885
13886         (IStackStore): Renamed from LValue, as it did not really describe
13887         what this did.  Also ResolveLValue is gone from this interface and
13888         now is part of Expression.
13889
13890         (ElementAccess): Depending on the element access type
13891
13892         * typemanager.cs: Add `indexer_name_type' as a Core type
13893         (System.Runtime.CompilerServices.IndexerNameAttribute)
13894
13895         * statement.cs (Goto): Take a location.
13896
13897 2001-10-18  Ravi Pratap  <ravi@ximian.com>
13898
13899         * delegate.cs (Delegate::VerifyDelegate): New method to verify
13900         if two delegates are compatible.
13901
13902         (NewDelegate::DoResolve): Update to take care of the case when
13903         we instantiate a delegate from another delegate.
13904
13905         * typemanager.cs (FindMembers): Don't even try to look up members
13906         of Delegate types for now.
13907
13908 2001-10-18  Ravi Pratap  <ravi@ximian.com>
13909
13910         * delegate.cs (NewDelegate): New class to take care of delegate
13911         instantiation.
13912
13913         * expression.cs (New): Split the delegate related code out into 
13914         the NewDelegate class.
13915
13916         * delegate.cs (DelegateInvocation): New class to handle delegate 
13917         invocation.
13918
13919         * expression.cs (Invocation): Split out delegate related code into
13920         the DelegateInvocation class.
13921
13922 2001-10-17  Ravi Pratap  <ravi@ximian.com>
13923
13924         * expression.cs (New::DoResolve): Implement delegate creation fully
13925         and according to the spec.
13926
13927         (New::DoEmit): Update to handle delegates differently.
13928
13929         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
13930         because of which we were printing out arguments in reverse order !
13931
13932         * delegate.cs (VerifyMethod): Implement to check if the given method
13933         matches the delegate.
13934
13935         (FullDelegateDesc): Implement.
13936
13937         (VerifyApplicability): Implement.
13938
13939         * expression.cs (Invocation::DoResolve): Update to accordingly handle
13940         delegate invocations too.
13941
13942         (Invocation::Emit): Ditto.
13943
13944         * ../errors/cs1593.cs : Added.
13945
13946         * ../errors/cs1594.cs : Added.
13947
13948         * delegate.cs (InstanceExpression, TargetMethod): New properties.
13949
13950 2001-10-16  Ravi Pratap  <ravi@ximian.com>
13951
13952         * typemanager.cs (intptr_type): Core type for System.IntPtr
13953
13954         (InitCoreTypes): Update for the same.
13955
13956         (iasyncresult_type, asynccallback_type): Ditto.
13957
13958         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
13959         correct.
13960
13961         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
13962         too.
13963
13964         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
13965         the builders for the 4 members of a delegate type :-)
13966
13967         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
13968         type.
13969
13970         * expression.cs (New::DoResolve): Implement guts for delegate creation.
13971
13972         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
13973
13974 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
13975
13976         * statement.cs (Break::Emit): Implement.   
13977         (Continue::Emit): Implement.
13978
13979         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
13980         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
13981         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
13982         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
13983         end loop
13984
13985         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
13986         properties that track the label for the current loop (begin of the
13987         loop and end of the loop).
13988
13989 2001-10-15  Ravi Pratap  <ravi@ximian.com>
13990
13991         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
13992         use of emitting anything at all.
13993
13994         * class.cs, rootcontext.cs : Get rid of calls to the same.
13995
13996         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
13997
13998         (Populate): Define the constructor correctly and set the implementation
13999         attributes.
14000
14001         * typemanager.cs (delegate_types): New hashtable to hold delegates that
14002         have been defined.
14003
14004         (AddDelegateType): Implement.
14005
14006         (IsDelegateType): Implement helper method.
14007
14008         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
14009
14010         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
14011         and accordingly handle it.
14012
14013         * delegate.cs (Populate): Take TypeContainer argument.
14014         Implement bits to define the Invoke method. However, I still haven't figured out
14015         how to take care of the native int bit :-(
14016
14017         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
14018         Qualify the name of the delegate, not its return type !
14019
14020         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
14021         conversion.
14022
14023         (StandardConversionExists): Checking for array types turns out to be recursive.
14024
14025         (ConvertReferenceExplicit): Implement array conversion.
14026
14027         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
14028
14029 2001-10-12  Ravi Pratap  <ravi@ximian.com>
14030
14031         * cs-parser.jay (delegate_declaration): Store the fully qualified
14032         name as it is a type declaration.
14033
14034         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
14035         readonly.
14036
14037         (DefineDelegate): Renamed from Define. Does the same thing essentially,
14038         as TypeContainer::DefineType.
14039
14040         (Populate): Method in which all the definition of the various methods (Invoke)
14041         etc is done.
14042
14043         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
14044         see.
14045
14046         (CloseDelegate): Finally creates the delegate.
14047
14048         * class.cs (TypeContainer::DefineType): Update to define delegates.
14049         (Populate, Emit and CloseType): Do the same thing here too.
14050
14051         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
14052         delegates in all these operations.
14053
14054 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
14055
14056         * expression.cs: LocalTemporary: a new expression used to
14057         reference a temporary that has been created.
14058
14059         * assign.cs: Handle PropertyAccess back here, so that we can
14060         provide the proper semantic access to properties.
14061
14062         * expression.cs (Expression::ConvertReferenceExplicit): Implement
14063         a few more explicit conversions. 
14064
14065         * modifiers.cs: `NEW' modifier maps to HideBySig.
14066
14067         * expression.cs (PropertyExpr): Make this into an
14068         ExpressionStatement, and support the EmitStatement code path. 
14069
14070         Perform get/set error checking, clean up the interface.
14071
14072         * assign.cs: recognize PropertyExprs as targets, and if so, turn
14073         them into toplevel access objects.
14074
14075 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
14076
14077         * expression.cs: PropertyExpr::PropertyExpr: use work around the
14078         SRE.
14079
14080         * typemanager.cs: Keep track here of our PropertyBuilders again to
14081         work around lameness in SRE.
14082
14083 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
14084
14085         * expression.cs (LValue::LValueResolve): New method in the
14086         interface, used to perform a second resolution pass for LValues. 
14087
14088         (This::DoResolve): Catch the use of this in static methods.
14089
14090         (This::LValueResolve): Implement.
14091
14092         (This::Store): Remove warning, assigning to `this' in structures
14093         is 
14094
14095         (Invocation::Emit): Deal with invocation of
14096         methods on value types.  We need to pass the address to structure
14097         methods rather than the object itself.  (The equivalent code to
14098         emit "this" for structures leaves the entire structure on the
14099         stack instead of a pointer to it). 
14100
14101         (ParameterReference::DoResolve): Compute the real index for the
14102         argument based on whether the method takes or not a `this' pointer
14103         (ie, the method is static).
14104
14105         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
14106         value types returned from functions when we need to invoke a
14107         method on the sturcture.
14108
14109
14110 2001-10-11  Ravi Pratap  <ravi@ximian.com>
14111
14112         * class.cs (TypeContainer::DefineType): Method to actually do the business of
14113         defining the type in the Modulebuilder or Typebuilder. This is to take
14114         care of nested types which need to be defined on the TypeBuilder using
14115         DefineNestedMethod.
14116
14117         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
14118         methods in RootContext, only ported to be part of TypeContainer.
14119
14120         (TypeContainer::GetInterfaceOrClass): Ditto.
14121
14122         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
14123
14124         * interface.cs (Interface::DefineInterface): New method. Does exactly
14125         what RootContext.CreateInterface did earlier, only it takes care of nested types 
14126         too.
14127
14128         (Interface::GetInterfaces): Move from RootContext here and port.
14129
14130         (Interface::GetInterfaceByName): Same here.
14131
14132         * rootcontext.cs (ResolveTree): Re-write.
14133
14134         (PopulateTypes): Re-write.
14135
14136         * class.cs (TypeContainer::Populate): Populate nested types too.
14137         (TypeContainer::Emit): Emit nested members too.
14138
14139         * typemanager.cs (AddUserType): Do not make use of the FullName property,
14140         instead just use the name argument passed in as it is already fully
14141         qualified.
14142
14143         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
14144         to TypeContainer mapping to see if a type is user-defined.
14145
14146         * class.cs (TypeContainer::CloseType): Implement. 
14147
14148         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
14149         the default constructor.
14150
14151         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
14152         twice.
14153
14154         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
14155
14156         * interface.cs (CloseType): Create the type here.
14157
14158         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
14159         the hierarchy.
14160
14161         Remove all the methods which are now in TypeContainer.
14162
14163 2001-10-10  Ravi Pratap  <ravi@ximian.com>
14164
14165         * delegate.cs (Define): Re-write bits to define the delegate
14166         correctly.
14167
14168 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
14169
14170         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
14171
14172         * expression.cs (ImplicitReferenceConversion): handle null as well
14173         as a source to convert to any reference type.
14174
14175         * statement.cs (Return): Perform any implicit conversions to
14176         expected return type.  
14177
14178         Validate use of return statement.  
14179
14180         * codegen.cs (EmitContext): Pass the expected return type here.
14181
14182         * class.cs (Method, Constructor, Property): Pass expected return
14183         type to EmitContext.
14184
14185 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
14186
14187         * expression.cs: Make DoResolve take an EmitContext instead of a
14188         TypeContainer.
14189
14190         Replaced `l' and `location' for `loc', for consistency.
14191
14192         (Error, Warning): Remove unneeded Tc argument.
14193
14194         * assign.cs, literal.cs, constant.cs: Update to new calling
14195         convention. 
14196
14197         * codegen.cs: EmitContext now contains a flag indicating whether
14198         code is being generated in a static method or not.
14199
14200         * cs-parser.jay: DecomposeQI, new function that replaces the old
14201         QualifiedIdentifier.  Now we always decompose the assembled
14202         strings from qualified_identifier productions into a group of
14203         memberaccesses.
14204
14205 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
14206
14207         * rootcontext.cs: Deal with field-less struct types correctly now
14208         by passing the size option to Define Type.
14209
14210         * class.cs: Removed hack that created one static field. 
14211
14212 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
14213
14214         * statement.cs: Moved most of the code generation here. 
14215
14216 2001-10-09  Ravi Pratap  <ravi@ximian.com>
14217
14218         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
14219         seem very right.
14220
14221         (ElementAccess): Remove useless bits for now - keep checks as the spec
14222         says.
14223
14224 2001-10-08  Ravi Pratap  <ravi@ximian.com>
14225
14226         * expression.cs (ElementAccess::DoResolve): Remove my crap code
14227         and start performing checks according to the spec.
14228
14229 2001-10-07  Ravi Pratap  <ravi@ximian.com>
14230
14231         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
14232         rank_specifiers instead.
14233
14234         (rank_specifiers): Change the order in which the rank specifiers are stored
14235
14236         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
14237
14238         * expression.cs (ElementAccess): Implement the LValue interface too.
14239
14240 2001-10-06  Ravi Pratap  <ravi@ximian.com>
14241
14242         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
14243         except that user defined conversions are not included.
14244
14245         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
14246         perform the conversion of the return type, if necessary.
14247
14248         (New::DoResolve): Check whether we are creating an array or an object
14249         and accordingly do the needful.
14250
14251         (New::Emit): Same here.
14252
14253         (New::DoResolve): Implement guts of array creation.
14254
14255         (New::FormLookupType): Helper function.
14256
14257 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
14258
14259         * codegen.cs: Removed most of the code generation here, and move the
14260         corresponding code generation bits to the statement classes. 
14261
14262         Added support for try/catch/finalize and throw.
14263
14264         * cs-parser.jay: Added support for try/catch/finalize.
14265
14266         * class.cs: Catch static methods having the flags override,
14267         virtual or abstract.
14268
14269         * expression.cs (UserCast): This user cast was not really doing
14270         what it was supposed to do.  Which is to be born in fully resolved
14271         state.  Parts of the resolution were being performed at Emit time! 
14272
14273         Fixed this code.
14274
14275 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
14276
14277         * expression.cs: Implicity convert the result from UserCast.
14278
14279 2001-10-05  Ravi Pratap  <ravi@ximian.com>
14280
14281         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
14282         prevented it from working correctly. 
14283
14284         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
14285         merely ConvertImplicit.
14286
14287 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
14288
14289         * typemanager.cs: Make the LookupTypeContainer function static,
14290         and not per-instance.  
14291
14292         * class.cs: Make static FindMembers (the one that takes a Type
14293         argument). 
14294
14295         * codegen.cs: Add EmitForeach here.
14296
14297         * cs-parser.jay: Make foreach a toplevel object instead of the
14298         inline expansion, as we need to perform semantic analysis on it. 
14299
14300 2001-10-05  Ravi Pratap  <ravi@ximian.com>
14301
14302         * expression.cs (Expression::ImplicitUserConversion): Rename to
14303         UserDefinedConversion.
14304
14305         (Expression::UserDefinedConversion): Take an extra argument specifying 
14306         whether we look for explicit user conversions too.
14307
14308         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
14309
14310         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
14311
14312         (ExplicitUserConversion): Make it a call to UserDefinedConversion
14313         with the appropriate arguments.
14314
14315         * cs-parser.jay (cast_expression): Record location too.
14316
14317         * expression.cs (Cast): Record location info.
14318
14319         (Expression::ConvertExplicit): Take location argument.
14320
14321         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
14322         to determine if we are doing explicit conversions.
14323
14324         (UserCast::Emit): Update accordingly.
14325
14326         (Expression::ConvertExplicit): Report an error if everything fails.
14327
14328         * ../errors/cs0030.cs : Add.
14329
14330 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
14331
14332         * modifiers.cs: If the ABSTRACT keyword is present, also set the
14333         virtual and newslot bits. 
14334
14335         * class.cs (TypeContainer::RegisterRequiredImplementations):
14336         Record methods we need.
14337
14338         (TypeContainer::MakeKey): Helper function to make keys for
14339         MethodBases, since the Methodbase key is useless.
14340
14341         (TypeContainer::Populate): Call RegisterRequiredImplementations
14342         before defining the methods.   
14343
14344         Create a mapping for method_builders_to_methods ahead of time
14345         instead of inside a tight loop.
14346
14347         (::RequireMethods):  Accept an object as the data to set into the
14348         hashtable so we can report interface vs abstract method mismatch.
14349
14350 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
14351
14352         * report.cs: Make all of it static.
14353
14354         * rootcontext.cs: Drop object_type and value_type computations, as
14355         we have those in the TypeManager anyways.
14356
14357         Drop report instance variable too, now it is a global.
14358
14359         * driver.cs: Use try/catch on command line handling.
14360
14361         Add --probe option to debug the error reporting system with a test
14362         suite. 
14363
14364         * report.cs: Add support for exiting program when a probe
14365         condition is reached.
14366
14367 2001-10-03  Ravi Pratap  <ravi@ximian.com>
14368
14369         * expression.cs (Binary::DoNumericPromotions): Fix the case when
14370         we do a forcible conversion regardless of type, to check if 
14371         ForceConversion returns a null.
14372
14373         (Binary::error19): Use location to report error.
14374
14375         (Unary::error23): Use location here too.
14376
14377         * ../errors/cs0019.cs : Check in.
14378
14379         * ../errors/cs0023.cs : Check in.
14380
14381         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
14382         case of a non-null MethodInfo object with a length of 0 !
14383
14384         (Binary::ResolveOperator): Flag error if overload resolution fails to find
14385         an applicable member - according to the spec :-)
14386         Also fix logic to find members in base types.
14387
14388         (Unary::ResolveOperator): Same here.
14389
14390         (Unary::report23): Change name to error23 and make first argument a TypeContainer
14391         as I was getting thoroughly confused between this and error19 :-)
14392
14393         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
14394         (::FindMostEncompassedType): Implement.
14395         (::FindMostEncompassingType): Implement.
14396         (::StandardConversionExists): Implement.
14397
14398         (UserImplicitCast): Re-vamp. We now need info about most specific
14399         source and target types so that we can do the necessary conversions.
14400
14401         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
14402         mathematical union with no duplicates.
14403
14404 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
14405
14406         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
14407         in order from base classes to child classes, so that we can in
14408         child classes look up in our parent for method names and
14409         attributes (required for handling abstract, virtual, new, override
14410         constructs: we need to instrospect our base class, and if we dont
14411         populate the classes in order, the introspection might be
14412         incorrect.  For example, a method could query its parent before
14413         the parent has any methods and would determine that the parent has
14414         no abstract methods (while it could have had them)).
14415
14416         (RootContext::CreateType): Record the order in which we define the
14417         classes.
14418
14419 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
14420
14421         * class.cs (TypeContainer::Populate): Also method definitions can
14422         fail now, keep track of this.
14423
14424         (TypeContainer::FindMembers): Implement support for
14425         DeclaredOnly/noDeclaredOnly flag.
14426
14427         (Constructor::Emit) Return the ConstructorBuilder.
14428
14429         (Method::Emit) Return the MethodBuilder. 
14430         Check for abstract or virtual methods to be public.
14431
14432         * rootcontext.cs (RootContext::CreateType): Register all the
14433         abstract methods required for the class to be complete and the
14434         interface methods that must be implemented. 
14435
14436         * cs-parser.jay: Report error 501 (method requires body if it is
14437         not marked abstract or extern).
14438
14439         * expression.cs (TypeOf::Emit): Implement.
14440
14441         * typemanager.cs: runtime_handle_type, new global type.
14442
14443         * class.cs (Property::Emit): Generate code for properties.
14444
14445 2001-10-02  Ravi Pratap  <ravi@ximian.com>
14446
14447         * expression.cs (Unary::ResolveOperator): Find operators on base type
14448         too - we now conform exactly to the spec.
14449
14450         (Binary::ResolveOperator): Same here.
14451
14452         * class.cs (Operator::Define): Fix minor quirk in the tests.
14453
14454         * ../errors/cs0215.cs : Added.
14455
14456         * ../errors/cs0556.cs : Added.
14457
14458         * ../errors/cs0555.cs : Added.
14459
14460 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
14461
14462         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
14463         single integer which is really efficient
14464
14465 2001-10-01  Ravi Pratap  <ravi@ximian.com>
14466
14467         *  expression.cs (Expression::ImplicitUserConversion): Use location
14468         even in the case when we are examining True operators.
14469  
14470         * class.cs (Operator::Define): Perform extensive checks to conform
14471         with the rules for operator overloading in the spec.
14472
14473         * expression.cs (Expression::ImplicitReferenceConversion): Implement
14474         some of the other conversions mentioned in the spec.
14475
14476         * typemanager.cs (array_type): New static member for the System.Array built-in
14477         type.
14478
14479         (cloneable_interface): For System.ICloneable interface.
14480
14481         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
14482         we start resolving the tree and populating types.
14483
14484         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
14485  
14486 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
14487
14488         * expression.cs (Expression::ExprClassFromMemberInfo,
14489         Expression::Literalize): Create literal expressions from
14490         FieldInfos which are literals.
14491
14492         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
14493         type casts, because they were wrong.  The test suite in tests
14494         caught these ones.
14495
14496         (ImplicitNumericConversion): ushort to ulong requires a widening
14497         cast. 
14498
14499         Int32 constant to long requires widening cast as well.
14500
14501         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
14502         for integers because the type on the stack is not i4.
14503
14504 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
14505
14506         * expression.cs (report118): require location argument. 
14507
14508         * parameter.cs: Do not dereference potential null value.
14509
14510         * class.cs: Catch methods that lack the `new' keyword when
14511         overriding a name.  Report warnings when `new' is used without
14512         anything being there to override.
14513
14514         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
14515
14516         * class.cs: Only add constructor to hashtable if it is non-null
14517         (as now constructors can fail on define).
14518
14519         (TypeManager, Class, Struct): Take location arguments.
14520
14521         Catch field instance initialization in structs as errors.
14522
14523         accepting_filter: a new filter for FindMembers that is static so
14524         that we dont create an instance per invocation.
14525
14526         (Constructor::Define): Catch errors where a struct constructor is
14527         parameterless 
14528
14529         * cs-parser.jay: Pass location information for various new
14530         constructs. 
14531
14532         * delegate.cs (Delegate): take a location argument.
14533
14534         * driver.cs: Do not call EmitCode if there were problesm in the
14535         Definition of the types, as many Builders wont be there. 
14536
14537         * decl.cs (Decl::Decl): Require a location argument.
14538
14539         * cs-tokenizer.cs: Handle properly hex constants that can not fit
14540         into integers, and find the most appropiate integer for it.
14541
14542         * literal.cs: Implement ULongLiteral.
14543
14544         * rootcontext.cs: Provide better information about the location of
14545         failure when CreateType fails.
14546
14547 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
14548
14549         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
14550         as well.
14551
14552         * expression.cs (Binary::CheckShiftArguments): Add missing type
14553         computation.
14554         (Binary::ResolveOperator): Add type to the logical and and logical
14555         or, Bitwise And/Or and Exclusive Or code paths, it was missing
14556         before.
14557
14558         (Binary::DoNumericPromotions): In the case where either argument
14559         is ulong (and most signed types combined with ulong cause an
14560         error) perform implicit integer constant conversions as well.
14561
14562 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
14563
14564         * expression.cs (UserImplicitCast): Method should always be
14565         non-null. 
14566         (Invocation::BetterConversion): Simplified test for IntLiteral.
14567
14568         (Expression::ImplicitNumericConversion): Split this routine out.
14569         Put the code that performs implicit constant integer conversions
14570         here. 
14571
14572         (Expression::Resolve): Become a wrapper around DoResolve so we can
14573         check eclass and type being set after resolve.
14574
14575         (Invocation::Badness): Remove this dead function
14576
14577         (Binary::ResolveOperator): Do not compute the expensive argumnets
14578         unless we have a union for it.
14579
14580         (Probe::Emit): Is needs to do an isinst and then
14581         compare against null.
14582
14583         (::CanConvert): Added Location argument.  If the Location argument
14584         is null (Location.Null), then we do not report errors.  This is
14585         used by the `probe' mechanism of the Explicit conversion.  We do
14586         not want to generate an error for something that the user
14587         explicitly requested to be casted.  But the pipeline for an
14588         explicit cast first tests for potential implicit casts.
14589
14590         So for now, if the Location is null, it means `Probe only' to
14591         avoid adding another argument.   Might have to revise this
14592         strategy later.
14593
14594         (ClassCast): New class used to type cast objects into arbitrary
14595         classes (used in Explicit Reference Conversions).
14596
14597         Implement `as' as well.
14598
14599         Reverted all the patches from Ravi below: they were broken:
14600
14601                 * The use of `level' as a mechanism to stop recursive
14602                   invocations is wrong.  That was there just to catch the
14603                   bug with a strack trace but not as a way of addressing
14604                   the problem.
14605
14606                   To fix the problem we have to *understand* what is going
14607                   on and the interactions and come up with a plan, not
14608                   just get things going.
14609
14610                 * The use of the type conversion cache that I proposed
14611                   last night had an open topic: How does this work across
14612                   protection domains.  A user defined conversion might not
14613                   be public in the location where we are applying the
14614                   conversion, a different conversion might be selected
14615                   (ie, private A->B (better) but public B->A (worse),
14616                   inside A, A->B applies, but outside it, B->A will
14617                   apply).
14618
14619                 * On top of that (ie, even if the above is solved),
14620                   conversions in a cache need to be abstract.  Ie, `To
14621                   convert from an Int to a Short use an OpcodeCast', not
14622                   `To convert from an Int to a Short use the OpcodeCast on
14623                   the variable 5' (which is what this patch was doing).
14624
14625 2001-09-28  Ravi Pratap  <ravi@ximian.com>
14626
14627         * expression.cs (Invocation::ConversionExists): Re-write to use
14628         the conversion cache
14629
14630         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
14631         cache all conversions done, not just user-defined ones.
14632
14633         (Invocation::BetterConversion): The real culprit. Use ConversionExists
14634         to determine if a conversion exists instead of acutually trying to 
14635         perform the conversion. It's faster too.
14636
14637         (Expression::ConvertExplicit): Modify to use ConversionExists to check
14638         and only then attempt the implicit conversion.
14639
14640 2001-09-28  Ravi Pratap  <ravi@ximian.com>
14641
14642         * expression.cs (ConvertImplicit): Use a cache for conversions
14643         already found. Check level of recursion and bail out if necessary.
14644
14645 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
14646
14647         * typemanager.cs (string_concat_string_string, string_concat_object_object):
14648         Export standard methods that we expect for string operations.
14649
14650         * statement.cs (Block::UsageWarning): Track usage of variables and
14651         report the errors for not used variables.
14652
14653         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
14654         operator. 
14655
14656 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
14657
14658         * codegen.cs: remove unnneded code 
14659
14660         * expression.cs: Removed BuiltinTypeAccess class
14661
14662         Fix the order in which implicit conversions are
14663         done.  
14664
14665         The previous fixed dropped support for boxed conversions (adding a
14666         test to the test suite now)
14667
14668         (UserImplicitCast::CanConvert): Remove test for source being null,
14669         that code is broken.  We should not feed a null to begin with, if
14670         we do, then we should track the bug where the problem originates
14671         and not try to cover it up here.
14672
14673         Return a resolved expression of type UserImplicitCast on success
14674         rather than true/false.  Ravi: this is what I was talking about,
14675         the pattern is to use a static method as a "constructor" for
14676         objects. 
14677
14678         Also, do not create arguments until the very last minute,
14679         otherwise we always create the arguments even for lookups that
14680         will never be performed. 
14681
14682         (UserImplicitCast::Resolve): Eliminate, objects of type
14683         UserImplicitCast are born in a fully resolved state. 
14684
14685         * typemanager.cs (InitCoreTypes): Init also value_type
14686         (System.ValueType). 
14687
14688         * expression.cs (Cast::Resolve): First resolve the child expression.
14689
14690         (LValue): Add new method AddressOf to be used by
14691         the `&' operator.  
14692
14693         Change the argument of Store to take an EmitContext instead of an
14694         ILGenerator, because things like FieldExpr need to be able to call
14695         their children expression to generate the instance code. 
14696
14697         (Expression::Error, Expression::Warning): Sugar functions for
14698         reporting errors.
14699
14700         (Expression::MemberLookup): Accept a TypeContainer instead of a
14701         Report as the first argument.
14702
14703         (Expression::ResolvePrimary): Killed.  I still want to improve
14704         this as currently the code is just not right.
14705
14706         (Expression::ResolveMemberAccess): Simplify, but it is still
14707         wrong. 
14708
14709         (Unary::Resolve): Catch errors in AddressOf operators.
14710
14711         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
14712         index to a byte for the short-version, or the compiler will choose
14713         the wrong Emit call, which generates the wrong data.
14714
14715         (ParameterReference::Emit, ::Store): same.
14716
14717         (FieldExpr::AddressOf): Implement.
14718
14719         * typemanager.cs: TypeManager: made public variable instead of
14720         property.
14721
14722         * driver.cs: document --fatal.
14723
14724         * report.cs (ErrorMessage, WarningMessage): new names for the old
14725         Error and Warning classes.
14726
14727         * cs-parser.jay (member_access): Turn built-in access to types
14728         into a normal simplename
14729
14730 2001-09-27  Ravi Pratap  <ravi@ximian.com>
14731
14732         * expression.cs (Invocation::BetterConversion): Fix to cope
14733         with q being null, since this was introducing a bug.
14734
14735         * expression.cs (ConvertImplicit): Do built-in conversions first.
14736
14737 2001-09-27  Ravi Pratap  <ravi@ximian.com>
14738
14739         * expression.cs (UserImplicitCast::Resolve): Fix bug.
14740
14741 2001-09-27  Ravi Pratap  <ravi@ximian.com>
14742
14743         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
14744         I had introduced long ago (what's new ?).
14745
14746         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
14747         the work of all the checking. 
14748         (ConvertImplicit): Call CanConvert and only then create object if necessary.
14749         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
14750
14751         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
14752         that is the right way. 
14753
14754         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
14755         overloading resolution. Use everywhere instead of cutting and pasting code.
14756
14757         (Binary::ResolveOperator): Use MakeUnionSet.
14758
14759         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
14760         we have to convert to bool types. Not complete yet.
14761
14762 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
14763
14764         * typemanager.cs (TypeManager::CSharpName): support ushort.
14765
14766         * expression.cs (Expression::TryImplicitIntConversion): Attempts
14767         to provide an expression that performsn an implicit constant int
14768         conversion (section 6.1.6).
14769         (Expression::ConvertImplicitRequired): Reworked to include
14770         implicit constant expression conversions.
14771
14772         (Expression::ConvertNumericExplicit): Finished.
14773
14774         (Invocation::Emit): If InstanceExpression is null, then it means
14775         that we perform a call on this.
14776
14777 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
14778
14779         * expression.cs (Unary::Emit): Remove some dead code.
14780         (Probe): Implement Resolve and Emit for `is'.
14781         (Expression::ConvertImplicitRequired): Attempt to do constant
14782         expression conversions here.  Maybe should be moved to
14783         ConvertImplicit, but I am not sure.
14784         (Expression::ImplicitLongConstantConversionPossible,
14785         Expression::ImplicitIntConstantConversionPossible): New functions
14786         that tell whether is it possible to apply an implicit constant
14787         expression conversion.
14788
14789         (ConvertNumericExplicit): Started work on explicit numeric
14790         conversions.
14791
14792         * cs-parser.jay: Update operator constants.
14793
14794         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
14795         (Parameters::GetSignature): Hook up VerifyArgs here.
14796         (Parameters::VerifyArgs): Verifies that no two arguments have the
14797         same name. 
14798
14799         * class.cs (Operator): Update the operator names to reflect the
14800         ones that the spec expects (as we are just stringizing the
14801         operator names).
14802
14803         * expression.cs (Unary::ResolveOperator): Fix bug: Use
14804         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
14805         previous usage did only work for our methods.
14806         (Expression::ConvertImplicit): Handle decimal implicit numeric
14807         conversions as well.
14808         (Expression::InternalTypeConstructor): Used to invoke constructors
14809         on internal types for default promotions.
14810
14811         (Unary::Emit): Implement special handling for the pre/post
14812         increment/decrement for overloaded operators, as they need to have
14813         the same semantics as the other operators.
14814
14815         (Binary::ResolveOperator): ditto.
14816         (Invocation::ConversionExists): ditto.
14817         (UserImplicitCast::Resolve): ditto.
14818
14819 2001-09-26  Ravi Pratap  <ravi@ximian.com>
14820
14821         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
14822         operator, return after emitting body. Regression tests pass again !
14823
14824         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
14825         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
14826         (Invocation::OverloadResolve): Ditto.
14827         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
14828
14829         * everywhere : update calls to the above methods accordingly.
14830
14831 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
14832
14833         * assign.cs (Assign): Make it inherit from ExpressionStatement.
14834
14835         * expression.cs (ExpressionStatement): New base class used for
14836         expressions that can appear in statements, so that we can provide
14837         an alternate path to generate expression that do not leave a value
14838         on the stack.
14839
14840         (Expression::Emit, and all the derivatives): We no longer return
14841         whether a value is left on the stack or not.  Every expression
14842         after being emitted leaves a single value on the stack.
14843
14844         * codegen.cs (EmitContext::EmitStatementExpression): Use the
14845         facilties of ExpressionStatement if possible.
14846
14847         * cs-parser.jay: Update statement_expression.
14848
14849 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
14850
14851         * driver.cs: Change the wording of message
14852
14853 2001-09-25  Ravi Pratap  <ravi@ximian.com>
14854
14855         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
14856         the type of the expression to the return type of the method if
14857         we have an overloaded operator match ! The regression tests pass again !
14858         (Unary::ResolveOperator): Ditto.
14859
14860         * expression.cs (Invocation::ConversionExists): Correct the member lookup
14861         to find "op_Implicit", not "implicit" ;-)
14862         (UserImplicitCast): New class to take care of user-defined implicit conversions.
14863         (ConvertImplicit, ForceConversion): Take TypeContainer argument
14864
14865         * everywhere : Correct calls to the above accordingly.
14866
14867         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
14868         (ConvertImplicit): Do user-defined conversion if it exists.
14869
14870 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
14871
14872         * assign.cs: track location.
14873         (Resolve): Use implicit conversions on assignment.
14874
14875         * literal.cs: Oops.  Not good, Emit of short access values should
14876         pass (Bytes) or the wrong argument will be selected.
14877
14878         * expression.cs (Unary::Emit): Emit code for -expr.
14879
14880         (Unary::ResolveOperator): Handle `Substract' for non-constants
14881         (substract from zero from the non-constants).
14882         Deal with Doubles as well. 
14883
14884         (Expression::ConvertImplicitRequired): New routine that reports an
14885         error if no implicit conversion exists. 
14886
14887         (Invocation::OverloadResolve): Store the converted implicit
14888         expressions if we make them
14889
14890 2001-09-24  Ravi Pratap  <ravi@ximian.com>
14891
14892         * class.cs (ConstructorInitializer): Take a Location argument.
14893         (ConstructorBaseInitializer): Same here.
14894         (ConstructorThisInitializer): Same here.
14895
14896         * cs-parser.jay : Update all calls accordingly.
14897
14898         * expression.cs (Unary, Binary, New): Take location argument.
14899         Update accordingly everywhere.
14900
14901         * cs-parser.jay : Update all calls to the above to take a location
14902         argument.
14903
14904         * class.cs : Ditto.
14905
14906 2001-09-24  Ravi Pratap  <ravi@ximian.com>
14907
14908         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
14909         (Invocation::BetterConversion): Same here
14910         (Invocation::ConversionExists): Ditto.
14911
14912         (Invocation::ConversionExists): Implement.
14913
14914 2001-09-22  Ravi Pratap  <ravi@ximian.com>
14915
14916         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
14917         Also take an additional TypeContainer argument.
14918
14919         * All over : Pass in TypeContainer as argument to OverloadResolve.
14920
14921         * typemanager.cs (CSharpName): Update to check for the string type and return
14922         that too.
14923
14924         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
14925         a given method.
14926
14927 2001-09-21  Ravi Pratap  <ravi@ximian.com>
14928
14929         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
14930         (Invocation::BetterFunction): Implement.
14931         (Invocation::BetterConversion): Implement.
14932         (Invocation::ConversionExists): Skeleton, no implementation yet.
14933
14934         Okay, things work fine !
14935
14936 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
14937
14938         * typemanager.cs: declare and load enum_type, delegate_type and
14939         void_type. 
14940
14941         * expression.cs (Expression::Emit): Now emit returns a value that
14942         tells whether a value is left on the stack or not.  This strategy
14943         might be reveted tomorrow with a mechanism that would address
14944         multiple assignments.
14945         (Expression::report118): Utility routine to report mismatches on
14946         the ExprClass.
14947
14948         (Unary::Report23): Report impossible type/operator combination
14949         utility function.
14950
14951         (Unary::IsIncrementableNumber): Whether the type can be
14952         incremented or decremented with add.
14953         (Unary::ResolveOperator): Also allow enumerations to be bitwise
14954         complemented. 
14955         (Unary::ResolveOperator): Implement ++, !, ~,
14956
14957         (Invocation::Emit): Deal with new Emit convetion.
14958
14959         * All Expression derivatives: Updated their Emit method to return
14960         whether they leave values on the stack or not.
14961
14962         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
14963         stack for expressions that are statements. 
14964
14965 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
14966
14967         * expression.cs (LValue): New interface.  Must be implemented by
14968         LValue objects.
14969         (LocalVariableReference, ParameterReference, FieldExpr): Implement
14970         LValue interface.
14971
14972         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
14973         interface for generating code, simplifies the code.
14974
14975 2001-09-20  Ravi Pratap  <ravi@ximian.com>
14976
14977         * expression.cs (everywhere): Comment out return statements in ::Resolve
14978         methods to avoid the warnings.
14979
14980 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
14981
14982         * driver.cs (parse): Report error 2001 if we can not open the
14983         source file.
14984
14985         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
14986         not resolve it.
14987
14988         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
14989         object. 
14990
14991         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
14992         otherwise nested blocks end up with the same index.
14993
14994         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
14995
14996         * expression.cs:  Instead of having FIXMEs in the Resolve
14997         functions, throw exceptions so it is obvious that we are facing a
14998         bug. 
14999
15000         * cs-parser.jay (invocation_expression): Pass Location information.
15001
15002         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
15003         Use a basename for those routines because .NET does not like paths
15004         on them. 
15005
15006         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
15007         already defined.
15008
15009 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
15010
15011         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
15012         are loading the correct data types (throws an exception if not).
15013         (TypeManager::InitCoreTypes): Use CoreLookupType
15014
15015         * expression.cs (Unary::ResolveOperator): return the child
15016         expression for expressions which are just +expr.
15017         (Unary::ResolveOperator): Return negative literals for -LITERAL
15018         expressions (otherwise they are Unary {Literal}).
15019         (Invocation::Badness): Take into account `Implicit constant
15020         expression conversions'.
15021
15022         * literal.cs (LongLiteral): Implement long literal class.
15023         (IntLiteral): export the `Value' of the intliteral. 
15024
15025 2001-09-19  Ravi Pratap  <ravi@ximian.com>
15026
15027         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
15028
15029         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
15030         instead of 'Operator'
15031
15032         * expression.cs (Binary::ResolveOperator): Update accordingly.
15033         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
15034         and 'Minus'
15035
15036         * cs-parser.jay (unary_expression): Update to use the new names.
15037
15038         * gen-treedump.cs (GetUnary): Same here.
15039
15040         * expression.cs (Unary::Resolve): Implement.
15041         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
15042         operators are found instead of making noise ;-)
15043         (Unary::ResolveOperator): New method to do precisely the same thing which
15044         Binary::ResolveOperator does for Binary expressions.
15045         (Unary.method, .Arguments): Add.
15046         (Unary::OperName): Implement.   
15047         (Unary::ForceConversion): Copy and Paste !
15048
15049         * class.cs (Operator::Define): Fix a small bug for the case when we have 
15050         a unary operator.
15051
15052         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
15053         for the inbuilt operators. Only overloading works for now ;-)
15054
15055 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
15056
15057         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
15058         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
15059
15060         * expression.cs (This::Emit): Implement. 
15061         (This::Resolve): Implement.
15062         (TypeOf:Resolve): Implement.
15063         (Expression::ResolveSimpleName): Add an implicit this to instance
15064         field references. 
15065         (MemberAccess::Resolve): Deal with Parameters and Fields. 
15066         Bind instance variable to Field expressions.
15067         (FieldExpr::Instance): New field used to track the expression that
15068         represents the object instance.
15069         (FieldExpr::Resolve): Track potential errors from MemberLookup not
15070         binding 
15071         (FieldExpr::Emit): Implement.
15072
15073         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
15074         the last instruction contains a return opcode to avoid generating
15075         the last `ret' instruction (this generates correct code, and it is
15076         nice to pass the peverify output).
15077
15078         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
15079         initializer for static and instance variables.
15080         (Constructor::Emit): Allow initializer to be null in the case of
15081         static constructors.  Only emit initializer for instance
15082         constructors. 
15083
15084         (TypeContainer::FindMembers): Return a null array if there are no
15085         matches.
15086
15087         Also fix the code for the MemberTypes.Method branch, as it was not
15088         scanning that for operators (or tried to access null variables before).
15089
15090         * assign.cs (Assign::Emit): Handle instance and static fields. 
15091
15092         * TODO: Updated.
15093
15094         * driver.cs: Stop compilation if there are parse errors.
15095
15096         * cs-parser.jay (constructor_declaration): Provide default base
15097         initializer for non-static constructors.
15098         (constructor_declarator): Do not provide a default base
15099         initializers if none was specified.
15100         Catch the fact that constructors should not have parameters.
15101
15102         * class.cs: Do not emit parent class initializers for static
15103         constructors, that should be flagged as an error.
15104
15105 2001-09-18  Ravi Pratap  <ravi@ximian.com>
15106
15107         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
15108         Move back code into TypeContainer::Populate.
15109
15110 2001-09-18  Ravi Pratap  <ravi@ximian.com>
15111
15112         * class.cs (TypeContainer::AddConstructor): Fix the check to
15113         compare against Name, not Basename. 
15114         (Operator::OpType): Change Plus and Minus to Add and Subtract.
15115
15116         * cs-parser.jay : Update accordingly.
15117
15118         * class.cs (TypeContainer::FindMembers): For the case where we are searching
15119         for methods, don't forget to look into the operators too.
15120         (RegisterMethodBuilder): Helper method to take care of this for
15121         methods, constructors and operators.
15122         (Operator::Define): Completely revamp.
15123         (Operator.OperatorMethod, MethodName): New fields.
15124         (TypeContainer::Populate): Move the registering of builders into
15125         RegisterMethodBuilder.
15126         (Operator::Emit): Re-write.
15127
15128         * expression.cs (Binary::Emit): Comment out code path to emit method
15129         invocation stuff for the case when we have a user defined operator. I am
15130         just not able to get it right !
15131
15132 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
15133
15134         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
15135         argument. 
15136
15137         (Expression::MemberLookup): Provide a version that allows to
15138         specify the MemberTypes and BindingFlags. 
15139
15140         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
15141         so it was not fetching variable information from outer blocks.
15142
15143         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
15144         Beforefieldinit as it was buggy.
15145
15146         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
15147         that Ravi put here.  
15148
15149         * class.cs (Constructor::Emit): Only emit if block is not null.
15150         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
15151         deal with this by semantically definining it as if the user had
15152         done it.
15153
15154         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
15155         constructors as we now "emit" them at a higher level.
15156
15157         (TypeContainer::DefineDefaultConstructor): Used to define the
15158         default constructors if none was provided.
15159
15160         (ConstructorInitializer): Add methods Resolve and Emit. 
15161
15162         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
15163
15164 2001-09-17  Ravi Pratap  <ravi@ximian.com>
15165
15166         * class.cs (TypeContainer::EmitDefaultConstructor): Register
15167         the default constructor builder with our hashtable for methodbuilders
15168         to methodcores.
15169
15170         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
15171         and argument_count is 0 in which case we have a match.
15172         (Binary::ResolveOperator): More null checking and miscellaneous coding
15173         style cleanup.
15174
15175 2001-09-17  Ravi Pratap  <ravi@ximian.com>
15176
15177         * rootcontext.cs (IsNameSpace): Compare against null.
15178
15179         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
15180
15181         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
15182         and Unary::Operator.
15183
15184         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
15185         accordingly.
15186
15187         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
15188         we have overloaded operators.
15189         (Binary::ResolveOperator): Implement the part which does the operator overload
15190         resolution.
15191
15192         * class.cs (Operator::Emit): Implement.
15193         (TypeContainer::Emit): Emit the operators we have too.
15194
15195         * expression.cs (Binary::Emit): Update to emit the appropriate code for
15196         the case when we have a user-defined operator.
15197
15198 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
15199
15200         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
15201
15202 2001-09-16  Ravi Pratap  <ravi@ximian.com>
15203
15204         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
15205         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
15206         (Constructor::Emit): Implement.
15207         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
15208         if we have no work to do. 
15209         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
15210         Emit method.
15211
15212         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
15213         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
15214
15215         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
15216         of parent.parent.
15217
15218 2001-09-15  Ravi Pratap  <ravi@ximian.com>
15219
15220         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
15221         in the source.
15222         (Tree::RecordNamespace): Method to do what the name says ;-)
15223         (Tree::Namespaces): Property to get at the namespaces hashtable.
15224
15225         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
15226         keep track.
15227
15228         * rootcontext.cs (IsNamespace): Fixed it :-)
15229
15230 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
15231
15232         * class.cs (TypeContainer::FindMembers): Add support for
15233         constructors. 
15234         (MethodCore): New class that encapsulates both the shared aspects
15235         of a Constructor and a Method.  
15236         (Method, Constructor): Factored pieces into MethodCore.
15237
15238         * driver.cs: Added --fatal which makes errors throw exceptions.
15239         Load System assembly as well as part of the standard library.
15240
15241         * report.cs: Allow throwing exceptions on errors for debugging.
15242
15243         * modifiers.cs: Do not use `parent', instead use the real type
15244         container to evaluate permission settings.
15245
15246         * class.cs: Put Ravi's patch back in.  He is right, and we will
15247         have to cope with the
15248
15249 2001-09-14  Ravi Pratap  <ravi@ximian.com>
15250
15251         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
15252         FamORAssem, not FamANDAssem.
15253
15254 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
15255
15256         * driver.cs: Added --parse option that only parses its input files
15257         and terminates.
15258
15259         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
15260         incorrect.  IsTopLevel is not used to tell whether an object is
15261         root_types or not (that can be achieved by testing this ==
15262         root_types).  But to see if this is a top-level *class* (not
15263         necessarly our "toplevel" container). 
15264
15265 2001-09-14  Ravi Pratap  <ravi@ximian.com>
15266
15267         * enum.cs (Enum::Define): Modify to call the Lookup method on the
15268         parent instead of a direct call to GetType.
15269
15270 2001-09-14  Ravi Pratap  <ravi@ximian.com>
15271
15272         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
15273         Modifiers.TypeAttr. This should just be a call to that method.
15274
15275         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
15276         object so that we can determine if we are top-level or not.
15277
15278         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
15279         TypeContainer too.
15280
15281         * enum.cs (Enum::Define): Ditto.
15282
15283         * modifiers.cs (FieldAttr): Re-write.
15284
15285         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
15286         (TypeContainer::HaveStaticConstructor): New property to provide access
15287         to precisely that info.
15288
15289         * modifiers.cs (MethodAttr): Re-write.
15290         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
15291
15292         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
15293         of top-level types as claimed.
15294
15295 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
15296
15297         * expression.cs (MemberLookup): Fruitless attempt to lookup
15298         constructors.  Maybe I need to emit default constructors?  That
15299         might be it (currently .NET emits this for me automatically).
15300         (Invocation::OverloadResolve): Cope with Arguments == null.
15301         (Invocation::EmitArguments): new function, shared by the new
15302         constructor and us.
15303         (Invocation::Emit): Handle static and instance methods.  Emit
15304         proper call instruction for virtual or non-virtual invocations.
15305         (New::Emit): Implement.
15306         (New::Resolve): Implement.
15307         (MemberAccess:Resolve): Implement.
15308         (MethodGroupExpr::InstanceExpression): used conforming to the spec
15309         to track instances.
15310         (FieldExpr::Resolve): Set type.
15311
15312         * support.cs: Handle empty arguments.
15313                 
15314         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
15315         SimpleLookup): Auxiliary routines to help parse a qualifier
15316         identifier.  
15317
15318         Update qualifier_identifier rule.
15319
15320         * codegen.cs: Removed debugging messages.
15321
15322         * class.cs: Make this a global thing, this acts just as a "key" to
15323         objects that we might have around.
15324
15325         (Populate): Only initialize method_builders_to_methods once.
15326
15327         * expression.cs (PropertyExpr): Initialize type from the
15328         PropertyType. 
15329
15330         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
15331         Resolve pattern.  Attempt to implicitly convert value to boolean.
15332         Emit code.
15333
15334         * expression.cs: Set the type for the int32/int32 argument case.
15335         (Binary::ResolveOperator): Set the return type to boolean for
15336         comparission operators
15337
15338         * typemanager.cs: Remove debugging print code.
15339
15340         (Invocation::Resolve): resolve type.
15341
15342         * class.cs: Allocate a MemberInfo of the correct size, as the code
15343         elsewhere depends on the test to reflect the correct contents.
15344
15345         (Method::) Keep track of parameters, due to System.Reflection holes
15346
15347         (TypeContainer::Populate): Keep track of MethodBuilders to Method
15348         mapping here.
15349
15350         (TypeContainer::FindMembers): Use ArrayList and then copy an array
15351         of the exact size and return that.
15352
15353         (Class::LookupMethodByBuilder): New function that maps
15354         MethodBuilders to its methods.  Required to locate the information
15355         on methods because System.Reflection bit us again.
15356
15357         * support.cs: New file, contains an interface ParameterData and
15358         two implementations: ReflectionParameters and InternalParameters
15359         used to access Parameter information.  We will need to grow this
15360         as required.
15361
15362         * expression.cs (Invocation::GetParameterData): implement a cache
15363         and a wrapper around the ParameterData creation for methods. 
15364         (Invocation::OverloadResolve): Use new code.
15365
15366 2001-09-13  Ravi Pratap  <ravi@ximian.com>
15367
15368         * class.cs (TypeContainer::EmitField): Remove and move into 
15369         (Field::Define): here and modify accordingly.
15370         (Field.FieldBuilder): New member.
15371         (TypeContainer::Populate): Update accordingly.
15372         (TypeContainer::FindMembers): Implement.
15373
15374 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
15375
15376         * statement.cs: (VariableInfo::VariableType): New field to be
15377         initialized with the full type once it is resolved. 
15378
15379 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
15380
15381         * parameter.cs (GetParameterInfo): Use a type cache to compute
15382         things only once, and to reuse this information
15383
15384         * expression.cs (LocalVariableReference::Emit): Implement.
15385         (OpcodeCast::Emit): fix.
15386
15387         (ParameterReference::Resolve): Implement.
15388         (ParameterReference::Emit): Implement.
15389
15390         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
15391         that are expressions need to stay as Expressions.
15392
15393         * typemanager.cs (CSharpName): Returns the C# name of a type if
15394         possible. 
15395
15396         * expression.cs (Expression::ConvertImplicit): New function that
15397         implements implicit type conversions.
15398
15399         (Expression::ImplicitReferenceConversion): Implements implicit
15400         reference conversions.
15401
15402         (EmptyCast): New type for transparent casts.
15403
15404         (OpcodeCast): New type for casts of types that are performed with
15405         a sequence of bytecodes.
15406
15407         (BoxedCast): New type used for casting value types into reference
15408         types.  Emits a box opcode.
15409
15410         (Binary::DoNumericPromotions): Implements numeric promotions of
15411         and computation of the Binary::Type.
15412
15413         (Binary::EmitBranchable): Optimization.
15414
15415         (Binary::Emit): Implement code emission for expressions.
15416
15417         * typemanager.cs (TypeManager): Added two new core types: sbyte
15418         and byte.
15419
15420 2001-09-12  Ravi Pratap  <ravi@ximian.com>
15421
15422         * class.cs (TypeContainer::FindMembers): Method which does exactly
15423         what Type.FindMembers does, only we don't have to use reflection. No
15424         implementation yet.
15425
15426         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
15427         typecontainer objects as we need to get at them.
15428         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
15429
15430         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
15431         typecontainer object.
15432
15433         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
15434         of just a Report object.
15435
15436 2001-09-11  Ravi Pratap  <ravi@ximian.com>
15437
15438         * class.cs (Event::Define): Go back to using the prefixes "add_" and
15439         "remove_"
15440         (TypeContainer::Populate): Now define the delegates of the type too.
15441         (TypeContainer.Delegates): Property to access the list of delegates defined
15442         in the type.
15443
15444         * delegates.cs (Delegate::Define): Implement partially.
15445
15446         * modifiers.cs (TypeAttr): Handle more flags.
15447
15448 2001-09-11  Ravi Pratap  <ravi@ximian.com>
15449
15450         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
15451         and not <=
15452         (Operator::Define): Re-write logic to get types by using the LookupType method
15453         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
15454         (Indexer::Define): Ditto.
15455         (Event::Define): Ditto.
15456         (Property::Define): Ditto.
15457
15458 2001-09-10  Ravi Pratap  <ravi@ximian.com>
15459
15460         * class.cs (TypeContainer::Populate): Now define operators too. 
15461         (TypeContainer.Operators): New property to access the list of operators
15462         in a type.
15463         (Operator.OperatorMethodBuilder): New member to hold the method builder
15464         for the operator we are defining.
15465         (Operator::Define): Implement.
15466
15467 2001-09-10  Ravi Pratap  <ravi@ximian.com>
15468
15469         * class.cs (Event::Define): Make the prefixes of the accessor methods
15470         addOn_ and removeOn_ 
15471
15472         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
15473         of the location being passed in too. Ideally, this should go later since all
15474         error reporting should be done through the Report object.
15475
15476         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
15477         (Populate): Iterate thru the indexers we have and define them too.
15478         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
15479         for the get and set accessors.
15480         (Indexer::Define): Implement.
15481
15482 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
15483
15484         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
15485         my previous implementation, did not work.
15486
15487         * typemanager.cs: Add a couple of missing types (the longs).
15488
15489         * literal.cs: Use TypeManager.bool_type instead of getting it.
15490
15491         * expression.cs (EventExpr): New kind of expressions.
15492         (Expressio::ExprClassFromMemberInfo): finish
15493
15494 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
15495
15496         * assign.cs: Emit stores to static fields differently.
15497
15498 2001-09-08  Ravi Pratap  <ravi@ximian.com>
15499
15500         * Merge in changes and adjust code to tackle conflicts. Backed out my
15501         code in Assign::Resolve ;-) 
15502
15503 2001-09-08  Ravi Pratap  <ravi@ximian.com>
15504
15505         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
15506         instead Report.Error and also pass in the location.
15507         (CSharpParser::Lexer): New readonly property to return the reference
15508         to the Tokenizer object.
15509         (declare_local_variables): Use Report.Error with location instead of plain 
15510         old error.
15511         (CheckDef): Ditto.
15512
15513         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
15514         (Operator.CheckBinaryOperator): Ditto.
15515
15516         * cs-parser.jay (operator_declarator): Update accordingly.
15517
15518         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
15519         (CheckBinaryOperator): Same here.
15520
15521         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
15522         on the name without any prefixes of namespace names etc. This is because we
15523         already might have something already fully qualified like 
15524         'System.Console.WriteLine'
15525
15526         * assign.cs (Resolve): Begin implementation. Stuck ;-)
15527
15528 2001-09-07  Ravi Pratap  <ravi@ximian.com>
15529
15530         * cs-tokenizer.cs (location): Return a string which also contains
15531         the file name.
15532
15533         * expression.cs (ElementAccess): New class for expressions of the
15534         type 'element access.'
15535         (BaseAccess): New class for expressions of the type 'base access.'
15536         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
15537         respectively.
15538
15539         * cs-parser.jay (element_access): Implement action.
15540         (base_access): Implement actions.
15541         (checked_expression, unchecked_expression): Implement.
15542
15543         * cs-parser.jay (local_variable_type): Correct and implement.
15544         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
15545
15546         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
15547
15548         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
15549         name and the specifiers.
15550
15551         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
15552
15553         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
15554         making them all public ;-)
15555
15556         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
15557         class anyways.
15558
15559 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
15560
15561         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
15562         PropertyExprs.
15563         (FieldExpr, PropertyExprs): New resolved expressions.
15564         (SimpleName::MemberStaticCheck): Perform static checks for access
15565         to non-static fields on static methods. Maybe this should be
15566         generalized for MemberAccesses. 
15567         (SimpleName::ResolveSimpleName): More work on simple name
15568         resolution. 
15569
15570         * cs-parser.jay (primary_expression/qualified_identifier): track
15571         the parameter index.
15572
15573         * codegen.cs (CodeGen::Save): Catch save exception, report error.
15574         (EmitContext::EmitBoolExpression): Chain to expression generation
15575         instead of temporary hack.
15576         (::EmitStatementExpression): Put generic expression code generation.
15577
15578         * assign.cs (Assign::Emit): Implement variable assignments to
15579         local variables, parameters and fields.
15580
15581 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
15582
15583         * statement.cs (Block::GetVariableInfo): New method, returns the
15584         VariableInfo for a variable name in a block.
15585         (Block::GetVariableType): Implement in terms of GetVariableInfo
15586
15587         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
15588         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
15589
15590 2001-09-06  Ravi Pratap  <ravi@ximian.com>
15591
15592         * cs-parser.jay (operator_declaration): Continue on my quest : update
15593         to take attributes argument.
15594         (event_declaration): Ditto.
15595         (enum_declaration): Ditto.
15596         (indexer_declaration): Ditto.
15597
15598         * class.cs (Operator::Operator): Update constructor accordingly.
15599         (Event::Event): Ditto.
15600
15601         * delegate.cs (Delegate::Delegate): Same here.
15602
15603         * enum.cs (Enum::Enum): Same here.
15604
15605 2001-09-05  Ravi Pratap  <ravi@ximian.com>
15606
15607         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
15608
15609         * ../tests/cs0658.cs : New file to demonstrate error 0658.
15610
15611         * attribute.cs (Attributes): New class to encapsulate all attributes which were
15612         being passed around as an arraylist.
15613         (Attributes::AddAttribute): Method to add attribute sections.
15614
15615         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
15616         (struct_declaration): Update accordingly.
15617         (constant_declaration): Update.
15618         (field_declaration): Update.
15619         (method_header): Update.
15620         (fixed_parameter): Update.
15621         (parameter_array): Ditto.
15622         (property_declaration): Ditto.
15623         (destructor_declaration): Ditto.
15624
15625         * class.cs (Struct::Struct): Update constructors accordingly.
15626         (Class::Class): Ditto.
15627         (Field::Field): Ditto.
15628         (Method::Method): Ditto.
15629         (Property::Property): Ditto.
15630         (TypeContainer::OptAttribute): update property's return type.
15631
15632         * interface.cs (Interface.opt_attributes): New member.
15633         (Interface::Interface): Update to take the extra Attributes argument.
15634
15635         * parameter.cs (Parameter::Parameter): Ditto.
15636
15637         * constant.cs (Constant::Constant): Ditto.
15638
15639         * interface.cs (InterfaceMemberBase): New OptAttributes field.
15640         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
15641         the attributes as a parameter.
15642         (InterfaceProperty): Update constructor call.
15643         (InterfaceEvent): Ditto.
15644         (InterfaceMethod): Ditto.
15645         (InterfaceIndexer): Ditto.
15646
15647         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
15648         pass the attributes too.
15649         (interface_event_declaration): Ditto.
15650         (interface_property_declaration): Ditto.
15651         (interface_method_declaration): Ditto.
15652         (interface_declaration): Ditto.
15653
15654 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
15655
15656         * class.cs (Method::Define): Track the "static Main" definition to
15657         create an entry point. 
15658
15659         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
15660         EntryPoint if we find it. 
15661
15662         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
15663         (EmitContext::ig): Make this variable public.
15664
15665         * driver.cs: Make the default output file be the first file name
15666         with the .exe extension.  
15667
15668         Detect empty compilations
15669
15670         Handle various kinds of output targets.  Handle --target and
15671         rename -t to --dumper.
15672
15673         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
15674         methods inherited from Expression return now an Expression.  This
15675         will is used during the tree rewriting as we resolve them during
15676         semantic analysis.
15677
15678         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
15679         the spec.  Missing entirely is the information about
15680         accessability of elements of it.
15681
15682         (Expression::ExprClassFromMemberInfo): New constructor for
15683         Expressions that creates a fully initialized Expression based on
15684         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
15685         a Type.
15686
15687         (Invocation::Resolve): Begin implementing resolution of invocations.
15688
15689         * literal.cs (StringLiteral):  Implement Emit.
15690
15691 2001-09-05  Ravi Pratap  <ravi@ximian.com>
15692
15693         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
15694         member.
15695
15696 2001-09-04  Ravi Pratap  <ravi@ximian.com>
15697
15698         * cs-parser.jay (attribute_arguments): Implement actions.
15699         (attribute): Fix bug in production. Implement action.
15700         (attribute_list): Implement.
15701         (attribute_target): Implement.
15702         (attribute_target_specifier, opt_target_specifier): Implement
15703         (CheckAttributeTarget): New method to check if the attribute target
15704         is valid.
15705         (attribute_section): Implement.
15706         (opt_attributes): Implement.
15707
15708         * attribute.cs : New file to handle attributes.
15709         (Attribute): Class to hold attribute info.
15710
15711         * cs-parser.jay (opt_attribute_target_specifier): Remove production
15712         (attribute_section): Modify production to use 2 different rules to 
15713         achieve the same thing. 1 s/r conflict down !
15714         Clean out commented, useless, non-reducing dimension_separator rules.
15715
15716         * class.cs (TypeContainer.attributes): New member to hold list
15717         of attributes for a type.
15718         (Struct::Struct): Modify to take one more argument, the attribute list.
15719         (Class::Class): Ditto.
15720         (Field::Field): Ditto.
15721         (Method::Method): Ditto.
15722         (Property::Property): Ditto.
15723
15724         * cs-parser.jay (struct_declaration): Update constructor call to
15725         pass in the attributes too.
15726         (class_declaration): Ditto.
15727         (constant_declaration): Ditto.
15728         (field_declaration): Ditto.
15729         (method_header): Ditto.
15730         (fixed_parameter): Ditto.
15731         (parameter_array): Ditto.
15732         (property_declaration): Ditto.
15733
15734         * constant.cs (Constant::Constant): Update constructor similarly.
15735         Use System.Collections.
15736
15737         * parameter.cs (Parameter::Parameter): Update as above.
15738
15739 2001-09-02  Ravi Pratap  <ravi@ximian.com>
15740
15741         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
15742         (TypeContainer.delegates): New member to hold list of delegates.
15743
15744         * cs-parser.jay (delegate_declaration): Implement the action correctly 
15745         this time as I seem to be on crack ;-)
15746
15747 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
15748
15749         * rootcontext.cs (RootContext::IsNamespace): new function, used to
15750         tell whether an identifier represents a namespace.
15751
15752         * expression.cs (NamespaceExpr): A namespace expression, used only
15753         temporarly during expression resolution.
15754         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
15755         utility functions to resolve names on expressions.
15756
15757 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
15758
15759         * codegen.cs: Add hook for StatementExpressions. 
15760
15761         * class.cs: Fix inverted test for static flag in methods.
15762
15763 2001-09-02  Ravi Pratap  <ravi@ximian.com>
15764
15765         * class.cs (Operator::CheckUnaryOperator): Correct error number used
15766         to make it coincide with MS' number.
15767         (Operator::CheckBinaryOperator): Ditto.
15768
15769         * ../errors/errors.txt : Remove error numbers added earlier.
15770
15771         * ../errors/cs1019.cs : Test case for error # 1019
15772
15773         * ../errros/cs1020.cs : Test case for error # 1020
15774
15775         * cs-parser.jay : Clean out commented cruft.
15776         (dimension_separators, dimension_separator): Comment out. Ostensibly not
15777         used anywhere - non-reducing rule.
15778         (namespace_declarations): Non-reducing rule - comment out.
15779
15780         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
15781         with TypeContainer::AddEnum.
15782
15783         * delegate.cs : New file for delegate handling classes.
15784         (Delegate): Class for declaring delegates.
15785
15786         * makefile : Update.
15787
15788         * cs-parser.jay (delegate_declaration): Implement.
15789
15790 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
15791
15792         * class.cs (Event::Define): Implement.
15793         (Event.EventBuilder): New member.
15794
15795         * class.cs (TypeContainer::Populate): Update to define all enums and events
15796         we have.
15797         (Events): New property for the events arraylist we hold. Shouldn't we move to using
15798         readonly fields for all these cases ?
15799
15800 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
15801
15802         * class.cs (Property): Revamp to use the convention of making fields readonly.
15803         Accordingly modify code elsewhere.
15804
15805         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
15806         the Define method of the Property class.
15807
15808         * class.cs : Clean up applied patch and update references to variables etc. Fix 
15809         trivial bug.
15810         (TypeContainer::Populate): Update to define all the properties we have. Also
15811         define all enumerations.
15812
15813         * enum.cs (Define): Implement.
15814
15815 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
15816
15817         * cs-parser.jay (overloadable_operator): The semantic value is an
15818         enum of the Operator class.
15819         (operator_declarator): Implement actions.
15820         (operator_declaration): Implement.
15821
15822         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
15823         validity of definitions.
15824         (Operator::CheckBinaryOperator): Static method to check for binary operators
15825         (TypeContainer::AddOperator): New method to add an operator to a type.
15826
15827         * cs-parser.jay (indexer_declaration): Added line to actually call the
15828         AddIndexer method so it gets added ;-)
15829
15830         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
15831         already taken care of by the MS compiler ?  
15832
15833 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
15834
15835         * class.cs (Operator): New class for operator declarations.
15836         (Operator::OpType): Enum for the various operators.
15837
15838 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
15839
15840         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
15841         ostensibly handle this in semantic analysis.
15842
15843         * cs-parser.jay (general_catch_clause): Comment out
15844         (specific_catch_clauses, specific_catch_clause): Ditto.
15845         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
15846         (catch_args, opt_catch_args): New productions.
15847         (catch_clause): Rewrite to use the new productions above
15848         (catch_clauses): Modify accordingly.
15849         (opt_catch_clauses): New production to use in try_statement
15850         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
15851         and re-write the code in the actions to extract the specific and
15852         general catch clauses by being a little smart ;-)
15853
15854         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
15855         Hooray, try and catch statements parse fine !
15856
15857 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
15858
15859         * statement.cs (Block::GetVariableType): Fix logic to extract the type
15860         string from the hashtable of variables.
15861
15862         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
15863         I end up making that mistake ;-)
15864         (catch_clauses): Fixed gross error which made Key and Value of the 
15865         DictionaryEntry the same : $1 !!
15866
15867 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
15868
15869         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
15870
15871         * cs-parser.jay (event_declaration): Correct to remove the semicolon
15872         when the add and remove accessors are specified. 
15873
15874 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
15875
15876         * cs-parser.jay (IndexerDeclaration): New helper class to hold
15877         information about indexer_declarator.
15878         (indexer_declarator): Implement actions.
15879         (parsing_indexer): New local boolean used to keep track of whether
15880         we are parsing indexers or properties. This is necessary because 
15881         implicit_parameters come into picture even for the get accessor in the 
15882         case of an indexer.
15883         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
15884
15885         * class.cs (Indexer): New class for indexer declarations.
15886         (TypeContainer::AddIndexer): New method to add an indexer to a type.
15887         (TypeContainer::indexers): New member to hold list of indexers for the
15888         type.
15889
15890 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
15891
15892         * cs-parser.jay (add_accessor_declaration): Implement action.
15893         (remove_accessor_declaration): Implement action.
15894         (event_accessors_declaration): Implement
15895         (variable_declarators): swap statements for first rule - trivial.
15896
15897         * class.cs (Event): New class to hold information about event
15898         declarations.
15899         (TypeContainer::AddEvent): New method to add an event to a type
15900         (TypeContainer::events): New member to hold list of events.
15901
15902         * cs-parser.jay (event_declaration): Implement actions.
15903
15904 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
15905
15906         * cs-parser.jay (dim_separators): Implement. Make it a string
15907         concatenating all the commas together, just as they appear.
15908         (opt_dim_separators): Modify accordingly
15909         (rank_specifiers): Update accordingly. Basically do the same
15910         thing - instead, collect the brackets here.
15911         (opt_rank_sepcifiers): Modify accordingly.
15912         (array_type): Modify to actually return the complete type string
15913         instead of ignoring the rank_specifiers.
15914         (expression_list): Implement to collect the expressions
15915         (variable_initializer): Implement. We make it a list of expressions
15916         essentially so that we can handle the array_initializer case neatly too.
15917         (variable_initializer_list): Implement.
15918         (array_initializer): Make it a list of variable_initializers
15919         (opt_array_initializer): Modify accordingly.
15920
15921         * expression.cs (New::NType): Add enumeration to help us
15922         keep track of whether we have an object/delegate creation
15923         or an array creation.
15924         (New:NewType, New::Rank, New::Indices, New::Initializers): New
15925         members to hold data about array creation.
15926         (New:New): Modify to update NewType
15927         (New:New): New Overloaded contructor for the array creation
15928         case.
15929
15930         * cs-parser.jay (array_creation_expression): Implement to call
15931         the overloaded New constructor.
15932
15933 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
15934
15935         * class.cs (TypeContainer::Constructors): Return member
15936         constructors instead of returning null.
15937
15938 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
15939
15940         * typemanager.cs (InitCoreTypes): Initialize the various core
15941         types after we have populated the type manager with the user
15942         defined types (this distinction will be important later while
15943         compiling corlib.dll)
15944
15945         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
15946         on Expression Classification.  Now all expressions have a method
15947         `Resolve' and a method `Emit'.
15948
15949         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
15950         generation from working.     Also add some temporary debugging
15951         code. 
15952
15953 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
15954
15955         * codegen.cs: Lots of code generation pieces.  This is only the
15956         beginning, will continue tomorrow with more touches of polish.  We
15957         handle the fundamentals of if, while, do, for, return.  Others are
15958         trickier and I need to start working on invocations soon.
15959
15960         * gen-treedump.cs: Bug fix, use s.Increment here instead of
15961         s.InitStatement. 
15962
15963         * codegen.cs (EmitContext): New struct, used during code
15964         emission to keep a context.   Most of the code generation will be
15965         here. 
15966
15967         * cs-parser.jay: Add embedded blocks to the list of statements of
15968         this block.  So code generation proceeds in a top down fashion.
15969
15970 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
15971
15972         * statement.cs: Add support for multiple child blocks.
15973
15974 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
15975
15976         * codegen.cs (EmitCode): New function, will emit the code for a
15977         Block of code given a TypeContainer and its ILGenerator. 
15978
15979         * statement.cs (Block): Standard public readonly optimization.
15980         (Block::Block constructors): Link children. 
15981         (Block::Child): Child Linker.
15982         (Block::EmitVariables): Emits IL variable declarations.
15983
15984         * class.cs: Drop support for MethodGroups here, delay until
15985         Semantic Analysis.
15986         (Method::): Applied the same simplification that I did before, and
15987         move from Properties to public readonly fields.
15988         (Method::ParameterTypes): Returns the parameter types for the
15989         function, and implements a cache that will be useful later when I
15990         do error checking and the semantic analysis on the methods is
15991         performed.
15992         (Constructor::GetCallingConvention): Renamed from CallingConvetion
15993         and made a method, optional argument tells whether this is a class
15994         or a structure to apply the `has-this' bit.
15995         (Method::GetCallingConvention): Implement, returns the calling
15996         convention. 
15997         (Method::Define): Defines the type, a second pass is performed
15998         later to populate the methods.
15999
16000         (Constructor::ParameterTypes): implement a cache similar to the
16001         one on Method::ParameterTypes, useful later when we do semantic
16002         analysis. 
16003
16004         (TypeContainer::EmitMethod):  New method.  Emits methods.
16005
16006         * expression.cs: Removed MethodGroup class from here.
16007
16008         * parameter.cs (Parameters::GetCallingConvention): new method.
16009
16010 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
16011
16012         * class.cs (TypeContainer::Populate): Drop RootContext from the
16013         argument. 
16014
16015         (Constructor::CallingConvention): Returns the calling convention.
16016         (Constructor::ParameterTypes): Returns the constructor parameter
16017         types. 
16018
16019         (TypeContainer::AddConstructor): Keep track of default constructor
16020         and the default static constructor.
16021
16022         (Constructor::) Another class that starts using `public readonly'
16023         instead of properties. 
16024
16025         (Constructor::IsDefault): Whether this is a default constructor. 
16026
16027         (Field::) use readonly public fields instead of properties also.
16028
16029         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
16030         track of static constructors;  If none is used, turn on
16031         BeforeFieldInit in the TypeAttributes. 
16032
16033         * cs-parser.jay (opt_argument_list): now the return can be null
16034         for the cases where there are no arguments. 
16035
16036         (constructor_declarator): If there is no implicit `base' or
16037         `this', then invoke the default parent constructor. 
16038
16039         * modifiers.cs (MethodAttr): New static function maps a set of
16040         modifiers flags into a MethodAttributes enum
16041         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
16042         MethodAttr, TypeAttr to represent the various mappings where the
16043         modifiers are used.
16044         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
16045
16046 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
16047
16048         * parameter.cs (GetParameterInfo): Fix bug where there would be no
16049         method arguments.
16050
16051         * interface.cs (PopulateIndexer): Implemented the code generator
16052         for interface indexers.
16053
16054 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
16055
16056         * interface.cs (InterfaceMemberBase): Now we track the new status
16057         here.  
16058
16059         (PopulateProperty): Implement property population.  Woohoo!  Got
16060         Methods and Properties going today. 
16061
16062         Removed all the properties for interfaces, and replaced them with
16063         `public readonly' fields. 
16064
16065 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
16066
16067         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
16068         initialize their hashtables/arraylists only when they are needed
16069         instead of doing this always.
16070
16071         * parameter.cs: Handle refs and out parameters.
16072
16073         * cs-parser.jay: Use an ArrayList to construct the arguments
16074         instead of the ParameterCollection, and then cast that to a
16075         Parameter[] array.
16076
16077         * parameter.cs: Drop the use of ParameterCollection and use
16078         instead arrays of Parameters.
16079
16080         (GetParameterInfo): Use the Type, not the Name when resolving
16081         types. 
16082
16083 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
16084
16085         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
16086         and instead use public readonly fields.
16087
16088         * class.cs: Put back walking code for type containers.
16089
16090 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
16091
16092         * class.cs (MakeConstant): Code to define constants.
16093
16094         * rootcontext.cs (LookupType): New function.  Used to locate types 
16095
16096
16097 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
16098
16099         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
16100         this System.Reflection code is.  Kudos to Microsoft
16101
16102         * typemanager.cs: Implement a type cache and avoid loading all
16103         types at boot time.  Wrap in LookupType the internals.  This made
16104         the compiler so much faster.  Wow.  I rule!
16105
16106         * driver.cs: Make sure we always load mscorlib first (for
16107         debugging purposes, nothing really important).
16108
16109         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
16110         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
16111
16112         * rootcontext.cs: Lookup types on their namespace;  Lookup types
16113         on namespaces that have been imported using the `using' keyword.
16114
16115         * class.cs (TypeContainer::TypeAttr): Virtualize.
16116         (Class::TypeAttr): Return attributes suitable for this bad boy.
16117         (Struct::TypeAttr): ditto.
16118         Handle nested classes.
16119         (TypeContainer::) Remove all the type visiting code, it is now
16120         replaced with the rootcontext.cs code
16121
16122         * rootcontext.cs (GetClassBases): Added support for structs. 
16123
16124 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
16125
16126         * interface.cs, statement.cs, class.cs, parameter.cs,
16127         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
16128         Drop use of TypeRefs, and use strings instead.
16129
16130 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
16131
16132         * rootcontext.cs: 
16133
16134         * class.cs (Struct::Struct): set the SEALED flags after
16135         checking the modifiers.
16136         (TypeContainer::TypeAttr): new property, returns the
16137         TypeAttributes for a class.  
16138
16139         * cs-parser.jay (type_list): Oops, list production was creating a
16140         new list of base types.
16141
16142         * rootcontext.cs (StdLib): New property.
16143         (GetInterfaceTypeByName): returns an interface by type name, and
16144         encapsulates error handling here.
16145         (GetInterfaces): simplified.
16146         (ResolveTree): Encapsulated all the tree resolution here.
16147         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
16148         types. 
16149
16150         * driver.cs: Add support for --nostdlib, to avoid loading the
16151         default assemblies.
16152         (Main): Do not put tree resolution here. 
16153
16154         * rootcontext.cs: Beginning of the class resolution.
16155
16156 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
16157
16158         * rootcontext.cs: Provide better error reporting. 
16159
16160         * cs-parser.jay (interface_base): set our $$ to be interfaces.
16161
16162         * rootcontext.cs (CreateInterface): Handle the case where there
16163         are no parent interfaces.
16164
16165         (CloseTypes): Routine to flush types at the end.
16166         (CreateInterface): Track types.
16167         (GetInterfaces): Returns an array of Types from the list of
16168         defined interfaces.
16169
16170         * typemanager.c (AddUserType): Mechanism to track user types (puts
16171         the type on the global type hash, and allows us to close it at the
16172         end). 
16173
16174 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
16175
16176         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
16177         RecordInterface instead.
16178
16179         * cs-parser.jay: Updated to reflect changes above.
16180
16181         * decl.cs (Definition): Keep track of the TypeBuilder type that
16182         represents this type here.  Not sure we will use it in the long
16183         run, but wont hurt for now.
16184
16185         * driver.cs: Smaller changes to accomodate the new code.
16186
16187         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
16188         when done. 
16189
16190         * rootcontext.cs (CreateInterface):  New method, used to create
16191         the System.TypeBuilder type for interfaces.
16192         (ResolveInterfaces): new entry point to resolve the interface
16193         hierarchy. 
16194         (CodeGen): Property, used to keep track of the code generator.
16195
16196 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
16197
16198         * cs-parser.jay: Add a second production for delegate_declaration
16199         with `VOID'.
16200
16201         (enum_body): Put an opt_comma here instead of putting it on
16202         enum_body or enum_member_declarations so we can handle trailing
16203         commas on enumeration members.  Gets rid of a shift/reduce.
16204
16205         (type_list): Need a COMMA in the middle.
16206
16207         (indexer_declaration): Tell tokenizer to recognize get/set
16208
16209         * Remove old targets.
16210
16211         * Re-add the parser target.
16212
16213 2001-07-13  Simon Cozens <simon@simon-cozens.org>
16214
16215         * cs-parser.jay: Add precendence rules for a number of operators
16216         ot reduce the number of shift/reduce conflicts in the grammar.
16217
16218 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
16219
16220         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
16221         and put it here.
16222
16223         Get rid of old crufty code.
16224
16225         * rootcontext.cs: Use this to keep track of the parsed
16226         representation and the defined types available to the program. 
16227
16228         * gen-treedump.cs: adjust for new convention.
16229
16230         * type.cs: Split out the type manager, and the assembly builder
16231         from here. 
16232
16233         * typemanager.cs: the type manager will live here now.
16234
16235         * cil-codegen.cs: And the code generator here. 
16236
16237 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
16238
16239         * makefile: Fixed up for easy making.
16240
16241 2001-07-13  Simon Cozens <simon@simon-cozens.org>
16242
16243         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
16244         the 
16245
16246         (unary_expression): Expand pre_increment_expression and
16247         post_decrement_expression to reduce a shift/reduce.
16248
16249 2001-07-11  Simon Cozens
16250
16251         * cs-tokenizer.cs: Hex numbers should begin with a 0.
16252
16253         Improve allow_keyword_as_indent name.
16254
16255 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
16256
16257         * Adjustments for Beta2. 
16258
16259 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
16260
16261         * decl.cs: Added `Define' abstract method.
16262         (InTransit): new property, used to catch recursive definitions. 
16263
16264         * interface.cs: Implement `Define'. 
16265
16266         * modifiers.cs: Map Modifiers.constants to
16267         System.Reflection.TypeAttribute flags.
16268
16269         * class.cs: Keep track of types and user-defined types.
16270         (BuilderInit): New method for creating an assembly
16271         (ResolveType): New function to launch the resolution process, only
16272         used by interfaces for now.
16273
16274         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
16275         that are inserted into the name space. 
16276
16277 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
16278
16279         * ARGH.  I have screwed up my tree so many times due to the use of
16280         rsync rather than using CVS.  Going to fix this at once. 
16281
16282         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
16283         load types.
16284
16285 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
16286
16287         * Experiment successful: Use System.Type rather that our own
16288         version of Type.  
16289
16290 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
16291
16292         * cs-parser.jay: Removed nsAliases from here.
16293
16294         Use new namespaces, handle `using XXX;' 
16295
16296         * namespace.cs: Reimplemented namespace handling, use a recursive
16297         definition of the class.  Now we can keep track of using clauses
16298         and catch invalid using clauses.
16299
16300 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
16301
16302         * gen-treedump.cs: Adapted for all the renaming.
16303
16304         * expression.cs (Expression): this class now has a Type property
16305         which returns an expression Type.
16306
16307         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
16308         `Type', as this has a different meaning now in the base
16309
16310 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
16311
16312         * interface.cs, class.cs: Removed from all the sources the
16313         references to signature computation, as we can not do method
16314         signature computation during the parsing time, as we are not
16315         trying to solve at that point distinguishing:
16316
16317         class X {
16318                 void a (Blah x) {}
16319                 void a (NS.Blah x) {}
16320         }
16321
16322         Which depending on the context might be valid or not, as we do not
16323         know if Blah is the same thing as NS.Blah at that point.
16324
16325         * Redid everything so the code uses TypeRefs now instead of
16326         Types.  TypeRefs are just temporary type placeholders, that need
16327         to be resolved.  They initially have a pointer to a string and the
16328         current scope in which they are used.  This is used later by the
16329         compiler to resolve the reference to an actual Type. 
16330
16331         * DeclSpace is no longer a CIR.Type, and neither are
16332         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
16333         are all DeclSpaces, but no Types. 
16334
16335         * type.cs (TypeRefManager): This implements the TypeRef manager,
16336         which keeps track of all the types that need to be resolved after
16337         the parsing has finished. 
16338
16339 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
16340
16341         * ARGH.  We are going to have to store `foreach' as a class rather
16342         than resolving it, as we need to verify error 1579 after name
16343         resolution.   *OR* we could keep a flag that says `This request to
16344         IEnumerator comes from a foreach statement' which we can then use
16345         to generate the error.
16346
16347 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
16348
16349         * class.cs (TypeContainer.AddMethod): we now add methods to the
16350         MethodGroup instead of the method hashtable.  
16351
16352         * expression.cs: Add MethodGroup abstraction, which gets us one
16353         step closer to the specification in the way we handle method
16354         declarations.  
16355
16356         * cs-parser.jay (primary_expression): qualified_identifier now
16357         tried to match up an identifier to a local variable reference or
16358         to a parameter reference.
16359
16360         current_local_parameters is now a parser global variable that
16361         points to the current parameters for the block, used during name
16362         lookup.
16363
16364         (property_declaration): Now creates an implicit `value' argument to
16365         the set accessor.
16366
16367 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
16368
16369         * parameter.cs: Do not use `param' arguments as part of the
16370         signature, per the spec.
16371
16372 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
16373
16374         * decl.cs: Base class for classes, structs and interfaces.  This
16375         is the "Declaration Space" 
16376
16377         * cs-parser.jay: Use CheckDef for checking declaration errors
16378         instead of having one on each function.
16379
16380         * class.cs: Factor out some code for handling error handling in
16381         accordance to the "Declarations" section in the "Basic Concepts"
16382         chapter in the ECMA C# spec.
16383
16384         * interface.cs: Make all interface member classes derive from
16385         InterfaceMemberBase.
16386
16387 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
16388
16389         * Many things: all interfaces are parsed and generated in
16390         gen-treedump.  Support for member variables, constructors,
16391         destructors, properties, constants is there.
16392
16393         Beginning of the IL backend, but very little done, just there for
16394         testing purposes. 
16395
16396 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
16397
16398         * cs-parser.jay: Fix labeled statement.
16399
16400         * cs-tokenizer.cs (escape): Escape " and ' always.
16401         ref_line, ref_name: keep track of the line/filename as instructed
16402         by #line by the compiler.
16403         Parse #line.
16404
16405 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
16406
16407         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
16408         to match the values in System.CodeDOM.
16409
16410         Divid renamed to Divide.
16411
16412         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
16413         statements. 
16414         (Statements.set): remove.
16415
16416         * System.CodeDOM/CodeCatchClause.cs: always have a valid
16417         statements. 
16418
16419         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
16420         falseStatements always have valid values. 
16421
16422         * cs-parser.jay: Use System.CodeDOM now.
16423