1 2002-05-22 Martin Baulig <martin@gnome.org>
3 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
4 Removed, this isn't needed anymore.
6 2002-05-20 Martin Baulig <martin@gnome.org>
8 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
9 be underlying type for an enum.
11 2002-05-20 Miguel de Icaza <miguel@ximian.com>
13 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
14 that splits out the loading of just the core types.
16 * rootcontext.cs (ResolveCore): Split the struct resolution in
17 two, so we can load the enumeration underlying types before any
20 * expression.cs (Is): Bandaid until we fix properly Switch (see
21 bug #24985 for details).
23 * typemanager.cs (ImplementsInterface): The hashtable will contain
24 a null if there are no interfaces implemented.
26 2002-05-18 Miguel de Icaza <miguel@ximian.com>
28 * cs-parser.jay (indexer_declarator): It is fine to have array
31 2002-05-17 Miguel de Icaza <miguel@ximian.com>
33 * typemanager.cs: (RegisterBuilder): New function used to register
34 TypeBuilders that implement interfaces. Since
35 TypeBuilder.GetInterfaces (as usual) does not work with lame
37 (AddUserType): register interfaces.
39 (ImplementsInterface): Use the builder_to_ifaces hash if we are
40 dealing with TypeBuilder. Also, arrays are showing up as
41 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
42 methods can not be invoked on them!
44 * ecore.cs (ExplicitReferenceConversionExists): Made public.
45 (ImplicitReferenceConversionExists): Split out from
46 StandardConversionExists.
48 * expression.cs (As): We were only implementing one of the three
49 cases for the as operator. We now implement them all.
50 (Is): Implement the various other cases for Is as well.
52 * typemanager.cs (CACHE): New define used to control if we want or
53 not the FindMembers cache. Seems to have a negative impact on
56 (MemberLookup): Nested types have full acess to
57 enclosing type members
59 Remove code that coped with instance/static returns for events, we
60 now catch this in RealFindMembers.
62 (RealFindMembers): only perform static lookup if the instance
63 lookup did not return a type or an event.
65 2002-05-17 Miguel de Icaza <miguel@ximian.com>
67 * assign.cs (CompoundAssign): We pass more semantic information
68 now to Compound Assignments than we did before: now we have all
69 the information at hand, and now we resolve the target *before* we
70 do the expression expansion, which allows the "CacheValue" method
71 to have the effect we intended (before, a [x] += 1 would generate
72 two differen ArrayAccess expressions from the ElementAccess,
73 during the resolution process).
75 (CompoundAssign.DoResolve): Resolve target and original_source here.
77 2002-05-16 Miguel de Icaza <miguel@ximian.com>
79 * expression.cs (ArrayAccess): dropped debugging information.
81 * typemanager.cs: Small bug fix: I was always returning i_members,
82 instead of one of i_members or s_members (depending on which had
85 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
86 method is invoked before any code generation takes place, and it
87 is a mechanism to inform that the expression will be invoked more
88 than once, and that the method should use temporary values to
89 avoid having side effects
91 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
93 * ecore.cs (Expression.CacheTemporaries): Provide empty default
96 * expression.cs (Indirection, ArrayAccess): Add support for
97 CacheTemporaries in these two bad boys.
99 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
101 (StoreFromPtr): Handle stobj as well.
103 * expression.cs (UnaryMutator): Share more code.
105 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
106 down: I was not tracking the Filter function as well, which
107 was affecting the results of the cache.
109 2002-05-15 Miguel de Icaza <miguel@ximian.com>
111 * attribute.cs: Remove the hack to handle the CharSet property on
114 2002-05-14 Miguel de Icaza <miguel@ximian.com>
116 * attribute.cs (DoResolve): More uglyness, we now only try to
117 resolve the attribute partially, to extract the CharSet
118 information (only if we are a StructLayout attribute). Otherwise
120 (GetExtraTypeInfo): Add some code to conditionally kill in the
121 future this. I am more and more convinced that the .NET
122 framework has special code to handle the attribute setting on
125 * expression.cs (IsParamsMethodApplicable): Revert my previous
126 foreach change here, it was wrong.
128 2002-05-13 Miguel de Icaza <miguel@ximian.com>
130 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
131 (pp_expr): do not abort on unknown input, just return.
132 (eval): abort if there are pending chars.
134 * attribute.cs (Attribute.Resolve): Positional parameters are
135 optional. Deal with that case.
137 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
138 the Ansi/Unicode/Auto information for the type.
140 (TypeContainer.DefineType): instantiate the EmitContext here, as
141 we will be using it during the type definition (to resolve
142 attributes) and during the emit phase.
144 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
145 to pull type information out of the attributes
147 (Attribute.Resolve): track the constructor builder, and allow for
148 multiple invocations (structs and classes will use this).
150 * ecore.cs (MemberLookupFinal): new version with all the
151 parameters customizable.
153 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
154 constructors. Return if the result value is null (as the error
155 would have been flagged already by MemberLookupFinal)
157 Do not allow instances of abstract classes or interfaces to be
160 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
161 We have to compare the assembly property here when dealing with
162 FamANDAssem and Assembly access modifiers, because we might be
163 creating an assembly from *modules* (that means that we are not
164 getting TypeBuilders for types defined in other modules that are
165 part of this assembly).
167 (Method.Emit): If the method is marked abstract and has a body,
170 (TypeContainer.DefineMembers): If both the defined member and the
171 parent name match are methods, then do not emit any warnings: let
172 the Method.Define routine take care of flagging warnings. But if
173 there is a mismatch (method overrides something else, or method is
174 overriwritten by something, then emit warning).
176 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
177 set to null, this means `do not check for the return type on the
180 (Method.Define): set the return type for the method signature to
181 null, so that we get methods with the same name and parameters and
182 different return types. This is used to flag warning 114 (you are
183 hiding a method, and you probably want to use the new/override
186 * typemanager.cs (MemberLookup): Implemented proper access
187 control, closing a long standing set of bug reports. The problem
188 was that the Framework only has two bits: Public and NonPublic,
189 and NonPublic includes private and protected methods, but we need
190 to enforce the FamANDAssem, FamOrAssem and Family.
192 2002-05-11 Miguel de Icaza <miguel@ximian.com>
194 * statement.cs (GotoCase): Return true: Ammounts to giving up
195 knowledge on whether we return or not, and letting the other case
196 be responsible for it.
198 2002-05-10 Miguel de Icaza <miguel@ximian.com>
200 * driver.cs: Do not load directories for each file processed, only
201 do it if there is a pattern.
203 * ecore.cs: Report readonly assigns here as well, as we might have
204 been resolved only by MemberAccess.
206 (SimpleName.SimpleNameResolve): Also be useful for LValue
207 resolution. We need this to propagate assign to local readonly variables
209 * typemanager.cs: Use a ptrhashtable for the criteria, because we
210 do not want to reuse potential criteria memory.
212 * class.cs (MyEventBuilder): Set reflected_type;
214 * ecore.cs (Constantify): Added support for constifying bools.
216 (RootContext.LookupType): Added a cache for values looked up in
217 the declaration space.
219 * typemanager.cs (FindMembers): Now is a front-end to
220 RealFindMembers, and provides a two-level hashtable-based cache to
223 15% performance improvement: from 22.5 to 19.2 seconds.
225 * expression.cs (IsParamsMethodApplicable): use foreach.
226 (Invocation.DoResolve): ditto.
227 (New.DoResolve): ditto.
228 (ArrayCreation.DoResolve): ditto.
230 * ecore.cs (FindMostEncompassingType): use foreach.
232 * delegate.cs (NewDelegate.DoResolve): Use foreach
234 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
235 (RemoveMethods): use foreach.
237 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
238 nested foreach statements instead of for, and also break out of
239 the inner loop once a match is found.
241 (Invocation.OverloadResolve): Use foreach, simplify the code.
243 2002-05-08 Miguel de Icaza <miguel@ximian.com>
245 * cfold.cs (BinaryFold): During an enumeration evaluation context,
246 we actually unwrap the expression to allow for extra information
249 * expression.cs: Use Shr_Un on unsigned operations.
251 2002-05-08 Ravi Pratap <ravi@ximian.com>
253 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
254 applicable operators was not being considered correctly. This closes
255 the bug Miguel reported.
257 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
259 * attribute.cs: check that the type derives from System.Attribute
260 and report the correct error in that case (moved the duplicate code to
261 its own method, too).
263 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
265 * attribute.cs: lookup attribute type name as the spec says: first the
266 bare attribute name and then name + "Attribute" (nant compiles with
269 2002-05-07 Miguel de Icaza <miguel@ximian.com>
271 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
272 Because of the way we parse things, we should try to see if a
273 UIntConstant can fit in an integer.
275 2002-05-07 Ravi Pratap <ravi@ximian.com>
277 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
278 when we are in an explicit context.
280 (ConvertReferenceExplicit): When converting from Iface type S to Class
281 T make sure the rules are implemented as an OR.
283 * parameter.cs (ParameterType): Make it a property for now although the
284 purpose really isn't anything immediate.
286 * expression.cs (Is*Applicable): Do better checking on the parameter type
287 of a ref/out parameter. The ones from the system assemblies are already
288 marked with the correct type so we don't need to do any correction.
290 * ecore.cs (StandardConversionExists): Conversion from Interface types to
291 the object type is standard too so include that.
293 2002-05-06 Miguel de Icaza <miguel@ximian.com>
295 * ecore.cs (StandardConversionExists): Augment with missing code:
296 deal with IntConstant, LongConstants and Enumerations.
298 * assign.cs: Report the error, instead of failing silently
300 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
301 typecontainer that they are declared, because the
302 typecontainer/namespace will have the list of using clauses that
305 Assembly Attributes were escaping the normal registration
308 (EmitCode): Apply attributes within an EmitContext that represents
309 the container they were declared on.
311 * cs-parser.jay: Track bases for structs. How did I get this wrong?
313 2002-05-06 Ravi Pratap <ravi@ximian.com>
315 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
316 Revamp completely - make much cleaner as we now operate only
319 (FindMostSpecificSource, FindMostSpecificTarget): New methods
320 to implement the logic detailed in the spec more correctly.
322 (UserDefinedConversion): Update accordingly.
324 2002-05-06 Miguel de Icaza <miguel@ximian.com>
326 * statement.cs: Return flow analysis information up.
328 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
331 (token): Do not consume an extra character before calling
334 2002-05-06 Piers Haken <piersh@friskit.com>
336 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
338 2002-05-06 Miguel de Icaza <miguel@ximian.com>
340 * class.cs (Constructor.Emit): Set the IsStatic flag in the
341 EmitContext during the instance constructor initializer
342 resolution, to stop access to instance variables.
344 This is mandated by the spec, last paragraph of the `constructor
345 initializers' section.
347 2002-05-05 Miguel de Icaza <miguel@ximian.com>
349 * cs-parser.jay, class.cs (Accessor): new class used to represent
350 an accessor (get or set). In the past we used `null' to represent
351 a missing accessor. But this is ambiguous because there was no
352 way to tell in abstract indexers/properties if one of them was
355 Now there is a way of addressing that.
357 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
358 instead of FindMembers.
360 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
361 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
363 * attribute.cs: Treat indexers and properties as the same in terms
364 of applying attributes
366 * ecore.cs (FindMostEncompassedType): Use statically initialized
367 EmptyExpressions()s like we do elsewhere to avoid creating useless
368 objects (and we take this out of the tight loop).
370 (GetConversionOperators): Move the code to extract the actual
371 operators to a separate routine to clean things up.
373 2002-05-04 Miguel de Icaza <miguel@ximian.com>
375 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
376 events are always registered FieldBuilders.
378 * class.cs (FieldBase): New class shared by Fields
380 * delegate.cs: If we are a toplevel delegate, use our full name.
381 If we are a nested delegate, then only use our tail name.
383 2002-05-02 Ravi Pratap <ravi@ximian.com>
385 * expression.cs (IsApplicable): Ensure that we add the "&" to
386 ref/out types before comparing it with the type of the argument.
388 (IsParamsMethodApplicable): Ditto.
390 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
393 * delegate.cs : Handle the case when we have more than one applicable
394 method. Flag an error only when we finish checking all.
396 2002-05-02 Miguel de Icaza <miguel@ximian.com>
398 * expression.cs: Add support for boolean static initializers.
400 2002-05-01 Miguel de Icaza <miguel@ximian.com>
402 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
404 * parameter.cs (ComputeParameterTypes,
405 ComputeAndDefineParameterTypes): Better error handling: now we
406 clear the `types' cache if we fail during any of the type lookups.
407 We also return the status code correctly to our caller
409 * delegate.cs: If we fail to define a delegate, abort the extra
412 * expression.cs (Binary.ResolveOperator): for
413 operator==(object,object) and operator !=(object, object) we also
414 have to verify that there is an implicit conversion from one to
417 (ArrayAccess.DoResolve): Array Access can operate on
420 2002-04-30 Miguel de Icaza <miguel@ximian.com>
422 * assign.cs (CompoundAssign): A new class used as a "flag" that
423 the assignment actually is happening as part of a compound
426 During compound assignment, a few new rules exist to enable things
433 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
434 to the type of x) if y is implicitly convertible to the type of x,
435 and the operator is a builtin operator and the return type of the
436 operator is explicitly convertible to the type of x.
438 * rootcontext.cs: Reset warning level to 2. 4 catches various
439 "interesting" features in mcs, we must clean this up at some
440 point, but currently am trying to kill other bugs ;-)
442 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
443 in container classes as well.
445 * expression.cs (Binary.ResolveOperator): Handle string case
446 before anything else (as operator overloading does emit an error
447 before doing anything else).
449 This code could go away when we move to a table driven model, but
450 i could not come up with a good plan last night.
452 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
454 * typemanager.cs (CSharpName): reimplementation using regex.
455 * class.cs: added null check for fields in Emit
456 * rootcontext.cs: set warninglevel to 4
458 2002-04-29 Miguel de Icaza <miguel@ximian.com>
460 * typemanager.cs (CSharpName): reimplemented with Lupus
463 2002-04-28 Miguel de Icaza <miguel@ximian.com>
465 * statement.cs (If): correclty implement Resolve, because we were
466 not catching sem errors in there. The same process is needed
468 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
471 (Statement.Warning_DeadCodeFound): Factorize code.
472 (While): Report dead code here too.
474 (Statement): Added Resolve virtual method to allow
475 for resolution split from the emit code.
477 2002-04-26 Miguel de Icaza <miguel@ximian.com>
479 * statement.cs (EmitBoolExpression): No longer try to resolve the
481 (MakeBoolean): New utility function that resolve, implicitly
482 converts to boolean and tags the expression.
485 (If, Do): Implement dead code elimination.
486 (While): Implement loop inversion
488 (Do, While, For, If): Resolve the expression prior to calling our
491 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
494 - added method Report28 (warning: program has more than one entry point)
495 - added method IsEntryPoint, implements paragraph 10.1 of the spec
496 - modified method Method.Define, the part at the end of the method
498 * rootcontext.cs: added static public Location EntryPointLocation;
500 * ../errors/cs0028.cs : Add test case for the above warning.
503 - modified method CSharpName to allow arrays of primitive type to
504 be printed nicely (e.g. instead of System.Int32[][] it now prints
506 - added method CSharpSignature: returns the signature of a method
507 in string format to be used in reporting errors, warnings, etc.
509 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
512 2002-04-26 Ravi Pratap <ravi@ximian.com>
514 * delegate.cs (Define): Fix extremely silly bug where I was
515 setting the type of the 'object' parameter of the BeginInvoke
516 method to System.IAsyncResult instead of System.Object ;-)
518 2002-04-26 Miguel de Icaza <miguel@ximian.com>
520 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
523 (Constructor.Emit): return if we fail to initialize the
524 constructor. Another door closed!
526 * expression.cs (New.DoResolve): Improve error message (from -6 to
527 1501). Use DeclaredOnly lookup to find the exact constructor.
529 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
530 loop. This is useful.
532 * cs-parser.jay: Adjust the default parameters so that destructors
533 have the proper signature.
535 2002-04-26 Martin Baulig <martin@gnome.org>
537 * driver.cs (LoadAssembly): If `assembly' contains any characters
538 which are only valid in path names and not in assembly names
539 (currently slash, backslash and point), use Assembly.LoadFrom ()
540 instead of Assembly.Load () on the `assembly' (before iteration
541 over the link_paths).
543 2002-04-26 Martin Baulig <martin@gnome.org>
545 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
547 2002-04-25 Miguel de Icaza <miguel@ximian.com>
549 * class.cs (Property): use the new typemanager.MemberLookup
551 (TypeContainer.MemberLookup): Implement using the
552 TypeManager.MemberLookup now.
554 * typemanager.cs: Make MemberLookup a function of the TypeManager,
555 and return MemberInfos, so that these can be used without an
556 EmitContext (what we had before).
558 2002-04-24 Miguel de Icaza <miguel@ximian.com>
560 * expression.cs: Fix the case where the argument to params if the
561 type of the params. I omitted handling this before. Fixed
563 2002-04-22 Miguel de Icaza <miguel@ximian.com>
565 * driver.cs: Call BootCorlib_PopulateCoreType
567 * class.cs (Property.CheckBase): Check for properties only, not
570 * interface.cs: Temporary hack: try/catch around the
571 CustomAttributeBuilder, because I am getting an exception that I
574 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
575 types whose definitions are required to be there (attributes are
576 defined before standard types).
578 Compute definitions as we boot the various types, as they are used
579 immediately (value_type class will need object_type, but if we do
580 not initialize object_type, we will pass a null, which will let
581 the runtime pick the System.Object from the existing corlib, which
582 is not what we want).
584 2002-04-22 Patrik Torstensson <totte@labs2.com>
586 * cs-tokenizer.cs: fixed a number of trim() issues.
588 2002-04-22 Ravi Pratap <ravi@ximian.com>
590 * expression.cs (Argument.Type): Ensure that we return the correct
591 type when we have out or ref parameters [in which case we
594 2002-04-22 Miguel de Icaza <miguel@ximian.com>
596 * class.cs (Property, Indexer): Allow extern modifier in there.
598 * typemanager.cs (InitBaseTypes): Initializes object_type and
599 value_type, since those will be used early on during the bootstrap
600 process to compile corlib.
602 (InitCoreTypes): Move code from here to InitBaseTypes.
604 2002-04-21 Miguel de Icaza <miguel@ximian.com>
606 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
607 single-dimension arrays as using the ldlen opcode.
609 Daniel Lewis discovered this optimization.
611 * typemanager.cs: Add signature for System.Array::get_Length
613 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
615 * statement.cs: report the error when the foreach does not apply to an
616 array nor a collection.
618 2002-04-19 Miguel de Icaza <miguel@ximian.com>
620 * expression.cs: Add implicit conversions to the operator ~.
622 * constant.cs (DecimalConstant.Emit): Emit decimal value.
624 * typemanager.cs: Locate the decimal constructor.
626 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
628 * attribute.cs: use the new property of TypeOf.
629 * expression.cs: added 'get' property around typearg.
631 These changes fix a build breaker reported by NickD. Is this the
632 correct way to fix? If not, please, revert my changes and make it
635 2002-04-17 Miguel de Icaza <miguel@ximian.com>
637 * attribute.cs: Add support for typeof in attribute invocations.
638 I am not sure that this is right though.
640 2002-04-14 Duncan Mak <duncan@ximian.com>
642 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
643 Binary.Operator.Division case.
645 2002-04-13 Ravi Pratap <ravi@ximian.com>
647 * class.cs (DefineType): Ensure that we do a proper check on
648 attribute types and also register it with the TypeManager.
650 (TypeContainer.Targets): The default for attribute types is
651 AttributeTargets.All.
653 * attribute.cs (ApplyAttributes): Registering the attribute type
654 is done elsewhere, not when we discover we have a Usage attribute.
656 2002-04-12 Ravi Pratap <ravi@ximian.com>
658 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
659 and get rid of is_delegate parameter.
661 * everywhere : update.
663 2002-04-12 Ravi Pratap <ravi@ximian.com>
665 * cs-parser.jay (compilation_unit): Revamp completely to use
666 some new ideas that I got from Rhys' grammar to solve the problems
667 with assembly level attributes.
669 (outer_declaration): New grammar production.
671 (attribute_sections): Add.
673 (opt_attributes): Base on attribute_sections
675 (namespace_declaration): Allow opt_attributes to tackle the case
676 when we have assembly level attributes - we are clever in this
679 * attribute.cs (ApplyAttributes): Do not worry about assembly
680 attributes in the non-global context.
682 * rootcontext.cs (AddGlobalAttributes): Go back to using this
683 instead of SetGlobalAttributes.
685 * class.cs, rootcontext.cs : Ensure we define and generate
686 attribute types before anything else.
688 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
689 and flag the new error -20 for the case when the attribute type
690 does not have valid targets specified. csc does not catch this.
692 * ../errors/errors.txt : update for error # -20
694 2002-04-11 Ravi Pratap <ravi@ximian.com>
696 * support.cs (InternalParameters.ParameterModifier): Do some null
697 checking and return sane values.
699 * class.cs (Method.Define): If we are a PInvoke method, ensure
700 that we are static and extern. Report error # 601
702 * ../errors/cs0601.cs : Add test case for the above error.
704 2002-04-07 Ravi Pratap <ravi@ximian.com>
706 * rootcontext.cs (attribute_types): We need to keep type of
707 all attribute types separately and emit code for them first.
709 (RegisterAttribute) : Implement.
711 * class.cs (DefineType): Check if the current Type is a custom
712 attribute type and register it accordingly.
714 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
715 adding the first attribute twice and rename to
717 (SetGlobalAttributes): this.
719 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
722 * attribute.cs (ApplyAttributes): Take an additional argument telling us
723 if we are processing global arguments. Hmm, I am unsure of this.
725 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
727 * expression.cs: added static array of strings to avoid calling
728 Enum.ToString () for Operator in Binary. Significant recover of
731 2002-04-10 Miguel de Icaza <miguel@ximian.com>
733 * class.cs (FindMembers): Allow the Builders of the various
734 members to be null. If they are skip them. This only happens
735 during the PInvoke declaration.
737 2002-04-09 Miguel de Icaza <miguel@ximian.com>
739 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
740 failure, so we do not keep going afterwards.
742 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
743 wanted to pass `false' as the `is_delegate' argument. If this is
744 the case, why not use delegate_type == null to mean `is_delegate =
745 false' and anything else as is_delegate = true.
747 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
749 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
750 code for the section, not the beginning of the tests.
752 2002-04-08 Miguel de Icaza <miguel@ximian.com>
754 * cfold.cs: Handle operator + (Enum x, Underlying x)
756 * expression.cs (Binary): same. Warn about errors where we have
757 Enum/Enum in operator + as well.
759 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
762 - added support for switch(bool)
763 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
764 - add TableSwitchEmit() to handle table-based switch statements
766 2002-04-05 Ravi Pratap <ravi@ximian.com>
768 * expression.cs (Invocation.OverloadResolve): Factor out code which
769 does parameter compatibility checking with arguments so that we can
770 re-use the code even from Delegate.VerifyApplicability
772 (VerifyArgumentsCompat): Move above code here.
774 * delegate.cs (VerifyApplicability): Get rid of duplicate code
775 and instead make a call to the above method.
777 2002-03-31 Ravi Pratap <ravi@ximian.com>
779 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
780 We use it to keep track of classes which are attribute types.
782 2002-04-02 Miguel de Icaza <miguel@ximian.com>
784 * delegate.cs (Delegate.Define): Correctly define the types in the
785 presence of fixed and array parameters.
787 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
790 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
791 include NonPublic after the first iteration.
793 * class.cs (Indexer.CheckBase): Only check if both parents are
796 * cs-parser.jay (accessor_body): If empty, set to null.
798 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
799 same code path here to resolve constants names that we did have in
800 MemberAccess.DoResolve. There is too much code duplicated here.
802 2002-04-01 Miguel de Icaza <miguel@ximian.com>
804 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
806 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
809 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
810 tokens, numbers and strings.
812 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
815 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
816 asyncronous parameters and the regular parameters.
818 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
819 specify the target directory.
821 * expression.cs: (This.DoResolve): Simplify
822 (As.Emit): Optimize, do not generate IsInst if the expression is
823 always of the given type.
825 (Is.DoResolve): Bug fix, we were reporting both always/never for
828 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
829 creating too many unnecessary arrays.
831 2002-03-31 Miguel de Icaza <miguel@ximian.com>
833 * class.cs (EmitFieldInitializer): Use Assign expression to assign
834 fields instead of rolling our own initializer. Takes care of all
835 implicit conversions, and drops unnecessary static checks/argument.
837 2002-03-31 Dick Porter <dick@ximian.com>
839 * driver.cs: use the GetDirectories() return values properly, and
840 use "/" as path separator.
842 2002-03-30 Miguel de Icaza <miguel@ximian.com>
844 * expression.cs (Unary): Optimize - - expr into expr.
845 (Binary): Optimize a + (-b) into a -b.
847 * codegen.cs (CodeGen): Made all methods static.
849 2002-03-29 Miguel de Icaza <miguel@ximian.com>
853 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
854 TypeBuilder property.
856 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
859 * tree.cs: Removed the various RecordXXXX, and replaced with a
860 single RecordDecl. Removed all the accessor methods, and just
861 left a single access point Type
863 * enum.cs: Rename DefineEnum to DefineType.
865 * decl.cs: New abstract method `DefineType' used to unify the
866 Defines for Enumerations, Interfaces, TypeContainers and
869 (FindType): Moved LookupInterfaceOrClass here. Moved the
870 LookupBaseClasses method that used to live in class.cs and
871 interface.cs here, and renamed to FindType.
873 * delegate.cs: Implement DefineType. Take advantage of the
874 refactored pattern for locating the parent builder without taking
875 the parent_builder argument (which we know does not work if we are
876 nested, and triggering a toplevel definition).
878 2002-03-28 Miguel de Icaza <miguel@ximian.com>
880 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
881 accessibility of a member has changed during override and report
884 * class.cs (Method.Define, Property.Define): Only complain on
885 overrides if the method is private, any other accessibility is
886 fine (and since we just checked the permission is the same, we are
889 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
890 and elif are processed always. The other pre-processing
891 directives are only processed if we are "taking" the path
893 2002-03-29 Martin Baulig <martin@gnome.org>
895 * class.cs (Method.Emit): Only emit symbolic debugging info if the
896 current location is not Null.
898 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
899 a separate method so we can profile it.
901 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
902 `span.Seconds' are just seconds, but no minutes or hours.
903 (MainDriver): Profile the CodeGen.SaveSymbols calls.
905 2002-03-28 Miguel de Icaza <miguel@ximian.com>
907 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
908 Remove the gratuitous set of Final:
910 // If an interface implementation, then we can set Final.
911 if (((flags & MethodAttributes.Abstract) == 0) &&
912 implementing.DeclaringType.IsInterface)
913 flags |= MethodAttributes.Final;
915 I do not know what I was smoking when I used that.
918 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
919 step into fixing the name resolution issues for delegates and
920 unifying the toplevel name resolution.
922 2002-03-28 Martin Baulig <martin@gnome.org>
924 * class.cs (Method.Emit): If we have a symbol writer, call its
925 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
926 tell it about the current method.
928 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
929 writer that we're going to emit the first byte of IL code for a new
930 statement (a new source line).
931 (EmitContext.EmitTopBlock): If we have a symbol writer, call
932 EmitContext.Mark() before emitting any code.
934 * location.cs (SymbolDocument): Return null when we're Null.
936 * statement.cs (Statement): Moved the `Location loc' variable here.
937 (Statement.EmitBoolExpression): If we have a symbol writer, call
938 ec.Mark() before emitting any code to tell it that we're at the
939 beginning of a new statement.
940 (StatementExpression): Added `Location' argument to the constructor.
941 (Block): Added public readonly variable `StartLocation' and public
942 variable `EndLocation'. The latter is to be set using SetEndLocation().
943 (Block): Added constructor which takes a start and end location.
944 (Block.SetEndLocation): New method. This sets the end location.
945 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
946 local variables we create.
947 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
948 each statement and do also mark the begin and end of the block.
950 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
951 tell it the current lexer.Location, use Location.Null for the end of the
953 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
954 current block, set its end location using SetEndLocation().
955 (statement_expression): StatementExpression constructor now takes the
956 lexer.Location as additional argument.
957 (for_statement, declare_local_variables): Likewise.
958 (declare_local_variables): When creating a new implicit block, use the
959 new Block constructor and pass it the lexer.Location.
961 2002-03-28 Miguel de Icaza <miguel@ximian.com>
963 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
964 members also on the parent interfaces recursively.
966 2002-03-27 Miguel de Icaza <miguel@ximian.com>
968 * report.cs: Use new formats, since Gonzalo finished the missing
971 * expression.cs (Binary.ResolveOperator): added missing operator|
972 operator& and operator^ for bool/bool.
974 * cs-parser.jay: CheckDef now takes a Location argument that is
975 used to report errors more precisly (instead of reporting the end
976 of a definition, we try to track something which is a lot closer
977 to the source of the problem).
979 * cs-tokenizer.cs: Track global token use, so we can properly flag
980 the use of #define/#undef after the first token has been seen.
982 Also, rename the reportXXXX to Error_DescriptiveName
984 * decl.cs (DeclSpace.IsTopLevel): Move property here from
985 TypeContainer, so that Enum and Interface can use this too.
987 * class.cs (TypeContainer.LookupInterfaceOrClass,
988 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
989 `builder' argument. Typically this was used to pass the parent
990 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
993 The problem is that a nested class could trigger the definition of
994 a toplevel class, and the builder would be obviously wrong in that
997 So we drop this argument, and we compute dynamically the
998 TypeBuilder/ModuleBuilder (the correct information was available
999 to us anyways from DeclSpace.Parent)
1001 * interface.cs (Interface.DefineInterface): Drop builder
1002 parameter cleanup like class.cs
1004 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
1007 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
1010 (Try.Emit): Propagate the returns value from the statement.
1012 (Return.Emit): Even if we are leavning
1014 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
1016 * modifiers.cs: Fix the computation of MethodAttributes flags.
1018 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
1020 * driver.cs: allow compilation of files that start with '/'.
1021 Add a default case when checking the argument of --target.
1023 2002-03-25 Miguel de Icaza <miguel@ximian.com>
1025 * interface.cs: Implement the same search algorithm for types in
1028 * delegate.cs: Do not allow multiple definition.
1030 * Recovered ChangeLog that got accidentally amputated
1032 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
1034 * rootcontext.cs: Load manually enum to allow core classes to
1035 contain enumerations.
1037 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
1038 Update to new static methods in TypeManager.
1040 * typemanager.cs (GetMethod, GetConstructor): Use our
1041 implementation of FindMembers to find the members, since during
1042 corlib compilation, the types are TypeBuilders and GetMethod and
1043 GetConstructor do not work.
1045 Make all methods in TypeManager static.
1047 (InitCodeHelpers): Split the functionality from
1048 the InitCodeTypes function.
1050 * driver.cs: Call InitCodeHelpers after we have populated the
1053 * cs-parser.jay (delegate_declaration): we did not used to compute
1054 the delegate name correctly for void delegates.
1056 2002-03-24 Miguel de Icaza <miguel@ximian.com>
1058 * rootcontext.cs (RootContext): Init the interface_resolve_order
1059 and type_container_resolve_order always.
1061 (ResolveCore, BootstrapCorlib_ResolveClass,
1062 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
1063 compiler when compiling with --nostdlib
1065 * class.cs (TypeContainer.DefineType): Check that our parent is
1066 not null. This test is most important when we are bootstraping
1069 * codegen.cs: Split out the symbol writing code.
1071 2002-03-25 Martin Baulig <martin@gnome.org>
1073 * driver.cs (-g): Made -g an alias for --debug.
1075 2002-03-24 Martin Baulig <martin@gnome.org>
1077 * codegen.cs (SymbolWriter): New public variable. Returns the
1078 current symbol writer.
1079 (CodeGen): Added `bool want_debugging_support' argument to the
1080 constructor. If true, tell the ModuleBuild that we want debugging
1081 support and ask it for the ISymbolWriter.
1082 (Save): If we have a symbol writer, call it's Close() method after
1083 saving the assembly.
1085 * driver.c (--debug): New command line argument to create a
1086 debugger information file.
1088 * location.cs (SymbolDocument): New public property. Returns an
1089 ISymbolDocumentWriter object for the current source file or null
1090 if we don't have a symbol writer.
1092 2002-03-21 Miguel de Icaza <miguel@ximian.com>
1094 * driver.cs (LoadAssembly): Correctly return when all the paths
1095 have been tried and not before.
1097 * statement.cs (Switch.Emit): return the actual coverage for this
1098 statement (returns/not-returns)
1100 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
1101 switch of the statement if we are the last switch section. That
1102 kills two problems: try/catch problems (we used to emit an empty
1103 nop at the end) and switch statements where all branches would
1106 2002-03-19 Miguel de Icaza <miguel@ximian.com>
1108 * driver.cs: Add default assemblies (the equivalent to the
1109 Microsoft CSC.RSP file)
1111 * cs-tokenizer.cs: When updating `cols and setting it to zero,
1112 also update tokens_seen and set it to false.
1114 * driver.cs: Implement --recurse for Mike.
1116 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
1117 correctly splitting out the paths.
1119 2002-03-18 Miguel de Icaza <miguel@ximian.com>
1121 * interface.cs (Interface.PopulateProperty): Instead of using
1122 `parent' as the declaration space for the set parameters, use
1125 * support.cs (InternalParameters): InternalParameters constructor
1126 takes a DeclSpace instead of a TypeContainer.
1128 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
1129 types are being initialized, load the address of it before calling
1132 (New): Provide a mechanism to disable the generation of local
1133 value type temporaries when the caller will be providing us with
1134 an address to store it.
1136 (ArrayCreation.EmitDynamicInitializers): Use it.
1138 2002-03-17 Miguel de Icaza <miguel@ximian.com>
1140 * expression.cs (Invocation.EmitArguments): Only probe for array
1141 property if there is more than one argument. Sorry about that.
1143 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
1146 * class.cs (Method.LabelParameters): Fix incorrect code path that
1147 prevented the `ParamArrayAttribute' from being applied to the
1150 2002-03-16 Miguel de Icaza <miguel@ximian.com>
1152 * support.cs (ReflectionParameters): Correctly compute whether the
1153 last argument is a params array. Fixes the problem with
1156 * typemanager.cs: Make the assemblies array always be non-null
1157 (empty, but non-null)
1159 * tree.cs (RecordDecl): New function that abstracts the recording
1160 of names. This reports error 101, and provides a pointer to the
1161 previous declaration. Fixes a crash in the compiler.
1163 * cs-parser.jay (constructor_declaration): Update to new grammar,
1164 and provide a constructor_body that can be empty.
1166 2002-03-15 Miguel de Icaza <miguel@ximian.com>
1168 * driver.cs: Add support for --resources.
1170 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
1171 Make all types for the various array helper methods be integer.
1173 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
1174 CheckState to ConvCast.
1176 (ConvCast): Now it takes a `checked' state argument, to avoid
1177 depending on the emit context for the conversion, and just using
1178 the resolve time setting.
1180 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
1181 instead of Invocation.EmitArguments. We do not emit the original
1182 arguments, instead we emit those which have been converted to
1183 unsigned int expressions.
1185 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
1187 * codegen.cs: ditto.
1189 * expression.cs (LocalVariableReference): Drop the use of the
1190 Store function that depended on the variable index.
1192 * statement.cs (VariableInfo): Drop the `Idx' property from this
1193 class, as this is not taking into account the indexes for
1194 temporaries tat we generate during the execution, getting the
1197 * class.cs: First emit class initializers, then call the parent
1200 * expression.cs (Binary): Fix opcode emision.
1201 (UnaryMutator.EmitCode): Support checked code generation
1203 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
1204 matches for events for both the Static and Instance scans,
1205 pointing to the same element. Fix that.
1207 2002-03-14 Miguel de Icaza <miguel@ximian.com>
1209 * rootcontext.cs (ResolveTree): Always set the
1210 interface_resolve_order, because nested interfaces will be calling
1213 * class.cs (GetInterfaceOrClass): Track the same resolution
1214 process used by TypeManager.LookupType. This fixes the nested
1215 type lookups in class declarations (separate path from
1218 (TypeContainer.DefineType): Also define nested interfaces.
1219 (TypeContainer.RegisterOrder): New public function used to
1220 register the order in which child interfaces need to be closed.
1222 Nested interfaces need to be closed after their parents have been
1225 * interface.cs (InterfaceAttr): Put all the logic for computing
1226 the interface attribute here.
1228 (DefineInterface): Register our interface order with the
1229 RootContext or with the TypeContainer depending on the case.
1231 2002-03-12 Miguel de Icaza <miguel@ximian.com>
1233 * cs-parser.jay: rework foreach statement to work with the new
1234 changes to the policy on SimpleNames.
1236 * report.cs: support Stacktrace on warnings as well.
1238 * makefile: drop --unsafe and /unsafe from the compile.
1240 2002-03-13 Ravi Pratap <ravi@ximian.com>
1242 * ecore.cs (StandardConversionExists): Modify to take an Expression
1243 as the first parameter. Ensure we do null -> reference type conversion
1246 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
1247 temporary Expression objects.
1249 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
1251 * interface.cs: workaround bug in method overloading resolution
1252 (there is already a bugzilla bug for it).
1254 2002-03-12 Miguel de Icaza <miguel@ximian.com>
1256 We could also solve this problem by having a separate path for
1257 performing type lookups, instead of DoResolve, we could have a
1258 ResolveType entry point, and only participating pieces of the
1259 production (simplename, deref, array) would implement this.
1261 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
1262 signal SimpleName to only resolve type names and not attempt to
1263 resolve anything else.
1265 * expression.cs (Cast): Set the flag.
1267 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
1269 * class.cs: Only report 108 if there is no `new' modifier.
1271 * cs-parser.jay: rework foreach statement to work with the new
1272 changes to the policy on SimpleNames.
1274 * report.cs: support Stacktrace on warnings as well.
1276 * makefile: drop --unsafe and /unsafe from the compile.
1278 2002-03-11 Miguel de Icaza <miguel@ximian.com>
1280 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1281 lookups here, instead of doing that at parse time. This means
1282 that our grammar will not introduce `LocalVariableReferences' as
1283 expressions at this point. That solves the problem of code like
1291 This is only half the fix. The full fix requires parameters to
1292 also be handled in this way.
1294 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
1295 makes the use more obvious of the DeclSpace. The
1296 ec.TypeContainer.TypeBuilder is now only used to pull the
1299 My theory is that I can get rid of the TypeBuilder completely from
1300 the EmitContext, and have typecasts where it is used (from
1301 DeclSpace to where it matters).
1303 The only pending problem is that the code that implements Aliases
1304 is on TypeContainer, and probably should go in DeclSpace.
1306 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1307 lookups here, instead of doing that at parse time. This means
1308 that our grammar will not introduce `LocalVariableReferences' as
1309 expressions at this point. That solves the problem of code like
1317 This is only half the fix. The full fix requires parameters to
1318 also be handled in this way.
1320 * class.cs (Property.DefineMethod): When implementing an interface
1321 method, set newslot, when implementing an abstract method, do not
1322 set the flag (before we tried never setting it, or always setting
1323 it, which is the difference).
1324 (Indexer.DefineMethod): same.
1325 (Method.DefineMethod): same.
1327 * ecore.cs: Only set the status used flag if we get back a Field.
1329 * attribute.cs: Temporary hack, so Paolo can keep working.
1331 2002-03-08 Ravi Pratap <ravi@ximian.com>
1333 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
1334 the unmanaged type in the case we have a MarshalAs attribute.
1336 (Resolve): Handle the case when we are parsing the special MarshalAs
1337 attribute [we need to store the unmanaged type to use later]
1339 * typemanager.cs (marshal_as_attr_type): Built in type for the
1340 MarshalAs Attribute.
1342 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
1343 on parameters and accordingly set the marshalling info.
1345 2002-03-09 Miguel de Icaza <miguel@ximian.com>
1347 * class.cs: Optimizing slightly by removing redundant code after
1348 we switched to the `NoTypes' return value.
1349 (Property.DefineMethod): use NoTypes here too.
1351 This fixes the bug I introduced in my last batch of changes.
1353 2002-03-05 Ravi Pratap <ravi@ximian.com>
1355 * tree.cs (RecordEnum): Add. We now keep track of enums too.
1357 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
1358 Enums since those are types too.
1360 * cs-parser.jay (enum_declaration): Record enums as we parse them.
1362 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
1363 thanks to a call during the lookup process.
1365 2002-03-07 Miguel de Icaza <miguel@ximian.com>
1367 * statement.cs (Foreach): Lots of work to accomodate a particular
1368 kind of foreach statement that I had not kept in mind. It is
1369 possible to have foreachs on classes that provide a GetEnumerator
1370 method that return objects that implement the "pattern" for using
1371 a foreach, there is no need to support GetEnumerator
1374 This is needed to compile nant.
1376 * decl.cs: Only report 114 if the member is not `Finalize' and if
1377 the warning level is at least 2.
1379 * class.cs: Moved the compare function from Method to
1382 (MethodSignature.InheritableMemberSignatureCompare): Add new
1383 filter function that is used to extract inheritable methods from a
1386 (Method.Define): Use the new `inheritable_method_signature_filter'
1389 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
1392 2002-03-06 Miguel de Icaza <miguel@ximian.com>
1394 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
1396 * cs-parser.jay: Add opt_semicolon to the interface declaration.
1398 * expression.cs: Pass location information to
1399 ConvertImplicitStandard.
1401 * class.cs: Added debugging code to track return values from
1404 2002-03-05 Miguel de Icaza <miguel@ximian.com>
1406 * expression.cs (Is.DoResolve): If either side of the `is' is an
1407 interface, do not flag the warning.
1409 * ecore.cs (ImplicitReferenceConversion): We need a separate test
1412 * report.cs: Allow for --fatal to be used with --probe.
1414 * typemanager.cs (NoTypes): Move the definition for the empty Type
1417 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
1419 (TypeContainer.DefineProxy): New function used to proxy to parent
1420 implementations when implementing interfaces.
1421 (TypeContainer.ParentImplements): used to lookup if our parent
1422 implements a public function that is required by an interface.
1423 (TypeContainer.VerifyPendingMethods): Hook this up.
1425 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
1426 `modules' and `assemblies' arraylists into arrays. We only grow
1427 these are the very early start up of the program, so this improves
1428 the speedof LookupType (nicely measured).
1430 * expression.cs (MakeByteBlob): Replaced unsafe code with
1431 BitConverter, as suggested by Paolo.
1433 * cfold.cs (ConstantFold.Binary): Special case: perform constant
1434 folding of string concatenation, but if either side is a string,
1435 and the other is not, then return null, and let the runtime use
1436 the concatenation on the string plus the object (using
1439 2002-03-04 Miguel de Icaza <miguel@ximian.com>
1441 Constant Folding has been implemented now.
1443 * expression.cs (Unary.Reduce): Do not throw an exception, catch
1444 the error instead on types that are not supported in one's
1447 * constant.cs (Constant and all children): New set of functions to
1448 perform implict and explicit conversions.
1450 * ecore.cs (EnumConstant): Implement the new functions to perform
1451 conversion by proxying to the child expression.
1453 * codegen.cs: (ConstantCheckState): Constant evaluation has its
1454 own separate setting that can not be turned off from the command
1455 line using --unchecked or --checked and is only controlled using
1456 the checked/unchecked statements and expressions. This setting is
1457 used by the constant folder to flag errors.
1459 * expression.cs (CheckedExpr, UncheckedExpr): Set the
1460 ConstantCheckState as well.
1462 During Resolve, they also have to flag the state, because the
1463 constant folder runs completely in the Resolve phase.
1465 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
1468 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1470 * cfold.cs: New file, this file contains the constant folder.
1472 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
1473 argument to track whether we are using the resulting address to
1474 load or store a value and provide better error messages.
1476 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
1477 new AddressOf arguments.
1479 * statement.cs (Foreach.EmitCollectionForeach): Update
1481 * expression.cs (Argument.Emit): Call AddressOf with proper
1482 arguments to track usage.
1484 (New.DoEmit): Call AddressOf with new arguments.
1486 (Unary.Emit): Adjust AddressOf call.
1488 2002-03-01 Ravi Pratap <ravi@ximian.com>
1490 * cs-parser.jay (member_access): Change the case for pre-defined types
1491 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
1494 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
1497 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
1498 essentially like methods and apply attributes like MethodImplOptions to them too.
1500 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
1503 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
1504 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
1507 * Update code everywhere accordingly.
1509 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
1511 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
1513 2002-02-28 Ravi Pratap <ravi@ximian.com>
1515 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
1516 try performing lookups against those instead of jumping straight into using
1517 the 'using' clauses.
1519 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
1521 (LookupType): Perform lookups in implicit parents too.
1523 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
1524 sequence as RootContext.LookupType.
1526 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
1527 the various cases of namespace lookups into this method.
1529 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1531 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
1532 in positional arguments)
1534 * class.cs (Operator): Update the AllowedModifiers to contain
1537 * cs-parser.jay: Update operator declaration to allow for the
1538 operator body to be empty.
1540 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
1543 2002-02-27 Miguel de Icaza <miguel@ximian.com>
1545 * class.cs (Method.Emit): Label parameters.
1547 * driver.cs: Return 1 or 0 as the program exit code.
1549 2002-02-26 Miguel de Icaza <miguel@ximian.com>
1551 * expression.cs: Special case the `null' object when trying to
1552 auto-compute the type, as anything can be explicitly converted to
1555 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
1556 spotting this Paolo.
1558 (Expression.ImplicitNumericConversion): Perform comparissions of
1559 the type using the underlying type in the case of an enumeration
1560 rather than using the enumeration type for the compare.
1562 Cope with the underlying == type case, which is not possible to
1565 (Expression.ConvertNumericExplicit): Perform comparissions of
1566 the type using the underlying type in the case of an enumeration
1567 rather than using the enumeration type for the compare.
1569 * driver.cs: If the user does not supply an extension, assume .exe
1571 * cs-parser.jay (if_statement): Rewrote so that we can track the
1572 location for the if statement.
1574 * expression.cs (Binary.ConstantFold): Only concat strings when
1575 the operation is "+", not everything ;-)
1577 * statement.cs (Statement.EmitBoolExpression): Take a location
1579 (If, While, Do): Track location.
1581 * expression.cs (Binary.ResolveOperator): In the object + string
1582 case, I was missing a call to ConvertImplicit
1584 2002-02-25 Ravi Pratap <ravi@ximian.com>
1586 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
1587 Location arguments. Ensure we use RootContext.LookupType to do our work
1588 and not try to do a direct Type.GetType and ModuleBuilder.GetType
1590 * interface.cs (PopulateMethod): Handle the type of the parameter being
1593 * expression.cs (Invocation.BetterFunction): Handle the case when we
1594 have a params method with no fixed arguments and a call is made with no
1597 2002-02-25 Miguel de Icaza <miguel@ximian.com>
1599 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
1600 the verbatim-string-literal
1602 * support.cs (InternalParameters.ParameterModifier): handle null
1604 (InternalParameters.ParameterType): ditto.
1606 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
1607 duplicating the name of the variable parameter.
1608 (GetParameterByName): Fix bug where we were not looking up array
1609 paramters if they were the only present (thanks Paolo!).
1610 (GetParameterInfo): We only have an empty set of types if both
1611 fixed and array are set to null.
1612 (GetParameterInfo-idx): Handle FixedParameter == null
1614 * cs-parser.jay: Handle the case where there is no catch
1615 statements (missing null test).
1617 2002-02-22 Miguel de Icaza <miguel@ximian.com>
1619 * driver.cs (MainDriver): Be conservative on our command line
1622 Catch DirectoryNotFoundException when calling GetFiles.
1624 (SplitPathAndPattern): Used to split the input specification into
1625 a path and a pattern that we can feed to Directory.GetFiles.
1627 2002-02-21 Miguel de Icaza <miguel@ximian.com>
1629 * statement.cs (Fixed): Implement the last case of the Fixed
1630 statement (string handling).
1632 * expression.cs (StringPtr): New class used to return a char * to
1633 a string; Used by the Fixed statement.
1635 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
1637 * expression.cs (Binary.ResolveOperator): Remove redundant
1638 MemberLookup pn parent type.
1639 Optimize union call, we do not need a union if the types are the same.
1640 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
1643 Specialize the use of MemberLookup everywhere, instead of using
1644 the default settings.
1646 (StackAlloc): Implement stackalloc keyword.
1648 * cs-parser.jay: Add rule to parse stackalloc.
1650 * driver.cs: Handle /h, /help, /?
1652 * expression.cs (MakeByteBlob): Removed the hacks we had in place
1653 before we supported unsafe code.
1655 * makefile: add --unsafe to the self compilation of mcs.
1657 2002-02-20 Miguel de Icaza <miguel@ximian.com>
1659 * expression.cs (PointerArithmetic): New class that is used to
1660 perform pointer arithmetic.
1661 (Binary.Resolve): Handle pointer arithmetic
1662 Handle pointer comparission.
1663 (ArrayPtr): Utility expression class that is used to take the
1664 address of an array.
1666 (ElementAccess): Implement array access for pointers
1668 * statement.cs (Fixed): Implement fixed statement for arrays, we
1669 are missing one more case before we are done.
1671 * expression.cs (Indirection): Implement EmitAssign and set the
1672 ExprClass to Variable. This allows pointer dereferences to be
1673 treated as variables, and to have values assigned to them.
1675 * ecore.cs (Expression.StoreFromPtr): New utility function to
1676 store values dereferencing.
1678 2002-02-20 Ravi Pratap <ravi@ximian.com>
1680 * expression.cs (Binary.ResolveOperator): Ensure that we are
1681 not trying to operate on a void type - this fixes the reported
1684 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
1685 the parent implementation is sealed.
1687 * ../errors/cs0239.cs : Add.
1689 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
1691 * typemanager.cs (unverifiable_code_type): Corresponds to
1692 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
1693 which have unsafe code in them.
1695 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
1698 2002-02-19 Miguel de Icaza <miguel@ximian.com>
1700 * cs-tokenizer.cs: Add support for @"litreal strings"
1702 Make tokenizer accept pre-processor directives
1703 on any column (remove the old C-like limitation).
1705 * rootcontext.cs (EmitCode): Emit any global attributes.
1706 (AddGlobalAttributes): Used to keep track of assembly attributes.
1708 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
1710 * cs-parser.jay: Add support for global attributes.
1712 2002-02-17 Miguel de Icaza <miguel@ximian.com>
1714 * expression.cs (Indirection): New helper class. Unary will
1715 create Indirection classes to be able to implement the
1716 IMemoryLocation interface on it.
1718 2002-02-16 Miguel de Icaza <miguel@ximian.com>
1720 * cs-parser.jay (fixed_statement): reference the right statement.
1722 * statement.cs (Fixed.Emit): Finish implementing the fixed
1723 statement for the &x case.
1725 2002-02-14 Miguel de Icaza <miguel@ximian.com>
1727 * class.cs (Property.Define, Method.Define): Remove newslot when
1730 * modifiers.cs: My use of NewSlot when `Abstract' was set was
1731 wrong. NewSlot should only be used if the `new' keyword is present.
1733 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
1734 locating our system dir. Sorry about this.
1736 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1738 * driver.cs (GetSystemDir): Compute correctly the location of our
1739 system assemblies. I was using the compiler directory instead of
1740 the library directory.
1742 2002-02-13 Ravi Pratap <ravi@ximian.com>
1744 * expression.cs (BetterFunction): Put back in what Miguel commented out
1745 since it is the correct fix. The problem is elsewhere ;-)
1747 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
1748 parameters of the parms method are themselves compatible or not !
1750 (StandardConversionExists): Fix very dangerous bug where we were forgetting
1751 to check that a class implements an interface before saying that an implicit
1752 conversion was allowed. Use ImplementsInterface to do the checking.
1754 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1756 * class.cs (Method.Define): Track whether we are an explicit
1757 implementation or not. And only call DefineMethodOverride if we
1758 are an explicit implementation.
1760 (Property.DefineMethod): Ditto.
1762 2002-02-11 Ravi Pratap <ravi@ximian.com>
1764 * expression.cs (BetterFunction): Catch hideous bug which was
1765 preventing us from detecting ambiguous calls due to implicit casts i.e
1768 2002-01-29 Miguel de Icaza <miguel@ximian.com>
1770 * support.cs (Pair): Remove un-needed method. I figured why I was
1771 getting the error in cs-parser.jay, the variable in a foreach loop
1772 is readonly, and the compiler does not really treat this as a variable.
1774 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
1775 instead of EQUALS in grammar.
1777 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
1779 * expression.cs (Unary.DoResolve): Check whether the argument is
1782 2002-01-28 Miguel de Icaza <miguel@ximian.com>
1784 * support.cs: Api for Pair to set a value. Despite the fact that
1785 the variables are public the MS C# compiler refuses to compile
1786 code that accesses the field if the variable is part of a foreach
1789 * statement.cs (Fixed): Begin implementation of the fixed
1792 (Block.AddVariable): Return the VariableInfo on success and null
1793 on failure instead of true/false.
1795 * cs-parser.jay (foreach): Catch errors on variables already
1796 defined (we were ignoring this value before) and properly unwind
1799 (fixed_statement): grammar for the fixed statement.
1801 2002-01-25 Miguel de Icaza <miguel@ximian.com>
1803 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
1804 pointer types to be incretemented.
1806 (SizeOf): Implement.
1808 * cs-parser.jay (pointer_member_access): Implement
1809 expr->IDENTIFIER production.
1811 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
1812 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
1815 (Unary): Implement indirection.
1817 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
1818 use in non-unsafe context).
1820 (SimpleName.DoResolve): Check for pointers in field access on safe
1823 (Expression.LoadFromPtr): Factor the load-indirect code in this
1824 function. This was duplicated in UnboxCast and ParameterReference
1826 2002-01-24 Miguel de Icaza <miguel@ximian.com>
1828 * expression.cs (ComposedCast): report an error if a pointer cast
1829 is used in a safe region.
1831 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
1832 pointer type casts in unsafe context.
1834 * codegen.cs (EmitContext): Set up IsUnsafe.
1836 * cs-parser.jay (non_expression_type): Add productions for pointer
1839 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
1840 code. We should not use force into static mode if the method is
1841 not virtual. Fixes bug in MIS
1843 * statement.cs (Do.Emit, While.Emit, For.Emit,
1844 Statement.EmitBoolExpression): Add support to Do and While to
1845 propagate infinite loop as `I do return' semantics.
1847 Improve the For case to also test for boolean constants.
1849 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
1850 to the list of attributes we can add.
1852 Remove `EmitContext' argument.
1854 * class.cs (Method.Define): Apply parameter attributes.
1855 (Constructor.Define): Apply parameter attributes.
1856 (MethodCore.LabelParameters): Move here the core of labeling
1859 * support.cs (ReflectionParameters.ParameterModifier,
1860 InternalParameters.ParameterModifier): Use IsByRef on the type and
1861 only return the OUT bit for these parameters instead of in/out/ref
1864 This is because I miss-understood things. The ParameterInfo.IsIn
1865 and IsOut represent whether the parameter has the [In] and [Out]
1868 2002-01-22 Miguel de Icaza <miguel@ximian.com>
1870 * ecore.cs (FieldExpr.Emit): Release temporaries.
1872 * assign.cs (LocalTemporary.Release): new function.
1874 * codegen.cs (EmitContext.GetTemporaryStorage,
1875 EmitContext.FreeTemporaryStorage): Rework the way we deal with
1876 temporary storage. Now we can "put back" localbuilders when we
1879 2002-01-21 Miguel de Icaza <miguel@ximian.com>
1881 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
1882 need to make a copy of the variable to generate verifiable code.
1884 2002-01-19 Miguel de Icaza <miguel@ximian.com>
1886 * driver.cs: Compute dynamically the system directory.
1888 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
1889 Slower, but more generally useful. Used by the abstract
1890 registering implementation.
1892 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
1893 the rules for the special rule on Type/instances. First check if
1894 we have the same name, and if so, try that special static path
1895 rather than the instance path.
1897 2002-01-18 Miguel de Icaza <miguel@ximian.com>
1899 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
1902 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
1903 Enum, ValueType, Delegate or Array for non-corlib compiles.
1905 * cs-tokenizer.cs: Catch long identifiers (645)
1907 * typemanager.cs (IndexerPropetyName): Ravi never tested this
1910 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
1911 fix, we were returning too early, so we were not registering
1912 pending methods from abstract classes.
1914 Do not register pending methods if the class is abstract.
1916 * expression.cs (Conditional.DoResolve): Report circular implicit
1917 conversions when we neecd to compute it for conditional
1920 (Is.DoResolve): If the expression is always of the provided type,
1921 flag warning 183. If the expression can not ever be of the
1922 provided type flag warning 184.
1924 * class.cs: Catch 169 as well.
1926 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
1929 2002-01-18 Nick Drochak <ndrochak@gol.com>
1931 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
1933 2002-01-17 Miguel de Icaza <miguel@ximian.com>
1935 * interface.cs: (PopulateMethod): Check for pointers being defined
1936 only if the unsafe context is active.
1937 (PopulateProperty): ditto.
1938 (PopulateIndexer): ditto.
1940 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
1941 specified. If pointers are present, make sure that they are
1942 present in an unsafe context.
1943 (Constructor, Constructor.Define): ditto.
1944 (Field, Field.Define): ditto.
1945 (Property, Property.Define): ditto.
1946 (Event, Event.Define): ditto.
1948 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
1949 hashtable if there are classes or structs defined.
1951 * expression.cs (LocalVariableReference.DoResolve): Simplify this
1952 code, as the constant resolution moved.
1954 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
1955 the metadata, so we can flag error 133.
1957 * decl.cs (MemberCore.UnsafeOK): New function to test that a
1958 pointer is being declared in an unsafe context.
1960 2002-01-16 Miguel de Icaza <miguel@ximian.com>
1962 * modifiers.cs (Modifiers.Check): Require a Location argument.
1963 Report error 227 for Unsafe use.
1965 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
1967 * statement.cs (For.Emit): If the test is null, then report that
1968 we do `return', as we wont reach anything afterwards.
1970 (Switch.SwitchGoverningType): Track the expression that matched
1973 * driver.cs: Allow negative numbers as an error code to flag.
1975 * cs-parser.jay: Handle 1551.
1977 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
1979 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1981 * cs-parser.jay: Report 1518 (type declaration can only contain
1982 class, struct, interface, enum or delegate)
1984 (switch_label): Report 1523 (keywords `case' or `default' must
1987 (opt_switch_sections): Report 1522 (empty switch)
1989 * driver.cs: Report 1515 (response file specified multiple times)
1990 Report 1516 (Source file specified multiple times).
1992 * expression.cs (Argument.Resolve): Signal 1510
1994 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
1995 access not allowed in static code)
1997 2002-01-11 Ravi Pratap <ravi@ximian.com>
1999 * typemanager.cs (IsPointerType): Utility method which we are going
2002 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
2003 the object type, so we take care of that.
2005 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
2007 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
2008 added to non-params parameters :-)
2010 * typemanager.cs (CSharpName): Include 'void' type too.
2012 (void_ptr_type): Include in the set of core types.
2014 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
2017 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
2020 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
2021 completely forgotten about it.
2023 2002-01-10 Ravi Pratap <ravi@ximian.com>
2025 * cs-parser.jay (pointer_type): Add. This begins our implementation
2026 of parsing rules for unsafe code.
2028 (unsafe_statement): Implement.
2030 (embedded_statement): Modify to include the above.
2032 * statement.cs (Unsafe): Implement new class for unsafe blocks.
2034 * codegen.cs (EmitContext.InUnsafe): Add. This determines
2035 if the current context is an unsafe one.
2037 * cs-parser.jay (local_variable_pointer_type): Since local variable types
2038 are handled differently, we need separate rules for them.
2040 (local_variable_declaration): Update to use local_variable_pointer_type
2041 to allow variable declarations of unmanaged pointer types.
2043 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
2046 * ../errors/cs0214.cs : Add.
2048 2002-01-16 Nick Drochak <ndrochak@gol.com>
2050 * makefile: remove 'response' file when cleaning.
2052 2002-01-15 Miguel de Icaza <miguel@ximian.com>
2054 * cs-parser.jay: Report 1524.
2056 2002-01-14 Miguel de Icaza <miguel@ximian.com>
2058 * typemanager.cs (RegisterMethod): drop checking if we have
2059 registered this from here
2061 2002-01-12 Miguel de Icaza <miguel@ximian.com>
2063 * class.cs (Method.EmitDestructor): Implement calling our base
2066 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
2069 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
2070 this routine and will wrap the call in a try/catch block. Deal
2073 2002-01-11 Miguel de Icaza <miguel@ximian.com>
2075 * ecore.cs (Expression.MemberLookup): instead of taking a
2076 parameter `same_type' that was used to tell whether we could
2077 access private members we compute our containing type from the
2080 (FieldExpr): Added partial support for volatile fields. This does
2081 not work for volatile fields exposed from assemblies, as I can not
2082 figure out how to extract the modreq from it.
2084 Updated all the source files to use this.
2086 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
2087 because it is referenced by MemberLookup very often.
2089 2002-01-09 Ravi Pratap <ravi@ximian.com>
2091 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
2092 TypeBuilder.GetCustomAttributes to retrieve what we need.
2094 Get rid of redundant default_member_attr_type as this is the same as
2095 default_member_type which already exists.
2097 * interface.cs, attribute.cs : Update accordingly.
2099 2002-01-08 Miguel de Icaza <miguel@ximian.com>
2101 * typemanager.cs: Enable IndexerPropertyName again. It does not
2102 work for TYpeBuilders though. Ravi, can you please fix this?
2104 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
2106 * expression.cs (Argument.Emit): Handle the case of ref objects
2107 being passed to ref functions;
2109 (ParameterReference.EmitLoad): Loads the content of the pointer
2110 without dereferencing.
2112 2002-01-07 Miguel de Icaza <miguel@ximian.com>
2114 * cs-tokenizer.cs: Implemented the pre-processing expressions.
2116 2002-01-08 Ravi Pratap <ravi@ximian.com>
2118 * class.cs (Indexer.DefineMethod): Incorporate the interface
2119 type in the name of the method if we are doing explicit interface
2122 * expression.cs (ConversionExists): Remove as it is completely obsolete.
2124 (BetterConversion): Fix extremely trivial bug where we were referring to
2125 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
2128 * ../errors/bug16.cs : Add although we have fixed it.
2130 2002-01-07 Miguel de Icaza <miguel@ximian.com>
2132 * expression.cs (BaseIndexer): Begin implementation.
2134 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
2136 * cs-parser.jay (indexer_declarator): Use qualified_identifier
2137 production directly to remove a shift/reduce, and implement
2138 explicit interface implementation.
2140 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
2141 after a floating point suffix.
2143 * expression.cs (DoNumericPromotions): Improved the conversion for
2144 uint/uint. If we have a constant, we avoid doing a typecast to a
2147 * class.cs (Indexer): Implement explicit interface implementation
2150 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
2152 * class.cs: make the default instance constructor public and hidebysig.
2154 2001-01-03 Ravi Pratap <ravi@ximian.com>
2156 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
2157 so we can call it from elsewhere.
2159 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
2160 we emit it internally if the class has a defined indexer; otherwise the user
2161 emits it by decorating the class definition with the DefaultMemberAttribute.
2163 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
2164 attribute is not used on a type which defines an indexer.
2166 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
2167 character when we skip whitespace.
2169 * ../errors/cs0646.cs : Add.
2171 2002-01-03 Miguel de Icaza <miguel@ximian.com>
2173 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
2176 * makefile: Add practical target `mcs3.exe' which builds the third
2177 generation compiler.
2179 * expression.cs (New): Fix structures constructor calling.
2181 * class.cs (Property, Method, Indexer): Emit Final flag on the
2182 method if we are an interface implementation and we are not
2185 * ecore.cs (PropertyExpr): New public field `IsBase', tells
2186 whether this property is referencing a `base' method.
2188 * expression.cs (Invocation.EmitCall): take an extra argument:
2189 is_base, this is used to determine whether the `call' or
2190 `callvirt' opcode should be used.
2193 * delegate.cs: update EmitCall.
2195 * class.cs (Method.Define): Set NewSlot for the cases where we are
2196 not implementing an interface method.
2198 (Property.Define): ditto.
2200 2002-01-02 Miguel de Icaza <miguel@ximian.com>
2202 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
2203 'r'. Allows mcs to parse itself fully.
2205 2002-01-02 Ravi Pratap <ravi@ximian.com>
2207 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
2208 of the number of initializers that require the InitializeArray method.
2210 (CheckIndices): Store the Expression in all cases - not the plain value. Also
2211 update the above field where necessary.
2213 (MakeByteBlob): Update accordingly.
2215 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
2218 (EmitDynamicInitializers): Update in accordance with the new optimization.
2220 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
2221 same OpCode applies.
2223 * cs-parser.jay : Fix some glaring errors I introduced.
2225 2002-01-01 Ravi Pratap <ravi@ximian.com>
2227 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
2228 so that we can check for name clashes there too.
2230 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
2231 for interface indexers.
2233 * interfaces.cs (Define): Emit the default member attribute.
2235 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
2236 variable was being referred to while setting the value ;-)
2238 2002-01-01 Miguel de Icaza <miguel@ximian.com>
2240 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
2241 byte-by-byte information when we know the data is zero.
2243 Make the block always a multiple of 4, because
2244 DefineInitializedData has a bug.
2246 * assign.cs: Fix, we should assign from the temporary, not from
2249 * expression.cs (MakeByteBlob): Fix my incorrect code.
2251 2001-12-31 Miguel de Icaza <miguel@ximian.com>
2253 * typemanager.cs (EnumToUnderlying): This function is used to get
2254 the underlying type from an enumeration, because it does not
2257 * constant.cs: Use the I4_S form for values between -128 and 127.
2259 * statement.cs (Block.LookupLabel): Looks up a label.
2260 (Block): Drop support for labeled blocks.
2262 (LabeledStatement): New kind of statement that represents a label
2265 (Goto): Finally implement this bad boy.
2267 * cs-parser.jay: Update to reflect new mechanism to implement
2270 2001-12-30 Miguel de Icaza <miguel@ximian.com>
2272 * codegen.cs (EmitContext.This): a codegen property that keeps the
2273 a single instance of this instead of creating many different this
2276 * delegate.cs (Delegate.DoResolve): Update to use the property;
2278 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
2280 * expression.cs (BaseAccess.DoResolve): Ditto.
2282 2001-12-29 Ravi Pratap <ravi@ximian.com>
2284 * typemanager.cs (methodimpl_attr_type): Add to hold the type
2285 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
2287 (InitCoreTypes): Update accordingly.
2289 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
2290 so we can quickly store the state.
2292 (ApplyAttributes): Set the correct implementation flags
2293 for InternalCall methods.
2295 2001-12-29 Miguel de Icaza <miguel@ximian.com>
2297 * expression.cs (EmitCall): if a method is not virtual, then do
2298 not use callvirt on it.
2300 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
2301 user defined stuff) requires the use of stobj, which takes an
2302 address on the stack instead of an array and an index. So emit
2303 the Ldelema operation for it.
2305 (EmitStoreOpcode): Use stobj for valuetypes.
2307 (UnaryMutator.EmitCode): Use the right 1 value depending on
2308 whether we are dealing with int64/uint64, float or doubles.
2310 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
2311 constructors that I implemented last night.
2313 (Constructor.IsDefault): Fix to work properly for static
2316 * cs-parser.jay (CheckDef): report method signature errors.
2317 Update error number 103 to be 132.
2319 * decl.cs: New AdditionResult enumeration value: MethodExists.
2320 Although we do this check for methods later on in the semantic
2321 analysis, catching repeated default constructors is so easy that
2322 we catch these here.
2324 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
2327 (ParameterReference.EmitAssign, Emit): handle
2330 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
2331 (ArrayAccess.EmitStoreOpcode): ditto.
2333 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
2335 * expression.cs (MakeByteBlob): Complete all the missing types
2336 (uint, short, ushort, byte, sbyte)
2338 * class.cs: Only init instance field initializers on instance
2341 Rename `constructors' to instance_constructors.
2343 (TypeContainer.AddConstructor): Only add constructors to the list
2344 if it is not static.
2346 Make sure that we handle default_static_constructor independently
2347 everywhere where we handle instance_constructors
2349 2001-12-28 Miguel de Icaza <miguel@ximian.com>
2351 * class.cs: Do not lookup or create a base initializer for a
2354 (ConstructorInitializer.Resolve): use the proper type to lookup
2357 * cs-parser.jay: Report error 1585 (modifiers between type and name).
2359 * enum.cs, interface.cs: Remove CloseType, this is taken care by
2362 * decl.cs: CloseType is now an virtual method, the default
2363 implementation just closes this type.
2365 2001-12-28 Ravi Pratap <ravi@ximian.com>
2367 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
2368 to PreserveSig by default. Also emit HideBySig on such methods.
2370 Basically, set the defaults to standard values.
2372 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
2373 argument, if candidate is better, it can't be worse than the best !
2375 (Invocation): Re-write bits to differentiate between methods being
2376 applicable in their expanded form and their normal form - for params
2379 Get rid of use_standard everywhere as only standard conversions are allowed
2380 in overload resolution.
2382 More spec conformance.
2384 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2386 * driver.cs: Add --timestamp, to see where the compiler spends
2389 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
2390 `this' in static code.
2392 (SimpleName.DoResolve): Implement in terms of a helper function
2393 that allows static-references to be passed upstream to
2396 (Expression.ResolveWithSimpleName): Resolve specially simple
2397 names when called by MemberAccess to implement the special
2400 (Expression.ImplicitReferenceConversion): Handle conversions from
2401 Null to reference types before others, as Null's type is
2404 * expression.cs (Invocation.EmitCall): Handle the special case of
2405 calling methods declared on a reference type from a ValueType
2406 (Base classes System.Object and System.Enum)
2408 (MemberAccess.Resolve): Only perform lookups on Enumerations if
2409 the left hand side is a TypeExpr, not on every enumeration.
2411 (Binary.Resolve): If types are reference types, then do a cast to
2412 object on operators != and == of both arguments.
2414 * typemanager.cs (FindMembers): Extract instance and static
2415 members if requested.
2417 * interface.cs (PopulateProperty): Use void_type instead of null
2418 as the return type for the setter method.
2420 (PopulateIndexer): ditto.
2422 2001-12-27 Ravi Pratap <ravi@ximian.com>
2424 * support.cs (ReflectionParameters): Fix minor bug where we
2425 were examining the wrong parameter for the ParamArray attribute.
2427 Cope with requests for the type of the parameter at position
2428 greater than the params parameter's. We now return the element
2429 type of the params array as that makes more sense.
2431 * expression.cs (Invocation.IsParamsMethodApplicable): Update
2432 accordingly as we no longer have to extract the element type
2435 (Invocation.OverloadResolve): Update.
2437 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2439 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
2440 against IEnumerator, test whether the return value is a descendant
2441 of the IEnumerator interface.
2443 * class.cs (Indexer.Define): Use an auxiliary method to implement
2444 the other bits of the method definition. Begin support for
2445 explicit interface implementation.
2447 (Property.DefineMethod): Use TypeManager.void_type instead of null
2448 for an empty return value.
2450 2001-12-26 Miguel de Icaza <miguel@ximian.com>
2452 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
2453 dealing with a FieldExpr which is composed of a FieldBuilder, in
2454 the code path we did extract the constant, but we should have
2455 obtained the underlying value to be able to cast it (otherwise we
2456 end up in an infinite loop, this is what Ravi was running into).
2458 (ArrayCreation.UpdateIndices): Arrays might be empty.
2460 (MemberAccess.ResolveMemberAccess): Add support for section
2461 14.5.4.1 that deals with the special case of E.I when E is a type
2462 and something else, that I can be a reference to a static member.
2464 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
2465 handle a particular array type to create byte blobs, it is just
2466 something we dont generate byteblobs for.
2468 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
2471 * location.cs (Push): remove the key from the hashtable that we
2472 are about to add. This happens for empty files.
2474 * driver.cs: Dispose files after we have parsed them.
2476 (tokenize): new function that only runs the tokenizer on its
2477 input, for speed testing.
2479 2001-12-26 Ravi Pratap <ravi@ximian.com>
2481 * class.cs (Event.Define): Define the private field only if there
2482 are no accessors defined.
2484 * expression.cs (ResolveMemberAccess): If there is no associated
2485 field with the event, that means we have an event defined with its
2486 own accessors and we should flag error cs0070 since transforming
2487 ourselves into a field is not valid in that case.
2489 * ecore.cs (SimpleName.DoResolve): Same as above.
2491 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
2492 and charset to sane values.
2494 2001-12-25 Ravi Pratap <ravi@ximian.com>
2496 * assign.cs (DoResolve): Perform check on events only if they
2497 are being accessed outside the declaring type.
2499 * cs-parser.jay (event_declarations): Update rules to correctly
2500 set the type of the implicit parameter etc.
2502 (add_accessor, remove_accessor): Set current local parameters.
2504 * expression.cs (Binary): For delegate addition and subtraction,
2505 cast the return value from the method into the appropriate delegate
2508 2001-12-24 Ravi Pratap <ravi@ximian.com>
2510 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
2511 of these as the workaround is unnecessary.
2513 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
2514 delegate data - none of that is needed at all.
2516 Re-write bits to extract the instance expression and the delegate method
2519 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
2522 * attribute.cs (ApplyAttributes): New method to take care of common tasks
2523 of attaching attributes instead of duplicating code everywhere.
2525 * everywhere : Update code to do attribute emission using the above method.
2527 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2529 * expression.cs (IsParamsMethodApplicable): if there are not
2530 parameters, return immediately.
2532 * ecore.cs: The 0 literal can be implicity converted to an enum
2535 (SimpleName.DoResolve): First lookup the type, then lookup the
2538 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
2539 want to get its address. If the InstanceExpression is not
2540 addressable, store the result in a temporary variable, then get
2543 * codegen.cs: Only display 219 errors on warning level or above.
2545 * expression.cs (ArrayAccess): Make it implement the
2546 IMemoryLocation interface.
2548 (Binary.DoResolve): handle the operator == (object a, object b)
2549 and operator != (object a, object b) without incurring into a
2550 BoxedCast (because 5 != o should never be performed).
2552 Handle binary enumerator operators.
2554 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
2555 value type, otherwise use Ldelem_ref.
2557 Use precomputed names;
2559 (AddressOf): Implement address of
2561 * cs-parser.jay (labeled_statement): Fix recursive block
2562 addition by reworking the production.
2564 * expression.cs (New.DoEmit): New has a special case:
2566 If we are dealing with a ValueType, we have a few
2567 situations to deal with:
2569 * The target of New is a ValueType variable, that is
2570 easy, we just pass this as the variable reference
2572 * The target of New is being passed as an argument,
2573 to a boxing operation or a function that takes a
2576 In this case, we need to create a temporary variable
2577 that is the argument of New.
2580 2001-12-23 Ravi Pratap <ravi@ximian.com>
2582 * rootcontext.cs (LookupType): Check that current_type is not null before
2583 going about looking at nested types.
2585 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
2586 not implement the IAssignMethod interface any more.
2588 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
2589 where we tranform them into FieldExprs if they are being resolved from within
2592 * ecore.cs (SimpleName.DoResolve): Do the same here.
2594 * assign.cs (DoResolve, Emit): Clean up code considerably.
2596 * ../errors/bug10.cs : Add.
2598 * ../errors/cs0070.cs : Add.
2600 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
2602 * assign.cs : Get rid of EventIsLocal everywhere.
2604 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2606 * ecore.cs (ConvertIntLiteral): finished the implementation.
2608 * statement.cs (SwitchLabel): Convert the value we are using as a
2609 key before looking up the table.
2611 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2613 * codegen.cs (EmitTopBlock): Require a Location argument now.
2615 * cs-parser.jay (constructor_declarator): We need to setup
2616 current_local_parameters before we parse the
2617 opt_constructor_initializer, to allow the variables to be bound
2618 to the constructor arguments.
2620 * rootcontext.cs (LookupType): First lookup nested classes in our
2621 class and our parents before we go looking outside our class.
2623 * expression.cs (ConstantFold): Extract/debox the values at the
2626 * rootcontext.cs (EmitCode): Resolve the constants first before we
2627 resolve the types. This is not really needed, but it helps debugging.
2629 * statement.cs: report location.
2631 * cs-parser.jay: pass location to throw statement.
2633 * driver.cs: Small bug fix.
2635 * report.cs: Updated format to be 4-zero filled digits.
2637 2001-12-22 Ravi Pratap <ravi@ximian.com>
2639 * expression.cs (CheckIndices): Fix minor bug where the wrong
2640 variable was being referred to ;-)
2642 (DoEmit): Do not call EmitStaticInitializers when the
2643 underlying type is System.Object.
2645 2001-12-21 Ravi Pratap <ravi@ximian.com>
2647 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
2648 and do the usual workaround for SRE.
2650 * class.cs (MyEventBuilder.EventType): New member to get at the type
2651 of the event, quickly.
2653 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
2655 * assign.cs (Assign.DoResolve): Handle the case when the target
2656 is an EventExpr and perform the necessary checks.
2658 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
2661 (SimpleName.MemberStaticCheck): Include check for EventExpr.
2663 (EventExpr): Set the type in the constructor itself since we
2664 are meant to be born fully resolved.
2666 (EventExpr.Define): Revert code I wrote earlier.
2668 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
2669 instance expression is null. The instance expression is a This in that case
2670 or a null, depending on whether it is a static method or not.
2672 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
2673 refers to more than one method.
2675 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
2676 and accordingly flag errors.
2678 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2680 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
2682 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2684 * location.cs (ToString): Provide useful rutine.
2686 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2688 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
2689 objects, return the actual integral boxed.
2691 * statement.cs (SwitchLabel): define an ILLabel for each
2694 (Switch.CheckSwitch): If the value is a Literal, extract
2695 the underlying literal.
2697 Also in the unused hashtable we had, add the SwitchLabel so we can
2698 quickly look this value up.
2700 * constant.cs: Implement a bunch of new constants. Rewrite
2701 Literal based on this. Made changes everywhere to adapt to this.
2703 * expression.cs (Expression.MakeByteBlob): Optimize routine by
2704 dereferencing array only once, and also copes with enumrations.
2706 bytes are two bytes wide, not one.
2708 (Cast): Perform constant conversions.
2710 * ecore.cs (TryImplicitIntConversion): Return literals instead of
2711 wrappers to the literals here.
2713 * expression.cs (DoNumericPromotions): long literals can converted
2714 to ulong implicity (this is taken care of elsewhere, but I was
2717 * ecore.cs (Expression.Literalize): Make the return type Literal,
2718 to improve type checking.
2720 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
2722 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2724 * literal.cs: Revert code from ravi that checked the bounds. The
2725 bounds are sane by the definition of the type itself.
2727 * typemanager.cs: Fix implementation of ImplementsInterface. We
2728 need to actually look up in our parent hierarchy for interfaces
2731 * const.cs: Use the underlying type for enumerations
2733 * delegate.cs: Compute the basename for the delegate creation,
2734 that should fix the delegate test case, and restore the correct
2735 Type Lookup semantics in rootcontext
2737 * rootcontext.cs: Revert Ravi's last patch. The correct way of
2738 referencing a nested type with the Reflection API is using the "+"
2741 * cs-parser.jay: Do not require EOF token at the end.
2743 2001-12-20 Ravi Pratap <ravi@ximian.com>
2745 * rootcontext.cs (LookupType): Concatenate type names with
2746 a '.' instead of a '+' The test suite passes again.
2748 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
2749 field of the enumeration.
2751 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
2752 the case when the member is an EventExpr.
2754 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
2755 static has an associated instance expression.
2757 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
2759 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
2761 * class.cs (Event.Define): Register event and perform appropriate checks
2764 We define the Add and Remove methods even if the use provides none because
2765 in that case, we provide default implementations ourselves.
2767 Define a private field of the type of the event. This is done by the CSC compiler
2768 and we should be doing it too ;-)
2770 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
2771 More methods we use in code we generate.
2773 (multicast_delegate_type, delegate_type): Two separate types since the distinction
2776 (InitCoreTypes): Update accordingly for the above.
2778 * class.cs (Event.Emit): Generate code for default accessors that we provide
2780 (EmitDefaultMethod): Do the job in the above.
2782 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
2785 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2787 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
2788 builders even if we were missing one.
2790 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
2791 pass the Basename as our class name instead of the Name. The
2792 basename will be correctly composed for us.
2794 * parameter.cs (Paramters): Now takes a Location argument.
2796 * decl.cs (DeclSpace.LookupType): Removed convenience function and
2797 make all the code call directly LookupType in RootContext and take
2798 this chance to pass the Location information everywhere.
2800 * Everywhere: pass Location information.
2802 2001-12-19 Miguel de Icaza <miguel@ximian.com>
2804 * class.cs (Constructor.Define): Updated way of detecting the
2805 length of the parameters.
2807 (TypeContainer.DefineType): Use basename as the type name for
2810 (TypeContainer.Define): Do not recursively define types here, as
2811 definition is taken care in order by the RootContext.
2813 * tree.cs: Keep track of namespaces in a per-file basis.
2815 * parameter.cs (Parameter.ComputeSignature): Update to use
2818 (Parameters.GetSignature): ditto.
2820 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
2821 instead of a TypeContainer.
2823 (Interface.SemanticAnalysis): Use `this' instead of our parent to
2824 resolve names. Because we need to be resolve in our context, not
2827 * driver.cs: Implement response files.
2829 * class.cs (TypeContainer.DefineType): If we are defined, do not
2832 (Event.Emit): Emit the code for add/remove handlers.
2833 (Event.Define): Save the MethodBuilders for add/remove.
2835 * typemanager.cs: Use pair here too.
2837 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
2838 DictionaryEntry requires the first argument to be non-null.
2840 (enum_declaration): Compute full name for registering the
2843 (delegate_declaration): Instead of using
2844 formal_parameter_list, use opt_formal_parameter_list as the list
2847 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
2848 (EventParsing): New property that controls whether `add' and
2849 `remove' are returned as tokens or identifiers (for events);
2851 2001-12-19 Ravi Pratap <ravi@ximian.com>
2853 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
2854 use MyEventBuilder only and let it wrap the real builder for us.
2856 (MyEventBuilder): Revamp constructor etc.
2858 Implement all operations that we perform on EventBuilder in precisely the same
2861 (FindMembers): Update to use the EventBuilder member.
2863 (Event.Emit): Update accordingly.
2865 2001-12-18 Ravi Pratap <ravi@ximian.com>
2867 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
2868 by calling the appropriate methods.
2870 (GetCustomAttributes): Make stubs as they cannot possibly do anything
2873 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
2875 2001-12-17 Ravi Pratap <ravi@ximian.com>
2877 * delegate.cs (Delegate.Populate): Check that the return type
2878 and various parameters types are indeed accessible.
2880 * class.cs (Constructor.Define): Same here.
2882 (Field.Define): Ditto.
2884 (Event.Define): Ditto.
2886 (Operator.Define): Check that the underlying Method defined itself
2887 correctly - so it's MethodBuilder should not be null.
2889 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
2890 expression happens to be null.
2892 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
2893 members but as of now we don't seem to be able to do anything really useful with it.
2895 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
2896 not the EventBuilder.
2898 2001-12-18 Miguel de Icaza <miguel@ximian.com>
2900 * cs-tokenizer.cs: Add support for defines.
2901 Add support for #if, #elif, #else, #endif
2903 (eval_var): evaluates a variable.
2904 (eval): stubbed for evaluating functions.
2906 * cs-parser.jay: Pass the defines information
2908 * driver.cs: Add --define command line option.
2910 * decl.cs: Move MemberCore here.
2912 Make it the base class for DeclSpace. This allows us to catch and
2913 report 108 and 109 for everything now.
2915 * class.cs (TypeContainer.Define): Extract all the members
2916 before populating and emit the warning 108 (new keyword required
2917 to override) instead of having each member implement this.
2919 (MemberCore.Define): New abstract method, we will be using this in
2920 the warning reporting engine in Populate.
2922 (Operator.Define): Adjust to new MemberCore protocol.
2924 * const.cs (Const): This does not derive from Expression, it is a
2925 temporary object we use to create fields, it is a MemberCore.
2927 * class.cs (Method.Define): Allow the entry point to be in a
2930 * driver.cs: Rewrite the argument handler to clean it up a bit.
2932 * rootcontext.cs: Made it just an auxiliary namespace feature by
2933 making everything static.
2935 * driver.cs: Adapt code to use RootContext type name instead of
2938 * delegate.cs: Remove RootContext argument.
2940 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
2943 * class.cs (Event.Define): The lookup can fail.
2945 * cs-tokenizer.cs: Begin implementation of pre-procesor.
2947 * expression.cs: Resolve the this instance before invoking the code.
2949 2001-12-17 Miguel de Icaza <miguel@ximian.com>
2951 * cs-parser.jay: Add a production in element_access that allows
2952 the thing to become a "type" reference. This way we can parse
2953 things like "(string [])" as a type.
2955 Note that this still does not handle the more complex rules of
2959 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
2961 * ecore.cs: (CopyNewMethods): new utility function used to
2962 assemble the list of methods from running FindMembers.
2964 (MemberLookup): Rework FindMembers so that
2966 2001-12-16 Miguel de Icaza <miguel@ximian.com>
2968 * class.cs (TypeContainer): Remove Delegates who fail to be
2971 * delegate.cs (Populate): Verify that we dont get null return
2972 values. TODO: Check for AsAccessible.
2974 * cs-parser.jay: Use basename to emit error 574 (destructor should
2975 have the same name as container class), not the full name.
2977 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
2978 possible representation.
2980 Also implements integer type suffixes U and L.
2982 2001-12-15 Miguel de Icaza <miguel@ximian.com>
2984 * expression.cs (ArrayCreation.DoResolve): We need to do the
2985 argument resolution *always*.
2987 * decl.cs: Make this hold the namespace. Hold the root context as
2989 (LookupType): Move here.
2991 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
2993 * location.cs (Row, Name): Fixed the code, it was always returning
2994 references to the first file.
2996 * interface.cs: Register properties defined through interfaces.
2998 * driver.cs: Add support for globbing on the command line
3000 * class.cs (Field): Make it derive from MemberCore as well.
3003 2001-12-15 Ravi Pratap <ravi@ximian.com>
3005 * class.cs (Event::Define): Check that the type of the event is a delegate
3006 type else flag error #66.
3008 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
3011 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
3012 values of EntryPoint, CharSet etc etc.
3014 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
3016 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
3017 be null and we should ignore this. I am not sure if this is really clean. Apparently,
3018 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
3019 which needs this to do its work.
3021 * ../errors/cs0066.cs : Add.
3023 2001-12-14 Miguel de Icaza <miguel@ximian.com>
3025 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
3028 * class.cs: (MethodSignature.MethodSignature): Removed hack that
3029 clears out the parameters field.
3030 (MemberSignatureCompare): Cleanup
3032 (MemberCore): New base class used to share code between MethodCore
3035 (RegisterRequiredImplementations) BindingFlags.Public requires
3036 either BindingFlags.Instace or Static. Use instance here.
3038 (Property): Refactored code to cope better with the full spec.
3040 * parameter.cs (GetParameterInfo): Return an empty array instead
3043 * class.cs (Property): Abstract or extern properties have no bodies.
3045 * parameter.cs (GetParameterInfo): return a zero-sized array.
3047 * class.cs (TypeContainer.MethodModifiersValid): Move all the
3048 method modifier validation to the typecontainer so we can reuse
3051 (MethodCore.ParameterTypes): return an empty sized array of types.
3053 (Property.Define): Test property modifier validity.
3055 Add tests for sealed/override too.
3057 (Method.Emit): abstract or extern methods have no bodies.
3059 2001-12-14 Ravi Pratap <ravi@ximian.com>
3061 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
3064 (Method::Define, ::Emit): Modify accordingly.
3066 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
3068 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
3070 * makefile: Pass in /unsafe.
3072 2001-12-13 Miguel de Icaza <miguel@ximian.com>
3074 * class.cs (MakeKey): Kill routine.
3076 * class.cs (TypeContainer.Define): Correctly define explicit
3077 method implementations (they require the full interface name plus
3080 * typemanager.cs: Deply the PtrHashtable here and stop using the
3081 lame keys. Things work so much better.
3083 This of course broke everyone who depended on `RegisterMethod' to
3084 do the `test for existance' test. This has to be done elsewhere.
3086 * support.cs (PtrHashtable): A hashtable that avoid comparing with
3087 the object stupid Equals method (because, that like fails all over
3088 the place). We still do not use it.
3090 * class.cs (TypeContainer.SetRequiredInterface,
3091 TypeContainer.RequireMethods): Killed these two routines and moved
3092 all the functionality to RegisterRequiredImplementations.
3094 (TypeContainer.RegisterRequiredImplementations): This routine now
3095 registers all the implementations required in an array for the
3096 interfaces and abstract methods. We use an array of structures
3097 which can be computed ahead of time to reduce memory usage and we
3098 also assume that lookups are cheap as most classes will not
3099 implement too many interfaces.
3101 We also avoid creating too many MethodSignatures.
3103 (TypeContainer.IsInterfaceMethod): Update and optionally does not
3104 clear the "pending" bit if we find that there are problems with
3107 (TypeContainer.VerifyPendingMethods): Update to report errors of
3108 methods that look like implementations but are not.
3110 (TypeContainer.Define): Add support for explicit interface method
3113 2001-12-12 Miguel de Icaza <miguel@ximian.com>
3115 * typemanager.cs: Keep track of the parameters here instead of
3116 being a feature of the TypeContainer.
3118 * class.cs: Drop the registration of parameters here, as
3119 InterfaceMethods are also interface declarations.
3121 * delegate.cs: Register methods with the TypeManager not only with
3122 the TypeContainer. This code was buggy.
3124 * interface.cs: Full registation here.
3126 2001-12-11 Miguel de Icaza <miguel@ximian.com>
3128 * expression.cs: Remove reducer for binary expressions, it can not
3131 * const.cs: Put here the code that used to go into constant.cs
3133 * constant.cs: Put here the code for constants, this is a new base
3136 * literal.cs: Make Literal derive from Constant.
3138 2001-12-09 Miguel de Icaza <miguel@ximian.com>
3140 * statement.cs (Return.Emit): Report error 157 if the user
3141 attempts to return from a finally block.
3143 (Return.Emit): Instead of emitting a return, jump to the end of
3146 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
3147 LocalBuilder to store the result of the function. ReturnLabel is
3148 the target where we jump.
3151 2001-12-09 Radek Doulik <rodo@ximian.com>
3153 * cs-parser.jay: remember alias in current namespace
3155 * ecore.cs (SimpleName::DoResolve): use aliases for types or
3158 * class.cs (LookupAlias): lookup alias in my_namespace
3160 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
3162 (LookupAlias): lookup alias in this and if needed in parent
3165 2001-12-08 Miguel de Icaza <miguel@ximian.com>
3169 * rootcontext.cs: (ModuleBuilder) Made static, first step into
3170 making things static. I need this to avoid passing the
3171 TypeContainer when calling ParameterType.
3173 * support.cs (InternalParameters.ParameterType): Remove ugly hack
3174 that did string manipulation to compute the type and then call
3175 GetType. Use Parameter.ParameterType instead.
3177 * cs-tokenizer.cs: Consume the suffix for floating values.
3179 * expression.cs (ParameterReference): figure out whether this is a
3180 reference parameter or not. Kill an extra variable by computing
3181 the arg_idx during emission.
3183 * parameter.cs (Parameters.GetParameterInfo): New overloaded
3184 function that returns whether a parameter is an out/ref value or not.
3186 (Parameter.ParameterType): The type of the parameter (base,
3187 without ref/out applied).
3189 (Parameter.Resolve): Perform resolution here.
3190 (Parameter.ExternalType): The full type (with ref/out applied).
3192 * statement.cs (Using.Emit, Using.EmitExpression): Implement
3193 support for expressions on the using statement.
3195 2001-12-07 Miguel de Icaza <miguel@ximian.com>
3197 * statement.cs (Using.EmitLocalVariableDecls): Split the
3198 localvariable handling of the using statement.
3200 (Block.EmitMeta): Keep track of variable count across blocks. We
3201 were reusing slots on separate branches of blocks.
3203 (Try.Emit): Emit the general code block, we were not emitting it.
3205 Check the type of the declaration to be an IDisposable or
3206 something that can be implicity converted to it.
3208 Emit conversions if required.
3210 * ecore.cs (EmptyExpression): New utility class.
3211 (Expression.ImplicitConversionExists): New utility function.
3213 2001-12-06 Miguel de Icaza <miguel@ximian.com>
3215 * statement.cs (Using): Implement.
3217 * expression.cs (LocalVariableReference): Support read only variables.
3219 * statement.cs: Remove the explicit emit for the Leave opcode.
3220 (VariableInfo): Add a readonly field.
3222 2001-12-05 Miguel de Icaza <miguel@ximian.com>
3224 * ecore.cs (ConvCast): new class used to encapsulate the various
3225 explicit integer conversions that works in both checked and
3228 (Expression.ConvertNumericExplicit): Use new ConvCast class to
3229 properly generate the overflow opcodes.
3231 2001-12-04 Miguel de Icaza <miguel@ximian.com>
3233 * statement.cs: The correct type for the EmptyExpression is the
3234 element_type, not the variable type. Ravi pointed this out.
3236 2001-12-04 Ravi Pratap <ravi@ximian.com>
3238 * class.cs (Method::Define): Handle PInvoke methods specially
3239 by using DefinePInvokeMethod instead of the usual one.
3241 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
3242 above to do the task of extracting information and defining the method.
3244 2001-12-04 Ravi Pratap <ravi@ximian.com>
3246 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
3247 of the condition for string type.
3249 (Emit): Move that here.
3251 (ArrayCreation::CheckIndices): Keep string literals in their expression
3254 (EmitDynamicInitializers): Handle strings appropriately.
3256 2001-12-04 Miguel de Icaza <miguel@ximian.com>
3258 * codegen.cs (EmitContext): Replace multiple variables with a
3259 single pointer to the current Switch statement.
3261 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
3264 2001-12-03 Miguel de Icaza <miguel@ximian.com>
3268 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
3271 (Foreach.Emit): Foreach on arrays was not setting
3272 up the loop variables (for break/continue).
3274 (GotoCase): Semi-implented.
3276 2001-12-03 Ravi Pratap <ravi@ximian.com>
3278 * attribute.cs (CheckAttribute): Handle system attributes by using
3279 Attribute.GetAttributes to examine information we need.
3281 (GetValidPlaces): Same here.
3283 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
3285 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
3287 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
3289 (Method::Define): Set appropriate flags if we have a DllImport attribute.
3291 (Method::Emit): Handle the case when we are a PInvoke method.
3293 2001-12-03 Miguel de Icaza <miguel@ximian.com>
3295 * expression.cs: Use ResolveWithSimpleName on compound names.
3297 2001-12-02 Ravi Pratap <ravi@ximian.com>
3299 * constant.cs (EmitConstant): Make sure we resolve the associated expression
3300 before trying to reduce it.
3302 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
3304 * constant.cs (LookupConstantValue): Implement.
3306 (EmitConstant): Use the above in emitting the constant.
3308 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
3309 that are user-defined by doing a LookupConstantValue on them.
3311 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
3314 2001-11-29 Miguel de Icaza <miguel@ximian.com>
3316 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
3318 (BaseAccess.DoResolve): Implement.
3320 (MemberAccess.DoResolve): Split this routine into a
3321 ResolveMemberAccess routine that can be used independently
3323 2001-11-28 Miguel de Icaza <miguel@ximian.com>
3325 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
3326 As that share bits of the implementation. Is returns a boolean,
3327 while As returns the Type that is being probed.
3329 2001-12-01 Ravi Pratap <ravi@ximian.com>
3331 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
3332 instead of a Literal - much easier.
3334 (EnumInTransit): Remove - utterly useless :-)
3336 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
3338 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
3340 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
3341 chain when we have no associated expression.
3343 2001-11-30 Ravi Pratap <ravi@ximian.com>
3345 * constant.cs (Define): Use Location while reporting the errror.
3347 Also emit a warning when 'new' is used and there is no inherited
3350 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
3353 (LookupEnumValue): Implement to lookup an enum member's value and define it
3356 (Populate): Re-write accordingly to use the above routine.
3358 2001-11-27 Miguel de Icaza <miguel@ximian.com>
3360 * expression.cs (This): Fix prototype for DoResolveLValue to
3361 override the base class DoResolveLValue.
3363 * cs-parser.cs: Report errors cs574 and cs575 (destructor
3366 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
3367 (we need to load the address of the field here). This fixes
3370 (FieldExpr.DoResolveLValue): Call the DoResolve
3371 function to initialize the Instance expression.
3373 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
3374 correctly the GetEnumerator operation on a value type.
3376 * cs-parser.jay: Add more simple parsing error catches.
3378 * statement.cs (Switch): Add support for string switches.
3379 Handle null specially.
3381 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
3383 2001-11-28 Ravi Pratap <ravi@ximian.com>
3385 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
3387 (declare_local_constant): New helper function.
3389 * statement.cs (AddConstant): Keep a separate record of constants
3391 (IsConstant): Implement to determine if a variable is a constant.
3393 (GetConstantExpression): Implement.
3395 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
3397 * statement.cs (IsVariableDefined): Re-write.
3399 2001-11-27 Ravi Pratap <ravi@ximian.com>
3401 * class.cs (TypeContainer::FindMembers): Look for constants
3402 in the case when we are looking for MemberTypes.Field
3404 * expression.cs (MemberAccess::DoResolve): Check that in the
3405 case we are a FieldExpr and a Literal, we are not being accessed
3406 by an instance reference.
3408 * cs-parser.jay (local_constant_declaration): Implement.
3410 (declaration_statement): Implement for constant declarations.
3412 2001-11-26 Miguel de Icaza <miguel@ximian.com>
3414 * statement.cs (Switch): Catch double defaults.
3416 (Switch): More work on the switch() statement
3417 implementation. It works for integral values now, need to finish
3421 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3423 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
3424 integer literals into other integer literals. To be used by
3427 2001-11-24 Ravi Pratap <ravi@ximian.com>
3429 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
3432 (EmitDynamicInitializers): Cope with the above since we extract data
3433 directly from ArrayData now.
3435 (ExpectInitializers): Keep track of whether initializers are mandatory
3438 (Bounds): Make it a hashtable to prevent the same dimension being
3439 recorded for every element in that dimension.
3441 (EmitDynamicInitializers): Fix bug which prevented the Set array method
3444 Also fix bug which was causing the indices to be emitted in the reverse
3447 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3449 * expression.cs (ArrayCreation): Implement the bits that Ravi left
3450 unfinished. They do not work, because the underlying code is
3453 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3455 * cs-parser.jay: Remove bogus fixme.
3457 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
3458 on Switch statement.
3460 2001-11-23 Ravi Pratap <ravi@ximian.com>
3462 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
3465 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
3466 parameter. Apparently, any expression is allowed.
3468 (ValidateInitializers): Update accordingly.
3470 (CheckIndices): Fix some tricky bugs thanks to recursion.
3472 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
3473 I was being completely brain-dead.
3475 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
3476 and re-write acordingly.
3478 (DelegateInvocation): Re-write accordingly.
3480 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
3482 (MakeByteBlob): Handle types more correctly.
3484 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
3485 initialization from expressions but it is incomplete because I am a complete
3488 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3490 * statement.cs (If.Emit): Fix a bug that generated incorrect code
3491 on If. Basically, we have to return `true' (ie, we do return to
3492 our caller) only if both branches of the if return.
3494 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
3495 short-circuit operators, handle them as short circuit operators.
3497 (Cast.DoResolve): Resolve type.
3498 (Cast.Cast): Take an expression as the target type.
3500 * cs-parser.jay (cast_expression): Remove old hack that only
3501 allowed a limited set of types to be handled. Now we take a
3502 unary_expression and we resolve to a type during semantic
3505 Use the grammar productions from Rhys to handle casts (this is
3506 not complete like Rhys syntax yet, we fail to handle that corner
3507 case that C# has regarding (-x), but we will get there.
3509 2001-11-22 Ravi Pratap <ravi@ximian.com>
3511 * class.cs (EmitFieldInitializer): Take care of the case when we have a
3512 field which is an array type.
3514 * cs-parser.jay (declare_local_variables): Support array initialization too.
3516 * typemanager.cs (MakeKey): Implement.
3518 (everywhere): Use the above appropriately.
3520 * cs-parser.jay (for_statement): Update for array initialization while
3521 declaring variables.
3523 * ecore.cs : The error message was correct, it's the variable's names that
3524 were misleading ;-) Make the code more readable.
3526 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
3527 the correct type etc.
3529 (ConvertExplicit): Handle Enum types by examining the underlying type.
3531 2001-11-21 Ravi Pratap <ravi@ximian.com>
3533 * parameter.cs (GetCallingConvention): Always return
3534 CallingConventions.Standard for now.
3536 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3538 * expression.cs (Binary.ResolveOperator): Update the values of `l'
3539 and `r' after calling DoNumericPromotions.
3541 * ecore.cs: Fix error message (the types were in the wrong order).
3543 * statement.cs (Foreach.ProbeCollectionType): Need to pass
3544 BindingFlags.Instance as well
3546 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
3547 implicit int literal conversion in an empty cast so that we
3548 propagate the right type upstream.
3550 (UnboxCast): new class used to unbox value types.
3551 (Expression.ConvertExplicit): Add explicit type conversions done
3554 (Expression.ImplicitNumericConversion): Oops, forgot to test for
3555 the target type before applying the implicit LongLiterals to ULong
3558 2001-11-21 Miguel de Icaza <miguel@ximian.com>
3560 * cs-parser.jay (for_statement): Reworked the way For works: now
3561 we declare manually any variables that are introduced in
3562 for_initializer to solve the problem of having out-of-band code
3563 emition (that is what got for broken).
3565 (declaration_statement): Perform the actual variable declaration
3566 that used to be done in local_variable_declaration here.
3568 (local_variable_declaration): Do not declare anything, just pass
3569 the information on a DictionaryEntry
3571 2001-11-20 Ravi Pratap <ravi@ximian.com>
3573 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
3574 re-write of the logic to now make it recursive.
3576 (UpdateIndices): Re-write accordingly.
3578 Store element data in a separate ArrayData list in the above methods.
3580 (MakeByteBlob): Implement to dump the array data into a byte array.
3582 2001-11-19 Ravi Pratap <ravi@ximian.com>
3584 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
3587 * constant.cs (Define): Implement.
3589 (EmitConstant): Re-write fully.
3591 Pass in location info.
3593 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
3596 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
3597 DictionaryEntry since we need location info too.
3599 (constant_declaration): Update accordingly.
3601 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
3602 code into another method : UpdateIndices.
3604 2001-11-18 Ravi Pratap <ravi@ximian.com>
3606 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
3607 some type checking etc.
3609 2001-11-17 Ravi Pratap <ravi@ximian.com>
3611 * expression.cs (ArrayCreation::ValidateInitializers): Implement
3612 bits to provide dimension info if the user skips doing that.
3614 Update second constructor to store the rank correctly.
3616 2001-11-16 Ravi Pratap <ravi@ximian.com>
3618 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
3619 and try to implement.
3621 * ../errors/cs0150.cs : Add.
3623 * ../errors/cs0178.cs : Add.
3625 2001-11-16 Miguel de Icaza <miguel@ximian.com>
3627 * statement.cs: Implement foreach on multi-dimensional arrays.
3629 * parameter.cs (Parameters.GetParameterByName): Also lookup the
3630 name of the params argument.
3632 * expression.cs: Use EmitStoreOpcode to get the right opcode while
3633 initializing the array.
3635 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
3636 we can use this elsewhere.
3638 * statement.cs: Finish implementation of foreach for single
3641 * cs-parser.jay: Use an out-of-band stack to pass information
3642 around, I wonder why I need this.
3644 foreach_block: Make the new foreach_block the current_block.
3646 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
3647 function used to return a static Parameters structure. Used for
3648 empty parameters, as those are created very frequently.
3650 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
3652 2001-11-15 Ravi Pratap <ravi@ximian.com>
3654 * interface.cs : Default modifier is private, not public. The
3655 make verify test passes again.
3657 2001-11-15 Ravi Pratap <ravi@ximian.com>
3659 * support.cs (ReflectionParameters): Fix logic to determine
3660 whether the last parameter is a params one. Test 9 passes again.
3662 * delegate.cs (Populate): Register the builders we define with
3663 RegisterParameterForBuilder. Test 19 passes again.
3665 * cs-parser.jay (property_declaration): Reference $6 instead
3666 of $$ to get at the location.
3668 (indexer_declaration): Similar stuff.
3672 * class.cs (Property): Register parameters for the Get and Set methods
3673 if they exist. Test 23 passes again.
3675 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
3676 call to EmitArguments as we are sure there aren't any params arguments.
3677 Test 32 passes again.
3679 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
3680 IndexOutOfRangeException.
3682 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
3683 Test 33 now passes again.
3685 2001-11-15 Miguel de Icaza <miguel@ximian.com>
3687 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
3688 broke a bunch of things. Will have to come up with a better way
3689 of tracking locations.
3691 * statement.cs: Implemented foreach for single dimension arrays.
3693 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3695 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
3696 an error. This removes the lookup from the critical path.
3698 * cs-parser.jay: Removed use of temporary_loc, which is completely
3701 2001-11-14 Miguel de Icaza <miguel@ximian.com>
3703 * support.cs (ReflectionParameters.ParameterModifier): Report
3704 whether the argument is a PARAMS argument or not.
3706 * class.cs: Set the attribute `ParamArrayAttribute' on the
3709 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
3710 and cons_param_array_attribute (ConstructorInfo for
3711 ParamArrayAttribute).,
3713 * codegen.cs: Emit the return using the `Return' statement, that
3714 way we can report the error correctly for missing return values.
3716 * class.cs (Method.Emit): Clean up.
3718 * expression.cs (Argument.Resolve): Take another argument: the
3719 location where this argument is used. Notice that this is not
3720 part of the "Argument" class as to reduce the size of the
3721 structure (we know the approximate location anyways).
3723 Test if the argument is a variable-reference, if not, then
3724 complain with a 206.
3726 (Argument.Emit): Emit addresses of variables.
3728 (Argument.FullDesc): Simplify.
3730 (Invocation.DoResolve): Update for Argument.Resolve.
3732 (ElementAccess.DoResolve): ditto.
3734 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
3735 method should be virtual, as this method is always virtual.
3737 (NewDelegate.DoResolve): Update for Argument.Resolve.
3739 * class.cs (ConstructorInitializer.DoResolve): ditto.
3741 * attribute.cs (Attribute.Resolve): ditto.
3743 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3745 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
3747 * expression.cs (ParameterReference): Drop IStackStorage and implement
3748 IAssignMethod instead.
3750 (LocalVariableReference): ditto.
3752 * ecore.cs (FieldExpr): Drop IStackStorage and implement
3753 IAssignMethod instead.
3755 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3757 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
3758 enumerations that are used in heavily used structures derive from
3759 byte in a laughable and pathetic attempt to reduce memory usage.
3760 This is the kind of pre-optimzations that you should not do at
3761 home without adult supervision.
3763 * expression.cs (UnaryMutator): New class, used to handle ++ and
3764 -- separatedly from the other unary operators. Cleans up the
3765 code, and kills the ExpressionStatement dependency in Unary.
3767 (Unary): Removed `method' and `Arguments' from this class, making
3768 it smaller, and moving it all to SimpleCall, so I can reuse this
3769 code in other locations and avoid creating a lot of transient data
3770 strucutres when not required.
3772 * cs-parser.jay: Adjust for new changes.
3774 2001-11-11 Miguel de Icaza <miguel@ximian.com>
3776 * enum.cs (Enum.Populate): If there is a failure during
3779 * cs-parser.jay (opt_enum_base): we used to catch type errors
3780 here, but this is really incorrect. The type error should be
3781 catched during semantic analysis.
3783 2001-12-11 Ravi Pratap <ravi@ximian.com>
3785 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
3786 current_local_parameters as expected since I, in my stupidity, had forgotten
3789 * attribute.cs (GetValidPlaces): Fix stupid bug.
3791 * class.cs (Method::Emit): Perform check on applicability of attributes.
3793 (Constructor::Emit): Ditto.
3795 (Field::Emit): Ditto.
3797 (Field.Location): Store location information.
3799 (Property, Event, Indexer, Operator): Ditto.
3801 * cs-parser.jay (field_declaration): Pass in location for each field.
3803 * ../errors/cs0592.cs : Add.
3805 2001-11-12 Ravi Pratap <ravi@ximian.com>
3807 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
3809 (InitCoreTypes): Update accordingly.
3811 (RegisterAttrType, LookupAttr): Implement.
3813 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
3814 info about the same.
3816 (Resolve): Update to populate the above as necessary.
3820 (GetValidPlaces): Helper to the above.
3822 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
3824 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
3826 2001-11-12 Ravi Pratap <ravi@ximian.com>
3828 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
3830 * ../errors/cs0617.cs : Add.
3832 2001-11-11 Ravi Pratap <ravi@ximian.com>
3834 * enum.cs (Emit): Rename to Populate to be more consistent with what
3835 we expect it to do and when exactly it is called.
3837 * class.cs, rootcontext.cs : Update accordingly.
3839 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
3840 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
3842 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
3844 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
3845 of a fieldinfo using the above, when dealing with a FieldBuilder.
3847 2001-11-10 Ravi Pratap <ravi@ximian.com>
3849 * ../errors/cs0031.cs : Add.
3851 * ../errors/cs1008.cs : Add.
3853 * ../errrors/cs0543.cs : Add.
3855 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
3858 (FindMembers): Implement.
3860 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
3861 enums and delegates too.
3863 (enum_types): Rename to builder_to_enum.
3865 (delegate_types): Rename to builder_to_delegate.
3867 * delegate.cs (FindMembers): Implement.
3869 2001-11-09 Ravi Pratap <ravi@ximian.com>
3871 * typemanager.cs (IsEnumType): Implement.
3873 * enum.cs (Emit): Re-write parts to account for the underlying type
3874 better and perform checking etc.
3876 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
3877 of the underlying type.
3879 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
3882 * enum.cs (error31): Helper to report error #31.
3884 * cs-parser.jay (enum_declaration): Store location of each member too.
3886 * enum.cs (member_to_location): New hashtable.
3888 (AddEnumMember): Update location hashtable.
3890 (Emit): Use the location of each member while reporting errors.
3892 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3894 * cs-parser.jay: A for_initializer if is a
3895 local_variable_declaration really ammount to have an implicit
3896 block with the variable declaration and no initializer for for.
3898 * statement.cs (For.Emit): Cope with null initializers.
3900 This fixes the infinite loop on for initializers.
3902 2001-11-08 Miguel de Icaza <miguel@ximian.com>
3904 * enum.cs: More cleanup.
3906 * ecore.cs: Remove dead code.
3908 * class.cs (Property.Emit): More simplification.
3909 (Event.Emit): ditto.
3911 Reworked to have less levels of indentation.
3913 2001-11-08 Ravi Pratap <ravi@ximian.com>
3915 * class.cs (Property): Emit attributes.
3925 * enum.cs (Emit): Ditto.
3927 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
3930 * class.cs (Field, Event, etc.): Move attribute generation into the
3931 Emit method everywhere.
3933 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
3934 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
3935 as we had no way of defining nested enums !
3937 * rootcontext.cs : Adjust code accordingly.
3939 * typemanager.cs (AddEnumType): To keep track of enum types separately.
3941 2001-11-07 Ravi Pratap <ravi@ximian.com>
3943 * expression.cs (EvalConstantExpression): Move into ecore.cs
3945 * enum.cs (Enum): Rename some members and make them public and readonly
3946 according to our convention.
3948 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
3951 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
3953 (Enum::Emit): Write a simple version for now which doesn't try to compute
3954 expressions. I shall modify this to be more robust in just a while.
3956 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
3958 (TypeContainer::CloseType): Create the Enum types too.
3960 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
3962 * expression.cs (EvalConstantExpression): Get rid of completely.
3964 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
3965 user-defined values and other cases.
3967 (IsValidEnumLiteral): Helper function.
3969 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
3970 out there in the case we had a literal FieldExpr.
3972 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
3974 (Literalize): Revamp a bit to take two arguments.
3976 (EnumLiteral): New class which derives from Literal to wrap enum literals.
3978 2001-11-06 Ravi Pratap <ravi@ximian.com>
3980 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
3982 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
3984 (Resolve): Use the above to ensure we have proper initializers.
3986 2001-11-05 Ravi Pratap <ravi@ximian.com>
3988 * expression.cs (Expression::EvalConstantExpression): New method to
3989 evaluate constant expressions.
3991 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
3993 2001-11-07 Miguel de Icaza <miguel@ximian.com>
3995 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
3998 (Binary.ResolveOperator): Handle operator != (object a, object b)
3999 and operator == (object a, object b);
4001 (Binary.DoNumericPromotions): Indicate whether the numeric
4002 promotion was possible.
4004 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
4007 Made the ArrayAccess implement interface IAssignMethod instead of
4008 IStackStore as the order in which arguments are passed reflects
4011 * assign.cs: Instead of using expr.ExprClass to select the way of
4012 assinging, probe for the IStackStore/IAssignMethod interfaces.
4014 * typemanager.cs: Load InitializeArray definition.
4016 * rootcontext.cs (RootContext.MakeStaticData): Used to define
4017 static data that can be used to initialize arrays.
4019 2001-11-05 Miguel de Icaza <miguel@ximian.com>
4021 * expression.cs: Handle operator== and operator!= for booleans.
4023 (Conditioal.Reduce): Implement reducer for the ?: operator.
4025 (Conditional.Resolve): Implement dead code elimination.
4027 (Binary.Resolve): Catch string literals and return a new
4028 concatenated string.
4030 (Unary.Reduce): Implement reduction of unary expressions.
4032 * ecore.cs: Split out the expression core handling here.
4034 (Expression.Reduce): New method used to perform constant folding
4035 and CSE. This is needed to support constant-expressions.
4037 * statement.cs (Statement.EmitBoolExpression): Pass true and false
4038 targets, and optimize for !x.
4040 2001-11-04 Ravi Pratap <ravi@ximian.com>
4042 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
4043 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
4044 set custom atttributes.
4046 * literal.cs (Literal::GetValue): New abstract method to return the actual
4047 value of the literal, cast as an object.
4049 (*Literal): Implement GetValue method.
4051 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
4052 expressions to the arraylist but objects of type Argument.
4054 * class.cs (TypeContainer::Emit): Emit our attributes too.
4056 (Method::Emit, Constructor::Emit): Ditto.
4058 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
4059 to be ignoring earlier.
4061 2001-11-03 Ravi Pratap <ravi@ximian.com>
4063 * attribute.cs (AttributeSection::Define): Implement to do the business
4064 of constructing a CustomAttributeBuilder.
4066 (Attribute): New trivial class. Increases readability of code.
4068 * cs-parser.jay : Update accordingly.
4070 (positional_argument_list, named_argument_list, named_argument): New rules
4072 (attribute_arguments): Use the above so that we are more correct.
4074 2001-11-02 Ravi Pratap <ravi@ximian.com>
4076 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
4077 to perform all checks for a method with a params parameter.
4079 (Invocation::OverloadResolve): Update to use the above method and therefore
4080 cope correctly with params method invocations.
4082 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
4085 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
4086 constructors in our parent too because we can't afford to miss out on
4089 * attribute.cs (AttributeSection): New name for the class Attribute
4091 Other trivial changes to improve readability.
4093 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
4094 use the new class names.
4096 2001-11-01 Ravi Pratap <ravi@ximian.com>
4098 * class.cs (Method::Define): Complete definition for params types too
4100 (Indexer::Define): Ditto.
4102 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
4103 Cope everywhere with a request for info about the array parameter.
4105 2001-11-01 Ravi Pratap <ravi@ximian.com>
4107 * tree.cs (RecordNamespace): Fix up to check for the correct key.
4109 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
4110 local_variable_type to extract the string corresponding to the type.
4112 (local_variable_type): Fixup the action to use the new helper method.
4114 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
4117 * expression.cs : Clean out code which uses the above.
4119 2001-10-31 Ravi Pratap <ravi@ximian.com>
4121 * typemanager.cs (RegisterMethod): Check if we already have an existing key
4122 and bale out if necessary by returning a false.
4124 (RegisterProperty): Ditto.
4126 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
4127 and print out appropriate error messages.
4129 * interface.cs (everywhere): Ditto.
4131 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
4132 location to constructor.
4134 * class.cs (Property, Event, Indexer): Update accordingly.
4136 * ../errors/cs111.cs : Added.
4138 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
4139 of a method, as laid down by the spec.
4141 (Invocation::OverloadResolve): Use the above method.
4143 2001-10-31 Ravi Pratap <ravi@ximian.com>
4145 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
4146 now take a TypeContainer and a Parameters object.
4148 (ParameterData): Modify return type of ParameterModifier method to be
4149 Parameter.Modifier and not a string.
4151 (ReflectionParameters, InternalParameters): Update accordingly.
4153 * expression.cs (Argument::GetParameterModifier): Same here.
4155 * support.cs (InternalParameters::ParameterType): Find a better way of determining
4156 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
4157 symbol in it at all so maybe this is only for now.
4159 2001-10-30 Ravi Pratap <ravi@ximian.com>
4161 * support.cs (InternalParameters): Constructor now takes an extra argument
4162 which is the actual Parameters class.
4164 (ParameterDesc): Update to provide info on ref/out modifiers.
4166 * class.cs (everywhere): Update call to InternalParameters to pass in
4167 the second argument too.
4169 * support.cs (ParameterData): Add ParameterModifier, which is a method
4170 to return the modifier info [ref/out etc]
4172 (InternalParameters, ReflectionParameters): Implement the above.
4174 * expression.cs (Argument::ParameterModifier): Similar function to return
4175 info about the argument's modifiers.
4177 (Invocation::OverloadResolve): Update to take into account matching modifiers
4180 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
4181 a new SetFormalParameters object which we pass to InternalParameters.
4183 2001-10-30 Ravi Pratap <ravi@ximian.com>
4185 * expression.cs (NewArray): Merge into the ArrayCreation class.
4187 2001-10-29 Ravi Pratap <ravi@ximian.com>
4189 * expression.cs (NewArray): Merge classes NewBuiltinArray and
4190 NewUserdefinedArray into one as there wasn't much of a use in having
4193 * expression.cs (Argument): Change field's name to ArgType from Type.
4195 (Type): New readonly property which returns the proper type, taking into
4196 account ref/out modifiers.
4198 (everywhere): Adjust code accordingly for the above.
4200 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
4201 whether we are emitting for a ref or out parameter.
4203 * expression.cs (Argument::Emit): Use the above field to set the state.
4205 (LocalVariableReference::Emit): Update to honour the flag and emit the
4208 * parameter.cs (Attributes): Set the correct flags for ref parameters.
4210 * expression.cs (Argument::FullDesc): New function to provide a full desc.
4212 * support.cs (ParameterData): Add method ParameterDesc to the interface.
4214 (ReflectionParameters, InternalParameters): Implement the above method.
4216 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
4219 (Invocation::FullMethodDesc): Ditto.
4221 2001-10-29 Miguel de Icaza <miguel@ximian.com>
4223 * cs-parser.jay: Add extra production for the second form of array
4226 * expression.cs (ArrayCreation): Update to reflect the above
4229 * Small changes to prepare for Array initialization.
4231 2001-10-28 Miguel de Icaza <miguel@ximian.com>
4233 * typemanager.cs (ImplementsInterface): interface might be null;
4234 Deal with this problem;
4236 Also, we do store negative hits on the cache (null values), so use
4237 this instead of calling t.GetInterfaces on the type everytime.
4239 2001-10-28 Ravi Pratap <ravi@ximian.com>
4241 * typemanager.cs (IsBuiltinType): New method to help determine the same.
4243 * expression.cs (New::DoResolve): Get rid of array creation code and instead
4244 split functionality out into different classes.
4246 (New::FormArrayType): Move into NewBuiltinArray.
4248 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
4251 (NewBuiltinArray): New class to handle creation of built-in arrays.
4253 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
4254 account creation of one-dimensional arrays.
4256 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
4258 (NewUserdefinedArray::DoResolve): Implement.
4260 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
4262 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
4263 we maintain inside the TypeManager. This is necessary to perform lookups on the
4266 (LookupType): Update to perform GetType on the module builders too.
4268 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
4270 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
4272 2001-10-23 Ravi Pratap <ravi@ximian.com>
4274 * expression.cs (New::DoResolve): Implement guts of array creation.
4276 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
4278 2001-10-27 Miguel de Icaza <miguel@ximian.com>
4280 * expression.cs: Fix bug I introduced lsat night that broke
4283 (Expression.Resolve): Report a 246 error (can not resolve name)
4284 if we find a SimpleName in the stream.
4286 (Expression.ResolveLValue): Ditto.
4288 (Expression.ResolveWithSimpleName): This function is a variant of
4289 ResolveName, this one allows SimpleNames to be returned without a
4290 warning. The only consumer of SimpleNames is MemberAccess
4292 2001-10-26 Miguel de Icaza <miguel@ximian.com>
4294 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
4295 might arrive here. I have my doubts that this is correct.
4297 * statement.cs (Lock): Implement lock statement.
4299 * cs-parser.jay: Small fixes to support `lock' and `using'
4301 * cs-tokenizer.cs: Remove extra space
4303 * driver.cs: New flag --checked, allows to turn on integer math
4306 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
4307 Threading.Monitor.Exit
4309 2001-10-23 Miguel de Icaza <miguel@ximian.com>
4311 * expression.cs (IndexerAccess::DoResolveLValue): Set the
4312 Expression Class to be IndexerAccess.
4314 Notice that Indexer::DoResolve sets the eclass to Value.
4316 2001-10-22 Miguel de Icaza <miguel@ximian.com>
4318 * class.cs (TypeContainer::Emit): Emit code for indexers.
4320 * assign.cs (IAssignMethod): New interface implemented by Indexers
4321 and Properties for handling assignment.
4323 (Assign::Emit): Simplify and reuse code.
4325 * expression.cs (IndexerAccess, PropertyExpr): Implement
4326 IAssignMethod, clean up old code.
4328 2001-10-22 Ravi Pratap <ravi@ximian.com>
4330 * typemanager.cs (ImplementsInterface): New method to determine if a type
4331 implements a given interface. Provides a nice cache too.
4333 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
4336 (ConvertReferenceExplicit): Ditto.
4338 * delegate.cs (Delegate::Populate): Update to define the parameters on the
4339 various methods, with correct names etc.
4341 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
4342 Operator.UnaryNegation.
4344 * cs-parser.jay (operator_declarator): Be a little clever in the case where
4345 we have a unary plus or minus operator.
4347 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
4350 * everywhere : update accordingly.
4352 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
4355 * class.cs (Method::Define): For the case where we are implementing a method
4356 inherited from an interface, we need to set the MethodAttributes.Final flag too.
4357 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
4359 2001-10-21 Ravi Pratap <ravi@ximian.com>
4361 * interface.cs (FindMembers): Implement to work around S.R.E
4364 * typemanager.cs (IsInterfaceType): Implement.
4366 (FindMembers): Update to handle interface types too.
4368 * expression.cs (ImplicitReferenceConversion): Re-write bits which
4369 use IsAssignableFrom as that is not correct - it doesn't work.
4371 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
4372 and accordingly override EmitStatement.
4374 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
4375 using the correct logic :-)
4377 2001-10-19 Ravi Pratap <ravi@ximian.com>
4379 * ../errors/cs-11.cs : Add to demonstrate error -11
4381 2001-10-17 Miguel de Icaza <miguel@ximian.com>
4383 * assign.cs (Assign::Resolve): Resolve right hand side first, and
4384 then pass this as a hint to ResolveLValue.
4386 * expression.cs (FieldExpr): Add Location information
4388 (FieldExpr::LValueResolve): Report assignment to readonly
4391 (Expression::ExprClassFromMemberInfo): Pass location information.
4393 (Expression::ResolveLValue): Add new method that resolves an
4396 (Expression::DoResolveLValue): Default invocation calls
4399 (Indexers): New class used to keep track of indexers in a given
4402 (IStackStore): Renamed from LValue, as it did not really describe
4403 what this did. Also ResolveLValue is gone from this interface and
4404 now is part of Expression.
4406 (ElementAccess): Depending on the element access type
4408 * typemanager.cs: Add `indexer_name_type' as a Core type
4409 (System.Runtime.CompilerServices.IndexerNameAttribute)
4411 * statement.cs (Goto): Take a location.
4413 2001-10-18 Ravi Pratap <ravi@ximian.com>
4415 * delegate.cs (Delegate::VerifyDelegate): New method to verify
4416 if two delegates are compatible.
4418 (NewDelegate::DoResolve): Update to take care of the case when
4419 we instantiate a delegate from another delegate.
4421 * typemanager.cs (FindMembers): Don't even try to look up members
4422 of Delegate types for now.
4424 2001-10-18 Ravi Pratap <ravi@ximian.com>
4426 * delegate.cs (NewDelegate): New class to take care of delegate
4429 * expression.cs (New): Split the delegate related code out into
4430 the NewDelegate class.
4432 * delegate.cs (DelegateInvocation): New class to handle delegate
4435 * expression.cs (Invocation): Split out delegate related code into
4436 the DelegateInvocation class.
4438 2001-10-17 Ravi Pratap <ravi@ximian.com>
4440 * expression.cs (New::DoResolve): Implement delegate creation fully
4441 and according to the spec.
4443 (New::DoEmit): Update to handle delegates differently.
4445 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
4446 because of which we were printing out arguments in reverse order !
4448 * delegate.cs (VerifyMethod): Implement to check if the given method
4449 matches the delegate.
4451 (FullDelegateDesc): Implement.
4453 (VerifyApplicability): Implement.
4455 * expression.cs (Invocation::DoResolve): Update to accordingly handle
4456 delegate invocations too.
4458 (Invocation::Emit): Ditto.
4460 * ../errors/cs1593.cs : Added.
4462 * ../errors/cs1594.cs : Added.
4464 * delegate.cs (InstanceExpression, TargetMethod): New properties.
4466 2001-10-16 Ravi Pratap <ravi@ximian.com>
4468 * typemanager.cs (intptr_type): Core type for System.IntPtr
4470 (InitCoreTypes): Update for the same.
4472 (iasyncresult_type, asynccallback_type): Ditto.
4474 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
4477 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
4480 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
4481 the builders for the 4 members of a delegate type :-)
4483 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
4486 * expression.cs (New::DoResolve): Implement guts for delegate creation.
4488 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
4490 2001-10-15 Miguel de Icaza <miguel@ximian.com>
4492 * statement.cs (Break::Emit): Implement.
4493 (Continue::Emit): Implement.
4495 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
4496 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
4497 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
4498 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
4501 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
4502 properties that track the label for the current loop (begin of the
4503 loop and end of the loop).
4505 2001-10-15 Ravi Pratap <ravi@ximian.com>
4507 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
4508 use of emitting anything at all.
4510 * class.cs, rootcontext.cs : Get rid of calls to the same.
4512 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
4514 (Populate): Define the constructor correctly and set the implementation
4517 * typemanager.cs (delegate_types): New hashtable to hold delegates that
4520 (AddDelegateType): Implement.
4522 (IsDelegateType): Implement helper method.
4524 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
4526 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
4527 and accordingly handle it.
4529 * delegate.cs (Populate): Take TypeContainer argument.
4530 Implement bits to define the Invoke method. However, I still haven't figured out
4531 how to take care of the native int bit :-(
4533 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
4534 Qualify the name of the delegate, not its return type !
4536 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
4539 (StandardConversionExists): Checking for array types turns out to be recursive.
4541 (ConvertReferenceExplicit): Implement array conversion.
4543 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
4545 2001-10-12 Ravi Pratap <ravi@ximian.com>
4547 * cs-parser.jay (delegate_declaration): Store the fully qualified
4548 name as it is a type declaration.
4550 * delegate.cs (ReturnType, Name): Rename members to these. Make them
4553 (DefineDelegate): Renamed from Define. Does the same thing essentially,
4554 as TypeContainer::DefineType.
4556 (Populate): Method in which all the definition of the various methods (Invoke)
4559 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
4562 (CloseDelegate): Finally creates the delegate.
4564 * class.cs (TypeContainer::DefineType): Update to define delegates.
4565 (Populate, Emit and CloseType): Do the same thing here too.
4567 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
4568 delegates in all these operations.
4570 2001-10-14 Miguel de Icaza <miguel@ximian.com>
4572 * expression.cs: LocalTemporary: a new expression used to
4573 reference a temporary that has been created.
4575 * assign.cs: Handle PropertyAccess back here, so that we can
4576 provide the proper semantic access to properties.
4578 * expression.cs (Expression::ConvertReferenceExplicit): Implement
4579 a few more explicit conversions.
4581 * modifiers.cs: `NEW' modifier maps to HideBySig.
4583 * expression.cs (PropertyExpr): Make this into an
4584 ExpressionStatement, and support the EmitStatement code path.
4586 Perform get/set error checking, clean up the interface.
4588 * assign.cs: recognize PropertyExprs as targets, and if so, turn
4589 them into toplevel access objects.
4591 2001-10-12 Miguel de Icaza <miguel@ximian.com>
4593 * expression.cs: PropertyExpr::PropertyExpr: use work around the
4596 * typemanager.cs: Keep track here of our PropertyBuilders again to
4597 work around lameness in SRE.
4599 2001-10-11 Miguel de Icaza <miguel@ximian.com>
4601 * expression.cs (LValue::LValueResolve): New method in the
4602 interface, used to perform a second resolution pass for LValues.
4604 (This::DoResolve): Catch the use of this in static methods.
4606 (This::LValueResolve): Implement.
4608 (This::Store): Remove warning, assigning to `this' in structures
4611 (Invocation::Emit): Deal with invocation of
4612 methods on value types. We need to pass the address to structure
4613 methods rather than the object itself. (The equivalent code to
4614 emit "this" for structures leaves the entire structure on the
4615 stack instead of a pointer to it).
4617 (ParameterReference::DoResolve): Compute the real index for the
4618 argument based on whether the method takes or not a `this' pointer
4619 (ie, the method is static).
4621 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
4622 value types returned from functions when we need to invoke a
4623 method on the sturcture.
4626 2001-10-11 Ravi Pratap <ravi@ximian.com>
4628 * class.cs (TypeContainer::DefineType): Method to actually do the business of
4629 defining the type in the Modulebuilder or Typebuilder. This is to take
4630 care of nested types which need to be defined on the TypeBuilder using
4633 (TypeContainer::GetClassBases): Implement. Essentially the code from the
4634 methods in RootContext, only ported to be part of TypeContainer.
4636 (TypeContainer::GetInterfaceOrClass): Ditto.
4638 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
4640 * interface.cs (Interface::DefineInterface): New method. Does exactly
4641 what RootContext.CreateInterface did earlier, only it takes care of nested types
4644 (Interface::GetInterfaces): Move from RootContext here and port.
4646 (Interface::GetInterfaceByName): Same here.
4648 * rootcontext.cs (ResolveTree): Re-write.
4650 (PopulateTypes): Re-write.
4652 * class.cs (TypeContainer::Populate): Populate nested types too.
4653 (TypeContainer::Emit): Emit nested members too.
4655 * typemanager.cs (AddUserType): Do not make use of the FullName property,
4656 instead just use the name argument passed in as it is already fully
4659 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
4660 to TypeContainer mapping to see if a type is user-defined.
4662 * class.cs (TypeContainer::CloseType): Implement.
4664 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
4665 the default constructor.
4667 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
4670 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
4672 * interface.cs (CloseType): Create the type here.
4674 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
4677 Remove all the methods which are now in TypeContainer.
4679 2001-10-10 Ravi Pratap <ravi@ximian.com>
4681 * delegate.cs (Define): Re-write bits to define the delegate
4684 2001-10-10 Miguel de Icaza <miguel@ximian.com>
4686 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
4688 * expression.cs (ImplicitReferenceConversion): handle null as well
4689 as a source to convert to any reference type.
4691 * statement.cs (Return): Perform any implicit conversions to
4692 expected return type.
4694 Validate use of return statement.
4696 * codegen.cs (EmitContext): Pass the expected return type here.
4698 * class.cs (Method, Constructor, Property): Pass expected return
4699 type to EmitContext.
4701 2001-10-09 Miguel de Icaza <miguel@ximian.com>
4703 * expression.cs: Make DoResolve take an EmitContext instead of a
4706 Replaced `l' and `location' for `loc', for consistency.
4708 (Error, Warning): Remove unneeded Tc argument.
4710 * assign.cs, literal.cs, constant.cs: Update to new calling
4713 * codegen.cs: EmitContext now contains a flag indicating whether
4714 code is being generated in a static method or not.
4716 * cs-parser.jay: DecomposeQI, new function that replaces the old
4717 QualifiedIdentifier. Now we always decompose the assembled
4718 strings from qualified_identifier productions into a group of
4721 2001-10-08 Miguel de Icaza <miguel@ximian.com>
4723 * rootcontext.cs: Deal with field-less struct types correctly now
4724 by passing the size option to Define Type.
4726 * class.cs: Removed hack that created one static field.
4728 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4730 * statement.cs: Moved most of the code generation here.
4732 2001-10-09 Ravi Pratap <ravi@ximian.com>
4734 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
4737 (ElementAccess): Remove useless bits for now - keep checks as the spec
4740 2001-10-08 Ravi Pratap <ravi@ximian.com>
4742 * expression.cs (ElementAccess::DoResolve): Remove my crap code
4743 and start performing checks according to the spec.
4745 2001-10-07 Ravi Pratap <ravi@ximian.com>
4747 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
4748 rank_specifiers instead.
4750 (rank_specifiers): Change the order in which the rank specifiers are stored
4752 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
4754 * expression.cs (ElementAccess): Implement the LValue interface too.
4756 2001-10-06 Ravi Pratap <ravi@ximian.com>
4758 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
4759 except that user defined conversions are not included.
4761 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
4762 perform the conversion of the return type, if necessary.
4764 (New::DoResolve): Check whether we are creating an array or an object
4765 and accordingly do the needful.
4767 (New::Emit): Same here.
4769 (New::DoResolve): Implement guts of array creation.
4771 (New::FormLookupType): Helper function.
4773 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4775 * codegen.cs: Removed most of the code generation here, and move the
4776 corresponding code generation bits to the statement classes.
4778 Added support for try/catch/finalize and throw.
4780 * cs-parser.jay: Added support for try/catch/finalize.
4782 * class.cs: Catch static methods having the flags override,
4783 virtual or abstract.
4785 * expression.cs (UserCast): This user cast was not really doing
4786 what it was supposed to do. Which is to be born in fully resolved
4787 state. Parts of the resolution were being performed at Emit time!
4791 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4793 * expression.cs: Implicity convert the result from UserCast.
4795 2001-10-05 Ravi Pratap <ravi@ximian.com>
4797 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
4798 prevented it from working correctly.
4800 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
4801 merely ConvertImplicit.
4803 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4805 * typemanager.cs: Make the LookupTypeContainer function static,
4806 and not per-instance.
4808 * class.cs: Make static FindMembers (the one that takes a Type
4811 * codegen.cs: Add EmitForeach here.
4813 * cs-parser.jay: Make foreach a toplevel object instead of the
4814 inline expansion, as we need to perform semantic analysis on it.
4816 2001-10-05 Ravi Pratap <ravi@ximian.com>
4818 * expression.cs (Expression::ImplicitUserConversion): Rename to
4819 UserDefinedConversion.
4821 (Expression::UserDefinedConversion): Take an extra argument specifying
4822 whether we look for explicit user conversions too.
4824 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
4826 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
4828 (ExplicitUserConversion): Make it a call to UserDefinedConversion
4829 with the appropriate arguments.
4831 * cs-parser.jay (cast_expression): Record location too.
4833 * expression.cs (Cast): Record location info.
4835 (Expression::ConvertExplicit): Take location argument.
4837 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
4838 to determine if we are doing explicit conversions.
4840 (UserCast::Emit): Update accordingly.
4842 (Expression::ConvertExplicit): Report an error if everything fails.
4844 * ../errors/cs0030.cs : Add.
4846 2001-10-04 Miguel de Icaza <miguel@ximian.com>
4848 * modifiers.cs: If the ABSTRACT keyword is present, also set the
4849 virtual and newslot bits.
4851 * class.cs (TypeContainer::RegisterRequiredImplementations):
4852 Record methods we need.
4854 (TypeContainer::MakeKey): Helper function to make keys for
4855 MethodBases, since the Methodbase key is useless.
4857 (TypeContainer::Populate): Call RegisterRequiredImplementations
4858 before defining the methods.
4860 Create a mapping for method_builders_to_methods ahead of time
4861 instead of inside a tight loop.
4863 (::RequireMethods): Accept an object as the data to set into the
4864 hashtable so we can report interface vs abstract method mismatch.
4866 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4868 * report.cs: Make all of it static.
4870 * rootcontext.cs: Drop object_type and value_type computations, as
4871 we have those in the TypeManager anyways.
4873 Drop report instance variable too, now it is a global.
4875 * driver.cs: Use try/catch on command line handling.
4877 Add --probe option to debug the error reporting system with a test
4880 * report.cs: Add support for exiting program when a probe
4881 condition is reached.
4883 2001-10-03 Ravi Pratap <ravi@ximian.com>
4885 * expression.cs (Binary::DoNumericPromotions): Fix the case when
4886 we do a forcible conversion regardless of type, to check if
4887 ForceConversion returns a null.
4889 (Binary::error19): Use location to report error.
4891 (Unary::error23): Use location here too.
4893 * ../errors/cs0019.cs : Check in.
4895 * ../errors/cs0023.cs : Check in.
4897 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
4898 case of a non-null MethodInfo object with a length of 0 !
4900 (Binary::ResolveOperator): Flag error if overload resolution fails to find
4901 an applicable member - according to the spec :-)
4902 Also fix logic to find members in base types.
4904 (Unary::ResolveOperator): Same here.
4906 (Unary::report23): Change name to error23 and make first argument a TypeContainer
4907 as I was getting thoroughly confused between this and error19 :-)
4909 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
4910 (::FindMostEncompassedType): Implement.
4911 (::FindMostEncompassingType): Implement.
4912 (::StandardConversionExists): Implement.
4914 (UserImplicitCast): Re-vamp. We now need info about most specific
4915 source and target types so that we can do the necessary conversions.
4917 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
4918 mathematical union with no duplicates.
4920 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4922 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
4923 in order from base classes to child classes, so that we can in
4924 child classes look up in our parent for method names and
4925 attributes (required for handling abstract, virtual, new, override
4926 constructs: we need to instrospect our base class, and if we dont
4927 populate the classes in order, the introspection might be
4928 incorrect. For example, a method could query its parent before
4929 the parent has any methods and would determine that the parent has
4930 no abstract methods (while it could have had them)).
4932 (RootContext::CreateType): Record the order in which we define the
4935 2001-10-02 Miguel de Icaza <miguel@ximian.com>
4937 * class.cs (TypeContainer::Populate): Also method definitions can
4938 fail now, keep track of this.
4940 (TypeContainer::FindMembers): Implement support for
4941 DeclaredOnly/noDeclaredOnly flag.
4943 (Constructor::Emit) Return the ConstructorBuilder.
4945 (Method::Emit) Return the MethodBuilder.
4946 Check for abstract or virtual methods to be public.
4948 * rootcontext.cs (RootContext::CreateType): Register all the
4949 abstract methods required for the class to be complete and the
4950 interface methods that must be implemented.
4952 * cs-parser.jay: Report error 501 (method requires body if it is
4953 not marked abstract or extern).
4955 * expression.cs (TypeOf::Emit): Implement.
4957 * typemanager.cs: runtime_handle_type, new global type.
4959 * class.cs (Property::Emit): Generate code for properties.
4961 2001-10-02 Ravi Pratap <ravi@ximian.com>
4963 * expression.cs (Unary::ResolveOperator): Find operators on base type
4964 too - we now conform exactly to the spec.
4966 (Binary::ResolveOperator): Same here.
4968 * class.cs (Operator::Define): Fix minor quirk in the tests.
4970 * ../errors/cs0215.cs : Added.
4972 * ../errors/cs0556.cs : Added.
4974 * ../errors/cs0555.cs : Added.
4976 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4978 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
4979 single integer which is really efficient
4981 2001-10-01 Ravi Pratap <ravi@ximian.com>
4983 * expression.cs (Expression::ImplicitUserConversion): Use location
4984 even in the case when we are examining True operators.
4986 * class.cs (Operator::Define): Perform extensive checks to conform
4987 with the rules for operator overloading in the spec.
4989 * expression.cs (Expression::ImplicitReferenceConversion): Implement
4990 some of the other conversions mentioned in the spec.
4992 * typemanager.cs (array_type): New static member for the System.Array built-in
4995 (cloneable_interface): For System.ICloneable interface.
4997 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
4998 we start resolving the tree and populating types.
5000 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
5002 2001-10-01 Miguel de Icaza <miguel@ximian.com>
5004 * expression.cs (Expression::ExprClassFromMemberInfo,
5005 Expression::Literalize): Create literal expressions from
5006 FieldInfos which are literals.
5008 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
5009 type casts, because they were wrong. The test suite in tests
5012 (ImplicitNumericConversion): ushort to ulong requires a widening
5015 Int32 constant to long requires widening cast as well.
5017 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
5018 for integers because the type on the stack is not i4.
5020 2001-09-30 Miguel de Icaza <miguel@ximian.com>
5022 * expression.cs (report118): require location argument.
5024 * parameter.cs: Do not dereference potential null value.
5026 * class.cs: Catch methods that lack the `new' keyword when
5027 overriding a name. Report warnings when `new' is used without
5028 anything being there to override.
5030 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
5032 * class.cs: Only add constructor to hashtable if it is non-null
5033 (as now constructors can fail on define).
5035 (TypeManager, Class, Struct): Take location arguments.
5037 Catch field instance initialization in structs as errors.
5039 accepting_filter: a new filter for FindMembers that is static so
5040 that we dont create an instance per invocation.
5042 (Constructor::Define): Catch errors where a struct constructor is
5045 * cs-parser.jay: Pass location information for various new
5048 * delegate.cs (Delegate): take a location argument.
5050 * driver.cs: Do not call EmitCode if there were problesm in the
5051 Definition of the types, as many Builders wont be there.
5053 * decl.cs (Decl::Decl): Require a location argument.
5055 * cs-tokenizer.cs: Handle properly hex constants that can not fit
5056 into integers, and find the most appropiate integer for it.
5058 * literal.cs: Implement ULongLiteral.
5060 * rootcontext.cs: Provide better information about the location of
5061 failure when CreateType fails.
5063 2001-09-29 Miguel de Icaza <miguel@ximian.com>
5065 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
5068 * expression.cs (Binary::CheckShiftArguments): Add missing type
5070 (Binary::ResolveOperator): Add type to the logical and and logical
5071 or, Bitwise And/Or and Exclusive Or code paths, it was missing
5074 (Binary::DoNumericPromotions): In the case where either argument
5075 is ulong (and most signed types combined with ulong cause an
5076 error) perform implicit integer constant conversions as well.
5078 2001-09-28 Miguel de Icaza <miguel@ximian.com>
5080 * expression.cs (UserImplicitCast): Method should always be
5082 (Invocation::BetterConversion): Simplified test for IntLiteral.
5084 (Expression::ImplicitNumericConversion): Split this routine out.
5085 Put the code that performs implicit constant integer conversions
5088 (Expression::Resolve): Become a wrapper around DoResolve so we can
5089 check eclass and type being set after resolve.
5091 (Invocation::Badness): Remove this dead function
5093 (Binary::ResolveOperator): Do not compute the expensive argumnets
5094 unless we have a union for it.
5096 (Probe::Emit): Is needs to do an isinst and then
5097 compare against null.
5099 (::CanConvert): Added Location argument. If the Location argument
5100 is null (Location.Null), then we do not report errors. This is
5101 used by the `probe' mechanism of the Explicit conversion. We do
5102 not want to generate an error for something that the user
5103 explicitly requested to be casted. But the pipeline for an
5104 explicit cast first tests for potential implicit casts.
5106 So for now, if the Location is null, it means `Probe only' to
5107 avoid adding another argument. Might have to revise this
5110 (ClassCast): New class used to type cast objects into arbitrary
5111 classes (used in Explicit Reference Conversions).
5113 Implement `as' as well.
5115 Reverted all the patches from Ravi below: they were broken:
5117 * The use of `level' as a mechanism to stop recursive
5118 invocations is wrong. That was there just to catch the
5119 bug with a strack trace but not as a way of addressing
5122 To fix the problem we have to *understand* what is going
5123 on and the interactions and come up with a plan, not
5124 just get things going.
5126 * The use of the type conversion cache that I proposed
5127 last night had an open topic: How does this work across
5128 protection domains. A user defined conversion might not
5129 be public in the location where we are applying the
5130 conversion, a different conversion might be selected
5131 (ie, private A->B (better) but public B->A (worse),
5132 inside A, A->B applies, but outside it, B->A will
5135 * On top of that (ie, even if the above is solved),
5136 conversions in a cache need to be abstract. Ie, `To
5137 convert from an Int to a Short use an OpcodeCast', not
5138 `To convert from an Int to a Short use the OpcodeCast on
5139 the variable 5' (which is what this patch was doing).
5141 2001-09-28 Ravi Pratap <ravi@ximian.com>
5143 * expression.cs (Invocation::ConversionExists): Re-write to use
5144 the conversion cache
5146 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
5147 cache all conversions done, not just user-defined ones.
5149 (Invocation::BetterConversion): The real culprit. Use ConversionExists
5150 to determine if a conversion exists instead of acutually trying to
5151 perform the conversion. It's faster too.
5153 (Expression::ConvertExplicit): Modify to use ConversionExists to check
5154 and only then attempt the implicit conversion.
5156 2001-09-28 Ravi Pratap <ravi@ximian.com>
5158 * expression.cs (ConvertImplicit): Use a cache for conversions
5159 already found. Check level of recursion and bail out if necessary.
5161 2001-09-28 Miguel de Icaza <miguel@ximian.com>
5163 * typemanager.cs (string_concat_string_string, string_concat_object_object):
5164 Export standard methods that we expect for string operations.
5166 * statement.cs (Block::UsageWarning): Track usage of variables and
5167 report the errors for not used variables.
5169 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
5172 2001-09-27 Miguel de Icaza <miguel@ximian.com>
5174 * codegen.cs: remove unnneded code
5176 * expression.cs: Removed BuiltinTypeAccess class
5178 Fix the order in which implicit conversions are
5181 The previous fixed dropped support for boxed conversions (adding a
5182 test to the test suite now)
5184 (UserImplicitCast::CanConvert): Remove test for source being null,
5185 that code is broken. We should not feed a null to begin with, if
5186 we do, then we should track the bug where the problem originates
5187 and not try to cover it up here.
5189 Return a resolved expression of type UserImplicitCast on success
5190 rather than true/false. Ravi: this is what I was talking about,
5191 the pattern is to use a static method as a "constructor" for
5194 Also, do not create arguments until the very last minute,
5195 otherwise we always create the arguments even for lookups that
5196 will never be performed.
5198 (UserImplicitCast::Resolve): Eliminate, objects of type
5199 UserImplicitCast are born in a fully resolved state.
5201 * typemanager.cs (InitCoreTypes): Init also value_type
5204 * expression.cs (Cast::Resolve): First resolve the child expression.
5206 (LValue): Add new method AddressOf to be used by
5209 Change the argument of Store to take an EmitContext instead of an
5210 ILGenerator, because things like FieldExpr need to be able to call
5211 their children expression to generate the instance code.
5213 (Expression::Error, Expression::Warning): Sugar functions for
5216 (Expression::MemberLookup): Accept a TypeContainer instead of a
5217 Report as the first argument.
5219 (Expression::ResolvePrimary): Killed. I still want to improve
5220 this as currently the code is just not right.
5222 (Expression::ResolveMemberAccess): Simplify, but it is still
5225 (Unary::Resolve): Catch errors in AddressOf operators.
5227 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
5228 index to a byte for the short-version, or the compiler will choose
5229 the wrong Emit call, which generates the wrong data.
5231 (ParameterReference::Emit, ::Store): same.
5233 (FieldExpr::AddressOf): Implement.
5235 * typemanager.cs: TypeManager: made public variable instead of
5238 * driver.cs: document --fatal.
5240 * report.cs (ErrorMessage, WarningMessage): new names for the old
5241 Error and Warning classes.
5243 * cs-parser.jay (member_access): Turn built-in access to types
5244 into a normal simplename
5246 2001-09-27 Ravi Pratap <ravi@ximian.com>
5248 * expression.cs (Invocation::BetterConversion): Fix to cope
5249 with q being null, since this was introducing a bug.
5251 * expression.cs (ConvertImplicit): Do built-in conversions first.
5253 2001-09-27 Ravi Pratap <ravi@ximian.com>
5255 * expression.cs (UserImplicitCast::Resolve): Fix bug.
5257 2001-09-27 Ravi Pratap <ravi@ximian.com>
5259 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
5260 I had introduced long ago (what's new ?).
5262 * expression.cs (UserImplicitCast::CanConvert): Static method to do
5263 the work of all the checking.
5264 (ConvertImplicit): Call CanConvert and only then create object if necessary.
5265 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
5267 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
5268 that is the right way.
5270 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
5271 overloading resolution. Use everywhere instead of cutting and pasting code.
5273 (Binary::ResolveOperator): Use MakeUnionSet.
5275 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
5276 we have to convert to bool types. Not complete yet.
5278 2001-09-27 Miguel de Icaza <miguel@ximian.com>
5280 * typemanager.cs (TypeManager::CSharpName): support ushort.
5282 * expression.cs (Expression::TryImplicitIntConversion): Attempts
5283 to provide an expression that performsn an implicit constant int
5284 conversion (section 6.1.6).
5285 (Expression::ConvertImplicitRequired): Reworked to include
5286 implicit constant expression conversions.
5288 (Expression::ConvertNumericExplicit): Finished.
5290 (Invocation::Emit): If InstanceExpression is null, then it means
5291 that we perform a call on this.
5293 2001-09-26 Miguel de Icaza <miguel@ximian.com>
5295 * expression.cs (Unary::Emit): Remove some dead code.
5296 (Probe): Implement Resolve and Emit for `is'.
5297 (Expression::ConvertImplicitRequired): Attempt to do constant
5298 expression conversions here. Maybe should be moved to
5299 ConvertImplicit, but I am not sure.
5300 (Expression::ImplicitLongConstantConversionPossible,
5301 Expression::ImplicitIntConstantConversionPossible): New functions
5302 that tell whether is it possible to apply an implicit constant
5303 expression conversion.
5305 (ConvertNumericExplicit): Started work on explicit numeric
5308 * cs-parser.jay: Update operator constants.
5310 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
5311 (Parameters::GetSignature): Hook up VerifyArgs here.
5312 (Parameters::VerifyArgs): Verifies that no two arguments have the
5315 * class.cs (Operator): Update the operator names to reflect the
5316 ones that the spec expects (as we are just stringizing the
5319 * expression.cs (Unary::ResolveOperator): Fix bug: Use
5320 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
5321 previous usage did only work for our methods.
5322 (Expression::ConvertImplicit): Handle decimal implicit numeric
5323 conversions as well.
5324 (Expression::InternalTypeConstructor): Used to invoke constructors
5325 on internal types for default promotions.
5327 (Unary::Emit): Implement special handling for the pre/post
5328 increment/decrement for overloaded operators, as they need to have
5329 the same semantics as the other operators.
5331 (Binary::ResolveOperator): ditto.
5332 (Invocation::ConversionExists): ditto.
5333 (UserImplicitCast::Resolve): ditto.
5335 2001-09-26 Ravi Pratap <ravi@ximian.com>
5337 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
5338 operator, return after emitting body. Regression tests pass again !
5340 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
5341 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
5342 (Invocation::OverloadResolve): Ditto.
5343 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
5345 * everywhere : update calls to the above methods accordingly.
5347 2001-09-26 Miguel de Icaza <miguel@ximian.com>
5349 * assign.cs (Assign): Make it inherit from ExpressionStatement.
5351 * expression.cs (ExpressionStatement): New base class used for
5352 expressions that can appear in statements, so that we can provide
5353 an alternate path to generate expression that do not leave a value
5356 (Expression::Emit, and all the derivatives): We no longer return
5357 whether a value is left on the stack or not. Every expression
5358 after being emitted leaves a single value on the stack.
5360 * codegen.cs (EmitContext::EmitStatementExpression): Use the
5361 facilties of ExpressionStatement if possible.
5363 * cs-parser.jay: Update statement_expression.
5365 2001-09-25 Miguel de Icaza <miguel@ximian.com>
5367 * driver.cs: Change the wording of message
5369 2001-09-25 Ravi Pratap <ravi@ximian.com>
5371 * expression.cs (Binary::ResolveOperator): Had forgottten to set
5372 the type of the expression to the return type of the method if
5373 we have an overloaded operator match ! The regression tests pass again !
5374 (Unary::ResolveOperator): Ditto.
5376 * expression.cs (Invocation::ConversionExists): Correct the member lookup
5377 to find "op_Implicit", not "implicit" ;-)
5378 (UserImplicitCast): New class to take care of user-defined implicit conversions.
5379 (ConvertImplicit, ForceConversion): Take TypeContainer argument
5381 * everywhere : Correct calls to the above accordingly.
5383 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
5384 (ConvertImplicit): Do user-defined conversion if it exists.
5386 2001-09-24 Miguel de Icaza <miguel@ximian.com>
5388 * assign.cs: track location.
5389 (Resolve): Use implicit conversions on assignment.
5391 * literal.cs: Oops. Not good, Emit of short access values should
5392 pass (Bytes) or the wrong argument will be selected.
5394 * expression.cs (Unary::Emit): Emit code for -expr.
5396 (Unary::ResolveOperator): Handle `Substract' for non-constants
5397 (substract from zero from the non-constants).
5398 Deal with Doubles as well.
5400 (Expression::ConvertImplicitRequired): New routine that reports an
5401 error if no implicit conversion exists.
5403 (Invocation::OverloadResolve): Store the converted implicit
5404 expressions if we make them
5406 2001-09-24 Ravi Pratap <ravi@ximian.com>
5408 * class.cs (ConstructorInitializer): Take a Location argument.
5409 (ConstructorBaseInitializer): Same here.
5410 (ConstructorThisInitializer): Same here.
5412 * cs-parser.jay : Update all calls accordingly.
5414 * expression.cs (Unary, Binary, New): Take location argument.
5415 Update accordingly everywhere.
5417 * cs-parser.jay : Update all calls to the above to take a location
5422 2001-09-24 Ravi Pratap <ravi@ximian.com>
5424 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
5425 (Invocation::BetterConversion): Same here
5426 (Invocation::ConversionExists): Ditto.
5428 (Invocation::ConversionExists): Implement.
5430 2001-09-22 Ravi Pratap <ravi@ximian.com>
5432 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
5433 Also take an additional TypeContainer argument.
5435 * All over : Pass in TypeContainer as argument to OverloadResolve.
5437 * typemanager.cs (CSharpName): Update to check for the string type and return
5440 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
5443 2001-09-21 Ravi Pratap <ravi@ximian.com>
5445 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
5446 (Invocation::BetterFunction): Implement.
5447 (Invocation::BetterConversion): Implement.
5448 (Invocation::ConversionExists): Skeleton, no implementation yet.
5450 Okay, things work fine !
5452 2001-09-21 Miguel de Icaza <miguel@ximian.com>
5454 * typemanager.cs: declare and load enum_type, delegate_type and
5457 * expression.cs (Expression::Emit): Now emit returns a value that
5458 tells whether a value is left on the stack or not. This strategy
5459 might be reveted tomorrow with a mechanism that would address
5460 multiple assignments.
5461 (Expression::report118): Utility routine to report mismatches on
5464 (Unary::Report23): Report impossible type/operator combination
5467 (Unary::IsIncrementableNumber): Whether the type can be
5468 incremented or decremented with add.
5469 (Unary::ResolveOperator): Also allow enumerations to be bitwise
5471 (Unary::ResolveOperator): Implement ++, !, ~,
5473 (Invocation::Emit): Deal with new Emit convetion.
5475 * All Expression derivatives: Updated their Emit method to return
5476 whether they leave values on the stack or not.
5478 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
5479 stack for expressions that are statements.
5481 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5483 * expression.cs (LValue): New interface. Must be implemented by
5485 (LocalVariableReference, ParameterReference, FieldExpr): Implement
5488 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
5489 interface for generating code, simplifies the code.
5491 2001-09-20 Ravi Pratap <ravi@ximian.com>
5493 * expression.cs (everywhere): Comment out return statements in ::Resolve
5494 methods to avoid the warnings.
5496 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5498 * driver.cs (parse): Report error 2001 if we can not open the
5501 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
5504 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
5507 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
5508 otherwise nested blocks end up with the same index.
5510 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
5512 * expression.cs: Instead of having FIXMEs in the Resolve
5513 functions, throw exceptions so it is obvious that we are facing a
5516 * cs-parser.jay (invocation_expression): Pass Location information.
5518 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
5519 Use a basename for those routines because .NET does not like paths
5522 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
5525 2001-09-19 Miguel de Icaza <miguel@ximian.com>
5527 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
5528 are loading the correct data types (throws an exception if not).
5529 (TypeManager::InitCoreTypes): Use CoreLookupType
5531 * expression.cs (Unary::ResolveOperator): return the child
5532 expression for expressions which are just +expr.
5533 (Unary::ResolveOperator): Return negative literals for -LITERAL
5534 expressions (otherwise they are Unary {Literal}).
5535 (Invocation::Badness): Take into account `Implicit constant
5536 expression conversions'.
5538 * literal.cs (LongLiteral): Implement long literal class.
5539 (IntLiteral): export the `Value' of the intliteral.
5541 2001-09-19 Ravi Pratap <ravi@ximian.com>
5543 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
5545 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
5546 instead of 'Operator'
5548 * expression.cs (Binary::ResolveOperator): Update accordingly.
5549 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
5552 * cs-parser.jay (unary_expression): Update to use the new names.
5554 * gen-treedump.cs (GetUnary): Same here.
5556 * expression.cs (Unary::Resolve): Implement.
5557 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
5558 operators are found instead of making noise ;-)
5559 (Unary::ResolveOperator): New method to do precisely the same thing which
5560 Binary::ResolveOperator does for Binary expressions.
5561 (Unary.method, .Arguments): Add.
5562 (Unary::OperName): Implement.
5563 (Unary::ForceConversion): Copy and Paste !
5565 * class.cs (Operator::Define): Fix a small bug for the case when we have
5568 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
5569 for the inbuilt operators. Only overloading works for now ;-)
5571 2001-09-18 Miguel de Icaza <miguel@ximian.com>
5573 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
5574 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
5576 * expression.cs (This::Emit): Implement.
5577 (This::Resolve): Implement.
5578 (TypeOf:Resolve): Implement.
5579 (Expression::ResolveSimpleName): Add an implicit this to instance
5581 (MemberAccess::Resolve): Deal with Parameters and Fields.
5582 Bind instance variable to Field expressions.
5583 (FieldExpr::Instance): New field used to track the expression that
5584 represents the object instance.
5585 (FieldExpr::Resolve): Track potential errors from MemberLookup not
5587 (FieldExpr::Emit): Implement.
5589 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
5590 the last instruction contains a return opcode to avoid generating
5591 the last `ret' instruction (this generates correct code, and it is
5592 nice to pass the peverify output).
5594 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
5595 initializer for static and instance variables.
5596 (Constructor::Emit): Allow initializer to be null in the case of
5597 static constructors. Only emit initializer for instance
5600 (TypeContainer::FindMembers): Return a null array if there are no
5603 Also fix the code for the MemberTypes.Method branch, as it was not
5604 scanning that for operators (or tried to access null variables before).
5606 * assign.cs (Assign::Emit): Handle instance and static fields.
5610 * driver.cs: Stop compilation if there are parse errors.
5612 * cs-parser.jay (constructor_declaration): Provide default base
5613 initializer for non-static constructors.
5614 (constructor_declarator): Do not provide a default base
5615 initializers if none was specified.
5616 Catch the fact that constructors should not have parameters.
5618 * class.cs: Do not emit parent class initializers for static
5619 constructors, that should be flagged as an error.
5621 2001-09-18 Ravi Pratap <ravi@ximian.com>
5623 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
5624 Move back code into TypeContainer::Populate.
5626 2001-09-18 Ravi Pratap <ravi@ximian.com>
5628 * class.cs (TypeContainer::AddConstructor): Fix the check to
5629 compare against Name, not Basename.
5630 (Operator::OpType): Change Plus and Minus to Add and Subtract.
5632 * cs-parser.jay : Update accordingly.
5634 * class.cs (TypeContainer::FindMembers): For the case where we are searching
5635 for methods, don't forget to look into the operators too.
5636 (RegisterMethodBuilder): Helper method to take care of this for
5637 methods, constructors and operators.
5638 (Operator::Define): Completely revamp.
5639 (Operator.OperatorMethod, MethodName): New fields.
5640 (TypeContainer::Populate): Move the registering of builders into
5641 RegisterMethodBuilder.
5642 (Operator::Emit): Re-write.
5644 * expression.cs (Binary::Emit): Comment out code path to emit method
5645 invocation stuff for the case when we have a user defined operator. I am
5646 just not able to get it right !
5648 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5650 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
5653 (Expression::MemberLookup): Provide a version that allows to
5654 specify the MemberTypes and BindingFlags.
5656 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
5657 so it was not fetching variable information from outer blocks.
5659 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
5660 Beforefieldinit as it was buggy.
5662 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
5665 * class.cs (Constructor::Emit): Only emit if block is not null.
5666 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
5667 deal with this by semantically definining it as if the user had
5670 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
5671 constructors as we now "emit" them at a higher level.
5673 (TypeContainer::DefineDefaultConstructor): Used to define the
5674 default constructors if none was provided.
5676 (ConstructorInitializer): Add methods Resolve and Emit.
5678 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
5680 2001-09-17 Ravi Pratap <ravi@ximian.com>
5682 * class.cs (TypeContainer::EmitDefaultConstructor): Register
5683 the default constructor builder with our hashtable for methodbuilders
5686 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
5687 and argument_count is 0 in which case we have a match.
5688 (Binary::ResolveOperator): More null checking and miscellaneous coding
5691 2001-09-17 Ravi Pratap <ravi@ximian.com>
5693 * rootcontext.cs (IsNameSpace): Compare against null.
5695 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
5697 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
5698 and Unary::Operator.
5700 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
5703 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
5704 we have overloaded operators.
5705 (Binary::ResolveOperator): Implement the part which does the operator overload
5708 * class.cs (Operator::Emit): Implement.
5709 (TypeContainer::Emit): Emit the operators we have too.
5711 * expression.cs (Binary::Emit): Update to emit the appropriate code for
5712 the case when we have a user-defined operator.
5714 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5716 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
5718 2001-09-16 Ravi Pratap <ravi@ximian.com>
5720 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
5721 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
5722 (Constructor::Emit): Implement.
5723 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
5724 if we have no work to do.
5725 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
5728 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
5729 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
5731 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
5734 2001-09-15 Ravi Pratap <ravi@ximian.com>
5736 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
5738 (Tree::RecordNamespace): Method to do what the name says ;-)
5739 (Tree::Namespaces): Property to get at the namespaces hashtable.
5741 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
5744 * rootcontext.cs (IsNamespace): Fixed it :-)
5746 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5748 * class.cs (TypeContainer::FindMembers): Add support for
5750 (MethodCore): New class that encapsulates both the shared aspects
5751 of a Constructor and a Method.
5752 (Method, Constructor): Factored pieces into MethodCore.
5754 * driver.cs: Added --fatal which makes errors throw exceptions.
5755 Load System assembly as well as part of the standard library.
5757 * report.cs: Allow throwing exceptions on errors for debugging.
5759 * modifiers.cs: Do not use `parent', instead use the real type
5760 container to evaluate permission settings.
5762 * class.cs: Put Ravi's patch back in. He is right, and we will
5763 have to cope with the
5765 2001-09-14 Ravi Pratap <ravi@ximian.com>
5767 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
5768 FamORAssem, not FamANDAssem.
5770 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5772 * driver.cs: Added --parse option that only parses its input files
5775 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
5776 incorrect. IsTopLevel is not used to tell whether an object is
5777 root_types or not (that can be achieved by testing this ==
5778 root_types). But to see if this is a top-level *class* (not
5779 necessarly our "toplevel" container).
5781 2001-09-14 Ravi Pratap <ravi@ximian.com>
5783 * enum.cs (Enum::Define): Modify to call the Lookup method on the
5784 parent instead of a direct call to GetType.
5786 2001-09-14 Ravi Pratap <ravi@ximian.com>
5788 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
5789 Modifiers.TypeAttr. This should just be a call to that method.
5791 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
5792 object so that we can determine if we are top-level or not.
5794 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
5797 * enum.cs (Enum::Define): Ditto.
5799 * modifiers.cs (FieldAttr): Re-write.
5801 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
5802 (TypeContainer::HaveStaticConstructor): New property to provide access
5803 to precisely that info.
5805 * modifiers.cs (MethodAttr): Re-write.
5806 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
5808 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
5809 of top-level types as claimed.
5811 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5813 * expression.cs (MemberLookup): Fruitless attempt to lookup
5814 constructors. Maybe I need to emit default constructors? That
5815 might be it (currently .NET emits this for me automatically).
5816 (Invocation::OverloadResolve): Cope with Arguments == null.
5817 (Invocation::EmitArguments): new function, shared by the new
5819 (Invocation::Emit): Handle static and instance methods. Emit
5820 proper call instruction for virtual or non-virtual invocations.
5821 (New::Emit): Implement.
5822 (New::Resolve): Implement.
5823 (MemberAccess:Resolve): Implement.
5824 (MethodGroupExpr::InstanceExpression): used conforming to the spec
5826 (FieldExpr::Resolve): Set type.
5828 * support.cs: Handle empty arguments.
5830 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
5831 SimpleLookup): Auxiliary routines to help parse a qualifier
5834 Update qualifier_identifier rule.
5836 * codegen.cs: Removed debugging messages.
5838 * class.cs: Make this a global thing, this acts just as a "key" to
5839 objects that we might have around.
5841 (Populate): Only initialize method_builders_to_methods once.
5843 * expression.cs (PropertyExpr): Initialize type from the
5846 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
5847 Resolve pattern. Attempt to implicitly convert value to boolean.
5850 * expression.cs: Set the type for the int32/int32 argument case.
5851 (Binary::ResolveOperator): Set the return type to boolean for
5852 comparission operators
5854 * typemanager.cs: Remove debugging print code.
5856 (Invocation::Resolve): resolve type.
5858 * class.cs: Allocate a MemberInfo of the correct size, as the code
5859 elsewhere depends on the test to reflect the correct contents.
5861 (Method::) Keep track of parameters, due to System.Reflection holes
5863 (TypeContainer::Populate): Keep track of MethodBuilders to Method
5866 (TypeContainer::FindMembers): Use ArrayList and then copy an array
5867 of the exact size and return that.
5869 (Class::LookupMethodByBuilder): New function that maps
5870 MethodBuilders to its methods. Required to locate the information
5871 on methods because System.Reflection bit us again.
5873 * support.cs: New file, contains an interface ParameterData and
5874 two implementations: ReflectionParameters and InternalParameters
5875 used to access Parameter information. We will need to grow this
5878 * expression.cs (Invocation::GetParameterData): implement a cache
5879 and a wrapper around the ParameterData creation for methods.
5880 (Invocation::OverloadResolve): Use new code.
5882 2001-09-13 Ravi Pratap <ravi@ximian.com>
5884 * class.cs (TypeContainer::EmitField): Remove and move into
5885 (Field::Define): here and modify accordingly.
5886 (Field.FieldBuilder): New member.
5887 (TypeContainer::Populate): Update accordingly.
5888 (TypeContainer::FindMembers): Implement.
5890 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5892 * statement.cs: (VariableInfo::VariableType): New field to be
5893 initialized with the full type once it is resolved.
5895 2001-09-12 Miguel de Icaza <miguel@ximian.com>
5897 * parameter.cs (GetParameterInfo): Use a type cache to compute
5898 things only once, and to reuse this information
5900 * expression.cs (LocalVariableReference::Emit): Implement.
5901 (OpcodeCast::Emit): fix.
5903 (ParameterReference::Resolve): Implement.
5904 (ParameterReference::Emit): Implement.
5906 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
5907 that are expressions need to stay as Expressions.
5909 * typemanager.cs (CSharpName): Returns the C# name of a type if
5912 * expression.cs (Expression::ConvertImplicit): New function that
5913 implements implicit type conversions.
5915 (Expression::ImplicitReferenceConversion): Implements implicit
5916 reference conversions.
5918 (EmptyCast): New type for transparent casts.
5920 (OpcodeCast): New type for casts of types that are performed with
5921 a sequence of bytecodes.
5923 (BoxedCast): New type used for casting value types into reference
5924 types. Emits a box opcode.
5926 (Binary::DoNumericPromotions): Implements numeric promotions of
5927 and computation of the Binary::Type.
5929 (Binary::EmitBranchable): Optimization.
5931 (Binary::Emit): Implement code emission for expressions.
5933 * typemanager.cs (TypeManager): Added two new core types: sbyte
5936 2001-09-12 Ravi Pratap <ravi@ximian.com>
5938 * class.cs (TypeContainer::FindMembers): Method which does exactly
5939 what Type.FindMembers does, only we don't have to use reflection. No
5942 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
5943 typecontainer objects as we need to get at them.
5944 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
5946 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
5947 typecontainer object.
5949 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
5950 of just a Report object.
5952 2001-09-11 Ravi Pratap <ravi@ximian.com>
5954 * class.cs (Event::Define): Go back to using the prefixes "add_" and
5956 (TypeContainer::Populate): Now define the delegates of the type too.
5957 (TypeContainer.Delegates): Property to access the list of delegates defined
5960 * delegates.cs (Delegate::Define): Implement partially.
5962 * modifiers.cs (TypeAttr): Handle more flags.
5964 2001-09-11 Ravi Pratap <ravi@ximian.com>
5966 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
5968 (Operator::Define): Re-write logic to get types by using the LookupType method
5969 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
5970 (Indexer::Define): Ditto.
5971 (Event::Define): Ditto.
5972 (Property::Define): Ditto.
5974 2001-09-10 Ravi Pratap <ravi@ximian.com>
5976 * class.cs (TypeContainer::Populate): Now define operators too.
5977 (TypeContainer.Operators): New property to access the list of operators
5979 (Operator.OperatorMethodBuilder): New member to hold the method builder
5980 for the operator we are defining.
5981 (Operator::Define): Implement.
5983 2001-09-10 Ravi Pratap <ravi@ximian.com>
5985 * class.cs (Event::Define): Make the prefixes of the accessor methods
5986 addOn_ and removeOn_
5988 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
5989 of the location being passed in too. Ideally, this should go later since all
5990 error reporting should be done through the Report object.
5992 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
5993 (Populate): Iterate thru the indexers we have and define them too.
5994 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
5995 for the get and set accessors.
5996 (Indexer::Define): Implement.
5998 2001-09-09 Miguel de Icaza <miguel@ximian.com>
6000 * expression.cs (Binary::Resolve): Beginning of it. I scratched
6001 my previous implementation, did not work.
6003 * typemanager.cs: Add a couple of missing types (the longs).
6005 * literal.cs: Use TypeManager.bool_type instead of getting it.
6007 * expression.cs (EventExpr): New kind of expressions.
6008 (Expressio::ExprClassFromMemberInfo): finish
6010 2001-09-08 Miguel de Icaza <miguel@ximian.com>
6012 * assign.cs: Emit stores to static fields differently.
6014 2001-09-08 Ravi Pratap <ravi@ximian.com>
6016 * Merge in changes and adjust code to tackle conflicts. Backed out my
6017 code in Assign::Resolve ;-)
6019 2001-09-08 Ravi Pratap <ravi@ximian.com>
6021 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
6022 instead Report.Error and also pass in the location.
6023 (CSharpParser::Lexer): New readonly property to return the reference
6024 to the Tokenizer object.
6025 (declare_local_variables): Use Report.Error with location instead of plain
6029 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
6030 (Operator.CheckBinaryOperator): Ditto.
6032 * cs-parser.jay (operator_declarator): Update accordingly.
6034 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
6035 (CheckBinaryOperator): Same here.
6037 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
6038 on the name without any prefixes of namespace names etc. This is because we
6039 already might have something already fully qualified like
6040 'System.Console.WriteLine'
6042 * assign.cs (Resolve): Begin implementation. Stuck ;-)
6044 2001-09-07 Ravi Pratap <ravi@ximian.com>
6046 * cs-tokenizer.cs (location): Return a string which also contains
6049 * expression.cs (ElementAccess): New class for expressions of the
6050 type 'element access.'
6051 (BaseAccess): New class for expressions of the type 'base access.'
6052 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
6055 * cs-parser.jay (element_access): Implement action.
6056 (base_access): Implement actions.
6057 (checked_expression, unchecked_expression): Implement.
6059 * cs-parser.jay (local_variable_type): Correct and implement.
6060 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
6062 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
6064 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
6065 name and the specifiers.
6067 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
6069 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
6070 making them all public ;-)
6072 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
6075 2001-09-07 Miguel de Icaza <miguel@ximian.com>
6077 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
6079 (FieldExpr, PropertyExprs): New resolved expressions.
6080 (SimpleName::MemberStaticCheck): Perform static checks for access
6081 to non-static fields on static methods. Maybe this should be
6082 generalized for MemberAccesses.
6083 (SimpleName::ResolveSimpleName): More work on simple name
6086 * cs-parser.jay (primary_expression/qualified_identifier): track
6087 the parameter index.
6089 * codegen.cs (CodeGen::Save): Catch save exception, report error.
6090 (EmitContext::EmitBoolExpression): Chain to expression generation
6091 instead of temporary hack.
6092 (::EmitStatementExpression): Put generic expression code generation.
6094 * assign.cs (Assign::Emit): Implement variable assignments to
6095 local variables, parameters and fields.
6097 2001-09-06 Miguel de Icaza <miguel@ximian.com>
6099 * statement.cs (Block::GetVariableInfo): New method, returns the
6100 VariableInfo for a variable name in a block.
6101 (Block::GetVariableType): Implement in terms of GetVariableInfo
6103 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
6104 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
6106 2001-09-06 Ravi Pratap <ravi@ximian.com>
6108 * cs-parser.jay (operator_declaration): Continue on my quest : update
6109 to take attributes argument.
6110 (event_declaration): Ditto.
6111 (enum_declaration): Ditto.
6112 (indexer_declaration): Ditto.
6114 * class.cs (Operator::Operator): Update constructor accordingly.
6115 (Event::Event): Ditto.
6117 * delegate.cs (Delegate::Delegate): Same here.
6119 * enum.cs (Enum::Enum): Same here.
6121 2001-09-05 Ravi Pratap <ravi@ximian.com>
6123 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
6125 * ../tests/cs0658.cs : New file to demonstrate error 0658.
6127 * attribute.cs (Attributes): New class to encapsulate all attributes which were
6128 being passed around as an arraylist.
6129 (Attributes::AddAttribute): Method to add attribute sections.
6131 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
6132 (struct_declaration): Update accordingly.
6133 (constant_declaration): Update.
6134 (field_declaration): Update.
6135 (method_header): Update.
6136 (fixed_parameter): Update.
6137 (parameter_array): Ditto.
6138 (property_declaration): Ditto.
6139 (destructor_declaration): Ditto.
6141 * class.cs (Struct::Struct): Update constructors accordingly.
6142 (Class::Class): Ditto.
6143 (Field::Field): Ditto.
6144 (Method::Method): Ditto.
6145 (Property::Property): Ditto.
6146 (TypeContainer::OptAttribute): update property's return type.
6148 * interface.cs (Interface.opt_attributes): New member.
6149 (Interface::Interface): Update to take the extra Attributes argument.
6151 * parameter.cs (Parameter::Parameter): Ditto.
6153 * constant.cs (Constant::Constant): Ditto.
6155 * interface.cs (InterfaceMemberBase): New OptAttributes field.
6156 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
6157 the attributes as a parameter.
6158 (InterfaceProperty): Update constructor call.
6159 (InterfaceEvent): Ditto.
6160 (InterfaceMethod): Ditto.
6161 (InterfaceIndexer): Ditto.
6163 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
6164 pass the attributes too.
6165 (interface_event_declaration): Ditto.
6166 (interface_property_declaration): Ditto.
6167 (interface_method_declaration): Ditto.
6168 (interface_declaration): Ditto.
6170 2001-09-05 Miguel de Icaza <miguel@ximian.com>
6172 * class.cs (Method::Define): Track the "static Main" definition to
6173 create an entry point.
6175 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
6176 EntryPoint if we find it.
6178 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
6179 (EmitContext::ig): Make this variable public.
6181 * driver.cs: Make the default output file be the first file name
6182 with the .exe extension.
6184 Detect empty compilations
6186 Handle various kinds of output targets. Handle --target and
6187 rename -t to --dumper.
6189 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
6190 methods inherited from Expression return now an Expression. This
6191 will is used during the tree rewriting as we resolve them during
6194 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
6195 the spec. Missing entirely is the information about
6196 accessability of elements of it.
6198 (Expression::ExprClassFromMemberInfo): New constructor for
6199 Expressions that creates a fully initialized Expression based on
6200 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
6203 (Invocation::Resolve): Begin implementing resolution of invocations.
6205 * literal.cs (StringLiteral): Implement Emit.
6207 2001-09-05 Ravi Pratap <ravi@ximian.com>
6209 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
6212 2001-09-04 Ravi Pratap <ravi@ximian.com>
6214 * cs-parser.jay (attribute_arguments): Implement actions.
6215 (attribute): Fix bug in production. Implement action.
6216 (attribute_list): Implement.
6217 (attribute_target): Implement.
6218 (attribute_target_specifier, opt_target_specifier): Implement
6219 (CheckAttributeTarget): New method to check if the attribute target
6221 (attribute_section): Implement.
6222 (opt_attributes): Implement.
6224 * attribute.cs : New file to handle attributes.
6225 (Attribute): Class to hold attribute info.
6227 * cs-parser.jay (opt_attribute_target_specifier): Remove production
6228 (attribute_section): Modify production to use 2 different rules to
6229 achieve the same thing. 1 s/r conflict down !
6230 Clean out commented, useless, non-reducing dimension_separator rules.
6232 * class.cs (TypeContainer.attributes): New member to hold list
6233 of attributes for a type.
6234 (Struct::Struct): Modify to take one more argument, the attribute list.
6235 (Class::Class): Ditto.
6236 (Field::Field): Ditto.
6237 (Method::Method): Ditto.
6238 (Property::Property): Ditto.
6240 * cs-parser.jay (struct_declaration): Update constructor call to
6241 pass in the attributes too.
6242 (class_declaration): Ditto.
6243 (constant_declaration): Ditto.
6244 (field_declaration): Ditto.
6245 (method_header): Ditto.
6246 (fixed_parameter): Ditto.
6247 (parameter_array): Ditto.
6248 (property_declaration): Ditto.
6250 * constant.cs (Constant::Constant): Update constructor similarly.
6251 Use System.Collections.
6253 * parameter.cs (Parameter::Parameter): Update as above.
6255 2001-09-02 Ravi Pratap <ravi@ximian.com>
6257 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
6258 (TypeContainer.delegates): New member to hold list of delegates.
6260 * cs-parser.jay (delegate_declaration): Implement the action correctly
6261 this time as I seem to be on crack ;-)
6263 2001-09-02 Miguel de Icaza <miguel@ximian.com>
6265 * rootcontext.cs (RootContext::IsNamespace): new function, used to
6266 tell whether an identifier represents a namespace.
6268 * expression.cs (NamespaceExpr): A namespace expression, used only
6269 temporarly during expression resolution.
6270 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
6271 utility functions to resolve names on expressions.
6273 2001-09-01 Miguel de Icaza <miguel@ximian.com>
6275 * codegen.cs: Add hook for StatementExpressions.
6277 * class.cs: Fix inverted test for static flag in methods.
6279 2001-09-02 Ravi Pratap <ravi@ximian.com>
6281 * class.cs (Operator::CheckUnaryOperator): Correct error number used
6282 to make it coincide with MS' number.
6283 (Operator::CheckBinaryOperator): Ditto.
6285 * ../errors/errors.txt : Remove error numbers added earlier.
6287 * ../errors/cs1019.cs : Test case for error # 1019
6289 * ../errros/cs1020.cs : Test case for error # 1020
6291 * cs-parser.jay : Clean out commented cruft.
6292 (dimension_separators, dimension_separator): Comment out. Ostensibly not
6293 used anywhere - non-reducing rule.
6294 (namespace_declarations): Non-reducing rule - comment out.
6296 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
6297 with TypeContainer::AddEnum.
6299 * delegate.cs : New file for delegate handling classes.
6300 (Delegate): Class for declaring delegates.
6302 * makefile : Update.
6304 * cs-parser.jay (delegate_declaration): Implement.
6306 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
6308 * class.cs (Event::Define): Implement.
6309 (Event.EventBuilder): New member.
6311 * class.cs (TypeContainer::Populate): Update to define all enums and events
6313 (Events): New property for the events arraylist we hold. Shouldn't we move to using
6314 readonly fields for all these cases ?
6316 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
6318 * class.cs (Property): Revamp to use the convention of making fields readonly.
6319 Accordingly modify code elsewhere.
6321 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
6322 the Define method of the Property class.
6324 * class.cs : Clean up applied patch and update references to variables etc. Fix
6326 (TypeContainer::Populate): Update to define all the properties we have. Also
6327 define all enumerations.
6329 * enum.cs (Define): Implement.
6331 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
6333 * cs-parser.jay (overloadable_operator): The semantic value is an
6334 enum of the Operator class.
6335 (operator_declarator): Implement actions.
6336 (operator_declaration): Implement.
6338 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
6339 validity of definitions.
6340 (Operator::CheckBinaryOperator): Static method to check for binary operators
6341 (TypeContainer::AddOperator): New method to add an operator to a type.
6343 * cs-parser.jay (indexer_declaration): Added line to actually call the
6344 AddIndexer method so it gets added ;-)
6346 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
6347 already taken care of by the MS compiler ?
6349 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
6351 * class.cs (Operator): New class for operator declarations.
6352 (Operator::OpType): Enum for the various operators.
6354 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
6356 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
6357 ostensibly handle this in semantic analysis.
6359 * cs-parser.jay (general_catch_clause): Comment out
6360 (specific_catch_clauses, specific_catch_clause): Ditto.
6361 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
6362 (catch_args, opt_catch_args): New productions.
6363 (catch_clause): Rewrite to use the new productions above
6364 (catch_clauses): Modify accordingly.
6365 (opt_catch_clauses): New production to use in try_statement
6366 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
6367 and re-write the code in the actions to extract the specific and
6368 general catch clauses by being a little smart ;-)
6370 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
6371 Hooray, try and catch statements parse fine !
6373 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6375 * statement.cs (Block::GetVariableType): Fix logic to extract the type
6376 string from the hashtable of variables.
6378 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
6379 I end up making that mistake ;-)
6380 (catch_clauses): Fixed gross error which made Key and Value of the
6381 DictionaryEntry the same : $1 !!
6383 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6385 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
6387 * cs-parser.jay (event_declaration): Correct to remove the semicolon
6388 when the add and remove accessors are specified.
6390 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6392 * cs-parser.jay (IndexerDeclaration): New helper class to hold
6393 information about indexer_declarator.
6394 (indexer_declarator): Implement actions.
6395 (parsing_indexer): New local boolean used to keep track of whether
6396 we are parsing indexers or properties. This is necessary because
6397 implicit_parameters come into picture even for the get accessor in the
6399 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
6401 * class.cs (Indexer): New class for indexer declarations.
6402 (TypeContainer::AddIndexer): New method to add an indexer to a type.
6403 (TypeContainer::indexers): New member to hold list of indexers for the
6406 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6408 * cs-parser.jay (add_accessor_declaration): Implement action.
6409 (remove_accessor_declaration): Implement action.
6410 (event_accessors_declaration): Implement
6411 (variable_declarators): swap statements for first rule - trivial.
6413 * class.cs (Event): New class to hold information about event
6415 (TypeContainer::AddEvent): New method to add an event to a type
6416 (TypeContainer::events): New member to hold list of events.
6418 * cs-parser.jay (event_declaration): Implement actions.
6420 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6422 * cs-parser.jay (dim_separators): Implement. Make it a string
6423 concatenating all the commas together, just as they appear.
6424 (opt_dim_separators): Modify accordingly
6425 (rank_specifiers): Update accordingly. Basically do the same
6426 thing - instead, collect the brackets here.
6427 (opt_rank_sepcifiers): Modify accordingly.
6428 (array_type): Modify to actually return the complete type string
6429 instead of ignoring the rank_specifiers.
6430 (expression_list): Implement to collect the expressions
6431 (variable_initializer): Implement. We make it a list of expressions
6432 essentially so that we can handle the array_initializer case neatly too.
6433 (variable_initializer_list): Implement.
6434 (array_initializer): Make it a list of variable_initializers
6435 (opt_array_initializer): Modify accordingly.
6437 * expression.cs (New::NType): Add enumeration to help us
6438 keep track of whether we have an object/delegate creation
6439 or an array creation.
6440 (New:NewType, New::Rank, New::Indices, New::Initializers): New
6441 members to hold data about array creation.
6442 (New:New): Modify to update NewType
6443 (New:New): New Overloaded contructor for the array creation
6446 * cs-parser.jay (array_creation_expression): Implement to call
6447 the overloaded New constructor.
6449 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
6451 * class.cs (TypeContainer::Constructors): Return member
6452 constructors instead of returning null.
6454 2001-08-26 Miguel de Icaza <miguel@ximian.com>
6456 * typemanager.cs (InitCoreTypes): Initialize the various core
6457 types after we have populated the type manager with the user
6458 defined types (this distinction will be important later while
6459 compiling corlib.dll)
6461 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
6462 on Expression Classification. Now all expressions have a method
6463 `Resolve' and a method `Emit'.
6465 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
6466 generation from working. Also add some temporary debugging
6469 2001-08-24 Miguel de Icaza <miguel@ximian.com>
6471 * codegen.cs: Lots of code generation pieces. This is only the
6472 beginning, will continue tomorrow with more touches of polish. We
6473 handle the fundamentals of if, while, do, for, return. Others are
6474 trickier and I need to start working on invocations soon.
6476 * gen-treedump.cs: Bug fix, use s.Increment here instead of
6479 * codegen.cs (EmitContext): New struct, used during code
6480 emission to keep a context. Most of the code generation will be
6483 * cs-parser.jay: Add embedded blocks to the list of statements of
6484 this block. So code generation proceeds in a top down fashion.
6486 2001-08-23 Miguel de Icaza <miguel@ximian.com>
6488 * statement.cs: Add support for multiple child blocks.
6490 2001-08-22 Miguel de Icaza <miguel@ximian.com>
6492 * codegen.cs (EmitCode): New function, will emit the code for a
6493 Block of code given a TypeContainer and its ILGenerator.
6495 * statement.cs (Block): Standard public readonly optimization.
6496 (Block::Block constructors): Link children.
6497 (Block::Child): Child Linker.
6498 (Block::EmitVariables): Emits IL variable declarations.
6500 * class.cs: Drop support for MethodGroups here, delay until
6502 (Method::): Applied the same simplification that I did before, and
6503 move from Properties to public readonly fields.
6504 (Method::ParameterTypes): Returns the parameter types for the
6505 function, and implements a cache that will be useful later when I
6506 do error checking and the semantic analysis on the methods is
6508 (Constructor::GetCallingConvention): Renamed from CallingConvetion
6509 and made a method, optional argument tells whether this is a class
6510 or a structure to apply the `has-this' bit.
6511 (Method::GetCallingConvention): Implement, returns the calling
6513 (Method::Define): Defines the type, a second pass is performed
6514 later to populate the methods.
6516 (Constructor::ParameterTypes): implement a cache similar to the
6517 one on Method::ParameterTypes, useful later when we do semantic
6520 (TypeContainer::EmitMethod): New method. Emits methods.
6522 * expression.cs: Removed MethodGroup class from here.
6524 * parameter.cs (Parameters::GetCallingConvention): new method.
6526 2001-08-21 Miguel de Icaza <miguel@ximian.com>
6528 * class.cs (TypeContainer::Populate): Drop RootContext from the
6531 (Constructor::CallingConvention): Returns the calling convention.
6532 (Constructor::ParameterTypes): Returns the constructor parameter
6535 (TypeContainer::AddConstructor): Keep track of default constructor
6536 and the default static constructor.
6538 (Constructor::) Another class that starts using `public readonly'
6539 instead of properties.
6541 (Constructor::IsDefault): Whether this is a default constructor.
6543 (Field::) use readonly public fields instead of properties also.
6545 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
6546 track of static constructors; If none is used, turn on
6547 BeforeFieldInit in the TypeAttributes.
6549 * cs-parser.jay (opt_argument_list): now the return can be null
6550 for the cases where there are no arguments.
6552 (constructor_declarator): If there is no implicit `base' or
6553 `this', then invoke the default parent constructor.
6555 * modifiers.cs (MethodAttr): New static function maps a set of
6556 modifiers flags into a MethodAttributes enum
6557 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
6558 MethodAttr, TypeAttr to represent the various mappings where the
6560 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
6562 2001-08-19 Miguel de Icaza <miguel@ximian.com>
6564 * parameter.cs (GetParameterInfo): Fix bug where there would be no
6567 * interface.cs (PopulateIndexer): Implemented the code generator
6568 for interface indexers.
6570 2001-08-17 Miguel de Icaza <miguel@ximian.com>
6572 * interface.cs (InterfaceMemberBase): Now we track the new status
6575 (PopulateProperty): Implement property population. Woohoo! Got
6576 Methods and Properties going today.
6578 Removed all the properties for interfaces, and replaced them with
6579 `public readonly' fields.
6581 2001-08-16 Miguel de Icaza <miguel@ximian.com>
6583 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
6584 initialize their hashtables/arraylists only when they are needed
6585 instead of doing this always.
6587 * parameter.cs: Handle refs and out parameters.
6589 * cs-parser.jay: Use an ArrayList to construct the arguments
6590 instead of the ParameterCollection, and then cast that to a
6593 * parameter.cs: Drop the use of ParameterCollection and use
6594 instead arrays of Parameters.
6596 (GetParameterInfo): Use the Type, not the Name when resolving
6599 2001-08-13 Miguel de Icaza <miguel@ximian.com>
6601 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
6602 and instead use public readonly fields.
6604 * class.cs: Put back walking code for type containers.
6606 2001-08-11 Miguel de Icaza <miguel@ximian.com>
6608 * class.cs (MakeConstant): Code to define constants.
6610 * rootcontext.cs (LookupType): New function. Used to locate types
6613 2001-08-08 Miguel de Icaza <miguel@ximian.com>
6615 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
6616 this System.Reflection code is. Kudos to Microsoft
6618 * typemanager.cs: Implement a type cache and avoid loading all
6619 types at boot time. Wrap in LookupType the internals. This made
6620 the compiler so much faster. Wow. I rule!
6622 * driver.cs: Make sure we always load mscorlib first (for
6623 debugging purposes, nothing really important).
6625 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
6626 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
6628 * rootcontext.cs: Lookup types on their namespace; Lookup types
6629 on namespaces that have been imported using the `using' keyword.
6631 * class.cs (TypeContainer::TypeAttr): Virtualize.
6632 (Class::TypeAttr): Return attributes suitable for this bad boy.
6633 (Struct::TypeAttr): ditto.
6634 Handle nested classes.
6635 (TypeContainer::) Remove all the type visiting code, it is now
6636 replaced with the rootcontext.cs code
6638 * rootcontext.cs (GetClassBases): Added support for structs.
6640 2001-08-06 Miguel de Icaza <miguel@ximian.com>
6642 * interface.cs, statement.cs, class.cs, parameter.cs,
6643 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
6644 Drop use of TypeRefs, and use strings instead.
6646 2001-08-04 Miguel de Icaza <miguel@ximian.com>
6650 * class.cs (Struct::Struct): set the SEALED flags after
6651 checking the modifiers.
6652 (TypeContainer::TypeAttr): new property, returns the
6653 TypeAttributes for a class.
6655 * cs-parser.jay (type_list): Oops, list production was creating a
6656 new list of base types.
6658 * rootcontext.cs (StdLib): New property.
6659 (GetInterfaceTypeByName): returns an interface by type name, and
6660 encapsulates error handling here.
6661 (GetInterfaces): simplified.
6662 (ResolveTree): Encapsulated all the tree resolution here.
6663 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
6666 * driver.cs: Add support for --nostdlib, to avoid loading the
6668 (Main): Do not put tree resolution here.
6670 * rootcontext.cs: Beginning of the class resolution.
6672 2001-08-03 Miguel de Icaza <miguel@ximian.com>
6674 * rootcontext.cs: Provide better error reporting.
6676 * cs-parser.jay (interface_base): set our $$ to be interfaces.
6678 * rootcontext.cs (CreateInterface): Handle the case where there
6679 are no parent interfaces.
6681 (CloseTypes): Routine to flush types at the end.
6682 (CreateInterface): Track types.
6683 (GetInterfaces): Returns an array of Types from the list of
6686 * typemanager.c (AddUserType): Mechanism to track user types (puts
6687 the type on the global type hash, and allows us to close it at the
6690 2001-08-02 Miguel de Icaza <miguel@ximian.com>
6692 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
6693 RecordInterface instead.
6695 * cs-parser.jay: Updated to reflect changes above.
6697 * decl.cs (Definition): Keep track of the TypeBuilder type that
6698 represents this type here. Not sure we will use it in the long
6699 run, but wont hurt for now.
6701 * driver.cs: Smaller changes to accomodate the new code.
6703 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
6706 * rootcontext.cs (CreateInterface): New method, used to create
6707 the System.TypeBuilder type for interfaces.
6708 (ResolveInterfaces): new entry point to resolve the interface
6710 (CodeGen): Property, used to keep track of the code generator.
6712 2001-07-26 Miguel de Icaza <miguel@ximian.com>
6714 * cs-parser.jay: Add a second production for delegate_declaration
6717 (enum_body): Put an opt_comma here instead of putting it on
6718 enum_body or enum_member_declarations so we can handle trailing
6719 commas on enumeration members. Gets rid of a shift/reduce.
6721 (type_list): Need a COMMA in the middle.
6723 (indexer_declaration): Tell tokenizer to recognize get/set
6725 * Remove old targets.
6727 * Re-add the parser target.
6729 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6731 * cs-parser.jay: Add precendence rules for a number of operators
6732 ot reduce the number of shift/reduce conflicts in the grammar.
6734 2001-07-17 Miguel de Icaza <miguel@ximian.com>
6736 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
6739 Get rid of old crufty code.
6741 * rootcontext.cs: Use this to keep track of the parsed
6742 representation and the defined types available to the program.
6744 * gen-treedump.cs: adjust for new convention.
6746 * type.cs: Split out the type manager, and the assembly builder
6749 * typemanager.cs: the type manager will live here now.
6751 * cil-codegen.cs: And the code generator here.
6753 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
6755 * makefile: Fixed up for easy making.
6757 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6759 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
6762 (unary_expression): Expand pre_increment_expression and
6763 post_decrement_expression to reduce a shift/reduce.
6765 2001-07-11 Simon Cozens
6767 * cs-tokenizer.cs: Hex numbers should begin with a 0.
6769 Improve allow_keyword_as_indent name.
6771 2001-06-19 Miguel de Icaza <miguel@ximian.com>
6773 * Adjustments for Beta2.
6775 2001-06-13 Miguel de Icaza <miguel@ximian.com>
6777 * decl.cs: Added `Define' abstract method.
6778 (InTransit): new property, used to catch recursive definitions.
6780 * interface.cs: Implement `Define'.
6782 * modifiers.cs: Map Modifiers.constants to
6783 System.Reflection.TypeAttribute flags.
6785 * class.cs: Keep track of types and user-defined types.
6786 (BuilderInit): New method for creating an assembly
6787 (ResolveType): New function to launch the resolution process, only
6788 used by interfaces for now.
6790 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
6791 that are inserted into the name space.
6793 2001-06-08 Miguel de Icaza <miguel@ximian.com>
6795 * ARGH. I have screwed up my tree so many times due to the use of
6796 rsync rather than using CVS. Going to fix this at once.
6798 * driver.cs: Objetify driver. Load assemblies, use assemblies to
6801 2001-06-07 Miguel de Icaza <miguel@ximian.com>
6803 * Experiment successful: Use System.Type rather that our own
6806 2001-05-25 Miguel de Icaza <miguel@ximian.com>
6808 * cs-parser.jay: Removed nsAliases from here.
6810 Use new namespaces, handle `using XXX;'
6812 * namespace.cs: Reimplemented namespace handling, use a recursive
6813 definition of the class. Now we can keep track of using clauses
6814 and catch invalid using clauses.
6816 2001-05-24 Miguel de Icaza <miguel@ximian.com>
6818 * gen-treedump.cs: Adapted for all the renaming.
6820 * expression.cs (Expression): this class now has a Type property
6821 which returns an expression Type.
6823 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
6824 `Type', as this has a different meaning now in the base
6826 2001-05-22 Miguel de Icaza <miguel@ximian.com>
6828 * interface.cs, class.cs: Removed from all the sources the
6829 references to signature computation, as we can not do method
6830 signature computation during the parsing time, as we are not
6831 trying to solve at that point distinguishing:
6835 void a (NS.Blah x) {}
6838 Which depending on the context might be valid or not, as we do not
6839 know if Blah is the same thing as NS.Blah at that point.
6841 * Redid everything so the code uses TypeRefs now instead of
6842 Types. TypeRefs are just temporary type placeholders, that need
6843 to be resolved. They initially have a pointer to a string and the
6844 current scope in which they are used. This is used later by the
6845 compiler to resolve the reference to an actual Type.
6847 * DeclSpace is no longer a CIR.Type, and neither are
6848 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
6849 are all DeclSpaces, but no Types.
6851 * type.cs (TypeRefManager): This implements the TypeRef manager,
6852 which keeps track of all the types that need to be resolved after
6853 the parsing has finished.
6855 2001-05-13 Miguel de Icaza <miguel@ximian.com>
6857 * ARGH. We are going to have to store `foreach' as a class rather
6858 than resolving it, as we need to verify error 1579 after name
6859 resolution. *OR* we could keep a flag that says `This request to
6860 IEnumerator comes from a foreach statement' which we can then use
6861 to generate the error.
6863 2001-05-10 Miguel de Icaza <miguel@ximian.com>
6865 * class.cs (TypeContainer.AddMethod): we now add methods to the
6866 MethodGroup instead of the method hashtable.
6868 * expression.cs: Add MethodGroup abstraction, which gets us one
6869 step closer to the specification in the way we handle method
6872 * cs-parser.jay (primary_expression): qualified_identifier now
6873 tried to match up an identifier to a local variable reference or
6874 to a parameter reference.
6876 current_local_parameters is now a parser global variable that
6877 points to the current parameters for the block, used during name
6880 (property_declaration): Now creates an implicit `value' argument to
6883 2001-05-09 Miguel de Icaza <miguel@ximian.com>
6885 * parameter.cs: Do not use `param' arguments as part of the
6886 signature, per the spec.
6888 2001-05-08 Miguel de Icaza <miguel@ximian.com>
6890 * decl.cs: Base class for classes, structs and interfaces. This
6891 is the "Declaration Space"
6893 * cs-parser.jay: Use CheckDef for checking declaration errors
6894 instead of having one on each function.
6896 * class.cs: Factor out some code for handling error handling in
6897 accordance to the "Declarations" section in the "Basic Concepts"
6898 chapter in the ECMA C# spec.
6900 * interface.cs: Make all interface member classes derive from
6901 InterfaceMemberBase.
6903 2001-05-07 Miguel de Icaza <miguel@ximian.com>
6905 * Many things: all interfaces are parsed and generated in
6906 gen-treedump. Support for member variables, constructors,
6907 destructors, properties, constants is there.
6909 Beginning of the IL backend, but very little done, just there for
6912 2001-04-29 Miguel de Icaza <miguel@ximian.com>
6914 * cs-parser.jay: Fix labeled statement.
6916 * cs-tokenizer.cs (escape): Escape " and ' always.
6917 ref_line, ref_name: keep track of the line/filename as instructed
6918 by #line by the compiler.
6921 2001-04-27 Miguel de Icaza <miguel@ximian.com>
6923 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
6924 to match the values in System.CodeDOM.
6926 Divid renamed to Divide.
6928 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
6930 (Statements.set): remove.
6932 * System.CodeDOM/CodeCatchClause.cs: always have a valid
6935 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
6936 falseStatements always have valid values.
6938 * cs-parser.jay: Use System.CodeDOM now.