Added target 'clean' so as make clean in the parent directory does not fail.
[mono.git] / mcs / mcs / ChangeLog
1 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
2
3         * delegate.cs: If we are a toplevel delegate, use our full name.
4         If we are a nested delegate, then only use our tail name.
5
6 2002-05-02  Ravi Pratap  <ravi@ximian.com>
7
8         * expression.cs (IsApplicable): Ensure that we add the "&" to
9         ref/out types before comparing it with the type of the argument.
10
11         (IsParamsMethodApplicable): Ditto.
12
13         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
14         silly me ;-)
15
16         * delegate.cs : Handle the case when we have more than one applicable
17         method. Flag an error only when we finish checking all.
18
19 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
20
21         * expression.cs: Add support for boolean static initializers.
22
23 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
24
25         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
26
27         * parameter.cs (ComputeParameterTypes,
28         ComputeAndDefineParameterTypes): Better error handling: now we
29         clear the `types' cache if we fail during any of the type lookups.
30         We also return the status code correctly to our caller
31
32         * delegate.cs: If we fail to define a delegate, abort the extra
33         steps. 
34
35         * expression.cs (Binary.ResolveOperator): for
36         operator==(object,object) and operator !=(object, object) we also
37         have to verify that there is an implicit conversion from one to
38         the other.
39
40         (ArrayAccess.DoResolve): Array Access can operate on
41         non-variables. 
42
43 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
44
45         * assign.cs (CompoundAssign): A new class used as a "flag" that
46         the assignment actually is happening as part of a compound
47         assignment operator.
48
49         During compound assignment, a few new rules exist to enable things
50         like:
51
52         byte b |= 1 + 2
53
54         From the spec:
55         
56         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
57         to the type of x) if y is implicitly convertible to the type of x,
58         and the operator is a builtin operator and the return type of the
59         operator is explicitly convertible to the type of x. 
60
61         * rootcontext.cs: Reset warning level to 2.  4 catches various
62         "interesting" features in mcs, we must clean this up at some
63         point, but currently am trying to kill other bugs ;-)
64
65         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
66         in container classes as well.  
67
68         * expression.cs (Binary.ResolveOperator): Handle string case
69         before anything else (as operator overloading does emit an error
70         before doing anything else).
71
72         This code could go away when we move to a table driven model, but
73         i could not come up with a good plan last night.
74         
75 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
76
77         * typemanager.cs (CSharpName): reimplementation using regex.
78         * class.cs: added null check for fields in Emit
79         * rootcontext.cs: set warninglevel to 4
80
81 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
82
83         * typemanager.cs (CSharpName): reimplemented with Lupus
84         suggestion.
85
86 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
87
88         * statement.cs (If): correclty implement Resolve, because we were
89         not catching sem errors in there.  The same process is needed
90         everywhere else. 
91         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
92         
93
94         (Statement.Warning_DeadCodeFound): Factorize code.
95         (While): Report dead code here too.
96
97         (Statement): Added Resolve virtual method to allow
98         for resolution split from the emit code.
99
100 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
101
102         * statement.cs (EmitBoolExpression): No longer try to resolve the
103         expression here.    
104         (MakeBoolean): New utility function that resolve, implicitly
105         converts to boolean and tags the expression. 
106         
107
108         (If, Do): Implement dead code elimination.
109         (While): Implement loop inversion
110
111         (Do, While, For, If): Resolve the expression prior to calling our
112         code generation.
113
114 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
115
116         * class.cs:
117           - added method Report28 (warning: program has more than one entry point)
118           - added method IsEntryPoint, implements paragraph 10.1 of the spec
119           - modified method Method.Define, the part at the end of the method
120
121         * rootcontext.cs: added static public Location EntryPointLocation;
122           
123         * ../errors/cs0028.cs : Add test case for the above warning.              
124
125         * typemanager.cs:
126           - modified method CSharpName to allow arrays of primitive type to
127             be printed nicely (e.g. instead of System.Int32[][] it now prints
128             int[][])
129           - added method CSharpSignature: returns the signature of a method
130             in string format to be used in reporting errors, warnings, etc.
131
132         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
133         with String.Empty.
134         
135 2002-04-26  Ravi Pratap  <ravi@ximian.com>
136
137         * delegate.cs (Define): Fix extremely silly bug where I was
138         setting the type of the 'object' parameter of the BeginInvoke
139         method to System.IAsyncResult instead of System.Object ;-)
140
141 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
142
143         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
144         here. 
145
146         (Constructor.Emit): return if we fail to initialize the
147         constructor.  Another door closed!  
148
149         * expression.cs (New.DoResolve): Improve error message (from -6 to
150         1501).  Use DeclaredOnly lookup to find the exact constructor.
151
152         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
153         loop.  This is useful.
154
155         * cs-parser.jay: Adjust the default parameters so that destructors
156         have the proper signature.
157
158 2002-04-26  Martin Baulig  <martin@gnome.org>
159
160         * driver.cs (LoadAssembly): If `assembly' contains any characters
161         which are only valid in path names and not in assembly names
162         (currently slash, backslash and point), use Assembly.LoadFrom ()
163         instead of Assembly.Load () on the `assembly' (before iteration
164         over the link_paths).
165
166 2002-04-26  Martin Baulig  <martin@gnome.org>
167
168         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
169
170 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
171
172         * class.cs (Property): use the new typemanager.MemberLookup
173
174         (TypeContainer.MemberLookup): Implement using the
175         TypeManager.MemberLookup now. 
176         
177         * typemanager.cs: Make MemberLookup a function of the TypeManager,
178         and return MemberInfos, so that these can be used without an
179         EmitContext (what we had before).
180
181 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
182
183         * expression.cs: Fix the case where the argument to params if the
184         type of the params.  I omitted handling this before.   Fixed
185
186 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
187
188         * driver.cs: Call BootCorlib_PopulateCoreType
189
190         * class.cs (Property.CheckBase): Check for properties only, not
191         for all members. 
192
193         * interface.cs: Temporary hack: try/catch around the
194         CustomAttributeBuilder, because I am getting an exception that I
195         do not understand.
196
197         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
198         types whose definitions are required to be there (attributes are
199         defined before standard types).
200
201         Compute definitions as we boot the various types, as they are used
202         immediately (value_type class will need object_type, but if we do
203         not initialize object_type, we will pass a null, which will let
204         the runtime pick the System.Object from the existing corlib, which
205         is not what we want).
206
207 2002-04-22  Patrik Torstensson <totte@labs2.com>
208
209         * cs-tokenizer.cs: fixed a number of trim() issues.
210
211 2002-04-22  Ravi Pratap  <ravi@ximian.com>
212
213         * expression.cs (Argument.Type): Ensure that we return the correct
214         type when we have out or ref parameters [in which case we 
215         append a "&"].
216         
217 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
218
219         * class.cs (Property, Indexer): Allow extern modifier in there. 
220
221         * typemanager.cs (InitBaseTypes): Initializes object_type and
222         value_type, since those will be used early on during the bootstrap
223         process to compile corlib.
224
225         (InitCoreTypes): Move code from here to InitBaseTypes.
226
227 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
228
229         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
230         single-dimension arrays as using the ldlen opcode.  
231
232         Daniel Lewis discovered this optimization.  
233
234         * typemanager.cs: Add signature for System.Array::get_Length
235
236 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
237
238         * statement.cs: report the error when the foreach does not apply to an
239         array nor a collection.
240
241 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
242
243         * expression.cs: Add implicit conversions to the operator ~.
244
245         * constant.cs (DecimalConstant.Emit): Emit decimal value.
246
247         * typemanager.cs: Locate the decimal constructor.
248
249 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
250
251         * attribute.cs: use the new property of TypeOf.
252         * expression.cs: added 'get' property around typearg.
253
254         These changes fix a build breaker reported by NickD. Is this the
255         correct way to fix?  If not, please, revert my changes and make it
256         work :-).
257
258 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
259
260         * attribute.cs: Add support for typeof in attribute invocations.
261         I am not sure that this is right though.
262
263 2002-04-14  Duncan Mak  <duncan@ximian.com>
264
265         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
266         Binary.Operator.Division case.
267
268 2002-04-13  Ravi Pratap  <ravi@ximian.com>
269
270         * class.cs (DefineType): Ensure that we do a proper check on
271         attribute types and also register it with the TypeManager.
272
273         (TypeContainer.Targets): The default for attribute types is
274         AttributeTargets.All.
275         
276         * attribute.cs (ApplyAttributes): Registering the attribute type
277         is done elsewhere, not when we discover we have a Usage attribute.
278
279 2002-04-12  Ravi Pratap  <ravi@ximian.com>
280
281         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
282         and get rid of is_delegate parameter.
283
284         * everywhere : update.
285         
286 2002-04-12  Ravi Pratap  <ravi@ximian.com>
287
288         * cs-parser.jay (compilation_unit): Revamp completely to use
289         some new ideas that I got from Rhys' grammar to solve the problems
290         with assembly level attributes.
291
292         (outer_declaration): New grammar production.
293
294         (attribute_sections): Add.
295
296         (opt_attributes): Base on attribute_sections
297
298         (namespace_declaration): Allow opt_attributes to tackle the case
299         when we have assembly level attributes - we are clever in this
300         regard now ;-)
301
302         * attribute.cs (ApplyAttributes): Do not worry about assembly 
303         attributes in the non-global context.
304
305         * rootcontext.cs (AddGlobalAttributes): Go back to using this
306         instead of SetGlobalAttributes.
307
308         * class.cs, rootcontext.cs : Ensure we define and generate 
309         attribute types before anything else.
310
311         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
312         and flag the new error -20 for the case when the attribute type
313         does not have valid targets specified. csc does not catch this.
314
315         * ../errors/errors.txt : update for error # -20
316
317 2002-04-11  Ravi Pratap  <ravi@ximian.com>
318
319         * support.cs (InternalParameters.ParameterModifier): Do some null
320         checking and return sane values.
321
322         * class.cs (Method.Define): If we are a PInvoke method, ensure
323         that we are static and extern. Report error # 601
324
325         * ../errors/cs0601.cs : Add test case for the above error.
326
327 2002-04-07  Ravi Pratap  <ravi@ximian.com>
328
329         * rootcontext.cs (attribute_types): We need to keep type of
330         all attribute types separately and emit code for them first.
331
332         (RegisterAttribute) : Implement.
333
334         * class.cs (DefineType): Check if the current Type is a custom
335         attribute type and register it accordingly.
336
337         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
338         adding the first attribute twice and rename to
339
340         (SetGlobalAttributes): this.
341
342         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
343         lookups.
344
345         * attribute.cs (ApplyAttributes): Take an additional argument telling us
346         if we are processing global arguments. Hmm, I am unsure of this.
347
348 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
349
350         * expression.cs: added static array of strings to avoid calling
351         Enum.ToString () for Operator in Binary. Significant recover of
352         performance.
353
354 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
355
356         * class.cs (FindMembers): Allow the Builders of the various
357         members to be null.  If they are skip them.  This only happens
358         during the PInvoke declaration.
359
360 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
361
362         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
363         failure, so we do not keep going afterwards.
364
365         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
366         wanted to pass `false' as the `is_delegate' argument.  If this is
367         the case, why not use delegate_type == null to mean `is_delegate =
368         false' and anything else as is_delegate = true.
369
370 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
371
372         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
373         code for the section, not the beginning of the tests.
374
375 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
376
377         * cfold.cs: Handle operator + (Enum x, Underlying x) 
378
379         * expression.cs (Binary): same.  Warn about errors where we have
380         Enum/Enum in operator + as well.
381
382 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
383
384         * statement.cs:
385                 - added support for switch(bool)
386                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
387                 - add TableSwitchEmit() to handle table-based switch statements
388
389 2002-04-05  Ravi Pratap  <ravi@ximian.com>
390
391         * expression.cs (Invocation.OverloadResolve): Factor out code which
392         does parameter compatibility checking with arguments so that we can 
393         re-use the code even from Delegate.VerifyApplicability
394
395         (VerifyArgumentsCompat): Move above code here.
396
397         * delegate.cs (VerifyApplicability): Get rid of duplicate code
398         and instead make a call to the above method.
399
400 2002-03-31  Ravi Pratap  <ravi@ximian.com>
401
402         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
403         We use it to keep track of classes which are attribute types.
404
405 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
406
407         * delegate.cs (Delegate.Define): Correctly define the types in the
408         presence of fixed and array parameters.
409
410         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
411         doing FindMembers.
412
413         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
414         include NonPublic after the first iteration.
415
416         * class.cs (Indexer.CheckBase): Only check if both parents are
417         non-null. 
418         
419         * cs-parser.jay (accessor_body): If empty, set to null.
420
421         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
422         same code path here to resolve constants names that we did have in
423         MemberAccess.DoResolve.  There is too much code duplicated here.
424
425 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
426
427         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
428
429         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
430         to MakeUnionSet.
431
432         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
433         tokens, numbers and strings.
434
435         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
436         parenthesis.
437
438         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
439         asyncronous parameters and the regular parameters.  
440
441         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
442         specify the target directory.
443
444         * expression.cs: (This.DoResolve): Simplify
445         (As.Emit): Optimize, do not generate IsInst if the expression is
446         always of the given type.
447
448         (Is.DoResolve): Bug fix, we were reporting both always/never for
449         the is expression.
450
451         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
452         creating too many unnecessary arrays.
453
454 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
455
456         * class.cs (EmitFieldInitializer): Use Assign expression to assign
457         fields instead of rolling our own initializer.   Takes care of all
458         implicit conversions, and drops unnecessary static checks/argument.
459
460 2002-03-31  Dick Porter  <dick@ximian.com>
461
462         * driver.cs: use the GetDirectories() return values properly, and
463         use "/" as path separator.
464
465 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
466
467         * expression.cs (Unary): Optimize - - expr into expr.
468         (Binary): Optimize a + (-b) into a -b.
469
470         * codegen.cs (CodeGen): Made all methods static.
471
472 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
473
474         * rootcontext.cs: 
475
476         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
477         TypeBuilder property.
478
479         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
480         instead. 
481
482         * tree.cs: Removed the various RecordXXXX, and replaced with a
483         single RecordDecl.  Removed all the accessor methods, and just
484         left a single access point Type 
485
486         * enum.cs: Rename DefineEnum to DefineType.
487
488         * decl.cs: New abstract method `DefineType' used to unify the
489         Defines for Enumerations, Interfaces, TypeContainers and
490         Delegates.
491
492         (FindType): Moved LookupInterfaceOrClass here.  Moved the
493         LookupBaseClasses method that used to live in class.cs and
494         interface.cs here, and renamed to FindType.
495         
496         * delegate.cs: Implement DefineType.  Take advantage of the
497         refactored pattern for locating the parent builder without taking
498         the parent_builder argument (which we know does not work if we are
499         nested, and triggering a toplevel definition).
500
501 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
502
503         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
504         accessibility of a member has changed during override and report
505         an error if so.
506
507         * class.cs (Method.Define, Property.Define): Only complain on
508         overrides if the method is private, any other accessibility is
509         fine (and since we just checked the permission is the same, we are
510         good to go).
511
512         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
513         and elif are processed always.  The other pre-processing
514         directives are only processed if we are "taking" the path
515
516 2002-03-29  Martin Baulig  <martin@gnome.org>
517
518         * class.cs (Method.Emit): Only emit symbolic debugging info if the
519         current location is not Null.
520
521         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
522         a separate method so we can profile it.
523
524         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
525         `span.Seconds' are just seconds, but no minutes or hours.
526         (MainDriver): Profile the CodeGen.SaveSymbols calls.
527
528 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
529
530         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
531         Remove the gratuitous set of Final:
532
533                                 // If an interface implementation, then we can set Final.
534                                 if (((flags & MethodAttributes.Abstract) == 0) &&
535                                     implementing.DeclaringType.IsInterface)
536                                         flags |= MethodAttributes.Final;
537
538         I do not know what I was smoking when I used that.
539         
540
541         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
542         step into fixing the name resolution issues for delegates and
543         unifying the toplevel name resolution.
544
545 2002-03-28  Martin Baulig  <martin@gnome.org>
546
547         * class.cs (Method.Emit): If we have a symbol writer, call its
548         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
549         tell it about the current method.
550
551         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
552         writer that we're going to emit the first byte of IL code for a new
553         statement (a new source line).
554         (EmitContext.EmitTopBlock): If we have a symbol writer, call
555         EmitContext.Mark() before emitting any code.
556
557         * location.cs (SymbolDocument): Return null when we're Null.
558
559         * statement.cs (Statement): Moved the `Location loc' variable here.
560         (Statement.EmitBoolExpression): If we have a symbol writer, call
561         ec.Mark() before emitting any code to tell it that we're at the
562         beginning of a new statement.
563         (StatementExpression): Added `Location' argument to the constructor.
564         (Block): Added public readonly variable `StartLocation' and public
565         variable `EndLocation'.  The latter is to be set using SetEndLocation().
566         (Block): Added constructor which takes a start and end location.
567         (Block.SetEndLocation): New method. This sets the end location.
568         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
569         local variables we create.
570         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
571         each statement and do also mark the begin and end of the block.
572
573         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
574         tell it the current lexer.Location, use Location.Null for the end of the
575         block.
576         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
577         current block, set its end location using SetEndLocation().
578         (statement_expression): StatementExpression constructor now takes the
579         lexer.Location as additional argument.
580         (for_statement, declare_local_variables): Likewise.
581         (declare_local_variables): When creating a new implicit block, use the
582         new Block constructor and pass it the lexer.Location.
583
584 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
585
586         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
587         members also on the parent interfaces recursively.
588
589 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
590
591         * report.cs: Use new formats, since Gonzalo finished the missing
592         bits. 
593
594         * expression.cs (Binary.ResolveOperator): added missing operator|
595         operator& and operator^ for bool/bool.
596
597         * cs-parser.jay: CheckDef now takes a Location argument that is
598         used to report errors more precisly (instead of reporting the end
599         of a definition, we try to track something which is a lot closer
600         to the source of the problem).
601
602         * cs-tokenizer.cs: Track global token use, so we can properly flag
603         the use of #define/#undef after the first token has been seen.
604
605         Also, rename the reportXXXX to Error_DescriptiveName
606
607         * decl.cs (DeclSpace.IsTopLevel): Move property here from
608         TypeContainer, so that Enum and Interface can use this too.
609
610         * class.cs (TypeContainer.LookupInterfaceOrClass,
611         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
612         `builder' argument.  Typically this was used to pass the parent
613         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
614         the definition).  
615
616         The problem is that a nested class could trigger the definition of
617         a toplevel class, and the builder would be obviously wrong in that
618         case. 
619
620         So we drop this argument, and we compute dynamically the
621         TypeBuilder/ModuleBuilder (the correct information was available
622         to us anyways from DeclSpace.Parent)
623
624         * interface.cs (Interface.DefineInterface): Drop builder
625         parameter cleanup like class.cs
626
627         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
628         like class.cs
629
630         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
631         values. 
632
633         (Try.Emit): Propagate the returns value from the statement.
634
635         (Return.Emit): Even if we are leavning 
636
637         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
638
639         * modifiers.cs: Fix the computation of MethodAttributes flags.
640
641 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
642
643         * driver.cs: allow compilation of files that start with '/'.
644         Add a default case when checking the argument of --target.
645
646 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
647
648         * interface.cs: Implement the same search algorithm for types in
649         the interface code.
650
651         * delegate.cs: Do not allow multiple definition.
652
653         * Recovered ChangeLog that got accidentally amputated
654
655         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
656
657         * rootcontext.cs: Load manually enum to allow core classes to
658         contain enumerations.
659
660         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
661         Update to new static methods in TypeManager.
662
663         * typemanager.cs (GetMethod, GetConstructor): Use our
664         implementation of FindMembers to find the members, since during
665         corlib compilation, the types are TypeBuilders and GetMethod and
666         GetConstructor do not work.
667
668         Make all methods in TypeManager static.
669
670         (InitCodeHelpers): Split the functionality from
671         the InitCodeTypes function.
672
673         * driver.cs: Call InitCodeHelpers after we have populated the
674         types. 
675
676         * cs-parser.jay (delegate_declaration): we did not used to compute
677         the delegate name correctly for void delegates.
678
679 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
680
681         * rootcontext.cs (RootContext): Init the interface_resolve_order
682         and type_container_resolve_order always.
683
684         (ResolveCore, BootstrapCorlib_ResolveClass,
685         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
686         compiler when compiling with --nostdlib
687
688         * class.cs (TypeContainer.DefineType): Check that our parent is
689         not null.  This test is most important when we are bootstraping
690         the core types.
691
692         * codegen.cs: Split out the symbol writing code.
693
694 2002-03-25  Martin Baulig  <martin@gnome.org>
695
696         * driver.cs (-g): Made -g an alias for --debug.
697
698 2002-03-24  Martin Baulig  <martin@gnome.org>
699
700         * codegen.cs (SymbolWriter): New public variable. Returns the
701         current symbol writer.
702         (CodeGen): Added `bool want_debugging_support' argument to the
703          constructor. If true, tell the ModuleBuild that we want debugging
704         support and ask it for the ISymbolWriter.
705         (Save): If we have a symbol writer, call it's Close() method after
706         saving the assembly.
707
708         * driver.c (--debug): New command line argument to create a
709         debugger information file.
710
711         * location.cs (SymbolDocument): New public property. Returns an
712         ISymbolDocumentWriter object for the current source file or null
713         if we don't have a symbol writer.
714
715 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
716
717         * driver.cs (LoadAssembly): Correctly return when all the paths
718         have been tried and not before.
719
720         * statement.cs (Switch.Emit): return the actual coverage for this
721         statement (returns/not-returns)
722
723         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
724         switch of the statement if we are the last switch section.  That
725         kills two problems: try/catch problems (we used to emit an empty
726         nop at the end) and switch statements where all branches would
727         return. 
728
729 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
730
731         * driver.cs: Add default assemblies (the equivalent to the
732         Microsoft CSC.RSP file)
733
734         * cs-tokenizer.cs: When updating `cols and setting it to zero,
735         also update tokens_seen and set it to false.
736
737         * driver.cs: Implement --recurse for Mike.
738
739         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
740         correctly splitting out the paths.
741
742 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
743
744         * interface.cs (Interface.PopulateProperty): Instead of using
745         `parent' as the declaration space for the set parameters, use
746         `this' 
747
748         * support.cs (InternalParameters): InternalParameters constructor
749         takes a DeclSpace instead of a TypeContainer.
750
751         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
752         types are being initialized, load the address of it before calling
753         the function.  
754
755         (New): Provide a mechanism to disable the generation of local
756         value type temporaries when the caller will be providing us with
757         an address to store it.
758
759         (ArrayCreation.EmitDynamicInitializers): Use it.
760
761 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
762
763         * expression.cs (Invocation.EmitArguments): Only probe for array
764         property if there is more than one argument.  Sorry about that.
765
766         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
767         empty param arrays.
768         
769         * class.cs (Method.LabelParameters): Fix incorrect code path that
770         prevented the `ParamArrayAttribute' from being applied to the
771         params attribute.
772
773 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
774
775         * support.cs (ReflectionParameters): Correctly compute whether the
776         last argument is a params array.  Fixes the problem with
777         string.Split ('a')
778
779         * typemanager.cs: Make the assemblies array always be non-null
780         (empty, but non-null)
781
782         * tree.cs (RecordDecl): New function that abstracts the recording
783         of names.  This reports error 101, and provides a pointer to the
784         previous declaration.  Fixes a crash in the compiler.
785
786         * cs-parser.jay (constructor_declaration): Update to new grammar,
787         and provide a constructor_body that can be empty.
788
789 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
790
791         * driver.cs: Add support for --resources.
792
793         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
794         Make all types for the various array helper methods be integer.
795
796         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
797         CheckState to ConvCast.
798
799         (ConvCast): Now it takes a `checked' state argument, to avoid
800         depending on the emit context for the conversion, and just using
801         the resolve time setting.
802
803         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
804         instead of Invocation.EmitArguments.  We do not emit the original
805         arguments, instead we emit those which have been converted to
806         unsigned int expressions.
807
808         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
809
810         * codegen.cs: ditto.
811
812         * expression.cs (LocalVariableReference): Drop the use of the
813         Store function that depended on the variable index.
814
815         * statement.cs (VariableInfo): Drop the `Idx' property from this
816         class, as this is not taking into account the indexes for
817         temporaries tat we generate during the execution, getting the
818         indexes wrong.
819
820         * class.cs: First emit class initializers, then call the parent
821         constructor. 
822
823         * expression.cs (Binary): Fix opcode emision.
824         (UnaryMutator.EmitCode): Support checked code generation
825
826         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
827         matches for events for both the Static and Instance scans,
828         pointing to the same element.   Fix that.
829
830 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
831
832         * rootcontext.cs (ResolveTree): Always set the
833         interface_resolve_order, because nested interfaces will be calling
834         into us.
835
836         * class.cs (GetInterfaceOrClass): Track the same resolution
837         process used by TypeManager.LookupType.  This fixes the nested
838         type lookups in class declarations (separate path from
839         LookupType). 
840
841         (TypeContainer.DefineType): Also define nested interfaces.
842         (TypeContainer.RegisterOrder): New public function used to
843         register the order in which child interfaces need to be closed.
844
845         Nested interfaces need to be closed after their parents have been
846         created. 
847         
848         * interface.cs (InterfaceAttr): Put all the logic for computing
849         the interface attribute here. 
850
851         (DefineInterface): Register our interface order with the
852         RootContext or with the TypeContainer depending on the case.
853
854 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
855
856         * cs-parser.jay: rework foreach statement to work with the new
857         changes to the policy on SimpleNames.
858         
859         * report.cs: support Stacktrace on warnings as well.
860
861         * makefile: drop --unsafe and /unsafe from the compile.
862
863 2002-03-13  Ravi Pratap  <ravi@ximian.com>
864
865         * ecore.cs (StandardConversionExists): Modify to take an Expression
866         as the first parameter. Ensure we do null -> reference type conversion
867         checking.
868
869         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
870         temporary Expression objects.
871
872 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
873
874         * interface.cs: workaround bug in method overloading resolution
875         (there is already a bugzilla bug for it).
876
877 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
878
879         We could also solve this problem by having a separate path for
880         performing type lookups, instead of DoResolve, we could have a
881         ResolveType entry point, and only participating pieces of the
882         production (simplename, deref, array) would implement this. 
883         
884         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
885         signal SimpleName to only resolve type names and not attempt to
886         resolve anything else.
887
888         * expression.cs (Cast): Set the flag.
889
890         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
891
892         * class.cs: Only report 108 if there is no `new' modifier.
893
894         * cs-parser.jay: rework foreach statement to work with the new
895         changes to the policy on SimpleNames.
896         
897         * report.cs: support Stacktrace on warnings as well.
898
899         * makefile: drop --unsafe and /unsafe from the compile.
900
901 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
902
903         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
904         lookups here, instead of doing that at parse time.  This means
905         that our grammar will not introduce `LocalVariableReferences' as
906         expressions at this point.  That solves the problem of code like
907         this:
908
909         class X {
910            static void Main ()
911            { int X = 1;
912             { X x = null }}}
913
914         This is only half the fix.  The full fix requires parameters to
915         also be handled in this way.
916
917         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
918         makes the use more obvious of the DeclSpace.  The
919         ec.TypeContainer.TypeBuilder is now only used to pull the
920         TypeBuilder for it.
921
922         My theory is that I can get rid of the TypeBuilder completely from
923         the EmitContext, and have typecasts where it is used (from
924         DeclSpace to where it matters).  
925
926         The only pending problem is that the code that implements Aliases
927         is on TypeContainer, and probably should go in DeclSpace.
928
929         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
930         lookups here, instead of doing that at parse time.  This means
931         that our grammar will not introduce `LocalVariableReferences' as
932         expressions at this point.  That solves the problem of code like
933         this:
934
935         class X {
936            static void Main ()
937            { int X = 1;
938             { X x = null }}}
939
940         This is only half the fix.  The full fix requires parameters to
941         also be handled in this way.
942
943         * class.cs (Property.DefineMethod): When implementing an interface
944         method, set newslot, when implementing an abstract method, do not
945         set the flag (before we tried never setting it, or always setting
946         it, which is the difference).
947         (Indexer.DefineMethod): same.
948         (Method.DefineMethod): same.
949
950         * ecore.cs: Only set the status used flag if we get back a Field.
951
952         * attribute.cs: Temporary hack, so Paolo can keep working.
953
954 2002-03-08  Ravi Pratap  <ravi@ximian.com>
955
956         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
957         the unmanaged type in the case we have a MarshalAs attribute.
958
959         (Resolve): Handle the case when we are parsing the special MarshalAs
960         attribute [we need to store the unmanaged type to use later]
961         
962         * typemanager.cs (marshal_as_attr_type): Built in type for the 
963         MarshalAs Attribute.
964
965         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
966         on parameters and accordingly set the marshalling info.
967         
968 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
969
970         * class.cs: Optimizing slightly by removing redundant code after
971         we switched to the `NoTypes' return value.
972         (Property.DefineMethod): use NoTypes here too.
973
974         This fixes the bug I introduced in my last batch of changes.
975
976 2002-03-05  Ravi Pratap  <ravi@ximian.com>
977
978         * tree.cs (RecordEnum): Add. We now keep track of enums too.
979
980         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
981         Enums since those are types too. 
982
983         * cs-parser.jay (enum_declaration): Record enums as we parse them.
984         
985         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
986         thanks to a call during the lookup process.
987
988 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
989
990         * statement.cs (Foreach): Lots of work to accomodate a particular
991         kind of foreach statement that I had not kept in mind.  It is
992         possible to have foreachs on classes that provide a GetEnumerator
993         method that return objects that implement the "pattern" for using
994         a foreach, there is no need to support GetEnumerator
995         specifically. 
996
997         This is needed to compile nant.
998
999         * decl.cs: Only report 114 if the member is not `Finalize' and if
1000         the warning level is at least 2.
1001
1002         * class.cs: Moved the compare function from Method to
1003         MethodSignature. 
1004
1005         (MethodSignature.InheritableMemberSignatureCompare): Add new
1006         filter function that is used to extract inheritable methods from a
1007         class. 
1008
1009         (Method.Define): Use the new `inheritable_method_signature_filter'
1010         delegate
1011
1012         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
1013         command. 
1014
1015 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
1016
1017         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
1018
1019         * cs-parser.jay: Add opt_semicolon to the interface declaration.
1020
1021         * expression.cs: Pass location information to
1022         ConvertImplicitStandard. 
1023
1024         * class.cs: Added debugging code to track return values from
1025         interfaces. 
1026
1027 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
1028
1029         * expression.cs (Is.DoResolve): If either side of the `is' is an
1030         interface, do not flag the warning.
1031
1032         * ecore.cs (ImplicitReferenceConversion): We need a separate test
1033         for interfaces
1034
1035         * report.cs: Allow for --fatal to be used with --probe.
1036         
1037         * typemanager.cs (NoTypes): Move the definition for the empty Type
1038         array here. 
1039
1040         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
1041         properties. 
1042         (TypeContainer.DefineProxy): New function used to proxy to parent
1043         implementations when implementing interfaces.
1044         (TypeContainer.ParentImplements): used to lookup if our parent
1045         implements a public function that is required by an interface.
1046         (TypeContainer.VerifyPendingMethods): Hook this up.
1047
1048         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
1049         `modules' and `assemblies' arraylists into arrays.  We only grow
1050         these are the very early start up of the program, so this improves
1051         the speedof LookupType (nicely measured).
1052
1053         * expression.cs (MakeByteBlob): Replaced unsafe code with
1054         BitConverter, as suggested by Paolo.
1055
1056         * cfold.cs (ConstantFold.Binary): Special case: perform constant
1057         folding of string concatenation, but if either side is a string,
1058         and the other is not, then return null, and let the runtime use
1059         the concatenation on the string plus the object (using
1060         `Object.ToString'). 
1061
1062 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
1063
1064         Constant Folding has been implemented now.
1065         
1066         * expression.cs (Unary.Reduce): Do not throw an exception, catch
1067         the error instead on types that are not supported in one's
1068         complement. 
1069
1070         * constant.cs (Constant and all children): New set of functions to
1071         perform implict and explicit conversions.
1072         
1073         * ecore.cs (EnumConstant): Implement the new functions to perform
1074         conversion by proxying to the child expression.
1075
1076         * codegen.cs: (ConstantCheckState): Constant evaluation has its
1077         own separate setting that can not be turned off from the command
1078         line using --unchecked or --checked and is only controlled using
1079         the checked/unchecked statements and expressions.  This setting is
1080         used by the constant folder to flag errors.
1081
1082         * expression.cs (CheckedExpr, UncheckedExpr): Set the
1083         ConstantCheckState as well.   
1084
1085         During Resolve, they also have to flag the state, because the
1086         constant folder runs completely in the Resolve phase.
1087
1088         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
1089         well.
1090
1091 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
1092
1093         * cfold.cs: New file, this file contains the constant folder.
1094         
1095         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
1096         argument to track whether we are using the resulting address to
1097         load or store a value and provide better error messages. 
1098
1099         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
1100         new AddressOf arguments.
1101
1102         * statement.cs (Foreach.EmitCollectionForeach): Update
1103
1104         * expression.cs (Argument.Emit): Call AddressOf with proper
1105         arguments to track usage.
1106
1107         (New.DoEmit): Call AddressOf with new arguments.
1108
1109         (Unary.Emit): Adjust AddressOf call.
1110
1111 2002-03-01  Ravi Pratap  <ravi@ximian.com>
1112
1113         * cs-parser.jay (member_access): Change the case for pre-defined types
1114         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
1115         this suggestion.
1116
1117         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
1118         a method body.
1119
1120         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
1121         essentially like methods and apply attributes like MethodImplOptions to them too.
1122
1123         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
1124         not being null.
1125
1126         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
1127         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
1128         is the DeclSpace.
1129
1130         * Update code everywhere accordingly.
1131
1132         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
1133
1134         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
1135
1136 2002-02-28  Ravi Pratap  <ravi@ximian.com>
1137
1138         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
1139         try performing lookups against those instead of jumping straight into using
1140         the 'using' clauses.
1141
1142         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
1143
1144         (LookupType): Perform lookups in implicit parents too.
1145
1146         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
1147         sequence as RootContext.LookupType. 
1148
1149         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
1150         the various cases of namespace lookups into this method.
1151
1152 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
1153
1154         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
1155         in positional arguments)
1156
1157         * class.cs (Operator): Update the AllowedModifiers to contain
1158         extern. 
1159
1160         * cs-parser.jay: Update operator declaration to allow for the
1161         operator body to be empty.
1162
1163         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
1164         values. 
1165
1166 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
1167
1168         * class.cs (Method.Emit): Label parameters.
1169
1170         * driver.cs: Return 1 or 0 as the program exit code.
1171
1172 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
1173
1174         * expression.cs: Special case the `null' object when trying to
1175         auto-compute the type, as anything can be explicitly converted to
1176         that. 
1177
1178         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
1179         spotting this Paolo.
1180
1181         (Expression.ImplicitNumericConversion): Perform comparissions of
1182         the type using the underlying type in the case of an enumeration
1183         rather than using the enumeration type for the compare.
1184
1185         Cope with the underlying == type case, which is not possible to
1186         catch before. 
1187
1188         (Expression.ConvertNumericExplicit): Perform comparissions of
1189         the type using the underlying type in the case of an enumeration
1190         rather than using the enumeration type for the compare.
1191
1192         * driver.cs: If the user does not supply an extension, assume .exe
1193
1194         * cs-parser.jay (if_statement): Rewrote so that we can track the
1195         location for the if statement.
1196
1197         * expression.cs (Binary.ConstantFold): Only concat strings when
1198         the operation is "+", not everything ;-)
1199
1200         * statement.cs (Statement.EmitBoolExpression): Take a location
1201         argument. 
1202         (If, While, Do): Track location.
1203
1204         * expression.cs (Binary.ResolveOperator): In the object + string
1205         case, I was missing a call to ConvertImplicit
1206
1207 2002-02-25  Ravi Pratap  <ravi@ximian.com>
1208
1209         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
1210         Location arguments. Ensure we use RootContext.LookupType to do our work
1211         and not try to do a direct Type.GetType and ModuleBuilder.GetType
1212
1213         * interface.cs (PopulateMethod): Handle the type of the parameter being
1214         null gracefully.
1215
1216         * expression.cs (Invocation.BetterFunction): Handle the case when we 
1217         have a params method with no fixed arguments and a call is made with no
1218         arguments.
1219
1220 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
1221
1222         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
1223         the verbatim-string-literal
1224
1225         * support.cs (InternalParameters.ParameterModifier): handle null
1226         fixed parameters.
1227         (InternalParameters.ParameterType): ditto.
1228
1229         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
1230         duplicating the name of the variable parameter.
1231         (GetParameterByName): Fix bug where we were not looking up array
1232         paramters if they were the only present (thanks Paolo!).
1233         (GetParameterInfo): We only have an empty set of types if both
1234         fixed and array are set to null.
1235         (GetParameterInfo-idx): Handle FixedParameter == null
1236
1237         * cs-parser.jay: Handle the case where there is no catch
1238         statements (missing null test).
1239
1240 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
1241
1242         * driver.cs (MainDriver): Be conservative on our command line
1243         handling.
1244
1245         Catch DirectoryNotFoundException when calling GetFiles.
1246         
1247         (SplitPathAndPattern): Used to split the input specification into
1248         a path and a pattern that we can feed to Directory.GetFiles.
1249
1250 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
1251
1252         * statement.cs (Fixed): Implement the last case of the Fixed
1253         statement (string handling).
1254
1255         * expression.cs (StringPtr): New class used to return a char * to
1256         a string;  Used by the Fixed statement.
1257
1258         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
1259
1260         * expression.cs (Binary.ResolveOperator): Remove redundant
1261         MemberLookup pn parent type.
1262         Optimize union call, we do not need a union if the types are the same.
1263         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
1264         type.
1265
1266         Specialize the use of MemberLookup everywhere, instead of using
1267         the default settings. 
1268
1269         (StackAlloc): Implement stackalloc keyword.
1270
1271         * cs-parser.jay: Add rule to parse stackalloc.
1272         
1273         * driver.cs: Handle /h, /help, /?
1274
1275         * expression.cs (MakeByteBlob): Removed the hacks we had in place
1276         before we supported unsafe code.
1277         
1278         * makefile: add --unsafe to the self compilation of mcs.
1279
1280 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
1281
1282         * expression.cs (PointerArithmetic): New class that is used to
1283         perform pointer arithmetic.
1284         (Binary.Resolve): Handle pointer arithmetic
1285         Handle pointer comparission.
1286         (ArrayPtr): Utility expression class that is used to take the
1287         address of an array.
1288
1289         (ElementAccess): Implement array access for pointers
1290         
1291         * statement.cs (Fixed): Implement fixed statement for arrays, we
1292         are missing one more case before we are done.
1293
1294         * expression.cs (Indirection): Implement EmitAssign and set the
1295         ExprClass to Variable.  This allows pointer dereferences to be
1296         treated as variables, and to have values assigned to them.
1297         
1298         * ecore.cs (Expression.StoreFromPtr): New utility function to
1299         store values dereferencing.
1300
1301 2002-02-20  Ravi Pratap  <ravi@ximian.com>
1302
1303         * expression.cs (Binary.ResolveOperator): Ensure that we are
1304         not trying to operate on a void type - this fixes the reported
1305         bug.
1306
1307         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
1308         the parent implementation is sealed.
1309
1310         * ../errors/cs0239.cs : Add.
1311
1312         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
1313
1314         * typemanager.cs (unverifiable_code_type): Corresponds to 
1315         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
1316         which have unsafe code in them.
1317
1318         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
1319         unsafe context.
1320
1321 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
1322
1323         * cs-tokenizer.cs: Add support for @"litreal strings"
1324
1325         Make tokenizer accept pre-processor directives
1326         on any column (remove the old C-like limitation). 
1327
1328         * rootcontext.cs (EmitCode): Emit any global attributes.
1329         (AddGlobalAttributes): Used to keep track of assembly attributes. 
1330
1331         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
1332
1333         * cs-parser.jay: Add support for global attributes.  
1334
1335 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
1336
1337         * expression.cs (Indirection): New helper class.  Unary will
1338         create Indirection classes to be able to implement the
1339         IMemoryLocation interface on it.
1340
1341 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
1342
1343         * cs-parser.jay (fixed_statement): reference the right statement.
1344
1345         * statement.cs (Fixed.Emit): Finish implementing the fixed
1346         statement for the &x case.
1347
1348 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
1349
1350         * class.cs (Property.Define, Method.Define): Remove newslot when
1351         `implementing'.  
1352
1353         * modifiers.cs: My use of NewSlot when `Abstract' was set was
1354         wrong.  NewSlot should only be used if the `new' keyword is present.
1355
1356         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
1357         locating our system dir.  Sorry about this.
1358
1359 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
1360
1361         * driver.cs (GetSystemDir): Compute correctly the location of our
1362         system assemblies.  I was using the compiler directory instead of
1363         the library directory.
1364
1365 2002-02-13  Ravi Pratap  <ravi@ximian.com>
1366
1367         * expression.cs (BetterFunction): Put back in what Miguel commented out
1368         since it is the correct fix. The problem is elsewhere ;-)
1369
1370         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
1371         parameters of the parms method are themselves compatible or not !
1372
1373         (StandardConversionExists): Fix very dangerous bug where we were forgetting
1374         to check that a class implements an interface before saying that an implicit
1375         conversion was allowed. Use ImplementsInterface to do the checking.
1376
1377 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
1378
1379         * class.cs (Method.Define): Track whether we are an explicit
1380         implementation or not.  And only call DefineMethodOverride if we
1381         are an explicit implementation.
1382
1383         (Property.DefineMethod): Ditto.
1384
1385 2002-02-11  Ravi Pratap  <ravi@ximian.com>
1386
1387         * expression.cs (BetterFunction): Catch hideous bug which was
1388          preventing us from detecting ambiguous calls due to implicit casts i.e
1389         cs0121.
1390
1391 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
1392
1393         * support.cs (Pair): Remove un-needed method.  I figured why I was
1394         getting the error in cs-parser.jay, the variable in a foreach loop
1395         is readonly, and the compiler does not really treat this as a variable.
1396
1397         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
1398         instead of EQUALS in grammar.  
1399
1400         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
1401
1402         * expression.cs (Unary.DoResolve): Check whether the argument is
1403         managed or not.
1404
1405 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
1406
1407         * support.cs: Api for Pair to set a value.  Despite the fact that
1408         the variables are public the MS C# compiler refuses to compile
1409         code that accesses the field if the variable is part of a foreach
1410         statement. 
1411
1412         * statement.cs (Fixed): Begin implementation of the fixed
1413         statement.
1414
1415         (Block.AddVariable): Return the VariableInfo on success and null
1416         on failure instead of true/false. 
1417
1418         * cs-parser.jay (foreach): Catch errors on variables already
1419         defined (we were ignoring this value before) and properly unwind
1420         the block hierarchy
1421
1422         (fixed_statement): grammar for the fixed statement.
1423
1424 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
1425
1426         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
1427         pointer types to be incretemented.
1428
1429         (SizeOf): Implement.
1430
1431         * cs-parser.jay (pointer_member_access): Implement
1432         expr->IDENTIFIER production.
1433
1434         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
1435         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
1436         on safe contexts.
1437
1438         (Unary): Implement indirection.
1439
1440         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
1441         use in non-unsafe context).
1442
1443         (SimpleName.DoResolve): Check for pointers in field access on safe
1444         contexts. 
1445
1446         (Expression.LoadFromPtr): Factor the load-indirect code in this
1447         function.  This was duplicated in UnboxCast and ParameterReference
1448
1449 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
1450
1451         * expression.cs (ComposedCast): report an error if a pointer cast
1452         is used in a safe region.
1453
1454         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
1455         pointer type casts in unsafe context.
1456
1457         * codegen.cs (EmitContext): Set up IsUnsafe.
1458
1459         * cs-parser.jay (non_expression_type): Add productions for pointer
1460         casts. 
1461
1462         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
1463         code.  We should not use force into static mode if the method is
1464         not virtual.  Fixes bug in MIS
1465
1466         * statement.cs (Do.Emit, While.Emit, For.Emit,
1467         Statement.EmitBoolExpression): Add support to Do and While to
1468         propagate infinite loop as `I do return' semantics.
1469
1470         Improve the For case to also test for boolean constants.
1471
1472         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
1473         to the list of attributes we can add.
1474
1475         Remove `EmitContext' argument.
1476
1477         * class.cs (Method.Define): Apply parameter attributes.
1478         (Constructor.Define): Apply parameter attributes.
1479         (MethodCore.LabelParameters): Move here the core of labeling
1480         parameters. 
1481
1482         * support.cs (ReflectionParameters.ParameterModifier,
1483         InternalParameters.ParameterModifier): Use IsByRef on the type and
1484         only return the OUT bit for these parameters instead of in/out/ref
1485         flags.
1486
1487         This is because I miss-understood things.  The ParameterInfo.IsIn
1488         and IsOut represent whether the parameter has the [In] and [Out]
1489         attributes set.  
1490
1491 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
1492
1493         * ecore.cs (FieldExpr.Emit): Release temporaries.
1494
1495         * assign.cs (LocalTemporary.Release): new function.
1496
1497         * codegen.cs (EmitContext.GetTemporaryStorage,
1498         EmitContext.FreeTemporaryStorage): Rework the way we deal with
1499         temporary storage.  Now we can "put back" localbuilders when we
1500         are done with them
1501
1502 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
1503
1504         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
1505         need to make a copy of the variable to generate verifiable code.
1506
1507 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
1508
1509         * driver.cs: Compute dynamically the system directory.
1510
1511         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
1512         Slower, but more generally useful.  Used by the abstract
1513         registering implementation. 
1514
1515         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
1516         the rules for the special rule on Type/instances.  First check if
1517         we have the same name, and if so, try that special static path
1518         rather than the instance path.
1519         
1520 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
1521
1522         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
1523         for, while and if.
1524
1525         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
1526         Enum, ValueType, Delegate or Array for non-corlib compiles.
1527
1528         * cs-tokenizer.cs: Catch long identifiers (645)
1529
1530         * typemanager.cs (IndexerPropetyName): Ravi never tested this
1531         piece of code.
1532
1533         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
1534         fix, we were returning too early, so we were not registering
1535         pending methods from abstract classes.
1536
1537         Do not register pending methods if the class is abstract.
1538
1539         * expression.cs (Conditional.DoResolve): Report circular implicit
1540         conversions when we neecd to compute it for conditional
1541         expressions. 
1542
1543         (Is.DoResolve): If the expression is always of the provided type,
1544         flag warning 183.  If the expression can not ever be of the
1545         provided type flag warning 184.
1546
1547         * class.cs: Catch 169 as well.
1548
1549         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
1550         read. 
1551
1552 2002-01-18  Nick Drochak  <ndrochak@gol.com>
1553
1554         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
1555
1556 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
1557
1558         * interface.cs: (PopulateMethod): Check for pointers being defined
1559         only if the unsafe context is active.
1560         (PopulateProperty): ditto.
1561         (PopulateIndexer): ditto.
1562
1563         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
1564         specified.  If pointers are present, make sure that they are
1565         present in an unsafe context.
1566         (Constructor, Constructor.Define): ditto.
1567         (Field, Field.Define): ditto.
1568         (Property, Property.Define): ditto.
1569         (Event, Event.Define): ditto.
1570
1571         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
1572         hashtable if there are classes or structs defined.
1573
1574         * expression.cs (LocalVariableReference.DoResolve): Simplify this
1575         code, as the constant resolution moved.
1576
1577         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
1578         the metadata, so we can flag error 133. 
1579
1580         * decl.cs (MemberCore.UnsafeOK): New function to test that a
1581         pointer is being declared in an unsafe context.
1582
1583 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
1584
1585         * modifiers.cs (Modifiers.Check): Require a Location argument.
1586         Report error 227 for Unsafe use.
1587
1588         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
1589
1590         * statement.cs (For.Emit): If the test is null, then report that
1591         we do `return', as we wont reach anything afterwards.
1592
1593         (Switch.SwitchGoverningType): Track the expression that matched
1594         the conversion.
1595
1596         * driver.cs: Allow negative numbers as an error code to flag.
1597
1598         * cs-parser.jay: Handle 1551.
1599
1600         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
1601
1602 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
1603
1604         * cs-parser.jay: Report 1518 (type declaration can only contain
1605         class, struct, interface, enum or delegate)
1606
1607         (switch_label): Report 1523 (keywords `case' or `default' must
1608         preced code)
1609
1610         (opt_switch_sections): Report 1522 (empty switch)
1611
1612         * driver.cs: Report 1515 (response file specified multiple times)
1613         Report 1516 (Source file specified multiple times).
1614
1615         * expression.cs (Argument.Resolve): Signal 1510
1616
1617         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
1618         access not allowed in static code)
1619
1620 2002-01-11  Ravi Pratap  <ravi@ximian.com>
1621
1622         * typemanager.cs (IsPointerType): Utility method which we are going
1623         to need a lot.
1624
1625         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
1626         the object type, so we take care of that.
1627
1628         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
1629         
1630         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
1631         added to non-params parameters :-)
1632
1633         * typemanager.cs (CSharpName): Include 'void' type too. 
1634
1635         (void_ptr_type): Include in the set of core types.
1636
1637         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
1638         duplicating code.
1639
1640         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
1641         an unsafe context.
1642
1643         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
1644         completely forgotten about it.
1645
1646 2002-01-10  Ravi Pratap  <ravi@ximian.com>
1647
1648         * cs-parser.jay (pointer_type): Add. This begins our implementation
1649         of parsing rules for unsafe code.
1650
1651         (unsafe_statement): Implement.
1652
1653         (embedded_statement): Modify to include the above.
1654
1655         * statement.cs (Unsafe): Implement new class for unsafe blocks.
1656
1657         * codegen.cs (EmitContext.InUnsafe): Add. This determines
1658         if the current context is an unsafe one.
1659
1660         * cs-parser.jay (local_variable_pointer_type): Since local variable types
1661         are handled differently, we need separate rules for them.
1662
1663         (local_variable_declaration): Update to use local_variable_pointer_type
1664         to allow variable declarations of unmanaged pointer types.
1665
1666         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
1667         in unsafe contexts.
1668
1669         * ../errors/cs0214.cs : Add.
1670
1671 2002-01-16  Nick Drochak  <ndrochak@gol.com>
1672
1673         * makefile: remove 'response' file when cleaning.
1674
1675 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
1676
1677         * cs-parser.jay: Report 1524.
1678
1679 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
1680
1681         * typemanager.cs (RegisterMethod): drop checking if we have
1682         registered this from here
1683
1684 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
1685
1686         * class.cs (Method.EmitDestructor): Implement calling our base
1687         destructor. 
1688
1689         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
1690         value of InFinally.
1691
1692         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
1693         this routine and will wrap the call in a try/catch block.  Deal
1694         with the case.
1695
1696 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
1697
1698         * ecore.cs (Expression.MemberLookup): instead of taking a
1699         parameter `same_type' that was used to tell whether we could
1700         access private members we compute our containing type from the
1701         EmitContext.
1702
1703         (FieldExpr): Added partial support for volatile fields.  This does
1704         not work for volatile fields exposed from assemblies, as I can not
1705         figure out how to extract the modreq from it.
1706
1707         Updated all the source files to use this.
1708
1709         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
1710         because it is referenced by MemberLookup very often. 
1711
1712 2002-01-09  Ravi Pratap  <ravi@ximian.com>
1713
1714         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
1715         TypeBuilder.GetCustomAttributes to retrieve what we need.
1716
1717         Get rid of redundant default_member_attr_type as this is the same as
1718         default_member_type which already exists.
1719
1720         * interface.cs, attribute.cs : Update accordingly.
1721         
1722 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
1723
1724         * typemanager.cs: Enable IndexerPropertyName again.  It does not
1725         work for TYpeBuilders though.  Ravi, can you please fix this?
1726
1727         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
1728
1729         * expression.cs (Argument.Emit): Handle the case of ref objects
1730         being passed to ref functions;  
1731
1732         (ParameterReference.EmitLoad): Loads the content of the pointer
1733         without dereferencing.
1734
1735 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
1736
1737         * cs-tokenizer.cs: Implemented the pre-processing expressions.
1738
1739 2002-01-08  Ravi Pratap  <ravi@ximian.com>
1740
1741         * class.cs (Indexer.DefineMethod): Incorporate the interface
1742         type in the name of the method if we are doing explicit interface
1743         implementation.
1744
1745         * expression.cs (ConversionExists): Remove as it is completely obsolete.
1746
1747         (BetterConversion): Fix extremely trivial bug where we were referring to
1748         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
1749         again !
1750
1751         * ../errors/bug16.cs : Add although we have fixed it.
1752
1753 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
1754
1755         * expression.cs (BaseIndexer): Begin implementation.
1756
1757         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
1758
1759         * cs-parser.jay (indexer_declarator): Use qualified_identifier
1760         production directly to remove a shift/reduce, and implement
1761         explicit interface implementation.
1762
1763         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
1764         after a floating point suffix.
1765
1766         * expression.cs (DoNumericPromotions): Improved the conversion for
1767         uint/uint.  If we have a constant, we avoid doing a typecast to a
1768         larger type.
1769
1770         * class.cs (Indexer): Implement explicit interface implementation
1771         for indexers.
1772         
1773 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
1774
1775         * class.cs: make the default instance constructor public and hidebysig.
1776
1777 2001-01-03  Ravi Pratap  <ravi@ximian.com>
1778
1779         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
1780         so we can call it from elsewhere.
1781
1782         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
1783         we emit it internally if the class has a defined indexer; otherwise the user
1784         emits it by decorating the class definition with the DefaultMemberAttribute.
1785
1786         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
1787         attribute is not used on a type which defines an indexer.
1788
1789         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
1790         character when we skip whitespace.
1791
1792         * ../errors/cs0646.cs : Add.
1793
1794 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
1795
1796         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
1797         again. 
1798
1799         * makefile: Add practical target `mcs3.exe' which builds the third
1800         generation compiler. 
1801
1802         * expression.cs (New): Fix structures constructor calling.
1803
1804         * class.cs (Property, Method, Indexer): Emit Final flag on the
1805         method if we are an interface implementation and we are not
1806         abstract. 
1807
1808         * ecore.cs (PropertyExpr): New public field `IsBase', tells
1809         whether this property is referencing a `base' method.
1810
1811         * expression.cs (Invocation.EmitCall): take an extra argument:
1812         is_base, this is used to determine whether the `call' or
1813         `callvirt' opcode should be used.
1814
1815         
1816         * delegate.cs: update EmitCall.
1817
1818         * class.cs (Method.Define): Set NewSlot for the cases where we are
1819         not implementing an interface method.
1820
1821         (Property.Define): ditto.
1822
1823 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
1824
1825         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
1826         'r'.  Allows mcs to parse itself fully.
1827
1828 2002-01-02  Ravi Pratap  <ravi@ximian.com>
1829
1830         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
1831         of the number of initializers that require the InitializeArray method.
1832
1833         (CheckIndices): Store the Expression in all cases - not the plain value. Also
1834         update the above field where necessary.
1835
1836         (MakeByteBlob): Update accordingly.
1837
1838         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
1839         greater than 2.
1840
1841         (EmitDynamicInitializers): Update in accordance with the new optimization.
1842
1843         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
1844         same OpCode applies.
1845
1846         * cs-parser.jay : Fix some glaring errors I introduced.
1847
1848 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
1849
1850         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
1851         so that we can check for name clashes there too.
1852
1853         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
1854         for interface indexers.
1855
1856         * interfaces.cs (Define): Emit the default member attribute.
1857
1858         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
1859         variable was being referred to while setting the value ;-)
1860
1861 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
1862
1863         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
1864         byte-by-byte information when we know the data is zero.
1865
1866         Make the block always a multiple of 4, because
1867         DefineInitializedData has a bug.
1868
1869         * assign.cs: Fix, we should assign from the temporary, not from
1870         the source. 
1871
1872         * expression.cs (MakeByteBlob): Fix my incorrect code.
1873
1874 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
1875
1876         * typemanager.cs (EnumToUnderlying): This function is used to get
1877         the underlying type from an enumeration, because it does not
1878         always work. 
1879
1880         * constant.cs: Use the I4_S form for values between -128 and 127.
1881
1882         * statement.cs (Block.LookupLabel): Looks up a label.
1883         (Block): Drop support for labeled blocks.
1884
1885         (LabeledStatement): New kind of statement that represents a label
1886         only.
1887
1888         (Goto): Finally implement this bad boy.
1889         
1890         * cs-parser.jay: Update to reflect new mechanism to implement
1891         labels.
1892
1893 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
1894
1895         * codegen.cs (EmitContext.This): a codegen property that keeps the
1896         a single instance of this instead of creating many different this
1897         instances. 
1898
1899         * delegate.cs (Delegate.DoResolve): Update to use the property;
1900
1901         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
1902
1903         * expression.cs (BaseAccess.DoResolve): Ditto.
1904
1905 2001-12-29  Ravi Pratap  <ravi@ximian.com>
1906
1907         * typemanager.cs (methodimpl_attr_type): Add to hold the type
1908         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
1909
1910         (InitCoreTypes): Update accordingly.
1911
1912         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
1913         so we can quickly store the state.
1914
1915         (ApplyAttributes): Set the correct implementation flags
1916         for InternalCall methods.
1917
1918 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
1919
1920         * expression.cs (EmitCall): if a method is not virtual, then do
1921         not use callvirt on it.
1922
1923         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
1924         user defined stuff) requires the use of stobj, which takes an
1925         address on the stack instead of an array and an index.  So emit
1926         the Ldelema operation for it.
1927
1928         (EmitStoreOpcode): Use stobj for valuetypes.
1929
1930         (UnaryMutator.EmitCode): Use the right 1 value depending on
1931         whether we are dealing with int64/uint64, float or doubles.
1932
1933         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
1934         constructors that I implemented last night.
1935
1936         (Constructor.IsDefault): Fix to work properly for static
1937         constructors.
1938
1939         * cs-parser.jay (CheckDef): report method signature errors.
1940         Update error number 103 to be 132.
1941
1942         * decl.cs: New AdditionResult enumeration value: MethodExists.
1943         Although we do this check for methods later on in the semantic
1944         analysis, catching repeated default constructors is so easy that
1945         we catch these here. 
1946         
1947         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
1948         promotions code.
1949
1950         (ParameterReference.EmitAssign, Emit): handle
1951         bools as bytes.
1952
1953         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
1954         (ArrayAccess.EmitStoreOpcode): ditto.
1955
1956         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
1957
1958         * expression.cs (MakeByteBlob): Complete all the missing types
1959         (uint, short, ushort, byte, sbyte)
1960
1961         * class.cs: Only init instance field initializers on instance
1962         constructors. 
1963
1964         Rename `constructors' to instance_constructors. 
1965
1966         (TypeContainer.AddConstructor): Only add constructors to the list
1967         if it is not static.
1968
1969         Make sure that we handle default_static_constructor independently
1970         everywhere where we handle instance_constructors
1971
1972 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
1973
1974         * class.cs: Do not lookup or create a base initializer for a
1975         static constructor.
1976
1977         (ConstructorInitializer.Resolve): use the proper type to lookup
1978         for constructors.
1979
1980         * cs-parser.jay: Report error 1585 (modifiers between type and name).
1981
1982         * enum.cs, interface.cs: Remove CloseType, this is taken care by
1983         in DeclSpace. 
1984
1985         * decl.cs: CloseType is now an virtual method, the default
1986         implementation just closes this type.
1987         
1988 2001-12-28  Ravi Pratap  <ravi@ximian.com>
1989
1990         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
1991         to PreserveSig by default. Also emit HideBySig on such methods.
1992
1993         Basically, set the defaults to standard values.
1994
1995         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
1996         argument, if candidate is better, it can't be worse than the best !
1997
1998         (Invocation): Re-write bits to differentiate between methods being
1999         applicable in their expanded form and their normal form - for params
2000         methods of course.
2001
2002         Get rid of use_standard everywhere as only standard conversions are allowed
2003         in overload resolution. 
2004
2005         More spec conformance.
2006         
2007 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
2008
2009         * driver.cs: Add --timestamp, to see where the compiler spends
2010         most of its time.
2011
2012         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
2013         `this' in static code.
2014
2015         (SimpleName.DoResolve): Implement in terms of a helper function
2016         that allows static-references to be passed upstream to
2017         MemberAccess.
2018
2019         (Expression.ResolveWithSimpleName): Resolve specially simple
2020         names when called by MemberAccess to implement the special
2021         semantics. 
2022
2023         (Expression.ImplicitReferenceConversion): Handle conversions from
2024         Null to reference types before others, as Null's type is
2025         System.Object. 
2026
2027         * expression.cs (Invocation.EmitCall): Handle the special case of
2028         calling methods declared on a reference type from a ValueType
2029         (Base classes System.Object and System.Enum)
2030
2031         (MemberAccess.Resolve): Only perform lookups on Enumerations if
2032         the left hand side is a TypeExpr, not on every enumeration. 
2033
2034         (Binary.Resolve): If types are reference types, then do a cast to
2035         object on operators != and == of both arguments.
2036         
2037         * typemanager.cs (FindMembers): Extract instance and static
2038         members if requested.
2039
2040         * interface.cs (PopulateProperty): Use void_type instead of null
2041         as the return type for the setter method.
2042
2043         (PopulateIndexer): ditto.
2044
2045 2001-12-27  Ravi Pratap  <ravi@ximian.com>
2046
2047         * support.cs (ReflectionParameters): Fix minor bug where we
2048         were examining the wrong parameter for the ParamArray attribute.
2049
2050         Cope with requests for the type of the parameter at position
2051         greater than the params parameter's. We now return the element
2052         type of the params array as that makes more sense.
2053
2054         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
2055         accordingly as we no longer have to extract the element type
2056         ourselves.
2057
2058         (Invocation.OverloadResolve): Update.
2059
2060 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
2061
2062         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
2063         against IEnumerator, test whether the return value is a descendant
2064         of the IEnumerator interface.
2065
2066         * class.cs (Indexer.Define): Use an auxiliary method to implement
2067         the other bits of the method definition.  Begin support for
2068         explicit interface implementation.
2069
2070         (Property.DefineMethod): Use TypeManager.void_type instead of null
2071         for an empty return value.
2072
2073 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
2074
2075         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
2076         dealing with a FieldExpr which is composed of a FieldBuilder, in
2077         the code path we did extract the constant, but we should have
2078         obtained the underlying value to be able to cast it (otherwise we
2079         end up in an infinite loop, this is what Ravi was running into).
2080
2081         (ArrayCreation.UpdateIndices): Arrays might be empty.
2082
2083         (MemberAccess.ResolveMemberAccess): Add support for section
2084         14.5.4.1 that deals with the special case of E.I when E is a type
2085         and something else, that I can be a reference to a static member.
2086
2087         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
2088         handle a particular array type to create byte blobs, it is just
2089         something we dont generate byteblobs for.
2090
2091         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
2092         arguments. 
2093
2094         * location.cs (Push): remove the key from the hashtable that we
2095         are about to add.   This happens for empty files.
2096
2097         * driver.cs: Dispose files after we have parsed them.
2098
2099         (tokenize): new function that only runs the tokenizer on its
2100         input, for speed testing.
2101
2102 2001-12-26  Ravi Pratap  <ravi@ximian.com>
2103
2104         * class.cs (Event.Define): Define the private field only if there
2105         are no accessors defined.
2106
2107         * expression.cs (ResolveMemberAccess): If there is no associated
2108         field with the event, that means we have an event defined with its
2109         own accessors and we should flag error cs0070 since transforming
2110         ourselves into a field is not valid in that case.
2111
2112         * ecore.cs (SimpleName.DoResolve): Same as above.
2113
2114         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
2115         and charset to sane values.
2116
2117 2001-12-25  Ravi Pratap  <ravi@ximian.com>
2118
2119         * assign.cs (DoResolve): Perform check on events only if they 
2120         are being accessed outside the declaring type.
2121
2122         * cs-parser.jay (event_declarations): Update rules to correctly
2123         set the type of the implicit parameter etc.
2124
2125         (add_accessor, remove_accessor): Set current local parameters.
2126
2127         * expression.cs (Binary): For delegate addition and subtraction,
2128         cast the return value from the method into the appropriate delegate
2129         type.
2130
2131 2001-12-24  Ravi Pratap  <ravi@ximian.com>
2132
2133         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
2134         of these as the workaround is unnecessary.
2135
2136         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
2137         delegate data - none of that is needed at all.
2138
2139         Re-write bits to extract the instance expression and the delegate method
2140         correctly.
2141
2142         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
2143         on delegates too.
2144
2145         * attribute.cs (ApplyAttributes): New method to take care of common tasks
2146         of attaching attributes instead of duplicating code everywhere.
2147
2148         * everywhere : Update code to do attribute emission using the above method.
2149
2150 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
2151
2152         * expression.cs (IsParamsMethodApplicable): if there are not
2153         parameters, return immediately.
2154
2155         * ecore.cs: The 0 literal can be implicity converted to an enum
2156         type. 
2157
2158         (SimpleName.DoResolve): First lookup the type, then lookup the
2159         members. 
2160
2161         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
2162         want to get its address.  If the InstanceExpression is not
2163         addressable, store the result in a temporary variable, then get
2164         the address of it.
2165
2166         * codegen.cs: Only display 219 errors on warning level or above. 
2167
2168         * expression.cs (ArrayAccess): Make it implement the
2169         IMemoryLocation interface.
2170
2171         (Binary.DoResolve): handle the operator == (object a, object b)
2172         and operator != (object a, object b) without incurring into a
2173         BoxedCast (because 5 != o should never be performed).
2174
2175         Handle binary enumerator operators.
2176
2177         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
2178         value type, otherwise use Ldelem_ref.
2179
2180         Use precomputed names;
2181
2182         (AddressOf): Implement address of
2183
2184         * cs-parser.jay (labeled_statement): Fix recursive block
2185         addition by reworking the production.
2186
2187         * expression.cs (New.DoEmit): New has a special case:
2188                 
2189                  If we are dealing with a ValueType, we have a few
2190                  situations to deal with:
2191                 
2192                     * The target of New is a ValueType variable, that is
2193                       easy, we just pass this as the variable reference
2194                 
2195                     * The target of New is being passed as an argument,
2196                       to a boxing operation or a function that takes a
2197                       ValueType.
2198                 
2199                       In this case, we need to create a temporary variable
2200                       that is the argument of New.
2201
2202
2203 2001-12-23  Ravi Pratap  <ravi@ximian.com>
2204
2205         * rootcontext.cs (LookupType): Check that current_type is not null before
2206         going about looking at nested types.
2207
2208         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
2209         not implement the IAssignMethod interface any more.
2210
2211         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
2212         where we tranform them into FieldExprs if they are being resolved from within
2213         the declaring type.
2214
2215         * ecore.cs (SimpleName.DoResolve): Do the same here.
2216
2217         * assign.cs (DoResolve, Emit): Clean up code considerably. 
2218
2219         * ../errors/bug10.cs : Add.
2220
2221         * ../errors/cs0070.cs : Add.
2222
2223         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
2224
2225         * assign.cs : Get rid of EventIsLocal everywhere.
2226         
2227 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
2228
2229         * ecore.cs (ConvertIntLiteral): finished the implementation.
2230
2231         * statement.cs (SwitchLabel): Convert the value we are using as a
2232         key before looking up the table.
2233
2234 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
2235
2236         * codegen.cs (EmitTopBlock): Require a Location argument now.
2237
2238         * cs-parser.jay (constructor_declarator): We need to setup
2239         current_local_parameters before we parse the
2240         opt_constructor_initializer, to allow the variables to be bound
2241         to the constructor arguments.
2242
2243         * rootcontext.cs (LookupType): First lookup nested classes in our
2244         class and our parents before we go looking outside our class.
2245
2246         * expression.cs (ConstantFold): Extract/debox the values at the
2247         beginnning. 
2248
2249         * rootcontext.cs (EmitCode): Resolve the constants first before we
2250         resolve the types.  This is not really needed, but it helps debugging.
2251
2252         * statement.cs: report location.
2253         
2254         * cs-parser.jay: pass location to throw statement.
2255
2256         * driver.cs: Small bug fix.
2257
2258         * report.cs: Updated format to be 4-zero filled digits.
2259
2260 2001-12-22  Ravi Pratap  <ravi@ximian.com>
2261
2262         * expression.cs (CheckIndices): Fix minor bug where the wrong
2263         variable was being referred to ;-)
2264
2265         (DoEmit): Do not call EmitStaticInitializers when the 
2266         underlying type is System.Object.
2267
2268 2001-12-21  Ravi Pratap  <ravi@ximian.com>
2269
2270         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
2271         and do the usual workaround for SRE.
2272
2273         * class.cs (MyEventBuilder.EventType): New member to get at the type
2274         of the event, quickly.
2275
2276         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
2277
2278         * assign.cs (Assign.DoResolve): Handle the case when the target
2279         is an EventExpr and perform the necessary checks.
2280
2281         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
2282         interface.
2283
2284         (SimpleName.MemberStaticCheck): Include check for EventExpr.
2285
2286         (EventExpr): Set the type in the constructor itself since we 
2287         are meant to be born fully resolved.
2288
2289         (EventExpr.Define): Revert code I wrote earlier.
2290                 
2291         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
2292         instance expression is null. The instance expression is a This in that case
2293         or a null, depending on whether it is a static method or not.
2294
2295         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
2296         refers to more than one method.
2297
2298         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
2299         and accordingly flag errors.
2300
2301 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
2302
2303         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
2304
2305 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
2306
2307         * location.cs (ToString): Provide useful rutine.
2308
2309 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
2310
2311         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
2312         objects, return the actual integral boxed.
2313
2314         * statement.cs (SwitchLabel): define an ILLabel for each
2315         SwitchLabel. 
2316         
2317         (Switch.CheckSwitch): If the value is a Literal, extract
2318         the underlying literal.
2319         
2320         Also in the unused hashtable we had, add the SwitchLabel so we can
2321         quickly look this value up.
2322
2323         * constant.cs: Implement a bunch of new constants.  Rewrite
2324         Literal based on this.  Made changes everywhere to adapt to this.
2325         
2326         * expression.cs (Expression.MakeByteBlob): Optimize routine by
2327         dereferencing array only once, and also copes with enumrations.
2328
2329         bytes are two bytes wide, not one.
2330
2331         (Cast): Perform constant conversions.
2332         
2333         * ecore.cs (TryImplicitIntConversion): Return literals instead of
2334         wrappers to the literals here.
2335
2336         * expression.cs (DoNumericPromotions): long literals can converted
2337         to ulong implicity (this is taken care of elsewhere, but I was
2338         missing this spot).
2339
2340         * ecore.cs (Expression.Literalize): Make the return type Literal,
2341         to improve type checking.
2342
2343         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
2344
2345 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
2346
2347         * literal.cs: Revert code from ravi that checked the bounds.  The
2348         bounds are sane by the definition of the type itself. 
2349
2350         * typemanager.cs: Fix implementation of ImplementsInterface.  We
2351         need to actually look up in our parent hierarchy for interfaces
2352         implemented. 
2353
2354         * const.cs: Use the underlying type for enumerations
2355
2356         * delegate.cs: Compute the basename for the delegate creation,
2357         that should fix the delegate test case, and restore the correct
2358         Type Lookup semantics in rootcontext
2359
2360         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
2361         referencing a nested type with the Reflection API is using the "+"
2362         sign. 
2363
2364         * cs-parser.jay: Do not require EOF token at the end.
2365
2366 2001-12-20  Ravi Pratap  <ravi@ximian.com>
2367
2368         * rootcontext.cs (LookupType): Concatenate type names with
2369         a '.' instead of a '+' The test suite passes again.
2370
2371         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
2372         field of the enumeration.
2373
2374         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
2375         the case when the member is an EventExpr.
2376
2377         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
2378         static has an associated instance expression.
2379
2380         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
2381
2382         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
2383
2384         * class.cs (Event.Define): Register event and perform appropriate checks
2385         for error #111.
2386
2387         We define the Add and Remove methods even if the use provides none because
2388         in that case, we provide default implementations ourselves.
2389
2390         Define a private field of the type of the event. This is done by the CSC compiler
2391         and we should be doing it too ;-)
2392
2393         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
2394         More methods we use in code we generate.
2395
2396         (multicast_delegate_type, delegate_type): Two separate types since the distinction
2397         is important.
2398
2399         (InitCoreTypes): Update accordingly for the above.
2400
2401         * class.cs (Event.Emit): Generate code for default accessors that we provide
2402
2403         (EmitDefaultMethod): Do the job in the above.
2404
2405         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
2406         appropriate place.
2407
2408 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
2409
2410         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
2411         builders even if we were missing one.
2412
2413         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
2414         pass the Basename as our class name instead of the Name.  The
2415         basename will be correctly composed for us.
2416
2417         * parameter.cs (Paramters): Now takes a Location argument.
2418
2419         * decl.cs (DeclSpace.LookupType): Removed convenience function and
2420         make all the code call directly LookupType in RootContext and take
2421         this chance to pass the Location information everywhere.
2422
2423         * Everywhere: pass Location information.
2424
2425 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
2426
2427         * class.cs (Constructor.Define): Updated way of detecting the
2428         length of the parameters.
2429
2430         (TypeContainer.DefineType): Use basename as the type name for
2431         nested types.
2432
2433         (TypeContainer.Define): Do not recursively define types here, as
2434         definition is taken care in order by the RootContext.
2435
2436         * tree.cs: Keep track of namespaces in a per-file basis.
2437
2438         * parameter.cs (Parameter.ComputeSignature): Update to use
2439         DeclSpace. 
2440
2441         (Parameters.GetSignature): ditto.
2442
2443         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
2444         instead of a TypeContainer.
2445
2446         (Interface.SemanticAnalysis): Use `this' instead of our parent to
2447         resolve names.  Because we need to be resolve in our context, not
2448         our parents.
2449         
2450         * driver.cs: Implement response files.
2451
2452         * class.cs (TypeContainer.DefineType): If we are defined, do not
2453         redefine ourselves.
2454         
2455         (Event.Emit): Emit the code for add/remove handlers.
2456         (Event.Define): Save the MethodBuilders for add/remove.
2457
2458         * typemanager.cs: Use pair here too.
2459
2460         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
2461         DictionaryEntry requires the first argument to be non-null.  
2462         
2463         (enum_declaration): Compute full name for registering the
2464         enumeration.
2465         
2466         (delegate_declaration): Instead of using
2467         formal_parameter_list, use opt_formal_parameter_list as the list
2468         can be empty.
2469
2470         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
2471         (EventParsing): New property that controls whether `add' and
2472         `remove' are returned as tokens or identifiers (for events);
2473
2474 2001-12-19  Ravi Pratap  <ravi@ximian.com>
2475
2476         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
2477         use MyEventBuilder only and let it wrap the real builder for us.
2478
2479         (MyEventBuilder): Revamp constructor etc.
2480
2481         Implement all operations that we perform on EventBuilder in precisely the same
2482         way here too.
2483
2484         (FindMembers): Update to use the EventBuilder member.
2485
2486         (Event.Emit): Update accordingly.
2487
2488 2001-12-18  Ravi Pratap  <ravi@ximian.com>
2489
2490         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
2491         by calling the appropriate methods.
2492
2493         (GetCustomAttributes): Make stubs as they cannot possibly do anything
2494         useful.
2495
2496         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
2497
2498 2001-12-17  Ravi Pratap  <ravi@ximian.com>
2499
2500         * delegate.cs (Delegate.Populate): Check that the return type
2501         and various parameters types are indeed accessible.
2502
2503         * class.cs (Constructor.Define): Same here.
2504
2505         (Field.Define): Ditto.
2506
2507         (Event.Define): Ditto.
2508
2509         (Operator.Define): Check that the underlying Method defined itself
2510         correctly - so it's MethodBuilder should not be null.
2511
2512         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
2513         expression happens to be null.
2514
2515         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
2516         members but as of now we don't seem to be able to do anything really useful with it.
2517
2518         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
2519         not the EventBuilder.
2520
2521 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
2522
2523         * cs-tokenizer.cs: Add support for defines.
2524         Add support for #if, #elif, #else, #endif
2525         
2526         (eval_var): evaluates a variable.
2527         (eval): stubbed for evaluating functions.
2528
2529         * cs-parser.jay: Pass the defines information
2530
2531         * driver.cs: Add --define command line option.
2532
2533         * decl.cs: Move MemberCore here.
2534
2535         Make it the base class for DeclSpace.  This allows us to catch and
2536         report 108 and 109 for everything now.
2537
2538         * class.cs (TypeContainer.Define): Extract all the members
2539         before populating and emit the warning 108 (new keyword required
2540         to override) instead of having each member implement this.
2541
2542         (MemberCore.Define): New abstract method, we will be using this in
2543         the warning reporting engine in Populate.
2544         
2545         (Operator.Define): Adjust to new MemberCore protocol. 
2546
2547         * const.cs (Const): This does not derive from Expression, it is a
2548         temporary object we use to create fields, it is a MemberCore. 
2549
2550         * class.cs (Method.Define): Allow the entry point to be in a
2551         specific class.
2552
2553         * driver.cs: Rewrite the argument handler to clean it up a bit.
2554
2555         * rootcontext.cs: Made it just an auxiliary namespace feature by
2556         making everything static.
2557
2558         * driver.cs: Adapt code to use RootContext type name instead of
2559         instance variable.
2560
2561         * delegate.cs: Remove RootContext argument.
2562
2563         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
2564         argument. 
2565
2566         * class.cs (Event.Define): The lookup can fail.
2567         
2568         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
2569
2570         * expression.cs: Resolve the this instance before invoking the code.
2571
2572 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
2573
2574         * cs-parser.jay: Add a production in element_access that allows
2575         the thing to become a "type" reference.  This way we can parse
2576         things like "(string [])" as a type.
2577
2578         Note that this still does not handle the more complex rules of
2579         casts. 
2580         
2581
2582         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
2583
2584         * ecore.cs: (CopyNewMethods): new utility function used to
2585         assemble the list of methods from running FindMembers.
2586
2587         (MemberLookup): Rework FindMembers so that 
2588
2589 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
2590
2591         * class.cs (TypeContainer): Remove Delegates who fail to be
2592         defined.
2593
2594         * delegate.cs (Populate): Verify that we dont get null return
2595         values.   TODO: Check for AsAccessible.
2596
2597         * cs-parser.jay: Use basename to emit error 574 (destructor should
2598         have the same name as container class), not the full name.
2599
2600         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
2601         possible representation.  
2602
2603         Also implements integer type suffixes U and L.
2604
2605 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
2606
2607         * expression.cs (ArrayCreation.DoResolve): We need to do the
2608         argument resolution *always*.
2609
2610         * decl.cs: Make this hold the namespace.  Hold the root context as
2611         well.
2612         (LookupType): Move here.
2613
2614         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
2615
2616         * location.cs (Row, Name): Fixed the code, it was always returning
2617         references to the first file.
2618
2619         * interface.cs: Register properties defined through interfaces.
2620
2621         * driver.cs: Add support for globbing on the command line
2622
2623         * class.cs (Field): Make it derive from MemberCore as well.
2624         (Event): ditto.
2625
2626 2001-12-15  Ravi Pratap  <ravi@ximian.com>
2627
2628         * class.cs (Event::Define): Check that the type of the event is a delegate
2629         type else flag error #66.
2630
2631         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
2632         same.
2633
2634         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
2635         values of EntryPoint, CharSet etc etc.
2636
2637         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
2638
2639         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
2640         be null and we should ignore this. I am not sure if this is really clean. Apparently,
2641         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
2642         which needs this to do its work.
2643
2644         * ../errors/cs0066.cs : Add.
2645
2646 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
2647
2648         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
2649         helper functions.
2650
2651         * class.cs: (MethodSignature.MethodSignature): Removed hack that
2652         clears out the parameters field.
2653         (MemberSignatureCompare): Cleanup
2654
2655         (MemberCore): New base class used to share code between MethodCore
2656         and Property.
2657
2658         (RegisterRequiredImplementations) BindingFlags.Public requires
2659         either BindingFlags.Instace or Static.  Use instance here.
2660
2661         (Property): Refactored code to cope better with the full spec.
2662
2663         * parameter.cs (GetParameterInfo): Return an empty array instead
2664         of null on error.
2665
2666         * class.cs (Property): Abstract or extern properties have no bodies.
2667
2668         * parameter.cs (GetParameterInfo): return a zero-sized array.
2669
2670         * class.cs (TypeContainer.MethodModifiersValid): Move all the
2671         method modifier validation to the typecontainer so we can reuse
2672         this on properties.
2673
2674         (MethodCore.ParameterTypes): return an empty sized array of types.
2675
2676         (Property.Define): Test property modifier validity.
2677
2678         Add tests for sealed/override too.
2679
2680         (Method.Emit): abstract or extern methods have no bodies.
2681
2682 2001-12-14  Ravi Pratap  <ravi@ximian.com>
2683
2684         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
2685         thing.
2686
2687         (Method::Define, ::Emit): Modify accordingly.
2688
2689         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
2690
2691         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
2692
2693         * makefile: Pass in /unsafe.
2694
2695 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
2696
2697         * class.cs (MakeKey): Kill routine.
2698         
2699         * class.cs (TypeContainer.Define): Correctly define explicit
2700         method implementations (they require the full interface name plus
2701         the method name).
2702
2703         * typemanager.cs: Deply the PtrHashtable here and stop using the
2704         lame keys.  Things work so much better.
2705
2706         This of course broke everyone who depended on `RegisterMethod' to
2707         do the `test for existance' test.  This has to be done elsewhere.
2708
2709         * support.cs (PtrHashtable): A hashtable that avoid comparing with
2710         the object stupid Equals method (because, that like fails all over
2711         the place).  We still do not use it.
2712
2713         * class.cs (TypeContainer.SetRequiredInterface,
2714         TypeContainer.RequireMethods): Killed these two routines and moved
2715         all the functionality to RegisterRequiredImplementations.
2716
2717         (TypeContainer.RegisterRequiredImplementations): This routine now
2718         registers all the implementations required in an array for the
2719         interfaces and abstract methods.  We use an array of structures
2720         which can be computed ahead of time to reduce memory usage and we
2721         also assume that lookups are cheap as most classes will not
2722         implement too many interfaces.
2723
2724         We also avoid creating too many MethodSignatures.
2725
2726         (TypeContainer.IsInterfaceMethod): Update and optionally does not
2727         clear the "pending" bit if we find that there are problems with
2728         the declaration.
2729
2730         (TypeContainer.VerifyPendingMethods): Update to report errors of
2731         methods that look like implementations but are not.
2732
2733         (TypeContainer.Define): Add support for explicit interface method
2734         implementation. 
2735         
2736 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
2737
2738         * typemanager.cs: Keep track of the parameters here instead of
2739         being a feature of the TypeContainer.
2740
2741         * class.cs: Drop the registration of parameters here, as
2742         InterfaceMethods are also interface declarations.
2743
2744         * delegate.cs: Register methods with the TypeManager not only with
2745         the TypeContainer.  This code was buggy.
2746
2747         * interface.cs: Full registation here.
2748
2749 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
2750
2751         * expression.cs: Remove reducer for binary expressions, it can not
2752         be done this way.
2753
2754         * const.cs: Put here the code that used to go into constant.cs
2755
2756         * constant.cs: Put here the code for constants, this is a new base
2757         class for Literals.
2758
2759         * literal.cs: Make Literal derive from Constant.
2760
2761 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
2762
2763         * statement.cs (Return.Emit): Report error 157 if the user
2764         attempts to return from a finally block.
2765
2766         (Return.Emit): Instead of emitting a return, jump to the end of
2767         the function.
2768
2769         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
2770         LocalBuilder to store the result of the function.  ReturnLabel is
2771         the target where we jump.
2772         
2773
2774 2001-12-09  Radek Doulik  <rodo@ximian.com>
2775
2776         * cs-parser.jay: remember alias in current namespace
2777
2778         * ecore.cs (SimpleName::DoResolve): use aliases for types or
2779         namespaces
2780
2781         * class.cs (LookupAlias): lookup alias in my_namespace
2782
2783         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
2784         aliases hashtable
2785         (LookupAlias): lookup alias in this and if needed in parent
2786         namespaces
2787
2788 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
2789
2790         * support.cs: 
2791
2792         * rootcontext.cs: (ModuleBuilder) Made static, first step into
2793         making things static.  I need this to avoid passing the
2794         TypeContainer when calling ParameterType.
2795
2796         * support.cs (InternalParameters.ParameterType): Remove ugly hack
2797         that did string manipulation to compute the type and then call
2798         GetType.  Use Parameter.ParameterType instead.
2799
2800         * cs-tokenizer.cs: Consume the suffix for floating values.
2801
2802         * expression.cs (ParameterReference): figure out whether this is a
2803         reference parameter or not.  Kill an extra variable by computing
2804         the arg_idx during emission.
2805
2806         * parameter.cs (Parameters.GetParameterInfo): New overloaded
2807         function that returns whether a parameter is an out/ref value or not.
2808
2809         (Parameter.ParameterType): The type of the parameter (base,
2810         without ref/out applied).
2811         
2812         (Parameter.Resolve): Perform resolution here.
2813         (Parameter.ExternalType): The full type (with ref/out applied).
2814
2815         * statement.cs (Using.Emit, Using.EmitExpression): Implement
2816         support for expressions on the using statement.
2817
2818 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
2819
2820         * statement.cs (Using.EmitLocalVariableDecls): Split the
2821         localvariable handling of the using statement.
2822
2823         (Block.EmitMeta): Keep track of variable count across blocks.  We
2824         were reusing slots on separate branches of blocks.
2825
2826         (Try.Emit): Emit the general code block, we were not emitting it. 
2827
2828         Check the type of the declaration to be an IDisposable or
2829         something that can be implicity converted to it. 
2830
2831         Emit conversions if required.
2832
2833         * ecore.cs (EmptyExpression): New utility class.
2834         (Expression.ImplicitConversionExists): New utility function.
2835
2836 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
2837
2838         * statement.cs (Using): Implement.
2839
2840         * expression.cs (LocalVariableReference): Support read only variables.
2841
2842         * statement.cs: Remove the explicit emit for the Leave opcode.
2843         (VariableInfo): Add a readonly field.
2844
2845 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
2846
2847         * ecore.cs (ConvCast): new class used to encapsulate the various
2848         explicit integer conversions that works in both checked and
2849         unchecked contexts.
2850
2851         (Expression.ConvertNumericExplicit): Use new ConvCast class to
2852         properly generate the overflow opcodes.
2853
2854 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
2855
2856         * statement.cs: The correct type for the EmptyExpression is the
2857         element_type, not the variable type.  Ravi pointed this out.
2858
2859 2001-12-04  Ravi Pratap  <ravi@ximian.com>
2860
2861         * class.cs (Method::Define): Handle PInvoke methods specially
2862         by using DefinePInvokeMethod instead of the usual one.
2863
2864         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
2865         above to do the task of extracting information and defining the method.
2866         
2867 2001-12-04  Ravi Pratap  <ravi@ximian.com>
2868
2869         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
2870         of the condition for string type.
2871
2872         (Emit): Move that here. 
2873
2874         (ArrayCreation::CheckIndices): Keep string literals in their expression
2875         form.
2876
2877         (EmitDynamicInitializers): Handle strings appropriately.
2878
2879 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
2880
2881         * codegen.cs (EmitContext): Replace multiple variables with a
2882         single pointer to the current Switch statement.
2883
2884         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
2885         EmitContext.
2886
2887 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
2888
2889         * statement.cs 
2890
2891         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
2892         default'.
2893         
2894         (Foreach.Emit): Foreach on arrays was not setting
2895         up the loop variables (for break/continue).
2896
2897         (GotoCase): Semi-implented.
2898         
2899 2001-12-03  Ravi Pratap  <ravi@ximian.com>
2900
2901         * attribute.cs (CheckAttribute): Handle system attributes by using
2902         Attribute.GetAttributes to examine information we need.
2903
2904         (GetValidPlaces): Same here.
2905
2906         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
2907
2908         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
2909
2910         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
2911
2912         (Method::Define): Set appropriate flags if we have a DllImport attribute.
2913
2914         (Method::Emit): Handle the case when we are a PInvoke method.
2915
2916 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
2917
2918         * expression.cs: Use ResolveWithSimpleName on compound names.
2919
2920 2001-12-02  Ravi Pratap  <ravi@ximian.com>
2921
2922         * constant.cs (EmitConstant): Make sure we resolve the associated expression
2923         before trying to reduce it.
2924
2925         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
2926
2927         * constant.cs (LookupConstantValue): Implement.
2928
2929         (EmitConstant): Use the above in emitting the constant.
2930
2931         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
2932         that are user-defined by doing a LookupConstantValue on them.
2933
2934         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
2935         too, like above.
2936
2937 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
2938
2939         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
2940
2941         (BaseAccess.DoResolve): Implement.
2942
2943         (MemberAccess.DoResolve): Split this routine into a
2944         ResolveMemberAccess routine that can be used independently
2945
2946 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
2947
2948         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
2949         As that share bits of the implementation.  Is returns a boolean,
2950         while As returns the Type that is being probed.
2951
2952 2001-12-01  Ravi Pratap  <ravi@ximian.com>
2953
2954         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
2955         instead of a Literal - much easier.
2956
2957         (EnumInTransit): Remove - utterly useless :-)
2958
2959         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
2960
2961         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
2962
2963         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
2964         chain when we have no associated expression.
2965
2966 2001-11-30  Ravi Pratap  <ravi@ximian.com>
2967
2968         * constant.cs (Define): Use Location while reporting the errror.
2969
2970         Also emit a warning when 'new' is used and there is no inherited
2971         member to hide.
2972
2973         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
2974         populated.
2975
2976         (LookupEnumValue): Implement to lookup an enum member's value and define it
2977         if necessary.
2978
2979         (Populate): Re-write accordingly to use the above routine.
2980
2981 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
2982
2983         * expression.cs (This): Fix prototype for DoResolveLValue to
2984         override the base class DoResolveLValue.
2985
2986         * cs-parser.cs: Report errors cs574 and cs575 (destructor
2987         declarations) 
2988
2989         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
2990         (we need to load the address of the field here).  This fixes
2991         test-22. 
2992         
2993         (FieldExpr.DoResolveLValue): Call the DoResolve
2994         function to initialize the Instance expression.
2995         
2996         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
2997         correctly the GetEnumerator operation on a value type.
2998
2999         * cs-parser.jay: Add more simple parsing error catches.
3000
3001         * statement.cs (Switch): Add support for string switches.
3002         Handle null specially.
3003
3004         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
3005
3006 2001-11-28  Ravi Pratap  <ravi@ximian.com>
3007
3008         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
3009
3010         (declare_local_constant): New helper function.
3011
3012         * statement.cs (AddConstant): Keep a separate record of constants
3013
3014         (IsConstant): Implement to determine if a variable is a constant.
3015
3016         (GetConstantExpression): Implement.
3017
3018         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
3019
3020         * statement.cs (IsVariableDefined): Re-write.
3021
3022 2001-11-27  Ravi Pratap  <ravi@ximian.com>
3023
3024         * class.cs (TypeContainer::FindMembers): Look for constants
3025         in the case when we are looking for MemberTypes.Field
3026
3027         * expression.cs (MemberAccess::DoResolve): Check that in the
3028         case we are a FieldExpr and a Literal, we are not being accessed
3029         by an instance reference.
3030
3031         * cs-parser.jay (local_constant_declaration): Implement.
3032
3033         (declaration_statement): Implement for constant declarations.
3034
3035 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
3036
3037         * statement.cs (Switch): Catch double defaults.
3038
3039         (Switch): More work on the switch() statement
3040         implementation.  It works for integral values now, need to finish
3041         string support.
3042
3043
3044 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
3045
3046         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
3047         integer literals into other integer literals.  To be used by
3048         switch. 
3049
3050 2001-11-24  Ravi Pratap  <ravi@ximian.com>
3051
3052         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
3053         some memory.
3054
3055         (EmitDynamicInitializers): Cope with the above since we extract data
3056         directly from ArrayData now.
3057
3058         (ExpectInitializers): Keep track of whether initializers are mandatory
3059         or not.
3060
3061         (Bounds): Make it a hashtable to prevent the same dimension being 
3062         recorded for every element in that dimension.
3063
3064         (EmitDynamicInitializers): Fix bug which prevented the Set array method
3065         from being found.
3066
3067         Also fix bug which was causing the indices to be emitted in the reverse
3068         order.
3069
3070 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
3071
3072         * expression.cs (ArrayCreation): Implement the bits that Ravi left
3073         unfinished.  They do not work, because the underlying code is
3074         sloppy.
3075
3076 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
3077
3078         * cs-parser.jay: Remove bogus fixme.
3079
3080         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
3081         on Switch statement.
3082         
3083 2001-11-23  Ravi Pratap  <ravi@ximian.com>
3084
3085         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
3086         the same. 
3087         
3088         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
3089         parameter. Apparently, any expression is allowed. 
3090
3091         (ValidateInitializers): Update accordingly.
3092
3093         (CheckIndices): Fix some tricky bugs thanks to recursion.
3094
3095         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
3096         I was being completely brain-dead.
3097
3098         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
3099         and re-write acordingly.
3100
3101         (DelegateInvocation): Re-write accordingly.
3102
3103         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
3104
3105         (MakeByteBlob): Handle types more correctly.
3106
3107         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
3108         initialization from expressions but it is incomplete because I am a complete
3109         Dodo :-|
3110
3111 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
3112
3113         * statement.cs (If.Emit): Fix a bug that generated incorrect code
3114         on If.  Basically, we have to return `true' (ie, we do return to
3115         our caller) only if both branches of the if return.
3116
3117         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
3118         short-circuit operators, handle them as short circuit operators. 
3119
3120         (Cast.DoResolve): Resolve type.
3121         (Cast.Cast): Take an expression as the target type.
3122
3123         * cs-parser.jay (cast_expression): Remove old hack that only
3124         allowed a limited set of types to be handled.  Now we take a
3125         unary_expression and we resolve to a type during semantic
3126         analysis.
3127
3128         Use the grammar productions from Rhys to handle casts (this is
3129         not complete like Rhys syntax yet, we fail to handle that corner
3130         case that C# has regarding (-x), but we will get there.
3131         
3132 2001-11-22  Ravi Pratap  <ravi@ximian.com>
3133
3134         * class.cs (EmitFieldInitializer): Take care of the case when we have a
3135         field which is an array type.
3136
3137         * cs-parser.jay (declare_local_variables): Support array initialization too.
3138
3139         * typemanager.cs (MakeKey): Implement.
3140
3141         (everywhere): Use the above appropriately.
3142
3143         * cs-parser.jay (for_statement): Update for array initialization while
3144         declaring variables.
3145
3146         * ecore.cs : The error message was correct, it's the variable's names that
3147         were misleading ;-) Make the code more readable.
3148
3149         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
3150         the correct type etc.
3151
3152         (ConvertExplicit): Handle Enum types by examining the underlying type.
3153
3154 2001-11-21  Ravi Pratap  <ravi@ximian.com>
3155
3156         * parameter.cs (GetCallingConvention): Always return
3157         CallingConventions.Standard for now.
3158
3159 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
3160
3161         * expression.cs (Binary.ResolveOperator): Update the values of `l'
3162         and `r' after calling DoNumericPromotions.
3163
3164         * ecore.cs: Fix error message (the types were in the wrong order).
3165
3166         * statement.cs (Foreach.ProbeCollectionType): Need to pass
3167         BindingFlags.Instance as well 
3168
3169         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
3170         implicit int literal conversion in an empty cast so that we
3171         propagate the right type upstream.
3172
3173         (UnboxCast): new class used to unbox value types.
3174         (Expression.ConvertExplicit): Add explicit type conversions done
3175         by unboxing.
3176
3177         (Expression.ImplicitNumericConversion): Oops, forgot to test for
3178         the target type before applying the implicit LongLiterals to ULong
3179         literal cast.
3180
3181 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
3182
3183         * cs-parser.jay (for_statement): Reworked the way For works: now
3184         we declare manually any variables that are introduced in
3185         for_initializer to solve the problem of having out-of-band code
3186         emition (that is what got for broken).
3187
3188         (declaration_statement): Perform the actual variable declaration
3189         that used to be done in local_variable_declaration here.
3190
3191         (local_variable_declaration): Do not declare anything, just pass
3192         the information on a DictionaryEntry
3193
3194 2001-11-20  Ravi Pratap  <ravi@ximian.com>
3195
3196         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
3197         re-write of the logic to now make it recursive.
3198
3199         (UpdateIndices): Re-write accordingly.
3200
3201         Store element data in a separate ArrayData list in the above methods.
3202
3203         (MakeByteBlob): Implement to dump the array data into a byte array.
3204
3205 2001-11-19  Ravi Pratap  <ravi@ximian.com>
3206
3207         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
3208         into CheckIndices.
3209
3210         * constant.cs (Define): Implement.
3211
3212         (EmitConstant): Re-write fully.
3213
3214         Pass in location info.
3215
3216         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
3217         respectively.
3218
3219         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
3220         DictionaryEntry since we need location info too.
3221
3222         (constant_declaration): Update accordingly.
3223
3224         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
3225         code into another method : UpdateIndices.
3226
3227 2001-11-18  Ravi Pratap  <ravi@ximian.com>
3228
3229         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
3230         some type checking etc.
3231
3232 2001-11-17  Ravi Pratap  <ravi@ximian.com>
3233
3234         * expression.cs (ArrayCreation::ValidateInitializers): Implement
3235         bits to provide dimension info if the user skips doing that.
3236
3237         Update second constructor to store the rank correctly.
3238
3239 2001-11-16  Ravi Pratap  <ravi@ximian.com>
3240
3241         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
3242         and try to implement.
3243
3244         * ../errors/cs0150.cs : Add.
3245
3246         * ../errors/cs0178.cs : Add.
3247
3248 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
3249
3250         * statement.cs: Implement foreach on multi-dimensional arrays. 
3251
3252         * parameter.cs (Parameters.GetParameterByName): Also lookup the
3253         name of the params argument.
3254
3255         * expression.cs: Use EmitStoreOpcode to get the right opcode while
3256         initializing the array.
3257
3258         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
3259         we can use this elsewhere.
3260
3261         * statement.cs: Finish implementation of foreach for single
3262         dimension arrays.
3263
3264         * cs-parser.jay: Use an out-of-band stack to pass information
3265         around, I wonder why I need this.
3266
3267         foreach_block: Make the new foreach_block the current_block.
3268
3269         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
3270         function used to return a static Parameters structure.  Used for
3271         empty parameters, as those are created very frequently.
3272
3273         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
3274
3275 2001-11-15  Ravi Pratap  <ravi@ximian.com>
3276
3277         * interface.cs : Default modifier is private, not public. The
3278         make verify test passes again.
3279
3280 2001-11-15  Ravi Pratap  <ravi@ximian.com>
3281
3282         * support.cs (ReflectionParameters): Fix logic to determine
3283         whether the last parameter is a params one. Test 9 passes again.
3284
3285         * delegate.cs (Populate): Register the builders we define with
3286         RegisterParameterForBuilder. Test 19 passes again.
3287
3288         * cs-parser.jay (property_declaration): Reference $6 instead
3289         of $$ to get at the location.
3290
3291         (indexer_declaration): Similar stuff.
3292
3293         (attribute): Ditto.
3294
3295         * class.cs (Property): Register parameters for the Get and Set methods
3296         if they exist. Test 23 passes again.
3297
3298         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
3299         call to EmitArguments as we are sure there aren't any params arguments. 
3300         Test 32 passes again.
3301
3302         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
3303         IndexOutOfRangeException. 
3304
3305         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
3306         Test 33 now passes again.
3307         
3308 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
3309
3310         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
3311         broke a bunch of things.  Will have to come up with a better way
3312         of tracking locations.
3313
3314         * statement.cs: Implemented foreach for single dimension arrays.
3315
3316 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
3317
3318         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
3319         an error.  This removes the lookup from the critical path.
3320
3321         * cs-parser.jay: Removed use of temporary_loc, which is completely
3322         broken. 
3323
3324 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
3325
3326         * support.cs (ReflectionParameters.ParameterModifier): Report
3327         whether the argument is a PARAMS argument or not.
3328
3329         * class.cs: Set the attribute `ParamArrayAttribute' on the
3330         parameter argument.
3331
3332         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
3333         and cons_param_array_attribute (ConstructorInfo for
3334         ParamArrayAttribute)., 
3335
3336         * codegen.cs: Emit the return using the `Return' statement, that
3337         way we can report the error correctly for missing return values. 
3338
3339         * class.cs (Method.Emit): Clean up.
3340
3341         * expression.cs (Argument.Resolve): Take another argument: the
3342         location where this argument is used.  Notice that this is not
3343         part of the "Argument" class as to reduce the size of the
3344         structure (we know the approximate location anyways).
3345
3346         Test if the argument is a variable-reference, if not, then
3347         complain with a 206.
3348
3349         (Argument.Emit): Emit addresses of variables.
3350
3351         (Argument.FullDesc): Simplify.
3352
3353         (Invocation.DoResolve): Update for Argument.Resolve.
3354
3355         (ElementAccess.DoResolve): ditto.
3356
3357         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
3358         method should be virtual, as this method is always virtual.
3359
3360         (NewDelegate.DoResolve): Update for Argument.Resolve.
3361
3362         * class.cs (ConstructorInitializer.DoResolve): ditto.
3363         
3364         * attribute.cs (Attribute.Resolve): ditto.
3365
3366 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
3367
3368         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
3369
3370         * expression.cs (ParameterReference): Drop IStackStorage and implement
3371         IAssignMethod instead. 
3372
3373         (LocalVariableReference): ditto.
3374         
3375         * ecore.cs (FieldExpr): Drop IStackStorage and implement
3376         IAssignMethod instead. 
3377
3378 2001-11-13  Miguel de Icaza <miguel@ximian.com>
3379
3380         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
3381         enumerations that are used in heavily used structures derive from
3382         byte in a laughable and pathetic attempt to reduce memory usage.
3383         This is the kind of pre-optimzations that you should not do at
3384         home without adult supervision.
3385
3386         * expression.cs (UnaryMutator): New class, used to handle ++ and
3387         -- separatedly from the other unary operators.  Cleans up the
3388         code, and kills the ExpressionStatement dependency in Unary.
3389
3390         (Unary): Removed `method' and `Arguments' from this class, making
3391         it smaller, and moving it all to SimpleCall, so I can reuse this
3392         code in other locations and avoid creating a lot of transient data
3393         strucutres when not required.
3394
3395         * cs-parser.jay: Adjust for new changes.
3396
3397 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
3398
3399         * enum.cs (Enum.Populate): If there is a failure during
3400         definition, return
3401
3402         * cs-parser.jay (opt_enum_base): we used to catch type errors
3403         here, but this is really incorrect.  The type error should be
3404         catched during semantic analysis.
3405
3406 2001-12-11  Ravi Pratap  <ravi@ximian.com>
3407
3408         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
3409         current_local_parameters as expected since I, in my stupidity, had forgotten
3410         to do this :-)
3411
3412         * attribute.cs (GetValidPlaces): Fix stupid bug.
3413
3414         * class.cs (Method::Emit): Perform check on applicability of attributes.
3415
3416         (Constructor::Emit): Ditto.
3417
3418         (Field::Emit): Ditto.
3419
3420         (Field.Location): Store location information.
3421
3422         (Property, Event, Indexer, Operator): Ditto.
3423
3424         * cs-parser.jay (field_declaration): Pass in location for each field.
3425
3426         * ../errors/cs0592.cs : Add.
3427
3428 2001-11-12  Ravi Pratap  <ravi@ximian.com>
3429
3430         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
3431
3432         (InitCoreTypes): Update accordingly.
3433
3434         (RegisterAttrType, LookupAttr): Implement.
3435
3436         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
3437         info about the same.
3438
3439         (Resolve): Update to populate the above as necessary.
3440
3441         (Error592): Helper.
3442
3443         (GetValidPlaces): Helper to the above.
3444
3445         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
3446
3447         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
3448
3449 2001-11-12  Ravi Pratap  <ravi@ximian.com>
3450
3451         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
3452
3453         * ../errors/cs0617.cs : Add.
3454
3455 2001-11-11  Ravi Pratap  <ravi@ximian.com>
3456
3457         * enum.cs (Emit): Rename to Populate to be more consistent with what
3458         we expect it to do and when exactly it is called.
3459
3460         * class.cs, rootcontext.cs : Update accordingly.
3461
3462         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
3463         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
3464
3465         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
3466
3467         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
3468         of a fieldinfo using the above, when dealing with a FieldBuilder.
3469
3470 2001-11-10  Ravi Pratap  <ravi@ximian.com>
3471
3472         * ../errors/cs0031.cs : Add.
3473
3474         * ../errors/cs1008.cs : Add.
3475
3476         * ../errrors/cs0543.cs : Add.
3477
3478         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
3479         enum type.
3480
3481         (FindMembers): Implement.
3482
3483         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
3484         enums and delegates too.
3485
3486         (enum_types): Rename to builder_to_enum.
3487
3488         (delegate_types): Rename to builder_to_delegate.
3489
3490         * delegate.cs (FindMembers): Implement.
3491
3492 2001-11-09  Ravi Pratap  <ravi@ximian.com>
3493
3494         * typemanager.cs (IsEnumType): Implement.
3495
3496         * enum.cs (Emit): Re-write parts to account for the underlying type
3497         better and perform checking etc.
3498
3499         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
3500         of the underlying type.
3501
3502         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
3503         value
3504
3505         * enum.cs (error31): Helper to report error #31.
3506
3507         * cs-parser.jay (enum_declaration): Store location of each member too.
3508
3509         * enum.cs (member_to_location): New hashtable. 
3510
3511         (AddEnumMember): Update location hashtable.
3512
3513         (Emit): Use the location of each member while reporting errors.
3514
3515 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
3516
3517         * cs-parser.jay: A for_initializer if is a
3518         local_variable_declaration really ammount to have an implicit
3519         block with the variable declaration and no initializer for for.
3520
3521         * statement.cs (For.Emit): Cope with null initializers.
3522
3523         This fixes the infinite loop on for initializers.
3524
3525 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
3526
3527         * enum.cs: More cleanup.
3528
3529         * ecore.cs: Remove dead code.
3530
3531         * class.cs (Property.Emit): More simplification.
3532         (Event.Emit): ditto.
3533
3534         Reworked to have less levels of indentation.
3535         
3536 2001-11-08  Ravi Pratap  <ravi@ximian.com>
3537
3538         * class.cs (Property): Emit attributes.
3539
3540         (Field): Ditto.
3541         
3542         (Event): Ditto.
3543
3544         (Indexer): Ditto.
3545
3546         (Operator): Ditto.
3547
3548         * enum.cs (Emit): Ditto.
3549
3550         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
3551         Enums too.
3552
3553         * class.cs (Field, Event, etc.): Move attribute generation into the
3554         Emit method everywhere.
3555
3556         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
3557         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
3558         as we had no way of defining nested enums !
3559
3560         * rootcontext.cs : Adjust code accordingly.
3561
3562         * typemanager.cs (AddEnumType): To keep track of enum types separately.
3563
3564 2001-11-07  Ravi Pratap  <ravi@ximian.com>
3565
3566         * expression.cs (EvalConstantExpression): Move into ecore.cs
3567         
3568         * enum.cs (Enum): Rename some members and make them public and readonly
3569         according to our convention.
3570
3571         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
3572         nothing else.
3573
3574         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
3575
3576         (Enum::Emit): Write a simple version for now which doesn't try to compute
3577         expressions. I shall modify this to be more robust in just a while.
3578
3579         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
3580
3581         (TypeContainer::CloseType): Create the Enum types too.
3582
3583         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
3584
3585         * expression.cs (EvalConstantExpression): Get rid of completely.
3586
3587         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
3588         user-defined values and other cases.
3589
3590         (IsValidEnumLiteral): Helper function.
3591
3592         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
3593         out there in the case we had a literal FieldExpr.
3594
3595         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
3596
3597         (Literalize): Revamp a bit to take two arguments.
3598         
3599         (EnumLiteral): New class which derives from Literal to wrap enum literals.
3600         
3601 2001-11-06  Ravi Pratap  <ravi@ximian.com>
3602
3603         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
3604
3605         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
3606
3607         (Resolve): Use the above to ensure we have proper initializers.
3608
3609 2001-11-05  Ravi Pratap  <ravi@ximian.com>
3610
3611         * expression.cs (Expression::EvalConstantExpression): New method to 
3612         evaluate constant expressions.
3613
3614         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
3615
3616 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
3617
3618         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
3619         in an array.
3620
3621         (Binary.ResolveOperator): Handle operator != (object a, object b)
3622         and operator == (object a, object b);
3623
3624         (Binary.DoNumericPromotions): Indicate whether the numeric
3625         promotion was possible.
3626
3627         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
3628         Implement.  
3629
3630         Made the ArrayAccess implement interface IAssignMethod instead of
3631         IStackStore as the order in which arguments are passed reflects
3632         this.
3633
3634         * assign.cs: Instead of using expr.ExprClass to select the way of
3635         assinging, probe for the IStackStore/IAssignMethod interfaces.
3636
3637         * typemanager.cs: Load InitializeArray definition.
3638
3639         * rootcontext.cs (RootContext.MakeStaticData): Used to define
3640         static data that can be used to initialize arrays. 
3641
3642 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
3643
3644         * expression.cs: Handle operator== and operator!= for booleans.
3645
3646         (Conditioal.Reduce): Implement reducer for the ?: operator.
3647
3648         (Conditional.Resolve): Implement dead code elimination.
3649
3650         (Binary.Resolve): Catch string literals and return a new
3651         concatenated string.
3652
3653         (Unary.Reduce): Implement reduction of unary expressions.
3654
3655         * ecore.cs: Split out the expression core handling here.
3656
3657         (Expression.Reduce): New method used to perform constant folding
3658         and CSE.  This is needed to support constant-expressions. 
3659         
3660         * statement.cs (Statement.EmitBoolExpression): Pass true and false
3661         targets, and optimize for !x.
3662
3663 2001-11-04  Ravi Pratap  <ravi@ximian.com>
3664
3665         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
3666         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
3667         set custom atttributes.
3668
3669         * literal.cs (Literal::GetValue): New abstract method to return the actual
3670         value of the literal, cast as an object.
3671
3672         (*Literal): Implement GetValue method.
3673
3674         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
3675         expressions to the arraylist but objects of type Argument.
3676
3677         * class.cs (TypeContainer::Emit): Emit our attributes too.
3678
3679         (Method::Emit, Constructor::Emit): Ditto.
3680
3681         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
3682         to be ignoring earlier.
3683
3684 2001-11-03  Ravi Pratap  <ravi@ximian.com>
3685
3686         * attribute.cs (AttributeSection::Define): Implement to do the business
3687         of constructing a CustomAttributeBuilder.
3688
3689         (Attribute): New trivial class. Increases readability of code.  
3690
3691         * cs-parser.jay : Update accordingly.
3692
3693         (positional_argument_list, named_argument_list, named_argument): New rules
3694
3695         (attribute_arguments): Use the above so that we are more correct.
3696         
3697 2001-11-02  Ravi Pratap  <ravi@ximian.com>
3698         
3699         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
3700         to perform all checks for a method with a params parameter.
3701
3702         (Invocation::OverloadResolve): Update to use the above method and therefore
3703         cope correctly with params method invocations.
3704
3705         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
3706         params too.
3707
3708         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
3709         constructors in our parent too because we can't afford to miss out on 
3710         protected ones ;-)
3711
3712         * attribute.cs (AttributeSection): New name for the class Attribute
3713
3714         Other trivial changes to improve readability.
3715
3716         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
3717         use the new class names.
3718         
3719 2001-11-01  Ravi Pratap  <ravi@ximian.com>
3720
3721         * class.cs (Method::Define): Complete definition for params types too
3722
3723         (Indexer::Define): Ditto.
3724
3725         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
3726         Cope everywhere with a request for info about the array parameter.
3727
3728 2001-11-01  Ravi Pratap  <ravi@ximian.com>
3729
3730         * tree.cs (RecordNamespace): Fix up to check for the correct key.
3731
3732         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
3733         local_variable_type to extract the string corresponding to the type.
3734
3735         (local_variable_type): Fixup the action to use the new helper method.
3736
3737         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
3738         go.
3739
3740         * expression.cs : Clean out code which uses the above.
3741
3742 2001-10-31  Ravi Pratap  <ravi@ximian.com>
3743         
3744         * typemanager.cs (RegisterMethod): Check if we already have an existing key
3745         and bale out if necessary by returning a false.
3746
3747         (RegisterProperty): Ditto.
3748
3749         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
3750         and print out appropriate error messages.
3751
3752         * interface.cs (everywhere): Ditto.
3753
3754         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
3755         location to constructor.
3756
3757         * class.cs (Property, Event, Indexer): Update accordingly.
3758
3759         * ../errors/cs111.cs : Added.
3760
3761         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
3762         of a method, as laid down by the spec.
3763
3764         (Invocation::OverloadResolve): Use the above method.
3765
3766 2001-10-31  Ravi Pratap  <ravi@ximian.com>
3767
3768         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
3769         now take a TypeContainer and a Parameters object.
3770
3771         (ParameterData): Modify return type of ParameterModifier method to be 
3772         Parameter.Modifier and not a string.
3773
3774         (ReflectionParameters, InternalParameters): Update accordingly.
3775
3776         * expression.cs (Argument::GetParameterModifier): Same here.
3777
3778         * support.cs (InternalParameters::ParameterType): Find a better way of determining
3779         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
3780         symbol in it at all so maybe this is only for now.
3781
3782 2001-10-30  Ravi Pratap  <ravi@ximian.com>
3783
3784         * support.cs (InternalParameters): Constructor now takes an extra argument 
3785         which is the actual Parameters class.
3786
3787         (ParameterDesc): Update to provide info on ref/out modifiers.
3788
3789         * class.cs (everywhere): Update call to InternalParameters to pass in
3790         the second argument too.
3791
3792         * support.cs (ParameterData): Add ParameterModifier, which is a method 
3793         to return the modifier info [ref/out etc]
3794
3795         (InternalParameters, ReflectionParameters): Implement the above.
3796
3797         * expression.cs (Argument::ParameterModifier): Similar function to return
3798         info about the argument's modifiers.
3799
3800         (Invocation::OverloadResolve): Update to take into account matching modifiers 
3801         too.
3802
3803         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
3804         a new SetFormalParameters object which we pass to InternalParameters.
3805
3806 2001-10-30  Ravi Pratap  <ravi@ximian.com>
3807
3808         * expression.cs (NewArray): Merge into the ArrayCreation class.
3809
3810 2001-10-29  Ravi Pratap  <ravi@ximian.com>
3811
3812         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
3813         NewUserdefinedArray into one as there wasn't much of a use in having
3814         two separate ones.
3815
3816         * expression.cs (Argument): Change field's name to ArgType from Type.
3817
3818         (Type): New readonly property which returns the proper type, taking into 
3819         account ref/out modifiers.
3820
3821         (everywhere): Adjust code accordingly for the above.
3822
3823         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
3824         whether we are emitting for a ref or out parameter.
3825
3826         * expression.cs (Argument::Emit): Use the above field to set the state.
3827
3828         (LocalVariableReference::Emit): Update to honour the flag and emit the
3829         right stuff.
3830
3831         * parameter.cs (Attributes): Set the correct flags for ref parameters.
3832
3833         * expression.cs (Argument::FullDesc): New function to provide a full desc.
3834
3835         * support.cs (ParameterData): Add method ParameterDesc to the interface.
3836
3837         (ReflectionParameters, InternalParameters): Implement the above method.
3838
3839         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
3840         reporting errors.
3841
3842         (Invocation::FullMethodDesc): Ditto. 
3843
3844 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
3845
3846         * cs-parser.jay: Add extra production for the second form of array
3847         creation. 
3848
3849         * expression.cs (ArrayCreation): Update to reflect the above
3850         change. 
3851
3852         * Small changes to prepare for Array initialization.
3853
3854 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
3855
3856         * typemanager.cs (ImplementsInterface): interface might be null;
3857         Deal with this problem;
3858
3859         Also, we do store negative hits on the cache (null values), so use
3860         this instead of calling t.GetInterfaces on the type everytime.
3861
3862 2001-10-28  Ravi Pratap  <ravi@ximian.com>
3863
3864         * typemanager.cs (IsBuiltinType): New method to help determine the same.
3865
3866         * expression.cs (New::DoResolve): Get rid of array creation code and instead
3867         split functionality out into different classes.
3868
3869         (New::FormArrayType): Move into NewBuiltinArray.
3870
3871         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
3872         quite useless.
3873
3874         (NewBuiltinArray): New class to handle creation of built-in arrays.
3875
3876         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
3877         account creation of one-dimensional arrays.
3878
3879         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
3880
3881         (NewUserdefinedArray::DoResolve): Implement.
3882
3883         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
3884
3885         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
3886         we maintain inside the TypeManager. This is necessary to perform lookups on the
3887         module builder.
3888
3889         (LookupType): Update to perform GetType on the module builders too.     
3890
3891         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
3892
3893         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
3894
3895 2001-10-23  Ravi Pratap  <ravi@ximian.com>
3896
3897         * expression.cs (New::DoResolve): Implement guts of array creation.
3898
3899         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
3900         
3901 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
3902
3903         * expression.cs: Fix bug I introduced lsat night that broke
3904         Delegates. 
3905
3906         (Expression.Resolve): Report a 246 error (can not resolve name)
3907         if we find a SimpleName in the stream.
3908         
3909         (Expression.ResolveLValue): Ditto.
3910         
3911         (Expression.ResolveWithSimpleName): This function is a variant of
3912         ResolveName, this one allows SimpleNames to be returned without a
3913         warning.  The only consumer of SimpleNames is MemberAccess
3914
3915 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
3916
3917         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
3918         might arrive here.  I have my doubts that this is correct.
3919
3920         * statement.cs (Lock): Implement lock statement.
3921
3922         * cs-parser.jay: Small fixes to support `lock' and `using'
3923
3924         * cs-tokenizer.cs: Remove extra space
3925
3926         * driver.cs: New flag --checked, allows to turn on integer math
3927         checking. 
3928
3929         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
3930         Threading.Monitor.Exit 
3931         
3932 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
3933
3934         * expression.cs (IndexerAccess::DoResolveLValue): Set the
3935         Expression Class to be IndexerAccess.
3936
3937         Notice that Indexer::DoResolve sets the eclass to Value.
3938
3939 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
3940
3941         * class.cs (TypeContainer::Emit): Emit code for indexers.
3942
3943         * assign.cs (IAssignMethod): New interface implemented by Indexers
3944         and Properties for handling assignment.
3945
3946         (Assign::Emit): Simplify and reuse code. 
3947         
3948         * expression.cs (IndexerAccess, PropertyExpr): Implement
3949         IAssignMethod, clean up old code. 
3950
3951 2001-10-22  Ravi Pratap  <ravi@ximian.com>
3952
3953         * typemanager.cs (ImplementsInterface): New method to determine if a type
3954         implements a given interface. Provides a nice cache too.
3955
3956         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
3957         method.
3958
3959         (ConvertReferenceExplicit): Ditto.
3960
3961         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
3962         various methods, with correct names etc.
3963
3964         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
3965         Operator.UnaryNegation.
3966
3967         * cs-parser.jay (operator_declarator): Be a little clever in the case where
3968         we have a unary plus or minus operator.
3969
3970         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
3971         UnaryMinus.
3972
3973         * everywhere : update accordingly.
3974
3975         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
3976         respectively.
3977
3978         * class.cs (Method::Define): For the case where we are implementing a method
3979         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
3980         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
3981         
3982 2001-10-21  Ravi Pratap  <ravi@ximian.com>
3983
3984         * interface.cs (FindMembers): Implement to work around S.R.E
3985         lameness.
3986
3987         * typemanager.cs (IsInterfaceType): Implement.
3988
3989         (FindMembers): Update to handle interface types too.
3990
3991         * expression.cs (ImplicitReferenceConversion): Re-write bits which
3992         use IsAssignableFrom as that is not correct - it doesn't work.
3993
3994         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
3995         and accordingly override EmitStatement.
3996
3997         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
3998         using the correct logic :-)
3999
4000 2001-10-19  Ravi Pratap  <ravi@ximian.com>
4001
4002         * ../errors/cs-11.cs : Add to demonstrate error -11 
4003
4004 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
4005
4006         * assign.cs (Assign::Resolve): Resolve right hand side first, and
4007         then pass this as a hint to ResolveLValue.
4008         
4009         * expression.cs (FieldExpr): Add Location information
4010
4011         (FieldExpr::LValueResolve): Report assignment to readonly
4012         variable. 
4013         
4014         (Expression::ExprClassFromMemberInfo): Pass location information.
4015
4016         (Expression::ResolveLValue): Add new method that resolves an
4017         LValue. 
4018
4019         (Expression::DoResolveLValue): Default invocation calls
4020         DoResolve. 
4021
4022         (Indexers): New class used to keep track of indexers in a given
4023         Type. 
4024
4025         (IStackStore): Renamed from LValue, as it did not really describe
4026         what this did.  Also ResolveLValue is gone from this interface and
4027         now is part of Expression.
4028
4029         (ElementAccess): Depending on the element access type
4030         
4031         * typemanager.cs: Add `indexer_name_type' as a Core type
4032         (System.Runtime.CompilerServices.IndexerNameAttribute)
4033
4034         * statement.cs (Goto): Take a location.
4035         
4036 2001-10-18  Ravi Pratap  <ravi@ximian.com>
4037
4038         * delegate.cs (Delegate::VerifyDelegate): New method to verify
4039         if two delegates are compatible.
4040
4041         (NewDelegate::DoResolve): Update to take care of the case when
4042         we instantiate a delegate from another delegate.
4043
4044         * typemanager.cs (FindMembers): Don't even try to look up members
4045         of Delegate types for now.
4046
4047 2001-10-18  Ravi Pratap  <ravi@ximian.com>
4048
4049         * delegate.cs (NewDelegate): New class to take care of delegate
4050         instantiation.
4051
4052         * expression.cs (New): Split the delegate related code out into 
4053         the NewDelegate class.
4054
4055         * delegate.cs (DelegateInvocation): New class to handle delegate 
4056         invocation.
4057
4058         * expression.cs (Invocation): Split out delegate related code into
4059         the DelegateInvocation class.
4060
4061 2001-10-17  Ravi Pratap  <ravi@ximian.com>
4062
4063         * expression.cs (New::DoResolve): Implement delegate creation fully
4064         and according to the spec.
4065
4066         (New::DoEmit): Update to handle delegates differently.
4067
4068         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
4069         because of which we were printing out arguments in reverse order !
4070
4071         * delegate.cs (VerifyMethod): Implement to check if the given method
4072         matches the delegate.
4073
4074         (FullDelegateDesc): Implement.
4075
4076         (VerifyApplicability): Implement.
4077
4078         * expression.cs (Invocation::DoResolve): Update to accordingly handle
4079         delegate invocations too.
4080
4081         (Invocation::Emit): Ditto.
4082
4083         * ../errors/cs1593.cs : Added.
4084
4085         * ../errors/cs1594.cs : Added.
4086
4087         * delegate.cs (InstanceExpression, TargetMethod): New properties.
4088
4089 2001-10-16  Ravi Pratap  <ravi@ximian.com>
4090
4091         * typemanager.cs (intptr_type): Core type for System.IntPtr
4092
4093         (InitCoreTypes): Update for the same.
4094
4095         (iasyncresult_type, asynccallback_type): Ditto.
4096
4097         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
4098         correct.
4099
4100         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
4101         too.
4102
4103         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
4104         the builders for the 4 members of a delegate type :-)
4105
4106         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
4107         type.
4108
4109         * expression.cs (New::DoResolve): Implement guts for delegate creation.
4110
4111         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
4112
4113 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
4114
4115         * statement.cs (Break::Emit): Implement.   
4116         (Continue::Emit): Implement.
4117
4118         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
4119         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
4120         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
4121         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
4122         end loop
4123         
4124         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
4125         properties that track the label for the current loop (begin of the
4126         loop and end of the loop).
4127
4128 2001-10-15  Ravi Pratap  <ravi@ximian.com>
4129
4130         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
4131         use of emitting anything at all.
4132
4133         * class.cs, rootcontext.cs : Get rid of calls to the same.
4134
4135         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
4136
4137         (Populate): Define the constructor correctly and set the implementation
4138         attributes.
4139
4140         * typemanager.cs (delegate_types): New hashtable to hold delegates that
4141         have been defined.
4142
4143         (AddDelegateType): Implement.
4144
4145         (IsDelegateType): Implement helper method.
4146
4147         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
4148
4149         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
4150         and accordingly handle it.
4151
4152         * delegate.cs (Populate): Take TypeContainer argument.
4153         Implement bits to define the Invoke method. However, I still haven't figured out
4154         how to take care of the native int bit :-(
4155
4156         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
4157         Qualify the name of the delegate, not its return type !
4158
4159         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
4160         conversion.
4161
4162         (StandardConversionExists): Checking for array types turns out to be recursive.
4163
4164         (ConvertReferenceExplicit): Implement array conversion.
4165
4166         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
4167         
4168 2001-10-12  Ravi Pratap  <ravi@ximian.com>
4169
4170         * cs-parser.jay (delegate_declaration): Store the fully qualified
4171         name as it is a type declaration.
4172
4173         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
4174         readonly.
4175
4176         (DefineDelegate): Renamed from Define. Does the same thing essentially,
4177         as TypeContainer::DefineType.
4178
4179         (Populate): Method in which all the definition of the various methods (Invoke)
4180         etc is done.
4181
4182         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
4183         see.
4184         
4185         (CloseDelegate): Finally creates the delegate.
4186
4187         * class.cs (TypeContainer::DefineType): Update to define delegates.
4188         (Populate, Emit and CloseType): Do the same thing here too.
4189
4190         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
4191         delegates in all these operations.
4192
4193 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
4194
4195         * expression.cs: LocalTemporary: a new expression used to
4196         reference a temporary that has been created.
4197
4198         * assign.cs: Handle PropertyAccess back here, so that we can
4199         provide the proper semantic access to properties.
4200
4201         * expression.cs (Expression::ConvertReferenceExplicit): Implement
4202         a few more explicit conversions. 
4203
4204         * modifiers.cs: `NEW' modifier maps to HideBySig.
4205
4206         * expression.cs (PropertyExpr): Make this into an
4207         ExpressionStatement, and support the EmitStatement code path. 
4208
4209         Perform get/set error checking, clean up the interface.
4210
4211         * assign.cs: recognize PropertyExprs as targets, and if so, turn
4212         them into toplevel access objects.
4213
4214 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
4215
4216         * expression.cs: PropertyExpr::PropertyExpr: use work around the
4217         SRE.
4218
4219         * typemanager.cs: Keep track here of our PropertyBuilders again to
4220         work around lameness in SRE.
4221
4222 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
4223
4224         * expression.cs (LValue::LValueResolve): New method in the
4225         interface, used to perform a second resolution pass for LValues. 
4226         
4227         (This::DoResolve): Catch the use of this in static methods.
4228
4229         (This::LValueResolve): Implement.
4230
4231         (This::Store): Remove warning, assigning to `this' in structures
4232         is 
4233
4234         (Invocation::Emit): Deal with invocation of
4235         methods on value types.  We need to pass the address to structure
4236         methods rather than the object itself.  (The equivalent code to
4237         emit "this" for structures leaves the entire structure on the
4238         stack instead of a pointer to it). 
4239
4240         (ParameterReference::DoResolve): Compute the real index for the
4241         argument based on whether the method takes or not a `this' pointer
4242         (ie, the method is static).
4243
4244         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
4245         value types returned from functions when we need to invoke a
4246         method on the sturcture.
4247         
4248
4249 2001-10-11  Ravi Pratap  <ravi@ximian.com>
4250
4251         * class.cs (TypeContainer::DefineType): Method to actually do the business of
4252         defining the type in the Modulebuilder or Typebuilder. This is to take
4253         care of nested types which need to be defined on the TypeBuilder using
4254         DefineNestedMethod.
4255
4256         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
4257         methods in RootContext, only ported to be part of TypeContainer.
4258
4259         (TypeContainer::GetInterfaceOrClass): Ditto.
4260
4261         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
4262
4263         * interface.cs (Interface::DefineInterface): New method. Does exactly
4264         what RootContext.CreateInterface did earlier, only it takes care of nested types 
4265         too.
4266
4267         (Interface::GetInterfaces): Move from RootContext here and port.
4268
4269         (Interface::GetInterfaceByName): Same here.
4270
4271         * rootcontext.cs (ResolveTree): Re-write.
4272
4273         (PopulateTypes): Re-write.
4274
4275         * class.cs (TypeContainer::Populate): Populate nested types too.
4276         (TypeContainer::Emit): Emit nested members too.
4277
4278         * typemanager.cs (AddUserType): Do not make use of the FullName property,
4279         instead just use the name argument passed in as it is already fully
4280         qualified.
4281
4282         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
4283         to TypeContainer mapping to see if a type is user-defined.
4284
4285         * class.cs (TypeContainer::CloseType): Implement. 
4286
4287         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
4288         the default constructor.
4289         
4290         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
4291         twice.
4292
4293         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
4294
4295         * interface.cs (CloseType): Create the type here.
4296         
4297         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
4298         the hierarchy.
4299
4300         Remove all the methods which are now in TypeContainer.
4301
4302 2001-10-10  Ravi Pratap  <ravi@ximian.com>
4303
4304         * delegate.cs (Define): Re-write bits to define the delegate
4305         correctly.
4306
4307 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
4308
4309         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
4310
4311         * expression.cs (ImplicitReferenceConversion): handle null as well
4312         as a source to convert to any reference type.
4313
4314         * statement.cs (Return): Perform any implicit conversions to
4315         expected return type.  
4316
4317         Validate use of return statement.  
4318
4319         * codegen.cs (EmitContext): Pass the expected return type here.
4320
4321         * class.cs (Method, Constructor, Property): Pass expected return
4322         type to EmitContext.
4323
4324 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
4325
4326         * expression.cs: Make DoResolve take an EmitContext instead of a
4327         TypeContainer.
4328
4329         Replaced `l' and `location' for `loc', for consistency.
4330         
4331         (Error, Warning): Remove unneeded Tc argument.
4332
4333         * assign.cs, literal.cs, constant.cs: Update to new calling
4334         convention. 
4335         
4336         * codegen.cs: EmitContext now contains a flag indicating whether
4337         code is being generated in a static method or not.
4338
4339         * cs-parser.jay: DecomposeQI, new function that replaces the old
4340         QualifiedIdentifier.  Now we always decompose the assembled
4341         strings from qualified_identifier productions into a group of
4342         memberaccesses.
4343
4344 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
4345
4346         * rootcontext.cs: Deal with field-less struct types correctly now
4347         by passing the size option to Define Type.
4348
4349         * class.cs: Removed hack that created one static field. 
4350
4351 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
4352
4353         * statement.cs: Moved most of the code generation here. 
4354
4355 2001-10-09  Ravi Pratap  <ravi@ximian.com>
4356
4357         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
4358         seem very right.
4359
4360         (ElementAccess): Remove useless bits for now - keep checks as the spec
4361         says.
4362
4363 2001-10-08  Ravi Pratap  <ravi@ximian.com>
4364
4365         * expression.cs (ElementAccess::DoResolve): Remove my crap code
4366         and start performing checks according to the spec.
4367
4368 2001-10-07  Ravi Pratap  <ravi@ximian.com>
4369
4370         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
4371         rank_specifiers instead.
4372
4373         (rank_specifiers): Change the order in which the rank specifiers are stored
4374
4375         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
4376
4377         * expression.cs (ElementAccess): Implement the LValue interface too.
4378         
4379 2001-10-06  Ravi Pratap  <ravi@ximian.com>
4380         
4381         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
4382         except that user defined conversions are not included.
4383
4384         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
4385         perform the conversion of the return type, if necessary.
4386
4387         (New::DoResolve): Check whether we are creating an array or an object
4388         and accordingly do the needful.
4389
4390         (New::Emit): Same here.
4391
4392         (New::DoResolve): Implement guts of array creation.
4393
4394         (New::FormLookupType): Helper function.
4395
4396 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
4397
4398         * codegen.cs: Removed most of the code generation here, and move the
4399         corresponding code generation bits to the statement classes. 
4400
4401         Added support for try/catch/finalize and throw.
4402         
4403         * cs-parser.jay: Added support for try/catch/finalize.
4404
4405         * class.cs: Catch static methods having the flags override,
4406         virtual or abstract.
4407
4408         * expression.cs (UserCast): This user cast was not really doing
4409         what it was supposed to do.  Which is to be born in fully resolved
4410         state.  Parts of the resolution were being performed at Emit time! 
4411
4412         Fixed this code.
4413
4414 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
4415
4416         * expression.cs: Implicity convert the result from UserCast.
4417
4418 2001-10-05  Ravi Pratap  <ravi@ximian.com>
4419
4420         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
4421         prevented it from working correctly. 
4422
4423         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
4424         merely ConvertImplicit.
4425
4426 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
4427
4428         * typemanager.cs: Make the LookupTypeContainer function static,
4429         and not per-instance.  
4430
4431         * class.cs: Make static FindMembers (the one that takes a Type
4432         argument). 
4433
4434         * codegen.cs: Add EmitForeach here.
4435
4436         * cs-parser.jay: Make foreach a toplevel object instead of the
4437         inline expansion, as we need to perform semantic analysis on it. 
4438
4439 2001-10-05  Ravi Pratap  <ravi@ximian.com>
4440
4441         * expression.cs (Expression::ImplicitUserConversion): Rename to
4442         UserDefinedConversion.
4443
4444         (Expression::UserDefinedConversion): Take an extra argument specifying 
4445         whether we look for explicit user conversions too.
4446
4447         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
4448
4449         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
4450
4451         (ExplicitUserConversion): Make it a call to UserDefinedConversion
4452         with the appropriate arguments.
4453
4454         * cs-parser.jay (cast_expression): Record location too.
4455
4456         * expression.cs (Cast): Record location info.
4457
4458         (Expression::ConvertExplicit): Take location argument.
4459
4460         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
4461         to determine if we are doing explicit conversions.
4462
4463         (UserCast::Emit): Update accordingly.
4464
4465         (Expression::ConvertExplicit): Report an error if everything fails.
4466
4467         * ../errors/cs0030.cs : Add.
4468
4469 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
4470
4471         * modifiers.cs: If the ABSTRACT keyword is present, also set the
4472         virtual and newslot bits. 
4473
4474         * class.cs (TypeContainer::RegisterRequiredImplementations):
4475         Record methods we need.
4476
4477         (TypeContainer::MakeKey): Helper function to make keys for
4478         MethodBases, since the Methodbase key is useless.
4479
4480         (TypeContainer::Populate): Call RegisterRequiredImplementations
4481         before defining the methods.   
4482
4483         Create a mapping for method_builders_to_methods ahead of time
4484         instead of inside a tight loop.
4485
4486         (::RequireMethods):  Accept an object as the data to set into the
4487         hashtable so we can report interface vs abstract method mismatch.
4488
4489 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
4490
4491         * report.cs: Make all of it static.
4492
4493         * rootcontext.cs: Drop object_type and value_type computations, as
4494         we have those in the TypeManager anyways.
4495
4496         Drop report instance variable too, now it is a global.
4497
4498         * driver.cs: Use try/catch on command line handling.
4499
4500         Add --probe option to debug the error reporting system with a test
4501         suite. 
4502
4503         * report.cs: Add support for exiting program when a probe
4504         condition is reached.
4505
4506 2001-10-03  Ravi Pratap  <ravi@ximian.com>
4507
4508         * expression.cs (Binary::DoNumericPromotions): Fix the case when
4509         we do a forcible conversion regardless of type, to check if 
4510         ForceConversion returns a null.
4511
4512         (Binary::error19): Use location to report error.
4513
4514         (Unary::error23): Use location here too.
4515
4516         * ../errors/cs0019.cs : Check in.
4517
4518         * ../errors/cs0023.cs : Check in.
4519
4520         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
4521         case of a non-null MethodInfo object with a length of 0 !
4522
4523         (Binary::ResolveOperator): Flag error if overload resolution fails to find
4524         an applicable member - according to the spec :-)
4525         Also fix logic to find members in base types.
4526
4527         (Unary::ResolveOperator): Same here.
4528
4529         (Unary::report23): Change name to error23 and make first argument a TypeContainer
4530         as I was getting thoroughly confused between this and error19 :-)
4531         
4532         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
4533         (::FindMostEncompassedType): Implement.
4534         (::FindMostEncompassingType): Implement.
4535         (::StandardConversionExists): Implement.
4536
4537         (UserImplicitCast): Re-vamp. We now need info about most specific
4538         source and target types so that we can do the necessary conversions.
4539
4540         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
4541         mathematical union with no duplicates.
4542
4543 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
4544
4545         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
4546         in order from base classes to child classes, so that we can in
4547         child classes look up in our parent for method names and
4548         attributes (required for handling abstract, virtual, new, override
4549         constructs: we need to instrospect our base class, and if we dont
4550         populate the classes in order, the introspection might be
4551         incorrect.  For example, a method could query its parent before
4552         the parent has any methods and would determine that the parent has
4553         no abstract methods (while it could have had them)).
4554
4555         (RootContext::CreateType): Record the order in which we define the
4556         classes.
4557
4558 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
4559
4560         * class.cs (TypeContainer::Populate): Also method definitions can
4561         fail now, keep track of this.
4562
4563         (TypeContainer::FindMembers): Implement support for
4564         DeclaredOnly/noDeclaredOnly flag.
4565
4566         (Constructor::Emit) Return the ConstructorBuilder.
4567
4568         (Method::Emit) Return the MethodBuilder. 
4569         Check for abstract or virtual methods to be public.
4570
4571         * rootcontext.cs (RootContext::CreateType): Register all the
4572         abstract methods required for the class to be complete and the
4573         interface methods that must be implemented. 
4574
4575         * cs-parser.jay: Report error 501 (method requires body if it is
4576         not marked abstract or extern).
4577
4578         * expression.cs (TypeOf::Emit): Implement.
4579
4580         * typemanager.cs: runtime_handle_type, new global type.
4581
4582         * class.cs (Property::Emit): Generate code for properties.
4583
4584 2001-10-02  Ravi Pratap  <ravi@ximian.com>
4585
4586         * expression.cs (Unary::ResolveOperator): Find operators on base type
4587         too - we now conform exactly to the spec.
4588
4589         (Binary::ResolveOperator): Same here.
4590
4591         * class.cs (Operator::Define): Fix minor quirk in the tests.
4592
4593         * ../errors/cs0215.cs : Added.
4594
4595         * ../errors/cs0556.cs : Added.
4596
4597         * ../errors/cs0555.cs : Added.
4598
4599 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
4600
4601         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
4602         single integer which is really efficient
4603
4604 2001-10-01  Ravi Pratap  <ravi@ximian.com>
4605
4606         *  expression.cs (Expression::ImplicitUserConversion): Use location
4607         even in the case when we are examining True operators.
4608  
4609         * class.cs (Operator::Define): Perform extensive checks to conform
4610         with the rules for operator overloading in the spec.
4611
4612         * expression.cs (Expression::ImplicitReferenceConversion): Implement
4613         some of the other conversions mentioned in the spec.
4614
4615         * typemanager.cs (array_type): New static member for the System.Array built-in
4616         type.
4617
4618         (cloneable_interface): For System.ICloneable interface.
4619
4620         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
4621         we start resolving the tree and populating types.
4622
4623         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
4624  
4625 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
4626
4627         * expression.cs (Expression::ExprClassFromMemberInfo,
4628         Expression::Literalize): Create literal expressions from
4629         FieldInfos which are literals.
4630
4631         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
4632         type casts, because they were wrong.  The test suite in tests
4633         caught these ones.
4634
4635         (ImplicitNumericConversion): ushort to ulong requires a widening
4636         cast. 
4637
4638         Int32 constant to long requires widening cast as well.
4639
4640         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
4641         for integers because the type on the stack is not i4.
4642
4643 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
4644
4645         * expression.cs (report118): require location argument. 
4646
4647         * parameter.cs: Do not dereference potential null value.
4648
4649         * class.cs: Catch methods that lack the `new' keyword when
4650         overriding a name.  Report warnings when `new' is used without
4651         anything being there to override.
4652
4653         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
4654
4655         * class.cs: Only add constructor to hashtable if it is non-null
4656         (as now constructors can fail on define).
4657
4658         (TypeManager, Class, Struct): Take location arguments.
4659
4660         Catch field instance initialization in structs as errors.
4661
4662         accepting_filter: a new filter for FindMembers that is static so
4663         that we dont create an instance per invocation.
4664
4665         (Constructor::Define): Catch errors where a struct constructor is
4666         parameterless 
4667
4668         * cs-parser.jay: Pass location information for various new
4669         constructs. 
4670         
4671         * delegate.cs (Delegate): take a location argument.
4672
4673         * driver.cs: Do not call EmitCode if there were problesm in the
4674         Definition of the types, as many Builders wont be there. 
4675
4676         * decl.cs (Decl::Decl): Require a location argument.
4677
4678         * cs-tokenizer.cs: Handle properly hex constants that can not fit
4679         into integers, and find the most appropiate integer for it.
4680
4681         * literal.cs: Implement ULongLiteral.
4682
4683         * rootcontext.cs: Provide better information about the location of
4684         failure when CreateType fails.
4685         
4686 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
4687
4688         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
4689         as well.
4690
4691         * expression.cs (Binary::CheckShiftArguments): Add missing type
4692         computation.
4693         (Binary::ResolveOperator): Add type to the logical and and logical
4694         or, Bitwise And/Or and Exclusive Or code paths, it was missing
4695         before.
4696
4697         (Binary::DoNumericPromotions): In the case where either argument
4698         is ulong (and most signed types combined with ulong cause an
4699         error) perform implicit integer constant conversions as well.
4700
4701 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
4702
4703         * expression.cs (UserImplicitCast): Method should always be
4704         non-null. 
4705         (Invocation::BetterConversion): Simplified test for IntLiteral.
4706
4707         (Expression::ImplicitNumericConversion): Split this routine out.
4708         Put the code that performs implicit constant integer conversions
4709         here. 
4710
4711         (Expression::Resolve): Become a wrapper around DoResolve so we can
4712         check eclass and type being set after resolve.
4713
4714         (Invocation::Badness): Remove this dead function
4715
4716         (Binary::ResolveOperator): Do not compute the expensive argumnets
4717         unless we have a union for it.
4718
4719         (Probe::Emit): Is needs to do an isinst and then
4720         compare against null.
4721
4722         (::CanConvert): Added Location argument.  If the Location argument
4723         is null (Location.Null), then we do not report errors.  This is
4724         used by the `probe' mechanism of the Explicit conversion.  We do
4725         not want to generate an error for something that the user
4726         explicitly requested to be casted.  But the pipeline for an
4727         explicit cast first tests for potential implicit casts.
4728
4729         So for now, if the Location is null, it means `Probe only' to
4730         avoid adding another argument.   Might have to revise this
4731         strategy later.
4732
4733         (ClassCast): New class used to type cast objects into arbitrary
4734         classes (used in Explicit Reference Conversions).
4735
4736         Implement `as' as well.
4737
4738         Reverted all the patches from Ravi below: they were broken:
4739
4740                 * The use of `level' as a mechanism to stop recursive
4741                   invocations is wrong.  That was there just to catch the
4742                   bug with a strack trace but not as a way of addressing
4743                   the problem.
4744
4745                   To fix the problem we have to *understand* what is going
4746                   on and the interactions and come up with a plan, not
4747                   just get things going.
4748
4749                 * The use of the type conversion cache that I proposed
4750                   last night had an open topic: How does this work across
4751                   protection domains.  A user defined conversion might not
4752                   be public in the location where we are applying the
4753                   conversion, a different conversion might be selected
4754                   (ie, private A->B (better) but public B->A (worse),
4755                   inside A, A->B applies, but outside it, B->A will
4756                   apply).
4757
4758                 * On top of that (ie, even if the above is solved),
4759                   conversions in a cache need to be abstract.  Ie, `To
4760                   convert from an Int to a Short use an OpcodeCast', not
4761                   `To convert from an Int to a Short use the OpcodeCast on
4762                   the variable 5' (which is what this patch was doing).
4763         
4764 2001-09-28  Ravi Pratap  <ravi@ximian.com>
4765
4766         * expression.cs (Invocation::ConversionExists): Re-write to use
4767         the conversion cache
4768         
4769         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
4770         cache all conversions done, not just user-defined ones.
4771
4772         (Invocation::BetterConversion): The real culprit. Use ConversionExists
4773         to determine if a conversion exists instead of acutually trying to 
4774         perform the conversion. It's faster too.
4775
4776         (Expression::ConvertExplicit): Modify to use ConversionExists to check
4777         and only then attempt the implicit conversion.
4778
4779 2001-09-28  Ravi Pratap  <ravi@ximian.com>
4780
4781         * expression.cs (ConvertImplicit): Use a cache for conversions
4782         already found. Check level of recursion and bail out if necessary.
4783         
4784 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
4785
4786         * typemanager.cs (string_concat_string_string, string_concat_object_object):
4787         Export standard methods that we expect for string operations.
4788         
4789         * statement.cs (Block::UsageWarning): Track usage of variables and
4790         report the errors for not used variables.
4791
4792         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
4793         operator. 
4794
4795 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
4796
4797         * codegen.cs: remove unnneded code 
4798
4799         * expression.cs: Removed BuiltinTypeAccess class
4800
4801         Fix the order in which implicit conversions are
4802         done.  
4803
4804         The previous fixed dropped support for boxed conversions (adding a
4805         test to the test suite now)
4806
4807         (UserImplicitCast::CanConvert): Remove test for source being null,
4808         that code is broken.  We should not feed a null to begin with, if
4809         we do, then we should track the bug where the problem originates
4810         and not try to cover it up here.
4811
4812         Return a resolved expression of type UserImplicitCast on success
4813         rather than true/false.  Ravi: this is what I was talking about,
4814         the pattern is to use a static method as a "constructor" for
4815         objects. 
4816
4817         Also, do not create arguments until the very last minute,
4818         otherwise we always create the arguments even for lookups that
4819         will never be performed. 
4820
4821         (UserImplicitCast::Resolve): Eliminate, objects of type
4822         UserImplicitCast are born in a fully resolved state. 
4823         
4824         * typemanager.cs (InitCoreTypes): Init also value_type
4825         (System.ValueType). 
4826
4827         * expression.cs (Cast::Resolve): First resolve the child expression.
4828
4829         (LValue): Add new method AddressOf to be used by
4830         the `&' operator.  
4831
4832         Change the argument of Store to take an EmitContext instead of an
4833         ILGenerator, because things like FieldExpr need to be able to call
4834         their children expression to generate the instance code. 
4835
4836         (Expression::Error, Expression::Warning): Sugar functions for
4837         reporting errors.
4838
4839         (Expression::MemberLookup): Accept a TypeContainer instead of a
4840         Report as the first argument.
4841
4842         (Expression::ResolvePrimary): Killed.  I still want to improve
4843         this as currently the code is just not right.
4844
4845         (Expression::ResolveMemberAccess): Simplify, but it is still
4846         wrong. 
4847
4848         (Unary::Resolve): Catch errors in AddressOf operators.
4849
4850         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
4851         index to a byte for the short-version, or the compiler will choose
4852         the wrong Emit call, which generates the wrong data.
4853
4854         (ParameterReference::Emit, ::Store): same.
4855
4856         (FieldExpr::AddressOf): Implement.
4857         
4858         * typemanager.cs: TypeManager: made public variable instead of
4859         property.
4860         
4861         * driver.cs: document --fatal.
4862
4863         * report.cs (ErrorMessage, WarningMessage): new names for the old
4864         Error and Warning classes.
4865
4866         * cs-parser.jay (member_access): Turn built-in access to types
4867         into a normal simplename
4868
4869 2001-09-27  Ravi Pratap  <ravi@ximian.com>
4870
4871         * expression.cs (Invocation::BetterConversion): Fix to cope
4872         with q being null, since this was introducing a bug.
4873
4874         * expression.cs (ConvertImplicit): Do built-in conversions first.
4875
4876 2001-09-27  Ravi Pratap  <ravi@ximian.com>
4877
4878         * expression.cs (UserImplicitCast::Resolve): Fix bug.
4879
4880 2001-09-27  Ravi Pratap  <ravi@ximian.com>
4881
4882         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
4883         I had introduced long ago (what's new ?).
4884
4885         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
4886         the work of all the checking. 
4887         (ConvertImplicit): Call CanConvert and only then create object if necessary.
4888         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
4889
4890         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
4891         that is the right way. 
4892
4893         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
4894         overloading resolution. Use everywhere instead of cutting and pasting code.
4895
4896         (Binary::ResolveOperator): Use MakeUnionSet.
4897
4898         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
4899         we have to convert to bool types. Not complete yet.
4900         
4901 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
4902
4903         * typemanager.cs (TypeManager::CSharpName): support ushort.
4904
4905         * expression.cs (Expression::TryImplicitIntConversion): Attempts
4906         to provide an expression that performsn an implicit constant int
4907         conversion (section 6.1.6).
4908         (Expression::ConvertImplicitRequired): Reworked to include
4909         implicit constant expression conversions.
4910
4911         (Expression::ConvertNumericExplicit): Finished.
4912
4913         (Invocation::Emit): If InstanceExpression is null, then it means
4914         that we perform a call on this.
4915         
4916 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
4917
4918         * expression.cs (Unary::Emit): Remove some dead code.
4919         (Probe): Implement Resolve and Emit for `is'.
4920         (Expression::ConvertImplicitRequired): Attempt to do constant
4921         expression conversions here.  Maybe should be moved to
4922         ConvertImplicit, but I am not sure.
4923         (Expression::ImplicitLongConstantConversionPossible,
4924         Expression::ImplicitIntConstantConversionPossible): New functions
4925         that tell whether is it possible to apply an implicit constant
4926         expression conversion.
4927
4928         (ConvertNumericExplicit): Started work on explicit numeric
4929         conversions.
4930
4931         * cs-parser.jay: Update operator constants.
4932
4933         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
4934         (Parameters::GetSignature): Hook up VerifyArgs here.
4935         (Parameters::VerifyArgs): Verifies that no two arguments have the
4936         same name. 
4937
4938         * class.cs (Operator): Update the operator names to reflect the
4939         ones that the spec expects (as we are just stringizing the
4940         operator names).
4941         
4942         * expression.cs (Unary::ResolveOperator): Fix bug: Use
4943         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
4944         previous usage did only work for our methods.
4945         (Expression::ConvertImplicit): Handle decimal implicit numeric
4946         conversions as well.
4947         (Expression::InternalTypeConstructor): Used to invoke constructors
4948         on internal types for default promotions.
4949
4950         (Unary::Emit): Implement special handling for the pre/post
4951         increment/decrement for overloaded operators, as they need to have
4952         the same semantics as the other operators.
4953
4954         (Binary::ResolveOperator): ditto.
4955         (Invocation::ConversionExists): ditto.
4956         (UserImplicitCast::Resolve): ditto.
4957         
4958 2001-09-26  Ravi Pratap  <ravi@ximian.com>
4959
4960         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
4961         operator, return after emitting body. Regression tests pass again !
4962
4963         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
4964         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
4965         (Invocation::OverloadResolve): Ditto.
4966         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
4967
4968         * everywhere : update calls to the above methods accordingly.
4969
4970 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
4971
4972         * assign.cs (Assign): Make it inherit from ExpressionStatement.
4973
4974         * expression.cs (ExpressionStatement): New base class used for
4975         expressions that can appear in statements, so that we can provide
4976         an alternate path to generate expression that do not leave a value
4977         on the stack.
4978
4979         (Expression::Emit, and all the derivatives): We no longer return
4980         whether a value is left on the stack or not.  Every expression
4981         after being emitted leaves a single value on the stack.
4982
4983         * codegen.cs (EmitContext::EmitStatementExpression): Use the
4984         facilties of ExpressionStatement if possible.
4985
4986         * cs-parser.jay: Update statement_expression.
4987
4988 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
4989
4990         * driver.cs: Change the wording of message
4991
4992 2001-09-25  Ravi Pratap  <ravi@ximian.com>
4993
4994         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
4995         the type of the expression to the return type of the method if
4996         we have an overloaded operator match ! The regression tests pass again !
4997         (Unary::ResolveOperator): Ditto.
4998
4999         * expression.cs (Invocation::ConversionExists): Correct the member lookup
5000         to find "op_Implicit", not "implicit" ;-)
5001         (UserImplicitCast): New class to take care of user-defined implicit conversions.
5002         (ConvertImplicit, ForceConversion): Take TypeContainer argument
5003
5004         * everywhere : Correct calls to the above accordingly.
5005
5006         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
5007         (ConvertImplicit): Do user-defined conversion if it exists.
5008
5009 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
5010
5011         * assign.cs: track location.
5012         (Resolve): Use implicit conversions on assignment.
5013
5014         * literal.cs: Oops.  Not good, Emit of short access values should
5015         pass (Bytes) or the wrong argument will be selected.
5016
5017         * expression.cs (Unary::Emit): Emit code for -expr.
5018         
5019         (Unary::ResolveOperator): Handle `Substract' for non-constants
5020         (substract from zero from the non-constants).
5021         Deal with Doubles as well. 
5022         
5023         (Expression::ConvertImplicitRequired): New routine that reports an
5024         error if no implicit conversion exists. 
5025
5026         (Invocation::OverloadResolve): Store the converted implicit
5027         expressions if we make them
5028         
5029 2001-09-24  Ravi Pratap  <ravi@ximian.com>
5030
5031         * class.cs (ConstructorInitializer): Take a Location argument.
5032         (ConstructorBaseInitializer): Same here.
5033         (ConstructorThisInitializer): Same here.
5034
5035         * cs-parser.jay : Update all calls accordingly.
5036
5037         * expression.cs (Unary, Binary, New): Take location argument.
5038         Update accordingly everywhere.
5039
5040         * cs-parser.jay : Update all calls to the above to take a location
5041         argument.
5042
5043         * class.cs : Ditto.
5044
5045 2001-09-24  Ravi Pratap  <ravi@ximian.com>
5046
5047         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
5048         (Invocation::BetterConversion): Same here
5049         (Invocation::ConversionExists): Ditto.
5050
5051         (Invocation::ConversionExists): Implement.
5052
5053 2001-09-22  Ravi Pratap  <ravi@ximian.com>
5054
5055         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
5056         Also take an additional TypeContainer argument.
5057
5058         * All over : Pass in TypeContainer as argument to OverloadResolve.
5059
5060         * typemanager.cs (CSharpName): Update to check for the string type and return
5061         that too.
5062
5063         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
5064         a given method.
5065         
5066 2001-09-21  Ravi Pratap  <ravi@ximian.com>
5067
5068         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
5069         (Invocation::BetterFunction): Implement.
5070         (Invocation::BetterConversion): Implement.
5071         (Invocation::ConversionExists): Skeleton, no implementation yet.
5072
5073         Okay, things work fine !
5074
5075 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
5076
5077         * typemanager.cs: declare and load enum_type, delegate_type and
5078         void_type. 
5079
5080         * expression.cs (Expression::Emit): Now emit returns a value that
5081         tells whether a value is left on the stack or not.  This strategy
5082         might be reveted tomorrow with a mechanism that would address
5083         multiple assignments.
5084         (Expression::report118): Utility routine to report mismatches on
5085         the ExprClass.
5086
5087         (Unary::Report23): Report impossible type/operator combination
5088         utility function.
5089
5090         (Unary::IsIncrementableNumber): Whether the type can be
5091         incremented or decremented with add.
5092         (Unary::ResolveOperator): Also allow enumerations to be bitwise
5093         complemented. 
5094         (Unary::ResolveOperator): Implement ++, !, ~,
5095
5096         (Invocation::Emit): Deal with new Emit convetion.
5097         
5098         * All Expression derivatives: Updated their Emit method to return
5099         whether they leave values on the stack or not.
5100         
5101         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
5102         stack for expressions that are statements. 
5103
5104 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
5105
5106         * expression.cs (LValue): New interface.  Must be implemented by
5107         LValue objects.
5108         (LocalVariableReference, ParameterReference, FieldExpr): Implement
5109         LValue interface.
5110         
5111         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
5112         interface for generating code, simplifies the code.
5113
5114 2001-09-20  Ravi Pratap  <ravi@ximian.com>
5115
5116         * expression.cs (everywhere): Comment out return statements in ::Resolve
5117         methods to avoid the warnings.
5118
5119 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
5120
5121         * driver.cs (parse): Report error 2001 if we can not open the
5122         source file.
5123
5124         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
5125         not resolve it.
5126
5127         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
5128         object. 
5129
5130         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
5131         otherwise nested blocks end up with the same index.
5132
5133         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
5134
5135         * expression.cs:  Instead of having FIXMEs in the Resolve
5136         functions, throw exceptions so it is obvious that we are facing a
5137         bug. 
5138
5139         * cs-parser.jay (invocation_expression): Pass Location information.
5140
5141         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
5142         Use a basename for those routines because .NET does not like paths
5143         on them. 
5144
5145         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
5146         already defined.
5147
5148 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
5149
5150         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
5151         are loading the correct data types (throws an exception if not).
5152         (TypeManager::InitCoreTypes): Use CoreLookupType
5153
5154         * expression.cs (Unary::ResolveOperator): return the child
5155         expression for expressions which are just +expr.
5156         (Unary::ResolveOperator): Return negative literals for -LITERAL
5157         expressions (otherwise they are Unary {Literal}).
5158         (Invocation::Badness): Take into account `Implicit constant
5159         expression conversions'.
5160
5161         * literal.cs (LongLiteral): Implement long literal class.
5162         (IntLiteral): export the `Value' of the intliteral. 
5163
5164 2001-09-19  Ravi Pratap  <ravi@ximian.com>
5165
5166         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
5167
5168         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
5169         instead of 'Operator'
5170
5171         * expression.cs (Binary::ResolveOperator): Update accordingly.
5172         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
5173         and 'Minus'
5174
5175         * cs-parser.jay (unary_expression): Update to use the new names.
5176
5177         * gen-treedump.cs (GetUnary): Same here.
5178
5179         * expression.cs (Unary::Resolve): Implement.
5180         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
5181         operators are found instead of making noise ;-)
5182         (Unary::ResolveOperator): New method to do precisely the same thing which
5183         Binary::ResolveOperator does for Binary expressions.
5184         (Unary.method, .Arguments): Add.
5185         (Unary::OperName): Implement.   
5186         (Unary::ForceConversion): Copy and Paste !
5187
5188         * class.cs (Operator::Define): Fix a small bug for the case when we have 
5189         a unary operator.
5190
5191         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
5192         for the inbuilt operators. Only overloading works for now ;-)
5193
5194 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
5195
5196         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
5197         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
5198
5199         * expression.cs (This::Emit): Implement. 
5200         (This::Resolve): Implement.
5201         (TypeOf:Resolve): Implement.
5202         (Expression::ResolveSimpleName): Add an implicit this to instance
5203         field references. 
5204         (MemberAccess::Resolve): Deal with Parameters and Fields. 
5205         Bind instance variable to Field expressions.
5206         (FieldExpr::Instance): New field used to track the expression that
5207         represents the object instance.
5208         (FieldExpr::Resolve): Track potential errors from MemberLookup not
5209         binding 
5210         (FieldExpr::Emit): Implement.
5211
5212         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
5213         the last instruction contains a return opcode to avoid generating
5214         the last `ret' instruction (this generates correct code, and it is
5215         nice to pass the peverify output).
5216
5217         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
5218         initializer for static and instance variables.
5219         (Constructor::Emit): Allow initializer to be null in the case of
5220         static constructors.  Only emit initializer for instance
5221         constructors. 
5222
5223         (TypeContainer::FindMembers): Return a null array if there are no
5224         matches.
5225
5226         Also fix the code for the MemberTypes.Method branch, as it was not
5227         scanning that for operators (or tried to access null variables before).
5228
5229         * assign.cs (Assign::Emit): Handle instance and static fields. 
5230
5231         * TODO: Updated.
5232
5233         * driver.cs: Stop compilation if there are parse errors.
5234
5235         * cs-parser.jay (constructor_declaration): Provide default base
5236         initializer for non-static constructors.
5237         (constructor_declarator): Do not provide a default base
5238         initializers if none was specified.
5239         Catch the fact that constructors should not have parameters.
5240
5241         * class.cs: Do not emit parent class initializers for static
5242         constructors, that should be flagged as an error.
5243
5244 2001-09-18  Ravi Pratap  <ravi@ximian.com>
5245
5246         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
5247         Move back code into TypeContainer::Populate.
5248
5249 2001-09-18  Ravi Pratap  <ravi@ximian.com>
5250
5251         * class.cs (TypeContainer::AddConstructor): Fix the check to
5252         compare against Name, not Basename. 
5253         (Operator::OpType): Change Plus and Minus to Add and Subtract.
5254
5255         * cs-parser.jay : Update accordingly.
5256
5257         * class.cs (TypeContainer::FindMembers): For the case where we are searching
5258         for methods, don't forget to look into the operators too.
5259         (RegisterMethodBuilder): Helper method to take care of this for
5260         methods, constructors and operators.
5261         (Operator::Define): Completely revamp.
5262         (Operator.OperatorMethod, MethodName): New fields.
5263         (TypeContainer::Populate): Move the registering of builders into
5264         RegisterMethodBuilder.
5265         (Operator::Emit): Re-write.
5266
5267         * expression.cs (Binary::Emit): Comment out code path to emit method
5268         invocation stuff for the case when we have a user defined operator. I am
5269         just not able to get it right !
5270         
5271 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
5272
5273         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
5274         argument. 
5275
5276         (Expression::MemberLookup): Provide a version that allows to
5277         specify the MemberTypes and BindingFlags. 
5278
5279         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
5280         so it was not fetching variable information from outer blocks.
5281
5282         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
5283         Beforefieldinit as it was buggy.
5284
5285         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
5286         that Ravi put here.  
5287
5288         * class.cs (Constructor::Emit): Only emit if block is not null.
5289         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
5290         deal with this by semantically definining it as if the user had
5291         done it.
5292
5293         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
5294         constructors as we now "emit" them at a higher level.
5295
5296         (TypeContainer::DefineDefaultConstructor): Used to define the
5297         default constructors if none was provided.
5298
5299         (ConstructorInitializer): Add methods Resolve and Emit. 
5300         
5301         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
5302
5303 2001-09-17  Ravi Pratap  <ravi@ximian.com>
5304
5305         * class.cs (TypeContainer::EmitDefaultConstructor): Register
5306         the default constructor builder with our hashtable for methodbuilders
5307         to methodcores.
5308
5309         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
5310         and argument_count is 0 in which case we have a match.
5311         (Binary::ResolveOperator): More null checking and miscellaneous coding
5312         style cleanup.
5313
5314 2001-09-17  Ravi Pratap  <ravi@ximian.com>
5315
5316         * rootcontext.cs (IsNameSpace): Compare against null.
5317
5318         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
5319
5320         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
5321         and Unary::Operator.
5322
5323         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
5324         accordingly.
5325
5326         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
5327         we have overloaded operators.
5328         (Binary::ResolveOperator): Implement the part which does the operator overload
5329         resolution.
5330
5331         * class.cs (Operator::Emit): Implement.
5332         (TypeContainer::Emit): Emit the operators we have too.
5333
5334         * expression.cs (Binary::Emit): Update to emit the appropriate code for
5335         the case when we have a user-defined operator.
5336         
5337 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
5338
5339         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
5340
5341 2001-09-16  Ravi Pratap  <ravi@ximian.com>
5342
5343         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
5344         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
5345         (Constructor::Emit): Implement.
5346         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
5347         if we have no work to do. 
5348         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
5349         Emit method.
5350
5351         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
5352         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
5353
5354         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
5355         of parent.parent.
5356
5357 2001-09-15  Ravi Pratap  <ravi@ximian.com>
5358
5359         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
5360         in the source.
5361         (Tree::RecordNamespace): Method to do what the name says ;-)
5362         (Tree::Namespaces): Property to get at the namespaces hashtable.
5363
5364         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
5365         keep track.
5366
5367         * rootcontext.cs (IsNamespace): Fixed it :-)
5368
5369 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
5370
5371         * class.cs (TypeContainer::FindMembers): Add support for
5372         constructors. 
5373         (MethodCore): New class that encapsulates both the shared aspects
5374         of a Constructor and a Method.  
5375         (Method, Constructor): Factored pieces into MethodCore.
5376
5377         * driver.cs: Added --fatal which makes errors throw exceptions.
5378         Load System assembly as well as part of the standard library.
5379
5380         * report.cs: Allow throwing exceptions on errors for debugging.
5381
5382         * modifiers.cs: Do not use `parent', instead use the real type
5383         container to evaluate permission settings.
5384
5385         * class.cs: Put Ravi's patch back in.  He is right, and we will
5386         have to cope with the
5387
5388 2001-09-14  Ravi Pratap  <ravi@ximian.com>
5389
5390         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
5391         FamORAssem, not FamANDAssem.
5392         
5393 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
5394
5395         * driver.cs: Added --parse option that only parses its input files
5396         and terminates.
5397
5398         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
5399         incorrect.  IsTopLevel is not used to tell whether an object is
5400         root_types or not (that can be achieved by testing this ==
5401         root_types).  But to see if this is a top-level *class* (not
5402         necessarly our "toplevel" container). 
5403
5404 2001-09-14  Ravi Pratap  <ravi@ximian.com>
5405
5406         * enum.cs (Enum::Define): Modify to call the Lookup method on the
5407         parent instead of a direct call to GetType.
5408
5409 2001-09-14  Ravi Pratap  <ravi@ximian.com>
5410
5411         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
5412         Modifiers.TypeAttr. This should just be a call to that method.
5413
5414         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
5415         object so that we can determine if we are top-level or not.
5416
5417         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
5418         TypeContainer too.
5419
5420         * enum.cs (Enum::Define): Ditto.
5421
5422         * modifiers.cs (FieldAttr): Re-write.
5423
5424         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
5425         (TypeContainer::HaveStaticConstructor): New property to provide access
5426         to precisely that info.
5427
5428         * modifiers.cs (MethodAttr): Re-write.
5429         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
5430
5431         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
5432         of top-level types as claimed.
5433         
5434 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
5435
5436         * expression.cs (MemberLookup): Fruitless attempt to lookup
5437         constructors.  Maybe I need to emit default constructors?  That
5438         might be it (currently .NET emits this for me automatically).
5439         (Invocation::OverloadResolve): Cope with Arguments == null.
5440         (Invocation::EmitArguments): new function, shared by the new
5441         constructor and us.
5442         (Invocation::Emit): Handle static and instance methods.  Emit
5443         proper call instruction for virtual or non-virtual invocations.
5444         (New::Emit): Implement.
5445         (New::Resolve): Implement.
5446         (MemberAccess:Resolve): Implement.
5447         (MethodGroupExpr::InstanceExpression): used conforming to the spec
5448         to track instances.
5449         (FieldExpr::Resolve): Set type.
5450
5451         * support.cs: Handle empty arguments.
5452                 
5453         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
5454         SimpleLookup): Auxiliary routines to help parse a qualifier
5455         identifier.  
5456
5457         Update qualifier_identifier rule.
5458
5459         * codegen.cs: Removed debugging messages.
5460
5461         * class.cs: Make this a global thing, this acts just as a "key" to
5462         objects that we might have around.
5463
5464         (Populate): Only initialize method_builders_to_methods once.
5465
5466         * expression.cs (PropertyExpr): Initialize type from the
5467         PropertyType. 
5468
5469         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
5470         Resolve pattern.  Attempt to implicitly convert value to boolean.
5471         Emit code.
5472
5473         * expression.cs: Set the type for the int32/int32 argument case.
5474         (Binary::ResolveOperator): Set the return type to boolean for
5475         comparission operators
5476
5477         * typemanager.cs: Remove debugging print code.
5478
5479         (Invocation::Resolve): resolve type.
5480
5481         * class.cs: Allocate a MemberInfo of the correct size, as the code
5482         elsewhere depends on the test to reflect the correct contents.
5483
5484         (Method::) Keep track of parameters, due to System.Reflection holes
5485
5486         (TypeContainer::Populate): Keep track of MethodBuilders to Method
5487         mapping here.
5488
5489         (TypeContainer::FindMembers): Use ArrayList and then copy an array
5490         of the exact size and return that.
5491
5492         (Class::LookupMethodByBuilder): New function that maps
5493         MethodBuilders to its methods.  Required to locate the information
5494         on methods because System.Reflection bit us again.
5495
5496         * support.cs: New file, contains an interface ParameterData and
5497         two implementations: ReflectionParameters and InternalParameters
5498         used to access Parameter information.  We will need to grow this
5499         as required.
5500
5501         * expression.cs (Invocation::GetParameterData): implement a cache
5502         and a wrapper around the ParameterData creation for methods. 
5503         (Invocation::OverloadResolve): Use new code.
5504
5505 2001-09-13  Ravi Pratap  <ravi@ximian.com>
5506
5507         * class.cs (TypeContainer::EmitField): Remove and move into 
5508         (Field::Define): here and modify accordingly.
5509         (Field.FieldBuilder): New member.
5510         (TypeContainer::Populate): Update accordingly.
5511         (TypeContainer::FindMembers): Implement.
5512
5513 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
5514
5515         * statement.cs: (VariableInfo::VariableType): New field to be
5516         initialized with the full type once it is resolved. 
5517
5518 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
5519
5520         * parameter.cs (GetParameterInfo): Use a type cache to compute
5521         things only once, and to reuse this information
5522
5523         * expression.cs (LocalVariableReference::Emit): Implement.
5524         (OpcodeCast::Emit): fix.
5525
5526         (ParameterReference::Resolve): Implement.
5527         (ParameterReference::Emit): Implement.
5528
5529         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
5530         that are expressions need to stay as Expressions.
5531
5532         * typemanager.cs (CSharpName): Returns the C# name of a type if
5533         possible. 
5534
5535         * expression.cs (Expression::ConvertImplicit): New function that
5536         implements implicit type conversions.
5537
5538         (Expression::ImplicitReferenceConversion): Implements implicit
5539         reference conversions.
5540
5541         (EmptyCast): New type for transparent casts.
5542
5543         (OpcodeCast): New type for casts of types that are performed with
5544         a sequence of bytecodes.
5545         
5546         (BoxedCast): New type used for casting value types into reference
5547         types.  Emits a box opcode.
5548
5549         (Binary::DoNumericPromotions): Implements numeric promotions of
5550         and computation of the Binary::Type.
5551
5552         (Binary::EmitBranchable): Optimization.
5553
5554         (Binary::Emit): Implement code emission for expressions.
5555         
5556         * typemanager.cs (TypeManager): Added two new core types: sbyte
5557         and byte.
5558
5559 2001-09-12  Ravi Pratap  <ravi@ximian.com>
5560
5561         * class.cs (TypeContainer::FindMembers): Method which does exactly
5562         what Type.FindMembers does, only we don't have to use reflection. No
5563         implementation yet.
5564
5565         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
5566         typecontainer objects as we need to get at them.
5567         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
5568
5569         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
5570         typecontainer object.
5571
5572         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
5573         of just a Report object.
5574
5575 2001-09-11  Ravi Pratap  <ravi@ximian.com>
5576
5577         * class.cs (Event::Define): Go back to using the prefixes "add_" and
5578         "remove_"
5579         (TypeContainer::Populate): Now define the delegates of the type too.
5580         (TypeContainer.Delegates): Property to access the list of delegates defined
5581         in the type.
5582
5583         * delegates.cs (Delegate::Define): Implement partially.
5584
5585         * modifiers.cs (TypeAttr): Handle more flags.
5586
5587 2001-09-11  Ravi Pratap  <ravi@ximian.com>
5588
5589         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
5590         and not <=
5591         (Operator::Define): Re-write logic to get types by using the LookupType method
5592         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
5593         (Indexer::Define): Ditto.
5594         (Event::Define): Ditto.
5595         (Property::Define): Ditto.
5596         
5597 2001-09-10  Ravi Pratap  <ravi@ximian.com>
5598
5599         * class.cs (TypeContainer::Populate): Now define operators too. 
5600         (TypeContainer.Operators): New property to access the list of operators
5601         in a type.
5602         (Operator.OperatorMethodBuilder): New member to hold the method builder
5603         for the operator we are defining.
5604         (Operator::Define): Implement.
5605
5606 2001-09-10  Ravi Pratap  <ravi@ximian.com>
5607
5608         * class.cs (Event::Define): Make the prefixes of the accessor methods
5609         addOn_ and removeOn_ 
5610
5611         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
5612         of the location being passed in too. Ideally, this should go later since all
5613         error reporting should be done through the Report object.
5614
5615         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
5616         (Populate): Iterate thru the indexers we have and define them too.
5617         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
5618         for the get and set accessors.
5619         (Indexer::Define): Implement.
5620         
5621 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
5622
5623         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
5624         my previous implementation, did not work.
5625
5626         * typemanager.cs: Add a couple of missing types (the longs).
5627
5628         * literal.cs: Use TypeManager.bool_type instead of getting it.
5629
5630         * expression.cs (EventExpr): New kind of expressions.
5631         (Expressio::ExprClassFromMemberInfo): finish
5632
5633 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
5634
5635         * assign.cs: Emit stores to static fields differently.
5636
5637 2001-09-08  Ravi Pratap  <ravi@ximian.com>
5638
5639         * Merge in changes and adjust code to tackle conflicts. Backed out my
5640         code in Assign::Resolve ;-) 
5641
5642 2001-09-08  Ravi Pratap  <ravi@ximian.com>
5643
5644         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
5645         instead Report.Error and also pass in the location.
5646         (CSharpParser::Lexer): New readonly property to return the reference
5647         to the Tokenizer object.
5648         (declare_local_variables): Use Report.Error with location instead of plain 
5649         old error.
5650         (CheckDef): Ditto.
5651
5652         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
5653         (Operator.CheckBinaryOperator): Ditto.
5654
5655         * cs-parser.jay (operator_declarator): Update accordingly.
5656
5657         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
5658         (CheckBinaryOperator): Same here.
5659
5660         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
5661         on the name without any prefixes of namespace names etc. This is because we
5662         already might have something already fully qualified like 
5663         'System.Console.WriteLine'
5664
5665         * assign.cs (Resolve): Begin implementation. Stuck ;-)
5666
5667 2001-09-07  Ravi Pratap  <ravi@ximian.com>
5668
5669         * cs-tokenizer.cs (location): Return a string which also contains
5670         the file name.
5671
5672         * expression.cs (ElementAccess): New class for expressions of the
5673         type 'element access.'
5674         (BaseAccess): New class for expressions of the type 'base access.'
5675         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
5676         respectively.
5677         
5678         * cs-parser.jay (element_access): Implement action.
5679         (base_access): Implement actions.
5680         (checked_expression, unchecked_expression): Implement.
5681
5682         * cs-parser.jay (local_variable_type): Correct and implement.
5683         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
5684
5685         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
5686
5687         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
5688         name and the specifiers.
5689
5690         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
5691         
5692         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
5693         making them all public ;-)
5694
5695         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
5696         class anyways.
5697         
5698 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
5699
5700         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
5701         PropertyExprs.
5702         (FieldExpr, PropertyExprs): New resolved expressions.
5703         (SimpleName::MemberStaticCheck): Perform static checks for access
5704         to non-static fields on static methods. Maybe this should be
5705         generalized for MemberAccesses. 
5706         (SimpleName::ResolveSimpleName): More work on simple name
5707         resolution. 
5708
5709         * cs-parser.jay (primary_expression/qualified_identifier): track
5710         the parameter index.
5711
5712         * codegen.cs (CodeGen::Save): Catch save exception, report error.
5713         (EmitContext::EmitBoolExpression): Chain to expression generation
5714         instead of temporary hack.
5715         (::EmitStatementExpression): Put generic expression code generation.
5716
5717         * assign.cs (Assign::Emit): Implement variable assignments to
5718         local variables, parameters and fields.
5719
5720 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
5721
5722         * statement.cs (Block::GetVariableInfo): New method, returns the
5723         VariableInfo for a variable name in a block.
5724         (Block::GetVariableType): Implement in terms of GetVariableInfo
5725
5726         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
5727         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
5728
5729 2001-09-06  Ravi Pratap  <ravi@ximian.com>
5730
5731         * cs-parser.jay (operator_declaration): Continue on my quest : update
5732         to take attributes argument.
5733         (event_declaration): Ditto.
5734         (enum_declaration): Ditto.
5735         (indexer_declaration): Ditto.
5736         
5737         * class.cs (Operator::Operator): Update constructor accordingly.
5738         (Event::Event): Ditto.
5739
5740         * delegate.cs (Delegate::Delegate): Same here.
5741
5742         * enum.cs (Enum::Enum): Same here.
5743         
5744 2001-09-05  Ravi Pratap  <ravi@ximian.com>
5745
5746         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
5747
5748         * ../tests/cs0658.cs : New file to demonstrate error 0658.
5749
5750         * attribute.cs (Attributes): New class to encapsulate all attributes which were
5751         being passed around as an arraylist.
5752         (Attributes::AddAttribute): Method to add attribute sections.
5753
5754         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
5755         (struct_declaration): Update accordingly.
5756         (constant_declaration): Update.
5757         (field_declaration): Update.
5758         (method_header): Update.
5759         (fixed_parameter): Update.
5760         (parameter_array): Ditto.
5761         (property_declaration): Ditto.
5762         (destructor_declaration): Ditto.
5763         
5764         * class.cs (Struct::Struct): Update constructors accordingly.
5765         (Class::Class): Ditto.
5766         (Field::Field): Ditto.
5767         (Method::Method): Ditto.
5768         (Property::Property): Ditto.
5769         (TypeContainer::OptAttribute): update property's return type.
5770         
5771         * interface.cs (Interface.opt_attributes): New member.
5772         (Interface::Interface): Update to take the extra Attributes argument.
5773
5774         * parameter.cs (Parameter::Parameter): Ditto.
5775
5776         * constant.cs (Constant::Constant): Ditto.
5777
5778         * interface.cs (InterfaceMemberBase): New OptAttributes field.
5779         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
5780         the attributes as a parameter.
5781         (InterfaceProperty): Update constructor call.
5782         (InterfaceEvent): Ditto.
5783         (InterfaceMethod): Ditto.
5784         (InterfaceIndexer): Ditto.
5785
5786         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
5787         pass the attributes too.
5788         (interface_event_declaration): Ditto.
5789         (interface_property_declaration): Ditto.
5790         (interface_method_declaration): Ditto.
5791         (interface_declaration): Ditto.
5792
5793 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
5794
5795         * class.cs (Method::Define): Track the "static Main" definition to
5796         create an entry point. 
5797
5798         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
5799         EntryPoint if we find it. 
5800
5801         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
5802         (EmitContext::ig): Make this variable public.
5803
5804         * driver.cs: Make the default output file be the first file name
5805         with the .exe extension.  
5806
5807         Detect empty compilations
5808
5809         Handle various kinds of output targets.  Handle --target and
5810         rename -t to --dumper.
5811
5812         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
5813         methods inherited from Expression return now an Expression.  This
5814         will is used during the tree rewriting as we resolve them during
5815         semantic analysis.
5816
5817         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
5818         the spec.  Missing entirely is the information about
5819         accessability of elements of it.
5820
5821         (Expression::ExprClassFromMemberInfo): New constructor for
5822         Expressions that creates a fully initialized Expression based on
5823         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
5824         a Type.
5825
5826         (Invocation::Resolve): Begin implementing resolution of invocations.
5827         
5828         * literal.cs (StringLiteral):  Implement Emit.
5829
5830 2001-09-05  Ravi Pratap  <ravi@ximian.com>
5831
5832         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
5833         member.
5834         
5835 2001-09-04  Ravi Pratap  <ravi@ximian.com>
5836
5837         * cs-parser.jay (attribute_arguments): Implement actions.
5838         (attribute): Fix bug in production. Implement action.
5839         (attribute_list): Implement.
5840         (attribute_target): Implement.
5841         (attribute_target_specifier, opt_target_specifier): Implement
5842         (CheckAttributeTarget): New method to check if the attribute target
5843         is valid.
5844         (attribute_section): Implement.
5845         (opt_attributes): Implement.
5846
5847         * attribute.cs : New file to handle attributes.
5848         (Attribute): Class to hold attribute info.
5849
5850         * cs-parser.jay (opt_attribute_target_specifier): Remove production
5851         (attribute_section): Modify production to use 2 different rules to 
5852         achieve the same thing. 1 s/r conflict down !
5853         Clean out commented, useless, non-reducing dimension_separator rules.
5854         
5855         * class.cs (TypeContainer.attributes): New member to hold list
5856         of attributes for a type.
5857         (Struct::Struct): Modify to take one more argument, the attribute list.
5858         (Class::Class): Ditto.
5859         (Field::Field): Ditto.
5860         (Method::Method): Ditto.
5861         (Property::Property): Ditto.
5862         
5863         * cs-parser.jay (struct_declaration): Update constructor call to
5864         pass in the attributes too.
5865         (class_declaration): Ditto.
5866         (constant_declaration): Ditto.
5867         (field_declaration): Ditto.
5868         (method_header): Ditto.
5869         (fixed_parameter): Ditto.
5870         (parameter_array): Ditto.
5871         (property_declaration): Ditto.
5872
5873         * constant.cs (Constant::Constant): Update constructor similarly.
5874         Use System.Collections.
5875
5876         * parameter.cs (Parameter::Parameter): Update as above.
5877
5878 2001-09-02  Ravi Pratap  <ravi@ximian.com>
5879
5880         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
5881         (TypeContainer.delegates): New member to hold list of delegates.
5882
5883         * cs-parser.jay (delegate_declaration): Implement the action correctly 
5884         this time as I seem to be on crack ;-)
5885
5886 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
5887
5888         * rootcontext.cs (RootContext::IsNamespace): new function, used to
5889         tell whether an identifier represents a namespace.
5890
5891         * expression.cs (NamespaceExpr): A namespace expression, used only
5892         temporarly during expression resolution.
5893         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
5894         utility functions to resolve names on expressions.
5895
5896 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
5897
5898         * codegen.cs: Add hook for StatementExpressions. 
5899
5900         * class.cs: Fix inverted test for static flag in methods.
5901
5902 2001-09-02  Ravi Pratap  <ravi@ximian.com>
5903
5904         * class.cs (Operator::CheckUnaryOperator): Correct error number used
5905         to make it coincide with MS' number.
5906         (Operator::CheckBinaryOperator): Ditto.
5907
5908         * ../errors/errors.txt : Remove error numbers added earlier.
5909
5910         * ../errors/cs1019.cs : Test case for error # 1019
5911
5912         * ../errros/cs1020.cs : Test case for error # 1020
5913
5914         * cs-parser.jay : Clean out commented cruft.
5915         (dimension_separators, dimension_separator): Comment out. Ostensibly not
5916         used anywhere - non-reducing rule.
5917         (namespace_declarations): Non-reducing rule - comment out.
5918
5919         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
5920         with TypeContainer::AddEnum.
5921
5922         * delegate.cs : New file for delegate handling classes.
5923         (Delegate): Class for declaring delegates.
5924
5925         * makefile : Update.
5926
5927         * cs-parser.jay (delegate_declaration): Implement.
5928
5929 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
5930
5931         * class.cs (Event::Define): Implement.
5932         (Event.EventBuilder): New member.
5933
5934         * class.cs (TypeContainer::Populate): Update to define all enums and events
5935         we have.
5936         (Events): New property for the events arraylist we hold. Shouldn't we move to using
5937         readonly fields for all these cases ?
5938
5939 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
5940
5941         * class.cs (Property): Revamp to use the convention of making fields readonly.
5942         Accordingly modify code elsewhere.
5943
5944         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
5945         the Define method of the Property class.
5946
5947         * class.cs : Clean up applied patch and update references to variables etc. Fix 
5948         trivial bug.
5949         (TypeContainer::Populate): Update to define all the properties we have. Also
5950         define all enumerations.
5951
5952         * enum.cs (Define): Implement.
5953         
5954 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
5955
5956         * cs-parser.jay (overloadable_operator): The semantic value is an
5957         enum of the Operator class.
5958         (operator_declarator): Implement actions.
5959         (operator_declaration): Implement.
5960
5961         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
5962         validity of definitions.
5963         (Operator::CheckBinaryOperator): Static method to check for binary operators
5964         (TypeContainer::AddOperator): New method to add an operator to a type.
5965
5966         * cs-parser.jay (indexer_declaration): Added line to actually call the
5967         AddIndexer method so it gets added ;-)
5968
5969         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
5970         already taken care of by the MS compiler ?  
5971
5972 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
5973
5974         * class.cs (Operator): New class for operator declarations.
5975         (Operator::OpType): Enum for the various operators.
5976
5977 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
5978
5979         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
5980         ostensibly handle this in semantic analysis.
5981
5982         * cs-parser.jay (general_catch_clause): Comment out
5983         (specific_catch_clauses, specific_catch_clause): Ditto.
5984         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
5985         (catch_args, opt_catch_args): New productions.
5986         (catch_clause): Rewrite to use the new productions above
5987         (catch_clauses): Modify accordingly.
5988         (opt_catch_clauses): New production to use in try_statement
5989         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
5990         and re-write the code in the actions to extract the specific and
5991         general catch clauses by being a little smart ;-)
5992
5993         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
5994         Hooray, try and catch statements parse fine !
5995         
5996 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
5997
5998         * statement.cs (Block::GetVariableType): Fix logic to extract the type
5999         string from the hashtable of variables.
6000
6001         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
6002         I end up making that mistake ;-)
6003         (catch_clauses): Fixed gross error which made Key and Value of the 
6004         DictionaryEntry the same : $1 !!
6005
6006 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
6007
6008         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
6009
6010         * cs-parser.jay (event_declaration): Correct to remove the semicolon
6011         when the add and remove accessors are specified. 
6012
6013 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
6014
6015         * cs-parser.jay (IndexerDeclaration): New helper class to hold
6016         information about indexer_declarator.
6017         (indexer_declarator): Implement actions.
6018         (parsing_indexer): New local boolean used to keep track of whether
6019         we are parsing indexers or properties. This is necessary because 
6020         implicit_parameters come into picture even for the get accessor in the 
6021         case of an indexer.
6022         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
6023
6024         * class.cs (Indexer): New class for indexer declarations.
6025         (TypeContainer::AddIndexer): New method to add an indexer to a type.
6026         (TypeContainer::indexers): New member to hold list of indexers for the
6027         type.
6028
6029 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
6030
6031         * cs-parser.jay (add_accessor_declaration): Implement action.
6032         (remove_accessor_declaration): Implement action.
6033         (event_accessors_declaration): Implement
6034         (variable_declarators): swap statements for first rule - trivial.
6035
6036         * class.cs (Event): New class to hold information about event
6037         declarations.
6038         (TypeContainer::AddEvent): New method to add an event to a type
6039         (TypeContainer::events): New member to hold list of events.
6040
6041         * cs-parser.jay (event_declaration): Implement actions.
6042
6043 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
6044
6045         * cs-parser.jay (dim_separators): Implement. Make it a string
6046         concatenating all the commas together, just as they appear.
6047         (opt_dim_separators): Modify accordingly
6048         (rank_specifiers): Update accordingly. Basically do the same
6049         thing - instead, collect the brackets here.
6050         (opt_rank_sepcifiers): Modify accordingly.
6051         (array_type): Modify to actually return the complete type string
6052         instead of ignoring the rank_specifiers.
6053         (expression_list): Implement to collect the expressions
6054         (variable_initializer): Implement. We make it a list of expressions
6055         essentially so that we can handle the array_initializer case neatly too.
6056         (variable_initializer_list): Implement.
6057         (array_initializer): Make it a list of variable_initializers
6058         (opt_array_initializer): Modify accordingly.
6059
6060         * expression.cs (New::NType): Add enumeration to help us
6061         keep track of whether we have an object/delegate creation
6062         or an array creation.
6063         (New:NewType, New::Rank, New::Indices, New::Initializers): New
6064         members to hold data about array creation.
6065         (New:New): Modify to update NewType
6066         (New:New): New Overloaded contructor for the array creation
6067         case.
6068
6069         * cs-parser.jay (array_creation_expression): Implement to call
6070         the overloaded New constructor.
6071         
6072 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
6073
6074         * class.cs (TypeContainer::Constructors): Return member
6075         constructors instead of returning null.
6076
6077 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
6078
6079         * typemanager.cs (InitCoreTypes): Initialize the various core
6080         types after we have populated the type manager with the user
6081         defined types (this distinction will be important later while
6082         compiling corlib.dll)
6083
6084         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
6085         on Expression Classification.  Now all expressions have a method
6086         `Resolve' and a method `Emit'.
6087
6088         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
6089         generation from working.     Also add some temporary debugging
6090         code. 
6091         
6092 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
6093
6094         * codegen.cs: Lots of code generation pieces.  This is only the
6095         beginning, will continue tomorrow with more touches of polish.  We
6096         handle the fundamentals of if, while, do, for, return.  Others are
6097         trickier and I need to start working on invocations soon.
6098         
6099         * gen-treedump.cs: Bug fix, use s.Increment here instead of
6100         s.InitStatement. 
6101
6102         * codegen.cs (EmitContext): New struct, used during code
6103         emission to keep a context.   Most of the code generation will be
6104         here. 
6105
6106         * cs-parser.jay: Add embedded blocks to the list of statements of
6107         this block.  So code generation proceeds in a top down fashion.
6108
6109 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
6110
6111         * statement.cs: Add support for multiple child blocks.
6112
6113 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
6114
6115         * codegen.cs (EmitCode): New function, will emit the code for a
6116         Block of code given a TypeContainer and its ILGenerator. 
6117
6118         * statement.cs (Block): Standard public readonly optimization.
6119         (Block::Block constructors): Link children. 
6120         (Block::Child): Child Linker.
6121         (Block::EmitVariables): Emits IL variable declarations.
6122
6123         * class.cs: Drop support for MethodGroups here, delay until
6124         Semantic Analysis.
6125         (Method::): Applied the same simplification that I did before, and
6126         move from Properties to public readonly fields.
6127         (Method::ParameterTypes): Returns the parameter types for the
6128         function, and implements a cache that will be useful later when I
6129         do error checking and the semantic analysis on the methods is
6130         performed.
6131         (Constructor::GetCallingConvention): Renamed from CallingConvetion
6132         and made a method, optional argument tells whether this is a class
6133         or a structure to apply the `has-this' bit.
6134         (Method::GetCallingConvention): Implement, returns the calling
6135         convention. 
6136         (Method::Define): Defines the type, a second pass is performed
6137         later to populate the methods.
6138
6139         (Constructor::ParameterTypes): implement a cache similar to the
6140         one on Method::ParameterTypes, useful later when we do semantic
6141         analysis. 
6142
6143         (TypeContainer::EmitMethod):  New method.  Emits methods.
6144
6145         * expression.cs: Removed MethodGroup class from here.
6146         
6147         * parameter.cs (Parameters::GetCallingConvention): new method.
6148
6149 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
6150
6151         * class.cs (TypeContainer::Populate): Drop RootContext from the
6152         argument. 
6153
6154         (Constructor::CallingConvention): Returns the calling convention.
6155         (Constructor::ParameterTypes): Returns the constructor parameter
6156         types. 
6157         
6158         (TypeContainer::AddConstructor): Keep track of default constructor
6159         and the default static constructor.
6160
6161         (Constructor::) Another class that starts using `public readonly'
6162         instead of properties. 
6163
6164         (Constructor::IsDefault): Whether this is a default constructor. 
6165
6166         (Field::) use readonly public fields instead of properties also.
6167
6168         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
6169         track of static constructors;  If none is used, turn on
6170         BeforeFieldInit in the TypeAttributes. 
6171
6172         * cs-parser.jay (opt_argument_list): now the return can be null
6173         for the cases where there are no arguments. 
6174
6175         (constructor_declarator): If there is no implicit `base' or
6176         `this', then invoke the default parent constructor. 
6177         
6178         * modifiers.cs (MethodAttr): New static function maps a set of
6179         modifiers flags into a MethodAttributes enum
6180         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
6181         MethodAttr, TypeAttr to represent the various mappings where the
6182         modifiers are used.
6183         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
6184
6185 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
6186
6187         * parameter.cs (GetParameterInfo): Fix bug where there would be no
6188         method arguments.
6189
6190         * interface.cs (PopulateIndexer): Implemented the code generator
6191         for interface indexers.
6192
6193 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
6194
6195         * interface.cs (InterfaceMemberBase): Now we track the new status
6196         here.  
6197
6198         (PopulateProperty): Implement property population.  Woohoo!  Got
6199         Methods and Properties going today. 
6200
6201         Removed all the properties for interfaces, and replaced them with
6202         `public readonly' fields. 
6203
6204 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
6205
6206         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
6207         initialize their hashtables/arraylists only when they are needed
6208         instead of doing this always.
6209
6210         * parameter.cs: Handle refs and out parameters.
6211
6212         * cs-parser.jay: Use an ArrayList to construct the arguments
6213         instead of the ParameterCollection, and then cast that to a
6214         Parameter[] array.
6215
6216         * parameter.cs: Drop the use of ParameterCollection and use
6217         instead arrays of Parameters.
6218
6219         (GetParameterInfo): Use the Type, not the Name when resolving
6220         types. 
6221
6222 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
6223
6224         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
6225         and instead use public readonly fields.
6226
6227         * class.cs: Put back walking code for type containers.
6228
6229 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
6230
6231         * class.cs (MakeConstant): Code to define constants.
6232
6233         * rootcontext.cs (LookupType): New function.  Used to locate types 
6234
6235         
6236 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
6237
6238         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
6239         this System.Reflection code is.  Kudos to Microsoft
6240         
6241         * typemanager.cs: Implement a type cache and avoid loading all
6242         types at boot time.  Wrap in LookupType the internals.  This made
6243         the compiler so much faster.  Wow.  I rule!
6244         
6245         * driver.cs: Make sure we always load mscorlib first (for
6246         debugging purposes, nothing really important).
6247
6248         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
6249         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
6250
6251         * rootcontext.cs: Lookup types on their namespace;  Lookup types
6252         on namespaces that have been imported using the `using' keyword.
6253
6254         * class.cs (TypeContainer::TypeAttr): Virtualize.
6255         (Class::TypeAttr): Return attributes suitable for this bad boy.
6256         (Struct::TypeAttr): ditto.
6257         Handle nested classes.
6258         (TypeContainer::) Remove all the type visiting code, it is now
6259         replaced with the rootcontext.cs code
6260
6261         * rootcontext.cs (GetClassBases): Added support for structs. 
6262
6263 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
6264
6265         * interface.cs, statement.cs, class.cs, parameter.cs,
6266         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
6267         Drop use of TypeRefs, and use strings instead.
6268
6269 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
6270
6271         * rootcontext.cs: 
6272
6273         * class.cs (Struct::Struct): set the SEALED flags after
6274         checking the modifiers.
6275         (TypeContainer::TypeAttr): new property, returns the
6276         TypeAttributes for a class.  
6277
6278         * cs-parser.jay (type_list): Oops, list production was creating a
6279         new list of base types.
6280
6281         * rootcontext.cs (StdLib): New property.
6282         (GetInterfaceTypeByName): returns an interface by type name, and
6283         encapsulates error handling here.
6284         (GetInterfaces): simplified.
6285         (ResolveTree): Encapsulated all the tree resolution here.
6286         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
6287         types. 
6288         
6289         * driver.cs: Add support for --nostdlib, to avoid loading the
6290         default assemblies.
6291         (Main): Do not put tree resolution here. 
6292
6293         * rootcontext.cs: Beginning of the class resolution.
6294
6295 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
6296
6297         * rootcontext.cs: Provide better error reporting. 
6298
6299         * cs-parser.jay (interface_base): set our $$ to be interfaces.
6300
6301         * rootcontext.cs (CreateInterface): Handle the case where there
6302         are no parent interfaces.
6303         
6304         (CloseTypes): Routine to flush types at the end.
6305         (CreateInterface): Track types.
6306         (GetInterfaces): Returns an array of Types from the list of
6307         defined interfaces.
6308
6309         * typemanager.c (AddUserType): Mechanism to track user types (puts
6310         the type on the global type hash, and allows us to close it at the
6311         end). 
6312         
6313 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
6314
6315         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
6316         RecordInterface instead.
6317
6318         * cs-parser.jay: Updated to reflect changes above.
6319
6320         * decl.cs (Definition): Keep track of the TypeBuilder type that
6321         represents this type here.  Not sure we will use it in the long
6322         run, but wont hurt for now.
6323
6324         * driver.cs: Smaller changes to accomodate the new code.
6325
6326         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
6327         when done. 
6328
6329         * rootcontext.cs (CreateInterface):  New method, used to create
6330         the System.TypeBuilder type for interfaces.
6331         (ResolveInterfaces): new entry point to resolve the interface
6332         hierarchy. 
6333         (CodeGen): Property, used to keep track of the code generator.
6334
6335 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
6336
6337         * cs-parser.jay: Add a second production for delegate_declaration
6338         with `VOID'.
6339
6340         (enum_body): Put an opt_comma here instead of putting it on
6341         enum_body or enum_member_declarations so we can handle trailing
6342         commas on enumeration members.  Gets rid of a shift/reduce.
6343         
6344         (type_list): Need a COMMA in the middle.
6345
6346         (indexer_declaration): Tell tokenizer to recognize get/set
6347
6348         * Remove old targets.
6349
6350         * Re-add the parser target.
6351
6352 2001-07-13  Simon Cozens <simon@simon-cozens.org>
6353
6354         * cs-parser.jay: Add precendence rules for a number of operators
6355         ot reduce the number of shift/reduce conflicts in the grammar.
6356         
6357 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
6358
6359         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
6360         and put it here.
6361
6362         Get rid of old crufty code.
6363
6364         * rootcontext.cs: Use this to keep track of the parsed
6365         representation and the defined types available to the program. 
6366
6367         * gen-treedump.cs: adjust for new convention.
6368
6369         * type.cs: Split out the type manager, and the assembly builder
6370         from here. 
6371
6372         * typemanager.cs: the type manager will live here now.
6373
6374         * cil-codegen.cs: And the code generator here. 
6375
6376 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
6377
6378         * makefile: Fixed up for easy making.
6379
6380 2001-07-13  Simon Cozens <simon@simon-cozens.org>
6381
6382         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
6383         the 
6384
6385         (unary_expression): Expand pre_increment_expression and
6386         post_decrement_expression to reduce a shift/reduce.
6387
6388 2001-07-11  Simon Cozens
6389
6390         * cs-tokenizer.cs: Hex numbers should begin with a 0.
6391
6392         Improve allow_keyword_as_indent name.
6393
6394 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
6395
6396         * Adjustments for Beta2. 
6397
6398 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
6399
6400         * decl.cs: Added `Define' abstract method.
6401         (InTransit): new property, used to catch recursive definitions. 
6402
6403         * interface.cs: Implement `Define'. 
6404
6405         * modifiers.cs: Map Modifiers.constants to
6406         System.Reflection.TypeAttribute flags.
6407
6408         * class.cs: Keep track of types and user-defined types.
6409         (BuilderInit): New method for creating an assembly
6410         (ResolveType): New function to launch the resolution process, only
6411         used by interfaces for now.
6412
6413         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
6414         that are inserted into the name space. 
6415
6416 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
6417
6418         * ARGH.  I have screwed up my tree so many times due to the use of
6419         rsync rather than using CVS.  Going to fix this at once. 
6420
6421         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
6422         load types.
6423
6424 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
6425
6426         * Experiment successful: Use System.Type rather that our own
6427         version of Type.  
6428
6429 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
6430
6431         * cs-parser.jay: Removed nsAliases from here.
6432
6433         Use new namespaces, handle `using XXX;' 
6434
6435         * namespace.cs: Reimplemented namespace handling, use a recursive
6436         definition of the class.  Now we can keep track of using clauses
6437         and catch invalid using clauses.
6438
6439 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
6440
6441         * gen-treedump.cs: Adapted for all the renaming.
6442
6443         * expression.cs (Expression): this class now has a Type property
6444         which returns an expression Type.
6445
6446         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
6447         `Type', as this has a different meaning now in the base
6448
6449 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
6450
6451         * interface.cs, class.cs: Removed from all the sources the
6452         references to signature computation, as we can not do method
6453         signature computation during the parsing time, as we are not
6454         trying to solve at that point distinguishing:
6455
6456         class X {
6457                 void a (Blah x) {}
6458                 void a (NS.Blah x) {}
6459         }
6460
6461         Which depending on the context might be valid or not, as we do not
6462         know if Blah is the same thing as NS.Blah at that point.
6463
6464         * Redid everything so the code uses TypeRefs now instead of
6465         Types.  TypeRefs are just temporary type placeholders, that need
6466         to be resolved.  They initially have a pointer to a string and the
6467         current scope in which they are used.  This is used later by the
6468         compiler to resolve the reference to an actual Type. 
6469
6470         * DeclSpace is no longer a CIR.Type, and neither are
6471         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
6472         are all DeclSpaces, but no Types. 
6473
6474         * type.cs (TypeRefManager): This implements the TypeRef manager,
6475         which keeps track of all the types that need to be resolved after
6476         the parsing has finished. 
6477
6478 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
6479
6480         * ARGH.  We are going to have to store `foreach' as a class rather
6481         than resolving it, as we need to verify error 1579 after name
6482         resolution.   *OR* we could keep a flag that says `This request to
6483         IEnumerator comes from a foreach statement' which we can then use
6484         to generate the error.
6485
6486 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
6487
6488         * class.cs (TypeContainer.AddMethod): we now add methods to the
6489         MethodGroup instead of the method hashtable.  
6490
6491         * expression.cs: Add MethodGroup abstraction, which gets us one
6492         step closer to the specification in the way we handle method
6493         declarations.  
6494
6495         * cs-parser.jay (primary_expression): qualified_identifier now
6496         tried to match up an identifier to a local variable reference or
6497         to a parameter reference.
6498
6499         current_local_parameters is now a parser global variable that
6500         points to the current parameters for the block, used during name
6501         lookup.
6502
6503         (property_declaration): Now creates an implicit `value' argument to
6504         the set accessor.
6505
6506 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
6507
6508         * parameter.cs: Do not use `param' arguments as part of the
6509         signature, per the spec.
6510
6511 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
6512
6513         * decl.cs: Base class for classes, structs and interfaces.  This
6514         is the "Declaration Space" 
6515
6516         * cs-parser.jay: Use CheckDef for checking declaration errors
6517         instead of having one on each function.
6518
6519         * class.cs: Factor out some code for handling error handling in
6520         accordance to the "Declarations" section in the "Basic Concepts"
6521         chapter in the ECMA C# spec.
6522
6523         * interface.cs: Make all interface member classes derive from
6524         InterfaceMemberBase.
6525
6526 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
6527
6528         * Many things: all interfaces are parsed and generated in
6529         gen-treedump.  Support for member variables, constructors,
6530         destructors, properties, constants is there.
6531
6532         Beginning of the IL backend, but very little done, just there for
6533         testing purposes. 
6534
6535 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
6536
6537         * cs-parser.jay: Fix labeled statement.
6538
6539         * cs-tokenizer.cs (escape): Escape " and ' always.
6540         ref_line, ref_name: keep track of the line/filename as instructed
6541         by #line by the compiler.
6542         Parse #line.
6543
6544 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
6545
6546         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
6547         to match the values in System.CodeDOM.
6548
6549         Divid renamed to Divide.
6550
6551         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
6552         statements. 
6553         (Statements.set): remove.
6554
6555         * System.CodeDOM/CodeCatchClause.cs: always have a valid
6556         statements. 
6557
6558         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
6559         falseStatements always have valid values. 
6560
6561         * cs-parser.jay: Use System.CodeDOM now.
6562