97d1c2aa3db4f5925eeb69ea6ca3a4e61ef932f0
[mono.git] / mcs / mcs / ChangeLog
1 2002-11-14  Martin Baulig  <martin@ximian.com>
2
3         * class.cs (Constructor.Emit): Added the extern/block check.
4         Fixes bug #33678.
5
6 2002-11-14  Martin Baulig  <martin@ximian.com>
7
8         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
9         iteration while looking for indexers, this is needed because the
10         indexer may have a different name in our base classes.  Fixed the
11         error reporting (no indexers at all, not get accessor, no
12         overloaded match).  Fixes bug #33089.
13         (IndexerAccess.DoResolveLValue): Likewise.
14
15 2002-11-14  Martin Baulig  <martin@ximian.com>
16
17         * class.cs (PropertyBase.CheckBase): Make this work for multiple
18         indexers.  Fixes the first part of bug #33089.
19         (MethodSignature.InheritableMemberSignatureCompare): Added support
20         for properties.
21
22 2002-11-13  Ravi Pratap  <ravi@ximian.com>
23
24         * attribute.cs (Attribute.Resolve): Catch the
25         NullReferenceException and report it since it isn't supposed to
26         happen. 
27         
28 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
29
30         * expression.cs (Binary.EmitBranchable): Also handle the cases for
31         LogicalOr and LogicalAnd that can benefit from recursively
32         handling EmitBranchable.  The code now should be nice for Paolo.
33
34 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
35
36         * typemanager.cs (LookupType): Added a negative-hit hashtable for
37         the Type lookups, as we perform quite a number of lookups on
38         non-Types.  This can be removed once we can deterministically tell
39         whether we have a type or a namespace in advance.
40
41         But this might require special hacks from our corlib.
42
43         * TODO: updated.
44
45         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
46         and double which avoids a conversion from an integer to a double.
47
48         * expression.cs: tiny optimization, avoid calling IsConstant,
49         because it effectively performs the lookup twice.
50
51 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
52
53         But a bogus return here to keep the semantics of the old code
54         until the Mono runtime is fixed.
55         
56         * pending.cs (GetMissingInterfaces): New method used to remove all
57         the interfaces that are already implemented by our parent
58         classes from the list of pending methods. 
59
60         * interface.cs: Add checks for calls after ResolveTypeExpr.
61
62 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
63
64         * class.cs (Class.Emit): Report warning 67: event not used if the
65         warning level is beyond 3.
66
67         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
68         being a NullLiteral.
69
70         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
71         specifiers. 
72
73         * class.cs (TypeContainer.GetClassBases): Cover a missing code
74         path that might fail if a type can not be resolved.
75
76         * expression.cs (Binary.Emit): Emit unsigned versions of the
77         operators. 
78
79         * driver.cs: use error 5.
80         
81 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
82
83         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
84
85 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
86
87         * cs-parser.jay (switch_section): A beautiful patch from Martin
88         Baulig that fixed 33094.
89
90 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
91
92         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
93         Check whether the base is abstract and report an error if so.
94
95         * expression.cs (IndexerAccess.DoResolveLValue,
96         IndexerAccess.DoResolve): ditto. 
97
98         (Invocation.DoResolve): ditto.
99         
100         (Invocation.FullMethodDesc): Improve the report string.
101
102         * statement.cs (Block): Eliminate IsVariableDefined as it is
103         basically just a wrapper for GetVariableInfo.
104
105         * ecore.cs (SimpleName): Use new 
106
107         * support.cs (ReflectionParamter.ParameterType): We unwrap the
108         type, as we return the actual parameter ref/unref state on a
109         different call.
110
111 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
112
113         * support.cs: Return proper flags REF/OUT fixing the previous
114         commit.  
115
116         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
117         not used to mean `ref' but `ref or out' in ParameterReference
118         
119         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
120         full type signature instead of calling TypeManger.CSharpName
121         ourselves. 
122
123         * support.cs (InternalParameters.ParameterDesc): Do not compare
124         directly to the modflags, because REF/OUT will actually be bitsets
125         if set. 
126
127         * delegate.cs (VerifyMethod): Check also the modifiers.
128
129         * cs-tokenizer.cs: Fix bug where floating point values with an
130         exponent where a sign was missing was ignored.
131
132         * driver.cs: Allow multiple assemblies to be specified in a single
133         /r: argument
134
135 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
136
137         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
138         because identifiers after a parenthesis would end up in this kind
139         of production, and we needed to desamiguate it for having casts
140         like:
141
142                 (UserDefinedType *) xxx
143
144 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
145
146         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
147         we should set on the Bindingflags.NonPublic, but not turn on
148         private_ok.  private_ok controls whether a Private member is
149         returned (this is chekced on the filter routine), while the
150         BindingFlags.NonPublic just controls whether private/protected
151         will be allowed.   This fixes the problem part of the problem of
152         private properties being allowed to be used in derived classes.
153
154         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
155         so we can call the children DoResolveLValue method (this will
156         properly signal errors on lvalue assignments to base properties)
157         
158         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
159         getter are null, and we have a property info, we know that this
160         happened because the lookup failed, so we report an error 122 for
161         protection level violation.
162
163         We also silently return if setter and getter are null in the
164         resolve functions, this condition only happens if we have flagged
165         the error before.  This is the other half of the problem. 
166
167         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
168         not have accessibility information, that is why we were returning
169         true in the filter function in typemanager.cs.
170
171         To properly report 122 (property is inaccessible because of its
172         protection level) correctly, we report this error in ResolveAccess
173         by failing if both the setter and the getter are lacking (ie, the
174         lookup failed). 
175
176         DoResolve and DoLResolve have been modified to check for both
177         setter/getter being null and returning silently, the reason being
178         that I did not want to put the knowledge about this error in upper
179         layers, like:
180
181         int old = Report.Errors;
182         x = new PropertyExpr (...);
183         if (old != Report.Errors)
184                 return null;
185         else
186                 return x;
187
188         So the property expr is returned, but it is invalid, so the error
189         will be flagged during the resolve process. 
190
191         * class.cs: Remove InheritablePropertySignatureCompare from the
192         class, as we no longer depend on the property signature to compute
193         whether it is possible to implement a method or not.
194
195         The reason is that calling PropertyInfo.GetGetMethod will return
196         null (in .NET, in Mono it works, and we should change this), in
197         cases where the Get Method does not exist in that particular
198         class.
199
200         So this code:
201
202         class X { public virtual int A { get { return 1; } } }
203         class Y : X { }
204         class Z : Y { public override int A { get { return 2; } } }
205
206         Would fail in Z because the parent (Y) would not have the property
207         defined.  So we avoid this completely now (because the alternative
208         fix was ugly and slow), and we now depend exclusively on the
209         method names.
210
211         (PropertyBase.CheckBase): Use a method-base mechanism to find our
212         reference method, instead of using the property.
213
214         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
215         routines are gone now.
216
217         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
218         names, they were incorrectly named.
219
220         * cs-tokenizer.cs: Return are more gentle token on failure. 
221
222         * pending.cs (PendingImplementation.InterfaceMethod): This routine
223         had an out-of-sync index variable, which caused it to remove from
224         the list of pending methods the wrong method sometimes.
225
226 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
227
228         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
229         CanWrite, because those refer to this particular instance of the
230         property, and do not take into account the fact that we can
231         override single members of a property.
232
233         Constructor requires an EmitContext.  The resolution process does
234         not happen here, but we need to compute the accessors before,
235         because the resolution does not always happen for properties.
236         
237         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
238         subclass, before we did not update this flag, but we did update
239         bindingflags. 
240
241         (GetAccessors): Drop this routine, as it did not work in the
242         presence of partially overwritten set/get methods. 
243
244         Notice that this broke the cs1540 detection, but that will require
245         more thinking. 
246         
247 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
248
249         * class.cs:
250         * codegen.cs:
251         * driver.cs: issue a warning instead of an error if we don't support
252         debugging for the platform. Also ignore a couple of errors that may
253         arise when trying to write the symbols. Undo my previous patch.
254
255 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
256
257         * driver.cs: ignore /debug switch except for Unix platforms.
258
259 2002-10-23  Nick Drochak  <ndrochak@gol.com>
260
261         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
262
263 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
264
265         * driver.cs: Do not make mcs-debug conditional, so we do not break
266         builds that use it.
267
268         * statement.cs (UsageVector.MergeChildren): I would like Martin to
269         review this patch.  But basically after all the children variables
270         have been merged, the value of "Breaks" was not being set to
271         new_breaks for Switch blocks.  I think that it should be set after
272         it has executed.  Currently I set this to the value of new_breaks,
273         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
274         conservative, but I do not understand this code very well.
275
276         I did not break anything in the build, so that is good ;-)
277
278         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
279
280 2002-10-20  Mark Crichton  <crichton@gimp.org>
281
282         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
283
284 2002-10-20  Nick Drochak  <ndrochak@gol.com>
285
286         * cfold.cs: Fixed compile blocker.
287
288 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
289
290         * driver.cs: I was chekcing the key, not the file.
291
292 2002-10-19  Ravi Pratap  <ravi@ximian.com>
293
294         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
295         message that we were generating - we just need to silently return
296         a null.
297
298 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
299
300         * class.cs (Event.Define): Change my previous commit, as this
301         breaks the debugger.  This is a temporary hack, as it seems like
302         the compiler is generating events incorrectly to begin with.
303
304         * expression.cs (Binary.ResolveOperator): Added support for 
305         "U operator - (E x, E y)"
306
307         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
308         y)".
309
310         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
311         init-only variables, but this path did not take into account that
312         there might be also instance readonly variables.  Correct this
313         problem. 
314
315         This fixes bug 32253
316
317         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
318         delegates as well.
319
320         * driver.cs: Change the extension for modules to `netmodule'
321
322         * cs-parser.jay: Improved slightly the location tracking for
323         the debugger symbols.
324
325         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
326         modifiers that were specified instead of the hardcoded value
327         (FamAndAssem).  This was basically ignoring the static modifier,
328         and others.  Fixes 32429.
329
330         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
331         fixed a bug in the process (32476)
332
333         * expression.cs (ArrayAccess.EmitAssign): Patch from
334         hwang_rob@yahoo.ca that fixes bug 31834.3
335
336 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
337
338         * driver.cs: Make the module extension .netmodule.
339
340 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
341
342         * driver.cs: Report an error if the resource file is not found
343         instead of crashing.
344
345         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
346         false, like Emit does.
347
348 2002-10-16  Nick Drochak  <ndrochak@gol.com>
349
350         * typemanager.cs: Remove unused private member.  Also reported mcs
351         bug to report this as a warning like csc.
352
353 2002-10-15  Martin Baulig  <martin@gnome.org>
354
355         * statement.cs (Statement.Emit): Made this a virtual method; emits
356         the line number info and calls DoEmit().
357         (Statement.DoEmit): New protected abstract method, formerly knows
358         as Statement.Emit().
359
360         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
361
362 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
363
364         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
365         have fixed a remaining problem: not every AddXXXX was adding a
366         fully qualified name.  
367
368         Now everyone registers a fully qualified name in the DeclSpace as
369         being defined instead of the partial name.  
370
371         Downsides: we are slower than we need to be due to the excess
372         copies and the names being registered this way.  
373
374         The reason for this is that we currently depend (on the corlib
375         bootstrap for instance) that types are fully qualified, because
376         we dump all the types in the namespace, and we should really have
377         types inserted into the proper namespace, so we can only store the
378         basenames in the defined_names array.
379
380 2002-10-10  Martin Baulig  <martin@gnome.org>
381
382         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
383         from bug #31834, see the bug report for a testcase which is
384         miscompiled.
385
386 2002-10-10  Martin Baulig  <martin@gnome.org>
387
388         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
389         flow analysis code for this.
390
391         * statement.cs (Do, While, For): Tell the flow analysis code about
392         infinite loops.
393         (FlowBranching.UsageVector): Added support for infinite loops.
394         (Block.Resolve): Moved the dead code elimination here and use flow
395         analysis to do it.
396
397 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
398
399         * class.cs (Field.Define): Catch cycles on struct type
400         definitions. 
401
402         * typemanager.cs (IsUnmanagedtype): Do not recursively check
403         fields if the fields are static.  We only need to check instance
404         fields. 
405
406         * expression.cs (As.DoResolve): Test for reference type.
407
408         * statement.cs (Using.ResolveExpression): Use
409         ConvertImplicitRequired, not ConvertImplicit which reports an
410         error on failture
411         (Using.ResolveLocalVariableDecls): ditto.
412
413         * expression.cs (Binary.ResolveOperator): Report errors in a few
414         places where we had to.
415
416         * typemanager.cs (IsUnmanagedtype): Finish implementation.
417
418 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
419
420         * expression.cs: Use StoreFromPtr instead of extracting the type
421         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
422
423         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
424         an enumeration value to a System.Enum, but System.Enum is not a
425         value type, but an class type, so we need to box.
426
427         (Expression.ConvertExplicit): One codepath could return
428         errors but not flag them.  Fix this.  Fixes #31853
429
430         * parameter.cs (Resolve): Do not allow void as a parameter type.
431
432 2002-10-06  Martin Baulig  <martin@gnome.org>
433
434         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
435         if it's a class type and not a struct.  Fixes #31815.
436
437 2002-10-06  Martin Baulig  <martin@gnome.org>
438
439         * statement.cs: Reworked the flow analysis code a bit to make it
440         usable for dead code elimination.
441
442 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
443
444         * cs-parser.jay: allow empty source files. Fixes bug #31781.
445
446 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
447
448         * expression.cs (ComposedCast.DoResolveType): A quick workaround
449         to fix the test 165, will investigate deeper.
450
451 2002-10-04  Martin Baulig  <martin@gnome.org>
452
453         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
454         finally blocks actually work.
455         (Try.Resolve): We don't need to create a sibling for `finally' if
456         there is no finally block.
457
458 2002-10-04  Martin Baulig  <martin@gnome.org>
459
460         * class.cs (Constructor.Define): The default accessibility for a
461         non-default constructor is private, not public.
462
463 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
464
465         * class.cs (Constructor): Make AllowedModifiers public, add
466         EXTERN.
467
468         * cs-parser.jay: Perform the modifiers test here, as the
469         constructor for the Constructor class usually receives a zero
470         because of the way we create it (first we create, later we
471         customize, and we were never checking the modifiers).
472
473         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
474         is a version of LookupTypeReflection that includes the type-name
475         cache.  This can be used as a fast path for functions that know
476         the fully qualified name and are only calling into *.GetType() to
477         obtain a composed type.
478
479         This is also used by TypeManager.LookupType during its type
480         composition.
481
482         (LookupType): We now also track the real type name, as sometimes
483         we can get a quey for the real type name from things like
484         ComposedCast.  This fixes bug 31422.
485         
486         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
487         complete type fullname, it does not have to go through the type
488         resolution system to obtain the composed version of the type (for
489         obtaining arrays or pointers).
490         
491         (Conditional.Emit): Use the EmitBoolExpression to
492         generate nicer code, as requested by Paolo.
493
494         (ArrayCreation.CheckIndices): Use the patch from
495         hwang_rob@yahoo.ca to validate the array initializers. 
496
497 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
498
499         * class.cs (ConstructorInitializer.Emit): simplify code by using
500         Invocation.EmitCall, and at the same time, fix the bugs in calling
501         parent constructors that took variable arguments. 
502
503         * ecore.cs (Expression.ConvertNumericExplicit,
504         Expression.ImplicitNumericConversion): Remove the code that
505         manually wrapped decimal (InternalTypeConstructor call is now gone
506         as well).
507
508         * expression.cs (Cast.TryReduce): Also handle decimal types when
509         trying to perform a constant fold on the type.
510
511         * typemanager.cs (IsUnmanagedtype): Partially implemented.
512
513         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
514         that only turned off an error report, and did nothing else. 
515
516 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
517
518         * driver.cs: Handle and ignore /fullpaths
519
520 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
521
522         * expression.cs (Binary.ResolveOperator): Catch the case where
523         DoNumericPromotions returns true, 
524
525         (Binary.DoNumericPromotions): Simplify the code, and the tests.
526
527 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
528
529         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
530         report error 70.
531
532 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
533
534         * ecore.cs (ConvertNumericExplicit): It is not enough that the
535         conversion exists, but it is also required that the conversion be
536         performed.  This manifested in "(Type64Enum) 2".  
537
538         * class.cs (TypeManager.AddMethod): The fix is not to change
539         AddEnum, because that one was using a fully qualified name (every
540         DeclSpace derivative does), but to change the AddMethod routine
541         that was using an un-namespaced name.  This now correctly reports
542         the duplicated name.
543
544         Revert patch until I can properly fix it.  The issue
545         is that we have a shared Type space across all namespaces
546         currently, which is wrong.
547
548         Options include making the Namespace a DeclSpace, and merge
549         current_namespace/current_container in the parser.
550
551 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
552
553         * cs-parser.jay: Improve error reporting when we get a different
554         kind of expression in local_variable_type and
555         local_variable_pointer_type. 
556
557         Propagate this to avoid missleading errors being reported.
558
559         * ecore.cs (ImplicitReferenceConversion): treat
560         TypeManager.value_type as a target just like object_type.   As
561         code like this:
562
563         ValueType v = 1;
564
565         Is valid, and needs to result in the int 1 being boxed before it
566         is assigned to the value type v.
567
568         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
569         to validate the enumeration name.
570
571         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
572         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
573         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
574
575         * ecore.cs (TryImplicitIntConversion): When doing an
576         implicit-enumeration-conversion, check if the type is 64-bits and
577         perform a conversion before passing to EnumConstant.
578
579 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
580
581         * decl.cs (Error_AmbiguousTypeReference); New routine used to
582         report ambiguous type references.  Unlike the MS version, we
583         report what the ambiguity is.   Innovation at work ;-)
584
585         (DeclSpace.FindType): Require a location argument to
586         display when we display an ambiguous error.
587
588         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
589
590         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
591
592         * expression.cs (EmitDynamicInitializers): Apply patch from
593         hwang_rob@yahoo.ca that fixes the order in which we emit our
594         initializers. 
595
596 2002-09-21  Martin Baulig  <martin@gnome.org>
597
598         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
599         delegate takes no arguments.
600
601 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
602
603         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
604         from integers.
605
606         * expression.cs: Extract the underlying type.
607
608         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
609
610         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
611
612 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
613
614         * class.cs (TypeContainer.DefineType): We can not use the nice
615         PackingSize with the size set to 1 DefineType method, because it
616         will not allow us to define the interfaces that the struct
617         implements.
618
619         This completes the fixing of bug 27287
620
621         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
622         means also structs.  This fixes part of the problem. 
623         (Expresion.ImplicitReferenceConversionExists): ditto.
624
625         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
626         error if there were no errors reported during the type lookup
627         process, to avoid duplicates or redundant errors.  Without this
628         you would get an ambiguous errors plus a type not found.  We have
629         beaten the user enough with the first error.  
630
631         (DeclSparce.FindType): Emit a warning if we have an ambiguous
632         reference. 
633
634         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
635         during the resolution process, stop the lookup, this avoids
636         repeated error reports (same error twice).
637
638         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
639
640         * typemanager.cs (LookupType): Redo the type lookup code to match
641         the needs of System.Reflection.  
642
643         The issue is that System.Reflection requires references to nested
644         types to begin with a "+" sign instead of a dot.  So toplevel
645         types look like: "NameSpace.TopLevelClass", and nested ones look
646         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
647         levels. 
648
649 2002-09-19  Martin Baulig  <martin@gnome.org>
650
651         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
652         says that a method always returns or always throws an exception,
653         don't report the CS0161.
654
655         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
656         set `Returns = new_returns'.
657
658 2002-09-19  Martin Baulig  <martin@gnome.org>
659
660         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
661         to an enum constant, check for a CS0176.
662
663 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
664
665         * class.cs (TypeContainer.CheckPairedOperators): Now we check
666         for operators that must be in pairs and report errors.
667
668         * ecore.cs (SimpleName.DoResolveType): During the initial type
669         resolution process, when we define types recursively, we must
670         check first for types in our current scope before we perform
671         lookups in the enclosing scopes.
672
673         * expression.cs (MakeByteBlob): Handle Decimal blobs.
674
675         (Invocation.VerifyArgumentsCompat): Call
676         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
677         I thought we were supposed to always call this, but there are a
678         few places in the code where we dont do it.
679
680 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
681
682         * driver.cs: Add support in -linkres and -resource to specify the
683         name of the identifier.
684
685 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
686
687         * ecore.cs (StandardConversionExists): Sync with the conversion
688         code: allow anything-* to void* conversions.
689
690         (FindMostSpecificSource): Use an Expression argument
691         instead of a Type, because we might be handed over a Literal which
692         gets a few more implicit conversions that plain types do not.  So
693         this information was being lost.
694
695         Also, we drop the temporary type-holder expression when not
696         required.
697
698 2002-09-17  Martin Baulig  <martin@gnome.org>
699
700         * class.cs (PropertyBase.CheckBase): Don't check the base class if
701         this is an explicit interface implementation.
702
703 2002-09-17  Martin Baulig  <martin@gnome.org>
704
705         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
706         different `IndexerName' attributes.
707
708         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
709         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
710         virtual CommonResolve().
711
712 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
713
714         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
715         and convert that to the UnderlyingType.
716
717         * statement.cs (Foreach.Resolve): Indexers are just like variables
718         or PropertyAccesses.
719
720         * cs-tokenizer.cs (consume_string): Track line numbers and columns
721         inside quoted strings, we were not doing this before.
722
723 2002-09-16  Martin Baulig  <martin@gnome.org>
724
725         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
726         resolve it.  This is needed for the definite assignment check of the
727         instance expression, fixes bug #29846.
728         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
729
730 2002-09-16  Nick Drochak  <ndrochak@gol.com>
731
732         * parameter.cs: Fix compile error.  Cannot reference static member
733         from an instance object.  Is this an mcs bug?
734
735 2002-09-14  Martin Baulig  <martin@gnome.org>
736
737         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
738         multiple times.  Fixes bug #30295, added test-166.cs.
739
740 2002-09-14  Martin Baulig  <martin@gnome.org>
741
742         * statement.cs (Block.Emit): Don't emit unreachable code.
743         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
744         `break' statements.
745         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
746
747 2002-09-14  Martin Baulig  <martin@gnome.org>
748
749         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
750         is set.
751
752 2002-09-14  Martin Baulig  <martin@gnome.org>
753
754         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
755         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
756         be false on the ms runtime.
757
758 2002-09-13  Martin Baulig  <martin@gnome.org>
759
760         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
761         the CS0038 error message.
762
763 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
764
765         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
766         constant inside, return it.
767
768 2002-09-12  Martin Baulig  <martin@gnome.org>
769
770         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
771         implicit conversion can be done between enum types.
772
773         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
774         check whether an implicit conversion to the current enum's UnderlyingType
775         exists and report an error if not.
776
777         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
778         without debugging support.
779
780         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
781         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
782
783 2002-09-12  Martin Baulig  <martin@gnome.org>
784
785         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
786
787         * ecore.cs (IMemberExpr.DeclaringType): New property.
788         (SimpleName.SimpleNameResolve): Check whether we're accessing a
789         nonstatic member of an outer type (CS0038).
790
791 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
792
793         * driver.cs: Activate the using-error detector at warning level
794         4 (at least for MS-compatible APIs).
795
796         * namespace.cs (VerifyUsing): Small buglett fix.
797
798         * pending.cs (PendingImplementation): pass the container pointer. 
799
800         * interface.cs (GetMethods): Allow for recursive definition.  Long
801         term, I would like to move every type to support recursive
802         definitions, not the current ordering mechanism that we have right
803         now.
804
805         The situation is this: Attributes are handled before interfaces,
806         so we can apply attributes to interfaces.  But some attributes
807         implement interfaces, we will now handle the simple cases
808         (recursive definitions will just get an error).  
809
810         * parameter.cs: Only invalidate types at the end if we fail to
811         lookup all types.  
812
813 2002-09-09  Martin Baulig  <martin@gnome.org>
814
815         * ecore.cs (PropertyExpr.Emit): Also check for
816         TypeManager.system_int_array_get_length so this'll also work when
817         compiling corlib.  Fixes #30003.
818
819 2002-09-09  Martin Baulig  <martin@gnome.org>
820
821         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
822         and throw an exception if we can't get the type's size.  Fixed #30040,
823         added test-165.cs.
824
825 2002-09-09  Martin Baulig  <martin@gnome.org>
826
827         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
828
829         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
830         context.  Fixes bug #30027.
831
832         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
833         virtual functions.  Fixes bug #30043, added test-164.cs.
834
835 2002-09-08  Ravi Pratap  <ravi@ximian.com>
836
837         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
838
839 2002-09-08  Nick Drochak  <ndrochak@gol.com>
840
841         * driver.cs: Use an object to get the windows codepage since it's not a
842         static property.
843
844 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
845
846         * statement.cs (For.Emit): for infinite loops (test == null)
847         return whether there is a break inside, not always "true".
848
849         * namespace.cs (UsingEntry): New struct to hold the name of the
850         using definition, the location where it is defined, and whether it
851         has been used in a successful type lookup.
852         
853         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
854         strings.
855
856         * decl.cs: ditto.
857
858 2002-09-06  Ravi Pratap  <ravi@ximian.com>
859
860         * attribute.cs : Fix incorrect code which relied on catching
861         a NullReferenceException to detect a null being passed in
862         where an object was expected.
863
864 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
865
866         * statement.cs (Try): flag the catch variable as assigned
867
868         * expression.cs (Cast): Simplified by using ResolveType instead of
869         manually resolving.
870
871         * statement.cs (Catch): Fix bug by using ResolveType.
872
873 2002-09-06  Ravi Pratap  <ravi@ximian.com>
874
875         * expression.cs (BetterConversion): Special case for when we have
876         a NullLiteral as the argument and we have to choose between string
877         and object types - we choose string the way csc does.
878
879         * attribute.cs (Attribute.Resolve): Catch the
880         NullReferenceException and report error #182 since the Mono
881         runtime no more has the bug and having this exception raised means
882         we tried to select a constructor which takes an object and is
883         passed a null.
884
885 2002-09-05  Ravi Pratap  <ravi@ximian.com>
886
887         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
888         message (1502, 1503) when we can't locate a method after overload
889         resolution. This is much more informative and closes the bug
890         Miguel reported.
891
892         * interface.cs (PopulateMethod): Return if there are no argument
893         types. Fixes a NullReferenceException bug.
894
895         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
896         expressions too. Previously we were checking only in one place for
897         positional arguments leaving out named arguments.
898
899         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
900         type to the enum type is not allowed. Remove code corresponding to
901         that.
902
903         (ConvertNumericExplicit): Allow explicit conversions from
904         the underlying type to enum type. This precisely follows the spec
905         and closes a bug filed by Gonzalo.
906         
907 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
908
909         * compiler.csproj:
910         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
911
912 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
913
914         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
915         it was important that we stored the right value after the
916         reduction in `converted'.
917
918 2002-09-04  Martin Baulig  <martin@gnome.org>
919
920         * location.cs (Location.SymbolDocument): Use full pathnames for the
921         source files.
922
923 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
924
925         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
926         of the expression resolve mechanism, because that will catch the
927         SimpleName error failures.
928
929         (Conditional): If we can not resolve the
930         expression, return, do not crash.
931
932 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
933
934         * cs-tokenizer.cs:
935         (location): display token name instead of its number.
936
937 2002-08-28  Martin Baulig  <martin@gnome.org>
938
939         * expression.cs (Binary.ResolveOperator): Don't silently return
940         but return an error if an operator cannot be applied between two
941         enum types.
942
943 2002-08-28  Martin Baulig  <martin@gnome.org>
944
945         * class.cs (Constructor.Define): Set the permission attributes
946         correctly instead of making all constructors public.
947
948 2002-08-28  Martin Baulig  <martin@gnome.org>
949
950         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
951         for private members before reporting a CS0103; if we find anything,
952         it's a CS0122.
953
954 2002-08-28  Martin Baulig  <martin@gnome.org>
955
956         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
957         to check whether `closure_start_type == closure_invocation_type',
958         we also need to check whether `m.DeclaringType == closure_invocation_type'
959         before bypassing the permission checks.  We might be accessing
960         protected/private members from the base class.
961         (TypeManager.RealMemberLookup): Only set private_ok if private
962         members were requested via BindingFlags.NonPublic.
963
964         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
965
966         * expression.cs (MemberAccess.ResolveMemberAccess): Set
967         MethodGroupExpr.IsExplicitImpl if appropriate.
968         (Invocation.DoResolve): Don't report the CS0120 for explicit
969         interface implementations.
970
971 2002-08-27  Martin Baulig  <martin@gnome.org>
972
973         * expression.cs (Invocation.DoResolve): If this is a static
974         method and we don't have an InstanceExpression, we must report
975         a CS0120.
976
977 2002-08-25  Martin Baulig  <martin@gnome.org>
978
979         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
980         `==' between a valuetype and an object.
981
982 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
983
984         * ecore.cs (TypeExpr): Provide a ToString method.
985
986 2002-08-24  Martin Baulig  <martin@gnome.org>
987
988         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
989         now called proggie.dbg and it's a binary file.
990
991 2002-08-23  Martin Baulig  <martin@gnome.org>
992
993         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
994
995 2002-08-23  Martin Baulig  <martin@gnome.org>
996
997         * struct.cs (MyStructInfo.ctor): Make this work with empty
998         structs; it's not allowed to use foreach() on null.
999
1000 2002-08-23  Martin Baulig  <martin@gnome.org>
1001
1002         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
1003         writer the full pathname of the generated assembly.
1004
1005 2002-08-23  Martin Baulig  <martin@gnome.org>
1006
1007         * statements.cs (FlowBranching.UsageVector.MergeChildren):
1008         A `finally' block never returns or breaks; improved handling of
1009         unreachable code.
1010
1011 2002-08-23  Martin Baulig  <martin@gnome.org>
1012
1013         * statement.cs (Throw.Resolve): Allow `throw null'.
1014
1015 2002-08-23  Martin Baulig  <martin@gnome.org>
1016
1017         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
1018         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
1019         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
1020         MemberLookup would return a wrong event if this is an explicit
1021         interface implementation and the class has an event with the same
1022         name.
1023
1024 2002-08-23  Martin Baulig  <martin@gnome.org>
1025
1026         * statement.cs (Block.AddChildVariableNames): New public method.
1027         (Block.AddChildVariableName): Likewise.
1028         (Block.IsVariableNameUsedInChildBlock): Likewise.
1029         (Block.AddVariable): Check whether a variable name has already
1030         been used in a child block.
1031
1032         * cs-parser.jay (declare_local_variables): Mark all variable names
1033         from the current block as being used in a child block in the
1034         implicit block.
1035
1036 2002-08-23  Martin Baulig  <martin@gnome.org>
1037
1038         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
1039         find the symbol writer.
1040
1041         * driver.cs: csc also allows the arguments to /define being
1042         separated by commas, not only by semicolons.
1043
1044 2002-08-23  Martin Baulig  <martin@gnome.org>
1045
1046         * interface.cs (Interface.GetMembers): Added static check for events.
1047
1048 2002-08-15  Martin Baulig  <martin@gnome.org>
1049
1050         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
1051         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
1052
1053         * ecore.cs (Expression.MemberLookup): Added documentation and explained
1054         why the MethodData.EmitDestructor() change was necessary.
1055
1056 2002-08-20  Martin Baulig  <martin@gnome.org>
1057
1058         * class.cs (TypeContainer.FindMembers): Added static check for events.
1059
1060         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
1061
1062         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
1063         use Type.GetEvents(), not Type.FindMembers().
1064
1065 2002-08-20  Martin Baulig  <martin@gnome.org>
1066
1067         * decl.cs (MemberCache): Added a special method cache which will
1068         be used for method-only searched.  This ensures that a method
1069         search will return a MethodInfo with the correct ReflectedType for
1070         inherited methods.      
1071
1072 2002-08-20  Martin Baulig  <martin@gnome.org>
1073
1074         * decl.cs (DeclSpace.FindMembers): Made this public.
1075
1076 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1077
1078         * delegate.cs: fixed build on windows.
1079         [FIXME:  Filed as bug #29150: MCS must report these errors.]
1080
1081 2002-08-19  Ravi Pratap  <ravi@ximian.com>
1082
1083         * ecore.cs (StandardConversionExists): Return a false
1084         if we are trying to convert the void type to anything else
1085         since that is not allowed.
1086
1087         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
1088         we flag error 70 in the event an event is trying to be accessed
1089         directly from outside the declaring type.
1090
1091 2002-08-20  Martin Baulig  <martin@gnome.org>
1092
1093         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
1094         MemberCache from typemanager.cs to decl.cs.
1095
1096 2002-08-19  Martin Baulig  <martin@gnome.org>
1097
1098         * class.cs (TypeContainer): Implement IMemberContainer.
1099         (TypeContainer.DefineMembers): Create the MemberCache.
1100         (TypeContainer.FindMembers): Do better BindingFlags checking; only
1101         return public members if BindingFlags.Public was given, check
1102         whether members are static.
1103
1104 2002-08-16  Martin Baulig  <martin@gnome.org>
1105
1106         * decl.cs (DeclSpace.Define): Splitted this in Define and
1107         DefineMembers.  DefineMembers is called first and initializes the
1108         MemberCache.
1109
1110         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
1111         DefineMembers() on all our DeclSpaces.
1112
1113         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
1114         but call DefineMembers() on all nested interfaces.  We call their
1115         Define() in our new Define() function.
1116
1117         * interface.cs (Interface): Implement IMemberContainer.
1118         (Interface.Define): Moved all code except the attribute stuf to
1119         DefineMembers().
1120         (Interface.DefineMembers): Initialize the member cache.
1121
1122         * typemanager.cs (IMemberFinder): Removed this interface, we don't
1123         need this anymore since we can use MemberCache.FindMembers directly.
1124
1125 2002-08-19  Martin Baulig  <martin@gnome.org>
1126
1127         * typemanager.cs (MemberCache): When creating the cache for an
1128         interface type, add all inherited members.
1129         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
1130         to `out bool used_cache' and documented it.
1131         (TypeManager.MemberLookup): If we already used the cache in the first
1132         iteration, we don't need to do the interfaces check.
1133
1134 2002-08-19  Martin Baulig  <martin@gnome.org>
1135
1136         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
1137         here from IMemberFinder and don't implement this interface anymore.
1138         (DeclSpace.MemberCache): Moved here from IMemberFinder.
1139
1140         * typemanager.cs (IMemberFinder): This interface is now only used by
1141         classes which actually support the member cache.
1142         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
1143         since we only put DeclSpaces into this Hashtable.
1144         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
1145         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
1146
1147 2002-08-16  Martin Baulig  <martin@gnome.org>
1148
1149         * typemanager.cs (ICachingMemberFinder): Removed.
1150         (IMemberFinder.MemberCache): New property.
1151         (TypeManager.FindMembers): Merged this with RealFindMembers().
1152         This function will never be called from TypeManager.MemberLookup()
1153         so we can't use the cache here, just the IMemberFinder.
1154         (TypeManager.MemberLookup_FindMembers): Check whether the
1155         IMemberFinder has a MemberCache and call the cache's FindMembers
1156         function.
1157         (MemberCache): Rewrote larger parts of this yet another time and
1158         cleaned it up a bit.
1159
1160 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
1161
1162         * driver.cs (LoadArgs): Support quoting.
1163
1164         (Usage): Show the CSC-like command line arguments.
1165
1166         Improved a few error messages.
1167
1168 2002-08-15  Martin Baulig  <martin@gnome.org>
1169
1170         * typemanager.cs (IMemberContainer.Type): New property.
1171         (IMemberContainer.IsInterface): New property.
1172
1173         The following changes are conditional to BROKEN_RUNTIME, which is
1174         defined at the top of the file.
1175
1176         * typemanager.cs (MemberCache.MemberCache): Don't add the base
1177         class'es members, but add all members from TypeHandle.ObjectType
1178         if we're an interface.
1179         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
1180         is the current type.
1181         (MemberCache.CacheEntry.Container): Removed this field.
1182         (TypeHandle.GetMembers): Include inherited members.
1183
1184 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1185
1186         * typemanager.cs: fixed compilation and added a comment on a field that
1187         is never used.
1188
1189 2002-08-15  Martin Baulig  <martin@gnome.org>
1190
1191         * class.cs (ConstructorInitializer.Resolve): In the
1192         Expression.MemberLookup call, use the queried_type as
1193         invocation_type.
1194
1195         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
1196         declared' attribute, it's always true.
1197         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
1198         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
1199         temporary wrapper for FindMembers which tells MemberLookup whether
1200         members from the base classes are included in the return value.
1201         This will go away soon.
1202         (TypeManager.MemberLookup): Use this temporary hack here; once the
1203         new MemberCache is completed, we don't need to do the DeclaredOnly
1204         looping here anymore since the MemberCache will take care of this.
1205         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
1206         (MemberCache): When creating the MemberCache for a class, get
1207         members from the current class and all its base classes.
1208         (MemberCache.CacheEntry.Container): New field.  This is a
1209         temporary hack until the Mono runtime is fixed to distinguish
1210         between ReflectedType and DeclaringType.  It allows us to use MCS
1211         with both the MS runtime and the unfixed Mono runtime without
1212         problems and without accecting performance.
1213         (MemberCache.SearchMembers): The DeclaredOnly looping from
1214         TypeManager.MemberLookup is now done here.      
1215
1216 2002-08-14  Martin Baulig  <martin@gnome.org>
1217
1218         * statement.cs (MyStructInfo.MyStructInfo): Don't call
1219         Type.GetFields on dynamic types but get the fields from the
1220         corresponding TypeContainer.
1221         (MyStructInfo.GetStructInfo): Added check for enum types.
1222
1223         * typemanager.cs (MemberList.IsSynchronized): Implemented.
1224         (MemberList.SyncRoot): Implemented.
1225         (TypeManager.FilterWithClosure): No need to check permissions if
1226         closure_start_type == closure_invocation_type, don't crash if
1227         closure_invocation_type is null.
1228
1229 2002-08-13  Martin Baulig  <martin@gnome.org>
1230
1231         Rewrote TypeContainer.FindMembers to use a member cache.  This
1232         gives us a speed increase of about 35% for the self-hosting MCS
1233         build and of about 15-20% for the class libs (both on GNU/Linux).
1234
1235         * report.cs (Timer): New class to get enhanced profiling.  This
1236         whole class is "TIMER" conditional since it remarkably slows down
1237         compilation speed.
1238
1239         * class.cs (MemberList): New class.  This is an IList wrapper
1240         which we're now using instead of passing MemberInfo[]'s around to
1241         avoid copying this array unnecessarily.
1242         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
1243         (ICachingMemberFinder, IMemberContainer): New interface.
1244         (TypeManager.FilterWithClosure): If `criteria' is null, the name
1245         has already been checked, otherwise use it for the name comparision.
1246         (TypeManager.FindMembers): Renamed to RealMemberFinder and
1247         provided wrapper which tries to use ICachingMemberFinder.FindMembers
1248         if possible.  Returns a MemberList, not a MemberInfo [].
1249         (TypeHandle): New class, implements IMemberContainer.  We create
1250         one instance of this class per type, it contains a MemberCache
1251         which is used to do the member lookups.
1252         (MemberCache): New class.  Each instance of this class contains
1253         all members of a type and a name-based hash table.
1254         (MemberCache.FindMembers): This is our new member lookup
1255         function.  First, it looks up all members of the requested name in
1256         the hash table.  Then, it walks this list and sorts out all
1257         applicable members and returns them.
1258
1259 2002-08-13  Martin Baulig  <martin@gnome.org>
1260
1261         In addition to a nice code cleanup, this gives us a performance
1262         increase of about 1.4% on GNU/Linux - not much, but it's already
1263         half a second for the self-hosting MCS compilation.
1264
1265         * typemanager.cs (IMemberFinder): New interface.  It is used by
1266         TypeManager.FindMembers to call FindMembers on a TypeContainer,
1267         Enum, Delegate or Interface.
1268         (TypeManager.finder_to_member_finder): New PtrHashtable.
1269         (TypeManager.finder_to_container): Removed.
1270         (TypeManager.finder_to_delegate): Removed.
1271         (TypeManager.finder_to_interface): Removed.
1272         (TypeManager.finder_to_enum): Removed.
1273
1274         * interface.cs (Interface): Implement IMemberFinder.
1275
1276         * delegate.cs (Delegate): Implement IMemberFinder.
1277
1278         * enum.cs (Enum): Implement IMemberFinder.
1279
1280         * class.cs (TypeContainer): Implement IMemberFinder.
1281
1282 2002-08-12  Martin Baulig  <martin@gnome.org>
1283
1284         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
1285
1286 2002-08-12  Martin Baulig  <martin@gnome.org>
1287
1288         * ecore.cs (ITypeExpression): New interface for expressions which
1289         resolve to a type.
1290         (TypeExpression): Renamed to TypeLookupExpression.
1291         (Expression.DoResolve): If we're doing a types-only lookup, the
1292         expression must implement the ITypeExpression interface and we
1293         call DoResolveType() on it.
1294         (SimpleName): Implement the new ITypeExpression interface.
1295         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
1296         hack, the situation that we're only looking up types can't happen
1297         anymore when this method is called.  Moved the type lookup code to
1298         DoResolveType() and call it.
1299         (SimpleName.DoResolveType): This ITypeExpression interface method
1300         is now doing the types-only lookup.
1301         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
1302         (ResolveFlags): Added MaskExprClass.
1303
1304         * expression.cs (MemberAccess): Implement the ITypeExpression
1305         interface.
1306         (MemberAccess.DoResolve): Added support for a types-only lookup
1307         when we're called via ITypeExpression.DoResolveType().
1308         (ComposedCast): Implement the ITypeExpression interface.
1309
1310         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
1311         Expression.Resolve() with ResolveFlags.Type instead.
1312
1313 2002-08-12  Martin Baulig  <martin@gnome.org>
1314
1315         * interface.cs (Interface.Define): Apply attributes.
1316
1317         * attribute.cs (Attribute.ApplyAttributes): Added support for
1318         interface attributes.
1319
1320 2002-08-11  Martin Baulig  <martin@gnome.org>
1321
1322         * statement.cs (Block.Emit): Only check the "this" variable if we
1323         do not always throw an exception.
1324
1325         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
1326         whether the property has a set accessor.
1327
1328 2002-08-11  Martin Baulig  <martin@gnome.org>
1329
1330         Added control flow analysis support for structs.
1331
1332         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
1333         with control flow analysis turned off.
1334         (IVariable): New interface.
1335         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
1336         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
1337         (FieldExpr.DoResolve): Resolve the instance expression with flow
1338         analysis turned off and do the definite assignment check after the
1339         resolving when we know what the expression will resolve to.
1340
1341         * expression.cs (LocalVariableReference, ParameterReference):
1342         Implement the new IVariable interface, only call the flow analysis
1343         code if ec.DoFlowAnalysis is true.
1344         (This): Added constructor which takes a Block argument.  Implement
1345         the new IVariable interface.
1346         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
1347         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
1348         This does the definite assignment checks for struct members.
1349
1350         * class.cs (Constructor.Emit): If this is a non-static `struct'
1351         constructor which doesn't have any initializer, call
1352         Block.AddThisVariable() to tell the flow analysis code that all
1353         struct elements must be initialized before control returns from
1354         the constructor.
1355
1356         * statement.cs (MyStructInfo): New public class.
1357         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
1358         argument to this indexer.  If non-zero, check an individual struct
1359         member, not the whole struct.
1360         (FlowBranching.CheckOutParameters): Check struct members.
1361         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
1362         overloaded versions of these methods which take an additional
1363         `int field_idx' argument to check struct members.
1364         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
1365         overloaded versions of these methods which take an additional
1366         `string field_name' argument to check struct member.s
1367         (VariableInfo): Implement the IVariable interface.
1368         (VariableInfo.StructInfo): New public property.  Returns the
1369         MyStructInfo instance of the variable if it's a struct or null.
1370         (Block.AddThisVariable): New public method.  This is called from
1371         Constructor.Emit() for non-static `struct' constructor which do
1372         not have any initializer.  It creates a special variable for the
1373         "this" instance variable which will be checked by the flow
1374         analysis code to ensure that all of the struct's fields are
1375         initialized before control returns from the constructor.
1376         (UsageVector): Added support for struct members.  If a
1377         variable/parameter is a struct with N members, we reserve a slot
1378         in the usage vector for each member.  A struct is considered fully
1379         initialized if either the struct itself (slot 0) or all its
1380         members are initialized.
1381
1382 2002-08-08  Martin Baulig  <martin@gnome.org>
1383
1384         * driver.cs (Driver.MainDriver): Only report an error CS5001
1385         if there were no compilation errors.
1386
1387         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
1388         `UnsafeContext' property to determine whether the parent is in
1389         unsafe context rather than checking the parent's ModFlags:
1390         classes nested in an unsafe class are unsafe as well.
1391
1392 2002-08-08  Martin Baulig  <martin@gnome.org>
1393
1394         * statement.cs (UsageVector.MergeChildren): Distinguish between
1395         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
1396         we return.  Added test17() and test18() to test-154.cs.
1397
1398 2002-08-08  Martin Baulig  <martin@gnome.org>
1399
1400         * typemanager.cs (TypeManager.FilterWithClosure): If we have
1401         Family access, make sure the invoking type isn't a subclass of the
1402         queried type (that'd be a CS1540).
1403
1404         * ecore.cs (Expression.MemberLookup): Added overloaded version of
1405         this method which takes an additional `Type invocation_type'.
1406
1407         * expression.cs (BaseAccess.DoResolve): Use the base type as
1408         invocation and query type.
1409         (MemberAccess.DoResolve): If the lookup failed and we're about to
1410         report a CS0122, try a lookup with the ec.ContainerType - if this
1411         succeeds, we must report a CS1540.
1412
1413 2002-08-08  Martin Baulig  <martin@gnome.org>
1414
1415         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
1416         (MethodGroupExpr): Implement the IMemberExpr interface.
1417
1418         * expression (MemberAccess.ResolveMemberAccess): No need to have
1419         any special code for MethodGroupExprs anymore, they're now
1420         IMemberExprs.   
1421
1422 2002-08-08  Martin Baulig  <martin@gnome.org>
1423
1424         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
1425         Family, FamANDAssem and FamORAssem permissions.
1426         (TypeManager.IsSubclassOrNestedChildOf): New public method.
1427
1428 2002-08-08  Martin Baulig  <martin@gnome.org>
1429
1430         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
1431         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
1432         or loop block.
1433
1434 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
1435
1436         * driver.cs: implemented /resource option to embed managed resources.
1437
1438 2002-08-07  Martin Baulig  <martin@gnome.org>
1439
1440         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
1441         (FieldBase.HasFieldInitializer): New public property.
1442         (FieldBase.GetInitializerExpression): New public method.  Resolves and
1443         returns the field initializer and makes sure it is only resolved once.
1444         (TypeContainer.EmitFieldInitializers): Call
1445         FieldBase.GetInitializerExpression to get the initializer, this ensures
1446         that it isn't resolved multiple times.
1447
1448         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
1449         the resolving process (SimpleName/MemberLookup) that we're currently
1450         emitting a field initializer (which must not access any instance members,
1451         this is an error CS0236).
1452
1453         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
1454         argument, if the `IsFieldInitializer' flag is set, we must report and
1455         error CS0236 and not an error CS0120.   
1456
1457 2002-08-07  Martin Baulig  <martin@gnome.org>
1458
1459         * ecore.cs (IMemberExpr): New public interface.
1460         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
1461         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
1462         if the expression is an IMemberExpr.
1463
1464         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
1465         to be null, implicitly default to `this' if we're non-static in
1466         this case.  Simplified the code a lot by using the new IMemberExpr
1467         interface.  Also fixed bug #28176 here.
1468
1469 2002-08-06  Martin Baulig  <martin@gnome.org>
1470
1471         * cs-parser.jay (SimpleLookup): Removed.  We need to create
1472         ParameterReferences during semantic analysis so that we can do a
1473         type-only search when resolving Cast, TypeOf and SizeOf.
1474         (block): Pass the `current_local_parameters' to the Block's
1475         constructor.
1476
1477         * class.cs (ConstructorInitializer): Added `Parameters parameters'
1478         argument to the constructor.
1479         (ConstructorInitializer.Resolve): Create a temporary implicit
1480         block with the parameters.
1481
1482         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
1483         references here if we aren't doing a type-only search.
1484
1485         * statement.cs (Block): Added constructor which takes a
1486         `Parameters parameters' argument.
1487         (Block.Parameters): New public property.
1488
1489         * support.cs (InternalParameters.Parameters): Renamed `parameters'
1490         to `Parameters' and made it public readonly.
1491
1492 2002-08-06  Martin Baulig  <martin@gnome.org>
1493
1494         * ecore.cs (Expression.Warning): Made this public as well.
1495
1496         * report.cs (Report.Debug): Print the contents of collections.
1497
1498 2002-08-06  Martin Baulig  <martin@gnome.org>
1499
1500         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
1501         used to tell Resolve() which kinds of expressions it may return.
1502         (Expression.Resolve): Added overloaded version of this method which
1503         takes a `ResolveFlags flags' argument.  This can be used to tell
1504         Resolve() which kinds of expressions it may return.  Reports a
1505         CS0118 on error.
1506         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
1507         ResolveFlags.SimpleName.
1508         (Expression.Error118): Added overloaded version of this method which
1509         takes a `ResolveFlags flags' argument.  It uses the flags to determine
1510         which kinds of expressions are allowed.
1511
1512         * expression.cs (Argument.ResolveMethodGroup): New public method.
1513         Resolves an argument, but allows a MethodGroup to be returned.
1514         This is used when invoking a delegate.
1515
1516         * TODO: Updated a bit.
1517
1518 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1519
1520         Fixed compilation with csc.
1521
1522         * ecore.cs: Expression.Error made public. Is this correct? Should
1523         Warning be made public too?
1524
1525         * expression.cs: use ea.Location instead of ea.loc.
1526         [FIXME:  Filed as bug #28607: MCS must report these errors.]
1527
1528 2002-08-06  Martin Baulig  <martin@gnome.org>
1529
1530         * ecore.cs (Expression.loc): Moved the location here instead of
1531         duplicating it in all derived classes.
1532         (Expression.Location): New public property.
1533         (Expression.Error, Expression.Warning): Made them non-static and
1534         removed the location argument.
1535         (Expression.Warning): Added overloaded version which takes an
1536         `int level' argument.
1537         (Expression.Error118): Make this non-static and removed the
1538         expression and location arguments.
1539         (TypeExpr): Added location argument to the constructor.
1540
1541         * expression.cs (StaticCallExpr): Added location argument to
1542         the constructor.
1543         (Indirection, PointerArithmetic): Likewise.
1544         (CheckedExpr, UnCheckedExpr): Likewise.
1545         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
1546         (StringPtr): Likewise.
1547
1548
1549 2002-08-05  Martin Baulig  <martin@gnome.org>
1550
1551         * expression.cs (BaseAccess.DoResolve): Actually report errors.
1552
1553         * assign.cs (Assign.DoResolve): Check whether the source
1554         expression is a value or variable.
1555
1556         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
1557         while resolving the corresponding blocks.
1558
1559         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
1560         an error, don't silently return null.
1561
1562         * statement.cs (Block.AddVariable): Do the error reporting here
1563         and distinguish between CS0128 and CS0136.
1564         (Block.DoResolve): Report all unused labels (warning CS0164).
1565         (LabeledStatement): Pass the location to the constructor.
1566         (LabeledStatement.HasBeenReferenced): New property.
1567         (LabeledStatement.Resolve): Set it to true here.
1568
1569         * statement.cs (Return.Emit): Return success even after reporting
1570         a type mismatch error (CS0126 or CS0127), this is what csc does and
1571         it avoids confusing the users with any consecutive errors.
1572
1573 2002-08-05  Martin Baulig  <martin@gnome.org>
1574
1575         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
1576
1577         * const.cs (Const.LookupConstantValue): Catch circular definitions.
1578
1579         * expression.cs (MemberAccess.DoResolve): Silently return if an
1580         error has already been reported.
1581
1582         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
1583         error has already been reported.
1584
1585 2002-08-05  Martin Baulig  <martin@gnome.org>
1586
1587         * statement.cs (UsageVector): Only initialize the `parameters'
1588         vector if we actually have any "out" parameters.
1589
1590 2002-08-05  Martin Baulig  <martin@gnome.org>
1591
1592         * expression.cs (Binary.ResolveOperator): When combining delegates,
1593         they must have the same type.
1594
1595 2002-08-05  Martin Baulig  <martin@gnome.org>
1596
1597         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
1598         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
1599         work with the ms runtime and we also don't need it: if we're a
1600         PropertyBuilder and not in the `indexer_arguments' hash, then we
1601         are a property and not an indexer.
1602
1603         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
1604         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
1605         since the latter one doesn't work with the ms runtime.
1606
1607 2002-08-03  Martin Baulig  <martin@gnome.org>
1608
1609         Fixed bugs #27998 and #22735.
1610
1611         * class.cs (Method.IsOperator): New public field.
1612         (Method.CheckBase): Report CS0111 if there's already a method
1613         with the same parameters in the current class.  Report CS0508 when
1614         attempting to change the return type of an inherited method.
1615         (MethodData.Emit): Report CS0179 if a method doesn't have a body
1616         and it's not marked abstract or extern.
1617         (PropertyBase): New abstract base class for Property and Indexer.
1618         (PropertyBase.CheckBase): Moved here from Property and made it work
1619         for indexers.
1620         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
1621         the same so we can reuse it there.
1622         (Property, Indexer): Derive from PropertyBase.
1623         (MethodSignature.inheritable_property_signature_filter): New delegate
1624         to find properties and indexers.
1625
1626         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
1627         argument and improved error reporting.
1628
1629         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
1630         EmptyReadOnlyParameters and made it a property.
1631
1632         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
1633         version of this method which takes a `PropertyInfo indexer'.
1634         (TypeManager.RegisterIndexer): New method.
1635
1636         * class.cs: Added myself as author of this file :-)
1637
1638 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1639
1640         * class.cs: fixed compilation on windoze.
1641
1642 2002-08-03  Martin Baulig  <martin@gnome.org>
1643
1644         * interface.cs (Interface.GetInterfaceBases): Check whether all
1645         base interfaces are at least as accessible than the current one.
1646
1647         * class.cs (TypeContainer.GetClassBases): Check whether base types
1648         are at least as accessible than the current type.
1649         (TypeContainer.AsAccessible): Implemented and made non-static.
1650         (MemberBase.CheckParameters): Report errors if the accessibility
1651         checks fail.
1652
1653         * delegate.cs (Delegate.Delegate): The default visibility is
1654         internal for top-level types and private for nested types.
1655         (Delegate.Define): Report errors if the accessibility checks fail.
1656
1657         * enum.cs (Enum.Enum): The default visibility is internal for
1658         top-level types and private for nested types.
1659         (Enum.DefineType): Compute the correct visibility.
1660
1661         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
1662         function which takes a `bool is_toplevel' instead of a TypeContainer.
1663
1664         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
1665         builtin type.
1666
1667 2002-08-02  Martin Baulig  <martin@gnome.org>
1668
1669         * expression.cs (LocalVariableReferenc): Added constructor which
1670         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
1671         (LocalVariableReference.IsReadOnly): New property.
1672         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
1673         variable is readonly, use our own readonly flag to do this; you can
1674         use the new constructor to get a writable reference to a read-only
1675         variable.
1676
1677         * cs-parser.jay (foreach_statement, using_statement): Get a writable
1678         reference to the local variable.
1679
1680 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
1681
1682         * rootcontext.cs (ResolveCore): Also include System.Exception
1683
1684         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
1685         we reach an EmptyStatement.
1686
1687         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
1688         is also fine.
1689
1690         * expression.cs (Binary.ResolveOperator): Check error result in
1691         two places.
1692
1693         use brtrue/brfalse directly and avoid compares to null.
1694
1695 2002-08-02  Martin Baulig  <martin@gnome.org>
1696
1697         * class.cs (TypeContainer.Define): Define all nested interfaces here.
1698         Fixes bug #28407, added test-155.cs.
1699
1700 2002-08-01  Martin Baulig  <martin@gnome.org>
1701
1702         * class.cs (Event.EmitDefaultMethod): Make this work with static
1703         events.  Fixes #28311, added verify-3.cs.
1704
1705 2002-08-01  Martin Baulig  <martin@gnome.org>
1706
1707         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
1708         `is_disposable' fields.
1709         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
1710         `hm.is_disposable' if we're using the collection pattern.
1711         (Foreach.EmitCollectionForeach): Use the correct type for the
1712         enumerator's local variable, only emit the try/finally block if
1713         necessary (fixes #27713).
1714
1715 2002-08-01  Martin Baulig  <martin@gnome.org>
1716
1717         * ecore.cs (Expression.report118): Renamed to Error118 and made
1718         it public static.
1719
1720         * statement.cs (Throw.Resolve): Check whether the expression is of
1721         the correct type (CS0118) and whether the type derives from
1722         System.Exception (CS0155).
1723         (Catch.Resolve): New method.  Do the type lookup here and check
1724         whether it derives from System.Exception (CS0155).
1725         (Catch.CatchType, Catch.IsGeneral): New public properties.
1726
1727         * typemanager.cs (TypeManager.exception_type): Added.
1728
1729 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
1730
1731         * driver.cs: Updated About function.
1732
1733 2002-07-31  Martin Baulig  <martin@gnome.org>
1734
1735         Implemented Control Flow Analysis.
1736
1737         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
1738         (EmitContext.CurrentBranching): Added.
1739         (EmitContext.StartFlowBranching): Added.
1740         (EmitContext.EndFlowBranching): Added.
1741         (EmitContext.KillFlowBranching): Added.
1742         (EmitContext.IsVariableAssigned): Added.
1743         (EmitContext.SetVariableAssigned): Added.
1744         (EmitContext.IsParameterAssigned): Added.
1745         (EmitContext.SetParameterAssigned): Added.
1746         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
1747         Added control flow analysis stuff here.
1748
1749         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
1750         resolve the expression as lvalue.
1751         (LocalVariableReference.DoResolve): Check whether the variable has
1752         already been assigned.
1753         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
1754         the parameter as assigned here.
1755         (ParameterReference.DoResolve): Check whether the parameter has already
1756         been assigned.
1757         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
1758         expression as lvalue.
1759
1760         * statement.cs (FlowBranching): New class for the flow analysis code.
1761         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
1762         (LabeledStatement.IsDefined): New public property.
1763         (LabeledStatement.AddUsageVector): New public method to tell flow
1764         analyis that the label may be reached via a forward jump.
1765         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
1766         flow analysis.
1767         (VariableInfo.Number): New public field.  This is used by flow analysis
1768         to number all locals of a block.
1769         (Block.CountVariables): New public property.  This is the number of
1770         local variables in this block (including the locals from all parent
1771         blocks).
1772         (Block.EmitMeta): Number all the variables.
1773
1774         * statement.cs: Added flow analysis support to all classes.
1775
1776 2002-07-31  Martin Baulig  <martin@gnome.org>
1777
1778         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
1779         To get debugging messages, compile mcs with /define:MCS_DEBUG and
1780         then use this argument.
1781
1782         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
1783
1784         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
1785         use this to specify /define options.
1786
1787 2002-07-29  Martin Baulig  <martin@gnome.org>
1788
1789         * statement.cs (Fixed): Moved all code that does variable lookups
1790         and resolvings from Emit to Resolve.
1791
1792         * statement.cs (For): Moved all code that does variable lookups
1793         and resolvings from Emit to Resolve.
1794
1795         * statement.cs (Using): Moved all code that does variable lookups
1796         and resolvings from Emit to Resolve.
1797
1798 2002-07-29  Martin Baulig  <martin@gnome.org>
1799
1800         * attribute.cs (Attribute.Resolve): Explicitly catch a
1801         System.NullReferenceException when creating the
1802         CustromAttributeBuilder and report a different warning message.
1803
1804 2002-07-29  Martin Baulig  <martin@gnome.org>
1805
1806         * support.cs (ParameterData.ParameterName): Added method to
1807         get the name of a parameter.
1808
1809         * typemanager.cs (TypeManager.IsValueType): New public method.
1810
1811 2002-07-29  Martin Baulig  <martin@gnome.org>
1812
1813         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
1814         is a flag which specifies that it's either ref or out.
1815         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
1816         the out parameter to `out Parameter.Modifier mod', also set the
1817         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
1818
1819         * support.cs (InternalParameters.ParameterModifier): Distinguish
1820         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
1821         Parameter.Modifier.ISBYREF flag if it's either ref or out.
1822
1823         * expression.cs (Argument.GetParameterModifier): Distinguish
1824         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
1825         Parameter.Modifier.ISBYREF flag if it's either ref or out.
1826
1827 2002-07-29  Martin Baulig  <martin@gnome.org>
1828
1829         * expression.cs (ParameterReference.ParameterReference): Added
1830         `Location loc' argument to the constructor.
1831
1832         * cs-parser.jay: Pass location to ParameterReference.
1833
1834 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
1835
1836         * statement.cs (Try): Initialize the location.
1837
1838         * cs-parser.jay: pass location to Try.
1839
1840         * expression.cs (Unary.Reduce): Change the prototype to return
1841         whether a constant fold could be performed or not.  The result is
1842         returned in an out parameters.  In the case of Indirection and
1843         AddressOf, we want to perform the full tests.
1844
1845 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
1846
1847         * statement.cs (Statement.Emit): Flag dead code.
1848
1849 2002-07-27  Andrew Birkett  <andy@nobugs.org>
1850
1851         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
1852
1853 2002-07-27  Martin Baulig  <martin@gnome.org>
1854
1855         * class.cs (MethodData.Define): Put back call to
1856         TypeManager.AddMethod(), accidentally commented this out.
1857
1858         * report.cs (Debug): New public method to print debugging information,
1859         this is `[Conditional ("DEBUG")]'.
1860
1861 2002-07-26  Martin Baulig  <martin@gnome.org>
1862
1863         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
1864         (switch_statement): Push the current_block to the switch_stack and
1865         pop it again when we're done with the switch.
1866         (switch_section): The new block is a child of the current_block.
1867         Fixes bug #24007, added test-152.cs.
1868
1869 2002-07-27  Martin Baulig  <martin@gnome.org>
1870
1871         * expression.cs (Invocation.EmitArguments): When calling a varargs
1872         function with only its fixed arguments, we need to pass an empty
1873         array.
1874
1875 2002-07-27  Martin Baulig  <martin@gnome.org>
1876
1877         Mono 0.13 has been released.
1878
1879 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
1880
1881         * driver.cs: Rename --resource to --linkres, because that is what
1882         we do currently, we dont support --resource yet.
1883
1884         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
1885
1886 2002-07-25  Martin Baulig  <martin@gnome.org>
1887
1888         * class.cs (MethodData): New public class.  This is a `method builder'
1889         class for a method or one accessor of a Property/Indexer/Event.
1890         (MethodData.GetMethodFlags): Moved here from MemberBase.
1891         (MethodData.ApplyAttributes): Likewise.
1892         (MethodData.ApplyObsoleteAttribute): Likewise.
1893         (MethodData.ApplyConditionalAttribute): Likewise.
1894         (MethodData.ApplyDllImportAttribute): Likewise.
1895         (MethodData.CheckAbstractAndExternal): Likewise.
1896         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
1897         (MethodData.Emit): Formerly known as Method.Emit().
1898         (MemberBase): Moved everything which was specific to a single
1899         accessor/method to MethodData.
1900         (Method): Create a new MethodData and call Define() and Emit() on it.
1901         (Property, Indexer, Event): Create a new MethodData objects for each
1902         accessor and call Define() and Emit() on them.
1903
1904 2002-07-25  Martin Baulig  <martin@gnome.org>
1905
1906         Made MethodCore derive from MemberBase to reuse the code from there.
1907         MemberBase now also checks for attributes.
1908
1909         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
1910         (MemberBase.GetMethodFlags): Moved here from class Method and marked
1911         as virtual.
1912         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
1913         `CallingConventions cc' and `Attributes opt_attrs' arguments.
1914         (MemberBase.ApplyAttributes): New virtual method; applies the
1915         attributes to a method or accessor.
1916         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
1917         (MemberBase.ApplyConditionalAttribute): Likewise.
1918         (MemberBase.ApplyDllImportAttribute): Likewise.
1919         (MemberBase.CheckAbstractAndExternal): Likewise.
1920         (MethodCore.ParameterTypes): This is now a property instead of a
1921         method, it's initialized from DoDefineParameters().
1922         (MethodCore.ParameterInfo): Removed the set accessor.
1923         (MethodCore.DoDefineParameters): New protected virtual method to
1924         initialize ParameterTypes and ParameterInfo.
1925         (Method.GetReturnType): We can now simply return the MemberType.
1926         (Method.GetMethodFlags): Override the MemberBase version and add
1927         the conditional flags.
1928         (Method.CheckBase): Moved some code from Define() here, call
1929         DoDefineParameters() here.
1930         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
1931         here to avoid some larger code duplication.
1932         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
1933         ensure that abstract and external accessors don't declare a body.
1934
1935         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
1936         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
1937         lookup in the attribute's parent classes, so we need to abort as soon
1938         as we found the first match.
1939         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
1940         the attribute has no arguments.
1941
1942         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
1943         of a Method.
1944
1945 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1946
1947         * cs-parser.jay: reverted previous patch.
1948
1949 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1950
1951         * cs-parser.jay: fixed bug #22119.
1952
1953 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1954
1955         * attribute.cs: fixed compilation. The error was:
1956         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
1957         be assigned to before control leaves the current method."
1958         [FIXME:  Filed as bug #28186: MCS must report this error.]
1959
1960 2002-07-25  Martin Baulig  <martin@gnome.org>
1961
1962         * attribute.cs (Attribute.Conditional_GetConditionName): New static
1963         method to pull the condition name ouf of a Conditional attribute.
1964         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
1965         the obsolete message and error flag out of an Obsolete attribute.
1966
1967         * class.cs (Method.GetMethodFlags): New public method to get the
1968         TypeManager.MethodFlags for this method.
1969         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
1970         private methods.
1971         (Method.Define): Get and apply the Obsolete and Conditional attributes;
1972         if we're overriding a virtual function, set the new private variable
1973         `parent_method'; call the new TypeManager.AddMethod().
1974
1975         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
1976         the MethodBuilder and the Method in a PtrHashtable.
1977         (TypeManager.builder_to_method): Added for this purpose.
1978         (TypeManager.MethodFlags): Added IsObsoleteError.
1979         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
1980         Obsolete and Conditional arguments in MethodBuilders.  If we discover
1981         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
1982         the message from the attribute.
1983
1984 2002-07-24  Martin Baulig  <martin@gnome.org>
1985
1986         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
1987         preprocessor directives, ensure that the argument to #define/#undef is
1988         exactly one identifier and that it's actually an identifier.
1989
1990         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
1991         did not work ....
1992
1993 2002-07-24  Martin Baulig  <martin@gnome.org>
1994
1995         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
1996         initialize it to TypeManager.object_type in the constructor.
1997         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
1998         of the `hm.get_current' method if we're using the collection pattern.
1999         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
2000         for the explicit conversion to make it work when we're using the collection
2001         pattern and the `Current' property has a different return type than `object'.
2002         Fixes #27713.
2003
2004 2002-07-24  Martin Baulig  <martin@gnome.org>
2005
2006         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
2007         does not match, but don't report any errors.  This method is called in
2008         order for all methods in a MethodGroupExpr until a matching method is
2009         found, so we don't want to bail out if the first method doesn't match.
2010         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
2011         matches, report the 123.  Fixes #28070.
2012
2013 2002-07-24  Martin Baulig  <martin@gnome.org>
2014
2015         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
2016         TypeManager.TypeToCoreType() to the top of the method so the
2017         following equality checks will work.  Fixes #28107.
2018
2019 2002-07-24  Martin Baulig  <martin@gnome.org>
2020
2021         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
2022         operand is of type uint, and the other operand is of type sbyte,
2023         short or int, the operands are converted to type long." -
2024         Actually do what this comment already told us.  Fixes bug #28106,
2025         added test-150.cs.
2026
2027 2002-07-24  Martin Baulig  <martin@gnome.org>
2028
2029         * class.cs (MethodBase): New abstract class.  This is now a base
2030         class for Property, Indexer and Event to avoid some code duplication
2031         in their Define() and DefineMethods() methods.
2032         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
2033         generic methods for Define() and DefineMethods().
2034         (FieldBase): Derive from MemberBase, not MemberCore.
2035         (Property): Derive from MemberBase, not MemberCore.
2036         (Property.DefineMethod): Moved all the code from this method to the
2037         new MethodBase.DefineAccessor(), just call it with appropriate
2038         argumetnts.
2039         (Property.Define): Call the new Property.DoDefine(), this does some
2040         sanity checks and we don't need to duplicate the code everywhere.
2041         (Event): Derive from MemberBase, not MemberCore.
2042         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
2043         accessors, this will also make them work with interface events.
2044         (Indexer): Derive from MemberBase, not MemberCore.
2045         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
2046         (Indexer.Define): Use the new MethodBase functions.
2047
2048         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
2049         argument to the constructor.
2050         (Interface.FindMembers): Added support for interface events.
2051         (Interface.PopluateEvent): Implemented.
2052
2053         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
2054
2055 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
2056
2057         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
2058         but this is required to check for a method name being the same as
2059         the containing class.  
2060
2061         Handle this now.
2062
2063 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2064
2065         * interface.cs: initialize variable.
2066
2067 2002-07-23  Martin Baulig  <martin@gnome.org>
2068
2069         Implemented the IndexerName attribute in interfaces.
2070
2071         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
2072         name if this is an explicit interface implementation.
2073         (Indexer.InterfaceIndexerName): New public variable.  If we're
2074         implementing an interface indexer, this is the IndexerName in that
2075         interface.  Otherwise, it's the IndexerName.
2076         (Indexer.DefineMethod): If we're implementing interface indexer,
2077         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
2078         and Pending.ImplementIndexer methods.
2079         (Indexer.Define): Also define the PropertyBuilder if we're
2080         implementing an interface indexer and this is neither an explicit
2081         interface implementation nor do the IndexerName match the one in
2082         the interface.
2083
2084         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
2085         If a method is defined here, then we always need to create a proxy
2086         for it.  This is used when implementing interface indexers.
2087         (Pending.IsInterfaceIndexer): New public method.
2088         (Pending.ImplementIndexer): New public method.
2089         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
2090         This is used when implementing interface indexers to define a proxy
2091         if necessary.
2092         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
2093         define a proxy if necessary.
2094
2095         * interface.cs (Interface.IndexerName): New public variable.
2096         (Interface.PopulateIndexer): Set the IndexerName.
2097         (Interface.DefineIndexers): New private method.  Populate all the
2098         indexers and make sure their IndexerNames match.
2099
2100         * typemanager.cs (IndexerPropertyName): Added support for interface
2101         indexers.
2102
2103 2002-07-22  Martin Baulig  <martin@gnome.org>
2104
2105         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
2106         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
2107         ret if HasReturnLabel.
2108         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
2109         variables.
2110
2111         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
2112         and set the ec.LoopBeginTryCatchLevel.
2113         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
2114         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
2115         the current ec.TryCatchLevel, the branch goes out of an exception
2116         block.  In this case, we need to use Leave and not Br.
2117
2118 2002-07-22  Martin Baulig  <martin@gnome.org>
2119
2120         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
2121         block unless the block does not always return or it is contained in
2122         another try { ... } catch { ... } block.  Fixes bug #26506.
2123         Added verify-1.cs to the test suite.
2124
2125 2002-07-22  Martin Baulig  <martin@gnome.org>
2126
2127         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
2128         then we do not always return.  Fixes bug #24985.
2129
2130 2002-07-22  Martin Baulig  <martin@gnome.org>
2131
2132         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
2133         lookup on a per-class level; ie. walk up the class hierarchy until we
2134         found at least one applicable method, then choose the best among them.
2135         Fixes bug #24463 and test-29.cs.
2136
2137 2002-07-22  Martin Baulig  <martin@gnome.org>
2138
2139         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
2140         return types of the methods.  The return type is not part of the
2141         signature and we must not check it to make the `new' modifier work.
2142         Fixes bug #27999, also added test-147.cs.
2143         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
2144
2145         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
2146         on the method's return type.
2147
2148 2002-07-21  Martin Baulig  <martin@gnome.org>
2149
2150         * assign.cs: Make this work if the rightmost source is a constant and
2151         we need to do an implicit type conversion.  Also adding a few more tests
2152         to test-38.cs which should have caught this.
2153
2154         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
2155         target in the makefile for this.  The makefile.gnu is primarily intended
2156         for end-users who don't want to debug the compiler.
2157
2158 2002-07-21  Martin Baulig  <martin@gnome.org>
2159
2160         * assign.cs: Improved the Assign class so it can now handle embedded
2161         assignments (X = Y = Z = something).  As a side-effect this'll now also
2162         consume less local variables.  test-38.cs now passes with MCS, added
2163         a few new test cases to that test.
2164
2165 2002-07-20  Martin Baulig  <martin@gnome.org>
2166
2167         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
2168         instructions.  Fixes bug #27977, also added test-146.cs.
2169
2170 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2171
2172         * cs-tokenizer.cs: fixed getHex ().
2173
2174 2002-07-19  Martin Baulig  <martin@gnome.org>
2175
2176         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
2177         not Type.GetType() to lookup the array type.  This is needed when
2178         we're constructing an array of a user-defined type.
2179         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
2180         single-dimensional arrays, but also for single-dimensial arrays of
2181         type decimal.
2182
2183 2002-07-19  Martin Baulig  <martin@gnome.org>
2184
2185         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
2186         this function is called, it's not allowed to share LocalBuilders
2187         among ILGenerators.
2188
2189 2002-07-19  Martin Baulig  <martin@gnome.org>
2190
2191         * expression.cs (Argument.Resolve): Report an error 118 when trying
2192         to pass a type as argument.
2193
2194 2002-07-18  Martin Baulig  <martin@gnome.org>
2195
2196         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
2197         Conv_R_Un for the signed `long' type.
2198
2199 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
2200
2201         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
2202         `expr' for the temporary result, as that will fail if we do
2203         multiple resolves on the same expression.
2204
2205 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
2206
2207         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
2208         ec.TypeContainer for looking up aliases. 
2209
2210         * class.cs (TypeContainer): Remove LookupAlias from here.
2211
2212         * decl.cs (DeclSpace); Move here.
2213
2214 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
2215
2216         * class.cs (FindMembers): Only call filter if the constructor
2217         bulider is not null.
2218
2219         Also handle delegates in `NestedTypes' now.  Now we will perform
2220         type lookups using the standard resolution process.  This also
2221         fixes a bug.
2222
2223         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
2224         This uses Expressions (the limited kind that can be parsed by the
2225         tree) instead of strings.
2226
2227         * expression.cs (ComposedCast.ToString): Implement, used to flag
2228         errors since now we have to render expressions.
2229
2230         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
2231         FormArrayType. 
2232
2233         * ecore.cs (SimpleName.ToString): ditto.
2234
2235         * cs-parser.jay: Instead of using strings to assemble types, use
2236         Expressions to assemble the type (using SimpleName, ComposedCast,
2237         MemberAccess).  This should fix the type lookups in declarations,
2238         because we were using a different code path for this.
2239
2240         * statement.cs (Block.Resolve): Continue processing statements
2241         even when there is an error.
2242
2243 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
2244
2245         * class.cs (Event.Define): Also remove the `remove' method from
2246         the list of pending items.
2247
2248         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
2249         generate more compact code. 
2250
2251 2002-07-17  Martin Baulig  <martin@gnome.org>
2252
2253         * const.cs (Const.LookupConstantValue): Add support for constant
2254         `unchecked' and `checked' expressions.
2255         Also adding test case test-140.cs for this.
2256
2257 2002-07-17  Martin Baulig  <martin@gnome.org>
2258
2259         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
2260         check whether mi.ReturnType implements the IEnumerator interface; the
2261         `==' and the IsAssignableFrom() will fail in this situation.
2262
2263 2002-07-16  Ravi Pratap  <ravi@ximian.com>
2264
2265         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
2266         here too.
2267
2268 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2269
2270         * expression.cs: fixed bug #27811.
2271
2272 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
2273
2274         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
2275         Molaro: when we are a ref, the value already contains a pointer
2276         value, do not take the address of it.
2277
2278 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
2279         * removed mb-parser.jay and mb-tokenizer.cs
2280
2281 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
2282
2283         * expression.cs: check against the building corlib void type.
2284
2285 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
2286
2287         * ecore.cs: fix for valuetype static readonly fields: when 
2288         initializing them, we need their address, not the address of a copy.
2289
2290 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
2291
2292         * typemanager.cs: register also enum_type in corlib.
2293
2294 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
2295
2296         * class.cs: allow calling this (but not base) initializers in structs.
2297
2298 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
2299
2300         * ecore.cs: make sure we compare against the building base types
2301         in GetTypeSize ().
2302
2303 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
2304
2305         * typemanager.cs: fix TypeToCoreType() to handle void and object
2306         (corlib gets no more typerefs after this change).
2307
2308 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
2309
2310         * expression.cs (ArrayCreation.EmitArrayArguments): use
2311         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
2312
2313         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
2314         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
2315         array indexes, the runtime actually forbids them.
2316
2317         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
2318         for array arguments here.
2319
2320         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
2321         instead of the default for ValueTypes.
2322
2323         (New.DoEmit): Use IsValueType instead of
2324         IsSubclassOf (value_type)
2325         (New.DoResolve): ditto.
2326         (Invocation.EmitCall): ditto.
2327
2328         * assign.cs (Assign): ditto.
2329
2330         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
2331         Statements *are* currently doing part of their resolution during
2332         Emit.  
2333
2334         Expressions do always resolve during resolve, but statements are
2335         only required to propagate resolution to their children.
2336
2337 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
2338
2339         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
2340
2341         (LoadAssembly): Do not add the dll if it is already specified
2342         
2343         (MainDriver): Add the System directory to the link path at the end,
2344         after all the other -L arguments. 
2345
2346         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
2347         wrong opcode for loading bytes and bools (ldelem.i1 instead of
2348         ldelem.u1) and using the opposite for sbytes.
2349
2350         This fixes Digger, and we can finally run it.
2351
2352         * driver.cs (UnixParseOption): Move the option parsing here.  
2353         (CSCParseOption): Implement CSC-like parsing of options.
2354
2355         We now support both modes of operation, the old Unix way, and the
2356         new CSC-like way.  This should help those who wanted to make cross
2357         platform makefiles.
2358
2359         The only thing broken is that /r:, /reference: and /lib: are not
2360         implemented, because I want to make those have the same semantics
2361         as the CSC compiler has, and kill once and for all the confussion
2362         around this.   Will be doing this tomorrow.
2363
2364         * statement.cs (Unsafe.Resolve): The state is checked during
2365         resolve, not emit, so we have to set the flags for IsUnsfe here.
2366
2367 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
2368
2369         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
2370         not catch the Error_ObjectRefRequired in SimpleName (as it is
2371         possible to have a class/instance variable name that later gets
2372         deambiguated), we have to check this here.      
2373
2374 2002-07-10  Ravi Pratap  <ravi@ximian.com>
2375
2376         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
2377         make static and put into Expression.
2378
2379         (Event.Define): Register the private field of the event with the 
2380         TypeManager so that GetFieldFromEvent can get at it.
2381
2382         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
2383         keep track of the private field associated with an event which
2384         has no accessors.
2385
2386         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
2387         private field.
2388
2389         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
2390         
2391 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
2392
2393         * expression.cs (Binary.EmitBranchable): this routine emits the
2394         Binary expression in a branchable context.  This basically means:
2395         we need to branch somewhere, not just get the value on the stack.
2396
2397         This works together with Statement.EmitBoolExpression.
2398
2399         * statement.cs (Statement.EmitBoolExpression): Use
2400         EmitBranchable. 
2401
2402 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
2403
2404         * statement.cs (For): Reduce the number of jumps in loops.
2405
2406         (For): Implement loop inversion for the For statement.
2407
2408         (Break): We can be breaking out of a Try/Catch controlled section
2409         (foreach might have an implicit try/catch clause), so we need to
2410         use Leave instead of Br.
2411
2412         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
2413         now).  If the instace expression supports IMemoryLocation, we use
2414         the AddressOf method from the IMemoryLocation to extract the
2415         address instead of emitting the instance.
2416
2417         This showed up with `This', as we were emitting the instance
2418         always (Emit) instead of the Address of This.  Particularly
2419         interesting when This is a value type, as we dont want the Emit
2420         effect (which was to load the object).
2421         
2422 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
2423
2424         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
2425
2426         * statement.cs (Checked): Set the CheckedState during the resolve
2427         process too, as the ConvCast operations track the checked state on
2428         the resolve process, and not emit.
2429
2430         * cs-parser.jay (namespace_member_declaration): Flag that we have
2431         found a declaration when we do.  This is used to flag error 1529
2432
2433         * driver.cs: Report ok when we display the help only.
2434
2435 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
2436
2437         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
2438
2439 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
2440
2441         * cs-tokenizer.cs (define): We also have to track locally the
2442         defines.  AllDefines is just used for the Conditional Attribute,
2443         but we also need the local defines for the current source code. 
2444
2445 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
2446
2447         * statement.cs (While, For, Do): These loops can exit through a
2448         Break statement, use this information to tell whether the
2449         statement is the last piece of code.
2450
2451         (Break): Flag that we break.
2452
2453         * codegen.cs (EmitContexts): New `Breaks' state variable.
2454
2455 2002-07-03  Martin Baulig  <martin@gnome.org>
2456
2457         * class.cs (TypeContainer.MethodModifiersValid): Allow override
2458         modifiers in method declarations in structs.  Otherwise, you won't
2459         be able to override things like Object.Equals().
2460
2461 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
2462
2463         * class.cs (Method, Property, Indexer): Do not allow the public
2464         modifier to be used in explicit interface implementations.
2465
2466         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
2467         override modifiers in method declarations in structs
2468
2469 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
2470
2471         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
2472         integer or real overflow, report an error
2473
2474 2002-07-02  Martin Baulig  <martin@gnome.org>
2475
2476         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
2477         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
2478         to tell the runtime about our newly created System.Object and
2479         System.ValueType types.
2480
2481 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
2482
2483         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
2484         struct instead of Ldarg/Starg.
2485
2486 2002-07-02  Martin Baulig  <martin@gnome.org>
2487
2488         * expression.cs (Indirection.Indirection): Call
2489         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
2490
2491 2002-07-02  Martin Baulig  <martin@gnome.org>
2492
2493         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
2494         ValueType, call TypeManager.TypeToCoreType() on it.
2495         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
2496         the OpCodes.Newarr argument.
2497
2498 2002-07-02  Martin Baulig  <martin@gnome.org>
2499
2500         * expression.cs (Invocation.EmitCall): When compiling corlib,
2501         replace all calls to the system's System.Array type to calls to
2502         the newly created one.
2503
2504         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
2505         System.Array methods.
2506         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
2507         from the system's System.Array type which must be replaced.
2508
2509 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
2510
2511         * typemanager.cs: load unverifiable_code_ctor so we can build
2512         corlib using the correct type. Avoid using GetTypeCode() with
2513         TypeBuilders.
2514         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
2515         TypeManager.object_type to allow building corlib.
2516
2517 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
2518
2519         * ecore.cs: handle System.Enum separately in LoadFromPtr().
2520
2521 2002-07-01  Martin Baulig  <martin@gnome.org>
2522
2523         * class.cs: Make the last change actually work, we need to check
2524         whether `ifaces != null' to avoid a crash.
2525
2526 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
2527
2528         * class.cs: when we build structs without fields that implement
2529         interfaces, we need to add the interfaces separately, since there is
2530         no API to both set the size and add the interfaces at type creation
2531         time.
2532
2533 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
2534
2535         * expression.cs: the dimension arguments to the array constructors
2536         need to be converted if they are a long.
2537
2538 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
2539
2540         * class.cs: don't emit ldarg.0 if there is no parent constructor
2541         (fixes showstopper for corlib).
2542
2543 2002-06-29  Martin Baulig  <martin@gnome.org>
2544
2545         MCS now compiles corlib on GNU/Linux :-)
2546
2547         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
2548         ie. check for MethodImplOptions.InternalCall.
2549
2550         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
2551         and TypeManager.attribute_type are null, so we must explicitly check
2552         whether parent is not null to find out whether it's an attribute type.
2553         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
2554         and SetBuilder, not only if the property is neither abstract nor external.
2555         This is necessary to set the MethodImplOptions on the accessor methods.
2556         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
2557         SetBuilder, see Property.Emit().
2558
2559         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
2560         populate "System.Object", "System.ValueType" and "System.Attribute" since
2561         they've already been populated from BootCorlib_PopulateCoreTypes().
2562
2563 2002-06-29  Martin Baulig  <martin@gnome.org>
2564
2565         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
2566         is the NullLiteral, we also need to make sure that target_type is not
2567         an enum type.   
2568
2569 2002-06-29  Martin Baulig  <martin@gnome.org>
2570
2571         * rootcontext.cs (RootContext.ResolveCore): We must initialize
2572         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
2573         before calling BootstrapCorlib_ResolveDelegate ().
2574
2575 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2576
2577         * statement.cs: fixed build-breaker. All tests passed ok.
2578
2579 2002-06-27  Martin Baulig  <martin@gnome.org>
2580
2581         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
2582         for System.Decimal when compiling corlib.
2583
2584 2002-06-27  Martin Baulig  <martin@gnome.org>
2585
2586         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
2587         switch blocks which contain nothing but a default clause.
2588
2589 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
2590
2591        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
2592
2593 2002-06-27  Martin Baulig  <martin@gnome.org>
2594
2595         * ecore.cs (PropertyExpr.PropertyExpr): Call
2596         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
2597
2598         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
2599         is already a TypeBuilder.
2600
2601 2002-06-27  Martin Baulig  <martin@gnome.org>
2602
2603         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
2604         `target_type == TypeManager.array_type', not IsAssignableFrom() in
2605         the "from an array-type to System.Array" case.  This makes it work
2606         when compiling corlib.
2607
2608 2002-06-27  Martin Baulig  <martin@gnome.org>
2609
2610         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
2611         non-static PropertyExpr, set its InstanceExpression.  This makes
2612         the `ICollection.Count' property work in System/Array.cs.
2613
2614 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
2615
2616         * driver.cs: Made error handling more consistent.  Errors now
2617         tracked by Report class, so many methods which used to return int
2618         now return void.  Main() now prints success/failure and 
2619         errors/warnings message.
2620
2621         Renamed '--probe' compiler argument to '--expect-error'.  Removed
2622         the magic number return values (123 and 124).  Now, if the
2623         expected error occurs, the compiler exits with success (exit value
2624         0).  If the compilation completes without seeing that particular
2625         error, the compiler exits with failure (exit value 1).  The
2626         makefile in mcs/errors has been changed to handle the new behaviour.
2627
2628         * report.cs: Made 'expected error' number a property and renamed
2629         it from 'Probe' to 'ExpectedError'.
2630
2631         * genericparser.cs: Removed error handling support, since it is
2632         now all done by Report class.
2633
2634         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
2635         class, so parse() no longer returns an int.
2636
2637         * namespace.cs: Use Report.Error instead of GenericParser.error
2638
2639 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
2640
2641         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
2642         TypeContainer.AddOperator): At the front of the list put the
2643         explicit implementations, so they get resolved/defined first. 
2644
2645 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
2646
2647         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
2648         interface type is implemented by this TypeContainer.  Used during
2649         explicit interface implementation.
2650
2651         (Property.Define, Indexer.Define, Method.Define): Validate that
2652         the given interface in the explicit implementation is one of the
2653         base classes for the containing type.
2654
2655         Also if we are explicitly implementing an interface, but there is
2656         no match in the pending implementation table, report an error.
2657
2658         (Property.Define): Only define the property if we are
2659         not explicitly implementing a property from an interface.  Use the
2660         correct name also for those properties (the same CSC uses,
2661         although that is really not needed).
2662         
2663         (Property.Emit): Do not emit attributes for explicitly implemented
2664         properties, as there is no TypeBuilder.
2665
2666         (Indexer.Emit): ditto.
2667
2668         Hiding then means that we do not really *implement* a pending
2669         implementation, which makes code fail.
2670
2671 2002-06-22  Martin Baulig  <martin@gnome.org>
2672
2673         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
2674         the return value of Object.GetType().  [FIXME: we need to do this whenever
2675         we get a type back from the reflection library].
2676
2677 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
2678
2679         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
2680
2681 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
2682
2683         * attribute.cs: Return null if we can not look up the type.
2684
2685         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
2686         the interface types found.
2687
2688         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
2689         interface types found.
2690
2691         * typemanager.cs (GetInterfaces): Make this routine returns alll
2692         the interfaces and work around the lame differences between
2693         System.Type and System.Reflection.Emit.TypeBuilder in the results
2694         result for GetInterfaces.
2695         
2696         (ExpandInterfaces): Given an array of interface types, expand and
2697         eliminate repeated ocurrences of an interface.  This expands in
2698         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
2699         be IA, IB, IC.
2700         
2701 2002-06-21  Martin Baulig  <martin@gnome.org>
2702
2703         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
2704         on System.Enum.
2705
2706 2002-06-21  Martin Baulig  <martin@gnome.org>
2707
2708         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
2709         and called with one of the core types, return the corresponding typebuilder for
2710         that type.
2711
2712         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
2713         element type.
2714
2715 2002-06-21  Martin Baulig  <martin@gnome.org>
2716
2717         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
2718         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
2719         (Expression.ConvertReferenceExplicit): Likewise.
2720
2721         * expression.cs (ElementAccess.DoResolve): Likewise.
2722         (ElementAccess.DoResolveLValue): Likewise.
2723
2724 2002-06-10  Martin Baulig  <martin@gnome.org>
2725
2726         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
2727         add the "value" parameter to the parameter list.
2728
2729         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
2730         to our caller.
2731
2732 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
2733
2734         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
2735         the argument to an int, uint, long or ulong, per the spec.  Also
2736         catch negative constants in array creation.
2737
2738 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
2739
2740         * class.cs: do not allow the same interface to appear twice in
2741         the definition list.
2742
2743 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
2744
2745         * ecore.cs: don't use ldlen with System.Array.
2746
2747 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
2748
2749         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
2750
2751 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
2752
2753         * modifiers.cs: produce correct field attributes for protected
2754         internal. Easy fix so miguel can work on ther harder stuff:-)
2755
2756 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
2757
2758         * pending.cs: New file.  Move the code from class.cs here.
2759         Support clearning the pending flag for all methods (when not doing
2760         explicit interface implementation).
2761
2762 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
2763
2764         * rootcontext.cs: added a couple more types needed to bootstrap.
2765
2766 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
2767
2768         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
2769         constructor in the type, instead of any constructor in the type
2770         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
2771         a bug in the Mono runtime when applying the params attribute). 
2772
2773 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
2774         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
2775
2776 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
2777
2778         * expression.cs (Unary.ResolveOperator): Use TypeManager
2779         to resolve the type.
2780         
2781 2002-06-13  Ravi Pratap  <ravi@ximian.com>
2782
2783         * cs-parser.jay (enum_member_declaration): Pass in the attributes
2784         attached.
2785
2786         * enum.cs (AddEnumMember): Add support to store the attributes associated 
2787         with each member too.
2788
2789         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
2790         field builders too - this takes care of the enum member case.
2791
2792 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
2793
2794         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
2795         address-of operator on both value types and pointers.
2796         
2797 2002-06-10  Martin Baulig  <martin@gnome.org>
2798
2799         * interface.cs (Interface.PopulateIndexer): Add the indexer's
2800         PropertyBuilder to the `property_builders' list.
2801
2802         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
2803         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
2804         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
2805         find any indexers which are inherited from an interface.
2806
2807 2002-06-09  Martin Baulig  <martin@gnome.org>
2808
2809         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
2810         the same type as the constant if necessary.  There's also a test-130.cs
2811         for this.
2812
2813         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
2814
2815         * typemanager.cs (TypeManager.ChangeType): Previously known as
2816         Enum.ChangeEnumType().
2817
2818 2002-06-09  Martin Baulig  <martin@gnome.org>
2819
2820         * expression.cs (Cast.TryReduce): Added support for consts.
2821
2822 2002-06-08  Ravi Pratap  <ravi@ximian.com>
2823
2824         * class.cs (Accessor): Hold attributes information so we can pass
2825         it along.
2826
2827         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
2828         Modify to pass in attributes attached to the methods.
2829
2830         (add_accessor_declaration, remove_accessor_declaration): Ditto.
2831
2832         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
2833         to handle the Accessor kind :-)
2834
2835         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
2836         
2837 2002-06-08  Martin Baulig  <martin@gnome.org>
2838
2839         * expression.cs (Unary.TryReduceNegative): Added support for
2840         ULongConstants.
2841
2842 2002-06-08  Martin Baulig  <martin@gnome.org>
2843
2844         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
2845         name can't be found in the `defined_names' - the caller will do a
2846         MemberLookup in this case and thus find methods in System.Enum
2847         such as Enum.IsDefined().
2848
2849 2002-06-08  Martin Baulig  <martin@gnome.org>
2850
2851         * enum.cs (Enum.ChangeEnumType): This is a custom version of
2852         Convert.ChangeType() which works with TypeBuilder created types.
2853         (Enum.LookupEnumValue, Enum.Define): Use it here.
2854
2855         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
2856         `TypeBuilder.BaseType != null' check.
2857         (TypeContainer.FindMembers): Only lookup parent members if we
2858         actually have a parent.
2859         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
2860         (ConstructorInitializer.Resolve): Likewise.
2861
2862         * interface.cs (Interface.FindMembers): Added
2863         `TypeBuilder.BaseType != null' check.
2864
2865         * rootcontext.cs (RootContext.ResolveCore): Added
2866         "System.Runtime.CompilerServices.IndexerNameAttribute" to
2867         classes_second_stage.
2868
2869         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
2870         debug_type and trace_type when compiling with --nostdlib.       
2871
2872 2002-06-07  Martin Baulig  <martin@gnome.org>
2873
2874         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
2875         (AddField): Set it to true when adding a non-static field.
2876         (DefineType): Use `have_nonstatic_fields' to find out whether we
2877         have non-static fields, not `Fields != null'.
2878
2879 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
2880
2881         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
2882         dereferencing a null on the static-field code path)
2883
2884 2002-05-30  Martin Baulig  <martin@gnome.org>
2885
2886         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
2887         to take command line arguments.  Use reflection to call the new
2888         custom `Initialize' function on the symbol writer and pass it the
2889         command line arguments.
2890
2891         * driver.cs (--debug-args): New command line argument to pass command
2892         line arguments to the symbol writer.
2893
2894 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
2895
2896         * assign.cs (DoResolve): Forgot to do the implicit conversion to
2897         the target type for indexers and properties.  Thanks to Joe for
2898         catching this.
2899
2900 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
2901
2902         * typemanager.cs (MethodFlags): returns the method flags
2903         (Obsolete/ShouldIgnore) that control warning emission and whether
2904         the invocation should be made, or ignored. 
2905
2906         * expression.cs (Invocation.Emit): Remove previous hack, we should
2907         not do this on matching a base type, we should do this based on an attribute
2908
2909         Only emit calls to System.Diagnostics.Debug and
2910         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
2911         on the command line.
2912
2913         * rootcontext.cs: Global settings for tracing and debugging.
2914
2915         * cs-tokenizer.cs (define): New utility function to track
2916         defines.   Set the global settings for TRACE and DEBUG if found.
2917
2918 2002-05-25  Ravi Pratap  <ravi@ximian.com>
2919
2920         * interface.cs (Populate*): Pass in the TypeContainer as well as
2921         the DeclSpace as parameters so that we can create EmitContexts and
2922         then use that to apply attributes etc.
2923
2924         (PopulateMethod, PopulateEvent, PopulateProperty)
2925         (PopulateIndexer): Apply attributes everywhere.
2926
2927         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
2928         etc.
2929
2930         (ApplyAttributes): Update accordingly.
2931
2932         We now apply interface attributes for all members too.
2933
2934 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
2935
2936         * class.cs (Indexer.Define); Correctly check if we are explicit
2937         implementation (instead of checking the Name for a ".", we
2938         directly look up if the InterfaceType was specified).
2939
2940         Delay the creation of the PropertyBuilder.
2941
2942         Only create the PropertyBuilder if we are not an explicit
2943         interface implementation.   This means that explicit interface
2944         implementation members do not participate in regular function
2945         lookups, and hence fixes another major ambiguity problem in
2946         overload resolution (that was the visible effect).
2947
2948         (DefineMethod): Return whether we are doing an interface
2949         implementation. 
2950         
2951         * typemanager.cs: Temporary hack until we get attributes in
2952         interfaces (Ravi is working on that) and we get IndexerName
2953         support in interfaces.
2954
2955         * interface.cs: Register the indexers as properties.
2956
2957         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
2958         warning, I have verified that this is a bug in the .NET runtime
2959         (JavaScript suffers of the same problem).
2960
2961         * typemanager.cs (MemberLookup): When looking up members for
2962         interfaces, the parent of an interface is the implicit
2963         System.Object (so we succeed in searches of Object methods in an
2964         interface method invocation.  Example:  IEnumerable x;  x.ToString
2965         ()) 
2966
2967 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
2968
2969         * class.cs (Event): Events should also register if they do
2970         implement the methods that an interface requires.
2971
2972         * typemanager.cs (MemberLookup); use the new GetInterfaces
2973         method. 
2974
2975         (GetInterfaces): The code used to lookup interfaces for a type is
2976         used in more than one place, factor it here. 
2977
2978         * driver.cs: Track the errors at the bottom of the file, we kept
2979         on going.
2980
2981         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
2982         instance if the method we are calling is static!
2983
2984 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
2985
2986         * attribute.cs (ApplyAttributes): Make this function filter out
2987         the IndexerName attribute (as that attribute in reality is never
2988         applied) and return the string constant for the IndexerName
2989         attribute. 
2990
2991         * class.cs (TypeContainer.Emit): Validate that all the indexers
2992         have the same IndexerName attribute, and if so, set the
2993         DefaultName attribute on the class. 
2994
2995         * typemanager.cs: The return value might contain other stuff (not
2996         only methods).  For instance, consider a method with an "Item"
2997         property and an Item method.
2998
2999         * class.cs: If there is a problem with the parameter types,
3000         return. 
3001
3002 2002-05-24  Ravi Pratap  <ravi@ximian.com>
3003
3004         * ecore.cs (ImplicitConversionExists): Wrapper function which also
3005         looks at user defined conversion after making a call to 
3006         StandardConversionExists - we need this for overload resolution.
3007
3008         * expression.cs : Update accordingly the various method calls.
3009
3010         This fixes 2 bugs filed against implicit user defined conversions 
3011
3012 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
3013
3014         * statement.cs: Track the result of the assignment.
3015
3016 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
3017
3018         * expression.cs (MemberAccess): Improved error reporting for
3019         inaccessible members.
3020
3021 2002-05-22  Martin Baulig  <martin@gnome.org>
3022
3023         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
3024         itself with debugging support.
3025
3026 2002-05-22  Martin Baulig  <martin@gnome.org>
3027
3028         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
3029         Removed, this isn't needed anymore.
3030
3031 2002-05-20  Martin Baulig  <martin@gnome.org>
3032
3033         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
3034         be underlying type for an enum.
3035
3036 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
3037
3038         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
3039         that splits out the loading of just the core types.
3040
3041         * rootcontext.cs (ResolveCore): Split the struct resolution in
3042         two, so we can load the enumeration underlying types before any
3043         enums are used.
3044
3045         * expression.cs (Is): Bandaid until we fix properly Switch (see
3046         bug #24985 for details).
3047
3048         * typemanager.cs (ImplementsInterface): The hashtable will contain
3049         a null if there are no interfaces implemented.
3050
3051 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
3052
3053         * cs-parser.jay (indexer_declarator): It is fine to have array
3054         parameters
3055
3056 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
3057
3058         * typemanager.cs: (RegisterBuilder): New function used to register
3059         TypeBuilders that implement interfaces.  Since
3060         TypeBuilder.GetInterfaces (as usual) does not work with lame
3061         Reflection.Emit. 
3062         (AddUserType): register interfaces.
3063
3064         (ImplementsInterface): Use the builder_to_ifaces hash if we are
3065         dealing with TypeBuilder.  Also, arrays are showing up as
3066         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
3067         methods can not be invoked on them!
3068
3069         * ecore.cs (ExplicitReferenceConversionExists): Made public.
3070         (ImplicitReferenceConversionExists): Split out from
3071         StandardConversionExists. 
3072
3073         * expression.cs (As): We were only implementing one of the three
3074         cases for the as operator.  We now implement them all.
3075         (Is): Implement the various other cases for Is as well.
3076
3077         * typemanager.cs (CACHE): New define used to control if we want or
3078         not the FindMembers cache.  Seems to have a negative impact on
3079         performance currently
3080
3081         (MemberLookup): Nested types have full acess to
3082         enclosing type members
3083
3084         Remove code that coped with instance/static returns for events, we
3085         now catch this in RealFindMembers.
3086
3087         (RealFindMembers): only perform static lookup if the instance
3088         lookup did not return a type or an event.  
3089
3090 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
3091
3092         * assign.cs (CompoundAssign): We pass more semantic information
3093         now to Compound Assignments than we did before: now we have all
3094         the information at hand, and now we resolve the target *before* we
3095         do the expression expansion, which allows the "CacheValue" method
3096         to have the effect we intended (before, a [x] += 1 would generate
3097         two differen ArrayAccess expressions from the ElementAccess,
3098         during the resolution process).
3099
3100         (CompoundAssign.DoResolve): Resolve target and original_source here.
3101
3102 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
3103
3104         * expression.cs (ArrayAccess): dropped debugging information. 
3105
3106         * typemanager.cs: Small bug fix: I was always returning i_members,
3107         instead of one of i_members or s_members (depending on which had
3108         the content).
3109
3110         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
3111         method is invoked before any code generation takes place, and it
3112         is a mechanism to inform that the expression will be invoked more
3113         than once, and that the method should use temporary values to
3114         avoid having side effects
3115
3116         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
3117         
3118         * ecore.cs (Expression.CacheTemporaries): Provide empty default
3119         implementation.
3120
3121         * expression.cs (Indirection, ArrayAccess): Add support for
3122         CacheTemporaries in these two bad boys. 
3123
3124         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
3125         ldobj or ldind_ref.  
3126         (StoreFromPtr): Handle stobj as well.
3127
3128         * expression.cs (UnaryMutator): Share more code.
3129         
3130         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
3131         down: I was not tracking the Filter function as well, which
3132         was affecting the results of the cache.
3133
3134 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
3135
3136         * attribute.cs: Remove the hack to handle the CharSet property on
3137         StructLayouts. 
3138
3139 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
3140
3141         * attribute.cs (DoResolve): More uglyness, we now only try to
3142         resolve the attribute partially, to extract the CharSet
3143         information (only if we are a StructLayout attribute).  Otherwise 
3144
3145         (GetExtraTypeInfo): Add some code to conditionally kill in the
3146         future this.   I am more and more convinced that the .NET
3147         framework has special code to handle the attribute setting on
3148         certain elements.
3149
3150         * expression.cs (IsParamsMethodApplicable): Revert my previous
3151         foreach change here, it was wrong.
3152
3153 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
3154
3155         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
3156         (pp_expr): do not abort on unknown input, just return.
3157         (eval): abort if there are pending chars.
3158
3159         * attribute.cs (Attribute.Resolve): Positional parameters are
3160         optional.  Deal with that case.
3161
3162         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
3163         the Ansi/Unicode/Auto information for the type.
3164
3165         (TypeContainer.DefineType): instantiate the EmitContext here, as
3166         we will be using it during the type definition (to resolve
3167         attributes) and during the emit phase.
3168
3169         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
3170         to pull type information out of the attributes
3171
3172         (Attribute.Resolve): track the constructor builder, and allow for
3173         multiple invocations (structs and classes will use this).
3174
3175         * ecore.cs (MemberLookupFinal): new version with all the
3176         parameters customizable.
3177
3178         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
3179         constructors.  Return if the result value is null (as the error
3180         would have been flagged already by MemberLookupFinal)
3181
3182         Do not allow instances of abstract classes or interfaces to be
3183         created.
3184         
3185         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
3186         We have to compare the assembly property here when dealing with
3187         FamANDAssem and Assembly access modifiers, because we might be
3188         creating an assembly from *modules* (that means that we are not
3189         getting TypeBuilders for types defined in other modules that are
3190         part of this assembly).
3191
3192         (Method.Emit): If the method is marked abstract and has a body,
3193         emit an error. 
3194
3195         (TypeContainer.DefineMembers): If both the defined member and the
3196         parent name match are methods, then do not emit any warnings: let
3197         the Method.Define routine take care of flagging warnings.  But if
3198         there is a mismatch (method overrides something else, or method is
3199         overriwritten by something, then emit warning).
3200
3201         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
3202         set to null, this means `do not check for the return type on the
3203         signature'. 
3204
3205         (Method.Define): set the return type for the method signature to
3206         null, so that we get methods with the same name and parameters and
3207         different return types.  This is used to flag warning 114 (you are
3208         hiding a method, and you probably want to use the new/override
3209         keywords instead).
3210
3211         * typemanager.cs (MemberLookup): Implemented proper access
3212         control, closing a long standing set of bug reports.  The problem
3213         was that the Framework only has two bits: Public and NonPublic,
3214         and NonPublic includes private and protected methods, but we need
3215         to enforce the FamANDAssem, FamOrAssem and Family. 
3216
3217 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
3218
3219         * statement.cs (GotoCase): Return true: Ammounts to giving up
3220         knowledge on whether we return or not, and letting the other case
3221         be responsible for it.
3222
3223 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
3224
3225         * driver.cs: Do not load directories for each file processed, only
3226         do it if there is a pattern.
3227
3228         * ecore.cs: Report readonly assigns here as well, as we might have
3229         been resolved only by MemberAccess.
3230
3231         (SimpleName.SimpleNameResolve): Also be useful for LValue
3232         resolution.   We need this to propagate assign to local readonly variables
3233
3234         * typemanager.cs: Use a ptrhashtable for the criteria, because we
3235         do not want to reuse potential criteria memory.
3236
3237         * class.cs (MyEventBuilder): Set reflected_type;
3238
3239         * ecore.cs (Constantify): Added support for constifying bools.
3240
3241         (RootContext.LookupType): Added a cache for values looked up in
3242         the declaration space.
3243
3244         * typemanager.cs (FindMembers): Now is a front-end to
3245         RealFindMembers, and provides a two-level hashtable-based cache to
3246         the request.  
3247
3248         15% performance improvement: from 22.5 to 19.2 seconds.
3249
3250         * expression.cs (IsParamsMethodApplicable): use foreach.
3251         (Invocation.DoResolve): ditto.
3252         (New.DoResolve): ditto.
3253         (ArrayCreation.DoResolve): ditto.
3254
3255         * ecore.cs (FindMostEncompassingType): use foreach.
3256
3257         * delegate.cs (NewDelegate.DoResolve): Use foreach
3258
3259         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
3260         (RemoveMethods): use foreach.
3261
3262         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
3263         nested foreach statements instead of for, and also break out of
3264         the inner loop once a match is found.
3265         
3266         (Invocation.OverloadResolve): Use foreach, simplify the code. 
3267
3268 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
3269
3270         * cfold.cs (BinaryFold): During an enumeration evaluation context,
3271         we actually unwrap the expression to allow for extra information
3272         to be extracted. 
3273
3274         * expression.cs: Use Shr_Un on unsigned operations. 
3275
3276 2002-05-08  Ravi Pratap  <ravi@ximian.com>
3277
3278         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
3279         applicable operators was not being considered correctly. This closes
3280         the bug Miguel reported.
3281
3282 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
3283
3284         * attribute.cs: check that the type derives from System.Attribute
3285         and report the correct error in that case (moved the duplicate code to
3286         its own method, too).
3287
3288 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
3289
3290         * attribute.cs: lookup attribute type name as the spec says: first the
3291         bare attribute name and then name + "Attribute" (nant compiles with
3292         mcs after this fix).
3293
3294 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
3295
3296         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
3297         Because of the way we parse things, we should try to see if a
3298         UIntConstant can fit in an integer.
3299
3300 2002-05-07  Ravi Pratap  <ravi@ximian.com>
3301
3302         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
3303         when we are in an explicit context.
3304
3305         (ConvertReferenceExplicit): When converting from Iface type S to Class
3306         T make sure the rules are implemented as an OR.
3307
3308         * parameter.cs (ParameterType): Make it a property for now although the
3309         purpose really isn't anything immediate.
3310         
3311         * expression.cs (Is*Applicable): Do better checking on the parameter type
3312         of a ref/out parameter. The ones from the system assemblies are already 
3313         marked with the correct type so we don't need to do any correction.
3314
3315         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
3316         the object type is standard too so include that.
3317
3318 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
3319
3320         * ecore.cs (StandardConversionExists): Augment with missing code:
3321         deal with IntConstant, LongConstants and Enumerations.
3322
3323         * assign.cs: Report the error, instead of failing silently
3324
3325         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
3326         typecontainer that they are declared, because the
3327         typecontainer/namespace will have the list of using clauses that
3328         need to be applied.
3329
3330         Assembly Attributes were escaping the normal registration
3331         mechanism. 
3332
3333         (EmitCode): Apply attributes within an EmitContext that represents
3334         the container they were declared on.
3335         
3336         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
3337
3338 2002-05-06  Ravi Pratap  <ravi@ximian.com>
3339
3340         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
3341         Revamp completely - make much cleaner as we now operate only
3342         on a set of Types.
3343
3344         (FindMostSpecificSource, FindMostSpecificTarget): New methods
3345         to implement the logic detailed in the spec more correctly.
3346
3347         (UserDefinedConversion): Update accordingly.
3348
3349 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
3350
3351         * statement.cs: Return flow analysis information up.
3352
3353         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
3354         and the default.
3355
3356         (token): Do not consume an extra character before calling
3357         decimal_digits.
3358
3359 2002-05-06  Piers Haken <piersh@friskit.com>
3360
3361         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
3362
3363 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
3364
3365         * class.cs (Constructor.Emit): Set the IsStatic flag in the
3366         EmitContext during the instance constructor initializer
3367         resolution, to stop access to instance variables.
3368
3369         This is mandated by the spec, last paragraph of the `constructor
3370         initializers' section. 
3371
3372 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
3373
3374         * cs-parser.jay, class.cs (Accessor): new class used to represent
3375         an accessor (get or set).  In the past we used `null' to represent
3376         a missing accessor.  But this is ambiguous because there was no
3377         way to tell in abstract indexers/properties if one of them was
3378         specified.
3379
3380         Now there is a way of addressing that.
3381
3382         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
3383         instead of FindMembers.
3384
3385         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
3386         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
3387
3388         * attribute.cs: Treat indexers and properties as the same in terms
3389         of applying attributes
3390
3391         * ecore.cs (FindMostEncompassedType): Use statically initialized
3392         EmptyExpressions()s like we do elsewhere to avoid creating useless
3393         objects (and we take this out of the tight loop).
3394
3395         (GetConversionOperators): Move the code to extract the actual
3396         operators to a separate routine to clean things up.
3397
3398 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
3399
3400         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
3401         events are always registered FieldBuilders.
3402         
3403         * class.cs (FieldBase): New class shared by Fields 
3404
3405         * delegate.cs: If we are a toplevel delegate, use our full name.
3406         If we are a nested delegate, then only use our tail name.
3407
3408 2002-05-02  Ravi Pratap  <ravi@ximian.com>
3409
3410         * expression.cs (IsApplicable): Ensure that we add the "&" to
3411         ref/out types before comparing it with the type of the argument.
3412
3413         (IsParamsMethodApplicable): Ditto.
3414
3415         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
3416         silly me ;-)
3417
3418         * delegate.cs : Handle the case when we have more than one applicable
3419         method. Flag an error only when we finish checking all.
3420
3421 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
3422
3423         * expression.cs: Add support for boolean static initializers.
3424
3425 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
3426
3427         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
3428
3429         * parameter.cs (ComputeParameterTypes,
3430         ComputeAndDefineParameterTypes): Better error handling: now we
3431         clear the `types' cache if we fail during any of the type lookups.
3432         We also return the status code correctly to our caller
3433
3434         * delegate.cs: If we fail to define a delegate, abort the extra
3435         steps. 
3436
3437         * expression.cs (Binary.ResolveOperator): for
3438         operator==(object,object) and operator !=(object, object) we also
3439         have to verify that there is an implicit conversion from one to
3440         the other.
3441
3442         (ArrayAccess.DoResolve): Array Access can operate on
3443         non-variables. 
3444
3445 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
3446
3447         * assign.cs (CompoundAssign): A new class used as a "flag" that
3448         the assignment actually is happening as part of a compound
3449         assignment operator.
3450
3451         During compound assignment, a few new rules exist to enable things
3452         like:
3453
3454         byte b |= 1 + 2
3455
3456         From the spec:
3457         
3458         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
3459         to the type of x) if y is implicitly convertible to the type of x,
3460         and the operator is a builtin operator and the return type of the
3461         operator is explicitly convertible to the type of x. 
3462
3463         * rootcontext.cs: Reset warning level to 2.  4 catches various
3464         "interesting" features in mcs, we must clean this up at some
3465         point, but currently am trying to kill other bugs ;-)
3466
3467         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
3468         in container classes as well.  
3469
3470         * expression.cs (Binary.ResolveOperator): Handle string case
3471         before anything else (as operator overloading does emit an error
3472         before doing anything else).
3473
3474         This code could go away when we move to a table driven model, but
3475         i could not come up with a good plan last night.
3476         
3477 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
3478
3479         * typemanager.cs (CSharpName): reimplementation using regex.
3480         * class.cs: added null check for fields in Emit
3481         * rootcontext.cs: set warninglevel to 4
3482
3483 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
3484
3485         * typemanager.cs (CSharpName): reimplemented with Lupus
3486         suggestion.
3487
3488 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
3489
3490         * statement.cs (If): correclty implement Resolve, because we were
3491         not catching sem errors in there.  The same process is needed
3492         everywhere else. 
3493         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
3494         
3495
3496         (Statement.Warning_DeadCodeFound): Factorize code.
3497         (While): Report dead code here too.
3498
3499         (Statement): Added Resolve virtual method to allow
3500         for resolution split from the emit code.
3501
3502 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
3503
3504         * statement.cs (EmitBoolExpression): No longer try to resolve the
3505         expression here.    
3506         (MakeBoolean): New utility function that resolve, implicitly
3507         converts to boolean and tags the expression. 
3508         
3509
3510         (If, Do): Implement dead code elimination.
3511         (While): Implement loop inversion
3512
3513         (Do, While, For, If): Resolve the expression prior to calling our
3514         code generation.
3515
3516 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
3517
3518         * class.cs:
3519           - added method Report28 (warning: program has more than one entry point)
3520           - added method IsEntryPoint, implements paragraph 10.1 of the spec
3521           - modified method Method.Define, the part at the end of the method
3522
3523         * rootcontext.cs: added static public Location EntryPointLocation;
3524           
3525         * ../errors/cs0028.cs : Add test case for the above warning.              
3526
3527         * typemanager.cs:
3528           - modified method CSharpName to allow arrays of primitive type to
3529             be printed nicely (e.g. instead of System.Int32[][] it now prints
3530             int[][])
3531           - added method CSharpSignature: returns the signature of a method
3532             in string format to be used in reporting errors, warnings, etc.
3533
3534         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
3535         with String.Empty.
3536         
3537 2002-04-26  Ravi Pratap  <ravi@ximian.com>
3538
3539         * delegate.cs (Define): Fix extremely silly bug where I was
3540         setting the type of the 'object' parameter of the BeginInvoke
3541         method to System.IAsyncResult instead of System.Object ;-)
3542
3543 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
3544
3545         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
3546         here. 
3547
3548         (Constructor.Emit): return if we fail to initialize the
3549         constructor.  Another door closed!  
3550
3551         * expression.cs (New.DoResolve): Improve error message (from -6 to
3552         1501).  Use DeclaredOnly lookup to find the exact constructor.
3553
3554         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
3555         loop.  This is useful.
3556
3557         * cs-parser.jay: Adjust the default parameters so that destructors
3558         have the proper signature.
3559
3560 2002-04-26  Martin Baulig  <martin@gnome.org>
3561
3562         * driver.cs (LoadAssembly): If `assembly' contains any characters
3563         which are only valid in path names and not in assembly names
3564         (currently slash, backslash and point), use Assembly.LoadFrom ()
3565         instead of Assembly.Load () on the `assembly' (before iteration
3566         over the link_paths).
3567
3568 2002-04-26  Martin Baulig  <martin@gnome.org>
3569
3570         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
3571
3572 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
3573
3574         * class.cs (Property): use the new typemanager.MemberLookup
3575
3576         (TypeContainer.MemberLookup): Implement using the
3577         TypeManager.MemberLookup now. 
3578         
3579         * typemanager.cs: Make MemberLookup a function of the TypeManager,
3580         and return MemberInfos, so that these can be used without an
3581         EmitContext (what we had before).
3582
3583 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
3584
3585         * expression.cs: Fix the case where the argument to params if the
3586         type of the params.  I omitted handling this before.   Fixed
3587
3588 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
3589
3590         * driver.cs: Call BootCorlib_PopulateCoreType
3591
3592         * class.cs (Property.CheckBase): Check for properties only, not
3593         for all members. 
3594
3595         * interface.cs: Temporary hack: try/catch around the
3596         CustomAttributeBuilder, because I am getting an exception that I
3597         do not understand.
3598
3599         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
3600         types whose definitions are required to be there (attributes are
3601         defined before standard types).
3602
3603         Compute definitions as we boot the various types, as they are used
3604         immediately (value_type class will need object_type, but if we do
3605         not initialize object_type, we will pass a null, which will let
3606         the runtime pick the System.Object from the existing corlib, which
3607         is not what we want).
3608
3609 2002-04-22  Patrik Torstensson <totte@labs2.com>
3610
3611         * cs-tokenizer.cs: fixed a number of trim() issues.
3612
3613 2002-04-22  Ravi Pratap  <ravi@ximian.com>
3614
3615         * expression.cs (Argument.Type): Ensure that we return the correct
3616         type when we have out or ref parameters [in which case we 
3617         append a "&"].
3618         
3619 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
3620
3621         * class.cs (Property, Indexer): Allow extern modifier in there. 
3622
3623         * typemanager.cs (InitBaseTypes): Initializes object_type and
3624         value_type, since those will be used early on during the bootstrap
3625         process to compile corlib.
3626
3627         (InitCoreTypes): Move code from here to InitBaseTypes.
3628
3629 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
3630
3631         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
3632         single-dimension arrays as using the ldlen opcode.  
3633
3634         Daniel Lewis discovered this optimization.  
3635
3636         * typemanager.cs: Add signature for System.Array::get_Length
3637
3638 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3639
3640         * statement.cs: report the error when the foreach does not apply to an
3641         array nor a collection.
3642
3643 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
3644
3645         * expression.cs: Add implicit conversions to the operator ~.
3646
3647         * constant.cs (DecimalConstant.Emit): Emit decimal value.
3648
3649         * typemanager.cs: Locate the decimal constructor.
3650
3651 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3652
3653         * attribute.cs: use the new property of TypeOf.
3654         * expression.cs: added 'get' property around typearg.
3655
3656         These changes fix a build breaker reported by NickD. Is this the
3657         correct way to fix?  If not, please, revert my changes and make it
3658         work :-).
3659
3660 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
3661
3662         * attribute.cs: Add support for typeof in attribute invocations.
3663         I am not sure that this is right though.
3664
3665 2002-04-14  Duncan Mak  <duncan@ximian.com>
3666
3667         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
3668         Binary.Operator.Division case.
3669
3670 2002-04-13  Ravi Pratap  <ravi@ximian.com>
3671
3672         * class.cs (DefineType): Ensure that we do a proper check on
3673         attribute types and also register it with the TypeManager.
3674
3675         (TypeContainer.Targets): The default for attribute types is
3676         AttributeTargets.All.
3677         
3678         * attribute.cs (ApplyAttributes): Registering the attribute type
3679         is done elsewhere, not when we discover we have a Usage attribute.
3680
3681 2002-04-12  Ravi Pratap  <ravi@ximian.com>
3682
3683         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
3684         and get rid of is_delegate parameter.
3685
3686         * everywhere : update.
3687         
3688 2002-04-12  Ravi Pratap  <ravi@ximian.com>
3689
3690         * cs-parser.jay (compilation_unit): Revamp completely to use
3691         some new ideas that I got from Rhys' grammar to solve the problems
3692         with assembly level attributes.
3693
3694         (outer_declaration): New grammar production.
3695
3696         (attribute_sections): Add.
3697
3698         (opt_attributes): Base on attribute_sections
3699
3700         (namespace_declaration): Allow opt_attributes to tackle the case
3701         when we have assembly level attributes - we are clever in this
3702         regard now ;-)
3703
3704         * attribute.cs (ApplyAttributes): Do not worry about assembly 
3705         attributes in the non-global context.
3706
3707         * rootcontext.cs (AddGlobalAttributes): Go back to using this
3708         instead of SetGlobalAttributes.
3709
3710         * class.cs, rootcontext.cs : Ensure we define and generate 
3711         attribute types before anything else.
3712
3713         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
3714         and flag the new error -20 for the case when the attribute type
3715         does not have valid targets specified. csc does not catch this.
3716
3717         * ../errors/errors.txt : update for error # -20
3718
3719 2002-04-11  Ravi Pratap  <ravi@ximian.com>
3720
3721         * support.cs (InternalParameters.ParameterModifier): Do some null
3722         checking and return sane values.
3723
3724         * class.cs (Method.Define): If we are a PInvoke method, ensure
3725         that we are static and extern. Report error # 601
3726
3727         * ../errors/cs0601.cs : Add test case for the above error.
3728
3729 2002-04-07  Ravi Pratap  <ravi@ximian.com>
3730
3731         * rootcontext.cs (attribute_types): We need to keep type of
3732         all attribute types separately and emit code for them first.
3733
3734         (RegisterAttribute) : Implement.
3735
3736         * class.cs (DefineType): Check if the current Type is a custom
3737         attribute type and register it accordingly.
3738
3739         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
3740         adding the first attribute twice and rename to
3741
3742         (SetGlobalAttributes): this.
3743
3744         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
3745         lookups.
3746
3747         * attribute.cs (ApplyAttributes): Take an additional argument telling us
3748         if we are processing global arguments. Hmm, I am unsure of this.
3749
3750 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3751
3752         * expression.cs: added static array of strings to avoid calling
3753         Enum.ToString () for Operator in Binary. Significant recover of
3754         performance.
3755
3756 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
3757
3758         * class.cs (FindMembers): Allow the Builders of the various
3759         members to be null.  If they are skip them.  This only happens
3760         during the PInvoke declaration.
3761
3762 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
3763
3764         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
3765         failure, so we do not keep going afterwards.
3766
3767         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
3768         wanted to pass `false' as the `is_delegate' argument.  If this is
3769         the case, why not use delegate_type == null to mean `is_delegate =
3770         false' and anything else as is_delegate = true.
3771
3772 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
3773
3774         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
3775         code for the section, not the beginning of the tests.
3776
3777 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
3778
3779         * cfold.cs: Handle operator + (Enum x, Underlying x) 
3780
3781         * expression.cs (Binary): same.  Warn about errors where we have
3782         Enum/Enum in operator + as well.
3783
3784 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
3785
3786         * statement.cs:
3787                 - added support for switch(bool)
3788                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
3789                 - add TableSwitchEmit() to handle table-based switch statements
3790
3791 2002-04-05  Ravi Pratap  <ravi@ximian.com>
3792
3793         * expression.cs (Invocation.OverloadResolve): Factor out code which
3794         does parameter compatibility checking with arguments so that we can 
3795         re-use the code even from Delegate.VerifyApplicability
3796
3797         (VerifyArgumentsCompat): Move above code here.
3798
3799         * delegate.cs (VerifyApplicability): Get rid of duplicate code
3800         and instead make a call to the above method.
3801
3802 2002-03-31  Ravi Pratap  <ravi@ximian.com>
3803
3804         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
3805         We use it to keep track of classes which are attribute types.
3806
3807 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
3808
3809         * delegate.cs (Delegate.Define): Correctly define the types in the
3810         presence of fixed and array parameters.
3811
3812         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
3813         doing FindMembers.
3814
3815         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
3816         include NonPublic after the first iteration.
3817
3818         * class.cs (Indexer.CheckBase): Only check if both parents are
3819         non-null. 
3820         
3821         * cs-parser.jay (accessor_body): If empty, set to null.
3822
3823         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
3824         same code path here to resolve constants names that we did have in
3825         MemberAccess.DoResolve.  There is too much code duplicated here.
3826
3827 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
3828
3829         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
3830
3831         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
3832         to MakeUnionSet.
3833
3834         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
3835         tokens, numbers and strings.
3836
3837         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
3838         parenthesis.
3839
3840         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
3841         asyncronous parameters and the regular parameters.  
3842
3843         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
3844         specify the target directory.
3845
3846         * expression.cs: (This.DoResolve): Simplify
3847         (As.Emit): Optimize, do not generate IsInst if the expression is
3848         always of the given type.
3849
3850         (Is.DoResolve): Bug fix, we were reporting both always/never for
3851         the is expression.
3852
3853         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
3854         creating too many unnecessary arrays.
3855
3856 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
3857
3858         * class.cs (EmitFieldInitializer): Use Assign expression to assign
3859         fields instead of rolling our own initializer.   Takes care of all
3860         implicit conversions, and drops unnecessary static checks/argument.
3861
3862 2002-03-31  Dick Porter  <dick@ximian.com>
3863
3864         * driver.cs: use the GetDirectories() return values properly, and
3865         use "/" as path separator.
3866
3867 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
3868
3869         * expression.cs (Unary): Optimize - - expr into expr.
3870         (Binary): Optimize a + (-b) into a -b.
3871
3872         * codegen.cs (CodeGen): Made all methods static.
3873
3874 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
3875
3876         * rootcontext.cs: 
3877
3878         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
3879         TypeBuilder property.
3880
3881         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
3882         instead. 
3883
3884         * tree.cs: Removed the various RecordXXXX, and replaced with a
3885         single RecordDecl.  Removed all the accessor methods, and just
3886         left a single access point Type 
3887
3888         * enum.cs: Rename DefineEnum to DefineType.
3889
3890         * decl.cs: New abstract method `DefineType' used to unify the
3891         Defines for Enumerations, Interfaces, TypeContainers and
3892         Delegates.
3893
3894         (FindType): Moved LookupInterfaceOrClass here.  Moved the
3895         LookupBaseClasses method that used to live in class.cs and
3896         interface.cs here, and renamed to FindType.
3897         
3898         * delegate.cs: Implement DefineType.  Take advantage of the
3899         refactored pattern for locating the parent builder without taking
3900         the parent_builder argument (which we know does not work if we are
3901         nested, and triggering a toplevel definition).
3902
3903 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
3904
3905         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
3906         accessibility of a member has changed during override and report
3907         an error if so.
3908
3909         * class.cs (Method.Define, Property.Define): Only complain on
3910         overrides if the method is private, any other accessibility is
3911         fine (and since we just checked the permission is the same, we are
3912         good to go).
3913
3914         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
3915         and elif are processed always.  The other pre-processing
3916         directives are only processed if we are "taking" the path
3917
3918 2002-03-29  Martin Baulig  <martin@gnome.org>
3919
3920         * class.cs (Method.Emit): Only emit symbolic debugging info if the
3921         current location is not Null.
3922
3923         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
3924         a separate method so we can profile it.
3925
3926         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
3927         `span.Seconds' are just seconds, but no minutes or hours.
3928         (MainDriver): Profile the CodeGen.SaveSymbols calls.
3929
3930 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
3931
3932         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
3933         Remove the gratuitous set of Final:
3934
3935                                 // If an interface implementation, then we can set Final.
3936                                 if (((flags & MethodAttributes.Abstract) == 0) &&
3937                                     implementing.DeclaringType.IsInterface)
3938                                         flags |= MethodAttributes.Final;
3939
3940         I do not know what I was smoking when I used that.
3941         
3942
3943         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
3944         step into fixing the name resolution issues for delegates and
3945         unifying the toplevel name resolution.
3946
3947 2002-03-28  Martin Baulig  <martin@gnome.org>
3948
3949         * class.cs (Method.Emit): If we have a symbol writer, call its
3950         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
3951         tell it about the current method.
3952
3953         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
3954         writer that we're going to emit the first byte of IL code for a new
3955         statement (a new source line).
3956         (EmitContext.EmitTopBlock): If we have a symbol writer, call
3957         EmitContext.Mark() before emitting any code.
3958
3959         * location.cs (SymbolDocument): Return null when we're Null.
3960
3961         * statement.cs (Statement): Moved the `Location loc' variable here.
3962         (Statement.EmitBoolExpression): If we have a symbol writer, call
3963         ec.Mark() before emitting any code to tell it that we're at the
3964         beginning of a new statement.
3965         (StatementExpression): Added `Location' argument to the constructor.
3966         (Block): Added public readonly variable `StartLocation' and public
3967         variable `EndLocation'.  The latter is to be set using SetEndLocation().
3968         (Block): Added constructor which takes a start and end location.
3969         (Block.SetEndLocation): New method. This sets the end location.
3970         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
3971         local variables we create.
3972         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
3973         each statement and do also mark the begin and end of the block.
3974
3975         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
3976         tell it the current lexer.Location, use Location.Null for the end of the
3977         block.
3978         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
3979         current block, set its end location using SetEndLocation().
3980         (statement_expression): StatementExpression constructor now takes the
3981         lexer.Location as additional argument.
3982         (for_statement, declare_local_variables): Likewise.
3983         (declare_local_variables): When creating a new implicit block, use the
3984         new Block constructor and pass it the lexer.Location.
3985
3986 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
3987
3988         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
3989         members also on the parent interfaces recursively.
3990
3991 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
3992
3993         * report.cs: Use new formats, since Gonzalo finished the missing
3994         bits. 
3995
3996         * expression.cs (Binary.ResolveOperator): added missing operator|
3997         operator& and operator^ for bool/bool.
3998
3999         * cs-parser.jay: CheckDef now takes a Location argument that is
4000         used to report errors more precisly (instead of reporting the end
4001         of a definition, we try to track something which is a lot closer
4002         to the source of the problem).
4003
4004         * cs-tokenizer.cs: Track global token use, so we can properly flag
4005         the use of #define/#undef after the first token has been seen.
4006
4007         Also, rename the reportXXXX to Error_DescriptiveName
4008
4009         * decl.cs (DeclSpace.IsTopLevel): Move property here from
4010         TypeContainer, so that Enum and Interface can use this too.
4011
4012         * class.cs (TypeContainer.LookupInterfaceOrClass,
4013         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
4014         `builder' argument.  Typically this was used to pass the parent
4015         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
4016         the definition).  
4017
4018         The problem is that a nested class could trigger the definition of
4019         a toplevel class, and the builder would be obviously wrong in that
4020         case. 
4021
4022         So we drop this argument, and we compute dynamically the
4023         TypeBuilder/ModuleBuilder (the correct information was available
4024         to us anyways from DeclSpace.Parent)
4025
4026         * interface.cs (Interface.DefineInterface): Drop builder
4027         parameter cleanup like class.cs
4028
4029         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
4030         like class.cs
4031
4032         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
4033         values. 
4034
4035         (Try.Emit): Propagate the returns value from the statement.
4036
4037         (Return.Emit): Even if we are leavning 
4038
4039         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
4040
4041         * modifiers.cs: Fix the computation of MethodAttributes flags.
4042
4043 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
4044
4045         * driver.cs: allow compilation of files that start with '/'.
4046         Add a default case when checking the argument of --target.
4047
4048 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
4049
4050         * interface.cs: Implement the same search algorithm for types in
4051         the interface code.
4052
4053         * delegate.cs: Do not allow multiple definition.
4054
4055         * Recovered ChangeLog that got accidentally amputated
4056
4057         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
4058
4059         * rootcontext.cs: Load manually enum to allow core classes to
4060         contain enumerations.
4061
4062         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
4063         Update to new static methods in TypeManager.
4064
4065         * typemanager.cs (GetMethod, GetConstructor): Use our
4066         implementation of FindMembers to find the members, since during
4067         corlib compilation, the types are TypeBuilders and GetMethod and
4068         GetConstructor do not work.
4069
4070         Make all methods in TypeManager static.
4071
4072         (InitCodeHelpers): Split the functionality from
4073         the InitCodeTypes function.
4074
4075         * driver.cs: Call InitCodeHelpers after we have populated the
4076         types. 
4077
4078         * cs-parser.jay (delegate_declaration): we did not used to compute
4079         the delegate name correctly for void delegates.
4080
4081 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
4082
4083         * rootcontext.cs (RootContext): Init the interface_resolve_order
4084         and type_container_resolve_order always.
4085
4086         (ResolveCore, BootstrapCorlib_ResolveClass,
4087         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
4088         compiler when compiling with --nostdlib
4089
4090         * class.cs (TypeContainer.DefineType): Check that our parent is
4091         not null.  This test is most important when we are bootstraping
4092         the core types.
4093
4094         * codegen.cs: Split out the symbol writing code.
4095
4096 2002-03-25  Martin Baulig  <martin@gnome.org>
4097
4098         * driver.cs (-g): Made -g an alias for --debug.
4099
4100 2002-03-24  Martin Baulig  <martin@gnome.org>
4101
4102         * codegen.cs (SymbolWriter): New public variable. Returns the
4103         current symbol writer.
4104         (CodeGen): Added `bool want_debugging_support' argument to the
4105          constructor. If true, tell the ModuleBuild that we want debugging
4106         support and ask it for the ISymbolWriter.
4107         (Save): If we have a symbol writer, call it's Close() method after
4108         saving the assembly.
4109
4110         * driver.c (--debug): New command line argument to create a
4111         debugger information file.
4112
4113         * location.cs (SymbolDocument): New public property. Returns an
4114         ISymbolDocumentWriter object for the current source file or null
4115         if we don't have a symbol writer.
4116
4117 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
4118
4119         * driver.cs (LoadAssembly): Correctly return when all the paths
4120         have been tried and not before.
4121
4122         * statement.cs (Switch.Emit): return the actual coverage for this
4123         statement (returns/not-returns)
4124
4125         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
4126         switch of the statement if we are the last switch section.  That
4127         kills two problems: try/catch problems (we used to emit an empty
4128         nop at the end) and switch statements where all branches would
4129         return. 
4130
4131 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
4132
4133         * driver.cs: Add default assemblies (the equivalent to the
4134         Microsoft CSC.RSP file)
4135
4136         * cs-tokenizer.cs: When updating `cols and setting it to zero,
4137         also update tokens_seen and set it to false.
4138
4139         * driver.cs: Implement --recurse for Mike.
4140
4141         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
4142         correctly splitting out the paths.
4143
4144 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
4145
4146         * interface.cs (Interface.PopulateProperty): Instead of using
4147         `parent' as the declaration space for the set parameters, use
4148         `this' 
4149
4150         * support.cs (InternalParameters): InternalParameters constructor
4151         takes a DeclSpace instead of a TypeContainer.
4152
4153         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
4154         types are being initialized, load the address of it before calling
4155         the function.  
4156
4157         (New): Provide a mechanism to disable the generation of local
4158         value type temporaries when the caller will be providing us with
4159         an address to store it.
4160
4161         (ArrayCreation.EmitDynamicInitializers): Use it.
4162
4163 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
4164
4165         * expression.cs (Invocation.EmitArguments): Only probe for array
4166         property if there is more than one argument.  Sorry about that.
4167
4168         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
4169         empty param arrays.
4170         
4171         * class.cs (Method.LabelParameters): Fix incorrect code path that
4172         prevented the `ParamArrayAttribute' from being applied to the
4173         params attribute.
4174
4175 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
4176
4177         * support.cs (ReflectionParameters): Correctly compute whether the
4178         last argument is a params array.  Fixes the problem with
4179         string.Split ('a')
4180
4181         * typemanager.cs: Make the assemblies array always be non-null
4182         (empty, but non-null)
4183
4184         * tree.cs (RecordDecl): New function that abstracts the recording
4185         of names.  This reports error 101, and provides a pointer to the
4186         previous declaration.  Fixes a crash in the compiler.
4187
4188         * cs-parser.jay (constructor_declaration): Update to new grammar,
4189         and provide a constructor_body that can be empty.
4190
4191 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
4192
4193         * driver.cs: Add support for --resources.
4194
4195         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
4196         Make all types for the various array helper methods be integer.
4197
4198         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
4199         CheckState to ConvCast.
4200
4201         (ConvCast): Now it takes a `checked' state argument, to avoid
4202         depending on the emit context for the conversion, and just using
4203         the resolve time setting.
4204
4205         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
4206         instead of Invocation.EmitArguments.  We do not emit the original
4207         arguments, instead we emit those which have been converted to
4208         unsigned int expressions.
4209
4210         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
4211
4212         * codegen.cs: ditto.
4213
4214         * expression.cs (LocalVariableReference): Drop the use of the
4215         Store function that depended on the variable index.
4216
4217         * statement.cs (VariableInfo): Drop the `Idx' property from this
4218         class, as this is not taking into account the indexes for
4219         temporaries tat we generate during the execution, getting the
4220         indexes wrong.
4221
4222         * class.cs: First emit class initializers, then call the parent
4223         constructor. 
4224
4225         * expression.cs (Binary): Fix opcode emision.
4226         (UnaryMutator.EmitCode): Support checked code generation
4227
4228         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
4229         matches for events for both the Static and Instance scans,
4230         pointing to the same element.   Fix that.
4231
4232 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
4233
4234         * rootcontext.cs (ResolveTree): Always set the
4235         interface_resolve_order, because nested interfaces will be calling
4236         into us.
4237
4238         * class.cs (GetInterfaceOrClass): Track the same resolution
4239         process used by TypeManager.LookupType.  This fixes the nested
4240         type lookups in class declarations (separate path from
4241         LookupType). 
4242
4243         (TypeContainer.DefineType): Also define nested interfaces.
4244         (TypeContainer.RegisterOrder): New public function used to
4245         register the order in which child interfaces need to be closed.
4246
4247         Nested interfaces need to be closed after their parents have been
4248         created. 
4249         
4250         * interface.cs (InterfaceAttr): Put all the logic for computing
4251         the interface attribute here. 
4252
4253         (DefineInterface): Register our interface order with the
4254         RootContext or with the TypeContainer depending on the case.
4255
4256 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
4257
4258         * cs-parser.jay: rework foreach statement to work with the new
4259         changes to the policy on SimpleNames.
4260         
4261         * report.cs: support Stacktrace on warnings as well.
4262
4263         * makefile: drop --unsafe and /unsafe from the compile.
4264
4265 2002-03-13  Ravi Pratap  <ravi@ximian.com>
4266
4267         * ecore.cs (StandardConversionExists): Modify to take an Expression
4268         as the first parameter. Ensure we do null -> reference type conversion
4269         checking.
4270
4271         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
4272         temporary Expression objects.
4273
4274 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
4275
4276         * interface.cs: workaround bug in method overloading resolution
4277         (there is already a bugzilla bug for it).
4278
4279 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
4280
4281         We could also solve this problem by having a separate path for
4282         performing type lookups, instead of DoResolve, we could have a
4283         ResolveType entry point, and only participating pieces of the
4284         production (simplename, deref, array) would implement this. 
4285         
4286         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
4287         signal SimpleName to only resolve type names and not attempt to
4288         resolve anything else.
4289
4290         * expression.cs (Cast): Set the flag.
4291
4292         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
4293
4294         * class.cs: Only report 108 if there is no `new' modifier.
4295
4296         * cs-parser.jay: rework foreach statement to work with the new
4297         changes to the policy on SimpleNames.
4298         
4299         * report.cs: support Stacktrace on warnings as well.
4300
4301         * makefile: drop --unsafe and /unsafe from the compile.
4302
4303 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
4304
4305         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
4306         lookups here, instead of doing that at parse time.  This means
4307         that our grammar will not introduce `LocalVariableReferences' as
4308         expressions at this point.  That solves the problem of code like
4309         this:
4310
4311         class X {
4312            static void Main ()
4313            { int X = 1;
4314             { X x = null }}}
4315
4316         This is only half the fix.  The full fix requires parameters to
4317         also be handled in this way.
4318
4319         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
4320         makes the use more obvious of the DeclSpace.  The
4321         ec.TypeContainer.TypeBuilder is now only used to pull the
4322         TypeBuilder for it.
4323
4324         My theory is that I can get rid of the TypeBuilder completely from
4325         the EmitContext, and have typecasts where it is used (from
4326         DeclSpace to where it matters).  
4327
4328         The only pending problem is that the code that implements Aliases
4329         is on TypeContainer, and probably should go in DeclSpace.
4330
4331         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
4332         lookups here, instead of doing that at parse time.  This means
4333         that our grammar will not introduce `LocalVariableReferences' as
4334         expressions at this point.  That solves the problem of code like
4335         this:
4336
4337         class X {
4338            static void Main ()
4339            { int X = 1;
4340             { X x = null }}}
4341
4342         This is only half the fix.  The full fix requires parameters to
4343         also be handled in this way.
4344
4345         * class.cs (Property.DefineMethod): When implementing an interface
4346         method, set newslot, when implementing an abstract method, do not
4347         set the flag (before we tried never setting it, or always setting
4348         it, which is the difference).
4349         (Indexer.DefineMethod): same.
4350         (Method.DefineMethod): same.
4351
4352         * ecore.cs: Only set the status used flag if we get back a Field.
4353
4354         * attribute.cs: Temporary hack, so Paolo can keep working.
4355
4356 2002-03-08  Ravi Pratap  <ravi@ximian.com>
4357
4358         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
4359         the unmanaged type in the case we have a MarshalAs attribute.
4360
4361         (Resolve): Handle the case when we are parsing the special MarshalAs
4362         attribute [we need to store the unmanaged type to use later]
4363         
4364         * typemanager.cs (marshal_as_attr_type): Built in type for the 
4365         MarshalAs Attribute.
4366
4367         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
4368         on parameters and accordingly set the marshalling info.
4369         
4370 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
4371
4372         * class.cs: Optimizing slightly by removing redundant code after
4373         we switched to the `NoTypes' return value.
4374         (Property.DefineMethod): use NoTypes here too.
4375
4376         This fixes the bug I introduced in my last batch of changes.
4377
4378 2002-03-05  Ravi Pratap  <ravi@ximian.com>
4379
4380         * tree.cs (RecordEnum): Add. We now keep track of enums too.
4381
4382         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
4383         Enums since those are types too. 
4384
4385         * cs-parser.jay (enum_declaration): Record enums as we parse them.
4386         
4387         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
4388         thanks to a call during the lookup process.
4389
4390 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
4391
4392         * statement.cs (Foreach): Lots of work to accomodate a particular
4393         kind of foreach statement that I had not kept in mind.  It is
4394         possible to have foreachs on classes that provide a GetEnumerator
4395         method that return objects that implement the "pattern" for using
4396         a foreach, there is no need to support GetEnumerator
4397         specifically. 
4398
4399         This is needed to compile nant.
4400
4401         * decl.cs: Only report 114 if the member is not `Finalize' and if
4402         the warning level is at least 2.
4403
4404         * class.cs: Moved the compare function from Method to
4405         MethodSignature. 
4406
4407         (MethodSignature.InheritableMemberSignatureCompare): Add new
4408         filter function that is used to extract inheritable methods from a
4409         class. 
4410
4411         (Method.Define): Use the new `inheritable_method_signature_filter'
4412         delegate
4413
4414         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
4415         command. 
4416
4417 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
4418
4419         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
4420
4421         * cs-parser.jay: Add opt_semicolon to the interface declaration.
4422
4423         * expression.cs: Pass location information to
4424         ConvertImplicitStandard. 
4425
4426         * class.cs: Added debugging code to track return values from
4427         interfaces. 
4428
4429 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
4430
4431         * expression.cs (Is.DoResolve): If either side of the `is' is an
4432         interface, do not flag the warning.
4433
4434         * ecore.cs (ImplicitReferenceConversion): We need a separate test
4435         for interfaces
4436
4437         * report.cs: Allow for --fatal to be used with --probe.
4438         
4439         * typemanager.cs (NoTypes): Move the definition for the empty Type
4440         array here. 
4441
4442         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
4443         properties. 
4444         (TypeContainer.DefineProxy): New function used to proxy to parent
4445         implementations when implementing interfaces.
4446         (TypeContainer.ParentImplements): used to lookup if our parent
4447         implements a public function that is required by an interface.
4448         (TypeContainer.VerifyPendingMethods): Hook this up.
4449
4450         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
4451         `modules' and `assemblies' arraylists into arrays.  We only grow
4452         these are the very early start up of the program, so this improves
4453         the speedof LookupType (nicely measured).
4454
4455         * expression.cs (MakeByteBlob): Replaced unsafe code with
4456         BitConverter, as suggested by Paolo.
4457
4458         * cfold.cs (ConstantFold.Binary): Special case: perform constant
4459         folding of string concatenation, but if either side is a string,
4460         and the other is not, then return null, and let the runtime use
4461         the concatenation on the string plus the object (using
4462         `Object.ToString'). 
4463
4464 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
4465
4466         Constant Folding has been implemented now.
4467         
4468         * expression.cs (Unary.Reduce): Do not throw an exception, catch
4469         the error instead on types that are not supported in one's
4470         complement. 
4471
4472         * constant.cs (Constant and all children): New set of functions to
4473         perform implict and explicit conversions.
4474         
4475         * ecore.cs (EnumConstant): Implement the new functions to perform
4476         conversion by proxying to the child expression.
4477
4478         * codegen.cs: (ConstantCheckState): Constant evaluation has its
4479         own separate setting that can not be turned off from the command
4480         line using --unchecked or --checked and is only controlled using
4481         the checked/unchecked statements and expressions.  This setting is
4482         used by the constant folder to flag errors.
4483
4484         * expression.cs (CheckedExpr, UncheckedExpr): Set the
4485         ConstantCheckState as well.   
4486
4487         During Resolve, they also have to flag the state, because the
4488         constant folder runs completely in the Resolve phase.
4489
4490         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
4491         well.
4492
4493 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
4494
4495         * cfold.cs: New file, this file contains the constant folder.
4496         
4497         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
4498         argument to track whether we are using the resulting address to
4499         load or store a value and provide better error messages. 
4500
4501         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
4502         new AddressOf arguments.
4503
4504         * statement.cs (Foreach.EmitCollectionForeach): Update
4505
4506         * expression.cs (Argument.Emit): Call AddressOf with proper
4507         arguments to track usage.
4508
4509         (New.DoEmit): Call AddressOf with new arguments.
4510
4511         (Unary.Emit): Adjust AddressOf call.
4512
4513 2002-03-01  Ravi Pratap  <ravi@ximian.com>
4514
4515         * cs-parser.jay (member_access): Change the case for pre-defined types
4516         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
4517         this suggestion.
4518
4519         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
4520         a method body.
4521
4522         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
4523         essentially like methods and apply attributes like MethodImplOptions to them too.
4524
4525         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
4526         not being null.
4527
4528         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
4529         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
4530         is the DeclSpace.
4531
4532         * Update code everywhere accordingly.
4533
4534         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
4535
4536         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
4537
4538 2002-02-28  Ravi Pratap  <ravi@ximian.com>
4539
4540         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
4541         try performing lookups against those instead of jumping straight into using
4542         the 'using' clauses.
4543
4544         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
4545
4546         (LookupType): Perform lookups in implicit parents too.
4547
4548         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
4549         sequence as RootContext.LookupType. 
4550
4551         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
4552         the various cases of namespace lookups into this method.
4553
4554 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
4555
4556         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
4557         in positional arguments)
4558
4559         * class.cs (Operator): Update the AllowedModifiers to contain
4560         extern. 
4561
4562         * cs-parser.jay: Update operator declaration to allow for the
4563         operator body to be empty.
4564
4565         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
4566         values. 
4567
4568 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
4569
4570         * class.cs (Method.Emit): Label parameters.
4571
4572         * driver.cs: Return 1 or 0 as the program exit code.
4573
4574 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
4575
4576         * expression.cs: Special case the `null' object when trying to
4577         auto-compute the type, as anything can be explicitly converted to
4578         that. 
4579
4580         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
4581         spotting this Paolo.
4582
4583         (Expression.ImplicitNumericConversion): Perform comparissions of
4584         the type using the underlying type in the case of an enumeration
4585         rather than using the enumeration type for the compare.
4586
4587         Cope with the underlying == type case, which is not possible to
4588         catch before. 
4589
4590         (Expression.ConvertNumericExplicit): Perform comparissions of
4591         the type using the underlying type in the case of an enumeration
4592         rather than using the enumeration type for the compare.
4593
4594         * driver.cs: If the user does not supply an extension, assume .exe
4595
4596         * cs-parser.jay (if_statement): Rewrote so that we can track the
4597         location for the if statement.
4598
4599         * expression.cs (Binary.ConstantFold): Only concat strings when
4600         the operation is "+", not everything ;-)
4601
4602         * statement.cs (Statement.EmitBoolExpression): Take a location
4603         argument. 
4604         (If, While, Do): Track location.
4605
4606         * expression.cs (Binary.ResolveOperator): In the object + string
4607         case, I was missing a call to ConvertImplicit
4608
4609 2002-02-25  Ravi Pratap  <ravi@ximian.com>
4610
4611         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
4612         Location arguments. Ensure we use RootContext.LookupType to do our work
4613         and not try to do a direct Type.GetType and ModuleBuilder.GetType
4614
4615         * interface.cs (PopulateMethod): Handle the type of the parameter being
4616         null gracefully.
4617
4618         * expression.cs (Invocation.BetterFunction): Handle the case when we 
4619         have a params method with no fixed arguments and a call is made with no
4620         arguments.
4621
4622 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
4623
4624         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
4625         the verbatim-string-literal
4626
4627         * support.cs (InternalParameters.ParameterModifier): handle null
4628         fixed parameters.
4629         (InternalParameters.ParameterType): ditto.
4630
4631         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
4632         duplicating the name of the variable parameter.
4633         (GetParameterByName): Fix bug where we were not looking up array
4634         paramters if they were the only present (thanks Paolo!).
4635         (GetParameterInfo): We only have an empty set of types if both
4636         fixed and array are set to null.
4637         (GetParameterInfo-idx): Handle FixedParameter == null
4638
4639         * cs-parser.jay: Handle the case where there is no catch
4640         statements (missing null test).
4641
4642 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
4643
4644         * driver.cs (MainDriver): Be conservative on our command line
4645         handling.
4646
4647         Catch DirectoryNotFoundException when calling GetFiles.
4648         
4649         (SplitPathAndPattern): Used to split the input specification into
4650         a path and a pattern that we can feed to Directory.GetFiles.
4651
4652 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
4653
4654         * statement.cs (Fixed): Implement the last case of the Fixed
4655         statement (string handling).
4656
4657         * expression.cs (StringPtr): New class used to return a char * to
4658         a string;  Used by the Fixed statement.
4659
4660         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
4661
4662         * expression.cs (Binary.ResolveOperator): Remove redundant
4663         MemberLookup pn parent type.
4664         Optimize union call, we do not need a union if the types are the same.
4665         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
4666         type.
4667
4668         Specialize the use of MemberLookup everywhere, instead of using
4669         the default settings. 
4670
4671         (StackAlloc): Implement stackalloc keyword.
4672
4673         * cs-parser.jay: Add rule to parse stackalloc.
4674         
4675         * driver.cs: Handle /h, /help, /?
4676
4677         * expression.cs (MakeByteBlob): Removed the hacks we had in place
4678         before we supported unsafe code.
4679         
4680         * makefile: add --unsafe to the self compilation of mcs.
4681
4682 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
4683
4684         * expression.cs (PointerArithmetic): New class that is used to
4685         perform pointer arithmetic.
4686         (Binary.Resolve): Handle pointer arithmetic
4687         Handle pointer comparission.
4688         (ArrayPtr): Utility expression class that is used to take the
4689         address of an array.
4690
4691         (ElementAccess): Implement array access for pointers
4692         
4693         * statement.cs (Fixed): Implement fixed statement for arrays, we
4694         are missing one more case before we are done.
4695
4696         * expression.cs (Indirection): Implement EmitAssign and set the
4697         ExprClass to Variable.  This allows pointer dereferences to be
4698         treated as variables, and to have values assigned to them.
4699         
4700         * ecore.cs (Expression.StoreFromPtr): New utility function to
4701         store values dereferencing.
4702
4703 2002-02-20  Ravi Pratap  <ravi@ximian.com>
4704
4705         * expression.cs (Binary.ResolveOperator): Ensure that we are
4706         not trying to operate on a void type - this fixes the reported
4707         bug.
4708
4709         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
4710         the parent implementation is sealed.
4711
4712         * ../errors/cs0239.cs : Add.
4713
4714         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
4715
4716         * typemanager.cs (unverifiable_code_type): Corresponds to 
4717         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
4718         which have unsafe code in them.
4719
4720         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
4721         unsafe context.
4722
4723 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
4724
4725         * cs-tokenizer.cs: Add support for @"litreal strings"
4726
4727         Make tokenizer accept pre-processor directives
4728         on any column (remove the old C-like limitation). 
4729
4730         * rootcontext.cs (EmitCode): Emit any global attributes.
4731         (AddGlobalAttributes): Used to keep track of assembly attributes. 
4732
4733         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
4734
4735         * cs-parser.jay: Add support for global attributes.  
4736
4737 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
4738
4739         * expression.cs (Indirection): New helper class.  Unary will
4740         create Indirection classes to be able to implement the
4741         IMemoryLocation interface on it.
4742
4743 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
4744
4745         * cs-parser.jay (fixed_statement): reference the right statement.
4746
4747         * statement.cs (Fixed.Emit): Finish implementing the fixed
4748         statement for the &x case.
4749
4750 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
4751
4752         * class.cs (Property.Define, Method.Define): Remove newslot when
4753         `implementing'.  
4754
4755         * modifiers.cs: My use of NewSlot when `Abstract' was set was
4756         wrong.  NewSlot should only be used if the `new' keyword is present.
4757
4758         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
4759         locating our system dir.  Sorry about this.
4760
4761 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
4762
4763         * driver.cs (GetSystemDir): Compute correctly the location of our
4764         system assemblies.  I was using the compiler directory instead of
4765         the library directory.
4766
4767 2002-02-13  Ravi Pratap  <ravi@ximian.com>
4768
4769         * expression.cs (BetterFunction): Put back in what Miguel commented out
4770         since it is the correct fix. The problem is elsewhere ;-)
4771
4772         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
4773         parameters of the parms method are themselves compatible or not !
4774
4775         (StandardConversionExists): Fix very dangerous bug where we were forgetting
4776         to check that a class implements an interface before saying that an implicit
4777         conversion was allowed. Use ImplementsInterface to do the checking.
4778
4779 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
4780
4781         * class.cs (Method.Define): Track whether we are an explicit
4782         implementation or not.  And only call DefineMethodOverride if we
4783         are an explicit implementation.
4784
4785         (Property.DefineMethod): Ditto.
4786
4787 2002-02-11  Ravi Pratap  <ravi@ximian.com>
4788
4789         * expression.cs (BetterFunction): Catch hideous bug which was
4790          preventing us from detecting ambiguous calls due to implicit casts i.e
4791         cs0121.
4792
4793 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
4794
4795         * support.cs (Pair): Remove un-needed method.  I figured why I was
4796         getting the error in cs-parser.jay, the variable in a foreach loop
4797         is readonly, and the compiler does not really treat this as a variable.
4798
4799         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
4800         instead of EQUALS in grammar.  
4801
4802         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
4803
4804         * expression.cs (Unary.DoResolve): Check whether the argument is
4805         managed or not.
4806
4807 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
4808
4809         * support.cs: Api for Pair to set a value.  Despite the fact that
4810         the variables are public the MS C# compiler refuses to compile
4811         code that accesses the field if the variable is part of a foreach
4812         statement. 
4813
4814         * statement.cs (Fixed): Begin implementation of the fixed
4815         statement.
4816
4817         (Block.AddVariable): Return the VariableInfo on success and null
4818         on failure instead of true/false. 
4819
4820         * cs-parser.jay (foreach): Catch errors on variables already
4821         defined (we were ignoring this value before) and properly unwind
4822         the block hierarchy
4823
4824         (fixed_statement): grammar for the fixed statement.
4825
4826 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
4827
4828         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
4829         pointer types to be incretemented.
4830
4831         (SizeOf): Implement.
4832
4833         * cs-parser.jay (pointer_member_access): Implement
4834         expr->IDENTIFIER production.
4835
4836         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
4837         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
4838         on safe contexts.
4839
4840         (Unary): Implement indirection.
4841
4842         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
4843         use in non-unsafe context).
4844
4845         (SimpleName.DoResolve): Check for pointers in field access on safe
4846         contexts. 
4847
4848         (Expression.LoadFromPtr): Factor the load-indirect code in this
4849         function.  This was duplicated in UnboxCast and ParameterReference
4850
4851 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
4852
4853         * expression.cs (ComposedCast): report an error if a pointer cast
4854         is used in a safe region.
4855
4856         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
4857         pointer type casts in unsafe context.
4858
4859         * codegen.cs (EmitContext): Set up IsUnsafe.
4860
4861         * cs-parser.jay (non_expression_type): Add productions for pointer
4862         casts. 
4863
4864         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
4865         code.  We should not use force into static mode if the method is
4866         not virtual.  Fixes bug in MIS
4867
4868         * statement.cs (Do.Emit, While.Emit, For.Emit,
4869         Statement.EmitBoolExpression): Add support to Do and While to
4870         propagate infinite loop as `I do return' semantics.
4871
4872         Improve the For case to also test for boolean constants.
4873
4874         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
4875         to the list of attributes we can add.
4876
4877         Remove `EmitContext' argument.
4878
4879         * class.cs (Method.Define): Apply parameter attributes.
4880         (Constructor.Define): Apply parameter attributes.
4881         (MethodCore.LabelParameters): Move here the core of labeling
4882         parameters. 
4883
4884         * support.cs (ReflectionParameters.ParameterModifier,
4885         InternalParameters.ParameterModifier): Use IsByRef on the type and
4886         only return the OUT bit for these parameters instead of in/out/ref
4887         flags.
4888
4889         This is because I miss-understood things.  The ParameterInfo.IsIn
4890         and IsOut represent whether the parameter has the [In] and [Out]
4891         attributes set.  
4892
4893 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
4894
4895         * ecore.cs (FieldExpr.Emit): Release temporaries.
4896
4897         * assign.cs (LocalTemporary.Release): new function.
4898
4899         * codegen.cs (EmitContext.GetTemporaryStorage,
4900         EmitContext.FreeTemporaryStorage): Rework the way we deal with
4901         temporary storage.  Now we can "put back" localbuilders when we
4902         are done with them
4903
4904 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
4905
4906         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
4907         need to make a copy of the variable to generate verifiable code.
4908
4909 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
4910
4911         * driver.cs: Compute dynamically the system directory.
4912
4913         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
4914         Slower, but more generally useful.  Used by the abstract
4915         registering implementation. 
4916
4917         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
4918         the rules for the special rule on Type/instances.  First check if
4919         we have the same name, and if so, try that special static path
4920         rather than the instance path.
4921         
4922 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
4923
4924         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
4925         for, while and if.
4926
4927         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
4928         Enum, ValueType, Delegate or Array for non-corlib compiles.
4929
4930         * cs-tokenizer.cs: Catch long identifiers (645)
4931
4932         * typemanager.cs (IndexerPropetyName): Ravi never tested this
4933         piece of code.
4934
4935         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
4936         fix, we were returning too early, so we were not registering
4937         pending methods from abstract classes.
4938
4939         Do not register pending methods if the class is abstract.
4940
4941         * expression.cs (Conditional.DoResolve): Report circular implicit
4942         conversions when we neecd to compute it for conditional
4943         expressions. 
4944
4945         (Is.DoResolve): If the expression is always of the provided type,
4946         flag warning 183.  If the expression can not ever be of the
4947         provided type flag warning 184.
4948
4949         * class.cs: Catch 169 as well.
4950
4951         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
4952         read. 
4953
4954 2002-01-18  Nick Drochak  <ndrochak@gol.com>
4955
4956         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
4957
4958 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
4959
4960         * interface.cs: (PopulateMethod): Check for pointers being defined
4961         only if the unsafe context is active.
4962         (PopulateProperty): ditto.
4963         (PopulateIndexer): ditto.
4964
4965         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
4966         specified.  If pointers are present, make sure that they are
4967         present in an unsafe context.
4968         (Constructor, Constructor.Define): ditto.
4969         (Field, Field.Define): ditto.
4970         (Property, Property.Define): ditto.
4971         (Event, Event.Define): ditto.
4972
4973         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
4974         hashtable if there are classes or structs defined.
4975
4976         * expression.cs (LocalVariableReference.DoResolve): Simplify this
4977         code, as the constant resolution moved.
4978
4979         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
4980         the metadata, so we can flag error 133. 
4981
4982         * decl.cs (MemberCore.UnsafeOK): New function to test that a
4983         pointer is being declared in an unsafe context.
4984
4985 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
4986
4987         * modifiers.cs (Modifiers.Check): Require a Location argument.
4988         Report error 227 for Unsafe use.
4989
4990         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
4991
4992         * statement.cs (For.Emit): If the test is null, then report that
4993         we do `return', as we wont reach anything afterwards.
4994
4995         (Switch.SwitchGoverningType): Track the expression that matched
4996         the conversion.
4997
4998         * driver.cs: Allow negative numbers as an error code to flag.
4999
5000         * cs-parser.jay: Handle 1551.
5001
5002         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
5003
5004 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
5005
5006         * cs-parser.jay: Report 1518 (type declaration can only contain
5007         class, struct, interface, enum or delegate)
5008
5009         (switch_label): Report 1523 (keywords `case' or `default' must
5010         preced code)
5011
5012         (opt_switch_sections): Report 1522 (empty switch)
5013
5014         * driver.cs: Report 1515 (response file specified multiple times)
5015         Report 1516 (Source file specified multiple times).
5016
5017         * expression.cs (Argument.Resolve): Signal 1510
5018
5019         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
5020         access not allowed in static code)
5021
5022 2002-01-11  Ravi Pratap  <ravi@ximian.com>
5023
5024         * typemanager.cs (IsPointerType): Utility method which we are going
5025         to need a lot.
5026
5027         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
5028         the object type, so we take care of that.
5029
5030         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
5031         
5032         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
5033         added to non-params parameters :-)
5034
5035         * typemanager.cs (CSharpName): Include 'void' type too. 
5036
5037         (void_ptr_type): Include in the set of core types.
5038
5039         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
5040         duplicating code.
5041
5042         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
5043         an unsafe context.
5044
5045         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
5046         completely forgotten about it.
5047
5048 2002-01-10  Ravi Pratap  <ravi@ximian.com>
5049
5050         * cs-parser.jay (pointer_type): Add. This begins our implementation
5051         of parsing rules for unsafe code.
5052
5053         (unsafe_statement): Implement.
5054
5055         (embedded_statement): Modify to include the above.
5056
5057         * statement.cs (Unsafe): Implement new class for unsafe blocks.
5058
5059         * codegen.cs (EmitContext.InUnsafe): Add. This determines
5060         if the current context is an unsafe one.
5061
5062         * cs-parser.jay (local_variable_pointer_type): Since local variable types
5063         are handled differently, we need separate rules for them.
5064
5065         (local_variable_declaration): Update to use local_variable_pointer_type
5066         to allow variable declarations of unmanaged pointer types.
5067
5068         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
5069         in unsafe contexts.
5070
5071         * ../errors/cs0214.cs : Add.
5072
5073 2002-01-16  Nick Drochak  <ndrochak@gol.com>
5074
5075         * makefile: remove 'response' file when cleaning.
5076
5077 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
5078
5079         * cs-parser.jay: Report 1524.
5080
5081 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
5082
5083         * typemanager.cs (RegisterMethod): drop checking if we have
5084         registered this from here
5085
5086 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
5087
5088         * class.cs (Method.EmitDestructor): Implement calling our base
5089         destructor. 
5090
5091         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
5092         value of InFinally.
5093
5094         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
5095         this routine and will wrap the call in a try/catch block.  Deal
5096         with the case.
5097
5098 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
5099
5100         * ecore.cs (Expression.MemberLookup): instead of taking a
5101         parameter `same_type' that was used to tell whether we could
5102         access private members we compute our containing type from the
5103         EmitContext.
5104
5105         (FieldExpr): Added partial support for volatile fields.  This does
5106         not work for volatile fields exposed from assemblies, as I can not
5107         figure out how to extract the modreq from it.
5108
5109         Updated all the source files to use this.
5110
5111         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
5112         because it is referenced by MemberLookup very often. 
5113
5114 2002-01-09  Ravi Pratap  <ravi@ximian.com>
5115
5116         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
5117         TypeBuilder.GetCustomAttributes to retrieve what we need.
5118
5119         Get rid of redundant default_member_attr_type as this is the same as
5120         default_member_type which already exists.
5121
5122         * interface.cs, attribute.cs : Update accordingly.
5123         
5124 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
5125
5126         * typemanager.cs: Enable IndexerPropertyName again.  It does not
5127         work for TYpeBuilders though.  Ravi, can you please fix this?
5128
5129         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
5130
5131         * expression.cs (Argument.Emit): Handle the case of ref objects
5132         being passed to ref functions;  
5133
5134         (ParameterReference.EmitLoad): Loads the content of the pointer
5135         without dereferencing.
5136
5137 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
5138
5139         * cs-tokenizer.cs: Implemented the pre-processing expressions.
5140
5141 2002-01-08  Ravi Pratap  <ravi@ximian.com>
5142
5143         * class.cs (Indexer.DefineMethod): Incorporate the interface
5144         type in the name of the method if we are doing explicit interface
5145         implementation.
5146
5147         * expression.cs (ConversionExists): Remove as it is completely obsolete.
5148
5149         (BetterConversion): Fix extremely trivial bug where we were referring to
5150         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
5151         again !
5152
5153         * ../errors/bug16.cs : Add although we have fixed it.
5154
5155 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
5156
5157         * expression.cs (BaseIndexer): Begin implementation.
5158
5159         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
5160
5161         * cs-parser.jay (indexer_declarator): Use qualified_identifier
5162         production directly to remove a shift/reduce, and implement
5163         explicit interface implementation.
5164
5165         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
5166         after a floating point suffix.
5167
5168         * expression.cs (DoNumericPromotions): Improved the conversion for
5169         uint/uint.  If we have a constant, we avoid doing a typecast to a
5170         larger type.
5171
5172         * class.cs (Indexer): Implement explicit interface implementation
5173         for indexers.
5174         
5175 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
5176
5177         * class.cs: make the default instance constructor public and hidebysig.
5178
5179 2001-01-03  Ravi Pratap  <ravi@ximian.com>
5180
5181         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
5182         so we can call it from elsewhere.
5183
5184         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
5185         we emit it internally if the class has a defined indexer; otherwise the user
5186         emits it by decorating the class definition with the DefaultMemberAttribute.
5187
5188         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
5189         attribute is not used on a type which defines an indexer.
5190
5191         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
5192         character when we skip whitespace.
5193
5194         * ../errors/cs0646.cs : Add.
5195
5196 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
5197
5198         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
5199         again. 
5200
5201         * makefile: Add practical target `mcs3.exe' which builds the third
5202         generation compiler. 
5203
5204         * expression.cs (New): Fix structures constructor calling.
5205
5206         * class.cs (Property, Method, Indexer): Emit Final flag on the
5207         method if we are an interface implementation and we are not
5208         abstract. 
5209
5210         * ecore.cs (PropertyExpr): New public field `IsBase', tells
5211         whether this property is referencing a `base' method.
5212
5213         * expression.cs (Invocation.EmitCall): take an extra argument:
5214         is_base, this is used to determine whether the `call' or
5215         `callvirt' opcode should be used.
5216
5217         
5218         * delegate.cs: update EmitCall.
5219
5220         * class.cs (Method.Define): Set NewSlot for the cases where we are
5221         not implementing an interface method.
5222
5223         (Property.Define): ditto.
5224
5225 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
5226
5227         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
5228         'r'.  Allows mcs to parse itself fully.
5229
5230 2002-01-02  Ravi Pratap  <ravi@ximian.com>
5231
5232         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
5233         of the number of initializers that require the InitializeArray method.
5234
5235         (CheckIndices): Store the Expression in all cases - not the plain value. Also
5236         update the above field where necessary.
5237
5238         (MakeByteBlob): Update accordingly.
5239
5240         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
5241         greater than 2.
5242
5243         (EmitDynamicInitializers): Update in accordance with the new optimization.
5244
5245         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
5246         same OpCode applies.
5247
5248         * cs-parser.jay : Fix some glaring errors I introduced.
5249
5250 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
5251
5252         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
5253         so that we can check for name clashes there too.
5254
5255         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
5256         for interface indexers.
5257
5258         * interfaces.cs (Define): Emit the default member attribute.
5259
5260         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
5261         variable was being referred to while setting the value ;-)
5262
5263 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
5264
5265         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
5266         byte-by-byte information when we know the data is zero.
5267
5268         Make the block always a multiple of 4, because
5269         DefineInitializedData has a bug.
5270
5271         * assign.cs: Fix, we should assign from the temporary, not from
5272         the source. 
5273
5274         * expression.cs (MakeByteBlob): Fix my incorrect code.
5275
5276 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
5277
5278         * typemanager.cs (EnumToUnderlying): This function is used to get
5279         the underlying type from an enumeration, because it does not
5280         always work. 
5281
5282         * constant.cs: Use the I4_S form for values between -128 and 127.
5283
5284         * statement.cs (Block.LookupLabel): Looks up a label.
5285         (Block): Drop support for labeled blocks.
5286
5287         (LabeledStatement): New kind of statement that represents a label
5288         only.
5289
5290         (Goto): Finally implement this bad boy.
5291         
5292         * cs-parser.jay: Update to reflect new mechanism to implement
5293         labels.
5294
5295 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
5296
5297         * codegen.cs (EmitContext.This): a codegen property that keeps the
5298         a single instance of this instead of creating many different this
5299         instances. 
5300
5301         * delegate.cs (Delegate.DoResolve): Update to use the property;
5302
5303         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
5304
5305         * expression.cs (BaseAccess.DoResolve): Ditto.
5306
5307 2001-12-29  Ravi Pratap  <ravi@ximian.com>
5308
5309         * typemanager.cs (methodimpl_attr_type): Add to hold the type
5310         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
5311
5312         (InitCoreTypes): Update accordingly.
5313
5314         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
5315         so we can quickly store the state.
5316
5317         (ApplyAttributes): Set the correct implementation flags
5318         for InternalCall methods.
5319
5320 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
5321
5322         * expression.cs (EmitCall): if a method is not virtual, then do
5323         not use callvirt on it.
5324
5325         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
5326         user defined stuff) requires the use of stobj, which takes an
5327         address on the stack instead of an array and an index.  So emit
5328         the Ldelema operation for it.
5329
5330         (EmitStoreOpcode): Use stobj for valuetypes.
5331
5332         (UnaryMutator.EmitCode): Use the right 1 value depending on
5333         whether we are dealing with int64/uint64, float or doubles.
5334
5335         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
5336         constructors that I implemented last night.
5337
5338         (Constructor.IsDefault): Fix to work properly for static
5339         constructors.
5340
5341         * cs-parser.jay (CheckDef): report method signature errors.
5342         Update error number 103 to be 132.
5343
5344         * decl.cs: New AdditionResult enumeration value: MethodExists.
5345         Although we do this check for methods later on in the semantic
5346         analysis, catching repeated default constructors is so easy that
5347         we catch these here. 
5348         
5349         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
5350         promotions code.
5351
5352         (ParameterReference.EmitAssign, Emit): handle
5353         bools as bytes.
5354
5355         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
5356         (ArrayAccess.EmitStoreOpcode): ditto.
5357
5358         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
5359
5360         * expression.cs (MakeByteBlob): Complete all the missing types
5361         (uint, short, ushort, byte, sbyte)
5362
5363         * class.cs: Only init instance field initializers on instance
5364         constructors. 
5365
5366         Rename `constructors' to instance_constructors. 
5367
5368         (TypeContainer.AddConstructor): Only add constructors to the list
5369         if it is not static.
5370
5371         Make sure that we handle default_static_constructor independently
5372         everywhere where we handle instance_constructors
5373
5374 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
5375
5376         * class.cs: Do not lookup or create a base initializer for a
5377         static constructor.
5378
5379         (ConstructorInitializer.Resolve): use the proper type to lookup
5380         for constructors.
5381
5382         * cs-parser.jay: Report error 1585 (modifiers between type and name).
5383
5384         * enum.cs, interface.cs: Remove CloseType, this is taken care by
5385         in DeclSpace. 
5386
5387         * decl.cs: CloseType is now an virtual method, the default
5388         implementation just closes this type.
5389         
5390 2001-12-28  Ravi Pratap  <ravi@ximian.com>
5391
5392         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
5393         to PreserveSig by default. Also emit HideBySig on such methods.
5394
5395         Basically, set the defaults to standard values.
5396
5397         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
5398         argument, if candidate is better, it can't be worse than the best !
5399
5400         (Invocation): Re-write bits to differentiate between methods being
5401         applicable in their expanded form and their normal form - for params
5402         methods of course.
5403
5404         Get rid of use_standard everywhere as only standard conversions are allowed
5405         in overload resolution. 
5406
5407         More spec conformance.
5408         
5409 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
5410
5411         * driver.cs: Add --timestamp, to see where the compiler spends
5412         most of its time.
5413
5414         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
5415         `this' in static code.
5416
5417         (SimpleName.DoResolve): Implement in terms of a helper function
5418         that allows static-references to be passed upstream to
5419         MemberAccess.
5420
5421         (Expression.ResolveWithSimpleName): Resolve specially simple
5422         names when called by MemberAccess to implement the special
5423         semantics. 
5424
5425         (Expression.ImplicitReferenceConversion): Handle conversions from
5426         Null to reference types before others, as Null's type is
5427         System.Object. 
5428
5429         * expression.cs (Invocation.EmitCall): Handle the special case of
5430         calling methods declared on a reference type from a ValueType
5431         (Base classes System.Object and System.Enum)
5432
5433         (MemberAccess.Resolve): Only perform lookups on Enumerations if
5434         the left hand side is a TypeExpr, not on every enumeration. 
5435
5436         (Binary.Resolve): If types are reference types, then do a cast to
5437         object on operators != and == of both arguments.
5438         
5439         * typemanager.cs (FindMembers): Extract instance and static
5440         members if requested.
5441
5442         * interface.cs (PopulateProperty): Use void_type instead of null
5443         as the return type for the setter method.
5444
5445         (PopulateIndexer): ditto.
5446
5447 2001-12-27  Ravi Pratap  <ravi@ximian.com>
5448
5449         * support.cs (ReflectionParameters): Fix minor bug where we
5450         were examining the wrong parameter for the ParamArray attribute.
5451
5452         Cope with requests for the type of the parameter at position
5453         greater than the params parameter's. We now return the element
5454         type of the params array as that makes more sense.
5455
5456         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
5457         accordingly as we no longer have to extract the element type
5458         ourselves.
5459
5460         (Invocation.OverloadResolve): Update.
5461
5462 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
5463
5464         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
5465         against IEnumerator, test whether the return value is a descendant
5466         of the IEnumerator interface.
5467
5468         * class.cs (Indexer.Define): Use an auxiliary method to implement
5469         the other bits of the method definition.  Begin support for
5470         explicit interface implementation.
5471
5472         (Property.DefineMethod): Use TypeManager.void_type instead of null
5473         for an empty return value.
5474
5475 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
5476
5477         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
5478         dealing with a FieldExpr which is composed of a FieldBuilder, in
5479         the code path we did extract the constant, but we should have
5480         obtained the underlying value to be able to cast it (otherwise we
5481         end up in an infinite loop, this is what Ravi was running into).
5482
5483         (ArrayCreation.UpdateIndices): Arrays might be empty.
5484
5485         (MemberAccess.ResolveMemberAccess): Add support for section
5486         14.5.4.1 that deals with the special case of E.I when E is a type
5487         and something else, that I can be a reference to a static member.
5488
5489         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
5490         handle a particular array type to create byte blobs, it is just
5491         something we dont generate byteblobs for.
5492
5493         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
5494         arguments. 
5495
5496         * location.cs (Push): remove the key from the hashtable that we
5497         are about to add.   This happens for empty files.
5498
5499         * driver.cs: Dispose files after we have parsed them.
5500
5501         (tokenize): new function that only runs the tokenizer on its
5502         input, for speed testing.
5503
5504 2001-12-26  Ravi Pratap  <ravi@ximian.com>
5505
5506         * class.cs (Event.Define): Define the private field only if there
5507         are no accessors defined.
5508
5509         * expression.cs (ResolveMemberAccess): If there is no associated
5510         field with the event, that means we have an event defined with its
5511         own accessors and we should flag error cs0070 since transforming
5512         ourselves into a field is not valid in that case.
5513
5514         * ecore.cs (SimpleName.DoResolve): Same as above.
5515
5516         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
5517         and charset to sane values.
5518
5519 2001-12-25  Ravi Pratap  <ravi@ximian.com>
5520
5521         * assign.cs (DoResolve): Perform check on events only if they 
5522         are being accessed outside the declaring type.
5523
5524         * cs-parser.jay (event_declarations): Update rules to correctly
5525         set the type of the implicit parameter etc.
5526
5527         (add_accessor, remove_accessor): Set current local parameters.
5528
5529         * expression.cs (Binary): For delegate addition and subtraction,
5530         cast the return value from the method into the appropriate delegate
5531         type.
5532
5533 2001-12-24  Ravi Pratap  <ravi@ximian.com>
5534
5535         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
5536         of these as the workaround is unnecessary.
5537
5538         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
5539         delegate data - none of that is needed at all.
5540
5541         Re-write bits to extract the instance expression and the delegate method
5542         correctly.
5543
5544         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
5545         on delegates too.
5546
5547         * attribute.cs (ApplyAttributes): New method to take care of common tasks
5548         of attaching attributes instead of duplicating code everywhere.
5549
5550         * everywhere : Update code to do attribute emission using the above method.
5551
5552 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
5553
5554         * expression.cs (IsParamsMethodApplicable): if there are not
5555         parameters, return immediately.
5556
5557         * ecore.cs: The 0 literal can be implicity converted to an enum
5558         type. 
5559
5560         (SimpleName.DoResolve): First lookup the type, then lookup the
5561         members. 
5562
5563         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
5564         want to get its address.  If the InstanceExpression is not
5565         addressable, store the result in a temporary variable, then get
5566         the address of it.
5567
5568         * codegen.cs: Only display 219 errors on warning level or above. 
5569
5570         * expression.cs (ArrayAccess): Make it implement the
5571         IMemoryLocation interface.
5572
5573         (Binary.DoResolve): handle the operator == (object a, object b)
5574         and operator != (object a, object b) without incurring into a
5575         BoxedCast (because 5 != o should never be performed).
5576
5577         Handle binary enumerator operators.
5578
5579         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
5580         value type, otherwise use Ldelem_ref.
5581
5582         Use precomputed names;
5583
5584         (AddressOf): Implement address of
5585
5586         * cs-parser.jay (labeled_statement): Fix recursive block
5587         addition by reworking the production.
5588
5589         * expression.cs (New.DoEmit): New has a special case:
5590                 
5591                  If we are dealing with a ValueType, we have a few
5592                  situations to deal with:
5593                 
5594                     * The target of New is a ValueType variable, that is
5595                       easy, we just pass this as the variable reference
5596                 
5597                     * The target of New is being passed as an argument,
5598                       to a boxing operation or a function that takes a
5599                       ValueType.
5600                 
5601                       In this case, we need to create a temporary variable
5602                       that is the argument of New.
5603
5604
5605 2001-12-23  Ravi Pratap  <ravi@ximian.com>
5606
5607         * rootcontext.cs (LookupType): Check that current_type is not null before
5608         going about looking at nested types.
5609
5610         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
5611         not implement the IAssignMethod interface any more.
5612
5613         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
5614         where we tranform them into FieldExprs if they are being resolved from within
5615         the declaring type.
5616
5617         * ecore.cs (SimpleName.DoResolve): Do the same here.
5618
5619         * assign.cs (DoResolve, Emit): Clean up code considerably. 
5620
5621         * ../errors/bug10.cs : Add.
5622
5623         * ../errors/cs0070.cs : Add.
5624
5625         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
5626
5627         * assign.cs : Get rid of EventIsLocal everywhere.
5628         
5629 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
5630
5631         * ecore.cs (ConvertIntLiteral): finished the implementation.
5632
5633         * statement.cs (SwitchLabel): Convert the value we are using as a
5634         key before looking up the table.
5635
5636 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
5637
5638         * codegen.cs (EmitTopBlock): Require a Location argument now.
5639
5640         * cs-parser.jay (constructor_declarator): We need to setup
5641         current_local_parameters before we parse the
5642         opt_constructor_initializer, to allow the variables to be bound
5643         to the constructor arguments.
5644
5645         * rootcontext.cs (LookupType): First lookup nested classes in our
5646         class and our parents before we go looking outside our class.
5647
5648         * expression.cs (ConstantFold): Extract/debox the values at the
5649         beginnning. 
5650
5651         * rootcontext.cs (EmitCode): Resolve the constants first before we
5652         resolve the types.  This is not really needed, but it helps debugging.
5653
5654         * statement.cs: report location.
5655         
5656         * cs-parser.jay: pass location to throw statement.
5657
5658         * driver.cs: Small bug fix.
5659
5660         * report.cs: Updated format to be 4-zero filled digits.
5661
5662 2001-12-22  Ravi Pratap  <ravi@ximian.com>
5663
5664         * expression.cs (CheckIndices): Fix minor bug where the wrong
5665         variable was being referred to ;-)
5666
5667         (DoEmit): Do not call EmitStaticInitializers when the 
5668         underlying type is System.Object.
5669
5670 2001-12-21  Ravi Pratap  <ravi@ximian.com>
5671
5672         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
5673         and do the usual workaround for SRE.
5674
5675         * class.cs (MyEventBuilder.EventType): New member to get at the type
5676         of the event, quickly.
5677
5678         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
5679
5680         * assign.cs (Assign.DoResolve): Handle the case when the target
5681         is an EventExpr and perform the necessary checks.
5682
5683         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
5684         interface.
5685
5686         (SimpleName.MemberStaticCheck): Include check for EventExpr.
5687
5688         (EventExpr): Set the type in the constructor itself since we 
5689         are meant to be born fully resolved.
5690
5691         (EventExpr.Define): Revert code I wrote earlier.
5692                 
5693         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
5694         instance expression is null. The instance expression is a This in that case
5695         or a null, depending on whether it is a static method or not.
5696
5697         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
5698         refers to more than one method.
5699
5700         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
5701         and accordingly flag errors.
5702
5703 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
5704
5705         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
5706
5707 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
5708
5709         * location.cs (ToString): Provide useful rutine.
5710
5711 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
5712
5713         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
5714         objects, return the actual integral boxed.
5715
5716         * statement.cs (SwitchLabel): define an ILLabel for each
5717         SwitchLabel. 
5718         
5719         (Switch.CheckSwitch): If the value is a Literal, extract
5720         the underlying literal.
5721         
5722         Also in the unused hashtable we had, add the SwitchLabel so we can
5723         quickly look this value up.
5724
5725         * constant.cs: Implement a bunch of new constants.  Rewrite
5726         Literal based on this.  Made changes everywhere to adapt to this.
5727         
5728         * expression.cs (Expression.MakeByteBlob): Optimize routine by
5729         dereferencing array only once, and also copes with enumrations.
5730
5731         bytes are two bytes wide, not one.
5732
5733         (Cast): Perform constant conversions.
5734         
5735         * ecore.cs (TryImplicitIntConversion): Return literals instead of
5736         wrappers to the literals here.
5737
5738         * expression.cs (DoNumericPromotions): long literals can converted
5739         to ulong implicity (this is taken care of elsewhere, but I was
5740         missing this spot).
5741
5742         * ecore.cs (Expression.Literalize): Make the return type Literal,
5743         to improve type checking.
5744
5745         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
5746
5747 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
5748
5749         * literal.cs: Revert code from ravi that checked the bounds.  The
5750         bounds are sane by the definition of the type itself. 
5751
5752         * typemanager.cs: Fix implementation of ImplementsInterface.  We
5753         need to actually look up in our parent hierarchy for interfaces
5754         implemented. 
5755
5756         * const.cs: Use the underlying type for enumerations
5757
5758         * delegate.cs: Compute the basename for the delegate creation,
5759         that should fix the delegate test case, and restore the correct
5760         Type Lookup semantics in rootcontext
5761
5762         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
5763         referencing a nested type with the Reflection API is using the "+"
5764         sign. 
5765
5766         * cs-parser.jay: Do not require EOF token at the end.
5767
5768 2001-12-20  Ravi Pratap  <ravi@ximian.com>
5769
5770         * rootcontext.cs (LookupType): Concatenate type names with
5771         a '.' instead of a '+' The test suite passes again.
5772
5773         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
5774         field of the enumeration.
5775
5776         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
5777         the case when the member is an EventExpr.
5778
5779         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
5780         static has an associated instance expression.
5781
5782         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
5783
5784         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
5785
5786         * class.cs (Event.Define): Register event and perform appropriate checks
5787         for error #111.
5788
5789         We define the Add and Remove methods even if the use provides none because
5790         in that case, we provide default implementations ourselves.
5791
5792         Define a private field of the type of the event. This is done by the CSC compiler
5793         and we should be doing it too ;-)
5794
5795         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
5796         More methods we use in code we generate.
5797
5798         (multicast_delegate_type, delegate_type): Two separate types since the distinction
5799         is important.
5800
5801         (InitCoreTypes): Update accordingly for the above.
5802
5803         * class.cs (Event.Emit): Generate code for default accessors that we provide
5804
5805         (EmitDefaultMethod): Do the job in the above.
5806
5807         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
5808         appropriate place.
5809
5810 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
5811
5812         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
5813         builders even if we were missing one.
5814
5815         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
5816         pass the Basename as our class name instead of the Name.  The
5817         basename will be correctly composed for us.
5818
5819         * parameter.cs (Paramters): Now takes a Location argument.
5820
5821         * decl.cs (DeclSpace.LookupType): Removed convenience function and
5822         make all the code call directly LookupType in RootContext and take
5823         this chance to pass the Location information everywhere.
5824
5825         * Everywhere: pass Location information.
5826
5827 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
5828
5829         * class.cs (Constructor.Define): Updated way of detecting the
5830         length of the parameters.
5831
5832         (TypeContainer.DefineType): Use basename as the type name for
5833         nested types.
5834
5835         (TypeContainer.Define): Do not recursively define types here, as
5836         definition is taken care in order by the RootContext.
5837
5838         * tree.cs: Keep track of namespaces in a per-file basis.
5839
5840         * parameter.cs (Parameter.ComputeSignature): Update to use
5841         DeclSpace. 
5842
5843         (Parameters.GetSignature): ditto.
5844
5845         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
5846         instead of a TypeContainer.
5847
5848         (Interface.SemanticAnalysis): Use `this' instead of our parent to
5849         resolve names.  Because we need to be resolve in our context, not
5850         our parents.
5851         
5852         * driver.cs: Implement response files.
5853
5854         * class.cs (TypeContainer.DefineType): If we are defined, do not
5855         redefine ourselves.
5856         
5857         (Event.Emit): Emit the code for add/remove handlers.
5858         (Event.Define): Save the MethodBuilders for add/remove.
5859
5860         * typemanager.cs: Use pair here too.
5861
5862         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
5863         DictionaryEntry requires the first argument to be non-null.  
5864         
5865         (enum_declaration): Compute full name for registering the
5866         enumeration.
5867         
5868         (delegate_declaration): Instead of using
5869         formal_parameter_list, use opt_formal_parameter_list as the list
5870         can be empty.
5871
5872         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
5873         (EventParsing): New property that controls whether `add' and
5874         `remove' are returned as tokens or identifiers (for events);
5875
5876 2001-12-19  Ravi Pratap  <ravi@ximian.com>
5877
5878         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
5879         use MyEventBuilder only and let it wrap the real builder for us.
5880
5881         (MyEventBuilder): Revamp constructor etc.
5882
5883         Implement all operations that we perform on EventBuilder in precisely the same
5884         way here too.
5885
5886         (FindMembers): Update to use the EventBuilder member.
5887
5888         (Event.Emit): Update accordingly.
5889
5890 2001-12-18  Ravi Pratap  <ravi@ximian.com>
5891
5892         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
5893         by calling the appropriate methods.
5894
5895         (GetCustomAttributes): Make stubs as they cannot possibly do anything
5896         useful.
5897
5898         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
5899
5900 2001-12-17  Ravi Pratap  <ravi@ximian.com>
5901
5902         * delegate.cs (Delegate.Populate): Check that the return type
5903         and various parameters types are indeed accessible.
5904
5905         * class.cs (Constructor.Define): Same here.
5906
5907         (Field.Define): Ditto.
5908
5909         (Event.Define): Ditto.
5910
5911         (Operator.Define): Check that the underlying Method defined itself
5912         correctly - so it's MethodBuilder should not be null.
5913
5914         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
5915         expression happens to be null.
5916
5917         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
5918         members but as of now we don't seem to be able to do anything really useful with it.
5919
5920         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
5921         not the EventBuilder.
5922
5923 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
5924
5925         * cs-tokenizer.cs: Add support for defines.
5926         Add support for #if, #elif, #else, #endif
5927         
5928         (eval_var): evaluates a variable.
5929         (eval): stubbed for evaluating functions.
5930
5931         * cs-parser.jay: Pass the defines information
5932
5933         * driver.cs: Add --define command line option.
5934
5935         * decl.cs: Move MemberCore here.
5936
5937         Make it the base class for DeclSpace.  This allows us to catch and
5938         report 108 and 109 for everything now.
5939
5940         * class.cs (TypeContainer.Define): Extract all the members
5941         before populating and emit the warning 108 (new keyword required
5942         to override) instead of having each member implement this.
5943
5944         (MemberCore.Define): New abstract method, we will be using this in
5945         the warning reporting engine in Populate.
5946         
5947         (Operator.Define): Adjust to new MemberCore protocol. 
5948
5949         * const.cs (Const): This does not derive from Expression, it is a
5950         temporary object we use to create fields, it is a MemberCore. 
5951
5952         * class.cs (Method.Define): Allow the entry point to be in a
5953         specific class.
5954
5955         * driver.cs: Rewrite the argument handler to clean it up a bit.
5956
5957         * rootcontext.cs: Made it just an auxiliary namespace feature by
5958         making everything static.
5959
5960         * driver.cs: Adapt code to use RootContext type name instead of
5961         instance variable.
5962
5963         * delegate.cs: Remove RootContext argument.
5964
5965         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
5966         argument. 
5967
5968         * class.cs (Event.Define): The lookup can fail.
5969         
5970         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
5971
5972         * expression.cs: Resolve the this instance before invoking the code.
5973
5974 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
5975
5976         * cs-parser.jay: Add a production in element_access that allows
5977         the thing to become a "type" reference.  This way we can parse
5978         things like "(string [])" as a type.
5979
5980         Note that this still does not handle the more complex rules of
5981         casts. 
5982         
5983
5984         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
5985
5986         * ecore.cs: (CopyNewMethods): new utility function used to
5987         assemble the list of methods from running FindMembers.
5988
5989         (MemberLookup): Rework FindMembers so that 
5990
5991 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
5992
5993         * class.cs (TypeContainer): Remove Delegates who fail to be
5994         defined.
5995
5996         * delegate.cs (Populate): Verify that we dont get null return
5997         values.   TODO: Check for AsAccessible.
5998
5999         * cs-parser.jay: Use basename to emit error 574 (destructor should
6000         have the same name as container class), not the full name.
6001
6002         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
6003         possible representation.  
6004
6005         Also implements integer type suffixes U and L.
6006
6007 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
6008
6009         * expression.cs (ArrayCreation.DoResolve): We need to do the
6010         argument resolution *always*.
6011
6012         * decl.cs: Make this hold the namespace.  Hold the root context as
6013         well.
6014         (LookupType): Move here.
6015
6016         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
6017
6018         * location.cs (Row, Name): Fixed the code, it was always returning
6019         references to the first file.
6020
6021         * interface.cs: Register properties defined through interfaces.
6022
6023         * driver.cs: Add support for globbing on the command line
6024
6025         * class.cs (Field): Make it derive from MemberCore as well.
6026         (Event): ditto.
6027
6028 2001-12-15  Ravi Pratap  <ravi@ximian.com>
6029
6030         * class.cs (Event::Define): Check that the type of the event is a delegate
6031         type else flag error #66.
6032
6033         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
6034         same.
6035
6036         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
6037         values of EntryPoint, CharSet etc etc.
6038
6039         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
6040
6041         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
6042         be null and we should ignore this. I am not sure if this is really clean. Apparently,
6043         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
6044         which needs this to do its work.
6045
6046         * ../errors/cs0066.cs : Add.
6047
6048 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
6049
6050         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
6051         helper functions.
6052
6053         * class.cs: (MethodSignature.MethodSignature): Removed hack that
6054         clears out the parameters field.
6055         (MemberSignatureCompare): Cleanup
6056
6057         (MemberCore): New base class used to share code between MethodCore
6058         and Property.
6059
6060         (RegisterRequiredImplementations) BindingFlags.Public requires
6061         either BindingFlags.Instace or Static.  Use instance here.
6062
6063         (Property): Refactored code to cope better with the full spec.
6064
6065         * parameter.cs (GetParameterInfo): Return an empty array instead
6066         of null on error.
6067
6068         * class.cs (Property): Abstract or extern properties have no bodies.
6069
6070         * parameter.cs (GetParameterInfo): return a zero-sized array.
6071
6072         * class.cs (TypeContainer.MethodModifiersValid): Move all the
6073         method modifier validation to the typecontainer so we can reuse
6074         this on properties.
6075
6076         (MethodCore.ParameterTypes): return an empty sized array of types.
6077
6078         (Property.Define): Test property modifier validity.
6079
6080         Add tests for sealed/override too.
6081
6082         (Method.Emit): abstract or extern methods have no bodies.
6083
6084 2001-12-14  Ravi Pratap  <ravi@ximian.com>
6085
6086         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
6087         thing.
6088
6089         (Method::Define, ::Emit): Modify accordingly.
6090
6091         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
6092
6093         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
6094
6095         * makefile: Pass in /unsafe.
6096
6097 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
6098
6099         * class.cs (MakeKey): Kill routine.
6100         
6101         * class.cs (TypeContainer.Define): Correctly define explicit
6102         method implementations (they require the full interface name plus
6103         the method name).
6104
6105         * typemanager.cs: Deply the PtrHashtable here and stop using the
6106         lame keys.  Things work so much better.
6107
6108         This of course broke everyone who depended on `RegisterMethod' to
6109         do the `test for existance' test.  This has to be done elsewhere.
6110
6111         * support.cs (PtrHashtable): A hashtable that avoid comparing with
6112         the object stupid Equals method (because, that like fails all over
6113         the place).  We still do not use it.
6114
6115         * class.cs (TypeContainer.SetRequiredInterface,
6116         TypeContainer.RequireMethods): Killed these two routines and moved
6117         all the functionality to RegisterRequiredImplementations.
6118
6119         (TypeContainer.RegisterRequiredImplementations): This routine now
6120         registers all the implementations required in an array for the
6121         interfaces and abstract methods.  We use an array of structures
6122         which can be computed ahead of time to reduce memory usage and we
6123         also assume that lookups are cheap as most classes will not
6124         implement too many interfaces.
6125
6126         We also avoid creating too many MethodSignatures.
6127
6128         (TypeContainer.IsInterfaceMethod): Update and optionally does not
6129         clear the "pending" bit if we find that there are problems with
6130         the declaration.
6131
6132         (TypeContainer.VerifyPendingMethods): Update to report errors of
6133         methods that look like implementations but are not.
6134
6135         (TypeContainer.Define): Add support for explicit interface method
6136         implementation. 
6137         
6138 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
6139
6140         * typemanager.cs: Keep track of the parameters here instead of
6141         being a feature of the TypeContainer.
6142
6143         * class.cs: Drop the registration of parameters here, as
6144         InterfaceMethods are also interface declarations.
6145
6146         * delegate.cs: Register methods with the TypeManager not only with
6147         the TypeContainer.  This code was buggy.
6148
6149         * interface.cs: Full registation here.
6150
6151 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
6152
6153         * expression.cs: Remove reducer for binary expressions, it can not
6154         be done this way.
6155
6156         * const.cs: Put here the code that used to go into constant.cs
6157
6158         * constant.cs: Put here the code for constants, this is a new base
6159         class for Literals.
6160
6161         * literal.cs: Make Literal derive from Constant.
6162
6163 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
6164
6165         * statement.cs (Return.Emit): Report error 157 if the user
6166         attempts to return from a finally block.
6167
6168         (Return.Emit): Instead of emitting a return, jump to the end of
6169         the function.
6170
6171         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
6172         LocalBuilder to store the result of the function.  ReturnLabel is
6173         the target where we jump.
6174         
6175
6176 2001-12-09  Radek Doulik  <rodo@ximian.com>
6177
6178         * cs-parser.jay: remember alias in current namespace
6179
6180         * ecore.cs (SimpleName::DoResolve): use aliases for types or
6181         namespaces
6182
6183         * class.cs (LookupAlias): lookup alias in my_namespace
6184
6185         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
6186         aliases hashtable
6187         (LookupAlias): lookup alias in this and if needed in parent
6188         namespaces
6189
6190 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
6191
6192         * support.cs: 
6193
6194         * rootcontext.cs: (ModuleBuilder) Made static, first step into
6195         making things static.  I need this to avoid passing the
6196         TypeContainer when calling ParameterType.
6197
6198         * support.cs (InternalParameters.ParameterType): Remove ugly hack
6199         that did string manipulation to compute the type and then call
6200         GetType.  Use Parameter.ParameterType instead.
6201
6202         * cs-tokenizer.cs: Consume the suffix for floating values.
6203
6204         * expression.cs (ParameterReference): figure out whether this is a
6205         reference parameter or not.  Kill an extra variable by computing
6206         the arg_idx during emission.
6207
6208         * parameter.cs (Parameters.GetParameterInfo): New overloaded
6209         function that returns whether a parameter is an out/ref value or not.
6210
6211         (Parameter.ParameterType): The type of the parameter (base,
6212         without ref/out applied).
6213         
6214         (Parameter.Resolve): Perform resolution here.
6215         (Parameter.ExternalType): The full type (with ref/out applied).
6216
6217         * statement.cs (Using.Emit, Using.EmitExpression): Implement
6218         support for expressions on the using statement.
6219
6220 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
6221
6222         * statement.cs (Using.EmitLocalVariableDecls): Split the
6223         localvariable handling of the using statement.
6224
6225         (Block.EmitMeta): Keep track of variable count across blocks.  We
6226         were reusing slots on separate branches of blocks.
6227
6228         (Try.Emit): Emit the general code block, we were not emitting it. 
6229
6230         Check the type of the declaration to be an IDisposable or
6231         something that can be implicity converted to it. 
6232
6233         Emit conversions if required.
6234
6235         * ecore.cs (EmptyExpression): New utility class.
6236         (Expression.ImplicitConversionExists): New utility function.
6237
6238 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
6239
6240         * statement.cs (Using): Implement.
6241
6242         * expression.cs (LocalVariableReference): Support read only variables.
6243
6244         * statement.cs: Remove the explicit emit for the Leave opcode.
6245         (VariableInfo): Add a readonly field.
6246
6247 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
6248
6249         * ecore.cs (ConvCast): new class used to encapsulate the various
6250         explicit integer conversions that works in both checked and
6251         unchecked contexts.
6252
6253         (Expression.ConvertNumericExplicit): Use new ConvCast class to
6254         properly generate the overflow opcodes.
6255
6256 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
6257
6258         * statement.cs: The correct type for the EmptyExpression is the
6259         element_type, not the variable type.  Ravi pointed this out.
6260
6261 2001-12-04  Ravi Pratap  <ravi@ximian.com>
6262
6263         * class.cs (Method::Define): Handle PInvoke methods specially
6264         by using DefinePInvokeMethod instead of the usual one.
6265
6266         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
6267         above to do the task of extracting information and defining the method.
6268         
6269 2001-12-04  Ravi Pratap  <ravi@ximian.com>
6270
6271         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
6272         of the condition for string type.
6273
6274         (Emit): Move that here. 
6275
6276         (ArrayCreation::CheckIndices): Keep string literals in their expression
6277         form.
6278
6279         (EmitDynamicInitializers): Handle strings appropriately.
6280
6281 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
6282
6283         * codegen.cs (EmitContext): Replace multiple variables with a
6284         single pointer to the current Switch statement.
6285
6286         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
6287         EmitContext.
6288
6289 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
6290
6291         * statement.cs 
6292
6293         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
6294         default'.
6295         
6296         (Foreach.Emit): Foreach on arrays was not setting
6297         up the loop variables (for break/continue).
6298
6299         (GotoCase): Semi-implented.
6300         
6301 2001-12-03  Ravi Pratap  <ravi@ximian.com>
6302
6303         * attribute.cs (CheckAttribute): Handle system attributes by using
6304         Attribute.GetAttributes to examine information we need.
6305
6306         (GetValidPlaces): Same here.
6307
6308         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
6309
6310         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
6311
6312         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
6313
6314         (Method::Define): Set appropriate flags if we have a DllImport attribute.
6315
6316         (Method::Emit): Handle the case when we are a PInvoke method.
6317
6318 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
6319
6320         * expression.cs: Use ResolveWithSimpleName on compound names.
6321
6322 2001-12-02  Ravi Pratap  <ravi@ximian.com>
6323
6324         * constant.cs (EmitConstant): Make sure we resolve the associated expression
6325         before trying to reduce it.
6326
6327         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
6328
6329         * constant.cs (LookupConstantValue): Implement.
6330
6331         (EmitConstant): Use the above in emitting the constant.
6332
6333         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
6334         that are user-defined by doing a LookupConstantValue on them.
6335
6336         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
6337         too, like above.
6338
6339 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
6340
6341         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
6342
6343         (BaseAccess.DoResolve): Implement.
6344
6345         (MemberAccess.DoResolve): Split this routine into a
6346         ResolveMemberAccess routine that can be used independently
6347
6348 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
6349
6350         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
6351         As that share bits of the implementation.  Is returns a boolean,
6352         while As returns the Type that is being probed.
6353
6354 2001-12-01  Ravi Pratap  <ravi@ximian.com>
6355
6356         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
6357         instead of a Literal - much easier.
6358
6359         (EnumInTransit): Remove - utterly useless :-)
6360
6361         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
6362
6363         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
6364
6365         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
6366         chain when we have no associated expression.
6367
6368 2001-11-30  Ravi Pratap  <ravi@ximian.com>
6369
6370         * constant.cs (Define): Use Location while reporting the errror.
6371
6372         Also emit a warning when 'new' is used and there is no inherited
6373         member to hide.
6374
6375         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
6376         populated.
6377
6378         (LookupEnumValue): Implement to lookup an enum member's value and define it
6379         if necessary.
6380
6381         (Populate): Re-write accordingly to use the above routine.
6382
6383 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
6384
6385         * expression.cs (This): Fix prototype for DoResolveLValue to
6386         override the base class DoResolveLValue.
6387
6388         * cs-parser.cs: Report errors cs574 and cs575 (destructor
6389         declarations) 
6390
6391         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
6392         (we need to load the address of the field here).  This fixes
6393         test-22. 
6394         
6395         (FieldExpr.DoResolveLValue): Call the DoResolve
6396         function to initialize the Instance expression.
6397         
6398         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
6399         correctly the GetEnumerator operation on a value type.
6400
6401         * cs-parser.jay: Add more simple parsing error catches.
6402
6403         * statement.cs (Switch): Add support for string switches.
6404         Handle null specially.
6405
6406         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
6407
6408 2001-11-28  Ravi Pratap  <ravi@ximian.com>
6409
6410         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
6411
6412         (declare_local_constant): New helper function.
6413
6414         * statement.cs (AddConstant): Keep a separate record of constants
6415
6416         (IsConstant): Implement to determine if a variable is a constant.
6417
6418         (GetConstantExpression): Implement.
6419
6420         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
6421
6422         * statement.cs (IsVariableDefined): Re-write.
6423
6424 2001-11-27  Ravi Pratap  <ravi@ximian.com>
6425
6426         * class.cs (TypeContainer::FindMembers): Look for constants
6427         in the case when we are looking for MemberTypes.Field
6428
6429         * expression.cs (MemberAccess::DoResolve): Check that in the
6430         case we are a FieldExpr and a Literal, we are not being accessed
6431         by an instance reference.
6432
6433         * cs-parser.jay (local_constant_declaration): Implement.
6434
6435         (declaration_statement): Implement for constant declarations.
6436
6437 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
6438
6439         * statement.cs (Switch): Catch double defaults.
6440
6441         (Switch): More work on the switch() statement
6442         implementation.  It works for integral values now, need to finish
6443         string support.
6444
6445
6446 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
6447
6448         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
6449         integer literals into other integer literals.  To be used by
6450         switch. 
6451
6452 2001-11-24  Ravi Pratap  <ravi@ximian.com>
6453
6454         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
6455         some memory.
6456
6457         (EmitDynamicInitializers): Cope with the above since we extract data
6458         directly from ArrayData now.
6459
6460         (ExpectInitializers): Keep track of whether initializers are mandatory
6461         or not.
6462
6463         (Bounds): Make it a hashtable to prevent the same dimension being 
6464         recorded for every element in that dimension.
6465
6466         (EmitDynamicInitializers): Fix bug which prevented the Set array method
6467         from being found.
6468
6469         Also fix bug which was causing the indices to be emitted in the reverse
6470         order.
6471
6472 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
6473
6474         * expression.cs (ArrayCreation): Implement the bits that Ravi left
6475         unfinished.  They do not work, because the underlying code is
6476         sloppy.
6477
6478 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
6479
6480         * cs-parser.jay: Remove bogus fixme.
6481
6482         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
6483         on Switch statement.
6484         
6485 2001-11-23  Ravi Pratap  <ravi@ximian.com>
6486
6487         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
6488         the same. 
6489         
6490         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
6491         parameter. Apparently, any expression is allowed. 
6492
6493         (ValidateInitializers): Update accordingly.
6494
6495         (CheckIndices): Fix some tricky bugs thanks to recursion.
6496
6497         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
6498         I was being completely brain-dead.
6499
6500         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
6501         and re-write acordingly.
6502
6503         (DelegateInvocation): Re-write accordingly.
6504
6505         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
6506
6507         (MakeByteBlob): Handle types more correctly.
6508
6509         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
6510         initialization from expressions but it is incomplete because I am a complete
6511         Dodo :-|
6512
6513 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
6514
6515         * statement.cs (If.Emit): Fix a bug that generated incorrect code
6516         on If.  Basically, we have to return `true' (ie, we do return to
6517         our caller) only if both branches of the if return.
6518
6519         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
6520         short-circuit operators, handle them as short circuit operators. 
6521
6522         (Cast.DoResolve): Resolve type.
6523         (Cast.Cast): Take an expression as the target type.
6524
6525         * cs-parser.jay (cast_expression): Remove old hack that only
6526         allowed a limited set of types to be handled.  Now we take a
6527         unary_expression and we resolve to a type during semantic
6528         analysis.
6529
6530         Use the grammar productions from Rhys to handle casts (this is
6531         not complete like Rhys syntax yet, we fail to handle that corner
6532         case that C# has regarding (-x), but we will get there.
6533         
6534 2001-11-22  Ravi Pratap  <ravi@ximian.com>
6535
6536         * class.cs (EmitFieldInitializer): Take care of the case when we have a
6537         field which is an array type.
6538
6539         * cs-parser.jay (declare_local_variables): Support array initialization too.
6540
6541         * typemanager.cs (MakeKey): Implement.
6542
6543         (everywhere): Use the above appropriately.
6544
6545         * cs-parser.jay (for_statement): Update for array initialization while
6546         declaring variables.
6547
6548         * ecore.cs : The error message was correct, it's the variable's names that
6549         were misleading ;-) Make the code more readable.
6550
6551         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
6552         the correct type etc.
6553
6554         (ConvertExplicit): Handle Enum types by examining the underlying type.
6555
6556 2001-11-21  Ravi Pratap  <ravi@ximian.com>
6557
6558         * parameter.cs (GetCallingConvention): Always return
6559         CallingConventions.Standard for now.
6560
6561 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
6562
6563         * expression.cs (Binary.ResolveOperator): Update the values of `l'
6564         and `r' after calling DoNumericPromotions.
6565
6566         * ecore.cs: Fix error message (the types were in the wrong order).
6567
6568         * statement.cs (Foreach.ProbeCollectionType): Need to pass
6569         BindingFlags.Instance as well 
6570
6571         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
6572         implicit int literal conversion in an empty cast so that we
6573         propagate the right type upstream.
6574
6575         (UnboxCast): new class used to unbox value types.
6576         (Expression.ConvertExplicit): Add explicit type conversions done
6577         by unboxing.
6578
6579         (Expression.ImplicitNumericConversion): Oops, forgot to test for
6580         the target type before applying the implicit LongLiterals to ULong
6581         literal cast.
6582
6583 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
6584
6585         * cs-parser.jay (for_statement): Reworked the way For works: now
6586         we declare manually any variables that are introduced in
6587         for_initializer to solve the problem of having out-of-band code
6588         emition (that is what got for broken).
6589
6590         (declaration_statement): Perform the actual variable declaration
6591         that used to be done in local_variable_declaration here.
6592
6593         (local_variable_declaration): Do not declare anything, just pass
6594         the information on a DictionaryEntry
6595
6596 2001-11-20  Ravi Pratap  <ravi@ximian.com>
6597
6598         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
6599         re-write of the logic to now make it recursive.
6600
6601         (UpdateIndices): Re-write accordingly.
6602
6603         Store element data in a separate ArrayData list in the above methods.
6604
6605         (MakeByteBlob): Implement to dump the array data into a byte array.
6606
6607 2001-11-19  Ravi Pratap  <ravi@ximian.com>
6608
6609         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
6610         into CheckIndices.
6611
6612         * constant.cs (Define): Implement.
6613
6614         (EmitConstant): Re-write fully.
6615
6616         Pass in location info.
6617
6618         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
6619         respectively.
6620
6621         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
6622         DictionaryEntry since we need location info too.
6623
6624         (constant_declaration): Update accordingly.
6625
6626         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
6627         code into another method : UpdateIndices.
6628
6629 2001-11-18  Ravi Pratap  <ravi@ximian.com>
6630
6631         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
6632         some type checking etc.
6633
6634 2001-11-17  Ravi Pratap  <ravi@ximian.com>
6635
6636         * expression.cs (ArrayCreation::ValidateInitializers): Implement
6637         bits to provide dimension info if the user skips doing that.
6638
6639         Update second constructor to store the rank correctly.
6640
6641 2001-11-16  Ravi Pratap  <ravi@ximian.com>
6642
6643         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
6644         and try to implement.
6645
6646         * ../errors/cs0150.cs : Add.
6647
6648         * ../errors/cs0178.cs : Add.
6649
6650 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
6651
6652         * statement.cs: Implement foreach on multi-dimensional arrays. 
6653
6654         * parameter.cs (Parameters.GetParameterByName): Also lookup the
6655         name of the params argument.
6656
6657         * expression.cs: Use EmitStoreOpcode to get the right opcode while
6658         initializing the array.
6659
6660         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
6661         we can use this elsewhere.
6662
6663         * statement.cs: Finish implementation of foreach for single
6664         dimension arrays.
6665
6666         * cs-parser.jay: Use an out-of-band stack to pass information
6667         around, I wonder why I need this.
6668
6669         foreach_block: Make the new foreach_block the current_block.
6670
6671         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
6672         function used to return a static Parameters structure.  Used for
6673         empty parameters, as those are created very frequently.
6674
6675         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
6676
6677 2001-11-15  Ravi Pratap  <ravi@ximian.com>
6678
6679         * interface.cs : Default modifier is private, not public. The
6680         make verify test passes again.
6681
6682 2001-11-15  Ravi Pratap  <ravi@ximian.com>
6683
6684         * support.cs (ReflectionParameters): Fix logic to determine
6685         whether the last parameter is a params one. Test 9 passes again.
6686
6687         * delegate.cs (Populate): Register the builders we define with
6688         RegisterParameterForBuilder. Test 19 passes again.
6689
6690         * cs-parser.jay (property_declaration): Reference $6 instead
6691         of $$ to get at the location.
6692
6693         (indexer_declaration): Similar stuff.
6694
6695         (attribute): Ditto.
6696
6697         * class.cs (Property): Register parameters for the Get and Set methods
6698         if they exist. Test 23 passes again.
6699
6700         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
6701         call to EmitArguments as we are sure there aren't any params arguments. 
6702         Test 32 passes again.
6703
6704         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
6705         IndexOutOfRangeException. 
6706
6707         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
6708         Test 33 now passes again.
6709         
6710 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
6711
6712         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
6713         broke a bunch of things.  Will have to come up with a better way
6714         of tracking locations.
6715
6716         * statement.cs: Implemented foreach for single dimension arrays.
6717
6718 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
6719
6720         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
6721         an error.  This removes the lookup from the critical path.
6722
6723         * cs-parser.jay: Removed use of temporary_loc, which is completely
6724         broken. 
6725
6726 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
6727
6728         * support.cs (ReflectionParameters.ParameterModifier): Report
6729         whether the argument is a PARAMS argument or not.
6730
6731         * class.cs: Set the attribute `ParamArrayAttribute' on the
6732         parameter argument.
6733
6734         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
6735         and cons_param_array_attribute (ConstructorInfo for
6736         ParamArrayAttribute)., 
6737
6738         * codegen.cs: Emit the return using the `Return' statement, that
6739         way we can report the error correctly for missing return values. 
6740
6741         * class.cs (Method.Emit): Clean up.
6742
6743         * expression.cs (Argument.Resolve): Take another argument: the
6744         location where this argument is used.  Notice that this is not
6745         part of the "Argument" class as to reduce the size of the
6746         structure (we know the approximate location anyways).
6747
6748         Test if the argument is a variable-reference, if not, then
6749         complain with a 206.
6750
6751         (Argument.Emit): Emit addresses of variables.
6752
6753         (Argument.FullDesc): Simplify.
6754
6755         (Invocation.DoResolve): Update for Argument.Resolve.
6756
6757         (ElementAccess.DoResolve): ditto.
6758
6759         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
6760         method should be virtual, as this method is always virtual.
6761
6762         (NewDelegate.DoResolve): Update for Argument.Resolve.
6763
6764         * class.cs (ConstructorInitializer.DoResolve): ditto.
6765         
6766         * attribute.cs (Attribute.Resolve): ditto.
6767
6768 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
6769
6770         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
6771
6772         * expression.cs (ParameterReference): Drop IStackStorage and implement
6773         IAssignMethod instead. 
6774
6775         (LocalVariableReference): ditto.
6776         
6777         * ecore.cs (FieldExpr): Drop IStackStorage and implement
6778         IAssignMethod instead. 
6779
6780 2001-11-13  Miguel de Icaza <miguel@ximian.com>
6781
6782         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
6783         enumerations that are used in heavily used structures derive from
6784         byte in a laughable and pathetic attempt to reduce memory usage.
6785         This is the kind of pre-optimzations that you should not do at
6786         home without adult supervision.
6787
6788         * expression.cs (UnaryMutator): New class, used to handle ++ and
6789         -- separatedly from the other unary operators.  Cleans up the
6790         code, and kills the ExpressionStatement dependency in Unary.
6791
6792         (Unary): Removed `method' and `Arguments' from this class, making
6793         it smaller, and moving it all to SimpleCall, so I can reuse this
6794         code in other locations and avoid creating a lot of transient data
6795         strucutres when not required.
6796
6797         * cs-parser.jay: Adjust for new changes.
6798
6799 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
6800
6801         * enum.cs (Enum.Populate): If there is a failure during
6802         definition, return
6803
6804         * cs-parser.jay (opt_enum_base): we used to catch type errors
6805         here, but this is really incorrect.  The type error should be
6806         catched during semantic analysis.
6807
6808 2001-12-11  Ravi Pratap  <ravi@ximian.com>
6809
6810         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
6811         current_local_parameters as expected since I, in my stupidity, had forgotten
6812         to do this :-)
6813
6814         * attribute.cs (GetValidPlaces): Fix stupid bug.
6815
6816         * class.cs (Method::Emit): Perform check on applicability of attributes.
6817
6818         (Constructor::Emit): Ditto.
6819
6820         (Field::Emit): Ditto.
6821
6822         (Field.Location): Store location information.
6823
6824         (Property, Event, Indexer, Operator): Ditto.
6825
6826         * cs-parser.jay (field_declaration): Pass in location for each field.
6827
6828         * ../errors/cs0592.cs : Add.
6829
6830 2001-11-12  Ravi Pratap  <ravi@ximian.com>
6831
6832         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
6833
6834         (InitCoreTypes): Update accordingly.
6835
6836         (RegisterAttrType, LookupAttr): Implement.
6837
6838         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
6839         info about the same.
6840
6841         (Resolve): Update to populate the above as necessary.
6842
6843         (Error592): Helper.
6844
6845         (GetValidPlaces): Helper to the above.
6846
6847         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
6848
6849         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
6850
6851 2001-11-12  Ravi Pratap  <ravi@ximian.com>
6852
6853         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
6854
6855         * ../errors/cs0617.cs : Add.
6856
6857 2001-11-11  Ravi Pratap  <ravi@ximian.com>
6858
6859         * enum.cs (Emit): Rename to Populate to be more consistent with what
6860         we expect it to do and when exactly it is called.
6861
6862         * class.cs, rootcontext.cs : Update accordingly.
6863
6864         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
6865         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
6866
6867         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
6868
6869         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
6870         of a fieldinfo using the above, when dealing with a FieldBuilder.
6871
6872 2001-11-10  Ravi Pratap  <ravi@ximian.com>
6873
6874         * ../errors/cs0031.cs : Add.
6875
6876         * ../errors/cs1008.cs : Add.
6877
6878         * ../errrors/cs0543.cs : Add.
6879
6880         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
6881         enum type.
6882
6883         (FindMembers): Implement.
6884
6885         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
6886         enums and delegates too.
6887
6888         (enum_types): Rename to builder_to_enum.
6889
6890         (delegate_types): Rename to builder_to_delegate.
6891
6892         * delegate.cs (FindMembers): Implement.
6893
6894 2001-11-09  Ravi Pratap  <ravi@ximian.com>
6895
6896         * typemanager.cs (IsEnumType): Implement.
6897
6898         * enum.cs (Emit): Re-write parts to account for the underlying type
6899         better and perform checking etc.
6900
6901         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
6902         of the underlying type.
6903
6904         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
6905         value
6906
6907         * enum.cs (error31): Helper to report error #31.
6908
6909         * cs-parser.jay (enum_declaration): Store location of each member too.
6910
6911         * enum.cs (member_to_location): New hashtable. 
6912
6913         (AddEnumMember): Update location hashtable.
6914
6915         (Emit): Use the location of each member while reporting errors.
6916
6917 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
6918
6919         * cs-parser.jay: A for_initializer if is a
6920         local_variable_declaration really ammount to have an implicit
6921         block with the variable declaration and no initializer for for.
6922
6923         * statement.cs (For.Emit): Cope with null initializers.
6924
6925         This fixes the infinite loop on for initializers.
6926
6927 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
6928
6929         * enum.cs: More cleanup.
6930
6931         * ecore.cs: Remove dead code.
6932
6933         * class.cs (Property.Emit): More simplification.
6934         (Event.Emit): ditto.
6935
6936         Reworked to have less levels of indentation.
6937         
6938 2001-11-08  Ravi Pratap  <ravi@ximian.com>
6939
6940         * class.cs (Property): Emit attributes.
6941
6942         (Field): Ditto.
6943         
6944         (Event): Ditto.
6945
6946         (Indexer): Ditto.
6947
6948         (Operator): Ditto.
6949
6950         * enum.cs (Emit): Ditto.
6951
6952         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
6953         Enums too.
6954
6955         * class.cs (Field, Event, etc.): Move attribute generation into the
6956         Emit method everywhere.
6957
6958         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
6959         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
6960         as we had no way of defining nested enums !
6961
6962         * rootcontext.cs : Adjust code accordingly.
6963
6964         * typemanager.cs (AddEnumType): To keep track of enum types separately.
6965
6966 2001-11-07  Ravi Pratap  <ravi@ximian.com>
6967
6968         * expression.cs (EvalConstantExpression): Move into ecore.cs
6969         
6970         * enum.cs (Enum): Rename some members and make them public and readonly
6971         according to our convention.
6972
6973         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
6974         nothing else.
6975
6976         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
6977
6978         (Enum::Emit): Write a simple version for now which doesn't try to compute
6979         expressions. I shall modify this to be more robust in just a while.
6980
6981         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
6982
6983         (TypeContainer::CloseType): Create the Enum types too.
6984
6985         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
6986
6987         * expression.cs (EvalConstantExpression): Get rid of completely.
6988
6989         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
6990         user-defined values and other cases.
6991
6992         (IsValidEnumLiteral): Helper function.
6993
6994         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
6995         out there in the case we had a literal FieldExpr.
6996
6997         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
6998
6999         (Literalize): Revamp a bit to take two arguments.
7000         
7001         (EnumLiteral): New class which derives from Literal to wrap enum literals.
7002         
7003 2001-11-06  Ravi Pratap  <ravi@ximian.com>
7004
7005         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
7006
7007         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
7008
7009         (Resolve): Use the above to ensure we have proper initializers.
7010
7011 2001-11-05  Ravi Pratap  <ravi@ximian.com>
7012
7013         * expression.cs (Expression::EvalConstantExpression): New method to 
7014         evaluate constant expressions.
7015
7016         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
7017
7018 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
7019
7020         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
7021         in an array.
7022
7023         (Binary.ResolveOperator): Handle operator != (object a, object b)
7024         and operator == (object a, object b);
7025
7026         (Binary.DoNumericPromotions): Indicate whether the numeric
7027         promotion was possible.
7028
7029         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
7030         Implement.  
7031
7032         Made the ArrayAccess implement interface IAssignMethod instead of
7033         IStackStore as the order in which arguments are passed reflects
7034         this.
7035
7036         * assign.cs: Instead of using expr.ExprClass to select the way of
7037         assinging, probe for the IStackStore/IAssignMethod interfaces.
7038
7039         * typemanager.cs: Load InitializeArray definition.
7040
7041         * rootcontext.cs (RootContext.MakeStaticData): Used to define
7042         static data that can be used to initialize arrays. 
7043
7044 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
7045
7046         * expression.cs: Handle operator== and operator!= for booleans.
7047
7048         (Conditioal.Reduce): Implement reducer for the ?: operator.
7049
7050         (Conditional.Resolve): Implement dead code elimination.
7051
7052         (Binary.Resolve): Catch string literals and return a new
7053         concatenated string.
7054
7055         (Unary.Reduce): Implement reduction of unary expressions.
7056
7057         * ecore.cs: Split out the expression core handling here.
7058
7059         (Expression.Reduce): New method used to perform constant folding
7060         and CSE.  This is needed to support constant-expressions. 
7061         
7062         * statement.cs (Statement.EmitBoolExpression): Pass true and false
7063         targets, and optimize for !x.
7064
7065 2001-11-04  Ravi Pratap  <ravi@ximian.com>
7066
7067         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
7068         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
7069         set custom atttributes.
7070
7071         * literal.cs (Literal::GetValue): New abstract method to return the actual
7072         value of the literal, cast as an object.
7073
7074         (*Literal): Implement GetValue method.
7075
7076         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
7077         expressions to the arraylist but objects of type Argument.
7078
7079         * class.cs (TypeContainer::Emit): Emit our attributes too.
7080
7081         (Method::Emit, Constructor::Emit): Ditto.
7082
7083         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
7084         to be ignoring earlier.
7085
7086 2001-11-03  Ravi Pratap  <ravi@ximian.com>
7087
7088         * attribute.cs (AttributeSection::Define): Implement to do the business
7089         of constructing a CustomAttributeBuilder.
7090
7091         (Attribute): New trivial class. Increases readability of code.  
7092
7093         * cs-parser.jay : Update accordingly.
7094
7095         (positional_argument_list, named_argument_list, named_argument): New rules
7096
7097         (attribute_arguments): Use the above so that we are more correct.
7098         
7099 2001-11-02  Ravi Pratap  <ravi@ximian.com>
7100         
7101         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
7102         to perform all checks for a method with a params parameter.
7103
7104         (Invocation::OverloadResolve): Update to use the above method and therefore
7105         cope correctly with params method invocations.
7106
7107         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
7108         params too.
7109
7110         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
7111         constructors in our parent too because we can't afford to miss out on 
7112         protected ones ;-)
7113
7114         * attribute.cs (AttributeSection): New name for the class Attribute
7115
7116         Other trivial changes to improve readability.
7117
7118         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
7119         use the new class names.
7120         
7121 2001-11-01  Ravi Pratap  <ravi@ximian.com>
7122
7123         * class.cs (Method::Define): Complete definition for params types too
7124
7125         (Indexer::Define): Ditto.
7126
7127         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
7128         Cope everywhere with a request for info about the array parameter.
7129
7130 2001-11-01  Ravi Pratap  <ravi@ximian.com>
7131
7132         * tree.cs (RecordNamespace): Fix up to check for the correct key.
7133
7134         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
7135         local_variable_type to extract the string corresponding to the type.
7136
7137         (local_variable_type): Fixup the action to use the new helper method.
7138
7139         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
7140         go.
7141
7142         * expression.cs : Clean out code which uses the above.
7143
7144 2001-10-31  Ravi Pratap  <ravi@ximian.com>
7145         
7146         * typemanager.cs (RegisterMethod): Check if we already have an existing key
7147         and bale out if necessary by returning a false.
7148
7149         (RegisterProperty): Ditto.
7150
7151         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
7152         and print out appropriate error messages.
7153
7154         * interface.cs (everywhere): Ditto.
7155
7156         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
7157         location to constructor.
7158
7159         * class.cs (Property, Event, Indexer): Update accordingly.
7160
7161         * ../errors/cs111.cs : Added.
7162
7163         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
7164         of a method, as laid down by the spec.
7165
7166         (Invocation::OverloadResolve): Use the above method.
7167
7168 2001-10-31  Ravi Pratap  <ravi@ximian.com>
7169
7170         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
7171         now take a TypeContainer and a Parameters object.
7172
7173         (ParameterData): Modify return type of ParameterModifier method to be 
7174         Parameter.Modifier and not a string.
7175
7176         (ReflectionParameters, InternalParameters): Update accordingly.
7177
7178         * expression.cs (Argument::GetParameterModifier): Same here.
7179
7180         * support.cs (InternalParameters::ParameterType): Find a better way of determining
7181         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
7182         symbol in it at all so maybe this is only for now.
7183
7184 2001-10-30  Ravi Pratap  <ravi@ximian.com>
7185
7186         * support.cs (InternalParameters): Constructor now takes an extra argument 
7187         which is the actual Parameters class.
7188
7189         (ParameterDesc): Update to provide info on ref/out modifiers.
7190
7191         * class.cs (everywhere): Update call to InternalParameters to pass in
7192         the second argument too.
7193
7194         * support.cs (ParameterData): Add ParameterModifier, which is a method 
7195         to return the modifier info [ref/out etc]
7196
7197         (InternalParameters, ReflectionParameters): Implement the above.
7198
7199         * expression.cs (Argument::ParameterModifier): Similar function to return
7200         info about the argument's modifiers.
7201
7202         (Invocation::OverloadResolve): Update to take into account matching modifiers 
7203         too.
7204
7205         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
7206         a new SetFormalParameters object which we pass to InternalParameters.
7207
7208 2001-10-30  Ravi Pratap  <ravi@ximian.com>
7209
7210         * expression.cs (NewArray): Merge into the ArrayCreation class.
7211
7212 2001-10-29  Ravi Pratap  <ravi@ximian.com>
7213
7214         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
7215         NewUserdefinedArray into one as there wasn't much of a use in having
7216         two separate ones.
7217
7218         * expression.cs (Argument): Change field's name to ArgType from Type.
7219
7220         (Type): New readonly property which returns the proper type, taking into 
7221         account ref/out modifiers.
7222
7223         (everywhere): Adjust code accordingly for the above.
7224
7225         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
7226         whether we are emitting for a ref or out parameter.
7227
7228         * expression.cs (Argument::Emit): Use the above field to set the state.
7229
7230         (LocalVariableReference::Emit): Update to honour the flag and emit the
7231         right stuff.
7232
7233         * parameter.cs (Attributes): Set the correct flags for ref parameters.
7234
7235         * expression.cs (Argument::FullDesc): New function to provide a full desc.
7236
7237         * support.cs (ParameterData): Add method ParameterDesc to the interface.
7238
7239         (ReflectionParameters, InternalParameters): Implement the above method.
7240
7241         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
7242         reporting errors.
7243
7244         (Invocation::FullMethodDesc): Ditto. 
7245
7246 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
7247
7248         * cs-parser.jay: Add extra production for the second form of array
7249         creation. 
7250
7251         * expression.cs (ArrayCreation): Update to reflect the above
7252         change. 
7253
7254         * Small changes to prepare for Array initialization.
7255
7256 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
7257
7258         * typemanager.cs (ImplementsInterface): interface might be null;
7259         Deal with this problem;
7260
7261         Also, we do store negative hits on the cache (null values), so use
7262         this instead of calling t.GetInterfaces on the type everytime.
7263
7264 2001-10-28  Ravi Pratap  <ravi@ximian.com>
7265
7266         * typemanager.cs (IsBuiltinType): New method to help determine the same.
7267
7268         * expression.cs (New::DoResolve): Get rid of array creation code and instead
7269         split functionality out into different classes.
7270
7271         (New::FormArrayType): Move into NewBuiltinArray.
7272
7273         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
7274         quite useless.
7275
7276         (NewBuiltinArray): New class to handle creation of built-in arrays.
7277
7278         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
7279         account creation of one-dimensional arrays.
7280
7281         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
7282
7283         (NewUserdefinedArray::DoResolve): Implement.
7284
7285         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
7286
7287         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
7288         we maintain inside the TypeManager. This is necessary to perform lookups on the
7289         module builder.
7290
7291         (LookupType): Update to perform GetType on the module builders too.     
7292
7293         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
7294
7295         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
7296
7297 2001-10-23  Ravi Pratap  <ravi@ximian.com>
7298
7299         * expression.cs (New::DoResolve): Implement guts of array creation.
7300
7301         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
7302         
7303 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
7304
7305         * expression.cs: Fix bug I introduced lsat night that broke
7306         Delegates. 
7307
7308         (Expression.Resolve): Report a 246 error (can not resolve name)
7309         if we find a SimpleName in the stream.
7310         
7311         (Expression.ResolveLValue): Ditto.
7312         
7313         (Expression.ResolveWithSimpleName): This function is a variant of
7314         ResolveName, this one allows SimpleNames to be returned without a
7315         warning.  The only consumer of SimpleNames is MemberAccess
7316
7317 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
7318
7319         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
7320         might arrive here.  I have my doubts that this is correct.
7321
7322         * statement.cs (Lock): Implement lock statement.
7323
7324         * cs-parser.jay: Small fixes to support `lock' and `using'
7325
7326         * cs-tokenizer.cs: Remove extra space
7327
7328         * driver.cs: New flag --checked, allows to turn on integer math
7329         checking. 
7330
7331         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
7332         Threading.Monitor.Exit 
7333         
7334 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
7335
7336         * expression.cs (IndexerAccess::DoResolveLValue): Set the
7337         Expression Class to be IndexerAccess.
7338
7339         Notice that Indexer::DoResolve sets the eclass to Value.
7340
7341 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
7342
7343         * class.cs (TypeContainer::Emit): Emit code for indexers.
7344
7345         * assign.cs (IAssignMethod): New interface implemented by Indexers
7346         and Properties for handling assignment.
7347
7348         (Assign::Emit): Simplify and reuse code. 
7349         
7350         * expression.cs (IndexerAccess, PropertyExpr): Implement
7351         IAssignMethod, clean up old code. 
7352
7353 2001-10-22  Ravi Pratap  <ravi@ximian.com>
7354
7355         * typemanager.cs (ImplementsInterface): New method to determine if a type
7356         implements a given interface. Provides a nice cache too.
7357
7358         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
7359         method.
7360
7361         (ConvertReferenceExplicit): Ditto.
7362
7363         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
7364         various methods, with correct names etc.
7365
7366         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
7367         Operator.UnaryNegation.
7368
7369         * cs-parser.jay (operator_declarator): Be a little clever in the case where
7370         we have a unary plus or minus operator.
7371
7372         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
7373         UnaryMinus.
7374
7375         * everywhere : update accordingly.
7376
7377         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
7378         respectively.
7379
7380         * class.cs (Method::Define): For the case where we are implementing a method
7381         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
7382         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
7383         
7384 2001-10-21  Ravi Pratap  <ravi@ximian.com>
7385
7386         * interface.cs (FindMembers): Implement to work around S.R.E
7387         lameness.
7388
7389         * typemanager.cs (IsInterfaceType): Implement.
7390
7391         (FindMembers): Update to handle interface types too.
7392
7393         * expression.cs (ImplicitReferenceConversion): Re-write bits which
7394         use IsAssignableFrom as that is not correct - it doesn't work.
7395
7396         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
7397         and accordingly override EmitStatement.
7398
7399         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
7400         using the correct logic :-)
7401
7402 2001-10-19  Ravi Pratap  <ravi@ximian.com>
7403
7404         * ../errors/cs-11.cs : Add to demonstrate error -11 
7405
7406 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
7407
7408         * assign.cs (Assign::Resolve): Resolve right hand side first, and
7409         then pass this as a hint to ResolveLValue.
7410         
7411         * expression.cs (FieldExpr): Add Location information
7412
7413         (FieldExpr::LValueResolve): Report assignment to readonly
7414         variable. 
7415         
7416         (Expression::ExprClassFromMemberInfo): Pass location information.
7417
7418         (Expression::ResolveLValue): Add new method that resolves an
7419         LValue. 
7420
7421         (Expression::DoResolveLValue): Default invocation calls
7422         DoResolve. 
7423
7424         (Indexers): New class used to keep track of indexers in a given
7425         Type. 
7426
7427         (IStackStore): Renamed from LValue, as it did not really describe
7428         what this did.  Also ResolveLValue is gone from this interface and
7429         now is part of Expression.
7430
7431         (ElementAccess): Depending on the element access type
7432         
7433         * typemanager.cs: Add `indexer_name_type' as a Core type
7434         (System.Runtime.CompilerServices.IndexerNameAttribute)
7435
7436         * statement.cs (Goto): Take a location.
7437         
7438 2001-10-18  Ravi Pratap  <ravi@ximian.com>
7439
7440         * delegate.cs (Delegate::VerifyDelegate): New method to verify
7441         if two delegates are compatible.
7442
7443         (NewDelegate::DoResolve): Update to take care of the case when
7444         we instantiate a delegate from another delegate.
7445
7446         * typemanager.cs (FindMembers): Don't even try to look up members
7447         of Delegate types for now.
7448
7449 2001-10-18  Ravi Pratap  <ravi@ximian.com>
7450
7451         * delegate.cs (NewDelegate): New class to take care of delegate
7452         instantiation.
7453
7454         * expression.cs (New): Split the delegate related code out into 
7455         the NewDelegate class.
7456
7457         * delegate.cs (DelegateInvocation): New class to handle delegate 
7458         invocation.
7459
7460         * expression.cs (Invocation): Split out delegate related code into
7461         the DelegateInvocation class.
7462
7463 2001-10-17  Ravi Pratap  <ravi@ximian.com>
7464
7465         * expression.cs (New::DoResolve): Implement delegate creation fully
7466         and according to the spec.
7467
7468         (New::DoEmit): Update to handle delegates differently.
7469
7470         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
7471         because of which we were printing out arguments in reverse order !
7472
7473         * delegate.cs (VerifyMethod): Implement to check if the given method
7474         matches the delegate.
7475
7476         (FullDelegateDesc): Implement.
7477
7478         (VerifyApplicability): Implement.
7479
7480         * expression.cs (Invocation::DoResolve): Update to accordingly handle
7481         delegate invocations too.
7482
7483         (Invocation::Emit): Ditto.
7484
7485         * ../errors/cs1593.cs : Added.
7486
7487         * ../errors/cs1594.cs : Added.
7488
7489         * delegate.cs (InstanceExpression, TargetMethod): New properties.
7490
7491 2001-10-16  Ravi Pratap  <ravi@ximian.com>
7492
7493         * typemanager.cs (intptr_type): Core type for System.IntPtr
7494
7495         (InitCoreTypes): Update for the same.
7496
7497         (iasyncresult_type, asynccallback_type): Ditto.
7498
7499         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
7500         correct.
7501
7502         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
7503         too.
7504
7505         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
7506         the builders for the 4 members of a delegate type :-)
7507
7508         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
7509         type.
7510
7511         * expression.cs (New::DoResolve): Implement guts for delegate creation.
7512
7513         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
7514
7515 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
7516
7517         * statement.cs (Break::Emit): Implement.   
7518         (Continue::Emit): Implement.
7519
7520         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
7521         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
7522         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
7523         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
7524         end loop
7525         
7526         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
7527         properties that track the label for the current loop (begin of the
7528         loop and end of the loop).
7529
7530 2001-10-15  Ravi Pratap  <ravi@ximian.com>
7531
7532         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
7533         use of emitting anything at all.
7534
7535         * class.cs, rootcontext.cs : Get rid of calls to the same.
7536
7537         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
7538
7539         (Populate): Define the constructor correctly and set the implementation
7540         attributes.
7541
7542         * typemanager.cs (delegate_types): New hashtable to hold delegates that
7543         have been defined.
7544
7545         (AddDelegateType): Implement.
7546
7547         (IsDelegateType): Implement helper method.
7548
7549         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
7550
7551         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
7552         and accordingly handle it.
7553
7554         * delegate.cs (Populate): Take TypeContainer argument.
7555         Implement bits to define the Invoke method. However, I still haven't figured out
7556         how to take care of the native int bit :-(
7557
7558         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
7559         Qualify the name of the delegate, not its return type !
7560
7561         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
7562         conversion.
7563
7564         (StandardConversionExists): Checking for array types turns out to be recursive.
7565
7566         (ConvertReferenceExplicit): Implement array conversion.
7567
7568         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
7569         
7570 2001-10-12  Ravi Pratap  <ravi@ximian.com>
7571
7572         * cs-parser.jay (delegate_declaration): Store the fully qualified
7573         name as it is a type declaration.
7574
7575         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
7576         readonly.
7577
7578         (DefineDelegate): Renamed from Define. Does the same thing essentially,
7579         as TypeContainer::DefineType.
7580
7581         (Populate): Method in which all the definition of the various methods (Invoke)
7582         etc is done.
7583
7584         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
7585         see.
7586         
7587         (CloseDelegate): Finally creates the delegate.
7588
7589         * class.cs (TypeContainer::DefineType): Update to define delegates.
7590         (Populate, Emit and CloseType): Do the same thing here too.
7591
7592         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
7593         delegates in all these operations.
7594
7595 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
7596
7597         * expression.cs: LocalTemporary: a new expression used to
7598         reference a temporary that has been created.
7599
7600         * assign.cs: Handle PropertyAccess back here, so that we can
7601         provide the proper semantic access to properties.
7602
7603         * expression.cs (Expression::ConvertReferenceExplicit): Implement
7604         a few more explicit conversions. 
7605
7606         * modifiers.cs: `NEW' modifier maps to HideBySig.
7607
7608         * expression.cs (PropertyExpr): Make this into an
7609         ExpressionStatement, and support the EmitStatement code path. 
7610
7611         Perform get/set error checking, clean up the interface.
7612
7613         * assign.cs: recognize PropertyExprs as targets, and if so, turn
7614         them into toplevel access objects.
7615
7616 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
7617
7618         * expression.cs: PropertyExpr::PropertyExpr: use work around the
7619         SRE.
7620
7621         * typemanager.cs: Keep track here of our PropertyBuilders again to
7622         work around lameness in SRE.
7623
7624 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
7625
7626         * expression.cs (LValue::LValueResolve): New method in the
7627         interface, used to perform a second resolution pass for LValues. 
7628         
7629         (This::DoResolve): Catch the use of this in static methods.
7630
7631         (This::LValueResolve): Implement.
7632
7633         (This::Store): Remove warning, assigning to `this' in structures
7634         is 
7635
7636         (Invocation::Emit): Deal with invocation of
7637         methods on value types.  We need to pass the address to structure
7638         methods rather than the object itself.  (The equivalent code to
7639         emit "this" for structures leaves the entire structure on the
7640         stack instead of a pointer to it). 
7641
7642         (ParameterReference::DoResolve): Compute the real index for the
7643         argument based on whether the method takes or not a `this' pointer
7644         (ie, the method is static).
7645
7646         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
7647         value types returned from functions when we need to invoke a
7648         method on the sturcture.
7649         
7650
7651 2001-10-11  Ravi Pratap  <ravi@ximian.com>
7652
7653         * class.cs (TypeContainer::DefineType): Method to actually do the business of
7654         defining the type in the Modulebuilder or Typebuilder. This is to take
7655         care of nested types which need to be defined on the TypeBuilder using
7656         DefineNestedMethod.
7657
7658         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
7659         methods in RootContext, only ported to be part of TypeContainer.
7660
7661         (TypeContainer::GetInterfaceOrClass): Ditto.
7662
7663         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
7664
7665         * interface.cs (Interface::DefineInterface): New method. Does exactly
7666         what RootContext.CreateInterface did earlier, only it takes care of nested types 
7667         too.
7668
7669         (Interface::GetInterfaces): Move from RootContext here and port.
7670
7671         (Interface::GetInterfaceByName): Same here.
7672
7673         * rootcontext.cs (ResolveTree): Re-write.
7674
7675         (PopulateTypes): Re-write.
7676
7677         * class.cs (TypeContainer::Populate): Populate nested types too.
7678         (TypeContainer::Emit): Emit nested members too.
7679
7680         * typemanager.cs (AddUserType): Do not make use of the FullName property,
7681         instead just use the name argument passed in as it is already fully
7682         qualified.
7683
7684         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
7685         to TypeContainer mapping to see if a type is user-defined.
7686
7687         * class.cs (TypeContainer::CloseType): Implement. 
7688
7689         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
7690         the default constructor.
7691         
7692         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
7693         twice.
7694
7695         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
7696
7697         * interface.cs (CloseType): Create the type here.
7698         
7699         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
7700         the hierarchy.
7701
7702         Remove all the methods which are now in TypeContainer.
7703
7704 2001-10-10  Ravi Pratap  <ravi@ximian.com>
7705
7706         * delegate.cs (Define): Re-write bits to define the delegate
7707         correctly.
7708
7709 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
7710
7711         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
7712
7713         * expression.cs (ImplicitReferenceConversion): handle null as well
7714         as a source to convert to any reference type.
7715
7716         * statement.cs (Return): Perform any implicit conversions to
7717         expected return type.  
7718
7719         Validate use of return statement.  
7720
7721         * codegen.cs (EmitContext): Pass the expected return type here.
7722
7723         * class.cs (Method, Constructor, Property): Pass expected return
7724         type to EmitContext.
7725
7726 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
7727
7728         * expression.cs: Make DoResolve take an EmitContext instead of a
7729         TypeContainer.
7730
7731         Replaced `l' and `location' for `loc', for consistency.
7732         
7733         (Error, Warning): Remove unneeded Tc argument.
7734
7735         * assign.cs, literal.cs, constant.cs: Update to new calling
7736         convention. 
7737         
7738         * codegen.cs: EmitContext now contains a flag indicating whether
7739         code is being generated in a static method or not.
7740
7741         * cs-parser.jay: DecomposeQI, new function that replaces the old
7742         QualifiedIdentifier.  Now we always decompose the assembled
7743         strings from qualified_identifier productions into a group of
7744         memberaccesses.
7745
7746 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
7747
7748         * rootcontext.cs: Deal with field-less struct types correctly now
7749         by passing the size option to Define Type.
7750
7751         * class.cs: Removed hack that created one static field. 
7752
7753 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
7754
7755         * statement.cs: Moved most of the code generation here. 
7756
7757 2001-10-09  Ravi Pratap  <ravi@ximian.com>
7758
7759         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
7760         seem very right.
7761
7762         (ElementAccess): Remove useless bits for now - keep checks as the spec
7763         says.
7764
7765 2001-10-08  Ravi Pratap  <ravi@ximian.com>
7766
7767         * expression.cs (ElementAccess::DoResolve): Remove my crap code
7768         and start performing checks according to the spec.
7769
7770 2001-10-07  Ravi Pratap  <ravi@ximian.com>
7771
7772         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
7773         rank_specifiers instead.
7774
7775         (rank_specifiers): Change the order in which the rank specifiers are stored
7776
7777         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
7778
7779         * expression.cs (ElementAccess): Implement the LValue interface too.
7780         
7781 2001-10-06  Ravi Pratap  <ravi@ximian.com>
7782         
7783         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
7784         except that user defined conversions are not included.
7785
7786         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
7787         perform the conversion of the return type, if necessary.
7788
7789         (New::DoResolve): Check whether we are creating an array or an object
7790         and accordingly do the needful.
7791
7792         (New::Emit): Same here.
7793
7794         (New::DoResolve): Implement guts of array creation.
7795
7796         (New::FormLookupType): Helper function.
7797
7798 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
7799
7800         * codegen.cs: Removed most of the code generation here, and move the
7801         corresponding code generation bits to the statement classes. 
7802
7803         Added support for try/catch/finalize and throw.
7804         
7805         * cs-parser.jay: Added support for try/catch/finalize.
7806
7807         * class.cs: Catch static methods having the flags override,
7808         virtual or abstract.
7809
7810         * expression.cs (UserCast): This user cast was not really doing
7811         what it was supposed to do.  Which is to be born in fully resolved
7812         state.  Parts of the resolution were being performed at Emit time! 
7813
7814         Fixed this code.
7815
7816 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
7817
7818         * expression.cs: Implicity convert the result from UserCast.
7819
7820 2001-10-05  Ravi Pratap  <ravi@ximian.com>
7821
7822         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
7823         prevented it from working correctly. 
7824
7825         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
7826         merely ConvertImplicit.
7827
7828 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
7829
7830         * typemanager.cs: Make the LookupTypeContainer function static,
7831         and not per-instance.  
7832
7833         * class.cs: Make static FindMembers (the one that takes a Type
7834         argument). 
7835
7836         * codegen.cs: Add EmitForeach here.
7837
7838         * cs-parser.jay: Make foreach a toplevel object instead of the
7839         inline expansion, as we need to perform semantic analysis on it. 
7840
7841 2001-10-05  Ravi Pratap  <ravi@ximian.com>
7842
7843         * expression.cs (Expression::ImplicitUserConversion): Rename to
7844         UserDefinedConversion.
7845
7846         (Expression::UserDefinedConversion): Take an extra argument specifying 
7847         whether we look for explicit user conversions too.
7848
7849         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
7850
7851         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
7852
7853         (ExplicitUserConversion): Make it a call to UserDefinedConversion
7854         with the appropriate arguments.
7855
7856         * cs-parser.jay (cast_expression): Record location too.
7857
7858         * expression.cs (Cast): Record location info.
7859
7860         (Expression::ConvertExplicit): Take location argument.
7861
7862         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
7863         to determine if we are doing explicit conversions.
7864
7865         (UserCast::Emit): Update accordingly.
7866
7867         (Expression::ConvertExplicit): Report an error if everything fails.
7868
7869         * ../errors/cs0030.cs : Add.
7870
7871 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
7872
7873         * modifiers.cs: If the ABSTRACT keyword is present, also set the
7874         virtual and newslot bits. 
7875
7876         * class.cs (TypeContainer::RegisterRequiredImplementations):
7877         Record methods we need.
7878
7879         (TypeContainer::MakeKey): Helper function to make keys for
7880         MethodBases, since the Methodbase key is useless.
7881
7882         (TypeContainer::Populate): Call RegisterRequiredImplementations
7883         before defining the methods.   
7884
7885         Create a mapping for method_builders_to_methods ahead of time
7886         instead of inside a tight loop.
7887
7888         (::RequireMethods):  Accept an object as the data to set into the
7889         hashtable so we can report interface vs abstract method mismatch.
7890
7891 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
7892
7893         * report.cs: Make all of it static.
7894
7895         * rootcontext.cs: Drop object_type and value_type computations, as
7896         we have those in the TypeManager anyways.
7897
7898         Drop report instance variable too, now it is a global.
7899
7900         * driver.cs: Use try/catch on command line handling.
7901
7902         Add --probe option to debug the error reporting system with a test
7903         suite. 
7904
7905         * report.cs: Add support for exiting program when a probe
7906         condition is reached.
7907
7908 2001-10-03  Ravi Pratap  <ravi@ximian.com>
7909
7910         * expression.cs (Binary::DoNumericPromotions): Fix the case when
7911         we do a forcible conversion regardless of type, to check if 
7912         ForceConversion returns a null.
7913
7914         (Binary::error19): Use location to report error.
7915
7916         (Unary::error23): Use location here too.
7917
7918         * ../errors/cs0019.cs : Check in.
7919
7920         * ../errors/cs0023.cs : Check in.
7921
7922         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
7923         case of a non-null MethodInfo object with a length of 0 !
7924
7925         (Binary::ResolveOperator): Flag error if overload resolution fails to find
7926         an applicable member - according to the spec :-)
7927         Also fix logic to find members in base types.
7928
7929         (Unary::ResolveOperator): Same here.
7930
7931         (Unary::report23): Change name to error23 and make first argument a TypeContainer
7932         as I was getting thoroughly confused between this and error19 :-)
7933         
7934         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
7935         (::FindMostEncompassedType): Implement.
7936         (::FindMostEncompassingType): Implement.
7937         (::StandardConversionExists): Implement.
7938
7939         (UserImplicitCast): Re-vamp. We now need info about most specific
7940         source and target types so that we can do the necessary conversions.
7941
7942         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
7943         mathematical union with no duplicates.
7944
7945 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
7946
7947         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
7948         in order from base classes to child classes, so that we can in
7949         child classes look up in our parent for method names and
7950         attributes (required for handling abstract, virtual, new, override
7951         constructs: we need to instrospect our base class, and if we dont
7952         populate the classes in order, the introspection might be
7953         incorrect.  For example, a method could query its parent before
7954         the parent has any methods and would determine that the parent has
7955         no abstract methods (while it could have had them)).
7956
7957         (RootContext::CreateType): Record the order in which we define the
7958         classes.
7959
7960 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
7961
7962         * class.cs (TypeContainer::Populate): Also method definitions can
7963         fail now, keep track of this.
7964
7965         (TypeContainer::FindMembers): Implement support for
7966         DeclaredOnly/noDeclaredOnly flag.
7967
7968         (Constructor::Emit) Return the ConstructorBuilder.
7969
7970         (Method::Emit) Return the MethodBuilder. 
7971         Check for abstract or virtual methods to be public.
7972
7973         * rootcontext.cs (RootContext::CreateType): Register all the
7974         abstract methods required for the class to be complete and the
7975         interface methods that must be implemented. 
7976
7977         * cs-parser.jay: Report error 501 (method requires body if it is
7978         not marked abstract or extern).
7979
7980         * expression.cs (TypeOf::Emit): Implement.
7981
7982         * typemanager.cs: runtime_handle_type, new global type.
7983
7984         * class.cs (Property::Emit): Generate code for properties.
7985
7986 2001-10-02  Ravi Pratap  <ravi@ximian.com>
7987
7988         * expression.cs (Unary::ResolveOperator): Find operators on base type
7989         too - we now conform exactly to the spec.
7990
7991         (Binary::ResolveOperator): Same here.
7992
7993         * class.cs (Operator::Define): Fix minor quirk in the tests.
7994
7995         * ../errors/cs0215.cs : Added.
7996
7997         * ../errors/cs0556.cs : Added.
7998
7999         * ../errors/cs0555.cs : Added.
8000
8001 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
8002
8003         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
8004         single integer which is really efficient
8005
8006 2001-10-01  Ravi Pratap  <ravi@ximian.com>
8007
8008         *  expression.cs (Expression::ImplicitUserConversion): Use location
8009         even in the case when we are examining True operators.
8010  
8011         * class.cs (Operator::Define): Perform extensive checks to conform
8012         with the rules for operator overloading in the spec.
8013
8014         * expression.cs (Expression::ImplicitReferenceConversion): Implement
8015         some of the other conversions mentioned in the spec.
8016
8017         * typemanager.cs (array_type): New static member for the System.Array built-in
8018         type.
8019
8020         (cloneable_interface): For System.ICloneable interface.
8021
8022         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
8023         we start resolving the tree and populating types.
8024
8025         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
8026  
8027 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
8028
8029         * expression.cs (Expression::ExprClassFromMemberInfo,
8030         Expression::Literalize): Create literal expressions from
8031         FieldInfos which are literals.
8032
8033         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
8034         type casts, because they were wrong.  The test suite in tests
8035         caught these ones.
8036
8037         (ImplicitNumericConversion): ushort to ulong requires a widening
8038         cast. 
8039
8040         Int32 constant to long requires widening cast as well.
8041
8042         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
8043         for integers because the type on the stack is not i4.
8044
8045 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
8046
8047         * expression.cs (report118): require location argument. 
8048
8049         * parameter.cs: Do not dereference potential null value.
8050
8051         * class.cs: Catch methods that lack the `new' keyword when
8052         overriding a name.  Report warnings when `new' is used without
8053         anything being there to override.
8054
8055         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
8056
8057         * class.cs: Only add constructor to hashtable if it is non-null
8058         (as now constructors can fail on define).
8059
8060         (TypeManager, Class, Struct): Take location arguments.
8061
8062         Catch field instance initialization in structs as errors.
8063
8064         accepting_filter: a new filter for FindMembers that is static so
8065         that we dont create an instance per invocation.
8066
8067         (Constructor::Define): Catch errors where a struct constructor is
8068         parameterless 
8069
8070         * cs-parser.jay: Pass location information for various new
8071         constructs. 
8072         
8073         * delegate.cs (Delegate): take a location argument.
8074
8075         * driver.cs: Do not call EmitCode if there were problesm in the
8076         Definition of the types, as many Builders wont be there. 
8077
8078         * decl.cs (Decl::Decl): Require a location argument.
8079
8080         * cs-tokenizer.cs: Handle properly hex constants that can not fit
8081         into integers, and find the most appropiate integer for it.
8082
8083         * literal.cs: Implement ULongLiteral.
8084
8085         * rootcontext.cs: Provide better information about the location of
8086         failure when CreateType fails.
8087         
8088 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
8089
8090         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
8091         as well.
8092
8093         * expression.cs (Binary::CheckShiftArguments): Add missing type
8094         computation.
8095         (Binary::ResolveOperator): Add type to the logical and and logical
8096         or, Bitwise And/Or and Exclusive Or code paths, it was missing
8097         before.
8098
8099         (Binary::DoNumericPromotions): In the case where either argument
8100         is ulong (and most signed types combined with ulong cause an
8101         error) perform implicit integer constant conversions as well.
8102
8103 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
8104
8105         * expression.cs (UserImplicitCast): Method should always be
8106         non-null. 
8107         (Invocation::BetterConversion): Simplified test for IntLiteral.
8108
8109         (Expression::ImplicitNumericConversion): Split this routine out.
8110         Put the code that performs implicit constant integer conversions
8111         here. 
8112
8113         (Expression::Resolve): Become a wrapper around DoResolve so we can
8114         check eclass and type being set after resolve.
8115
8116         (Invocation::Badness): Remove this dead function
8117
8118         (Binary::ResolveOperator): Do not compute the expensive argumnets
8119         unless we have a union for it.
8120
8121         (Probe::Emit): Is needs to do an isinst and then
8122         compare against null.
8123
8124         (::CanConvert): Added Location argument.  If the Location argument
8125         is null (Location.Null), then we do not report errors.  This is
8126         used by the `probe' mechanism of the Explicit conversion.  We do
8127         not want to generate an error for something that the user
8128         explicitly requested to be casted.  But the pipeline for an
8129         explicit cast first tests for potential implicit casts.
8130
8131         So for now, if the Location is null, it means `Probe only' to
8132         avoid adding another argument.   Might have to revise this
8133         strategy later.
8134
8135         (ClassCast): New class used to type cast objects into arbitrary
8136         classes (used in Explicit Reference Conversions).
8137
8138         Implement `as' as well.
8139
8140         Reverted all the patches from Ravi below: they were broken:
8141
8142                 * The use of `level' as a mechanism to stop recursive
8143                   invocations is wrong.  That was there just to catch the
8144                   bug with a strack trace but not as a way of addressing
8145                   the problem.
8146
8147                   To fix the problem we have to *understand* what is going
8148                   on and the interactions and come up with a plan, not
8149                   just get things going.
8150
8151                 * The use of the type conversion cache that I proposed
8152                   last night had an open topic: How does this work across
8153                   protection domains.  A user defined conversion might not
8154                   be public in the location where we are applying the
8155                   conversion, a different conversion might be selected
8156                   (ie, private A->B (better) but public B->A (worse),
8157                   inside A, A->B applies, but outside it, B->A will
8158                   apply).
8159
8160                 * On top of that (ie, even if the above is solved),
8161                   conversions in a cache need to be abstract.  Ie, `To
8162                   convert from an Int to a Short use an OpcodeCast', not
8163                   `To convert from an Int to a Short use the OpcodeCast on
8164                   the variable 5' (which is what this patch was doing).
8165         
8166 2001-09-28  Ravi Pratap  <ravi@ximian.com>
8167
8168         * expression.cs (Invocation::ConversionExists): Re-write to use
8169         the conversion cache
8170         
8171         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
8172         cache all conversions done, not just user-defined ones.
8173
8174         (Invocation::BetterConversion): The real culprit. Use ConversionExists
8175         to determine if a conversion exists instead of acutually trying to 
8176         perform the conversion. It's faster too.
8177
8178         (Expression::ConvertExplicit): Modify to use ConversionExists to check
8179         and only then attempt the implicit conversion.
8180
8181 2001-09-28  Ravi Pratap  <ravi@ximian.com>
8182
8183         * expression.cs (ConvertImplicit): Use a cache for conversions
8184         already found. Check level of recursion and bail out if necessary.
8185         
8186 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
8187
8188         * typemanager.cs (string_concat_string_string, string_concat_object_object):
8189         Export standard methods that we expect for string operations.
8190         
8191         * statement.cs (Block::UsageWarning): Track usage of variables and
8192         report the errors for not used variables.
8193
8194         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
8195         operator. 
8196
8197 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
8198
8199         * codegen.cs: remove unnneded code 
8200
8201         * expression.cs: Removed BuiltinTypeAccess class
8202
8203         Fix the order in which implicit conversions are
8204         done.  
8205
8206         The previous fixed dropped support for boxed conversions (adding a
8207         test to the test suite now)
8208
8209         (UserImplicitCast::CanConvert): Remove test for source being null,
8210         that code is broken.  We should not feed a null to begin with, if
8211         we do, then we should track the bug where the problem originates
8212         and not try to cover it up here.
8213
8214         Return a resolved expression of type UserImplicitCast on success
8215         rather than true/false.  Ravi: this is what I was talking about,
8216         the pattern is to use a static method as a "constructor" for
8217         objects. 
8218
8219         Also, do not create arguments until the very last minute,
8220         otherwise we always create the arguments even for lookups that
8221         will never be performed. 
8222
8223         (UserImplicitCast::Resolve): Eliminate, objects of type
8224         UserImplicitCast are born in a fully resolved state. 
8225         
8226         * typemanager.cs (InitCoreTypes): Init also value_type
8227         (System.ValueType). 
8228
8229         * expression.cs (Cast::Resolve): First resolve the child expression.
8230
8231         (LValue): Add new method AddressOf to be used by
8232         the `&' operator.  
8233
8234         Change the argument of Store to take an EmitContext instead of an
8235         ILGenerator, because things like FieldExpr need to be able to call
8236         their children expression to generate the instance code. 
8237
8238         (Expression::Error, Expression::Warning): Sugar functions for
8239         reporting errors.
8240
8241         (Expression::MemberLookup): Accept a TypeContainer instead of a
8242         Report as the first argument.
8243
8244         (Expression::ResolvePrimary): Killed.  I still want to improve
8245         this as currently the code is just not right.
8246
8247         (Expression::ResolveMemberAccess): Simplify, but it is still
8248         wrong. 
8249
8250         (Unary::Resolve): Catch errors in AddressOf operators.
8251
8252         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
8253         index to a byte for the short-version, or the compiler will choose
8254         the wrong Emit call, which generates the wrong data.
8255
8256         (ParameterReference::Emit, ::Store): same.
8257
8258         (FieldExpr::AddressOf): Implement.
8259         
8260         * typemanager.cs: TypeManager: made public variable instead of
8261         property.
8262         
8263         * driver.cs: document --fatal.
8264
8265         * report.cs (ErrorMessage, WarningMessage): new names for the old
8266         Error and Warning classes.
8267
8268         * cs-parser.jay (member_access): Turn built-in access to types
8269         into a normal simplename
8270
8271 2001-09-27  Ravi Pratap  <ravi@ximian.com>
8272
8273         * expression.cs (Invocation::BetterConversion): Fix to cope
8274         with q being null, since this was introducing a bug.
8275
8276         * expression.cs (ConvertImplicit): Do built-in conversions first.
8277
8278 2001-09-27  Ravi Pratap  <ravi@ximian.com>
8279
8280         * expression.cs (UserImplicitCast::Resolve): Fix bug.
8281
8282 2001-09-27  Ravi Pratap  <ravi@ximian.com>
8283
8284         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
8285         I had introduced long ago (what's new ?).
8286
8287         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
8288         the work of all the checking. 
8289         (ConvertImplicit): Call CanConvert and only then create object if necessary.
8290         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
8291
8292         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
8293         that is the right way. 
8294
8295         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
8296         overloading resolution. Use everywhere instead of cutting and pasting code.
8297
8298         (Binary::ResolveOperator): Use MakeUnionSet.
8299
8300         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
8301         we have to convert to bool types. Not complete yet.
8302         
8303 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
8304
8305         * typemanager.cs (TypeManager::CSharpName): support ushort.
8306
8307         * expression.cs (Expression::TryImplicitIntConversion): Attempts
8308         to provide an expression that performsn an implicit constant int
8309         conversion (section 6.1.6).
8310         (Expression::ConvertImplicitRequired): Reworked to include
8311         implicit constant expression conversions.
8312
8313         (Expression::ConvertNumericExplicit): Finished.
8314
8315         (Invocation::Emit): If InstanceExpression is null, then it means
8316         that we perform a call on this.
8317         
8318 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
8319
8320         * expression.cs (Unary::Emit): Remove some dead code.
8321         (Probe): Implement Resolve and Emit for `is'.
8322         (Expression::ConvertImplicitRequired): Attempt to do constant
8323         expression conversions here.  Maybe should be moved to
8324         ConvertImplicit, but I am not sure.
8325         (Expression::ImplicitLongConstantConversionPossible,
8326         Expression::ImplicitIntConstantConversionPossible): New functions
8327         that tell whether is it possible to apply an implicit constant
8328         expression conversion.
8329
8330         (ConvertNumericExplicit): Started work on explicit numeric
8331         conversions.
8332
8333         * cs-parser.jay: Update operator constants.
8334
8335         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
8336         (Parameters::GetSignature): Hook up VerifyArgs here.
8337         (Parameters::VerifyArgs): Verifies that no two arguments have the
8338         same name. 
8339
8340         * class.cs (Operator): Update the operator names to reflect the
8341         ones that the spec expects (as we are just stringizing the
8342         operator names).
8343         
8344         * expression.cs (Unary::ResolveOperator): Fix bug: Use
8345         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
8346         previous usage did only work for our methods.
8347         (Expression::ConvertImplicit): Handle decimal implicit numeric
8348         conversions as well.
8349         (Expression::InternalTypeConstructor): Used to invoke constructors
8350         on internal types for default promotions.
8351
8352         (Unary::Emit): Implement special handling for the pre/post
8353         increment/decrement for overloaded operators, as they need to have
8354         the same semantics as the other operators.
8355
8356         (Binary::ResolveOperator): ditto.
8357         (Invocation::ConversionExists): ditto.
8358         (UserImplicitCast::Resolve): ditto.
8359         
8360 2001-09-26  Ravi Pratap  <ravi@ximian.com>
8361
8362         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
8363         operator, return after emitting body. Regression tests pass again !
8364
8365         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
8366         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
8367         (Invocation::OverloadResolve): Ditto.
8368         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
8369
8370         * everywhere : update calls to the above methods accordingly.
8371
8372 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
8373
8374         * assign.cs (Assign): Make it inherit from ExpressionStatement.
8375
8376         * expression.cs (ExpressionStatement): New base class used for
8377         expressions that can appear in statements, so that we can provide
8378         an alternate path to generate expression that do not leave a value
8379         on the stack.
8380
8381         (Expression::Emit, and all the derivatives): We no longer return
8382         whether a value is left on the stack or not.  Every expression
8383         after being emitted leaves a single value on the stack.
8384
8385         * codegen.cs (EmitContext::EmitStatementExpression): Use the
8386         facilties of ExpressionStatement if possible.
8387
8388         * cs-parser.jay: Update statement_expression.
8389
8390 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
8391
8392         * driver.cs: Change the wording of message
8393
8394 2001-09-25  Ravi Pratap  <ravi@ximian.com>
8395
8396         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
8397         the type of the expression to the return type of the method if
8398         we have an overloaded operator match ! The regression tests pass again !
8399         (Unary::ResolveOperator): Ditto.
8400
8401         * expression.cs (Invocation::ConversionExists): Correct the member lookup
8402         to find "op_Implicit", not "implicit" ;-)
8403         (UserImplicitCast): New class to take care of user-defined implicit conversions.
8404         (ConvertImplicit, ForceConversion): Take TypeContainer argument
8405
8406         * everywhere : Correct calls to the above accordingly.
8407
8408         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
8409         (ConvertImplicit): Do user-defined conversion if it exists.
8410
8411 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
8412
8413         * assign.cs: track location.
8414         (Resolve): Use implicit conversions on assignment.
8415
8416         * literal.cs: Oops.  Not good, Emit of short access values should
8417         pass (Bytes) or the wrong argument will be selected.
8418
8419         * expression.cs (Unary::Emit): Emit code for -expr.
8420         
8421         (Unary::ResolveOperator): Handle `Substract' for non-constants
8422         (substract from zero from the non-constants).
8423         Deal with Doubles as well. 
8424         
8425         (Expression::ConvertImplicitRequired): New routine that reports an
8426         error if no implicit conversion exists. 
8427
8428         (Invocation::OverloadResolve): Store the converted implicit
8429         expressions if we make them
8430         
8431 2001-09-24  Ravi Pratap  <ravi@ximian.com>
8432
8433         * class.cs (ConstructorInitializer): Take a Location argument.
8434         (ConstructorBaseInitializer): Same here.
8435         (ConstructorThisInitializer): Same here.
8436
8437         * cs-parser.jay : Update all calls accordingly.
8438
8439         * expression.cs (Unary, Binary, New): Take location argument.
8440         Update accordingly everywhere.
8441
8442         * cs-parser.jay : Update all calls to the above to take a location
8443         argument.
8444
8445         * class.cs : Ditto.
8446
8447 2001-09-24  Ravi Pratap  <ravi@ximian.com>
8448
8449         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
8450         (Invocation::BetterConversion): Same here
8451         (Invocation::ConversionExists): Ditto.
8452
8453         (Invocation::ConversionExists): Implement.
8454
8455 2001-09-22  Ravi Pratap  <ravi@ximian.com>
8456
8457         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
8458         Also take an additional TypeContainer argument.
8459
8460         * All over : Pass in TypeContainer as argument to OverloadResolve.
8461
8462         * typemanager.cs (CSharpName): Update to check for the string type and return
8463         that too.
8464
8465         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
8466         a given method.
8467         
8468 2001-09-21  Ravi Pratap  <ravi@ximian.com>
8469
8470         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
8471         (Invocation::BetterFunction): Implement.
8472         (Invocation::BetterConversion): Implement.
8473         (Invocation::ConversionExists): Skeleton, no implementation yet.
8474
8475         Okay, things work fine !
8476
8477 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
8478
8479         * typemanager.cs: declare and load enum_type, delegate_type and
8480         void_type. 
8481
8482         * expression.cs (Expression::Emit): Now emit returns a value that
8483         tells whether a value is left on the stack or not.  This strategy
8484         might be reveted tomorrow with a mechanism that would address
8485         multiple assignments.
8486         (Expression::report118): Utility routine to report mismatches on
8487         the ExprClass.
8488
8489         (Unary::Report23): Report impossible type/operator combination
8490         utility function.
8491
8492         (Unary::IsIncrementableNumber): Whether the type can be
8493         incremented or decremented with add.
8494         (Unary::ResolveOperator): Also allow enumerations to be bitwise
8495         complemented. 
8496         (Unary::ResolveOperator): Implement ++, !, ~,
8497
8498         (Invocation::Emit): Deal with new Emit convetion.
8499         
8500         * All Expression derivatives: Updated their Emit method to return
8501         whether they leave values on the stack or not.
8502         
8503         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
8504         stack for expressions that are statements. 
8505
8506 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
8507
8508         * expression.cs (LValue): New interface.  Must be implemented by
8509         LValue objects.
8510         (LocalVariableReference, ParameterReference, FieldExpr): Implement
8511         LValue interface.
8512         
8513         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
8514         interface for generating code, simplifies the code.
8515
8516 2001-09-20  Ravi Pratap  <ravi@ximian.com>
8517
8518         * expression.cs (everywhere): Comment out return statements in ::Resolve
8519         methods to avoid the warnings.
8520
8521 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
8522
8523         * driver.cs (parse): Report error 2001 if we can not open the
8524         source file.
8525
8526         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
8527         not resolve it.
8528
8529         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
8530         object. 
8531
8532         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
8533         otherwise nested blocks end up with the same index.
8534
8535         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
8536
8537         * expression.cs:  Instead of having FIXMEs in the Resolve
8538         functions, throw exceptions so it is obvious that we are facing a
8539         bug. 
8540
8541         * cs-parser.jay (invocation_expression): Pass Location information.
8542
8543         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
8544         Use a basename for those routines because .NET does not like paths
8545         on them. 
8546
8547         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
8548         already defined.
8549
8550 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
8551
8552         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
8553         are loading the correct data types (throws an exception if not).
8554         (TypeManager::InitCoreTypes): Use CoreLookupType
8555
8556         * expression.cs (Unary::ResolveOperator): return the child
8557         expression for expressions which are just +expr.
8558         (Unary::ResolveOperator): Return negative literals for -LITERAL
8559         expressions (otherwise they are Unary {Literal}).
8560         (Invocation::Badness): Take into account `Implicit constant
8561         expression conversions'.
8562
8563         * literal.cs (LongLiteral): Implement long literal class.
8564         (IntLiteral): export the `Value' of the intliteral. 
8565
8566 2001-09-19  Ravi Pratap  <ravi@ximian.com>
8567
8568         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
8569
8570         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
8571         instead of 'Operator'
8572
8573         * expression.cs (Binary::ResolveOperator): Update accordingly.
8574         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
8575         and 'Minus'
8576
8577         * cs-parser.jay (unary_expression): Update to use the new names.
8578
8579         * gen-treedump.cs (GetUnary): Same here.
8580
8581         * expression.cs (Unary::Resolve): Implement.
8582         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
8583         operators are found instead of making noise ;-)
8584         (Unary::ResolveOperator): New method to do precisely the same thing which
8585         Binary::ResolveOperator does for Binary expressions.
8586         (Unary.method, .Arguments): Add.
8587         (Unary::OperName): Implement.   
8588         (Unary::ForceConversion): Copy and Paste !
8589
8590         * class.cs (Operator::Define): Fix a small bug for the case when we have 
8591         a unary operator.
8592
8593         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
8594         for the inbuilt operators. Only overloading works for now ;-)
8595
8596 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
8597
8598         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
8599         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
8600
8601         * expression.cs (This::Emit): Implement. 
8602         (This::Resolve): Implement.
8603         (TypeOf:Resolve): Implement.
8604         (Expression::ResolveSimpleName): Add an implicit this to instance
8605         field references. 
8606         (MemberAccess::Resolve): Deal with Parameters and Fields. 
8607         Bind instance variable to Field expressions.
8608         (FieldExpr::Instance): New field used to track the expression that
8609         represents the object instance.
8610         (FieldExpr::Resolve): Track potential errors from MemberLookup not
8611         binding 
8612         (FieldExpr::Emit): Implement.
8613
8614         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
8615         the last instruction contains a return opcode to avoid generating
8616         the last `ret' instruction (this generates correct code, and it is
8617         nice to pass the peverify output).
8618
8619         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
8620         initializer for static and instance variables.
8621         (Constructor::Emit): Allow initializer to be null in the case of
8622         static constructors.  Only emit initializer for instance
8623         constructors. 
8624
8625         (TypeContainer::FindMembers): Return a null array if there are no
8626         matches.
8627
8628         Also fix the code for the MemberTypes.Method branch, as it was not
8629         scanning that for operators (or tried to access null variables before).
8630
8631         * assign.cs (Assign::Emit): Handle instance and static fields. 
8632
8633         * TODO: Updated.
8634
8635         * driver.cs: Stop compilation if there are parse errors.
8636
8637         * cs-parser.jay (constructor_declaration): Provide default base
8638         initializer for non-static constructors.
8639         (constructor_declarator): Do not provide a default base
8640         initializers if none was specified.
8641         Catch the fact that constructors should not have parameters.
8642
8643         * class.cs: Do not emit parent class initializers for static
8644         constructors, that should be flagged as an error.
8645
8646 2001-09-18  Ravi Pratap  <ravi@ximian.com>
8647
8648         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
8649         Move back code into TypeContainer::Populate.
8650
8651 2001-09-18  Ravi Pratap  <ravi@ximian.com>
8652
8653         * class.cs (TypeContainer::AddConstructor): Fix the check to
8654         compare against Name, not Basename. 
8655         (Operator::OpType): Change Plus and Minus to Add and Subtract.
8656
8657         * cs-parser.jay : Update accordingly.
8658
8659         * class.cs (TypeContainer::FindMembers): For the case where we are searching
8660         for methods, don't forget to look into the operators too.
8661         (RegisterMethodBuilder): Helper method to take care of this for
8662         methods, constructors and operators.
8663         (Operator::Define): Completely revamp.
8664         (Operator.OperatorMethod, MethodName): New fields.
8665         (TypeContainer::Populate): Move the registering of builders into
8666         RegisterMethodBuilder.
8667         (Operator::Emit): Re-write.
8668
8669         * expression.cs (Binary::Emit): Comment out code path to emit method
8670         invocation stuff for the case when we have a user defined operator. I am
8671         just not able to get it right !
8672         
8673 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
8674
8675         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
8676         argument. 
8677
8678         (Expression::MemberLookup): Provide a version that allows to
8679         specify the MemberTypes and BindingFlags. 
8680
8681         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
8682         so it was not fetching variable information from outer blocks.
8683
8684         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
8685         Beforefieldinit as it was buggy.
8686
8687         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
8688         that Ravi put here.  
8689
8690         * class.cs (Constructor::Emit): Only emit if block is not null.
8691         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
8692         deal with this by semantically definining it as if the user had
8693         done it.
8694
8695         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
8696         constructors as we now "emit" them at a higher level.
8697
8698         (TypeContainer::DefineDefaultConstructor): Used to define the
8699         default constructors if none was provided.
8700
8701         (ConstructorInitializer): Add methods Resolve and Emit. 
8702         
8703         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
8704
8705 2001-09-17  Ravi Pratap  <ravi@ximian.com>
8706
8707         * class.cs (TypeContainer::EmitDefaultConstructor): Register
8708         the default constructor builder with our hashtable for methodbuilders
8709         to methodcores.
8710
8711         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
8712         and argument_count is 0 in which case we have a match.
8713         (Binary::ResolveOperator): More null checking and miscellaneous coding
8714         style cleanup.
8715
8716 2001-09-17  Ravi Pratap  <ravi@ximian.com>
8717
8718         * rootcontext.cs (IsNameSpace): Compare against null.
8719
8720         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
8721
8722         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
8723         and Unary::Operator.
8724
8725         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
8726         accordingly.
8727
8728         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
8729         we have overloaded operators.
8730         (Binary::ResolveOperator): Implement the part which does the operator overload
8731         resolution.
8732
8733         * class.cs (Operator::Emit): Implement.
8734         (TypeContainer::Emit): Emit the operators we have too.
8735
8736         * expression.cs (Binary::Emit): Update to emit the appropriate code for
8737         the case when we have a user-defined operator.
8738         
8739 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
8740
8741         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
8742
8743 2001-09-16  Ravi Pratap  <ravi@ximian.com>
8744
8745         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
8746         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
8747         (Constructor::Emit): Implement.
8748         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
8749         if we have no work to do. 
8750         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
8751         Emit method.
8752
8753         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
8754         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
8755
8756         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
8757         of parent.parent.
8758
8759 2001-09-15  Ravi Pratap  <ravi@ximian.com>
8760
8761         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
8762         in the source.
8763         (Tree::RecordNamespace): Method to do what the name says ;-)
8764         (Tree::Namespaces): Property to get at the namespaces hashtable.
8765
8766         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
8767         keep track.
8768
8769         * rootcontext.cs (IsNamespace): Fixed it :-)
8770
8771 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
8772
8773         * class.cs (TypeContainer::FindMembers): Add support for
8774         constructors. 
8775         (MethodCore): New class that encapsulates both the shared aspects
8776         of a Constructor and a Method.  
8777         (Method, Constructor): Factored pieces into MethodCore.
8778
8779         * driver.cs: Added --fatal which makes errors throw exceptions.
8780         Load System assembly as well as part of the standard library.
8781
8782         * report.cs: Allow throwing exceptions on errors for debugging.
8783
8784         * modifiers.cs: Do not use `parent', instead use the real type
8785         container to evaluate permission settings.
8786
8787         * class.cs: Put Ravi's patch back in.  He is right, and we will
8788         have to cope with the
8789
8790 2001-09-14  Ravi Pratap  <ravi@ximian.com>
8791
8792         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
8793         FamORAssem, not FamANDAssem.
8794         
8795 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
8796
8797         * driver.cs: Added --parse option that only parses its input files
8798         and terminates.
8799
8800         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
8801         incorrect.  IsTopLevel is not used to tell whether an object is
8802         root_types or not (that can be achieved by testing this ==
8803         root_types).  But to see if this is a top-level *class* (not
8804         necessarly our "toplevel" container). 
8805
8806 2001-09-14  Ravi Pratap  <ravi@ximian.com>
8807
8808         * enum.cs (Enum::Define): Modify to call the Lookup method on the
8809         parent instead of a direct call to GetType.
8810
8811 2001-09-14  Ravi Pratap  <ravi@ximian.com>
8812
8813         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
8814         Modifiers.TypeAttr. This should just be a call to that method.
8815
8816         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
8817         object so that we can determine if we are top-level or not.
8818
8819         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
8820         TypeContainer too.
8821
8822         * enum.cs (Enum::Define): Ditto.
8823
8824         * modifiers.cs (FieldAttr): Re-write.
8825
8826         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
8827         (TypeContainer::HaveStaticConstructor): New property to provide access
8828         to precisely that info.
8829
8830         * modifiers.cs (MethodAttr): Re-write.
8831         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
8832
8833         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
8834         of top-level types as claimed.
8835         
8836 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
8837
8838         * expression.cs (MemberLookup): Fruitless attempt to lookup
8839         constructors.  Maybe I need to emit default constructors?  That
8840         might be it (currently .NET emits this for me automatically).
8841         (Invocation::OverloadResolve): Cope with Arguments == null.
8842         (Invocation::EmitArguments): new function, shared by the new
8843         constructor and us.
8844         (Invocation::Emit): Handle static and instance methods.  Emit
8845         proper call instruction for virtual or non-virtual invocations.
8846         (New::Emit): Implement.
8847         (New::Resolve): Implement.
8848         (MemberAccess:Resolve): Implement.
8849         (MethodGroupExpr::InstanceExpression): used conforming to the spec
8850         to track instances.
8851         (FieldExpr::Resolve): Set type.
8852
8853         * support.cs: Handle empty arguments.
8854                 
8855         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
8856         SimpleLookup): Auxiliary routines to help parse a qualifier
8857         identifier.  
8858
8859         Update qualifier_identifier rule.
8860
8861         * codegen.cs: Removed debugging messages.
8862
8863         * class.cs: Make this a global thing, this acts just as a "key" to
8864         objects that we might have around.
8865
8866         (Populate): Only initialize method_builders_to_methods once.
8867
8868         * expression.cs (PropertyExpr): Initialize type from the
8869         PropertyType. 
8870
8871         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
8872         Resolve pattern.  Attempt to implicitly convert value to boolean.
8873         Emit code.
8874
8875         * expression.cs: Set the type for the int32/int32 argument case.
8876         (Binary::ResolveOperator): Set the return type to boolean for
8877         comparission operators
8878
8879         * typemanager.cs: Remove debugging print code.
8880
8881         (Invocation::Resolve): resolve type.
8882
8883         * class.cs: Allocate a MemberInfo of the correct size, as the code
8884         elsewhere depends on the test to reflect the correct contents.
8885
8886         (Method::) Keep track of parameters, due to System.Reflection holes
8887
8888         (TypeContainer::Populate): Keep track of MethodBuilders to Method
8889         mapping here.
8890
8891         (TypeContainer::FindMembers): Use ArrayList and then copy an array
8892         of the exact size and return that.
8893
8894         (Class::LookupMethodByBuilder): New function that maps
8895         MethodBuilders to its methods.  Required to locate the information
8896         on methods because System.Reflection bit us again.
8897
8898         * support.cs: New file, contains an interface ParameterData and
8899         two implementations: ReflectionParameters and InternalParameters
8900         used to access Parameter information.  We will need to grow this
8901         as required.
8902
8903         * expression.cs (Invocation::GetParameterData): implement a cache
8904         and a wrapper around the ParameterData creation for methods. 
8905         (Invocation::OverloadResolve): Use new code.
8906
8907 2001-09-13  Ravi Pratap  <ravi@ximian.com>
8908
8909         * class.cs (TypeContainer::EmitField): Remove and move into 
8910         (Field::Define): here and modify accordingly.
8911         (Field.FieldBuilder): New member.
8912         (TypeContainer::Populate): Update accordingly.
8913         (TypeContainer::FindMembers): Implement.
8914
8915 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
8916
8917         * statement.cs: (VariableInfo::VariableType): New field to be
8918         initialized with the full type once it is resolved. 
8919
8920 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
8921
8922         * parameter.cs (GetParameterInfo): Use a type cache to compute
8923         things only once, and to reuse this information
8924
8925         * expression.cs (LocalVariableReference::Emit): Implement.
8926         (OpcodeCast::Emit): fix.
8927
8928         (ParameterReference::Resolve): Implement.
8929         (ParameterReference::Emit): Implement.
8930
8931         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
8932         that are expressions need to stay as Expressions.
8933
8934         * typemanager.cs (CSharpName): Returns the C# name of a type if
8935         possible. 
8936
8937         * expression.cs (Expression::ConvertImplicit): New function that
8938         implements implicit type conversions.
8939
8940         (Expression::ImplicitReferenceConversion): Implements implicit
8941         reference conversions.
8942
8943         (EmptyCast): New type for transparent casts.
8944
8945         (OpcodeCast): New type for casts of types that are performed with
8946         a sequence of bytecodes.
8947         
8948         (BoxedCast): New type used for casting value types into reference
8949         types.  Emits a box opcode.
8950
8951         (Binary::DoNumericPromotions): Implements numeric promotions of
8952         and computation of the Binary::Type.
8953
8954         (Binary::EmitBranchable): Optimization.
8955
8956         (Binary::Emit): Implement code emission for expressions.
8957         
8958         * typemanager.cs (TypeManager): Added two new core types: sbyte
8959         and byte.
8960
8961 2001-09-12  Ravi Pratap  <ravi@ximian.com>
8962
8963         * class.cs (TypeContainer::FindMembers): Method which does exactly
8964         what Type.FindMembers does, only we don't have to use reflection. No
8965         implementation yet.
8966
8967         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
8968         typecontainer objects as we need to get at them.
8969         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
8970
8971         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
8972         typecontainer object.
8973
8974         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
8975         of just a Report object.
8976
8977 2001-09-11  Ravi Pratap  <ravi@ximian.com>
8978
8979         * class.cs (Event::Define): Go back to using the prefixes "add_" and
8980         "remove_"
8981         (TypeContainer::Populate): Now define the delegates of the type too.
8982         (TypeContainer.Delegates): Property to access the list of delegates defined
8983         in the type.
8984
8985         * delegates.cs (Delegate::Define): Implement partially.
8986
8987         * modifiers.cs (TypeAttr): Handle more flags.
8988
8989 2001-09-11  Ravi Pratap  <ravi@ximian.com>
8990
8991         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
8992         and not <=
8993         (Operator::Define): Re-write logic to get types by using the LookupType method
8994         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
8995         (Indexer::Define): Ditto.
8996         (Event::Define): Ditto.
8997         (Property::Define): Ditto.
8998         
8999 2001-09-10  Ravi Pratap  <ravi@ximian.com>
9000
9001         * class.cs (TypeContainer::Populate): Now define operators too. 
9002         (TypeContainer.Operators): New property to access the list of operators
9003         in a type.
9004         (Operator.OperatorMethodBuilder): New member to hold the method builder
9005         for the operator we are defining.
9006         (Operator::Define): Implement.
9007
9008 2001-09-10  Ravi Pratap  <ravi@ximian.com>
9009
9010         * class.cs (Event::Define): Make the prefixes of the accessor methods
9011         addOn_ and removeOn_ 
9012
9013         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
9014         of the location being passed in too. Ideally, this should go later since all
9015         error reporting should be done through the Report object.
9016
9017         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
9018         (Populate): Iterate thru the indexers we have and define them too.
9019         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
9020         for the get and set accessors.
9021         (Indexer::Define): Implement.
9022         
9023 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
9024
9025         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
9026         my previous implementation, did not work.
9027
9028         * typemanager.cs: Add a couple of missing types (the longs).
9029
9030         * literal.cs: Use TypeManager.bool_type instead of getting it.
9031
9032         * expression.cs (EventExpr): New kind of expressions.
9033         (Expressio::ExprClassFromMemberInfo): finish
9034
9035 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
9036
9037         * assign.cs: Emit stores to static fields differently.
9038
9039 2001-09-08  Ravi Pratap  <ravi@ximian.com>
9040
9041         * Merge in changes and adjust code to tackle conflicts. Backed out my
9042         code in Assign::Resolve ;-) 
9043
9044 2001-09-08  Ravi Pratap  <ravi@ximian.com>
9045
9046         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
9047         instead Report.Error and also pass in the location.
9048         (CSharpParser::Lexer): New readonly property to return the reference
9049         to the Tokenizer object.
9050         (declare_local_variables): Use Report.Error with location instead of plain 
9051         old error.
9052         (CheckDef): Ditto.
9053
9054         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
9055         (Operator.CheckBinaryOperator): Ditto.
9056
9057         * cs-parser.jay (operator_declarator): Update accordingly.
9058
9059         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
9060         (CheckBinaryOperator): Same here.
9061
9062         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
9063         on the name without any prefixes of namespace names etc. This is because we
9064         already might have something already fully qualified like 
9065         'System.Console.WriteLine'
9066
9067         * assign.cs (Resolve): Begin implementation. Stuck ;-)
9068
9069 2001-09-07  Ravi Pratap  <ravi@ximian.com>
9070
9071         * cs-tokenizer.cs (location): Return a string which also contains
9072         the file name.
9073
9074         * expression.cs (ElementAccess): New class for expressions of the
9075         type 'element access.'
9076         (BaseAccess): New class for expressions of the type 'base access.'
9077         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
9078         respectively.
9079         
9080         * cs-parser.jay (element_access): Implement action.
9081         (base_access): Implement actions.
9082         (checked_expression, unchecked_expression): Implement.
9083
9084         * cs-parser.jay (local_variable_type): Correct and implement.
9085         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
9086
9087         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
9088
9089         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
9090         name and the specifiers.
9091
9092         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
9093         
9094         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
9095         making them all public ;-)
9096
9097         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
9098         class anyways.
9099         
9100 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
9101
9102         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
9103         PropertyExprs.
9104         (FieldExpr, PropertyExprs): New resolved expressions.
9105         (SimpleName::MemberStaticCheck): Perform static checks for access
9106         to non-static fields on static methods. Maybe this should be
9107         generalized for MemberAccesses. 
9108         (SimpleName::ResolveSimpleName): More work on simple name
9109         resolution. 
9110
9111         * cs-parser.jay (primary_expression/qualified_identifier): track
9112         the parameter index.
9113
9114         * codegen.cs (CodeGen::Save): Catch save exception, report error.
9115         (EmitContext::EmitBoolExpression): Chain to expression generation
9116         instead of temporary hack.
9117         (::EmitStatementExpression): Put generic expression code generation.
9118
9119         * assign.cs (Assign::Emit): Implement variable assignments to
9120         local variables, parameters and fields.
9121
9122 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
9123
9124         * statement.cs (Block::GetVariableInfo): New method, returns the
9125         VariableInfo for a variable name in a block.
9126         (Block::GetVariableType): Implement in terms of GetVariableInfo
9127
9128         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
9129         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
9130
9131 2001-09-06  Ravi Pratap  <ravi@ximian.com>
9132
9133         * cs-parser.jay (operator_declaration): Continue on my quest : update
9134         to take attributes argument.
9135         (event_declaration): Ditto.
9136         (enum_declaration): Ditto.
9137         (indexer_declaration): Ditto.
9138         
9139         * class.cs (Operator::Operator): Update constructor accordingly.
9140         (Event::Event): Ditto.
9141
9142         * delegate.cs (Delegate::Delegate): Same here.
9143
9144         * enum.cs (Enum::Enum): Same here.
9145         
9146 2001-09-05  Ravi Pratap  <ravi@ximian.com>
9147
9148         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
9149
9150         * ../tests/cs0658.cs : New file to demonstrate error 0658.
9151
9152         * attribute.cs (Attributes): New class to encapsulate all attributes which were
9153         being passed around as an arraylist.
9154         (Attributes::AddAttribute): Method to add attribute sections.
9155
9156         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
9157         (struct_declaration): Update accordingly.
9158         (constant_declaration): Update.
9159         (field_declaration): Update.
9160         (method_header): Update.
9161         (fixed_parameter): Update.
9162         (parameter_array): Ditto.
9163         (property_declaration): Ditto.
9164         (destructor_declaration): Ditto.
9165         
9166         * class.cs (Struct::Struct): Update constructors accordingly.
9167         (Class::Class): Ditto.
9168         (Field::Field): Ditto.
9169         (Method::Method): Ditto.
9170         (Property::Property): Ditto.
9171         (TypeContainer::OptAttribute): update property's return type.
9172         
9173         * interface.cs (Interface.opt_attributes): New member.
9174         (Interface::Interface): Update to take the extra Attributes argument.
9175
9176         * parameter.cs (Parameter::Parameter): Ditto.
9177
9178         * constant.cs (Constant::Constant): Ditto.
9179
9180         * interface.cs (InterfaceMemberBase): New OptAttributes field.
9181         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
9182         the attributes as a parameter.
9183         (InterfaceProperty): Update constructor call.
9184         (InterfaceEvent): Ditto.
9185         (InterfaceMethod): Ditto.
9186         (InterfaceIndexer): Ditto.
9187
9188         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
9189         pass the attributes too.
9190         (interface_event_declaration): Ditto.
9191         (interface_property_declaration): Ditto.
9192         (interface_method_declaration): Ditto.
9193         (interface_declaration): Ditto.
9194
9195 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
9196
9197         * class.cs (Method::Define): Track the "static Main" definition to
9198         create an entry point. 
9199
9200         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
9201         EntryPoint if we find it. 
9202
9203         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
9204         (EmitContext::ig): Make this variable public.
9205
9206         * driver.cs: Make the default output file be the first file name
9207         with the .exe extension.  
9208
9209         Detect empty compilations
9210
9211         Handle various kinds of output targets.  Handle --target and
9212         rename -t to --dumper.
9213
9214         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
9215         methods inherited from Expression return now an Expression.  This
9216         will is used during the tree rewriting as we resolve them during
9217         semantic analysis.
9218
9219         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
9220         the spec.  Missing entirely is the information about
9221         accessability of elements of it.
9222
9223         (Expression::ExprClassFromMemberInfo): New constructor for
9224         Expressions that creates a fully initialized Expression based on
9225         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
9226         a Type.
9227
9228         (Invocation::Resolve): Begin implementing resolution of invocations.
9229         
9230         * literal.cs (StringLiteral):  Implement Emit.
9231
9232 2001-09-05  Ravi Pratap  <ravi@ximian.com>
9233
9234         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
9235         member.
9236         
9237 2001-09-04  Ravi Pratap  <ravi@ximian.com>
9238
9239         * cs-parser.jay (attribute_arguments): Implement actions.
9240         (attribute): Fix bug in production. Implement action.
9241         (attribute_list): Implement.
9242         (attribute_target): Implement.
9243         (attribute_target_specifier, opt_target_specifier): Implement
9244         (CheckAttributeTarget): New method to check if the attribute target
9245         is valid.
9246         (attribute_section): Implement.
9247         (opt_attributes): Implement.
9248
9249         * attribute.cs : New file to handle attributes.
9250         (Attribute): Class to hold attribute info.
9251
9252         * cs-parser.jay (opt_attribute_target_specifier): Remove production
9253         (attribute_section): Modify production to use 2 different rules to 
9254         achieve the same thing. 1 s/r conflict down !
9255         Clean out commented, useless, non-reducing dimension_separator rules.
9256         
9257         * class.cs (TypeContainer.attributes): New member to hold list
9258         of attributes for a type.
9259         (Struct::Struct): Modify to take one more argument, the attribute list.
9260         (Class::Class): Ditto.
9261         (Field::Field): Ditto.
9262         (Method::Method): Ditto.
9263         (Property::Property): Ditto.
9264         
9265         * cs-parser.jay (struct_declaration): Update constructor call to
9266         pass in the attributes too.
9267         (class_declaration): Ditto.
9268         (constant_declaration): Ditto.
9269         (field_declaration): Ditto.
9270         (method_header): Ditto.
9271         (fixed_parameter): Ditto.
9272         (parameter_array): Ditto.
9273         (property_declaration): Ditto.
9274
9275         * constant.cs (Constant::Constant): Update constructor similarly.
9276         Use System.Collections.
9277
9278         * parameter.cs (Parameter::Parameter): Update as above.
9279
9280 2001-09-02  Ravi Pratap  <ravi@ximian.com>
9281
9282         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
9283         (TypeContainer.delegates): New member to hold list of delegates.
9284
9285         * cs-parser.jay (delegate_declaration): Implement the action correctly 
9286         this time as I seem to be on crack ;-)
9287
9288 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
9289
9290         * rootcontext.cs (RootContext::IsNamespace): new function, used to
9291         tell whether an identifier represents a namespace.
9292
9293         * expression.cs (NamespaceExpr): A namespace expression, used only
9294         temporarly during expression resolution.
9295         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
9296         utility functions to resolve names on expressions.
9297
9298 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
9299
9300         * codegen.cs: Add hook for StatementExpressions. 
9301
9302         * class.cs: Fix inverted test for static flag in methods.
9303
9304 2001-09-02  Ravi Pratap  <ravi@ximian.com>
9305
9306         * class.cs (Operator::CheckUnaryOperator): Correct error number used
9307         to make it coincide with MS' number.
9308         (Operator::CheckBinaryOperator): Ditto.
9309
9310         * ../errors/errors.txt : Remove error numbers added earlier.
9311
9312         * ../errors/cs1019.cs : Test case for error # 1019
9313
9314         * ../errros/cs1020.cs : Test case for error # 1020
9315
9316         * cs-parser.jay : Clean out commented cruft.
9317         (dimension_separators, dimension_separator): Comment out. Ostensibly not
9318         used anywhere - non-reducing rule.
9319         (namespace_declarations): Non-reducing rule - comment out.
9320
9321         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
9322         with TypeContainer::AddEnum.
9323
9324         * delegate.cs : New file for delegate handling classes.
9325         (Delegate): Class for declaring delegates.
9326
9327         * makefile : Update.
9328
9329         * cs-parser.jay (delegate_declaration): Implement.
9330
9331 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
9332
9333         * class.cs (Event::Define): Implement.
9334         (Event.EventBuilder): New member.
9335
9336         * class.cs (TypeContainer::Populate): Update to define all enums and events
9337         we have.
9338         (Events): New property for the events arraylist we hold. Shouldn't we move to using
9339         readonly fields for all these cases ?
9340
9341 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
9342
9343         * class.cs (Property): Revamp to use the convention of making fields readonly.
9344         Accordingly modify code elsewhere.
9345
9346         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
9347         the Define method of the Property class.
9348
9349         * class.cs : Clean up applied patch and update references to variables etc. Fix 
9350         trivial bug.
9351         (TypeContainer::Populate): Update to define all the properties we have. Also
9352         define all enumerations.
9353
9354         * enum.cs (Define): Implement.
9355         
9356 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
9357
9358         * cs-parser.jay (overloadable_operator): The semantic value is an
9359         enum of the Operator class.
9360         (operator_declarator): Implement actions.
9361         (operator_declaration): Implement.
9362
9363         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
9364         validity of definitions.
9365         (Operator::CheckBinaryOperator): Static method to check for binary operators
9366         (TypeContainer::AddOperator): New method to add an operator to a type.
9367
9368         * cs-parser.jay (indexer_declaration): Added line to actually call the
9369         AddIndexer method so it gets added ;-)
9370
9371         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
9372         already taken care of by the MS compiler ?  
9373
9374 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
9375
9376         * class.cs (Operator): New class for operator declarations.
9377         (Operator::OpType): Enum for the various operators.
9378
9379 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
9380
9381         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
9382         ostensibly handle this in semantic analysis.
9383
9384         * cs-parser.jay (general_catch_clause): Comment out
9385         (specific_catch_clauses, specific_catch_clause): Ditto.
9386         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
9387         (catch_args, opt_catch_args): New productions.
9388         (catch_clause): Rewrite to use the new productions above
9389         (catch_clauses): Modify accordingly.
9390         (opt_catch_clauses): New production to use in try_statement
9391         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
9392         and re-write the code in the actions to extract the specific and
9393         general catch clauses by being a little smart ;-)
9394
9395         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
9396         Hooray, try and catch statements parse fine !
9397         
9398 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
9399
9400         * statement.cs (Block::GetVariableType): Fix logic to extract the type
9401         string from the hashtable of variables.
9402
9403         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
9404         I end up making that mistake ;-)
9405         (catch_clauses): Fixed gross error which made Key and Value of the 
9406         DictionaryEntry the same : $1 !!
9407
9408 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
9409
9410         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
9411
9412         * cs-parser.jay (event_declaration): Correct to remove the semicolon
9413         when the add and remove accessors are specified. 
9414
9415 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
9416
9417         * cs-parser.jay (IndexerDeclaration): New helper class to hold
9418         information about indexer_declarator.
9419         (indexer_declarator): Implement actions.
9420         (parsing_indexer): New local boolean used to keep track of whether
9421         we are parsing indexers or properties. This is necessary because 
9422         implicit_parameters come into picture even for the get accessor in the 
9423         case of an indexer.
9424         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
9425
9426         * class.cs (Indexer): New class for indexer declarations.
9427         (TypeContainer::AddIndexer): New method to add an indexer to a type.
9428         (TypeContainer::indexers): New member to hold list of indexers for the
9429         type.
9430
9431 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
9432
9433         * cs-parser.jay (add_accessor_declaration): Implement action.
9434         (remove_accessor_declaration): Implement action.
9435         (event_accessors_declaration): Implement
9436         (variable_declarators): swap statements for first rule - trivial.
9437
9438         * class.cs (Event): New class to hold information about event
9439         declarations.
9440         (TypeContainer::AddEvent): New method to add an event to a type
9441         (TypeContainer::events): New member to hold list of events.
9442
9443         * cs-parser.jay (event_declaration): Implement actions.
9444
9445 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
9446
9447         * cs-parser.jay (dim_separators): Implement. Make it a string
9448         concatenating all the commas together, just as they appear.
9449         (opt_dim_separators): Modify accordingly
9450         (rank_specifiers): Update accordingly. Basically do the same
9451         thing - instead, collect the brackets here.
9452         (opt_rank_sepcifiers): Modify accordingly.
9453         (array_type): Modify to actually return the complete type string
9454         instead of ignoring the rank_specifiers.
9455         (expression_list): Implement to collect the expressions
9456         (variable_initializer): Implement. We make it a list of expressions
9457         essentially so that we can handle the array_initializer case neatly too.
9458         (variable_initializer_list): Implement.
9459         (array_initializer): Make it a list of variable_initializers
9460         (opt_array_initializer): Modify accordingly.
9461
9462         * expression.cs (New::NType): Add enumeration to help us
9463         keep track of whether we have an object/delegate creation
9464         or an array creation.
9465         (New:NewType, New::Rank, New::Indices, New::Initializers): New
9466         members to hold data about array creation.
9467         (New:New): Modify to update NewType
9468         (New:New): New Overloaded contructor for the array creation
9469         case.
9470
9471         * cs-parser.jay (array_creation_expression): Implement to call
9472         the overloaded New constructor.
9473         
9474 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
9475
9476         * class.cs (TypeContainer::Constructors): Return member
9477         constructors instead of returning null.
9478
9479 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
9480
9481         * typemanager.cs (InitCoreTypes): Initialize the various core
9482         types after we have populated the type manager with the user
9483         defined types (this distinction will be important later while
9484         compiling corlib.dll)
9485
9486         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
9487         on Expression Classification.  Now all expressions have a method
9488         `Resolve' and a method `Emit'.
9489
9490         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
9491         generation from working.     Also add some temporary debugging
9492         code. 
9493         
9494 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
9495
9496         * codegen.cs: Lots of code generation pieces.  This is only the
9497         beginning, will continue tomorrow with more touches of polish.  We
9498         handle the fundamentals of if, while, do, for, return.  Others are
9499         trickier and I need to start working on invocations soon.
9500         
9501         * gen-treedump.cs: Bug fix, use s.Increment here instead of
9502         s.InitStatement. 
9503
9504         * codegen.cs (EmitContext): New struct, used during code
9505         emission to keep a context.   Most of the code generation will be
9506         here. 
9507
9508         * cs-parser.jay: Add embedded blocks to the list of statements of
9509         this block.  So code generation proceeds in a top down fashion.
9510
9511 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
9512
9513         * statement.cs: Add support for multiple child blocks.
9514
9515 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
9516
9517         * codegen.cs (EmitCode): New function, will emit the code for a
9518         Block of code given a TypeContainer and its ILGenerator. 
9519
9520         * statement.cs (Block): Standard public readonly optimization.
9521         (Block::Block constructors): Link children. 
9522         (Block::Child): Child Linker.
9523         (Block::EmitVariables): Emits IL variable declarations.
9524
9525         * class.cs: Drop support for MethodGroups here, delay until
9526         Semantic Analysis.
9527         (Method::): Applied the same simplification that I did before, and
9528         move from Properties to public readonly fields.
9529         (Method::ParameterTypes): Returns the parameter types for the
9530         function, and implements a cache that will be useful later when I
9531         do error checking and the semantic analysis on the methods is
9532         performed.
9533         (Constructor::GetCallingConvention): Renamed from CallingConvetion
9534         and made a method, optional argument tells whether this is a class
9535         or a structure to apply the `has-this' bit.
9536         (Method::GetCallingConvention): Implement, returns the calling
9537         convention. 
9538         (Method::Define): Defines the type, a second pass is performed
9539         later to populate the methods.
9540
9541         (Constructor::ParameterTypes): implement a cache similar to the
9542         one on Method::ParameterTypes, useful later when we do semantic
9543         analysis. 
9544
9545         (TypeContainer::EmitMethod):  New method.  Emits methods.
9546
9547         * expression.cs: Removed MethodGroup class from here.
9548         
9549         * parameter.cs (Parameters::GetCallingConvention): new method.
9550
9551 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
9552
9553         * class.cs (TypeContainer::Populate): Drop RootContext from the
9554         argument. 
9555
9556         (Constructor::CallingConvention): Returns the calling convention.
9557         (Constructor::ParameterTypes): Returns the constructor parameter
9558         types. 
9559         
9560         (TypeContainer::AddConstructor): Keep track of default constructor
9561         and the default static constructor.
9562
9563         (Constructor::) Another class that starts using `public readonly'
9564         instead of properties. 
9565
9566         (Constructor::IsDefault): Whether this is a default constructor. 
9567
9568         (Field::) use readonly public fields instead of properties also.
9569
9570         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
9571         track of static constructors;  If none is used, turn on
9572         BeforeFieldInit in the TypeAttributes. 
9573
9574         * cs-parser.jay (opt_argument_list): now the return can be null
9575         for the cases where there are no arguments. 
9576
9577         (constructor_declarator): If there is no implicit `base' or
9578         `this', then invoke the default parent constructor. 
9579         
9580         * modifiers.cs (MethodAttr): New static function maps a set of
9581         modifiers flags into a MethodAttributes enum
9582         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
9583         MethodAttr, TypeAttr to represent the various mappings where the
9584         modifiers are used.
9585         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
9586
9587 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
9588
9589         * parameter.cs (GetParameterInfo): Fix bug where there would be no
9590         method arguments.
9591
9592         * interface.cs (PopulateIndexer): Implemented the code generator
9593         for interface indexers.
9594
9595 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
9596
9597         * interface.cs (InterfaceMemberBase): Now we track the new status
9598         here.  
9599
9600         (PopulateProperty): Implement property population.  Woohoo!  Got
9601         Methods and Properties going today. 
9602
9603         Removed all the properties for interfaces, and replaced them with
9604         `public readonly' fields. 
9605
9606 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
9607
9608         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
9609         initialize their hashtables/arraylists only when they are needed
9610         instead of doing this always.
9611
9612         * parameter.cs: Handle refs and out parameters.
9613
9614         * cs-parser.jay: Use an ArrayList to construct the arguments
9615         instead of the ParameterCollection, and then cast that to a
9616         Parameter[] array.
9617
9618         * parameter.cs: Drop the use of ParameterCollection and use
9619         instead arrays of Parameters.
9620
9621         (GetParameterInfo): Use the Type, not the Name when resolving
9622         types. 
9623
9624 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
9625
9626         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
9627         and instead use public readonly fields.
9628
9629         * class.cs: Put back walking code for type containers.
9630
9631 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
9632
9633         * class.cs (MakeConstant): Code to define constants.
9634
9635         * rootcontext.cs (LookupType): New function.  Used to locate types 
9636
9637         
9638 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
9639
9640         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
9641         this System.Reflection code is.  Kudos to Microsoft
9642         
9643         * typemanager.cs: Implement a type cache and avoid loading all
9644         types at boot time.  Wrap in LookupType the internals.  This made
9645         the compiler so much faster.  Wow.  I rule!
9646         
9647         * driver.cs: Make sure we always load mscorlib first (for
9648         debugging purposes, nothing really important).
9649
9650         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
9651         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
9652
9653         * rootcontext.cs: Lookup types on their namespace;  Lookup types
9654         on namespaces that have been imported using the `using' keyword.
9655
9656         * class.cs (TypeContainer::TypeAttr): Virtualize.
9657         (Class::TypeAttr): Return attributes suitable for this bad boy.
9658         (Struct::TypeAttr): ditto.
9659         Handle nested classes.
9660         (TypeContainer::) Remove all the type visiting code, it is now
9661         replaced with the rootcontext.cs code
9662
9663         * rootcontext.cs (GetClassBases): Added support for structs. 
9664
9665 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
9666
9667         * interface.cs, statement.cs, class.cs, parameter.cs,
9668         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
9669         Drop use of TypeRefs, and use strings instead.
9670
9671 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
9672
9673         * rootcontext.cs: 
9674
9675         * class.cs (Struct::Struct): set the SEALED flags after
9676         checking the modifiers.
9677         (TypeContainer::TypeAttr): new property, returns the
9678         TypeAttributes for a class.  
9679
9680         * cs-parser.jay (type_list): Oops, list production was creating a
9681         new list of base types.
9682
9683         * rootcontext.cs (StdLib): New property.
9684         (GetInterfaceTypeByName): returns an interface by type name, and
9685         encapsulates error handling here.
9686         (GetInterfaces): simplified.
9687         (ResolveTree): Encapsulated all the tree resolution here.
9688         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
9689         types. 
9690         
9691         * driver.cs: Add support for --nostdlib, to avoid loading the
9692         default assemblies.
9693         (Main): Do not put tree resolution here. 
9694
9695         * rootcontext.cs: Beginning of the class resolution.
9696
9697 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
9698
9699         * rootcontext.cs: Provide better error reporting. 
9700
9701         * cs-parser.jay (interface_base): set our $$ to be interfaces.
9702
9703         * rootcontext.cs (CreateInterface): Handle the case where there
9704         are no parent interfaces.
9705         
9706         (CloseTypes): Routine to flush types at the end.
9707         (CreateInterface): Track types.
9708         (GetInterfaces): Returns an array of Types from the list of
9709         defined interfaces.
9710
9711         * typemanager.c (AddUserType): Mechanism to track user types (puts
9712         the type on the global type hash, and allows us to close it at the
9713         end). 
9714         
9715 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
9716
9717         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
9718         RecordInterface instead.
9719
9720         * cs-parser.jay: Updated to reflect changes above.
9721
9722         * decl.cs (Definition): Keep track of the TypeBuilder type that
9723         represents this type here.  Not sure we will use it in the long
9724         run, but wont hurt for now.
9725
9726         * driver.cs: Smaller changes to accomodate the new code.
9727
9728         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
9729         when done. 
9730
9731         * rootcontext.cs (CreateInterface):  New method, used to create
9732         the System.TypeBuilder type for interfaces.
9733         (ResolveInterfaces): new entry point to resolve the interface
9734         hierarchy. 
9735         (CodeGen): Property, used to keep track of the code generator.
9736
9737 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
9738
9739         * cs-parser.jay: Add a second production for delegate_declaration
9740         with `VOID'.
9741
9742         (enum_body): Put an opt_comma here instead of putting it on
9743         enum_body or enum_member_declarations so we can handle trailing
9744         commas on enumeration members.  Gets rid of a shift/reduce.
9745         
9746         (type_list): Need a COMMA in the middle.
9747
9748         (indexer_declaration): Tell tokenizer to recognize get/set
9749
9750         * Remove old targets.
9751
9752         * Re-add the parser target.
9753
9754 2001-07-13  Simon Cozens <simon@simon-cozens.org>
9755
9756         * cs-parser.jay: Add precendence rules for a number of operators
9757         ot reduce the number of shift/reduce conflicts in the grammar.
9758         
9759 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
9760
9761         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
9762         and put it here.
9763
9764         Get rid of old crufty code.
9765
9766         * rootcontext.cs: Use this to keep track of the parsed
9767         representation and the defined types available to the program. 
9768
9769         * gen-treedump.cs: adjust for new convention.
9770
9771         * type.cs: Split out the type manager, and the assembly builder
9772         from here. 
9773
9774         * typemanager.cs: the type manager will live here now.
9775
9776         * cil-codegen.cs: And the code generator here. 
9777
9778 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
9779
9780         * makefile: Fixed up for easy making.
9781
9782 2001-07-13  Simon Cozens <simon@simon-cozens.org>
9783
9784         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
9785         the 
9786
9787         (unary_expression): Expand pre_increment_expression and
9788         post_decrement_expression to reduce a shift/reduce.
9789
9790 2001-07-11  Simon Cozens
9791
9792         * cs-tokenizer.cs: Hex numbers should begin with a 0.
9793
9794         Improve allow_keyword_as_indent name.
9795
9796 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
9797
9798         * Adjustments for Beta2. 
9799
9800 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
9801
9802         * decl.cs: Added `Define' abstract method.
9803         (InTransit): new property, used to catch recursive definitions. 
9804
9805         * interface.cs: Implement `Define'. 
9806
9807         * modifiers.cs: Map Modifiers.constants to
9808         System.Reflection.TypeAttribute flags.
9809
9810         * class.cs: Keep track of types and user-defined types.
9811         (BuilderInit): New method for creating an assembly
9812         (ResolveType): New function to launch the resolution process, only
9813         used by interfaces for now.
9814
9815         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
9816         that are inserted into the name space. 
9817
9818 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
9819
9820         * ARGH.  I have screwed up my tree so many times due to the use of
9821         rsync rather than using CVS.  Going to fix this at once. 
9822
9823         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
9824         load types.
9825
9826 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
9827
9828         * Experiment successful: Use System.Type rather that our own
9829         version of Type.  
9830
9831 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
9832
9833         * cs-parser.jay: Removed nsAliases from here.
9834
9835         Use new namespaces, handle `using XXX;' 
9836
9837         * namespace.cs: Reimplemented namespace handling, use a recursive
9838         definition of the class.  Now we can keep track of using clauses
9839         and catch invalid using clauses.
9840
9841 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
9842
9843         * gen-treedump.cs: Adapted for all the renaming.
9844
9845         * expression.cs (Expression): this class now has a Type property
9846         which returns an expression Type.
9847
9848         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
9849         `Type', as this has a different meaning now in the base
9850
9851 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
9852
9853         * interface.cs, class.cs: Removed from all the sources the
9854         references to signature computation, as we can not do method
9855         signature computation during the parsing time, as we are not
9856         trying to solve at that point distinguishing:
9857
9858         class X {
9859                 void a (Blah x) {}
9860                 void a (NS.Blah x) {}
9861         }
9862
9863         Which depending on the context might be valid or not, as we do not
9864         know if Blah is the same thing as NS.Blah at that point.
9865
9866         * Redid everything so the code uses TypeRefs now instead of
9867         Types.  TypeRefs are just temporary type placeholders, that need
9868         to be resolved.  They initially have a pointer to a string and the
9869         current scope in which they are used.  This is used later by the
9870         compiler to resolve the reference to an actual Type. 
9871
9872         * DeclSpace is no longer a CIR.Type, and neither are
9873         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
9874         are all DeclSpaces, but no Types. 
9875
9876         * type.cs (TypeRefManager): This implements the TypeRef manager,
9877         which keeps track of all the types that need to be resolved after
9878         the parsing has finished. 
9879
9880 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
9881
9882         * ARGH.  We are going to have to store `foreach' as a class rather
9883         than resolving it, as we need to verify error 1579 after name
9884         resolution.   *OR* we could keep a flag that says `This request to
9885         IEnumerator comes from a foreach statement' which we can then use
9886         to generate the error.
9887
9888 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
9889
9890         * class.cs (TypeContainer.AddMethod): we now add methods to the
9891         MethodGroup instead of the method hashtable.  
9892
9893         * expression.cs: Add MethodGroup abstraction, which gets us one
9894         step closer to the specification in the way we handle method
9895         declarations.  
9896
9897         * cs-parser.jay (primary_expression): qualified_identifier now
9898         tried to match up an identifier to a local variable reference or
9899         to a parameter reference.
9900
9901         current_local_parameters is now a parser global variable that
9902         points to the current parameters for the block, used during name
9903         lookup.
9904
9905         (property_declaration): Now creates an implicit `value' argument to
9906         the set accessor.
9907
9908 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
9909
9910         * parameter.cs: Do not use `param' arguments as part of the
9911         signature, per the spec.
9912
9913 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
9914
9915         * decl.cs: Base class for classes, structs and interfaces.  This
9916         is the "Declaration Space" 
9917
9918         * cs-parser.jay: Use CheckDef for checking declaration errors
9919         instead of having one on each function.
9920
9921         * class.cs: Factor out some code for handling error handling in
9922         accordance to the "Declarations" section in the "Basic Concepts"
9923         chapter in the ECMA C# spec.
9924
9925         * interface.cs: Make all interface member classes derive from
9926         InterfaceMemberBase.
9927
9928 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
9929
9930         * Many things: all interfaces are parsed and generated in
9931         gen-treedump.  Support for member variables, constructors,
9932         destructors, properties, constants is there.
9933
9934         Beginning of the IL backend, but very little done, just there for
9935         testing purposes. 
9936
9937 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
9938
9939         * cs-parser.jay: Fix labeled statement.
9940
9941         * cs-tokenizer.cs (escape): Escape " and ' always.
9942         ref_line, ref_name: keep track of the line/filename as instructed
9943         by #line by the compiler.
9944         Parse #line.
9945
9946 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
9947
9948         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
9949         to match the values in System.CodeDOM.
9950
9951         Divid renamed to Divide.
9952
9953         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
9954         statements. 
9955         (Statements.set): remove.
9956
9957         * System.CodeDOM/CodeCatchClause.cs: always have a valid
9958         statements. 
9959
9960         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
9961         falseStatements always have valid values. 
9962
9963         * cs-parser.jay: Use System.CodeDOM now.
9964