1 2002-05-22 Martin Baulig <martin@gnome.org>
3 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
4 itself with debugging support.
6 2002-05-22 Martin Baulig <martin@gnome.org>
8 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
9 Removed, this isn't needed anymore.
11 2002-05-20 Martin Baulig <martin@gnome.org>
13 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
14 be underlying type for an enum.
16 2002-05-20 Miguel de Icaza <miguel@ximian.com>
18 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
19 that splits out the loading of just the core types.
21 * rootcontext.cs (ResolveCore): Split the struct resolution in
22 two, so we can load the enumeration underlying types before any
25 * expression.cs (Is): Bandaid until we fix properly Switch (see
26 bug #24985 for details).
28 * typemanager.cs (ImplementsInterface): The hashtable will contain
29 a null if there are no interfaces implemented.
31 2002-05-18 Miguel de Icaza <miguel@ximian.com>
33 * cs-parser.jay (indexer_declarator): It is fine to have array
36 2002-05-17 Miguel de Icaza <miguel@ximian.com>
38 * typemanager.cs: (RegisterBuilder): New function used to register
39 TypeBuilders that implement interfaces. Since
40 TypeBuilder.GetInterfaces (as usual) does not work with lame
42 (AddUserType): register interfaces.
44 (ImplementsInterface): Use the builder_to_ifaces hash if we are
45 dealing with TypeBuilder. Also, arrays are showing up as
46 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
47 methods can not be invoked on them!
49 * ecore.cs (ExplicitReferenceConversionExists): Made public.
50 (ImplicitReferenceConversionExists): Split out from
51 StandardConversionExists.
53 * expression.cs (As): We were only implementing one of the three
54 cases for the as operator. We now implement them all.
55 (Is): Implement the various other cases for Is as well.
57 * typemanager.cs (CACHE): New define used to control if we want or
58 not the FindMembers cache. Seems to have a negative impact on
61 (MemberLookup): Nested types have full acess to
62 enclosing type members
64 Remove code that coped with instance/static returns for events, we
65 now catch this in RealFindMembers.
67 (RealFindMembers): only perform static lookup if the instance
68 lookup did not return a type or an event.
70 2002-05-17 Miguel de Icaza <miguel@ximian.com>
72 * assign.cs (CompoundAssign): We pass more semantic information
73 now to Compound Assignments than we did before: now we have all
74 the information at hand, and now we resolve the target *before* we
75 do the expression expansion, which allows the "CacheValue" method
76 to have the effect we intended (before, a [x] += 1 would generate
77 two differen ArrayAccess expressions from the ElementAccess,
78 during the resolution process).
80 (CompoundAssign.DoResolve): Resolve target and original_source here.
82 2002-05-16 Miguel de Icaza <miguel@ximian.com>
84 * expression.cs (ArrayAccess): dropped debugging information.
86 * typemanager.cs: Small bug fix: I was always returning i_members,
87 instead of one of i_members or s_members (depending on which had
90 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
91 method is invoked before any code generation takes place, and it
92 is a mechanism to inform that the expression will be invoked more
93 than once, and that the method should use temporary values to
94 avoid having side effects
96 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
98 * ecore.cs (Expression.CacheTemporaries): Provide empty default
101 * expression.cs (Indirection, ArrayAccess): Add support for
102 CacheTemporaries in these two bad boys.
104 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
106 (StoreFromPtr): Handle stobj as well.
108 * expression.cs (UnaryMutator): Share more code.
110 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
111 down: I was not tracking the Filter function as well, which
112 was affecting the results of the cache.
114 2002-05-15 Miguel de Icaza <miguel@ximian.com>
116 * attribute.cs: Remove the hack to handle the CharSet property on
119 2002-05-14 Miguel de Icaza <miguel@ximian.com>
121 * attribute.cs (DoResolve): More uglyness, we now only try to
122 resolve the attribute partially, to extract the CharSet
123 information (only if we are a StructLayout attribute). Otherwise
125 (GetExtraTypeInfo): Add some code to conditionally kill in the
126 future this. I am more and more convinced that the .NET
127 framework has special code to handle the attribute setting on
130 * expression.cs (IsParamsMethodApplicable): Revert my previous
131 foreach change here, it was wrong.
133 2002-05-13 Miguel de Icaza <miguel@ximian.com>
135 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
136 (pp_expr): do not abort on unknown input, just return.
137 (eval): abort if there are pending chars.
139 * attribute.cs (Attribute.Resolve): Positional parameters are
140 optional. Deal with that case.
142 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
143 the Ansi/Unicode/Auto information for the type.
145 (TypeContainer.DefineType): instantiate the EmitContext here, as
146 we will be using it during the type definition (to resolve
147 attributes) and during the emit phase.
149 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
150 to pull type information out of the attributes
152 (Attribute.Resolve): track the constructor builder, and allow for
153 multiple invocations (structs and classes will use this).
155 * ecore.cs (MemberLookupFinal): new version with all the
156 parameters customizable.
158 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
159 constructors. Return if the result value is null (as the error
160 would have been flagged already by MemberLookupFinal)
162 Do not allow instances of abstract classes or interfaces to be
165 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
166 We have to compare the assembly property here when dealing with
167 FamANDAssem and Assembly access modifiers, because we might be
168 creating an assembly from *modules* (that means that we are not
169 getting TypeBuilders for types defined in other modules that are
170 part of this assembly).
172 (Method.Emit): If the method is marked abstract and has a body,
175 (TypeContainer.DefineMembers): If both the defined member and the
176 parent name match are methods, then do not emit any warnings: let
177 the Method.Define routine take care of flagging warnings. But if
178 there is a mismatch (method overrides something else, or method is
179 overriwritten by something, then emit warning).
181 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
182 set to null, this means `do not check for the return type on the
185 (Method.Define): set the return type for the method signature to
186 null, so that we get methods with the same name and parameters and
187 different return types. This is used to flag warning 114 (you are
188 hiding a method, and you probably want to use the new/override
191 * typemanager.cs (MemberLookup): Implemented proper access
192 control, closing a long standing set of bug reports. The problem
193 was that the Framework only has two bits: Public and NonPublic,
194 and NonPublic includes private and protected methods, but we need
195 to enforce the FamANDAssem, FamOrAssem and Family.
197 2002-05-11 Miguel de Icaza <miguel@ximian.com>
199 * statement.cs (GotoCase): Return true: Ammounts to giving up
200 knowledge on whether we return or not, and letting the other case
201 be responsible for it.
203 2002-05-10 Miguel de Icaza <miguel@ximian.com>
205 * driver.cs: Do not load directories for each file processed, only
206 do it if there is a pattern.
208 * ecore.cs: Report readonly assigns here as well, as we might have
209 been resolved only by MemberAccess.
211 (SimpleName.SimpleNameResolve): Also be useful for LValue
212 resolution. We need this to propagate assign to local readonly variables
214 * typemanager.cs: Use a ptrhashtable for the criteria, because we
215 do not want to reuse potential criteria memory.
217 * class.cs (MyEventBuilder): Set reflected_type;
219 * ecore.cs (Constantify): Added support for constifying bools.
221 (RootContext.LookupType): Added a cache for values looked up in
222 the declaration space.
224 * typemanager.cs (FindMembers): Now is a front-end to
225 RealFindMembers, and provides a two-level hashtable-based cache to
228 15% performance improvement: from 22.5 to 19.2 seconds.
230 * expression.cs (IsParamsMethodApplicable): use foreach.
231 (Invocation.DoResolve): ditto.
232 (New.DoResolve): ditto.
233 (ArrayCreation.DoResolve): ditto.
235 * ecore.cs (FindMostEncompassingType): use foreach.
237 * delegate.cs (NewDelegate.DoResolve): Use foreach
239 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
240 (RemoveMethods): use foreach.
242 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
243 nested foreach statements instead of for, and also break out of
244 the inner loop once a match is found.
246 (Invocation.OverloadResolve): Use foreach, simplify the code.
248 2002-05-08 Miguel de Icaza <miguel@ximian.com>
250 * cfold.cs (BinaryFold): During an enumeration evaluation context,
251 we actually unwrap the expression to allow for extra information
254 * expression.cs: Use Shr_Un on unsigned operations.
256 2002-05-08 Ravi Pratap <ravi@ximian.com>
258 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
259 applicable operators was not being considered correctly. This closes
260 the bug Miguel reported.
262 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
264 * attribute.cs: check that the type derives from System.Attribute
265 and report the correct error in that case (moved the duplicate code to
266 its own method, too).
268 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
270 * attribute.cs: lookup attribute type name as the spec says: first the
271 bare attribute name and then name + "Attribute" (nant compiles with
274 2002-05-07 Miguel de Icaza <miguel@ximian.com>
276 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
277 Because of the way we parse things, we should try to see if a
278 UIntConstant can fit in an integer.
280 2002-05-07 Ravi Pratap <ravi@ximian.com>
282 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
283 when we are in an explicit context.
285 (ConvertReferenceExplicit): When converting from Iface type S to Class
286 T make sure the rules are implemented as an OR.
288 * parameter.cs (ParameterType): Make it a property for now although the
289 purpose really isn't anything immediate.
291 * expression.cs (Is*Applicable): Do better checking on the parameter type
292 of a ref/out parameter. The ones from the system assemblies are already
293 marked with the correct type so we don't need to do any correction.
295 * ecore.cs (StandardConversionExists): Conversion from Interface types to
296 the object type is standard too so include that.
298 2002-05-06 Miguel de Icaza <miguel@ximian.com>
300 * ecore.cs (StandardConversionExists): Augment with missing code:
301 deal with IntConstant, LongConstants and Enumerations.
303 * assign.cs: Report the error, instead of failing silently
305 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
306 typecontainer that they are declared, because the
307 typecontainer/namespace will have the list of using clauses that
310 Assembly Attributes were escaping the normal registration
313 (EmitCode): Apply attributes within an EmitContext that represents
314 the container they were declared on.
316 * cs-parser.jay: Track bases for structs. How did I get this wrong?
318 2002-05-06 Ravi Pratap <ravi@ximian.com>
320 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
321 Revamp completely - make much cleaner as we now operate only
324 (FindMostSpecificSource, FindMostSpecificTarget): New methods
325 to implement the logic detailed in the spec more correctly.
327 (UserDefinedConversion): Update accordingly.
329 2002-05-06 Miguel de Icaza <miguel@ximian.com>
331 * statement.cs: Return flow analysis information up.
333 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
336 (token): Do not consume an extra character before calling
339 2002-05-06 Piers Haken <piersh@friskit.com>
341 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
343 2002-05-06 Miguel de Icaza <miguel@ximian.com>
345 * class.cs (Constructor.Emit): Set the IsStatic flag in the
346 EmitContext during the instance constructor initializer
347 resolution, to stop access to instance variables.
349 This is mandated by the spec, last paragraph of the `constructor
350 initializers' section.
352 2002-05-05 Miguel de Icaza <miguel@ximian.com>
354 * cs-parser.jay, class.cs (Accessor): new class used to represent
355 an accessor (get or set). In the past we used `null' to represent
356 a missing accessor. But this is ambiguous because there was no
357 way to tell in abstract indexers/properties if one of them was
360 Now there is a way of addressing that.
362 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
363 instead of FindMembers.
365 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
366 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
368 * attribute.cs: Treat indexers and properties as the same in terms
369 of applying attributes
371 * ecore.cs (FindMostEncompassedType): Use statically initialized
372 EmptyExpressions()s like we do elsewhere to avoid creating useless
373 objects (and we take this out of the tight loop).
375 (GetConversionOperators): Move the code to extract the actual
376 operators to a separate routine to clean things up.
378 2002-05-04 Miguel de Icaza <miguel@ximian.com>
380 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
381 events are always registered FieldBuilders.
383 * class.cs (FieldBase): New class shared by Fields
385 * delegate.cs: If we are a toplevel delegate, use our full name.
386 If we are a nested delegate, then only use our tail name.
388 2002-05-02 Ravi Pratap <ravi@ximian.com>
390 * expression.cs (IsApplicable): Ensure that we add the "&" to
391 ref/out types before comparing it with the type of the argument.
393 (IsParamsMethodApplicable): Ditto.
395 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
398 * delegate.cs : Handle the case when we have more than one applicable
399 method. Flag an error only when we finish checking all.
401 2002-05-02 Miguel de Icaza <miguel@ximian.com>
403 * expression.cs: Add support for boolean static initializers.
405 2002-05-01 Miguel de Icaza <miguel@ximian.com>
407 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
409 * parameter.cs (ComputeParameterTypes,
410 ComputeAndDefineParameterTypes): Better error handling: now we
411 clear the `types' cache if we fail during any of the type lookups.
412 We also return the status code correctly to our caller
414 * delegate.cs: If we fail to define a delegate, abort the extra
417 * expression.cs (Binary.ResolveOperator): for
418 operator==(object,object) and operator !=(object, object) we also
419 have to verify that there is an implicit conversion from one to
422 (ArrayAccess.DoResolve): Array Access can operate on
425 2002-04-30 Miguel de Icaza <miguel@ximian.com>
427 * assign.cs (CompoundAssign): A new class used as a "flag" that
428 the assignment actually is happening as part of a compound
431 During compound assignment, a few new rules exist to enable things
438 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
439 to the type of x) if y is implicitly convertible to the type of x,
440 and the operator is a builtin operator and the return type of the
441 operator is explicitly convertible to the type of x.
443 * rootcontext.cs: Reset warning level to 2. 4 catches various
444 "interesting" features in mcs, we must clean this up at some
445 point, but currently am trying to kill other bugs ;-)
447 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
448 in container classes as well.
450 * expression.cs (Binary.ResolveOperator): Handle string case
451 before anything else (as operator overloading does emit an error
452 before doing anything else).
454 This code could go away when we move to a table driven model, but
455 i could not come up with a good plan last night.
457 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
459 * typemanager.cs (CSharpName): reimplementation using regex.
460 * class.cs: added null check for fields in Emit
461 * rootcontext.cs: set warninglevel to 4
463 2002-04-29 Miguel de Icaza <miguel@ximian.com>
465 * typemanager.cs (CSharpName): reimplemented with Lupus
468 2002-04-28 Miguel de Icaza <miguel@ximian.com>
470 * statement.cs (If): correclty implement Resolve, because we were
471 not catching sem errors in there. The same process is needed
473 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
476 (Statement.Warning_DeadCodeFound): Factorize code.
477 (While): Report dead code here too.
479 (Statement): Added Resolve virtual method to allow
480 for resolution split from the emit code.
482 2002-04-26 Miguel de Icaza <miguel@ximian.com>
484 * statement.cs (EmitBoolExpression): No longer try to resolve the
486 (MakeBoolean): New utility function that resolve, implicitly
487 converts to boolean and tags the expression.
490 (If, Do): Implement dead code elimination.
491 (While): Implement loop inversion
493 (Do, While, For, If): Resolve the expression prior to calling our
496 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
499 - added method Report28 (warning: program has more than one entry point)
500 - added method IsEntryPoint, implements paragraph 10.1 of the spec
501 - modified method Method.Define, the part at the end of the method
503 * rootcontext.cs: added static public Location EntryPointLocation;
505 * ../errors/cs0028.cs : Add test case for the above warning.
508 - modified method CSharpName to allow arrays of primitive type to
509 be printed nicely (e.g. instead of System.Int32[][] it now prints
511 - added method CSharpSignature: returns the signature of a method
512 in string format to be used in reporting errors, warnings, etc.
514 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
517 2002-04-26 Ravi Pratap <ravi@ximian.com>
519 * delegate.cs (Define): Fix extremely silly bug where I was
520 setting the type of the 'object' parameter of the BeginInvoke
521 method to System.IAsyncResult instead of System.Object ;-)
523 2002-04-26 Miguel de Icaza <miguel@ximian.com>
525 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
528 (Constructor.Emit): return if we fail to initialize the
529 constructor. Another door closed!
531 * expression.cs (New.DoResolve): Improve error message (from -6 to
532 1501). Use DeclaredOnly lookup to find the exact constructor.
534 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
535 loop. This is useful.
537 * cs-parser.jay: Adjust the default parameters so that destructors
538 have the proper signature.
540 2002-04-26 Martin Baulig <martin@gnome.org>
542 * driver.cs (LoadAssembly): If `assembly' contains any characters
543 which are only valid in path names and not in assembly names
544 (currently slash, backslash and point), use Assembly.LoadFrom ()
545 instead of Assembly.Load () on the `assembly' (before iteration
546 over the link_paths).
548 2002-04-26 Martin Baulig <martin@gnome.org>
550 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
552 2002-04-25 Miguel de Icaza <miguel@ximian.com>
554 * class.cs (Property): use the new typemanager.MemberLookup
556 (TypeContainer.MemberLookup): Implement using the
557 TypeManager.MemberLookup now.
559 * typemanager.cs: Make MemberLookup a function of the TypeManager,
560 and return MemberInfos, so that these can be used without an
561 EmitContext (what we had before).
563 2002-04-24 Miguel de Icaza <miguel@ximian.com>
565 * expression.cs: Fix the case where the argument to params if the
566 type of the params. I omitted handling this before. Fixed
568 2002-04-22 Miguel de Icaza <miguel@ximian.com>
570 * driver.cs: Call BootCorlib_PopulateCoreType
572 * class.cs (Property.CheckBase): Check for properties only, not
575 * interface.cs: Temporary hack: try/catch around the
576 CustomAttributeBuilder, because I am getting an exception that I
579 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
580 types whose definitions are required to be there (attributes are
581 defined before standard types).
583 Compute definitions as we boot the various types, as they are used
584 immediately (value_type class will need object_type, but if we do
585 not initialize object_type, we will pass a null, which will let
586 the runtime pick the System.Object from the existing corlib, which
587 is not what we want).
589 2002-04-22 Patrik Torstensson <totte@labs2.com>
591 * cs-tokenizer.cs: fixed a number of trim() issues.
593 2002-04-22 Ravi Pratap <ravi@ximian.com>
595 * expression.cs (Argument.Type): Ensure that we return the correct
596 type when we have out or ref parameters [in which case we
599 2002-04-22 Miguel de Icaza <miguel@ximian.com>
601 * class.cs (Property, Indexer): Allow extern modifier in there.
603 * typemanager.cs (InitBaseTypes): Initializes object_type and
604 value_type, since those will be used early on during the bootstrap
605 process to compile corlib.
607 (InitCoreTypes): Move code from here to InitBaseTypes.
609 2002-04-21 Miguel de Icaza <miguel@ximian.com>
611 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
612 single-dimension arrays as using the ldlen opcode.
614 Daniel Lewis discovered this optimization.
616 * typemanager.cs: Add signature for System.Array::get_Length
618 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
620 * statement.cs: report the error when the foreach does not apply to an
621 array nor a collection.
623 2002-04-19 Miguel de Icaza <miguel@ximian.com>
625 * expression.cs: Add implicit conversions to the operator ~.
627 * constant.cs (DecimalConstant.Emit): Emit decimal value.
629 * typemanager.cs: Locate the decimal constructor.
631 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
633 * attribute.cs: use the new property of TypeOf.
634 * expression.cs: added 'get' property around typearg.
636 These changes fix a build breaker reported by NickD. Is this the
637 correct way to fix? If not, please, revert my changes and make it
640 2002-04-17 Miguel de Icaza <miguel@ximian.com>
642 * attribute.cs: Add support for typeof in attribute invocations.
643 I am not sure that this is right though.
645 2002-04-14 Duncan Mak <duncan@ximian.com>
647 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
648 Binary.Operator.Division case.
650 2002-04-13 Ravi Pratap <ravi@ximian.com>
652 * class.cs (DefineType): Ensure that we do a proper check on
653 attribute types and also register it with the TypeManager.
655 (TypeContainer.Targets): The default for attribute types is
656 AttributeTargets.All.
658 * attribute.cs (ApplyAttributes): Registering the attribute type
659 is done elsewhere, not when we discover we have a Usage attribute.
661 2002-04-12 Ravi Pratap <ravi@ximian.com>
663 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
664 and get rid of is_delegate parameter.
666 * everywhere : update.
668 2002-04-12 Ravi Pratap <ravi@ximian.com>
670 * cs-parser.jay (compilation_unit): Revamp completely to use
671 some new ideas that I got from Rhys' grammar to solve the problems
672 with assembly level attributes.
674 (outer_declaration): New grammar production.
676 (attribute_sections): Add.
678 (opt_attributes): Base on attribute_sections
680 (namespace_declaration): Allow opt_attributes to tackle the case
681 when we have assembly level attributes - we are clever in this
684 * attribute.cs (ApplyAttributes): Do not worry about assembly
685 attributes in the non-global context.
687 * rootcontext.cs (AddGlobalAttributes): Go back to using this
688 instead of SetGlobalAttributes.
690 * class.cs, rootcontext.cs : Ensure we define and generate
691 attribute types before anything else.
693 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
694 and flag the new error -20 for the case when the attribute type
695 does not have valid targets specified. csc does not catch this.
697 * ../errors/errors.txt : update for error # -20
699 2002-04-11 Ravi Pratap <ravi@ximian.com>
701 * support.cs (InternalParameters.ParameterModifier): Do some null
702 checking and return sane values.
704 * class.cs (Method.Define): If we are a PInvoke method, ensure
705 that we are static and extern. Report error # 601
707 * ../errors/cs0601.cs : Add test case for the above error.
709 2002-04-07 Ravi Pratap <ravi@ximian.com>
711 * rootcontext.cs (attribute_types): We need to keep type of
712 all attribute types separately and emit code for them first.
714 (RegisterAttribute) : Implement.
716 * class.cs (DefineType): Check if the current Type is a custom
717 attribute type and register it accordingly.
719 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
720 adding the first attribute twice and rename to
722 (SetGlobalAttributes): this.
724 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
727 * attribute.cs (ApplyAttributes): Take an additional argument telling us
728 if we are processing global arguments. Hmm, I am unsure of this.
730 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
732 * expression.cs: added static array of strings to avoid calling
733 Enum.ToString () for Operator in Binary. Significant recover of
736 2002-04-10 Miguel de Icaza <miguel@ximian.com>
738 * class.cs (FindMembers): Allow the Builders of the various
739 members to be null. If they are skip them. This only happens
740 during the PInvoke declaration.
742 2002-04-09 Miguel de Icaza <miguel@ximian.com>
744 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
745 failure, so we do not keep going afterwards.
747 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
748 wanted to pass `false' as the `is_delegate' argument. If this is
749 the case, why not use delegate_type == null to mean `is_delegate =
750 false' and anything else as is_delegate = true.
752 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
754 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
755 code for the section, not the beginning of the tests.
757 2002-04-08 Miguel de Icaza <miguel@ximian.com>
759 * cfold.cs: Handle operator + (Enum x, Underlying x)
761 * expression.cs (Binary): same. Warn about errors where we have
762 Enum/Enum in operator + as well.
764 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
767 - added support for switch(bool)
768 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
769 - add TableSwitchEmit() to handle table-based switch statements
771 2002-04-05 Ravi Pratap <ravi@ximian.com>
773 * expression.cs (Invocation.OverloadResolve): Factor out code which
774 does parameter compatibility checking with arguments so that we can
775 re-use the code even from Delegate.VerifyApplicability
777 (VerifyArgumentsCompat): Move above code here.
779 * delegate.cs (VerifyApplicability): Get rid of duplicate code
780 and instead make a call to the above method.
782 2002-03-31 Ravi Pratap <ravi@ximian.com>
784 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
785 We use it to keep track of classes which are attribute types.
787 2002-04-02 Miguel de Icaza <miguel@ximian.com>
789 * delegate.cs (Delegate.Define): Correctly define the types in the
790 presence of fixed and array parameters.
792 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
795 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
796 include NonPublic after the first iteration.
798 * class.cs (Indexer.CheckBase): Only check if both parents are
801 * cs-parser.jay (accessor_body): If empty, set to null.
803 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
804 same code path here to resolve constants names that we did have in
805 MemberAccess.DoResolve. There is too much code duplicated here.
807 2002-04-01 Miguel de Icaza <miguel@ximian.com>
809 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
811 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
814 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
815 tokens, numbers and strings.
817 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
820 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
821 asyncronous parameters and the regular parameters.
823 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
824 specify the target directory.
826 * expression.cs: (This.DoResolve): Simplify
827 (As.Emit): Optimize, do not generate IsInst if the expression is
828 always of the given type.
830 (Is.DoResolve): Bug fix, we were reporting both always/never for
833 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
834 creating too many unnecessary arrays.
836 2002-03-31 Miguel de Icaza <miguel@ximian.com>
838 * class.cs (EmitFieldInitializer): Use Assign expression to assign
839 fields instead of rolling our own initializer. Takes care of all
840 implicit conversions, and drops unnecessary static checks/argument.
842 2002-03-31 Dick Porter <dick@ximian.com>
844 * driver.cs: use the GetDirectories() return values properly, and
845 use "/" as path separator.
847 2002-03-30 Miguel de Icaza <miguel@ximian.com>
849 * expression.cs (Unary): Optimize - - expr into expr.
850 (Binary): Optimize a + (-b) into a -b.
852 * codegen.cs (CodeGen): Made all methods static.
854 2002-03-29 Miguel de Icaza <miguel@ximian.com>
858 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
859 TypeBuilder property.
861 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
864 * tree.cs: Removed the various RecordXXXX, and replaced with a
865 single RecordDecl. Removed all the accessor methods, and just
866 left a single access point Type
868 * enum.cs: Rename DefineEnum to DefineType.
870 * decl.cs: New abstract method `DefineType' used to unify the
871 Defines for Enumerations, Interfaces, TypeContainers and
874 (FindType): Moved LookupInterfaceOrClass here. Moved the
875 LookupBaseClasses method that used to live in class.cs and
876 interface.cs here, and renamed to FindType.
878 * delegate.cs: Implement DefineType. Take advantage of the
879 refactored pattern for locating the parent builder without taking
880 the parent_builder argument (which we know does not work if we are
881 nested, and triggering a toplevel definition).
883 2002-03-28 Miguel de Icaza <miguel@ximian.com>
885 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
886 accessibility of a member has changed during override and report
889 * class.cs (Method.Define, Property.Define): Only complain on
890 overrides if the method is private, any other accessibility is
891 fine (and since we just checked the permission is the same, we are
894 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
895 and elif are processed always. The other pre-processing
896 directives are only processed if we are "taking" the path
898 2002-03-29 Martin Baulig <martin@gnome.org>
900 * class.cs (Method.Emit): Only emit symbolic debugging info if the
901 current location is not Null.
903 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
904 a separate method so we can profile it.
906 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
907 `span.Seconds' are just seconds, but no minutes or hours.
908 (MainDriver): Profile the CodeGen.SaveSymbols calls.
910 2002-03-28 Miguel de Icaza <miguel@ximian.com>
912 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
913 Remove the gratuitous set of Final:
915 // If an interface implementation, then we can set Final.
916 if (((flags & MethodAttributes.Abstract) == 0) &&
917 implementing.DeclaringType.IsInterface)
918 flags |= MethodAttributes.Final;
920 I do not know what I was smoking when I used that.
923 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
924 step into fixing the name resolution issues for delegates and
925 unifying the toplevel name resolution.
927 2002-03-28 Martin Baulig <martin@gnome.org>
929 * class.cs (Method.Emit): If we have a symbol writer, call its
930 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
931 tell it about the current method.
933 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
934 writer that we're going to emit the first byte of IL code for a new
935 statement (a new source line).
936 (EmitContext.EmitTopBlock): If we have a symbol writer, call
937 EmitContext.Mark() before emitting any code.
939 * location.cs (SymbolDocument): Return null when we're Null.
941 * statement.cs (Statement): Moved the `Location loc' variable here.
942 (Statement.EmitBoolExpression): If we have a symbol writer, call
943 ec.Mark() before emitting any code to tell it that we're at the
944 beginning of a new statement.
945 (StatementExpression): Added `Location' argument to the constructor.
946 (Block): Added public readonly variable `StartLocation' and public
947 variable `EndLocation'. The latter is to be set using SetEndLocation().
948 (Block): Added constructor which takes a start and end location.
949 (Block.SetEndLocation): New method. This sets the end location.
950 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
951 local variables we create.
952 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
953 each statement and do also mark the begin and end of the block.
955 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
956 tell it the current lexer.Location, use Location.Null for the end of the
958 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
959 current block, set its end location using SetEndLocation().
960 (statement_expression): StatementExpression constructor now takes the
961 lexer.Location as additional argument.
962 (for_statement, declare_local_variables): Likewise.
963 (declare_local_variables): When creating a new implicit block, use the
964 new Block constructor and pass it the lexer.Location.
966 2002-03-28 Miguel de Icaza <miguel@ximian.com>
968 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
969 members also on the parent interfaces recursively.
971 2002-03-27 Miguel de Icaza <miguel@ximian.com>
973 * report.cs: Use new formats, since Gonzalo finished the missing
976 * expression.cs (Binary.ResolveOperator): added missing operator|
977 operator& and operator^ for bool/bool.
979 * cs-parser.jay: CheckDef now takes a Location argument that is
980 used to report errors more precisly (instead of reporting the end
981 of a definition, we try to track something which is a lot closer
982 to the source of the problem).
984 * cs-tokenizer.cs: Track global token use, so we can properly flag
985 the use of #define/#undef after the first token has been seen.
987 Also, rename the reportXXXX to Error_DescriptiveName
989 * decl.cs (DeclSpace.IsTopLevel): Move property here from
990 TypeContainer, so that Enum and Interface can use this too.
992 * class.cs (TypeContainer.LookupInterfaceOrClass,
993 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
994 `builder' argument. Typically this was used to pass the parent
995 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
998 The problem is that a nested class could trigger the definition of
999 a toplevel class, and the builder would be obviously wrong in that
1002 So we drop this argument, and we compute dynamically the
1003 TypeBuilder/ModuleBuilder (the correct information was available
1004 to us anyways from DeclSpace.Parent)
1006 * interface.cs (Interface.DefineInterface): Drop builder
1007 parameter cleanup like class.cs
1009 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
1012 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
1015 (Try.Emit): Propagate the returns value from the statement.
1017 (Return.Emit): Even if we are leavning
1019 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
1021 * modifiers.cs: Fix the computation of MethodAttributes flags.
1023 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
1025 * driver.cs: allow compilation of files that start with '/'.
1026 Add a default case when checking the argument of --target.
1028 2002-03-25 Miguel de Icaza <miguel@ximian.com>
1030 * interface.cs: Implement the same search algorithm for types in
1033 * delegate.cs: Do not allow multiple definition.
1035 * Recovered ChangeLog that got accidentally amputated
1037 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
1039 * rootcontext.cs: Load manually enum to allow core classes to
1040 contain enumerations.
1042 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
1043 Update to new static methods in TypeManager.
1045 * typemanager.cs (GetMethod, GetConstructor): Use our
1046 implementation of FindMembers to find the members, since during
1047 corlib compilation, the types are TypeBuilders and GetMethod and
1048 GetConstructor do not work.
1050 Make all methods in TypeManager static.
1052 (InitCodeHelpers): Split the functionality from
1053 the InitCodeTypes function.
1055 * driver.cs: Call InitCodeHelpers after we have populated the
1058 * cs-parser.jay (delegate_declaration): we did not used to compute
1059 the delegate name correctly for void delegates.
1061 2002-03-24 Miguel de Icaza <miguel@ximian.com>
1063 * rootcontext.cs (RootContext): Init the interface_resolve_order
1064 and type_container_resolve_order always.
1066 (ResolveCore, BootstrapCorlib_ResolveClass,
1067 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
1068 compiler when compiling with --nostdlib
1070 * class.cs (TypeContainer.DefineType): Check that our parent is
1071 not null. This test is most important when we are bootstraping
1074 * codegen.cs: Split out the symbol writing code.
1076 2002-03-25 Martin Baulig <martin@gnome.org>
1078 * driver.cs (-g): Made -g an alias for --debug.
1080 2002-03-24 Martin Baulig <martin@gnome.org>
1082 * codegen.cs (SymbolWriter): New public variable. Returns the
1083 current symbol writer.
1084 (CodeGen): Added `bool want_debugging_support' argument to the
1085 constructor. If true, tell the ModuleBuild that we want debugging
1086 support and ask it for the ISymbolWriter.
1087 (Save): If we have a symbol writer, call it's Close() method after
1088 saving the assembly.
1090 * driver.c (--debug): New command line argument to create a
1091 debugger information file.
1093 * location.cs (SymbolDocument): New public property. Returns an
1094 ISymbolDocumentWriter object for the current source file or null
1095 if we don't have a symbol writer.
1097 2002-03-21 Miguel de Icaza <miguel@ximian.com>
1099 * driver.cs (LoadAssembly): Correctly return when all the paths
1100 have been tried and not before.
1102 * statement.cs (Switch.Emit): return the actual coverage for this
1103 statement (returns/not-returns)
1105 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
1106 switch of the statement if we are the last switch section. That
1107 kills two problems: try/catch problems (we used to emit an empty
1108 nop at the end) and switch statements where all branches would
1111 2002-03-19 Miguel de Icaza <miguel@ximian.com>
1113 * driver.cs: Add default assemblies (the equivalent to the
1114 Microsoft CSC.RSP file)
1116 * cs-tokenizer.cs: When updating `cols and setting it to zero,
1117 also update tokens_seen and set it to false.
1119 * driver.cs: Implement --recurse for Mike.
1121 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
1122 correctly splitting out the paths.
1124 2002-03-18 Miguel de Icaza <miguel@ximian.com>
1126 * interface.cs (Interface.PopulateProperty): Instead of using
1127 `parent' as the declaration space for the set parameters, use
1130 * support.cs (InternalParameters): InternalParameters constructor
1131 takes a DeclSpace instead of a TypeContainer.
1133 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
1134 types are being initialized, load the address of it before calling
1137 (New): Provide a mechanism to disable the generation of local
1138 value type temporaries when the caller will be providing us with
1139 an address to store it.
1141 (ArrayCreation.EmitDynamicInitializers): Use it.
1143 2002-03-17 Miguel de Icaza <miguel@ximian.com>
1145 * expression.cs (Invocation.EmitArguments): Only probe for array
1146 property if there is more than one argument. Sorry about that.
1148 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
1151 * class.cs (Method.LabelParameters): Fix incorrect code path that
1152 prevented the `ParamArrayAttribute' from being applied to the
1155 2002-03-16 Miguel de Icaza <miguel@ximian.com>
1157 * support.cs (ReflectionParameters): Correctly compute whether the
1158 last argument is a params array. Fixes the problem with
1161 * typemanager.cs: Make the assemblies array always be non-null
1162 (empty, but non-null)
1164 * tree.cs (RecordDecl): New function that abstracts the recording
1165 of names. This reports error 101, and provides a pointer to the
1166 previous declaration. Fixes a crash in the compiler.
1168 * cs-parser.jay (constructor_declaration): Update to new grammar,
1169 and provide a constructor_body that can be empty.
1171 2002-03-15 Miguel de Icaza <miguel@ximian.com>
1173 * driver.cs: Add support for --resources.
1175 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
1176 Make all types for the various array helper methods be integer.
1178 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
1179 CheckState to ConvCast.
1181 (ConvCast): Now it takes a `checked' state argument, to avoid
1182 depending on the emit context for the conversion, and just using
1183 the resolve time setting.
1185 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
1186 instead of Invocation.EmitArguments. We do not emit the original
1187 arguments, instead we emit those which have been converted to
1188 unsigned int expressions.
1190 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
1192 * codegen.cs: ditto.
1194 * expression.cs (LocalVariableReference): Drop the use of the
1195 Store function that depended on the variable index.
1197 * statement.cs (VariableInfo): Drop the `Idx' property from this
1198 class, as this is not taking into account the indexes for
1199 temporaries tat we generate during the execution, getting the
1202 * class.cs: First emit class initializers, then call the parent
1205 * expression.cs (Binary): Fix opcode emision.
1206 (UnaryMutator.EmitCode): Support checked code generation
1208 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
1209 matches for events for both the Static and Instance scans,
1210 pointing to the same element. Fix that.
1212 2002-03-14 Miguel de Icaza <miguel@ximian.com>
1214 * rootcontext.cs (ResolveTree): Always set the
1215 interface_resolve_order, because nested interfaces will be calling
1218 * class.cs (GetInterfaceOrClass): Track the same resolution
1219 process used by TypeManager.LookupType. This fixes the nested
1220 type lookups in class declarations (separate path from
1223 (TypeContainer.DefineType): Also define nested interfaces.
1224 (TypeContainer.RegisterOrder): New public function used to
1225 register the order in which child interfaces need to be closed.
1227 Nested interfaces need to be closed after their parents have been
1230 * interface.cs (InterfaceAttr): Put all the logic for computing
1231 the interface attribute here.
1233 (DefineInterface): Register our interface order with the
1234 RootContext or with the TypeContainer depending on the case.
1236 2002-03-12 Miguel de Icaza <miguel@ximian.com>
1238 * cs-parser.jay: rework foreach statement to work with the new
1239 changes to the policy on SimpleNames.
1241 * report.cs: support Stacktrace on warnings as well.
1243 * makefile: drop --unsafe and /unsafe from the compile.
1245 2002-03-13 Ravi Pratap <ravi@ximian.com>
1247 * ecore.cs (StandardConversionExists): Modify to take an Expression
1248 as the first parameter. Ensure we do null -> reference type conversion
1251 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
1252 temporary Expression objects.
1254 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
1256 * interface.cs: workaround bug in method overloading resolution
1257 (there is already a bugzilla bug for it).
1259 2002-03-12 Miguel de Icaza <miguel@ximian.com>
1261 We could also solve this problem by having a separate path for
1262 performing type lookups, instead of DoResolve, we could have a
1263 ResolveType entry point, and only participating pieces of the
1264 production (simplename, deref, array) would implement this.
1266 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
1267 signal SimpleName to only resolve type names and not attempt to
1268 resolve anything else.
1270 * expression.cs (Cast): Set the flag.
1272 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
1274 * class.cs: Only report 108 if there is no `new' modifier.
1276 * cs-parser.jay: rework foreach statement to work with the new
1277 changes to the policy on SimpleNames.
1279 * report.cs: support Stacktrace on warnings as well.
1281 * makefile: drop --unsafe and /unsafe from the compile.
1283 2002-03-11 Miguel de Icaza <miguel@ximian.com>
1285 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1286 lookups here, instead of doing that at parse time. This means
1287 that our grammar will not introduce `LocalVariableReferences' as
1288 expressions at this point. That solves the problem of code like
1296 This is only half the fix. The full fix requires parameters to
1297 also be handled in this way.
1299 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
1300 makes the use more obvious of the DeclSpace. The
1301 ec.TypeContainer.TypeBuilder is now only used to pull the
1304 My theory is that I can get rid of the TypeBuilder completely from
1305 the EmitContext, and have typecasts where it is used (from
1306 DeclSpace to where it matters).
1308 The only pending problem is that the code that implements Aliases
1309 is on TypeContainer, and probably should go in DeclSpace.
1311 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1312 lookups here, instead of doing that at parse time. This means
1313 that our grammar will not introduce `LocalVariableReferences' as
1314 expressions at this point. That solves the problem of code like
1322 This is only half the fix. The full fix requires parameters to
1323 also be handled in this way.
1325 * class.cs (Property.DefineMethod): When implementing an interface
1326 method, set newslot, when implementing an abstract method, do not
1327 set the flag (before we tried never setting it, or always setting
1328 it, which is the difference).
1329 (Indexer.DefineMethod): same.
1330 (Method.DefineMethod): same.
1332 * ecore.cs: Only set the status used flag if we get back a Field.
1334 * attribute.cs: Temporary hack, so Paolo can keep working.
1336 2002-03-08 Ravi Pratap <ravi@ximian.com>
1338 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
1339 the unmanaged type in the case we have a MarshalAs attribute.
1341 (Resolve): Handle the case when we are parsing the special MarshalAs
1342 attribute [we need to store the unmanaged type to use later]
1344 * typemanager.cs (marshal_as_attr_type): Built in type for the
1345 MarshalAs Attribute.
1347 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
1348 on parameters and accordingly set the marshalling info.
1350 2002-03-09 Miguel de Icaza <miguel@ximian.com>
1352 * class.cs: Optimizing slightly by removing redundant code after
1353 we switched to the `NoTypes' return value.
1354 (Property.DefineMethod): use NoTypes here too.
1356 This fixes the bug I introduced in my last batch of changes.
1358 2002-03-05 Ravi Pratap <ravi@ximian.com>
1360 * tree.cs (RecordEnum): Add. We now keep track of enums too.
1362 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
1363 Enums since those are types too.
1365 * cs-parser.jay (enum_declaration): Record enums as we parse them.
1367 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
1368 thanks to a call during the lookup process.
1370 2002-03-07 Miguel de Icaza <miguel@ximian.com>
1372 * statement.cs (Foreach): Lots of work to accomodate a particular
1373 kind of foreach statement that I had not kept in mind. It is
1374 possible to have foreachs on classes that provide a GetEnumerator
1375 method that return objects that implement the "pattern" for using
1376 a foreach, there is no need to support GetEnumerator
1379 This is needed to compile nant.
1381 * decl.cs: Only report 114 if the member is not `Finalize' and if
1382 the warning level is at least 2.
1384 * class.cs: Moved the compare function from Method to
1387 (MethodSignature.InheritableMemberSignatureCompare): Add new
1388 filter function that is used to extract inheritable methods from a
1391 (Method.Define): Use the new `inheritable_method_signature_filter'
1394 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
1397 2002-03-06 Miguel de Icaza <miguel@ximian.com>
1399 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
1401 * cs-parser.jay: Add opt_semicolon to the interface declaration.
1403 * expression.cs: Pass location information to
1404 ConvertImplicitStandard.
1406 * class.cs: Added debugging code to track return values from
1409 2002-03-05 Miguel de Icaza <miguel@ximian.com>
1411 * expression.cs (Is.DoResolve): If either side of the `is' is an
1412 interface, do not flag the warning.
1414 * ecore.cs (ImplicitReferenceConversion): We need a separate test
1417 * report.cs: Allow for --fatal to be used with --probe.
1419 * typemanager.cs (NoTypes): Move the definition for the empty Type
1422 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
1424 (TypeContainer.DefineProxy): New function used to proxy to parent
1425 implementations when implementing interfaces.
1426 (TypeContainer.ParentImplements): used to lookup if our parent
1427 implements a public function that is required by an interface.
1428 (TypeContainer.VerifyPendingMethods): Hook this up.
1430 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
1431 `modules' and `assemblies' arraylists into arrays. We only grow
1432 these are the very early start up of the program, so this improves
1433 the speedof LookupType (nicely measured).
1435 * expression.cs (MakeByteBlob): Replaced unsafe code with
1436 BitConverter, as suggested by Paolo.
1438 * cfold.cs (ConstantFold.Binary): Special case: perform constant
1439 folding of string concatenation, but if either side is a string,
1440 and the other is not, then return null, and let the runtime use
1441 the concatenation on the string plus the object (using
1444 2002-03-04 Miguel de Icaza <miguel@ximian.com>
1446 Constant Folding has been implemented now.
1448 * expression.cs (Unary.Reduce): Do not throw an exception, catch
1449 the error instead on types that are not supported in one's
1452 * constant.cs (Constant and all children): New set of functions to
1453 perform implict and explicit conversions.
1455 * ecore.cs (EnumConstant): Implement the new functions to perform
1456 conversion by proxying to the child expression.
1458 * codegen.cs: (ConstantCheckState): Constant evaluation has its
1459 own separate setting that can not be turned off from the command
1460 line using --unchecked or --checked and is only controlled using
1461 the checked/unchecked statements and expressions. This setting is
1462 used by the constant folder to flag errors.
1464 * expression.cs (CheckedExpr, UncheckedExpr): Set the
1465 ConstantCheckState as well.
1467 During Resolve, they also have to flag the state, because the
1468 constant folder runs completely in the Resolve phase.
1470 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
1473 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1475 * cfold.cs: New file, this file contains the constant folder.
1477 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
1478 argument to track whether we are using the resulting address to
1479 load or store a value and provide better error messages.
1481 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
1482 new AddressOf arguments.
1484 * statement.cs (Foreach.EmitCollectionForeach): Update
1486 * expression.cs (Argument.Emit): Call AddressOf with proper
1487 arguments to track usage.
1489 (New.DoEmit): Call AddressOf with new arguments.
1491 (Unary.Emit): Adjust AddressOf call.
1493 2002-03-01 Ravi Pratap <ravi@ximian.com>
1495 * cs-parser.jay (member_access): Change the case for pre-defined types
1496 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
1499 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
1502 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
1503 essentially like methods and apply attributes like MethodImplOptions to them too.
1505 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
1508 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
1509 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
1512 * Update code everywhere accordingly.
1514 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
1516 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
1518 2002-02-28 Ravi Pratap <ravi@ximian.com>
1520 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
1521 try performing lookups against those instead of jumping straight into using
1522 the 'using' clauses.
1524 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
1526 (LookupType): Perform lookups in implicit parents too.
1528 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
1529 sequence as RootContext.LookupType.
1531 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
1532 the various cases of namespace lookups into this method.
1534 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1536 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
1537 in positional arguments)
1539 * class.cs (Operator): Update the AllowedModifiers to contain
1542 * cs-parser.jay: Update operator declaration to allow for the
1543 operator body to be empty.
1545 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
1548 2002-02-27 Miguel de Icaza <miguel@ximian.com>
1550 * class.cs (Method.Emit): Label parameters.
1552 * driver.cs: Return 1 or 0 as the program exit code.
1554 2002-02-26 Miguel de Icaza <miguel@ximian.com>
1556 * expression.cs: Special case the `null' object when trying to
1557 auto-compute the type, as anything can be explicitly converted to
1560 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
1561 spotting this Paolo.
1563 (Expression.ImplicitNumericConversion): Perform comparissions of
1564 the type using the underlying type in the case of an enumeration
1565 rather than using the enumeration type for the compare.
1567 Cope with the underlying == type case, which is not possible to
1570 (Expression.ConvertNumericExplicit): Perform comparissions of
1571 the type using the underlying type in the case of an enumeration
1572 rather than using the enumeration type for the compare.
1574 * driver.cs: If the user does not supply an extension, assume .exe
1576 * cs-parser.jay (if_statement): Rewrote so that we can track the
1577 location for the if statement.
1579 * expression.cs (Binary.ConstantFold): Only concat strings when
1580 the operation is "+", not everything ;-)
1582 * statement.cs (Statement.EmitBoolExpression): Take a location
1584 (If, While, Do): Track location.
1586 * expression.cs (Binary.ResolveOperator): In the object + string
1587 case, I was missing a call to ConvertImplicit
1589 2002-02-25 Ravi Pratap <ravi@ximian.com>
1591 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
1592 Location arguments. Ensure we use RootContext.LookupType to do our work
1593 and not try to do a direct Type.GetType and ModuleBuilder.GetType
1595 * interface.cs (PopulateMethod): Handle the type of the parameter being
1598 * expression.cs (Invocation.BetterFunction): Handle the case when we
1599 have a params method with no fixed arguments and a call is made with no
1602 2002-02-25 Miguel de Icaza <miguel@ximian.com>
1604 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
1605 the verbatim-string-literal
1607 * support.cs (InternalParameters.ParameterModifier): handle null
1609 (InternalParameters.ParameterType): ditto.
1611 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
1612 duplicating the name of the variable parameter.
1613 (GetParameterByName): Fix bug where we were not looking up array
1614 paramters if they were the only present (thanks Paolo!).
1615 (GetParameterInfo): We only have an empty set of types if both
1616 fixed and array are set to null.
1617 (GetParameterInfo-idx): Handle FixedParameter == null
1619 * cs-parser.jay: Handle the case where there is no catch
1620 statements (missing null test).
1622 2002-02-22 Miguel de Icaza <miguel@ximian.com>
1624 * driver.cs (MainDriver): Be conservative on our command line
1627 Catch DirectoryNotFoundException when calling GetFiles.
1629 (SplitPathAndPattern): Used to split the input specification into
1630 a path and a pattern that we can feed to Directory.GetFiles.
1632 2002-02-21 Miguel de Icaza <miguel@ximian.com>
1634 * statement.cs (Fixed): Implement the last case of the Fixed
1635 statement (string handling).
1637 * expression.cs (StringPtr): New class used to return a char * to
1638 a string; Used by the Fixed statement.
1640 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
1642 * expression.cs (Binary.ResolveOperator): Remove redundant
1643 MemberLookup pn parent type.
1644 Optimize union call, we do not need a union if the types are the same.
1645 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
1648 Specialize the use of MemberLookup everywhere, instead of using
1649 the default settings.
1651 (StackAlloc): Implement stackalloc keyword.
1653 * cs-parser.jay: Add rule to parse stackalloc.
1655 * driver.cs: Handle /h, /help, /?
1657 * expression.cs (MakeByteBlob): Removed the hacks we had in place
1658 before we supported unsafe code.
1660 * makefile: add --unsafe to the self compilation of mcs.
1662 2002-02-20 Miguel de Icaza <miguel@ximian.com>
1664 * expression.cs (PointerArithmetic): New class that is used to
1665 perform pointer arithmetic.
1666 (Binary.Resolve): Handle pointer arithmetic
1667 Handle pointer comparission.
1668 (ArrayPtr): Utility expression class that is used to take the
1669 address of an array.
1671 (ElementAccess): Implement array access for pointers
1673 * statement.cs (Fixed): Implement fixed statement for arrays, we
1674 are missing one more case before we are done.
1676 * expression.cs (Indirection): Implement EmitAssign and set the
1677 ExprClass to Variable. This allows pointer dereferences to be
1678 treated as variables, and to have values assigned to them.
1680 * ecore.cs (Expression.StoreFromPtr): New utility function to
1681 store values dereferencing.
1683 2002-02-20 Ravi Pratap <ravi@ximian.com>
1685 * expression.cs (Binary.ResolveOperator): Ensure that we are
1686 not trying to operate on a void type - this fixes the reported
1689 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
1690 the parent implementation is sealed.
1692 * ../errors/cs0239.cs : Add.
1694 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
1696 * typemanager.cs (unverifiable_code_type): Corresponds to
1697 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
1698 which have unsafe code in them.
1700 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
1703 2002-02-19 Miguel de Icaza <miguel@ximian.com>
1705 * cs-tokenizer.cs: Add support for @"litreal strings"
1707 Make tokenizer accept pre-processor directives
1708 on any column (remove the old C-like limitation).
1710 * rootcontext.cs (EmitCode): Emit any global attributes.
1711 (AddGlobalAttributes): Used to keep track of assembly attributes.
1713 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
1715 * cs-parser.jay: Add support for global attributes.
1717 2002-02-17 Miguel de Icaza <miguel@ximian.com>
1719 * expression.cs (Indirection): New helper class. Unary will
1720 create Indirection classes to be able to implement the
1721 IMemoryLocation interface on it.
1723 2002-02-16 Miguel de Icaza <miguel@ximian.com>
1725 * cs-parser.jay (fixed_statement): reference the right statement.
1727 * statement.cs (Fixed.Emit): Finish implementing the fixed
1728 statement for the &x case.
1730 2002-02-14 Miguel de Icaza <miguel@ximian.com>
1732 * class.cs (Property.Define, Method.Define): Remove newslot when
1735 * modifiers.cs: My use of NewSlot when `Abstract' was set was
1736 wrong. NewSlot should only be used if the `new' keyword is present.
1738 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
1739 locating our system dir. Sorry about this.
1741 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1743 * driver.cs (GetSystemDir): Compute correctly the location of our
1744 system assemblies. I was using the compiler directory instead of
1745 the library directory.
1747 2002-02-13 Ravi Pratap <ravi@ximian.com>
1749 * expression.cs (BetterFunction): Put back in what Miguel commented out
1750 since it is the correct fix. The problem is elsewhere ;-)
1752 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
1753 parameters of the parms method are themselves compatible or not !
1755 (StandardConversionExists): Fix very dangerous bug where we were forgetting
1756 to check that a class implements an interface before saying that an implicit
1757 conversion was allowed. Use ImplementsInterface to do the checking.
1759 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1761 * class.cs (Method.Define): Track whether we are an explicit
1762 implementation or not. And only call DefineMethodOverride if we
1763 are an explicit implementation.
1765 (Property.DefineMethod): Ditto.
1767 2002-02-11 Ravi Pratap <ravi@ximian.com>
1769 * expression.cs (BetterFunction): Catch hideous bug which was
1770 preventing us from detecting ambiguous calls due to implicit casts i.e
1773 2002-01-29 Miguel de Icaza <miguel@ximian.com>
1775 * support.cs (Pair): Remove un-needed method. I figured why I was
1776 getting the error in cs-parser.jay, the variable in a foreach loop
1777 is readonly, and the compiler does not really treat this as a variable.
1779 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
1780 instead of EQUALS in grammar.
1782 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
1784 * expression.cs (Unary.DoResolve): Check whether the argument is
1787 2002-01-28 Miguel de Icaza <miguel@ximian.com>
1789 * support.cs: Api for Pair to set a value. Despite the fact that
1790 the variables are public the MS C# compiler refuses to compile
1791 code that accesses the field if the variable is part of a foreach
1794 * statement.cs (Fixed): Begin implementation of the fixed
1797 (Block.AddVariable): Return the VariableInfo on success and null
1798 on failure instead of true/false.
1800 * cs-parser.jay (foreach): Catch errors on variables already
1801 defined (we were ignoring this value before) and properly unwind
1804 (fixed_statement): grammar for the fixed statement.
1806 2002-01-25 Miguel de Icaza <miguel@ximian.com>
1808 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
1809 pointer types to be incretemented.
1811 (SizeOf): Implement.
1813 * cs-parser.jay (pointer_member_access): Implement
1814 expr->IDENTIFIER production.
1816 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
1817 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
1820 (Unary): Implement indirection.
1822 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
1823 use in non-unsafe context).
1825 (SimpleName.DoResolve): Check for pointers in field access on safe
1828 (Expression.LoadFromPtr): Factor the load-indirect code in this
1829 function. This was duplicated in UnboxCast and ParameterReference
1831 2002-01-24 Miguel de Icaza <miguel@ximian.com>
1833 * expression.cs (ComposedCast): report an error if a pointer cast
1834 is used in a safe region.
1836 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
1837 pointer type casts in unsafe context.
1839 * codegen.cs (EmitContext): Set up IsUnsafe.
1841 * cs-parser.jay (non_expression_type): Add productions for pointer
1844 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
1845 code. We should not use force into static mode if the method is
1846 not virtual. Fixes bug in MIS
1848 * statement.cs (Do.Emit, While.Emit, For.Emit,
1849 Statement.EmitBoolExpression): Add support to Do and While to
1850 propagate infinite loop as `I do return' semantics.
1852 Improve the For case to also test for boolean constants.
1854 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
1855 to the list of attributes we can add.
1857 Remove `EmitContext' argument.
1859 * class.cs (Method.Define): Apply parameter attributes.
1860 (Constructor.Define): Apply parameter attributes.
1861 (MethodCore.LabelParameters): Move here the core of labeling
1864 * support.cs (ReflectionParameters.ParameterModifier,
1865 InternalParameters.ParameterModifier): Use IsByRef on the type and
1866 only return the OUT bit for these parameters instead of in/out/ref
1869 This is because I miss-understood things. The ParameterInfo.IsIn
1870 and IsOut represent whether the parameter has the [In] and [Out]
1873 2002-01-22 Miguel de Icaza <miguel@ximian.com>
1875 * ecore.cs (FieldExpr.Emit): Release temporaries.
1877 * assign.cs (LocalTemporary.Release): new function.
1879 * codegen.cs (EmitContext.GetTemporaryStorage,
1880 EmitContext.FreeTemporaryStorage): Rework the way we deal with
1881 temporary storage. Now we can "put back" localbuilders when we
1884 2002-01-21 Miguel de Icaza <miguel@ximian.com>
1886 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
1887 need to make a copy of the variable to generate verifiable code.
1889 2002-01-19 Miguel de Icaza <miguel@ximian.com>
1891 * driver.cs: Compute dynamically the system directory.
1893 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
1894 Slower, but more generally useful. Used by the abstract
1895 registering implementation.
1897 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
1898 the rules for the special rule on Type/instances. First check if
1899 we have the same name, and if so, try that special static path
1900 rather than the instance path.
1902 2002-01-18 Miguel de Icaza <miguel@ximian.com>
1904 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
1907 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
1908 Enum, ValueType, Delegate or Array for non-corlib compiles.
1910 * cs-tokenizer.cs: Catch long identifiers (645)
1912 * typemanager.cs (IndexerPropetyName): Ravi never tested this
1915 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
1916 fix, we were returning too early, so we were not registering
1917 pending methods from abstract classes.
1919 Do not register pending methods if the class is abstract.
1921 * expression.cs (Conditional.DoResolve): Report circular implicit
1922 conversions when we neecd to compute it for conditional
1925 (Is.DoResolve): If the expression is always of the provided type,
1926 flag warning 183. If the expression can not ever be of the
1927 provided type flag warning 184.
1929 * class.cs: Catch 169 as well.
1931 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
1934 2002-01-18 Nick Drochak <ndrochak@gol.com>
1936 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
1938 2002-01-17 Miguel de Icaza <miguel@ximian.com>
1940 * interface.cs: (PopulateMethod): Check for pointers being defined
1941 only if the unsafe context is active.
1942 (PopulateProperty): ditto.
1943 (PopulateIndexer): ditto.
1945 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
1946 specified. If pointers are present, make sure that they are
1947 present in an unsafe context.
1948 (Constructor, Constructor.Define): ditto.
1949 (Field, Field.Define): ditto.
1950 (Property, Property.Define): ditto.
1951 (Event, Event.Define): ditto.
1953 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
1954 hashtable if there are classes or structs defined.
1956 * expression.cs (LocalVariableReference.DoResolve): Simplify this
1957 code, as the constant resolution moved.
1959 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
1960 the metadata, so we can flag error 133.
1962 * decl.cs (MemberCore.UnsafeOK): New function to test that a
1963 pointer is being declared in an unsafe context.
1965 2002-01-16 Miguel de Icaza <miguel@ximian.com>
1967 * modifiers.cs (Modifiers.Check): Require a Location argument.
1968 Report error 227 for Unsafe use.
1970 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
1972 * statement.cs (For.Emit): If the test is null, then report that
1973 we do `return', as we wont reach anything afterwards.
1975 (Switch.SwitchGoverningType): Track the expression that matched
1978 * driver.cs: Allow negative numbers as an error code to flag.
1980 * cs-parser.jay: Handle 1551.
1982 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
1984 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1986 * cs-parser.jay: Report 1518 (type declaration can only contain
1987 class, struct, interface, enum or delegate)
1989 (switch_label): Report 1523 (keywords `case' or `default' must
1992 (opt_switch_sections): Report 1522 (empty switch)
1994 * driver.cs: Report 1515 (response file specified multiple times)
1995 Report 1516 (Source file specified multiple times).
1997 * expression.cs (Argument.Resolve): Signal 1510
1999 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
2000 access not allowed in static code)
2002 2002-01-11 Ravi Pratap <ravi@ximian.com>
2004 * typemanager.cs (IsPointerType): Utility method which we are going
2007 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
2008 the object type, so we take care of that.
2010 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
2012 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
2013 added to non-params parameters :-)
2015 * typemanager.cs (CSharpName): Include 'void' type too.
2017 (void_ptr_type): Include in the set of core types.
2019 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
2022 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
2025 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
2026 completely forgotten about it.
2028 2002-01-10 Ravi Pratap <ravi@ximian.com>
2030 * cs-parser.jay (pointer_type): Add. This begins our implementation
2031 of parsing rules for unsafe code.
2033 (unsafe_statement): Implement.
2035 (embedded_statement): Modify to include the above.
2037 * statement.cs (Unsafe): Implement new class for unsafe blocks.
2039 * codegen.cs (EmitContext.InUnsafe): Add. This determines
2040 if the current context is an unsafe one.
2042 * cs-parser.jay (local_variable_pointer_type): Since local variable types
2043 are handled differently, we need separate rules for them.
2045 (local_variable_declaration): Update to use local_variable_pointer_type
2046 to allow variable declarations of unmanaged pointer types.
2048 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
2051 * ../errors/cs0214.cs : Add.
2053 2002-01-16 Nick Drochak <ndrochak@gol.com>
2055 * makefile: remove 'response' file when cleaning.
2057 2002-01-15 Miguel de Icaza <miguel@ximian.com>
2059 * cs-parser.jay: Report 1524.
2061 2002-01-14 Miguel de Icaza <miguel@ximian.com>
2063 * typemanager.cs (RegisterMethod): drop checking if we have
2064 registered this from here
2066 2002-01-12 Miguel de Icaza <miguel@ximian.com>
2068 * class.cs (Method.EmitDestructor): Implement calling our base
2071 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
2074 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
2075 this routine and will wrap the call in a try/catch block. Deal
2078 2002-01-11 Miguel de Icaza <miguel@ximian.com>
2080 * ecore.cs (Expression.MemberLookup): instead of taking a
2081 parameter `same_type' that was used to tell whether we could
2082 access private members we compute our containing type from the
2085 (FieldExpr): Added partial support for volatile fields. This does
2086 not work for volatile fields exposed from assemblies, as I can not
2087 figure out how to extract the modreq from it.
2089 Updated all the source files to use this.
2091 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
2092 because it is referenced by MemberLookup very often.
2094 2002-01-09 Ravi Pratap <ravi@ximian.com>
2096 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
2097 TypeBuilder.GetCustomAttributes to retrieve what we need.
2099 Get rid of redundant default_member_attr_type as this is the same as
2100 default_member_type which already exists.
2102 * interface.cs, attribute.cs : Update accordingly.
2104 2002-01-08 Miguel de Icaza <miguel@ximian.com>
2106 * typemanager.cs: Enable IndexerPropertyName again. It does not
2107 work for TYpeBuilders though. Ravi, can you please fix this?
2109 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
2111 * expression.cs (Argument.Emit): Handle the case of ref objects
2112 being passed to ref functions;
2114 (ParameterReference.EmitLoad): Loads the content of the pointer
2115 without dereferencing.
2117 2002-01-07 Miguel de Icaza <miguel@ximian.com>
2119 * cs-tokenizer.cs: Implemented the pre-processing expressions.
2121 2002-01-08 Ravi Pratap <ravi@ximian.com>
2123 * class.cs (Indexer.DefineMethod): Incorporate the interface
2124 type in the name of the method if we are doing explicit interface
2127 * expression.cs (ConversionExists): Remove as it is completely obsolete.
2129 (BetterConversion): Fix extremely trivial bug where we were referring to
2130 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
2133 * ../errors/bug16.cs : Add although we have fixed it.
2135 2002-01-07 Miguel de Icaza <miguel@ximian.com>
2137 * expression.cs (BaseIndexer): Begin implementation.
2139 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
2141 * cs-parser.jay (indexer_declarator): Use qualified_identifier
2142 production directly to remove a shift/reduce, and implement
2143 explicit interface implementation.
2145 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
2146 after a floating point suffix.
2148 * expression.cs (DoNumericPromotions): Improved the conversion for
2149 uint/uint. If we have a constant, we avoid doing a typecast to a
2152 * class.cs (Indexer): Implement explicit interface implementation
2155 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
2157 * class.cs: make the default instance constructor public and hidebysig.
2159 2001-01-03 Ravi Pratap <ravi@ximian.com>
2161 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
2162 so we can call it from elsewhere.
2164 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
2165 we emit it internally if the class has a defined indexer; otherwise the user
2166 emits it by decorating the class definition with the DefaultMemberAttribute.
2168 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
2169 attribute is not used on a type which defines an indexer.
2171 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
2172 character when we skip whitespace.
2174 * ../errors/cs0646.cs : Add.
2176 2002-01-03 Miguel de Icaza <miguel@ximian.com>
2178 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
2181 * makefile: Add practical target `mcs3.exe' which builds the third
2182 generation compiler.
2184 * expression.cs (New): Fix structures constructor calling.
2186 * class.cs (Property, Method, Indexer): Emit Final flag on the
2187 method if we are an interface implementation and we are not
2190 * ecore.cs (PropertyExpr): New public field `IsBase', tells
2191 whether this property is referencing a `base' method.
2193 * expression.cs (Invocation.EmitCall): take an extra argument:
2194 is_base, this is used to determine whether the `call' or
2195 `callvirt' opcode should be used.
2198 * delegate.cs: update EmitCall.
2200 * class.cs (Method.Define): Set NewSlot for the cases where we are
2201 not implementing an interface method.
2203 (Property.Define): ditto.
2205 2002-01-02 Miguel de Icaza <miguel@ximian.com>
2207 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
2208 'r'. Allows mcs to parse itself fully.
2210 2002-01-02 Ravi Pratap <ravi@ximian.com>
2212 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
2213 of the number of initializers that require the InitializeArray method.
2215 (CheckIndices): Store the Expression in all cases - not the plain value. Also
2216 update the above field where necessary.
2218 (MakeByteBlob): Update accordingly.
2220 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
2223 (EmitDynamicInitializers): Update in accordance with the new optimization.
2225 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
2226 same OpCode applies.
2228 * cs-parser.jay : Fix some glaring errors I introduced.
2230 2002-01-01 Ravi Pratap <ravi@ximian.com>
2232 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
2233 so that we can check for name clashes there too.
2235 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
2236 for interface indexers.
2238 * interfaces.cs (Define): Emit the default member attribute.
2240 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
2241 variable was being referred to while setting the value ;-)
2243 2002-01-01 Miguel de Icaza <miguel@ximian.com>
2245 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
2246 byte-by-byte information when we know the data is zero.
2248 Make the block always a multiple of 4, because
2249 DefineInitializedData has a bug.
2251 * assign.cs: Fix, we should assign from the temporary, not from
2254 * expression.cs (MakeByteBlob): Fix my incorrect code.
2256 2001-12-31 Miguel de Icaza <miguel@ximian.com>
2258 * typemanager.cs (EnumToUnderlying): This function is used to get
2259 the underlying type from an enumeration, because it does not
2262 * constant.cs: Use the I4_S form for values between -128 and 127.
2264 * statement.cs (Block.LookupLabel): Looks up a label.
2265 (Block): Drop support for labeled blocks.
2267 (LabeledStatement): New kind of statement that represents a label
2270 (Goto): Finally implement this bad boy.
2272 * cs-parser.jay: Update to reflect new mechanism to implement
2275 2001-12-30 Miguel de Icaza <miguel@ximian.com>
2277 * codegen.cs (EmitContext.This): a codegen property that keeps the
2278 a single instance of this instead of creating many different this
2281 * delegate.cs (Delegate.DoResolve): Update to use the property;
2283 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
2285 * expression.cs (BaseAccess.DoResolve): Ditto.
2287 2001-12-29 Ravi Pratap <ravi@ximian.com>
2289 * typemanager.cs (methodimpl_attr_type): Add to hold the type
2290 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
2292 (InitCoreTypes): Update accordingly.
2294 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
2295 so we can quickly store the state.
2297 (ApplyAttributes): Set the correct implementation flags
2298 for InternalCall methods.
2300 2001-12-29 Miguel de Icaza <miguel@ximian.com>
2302 * expression.cs (EmitCall): if a method is not virtual, then do
2303 not use callvirt on it.
2305 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
2306 user defined stuff) requires the use of stobj, which takes an
2307 address on the stack instead of an array and an index. So emit
2308 the Ldelema operation for it.
2310 (EmitStoreOpcode): Use stobj for valuetypes.
2312 (UnaryMutator.EmitCode): Use the right 1 value depending on
2313 whether we are dealing with int64/uint64, float or doubles.
2315 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
2316 constructors that I implemented last night.
2318 (Constructor.IsDefault): Fix to work properly for static
2321 * cs-parser.jay (CheckDef): report method signature errors.
2322 Update error number 103 to be 132.
2324 * decl.cs: New AdditionResult enumeration value: MethodExists.
2325 Although we do this check for methods later on in the semantic
2326 analysis, catching repeated default constructors is so easy that
2327 we catch these here.
2329 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
2332 (ParameterReference.EmitAssign, Emit): handle
2335 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
2336 (ArrayAccess.EmitStoreOpcode): ditto.
2338 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
2340 * expression.cs (MakeByteBlob): Complete all the missing types
2341 (uint, short, ushort, byte, sbyte)
2343 * class.cs: Only init instance field initializers on instance
2346 Rename `constructors' to instance_constructors.
2348 (TypeContainer.AddConstructor): Only add constructors to the list
2349 if it is not static.
2351 Make sure that we handle default_static_constructor independently
2352 everywhere where we handle instance_constructors
2354 2001-12-28 Miguel de Icaza <miguel@ximian.com>
2356 * class.cs: Do not lookup or create a base initializer for a
2359 (ConstructorInitializer.Resolve): use the proper type to lookup
2362 * cs-parser.jay: Report error 1585 (modifiers between type and name).
2364 * enum.cs, interface.cs: Remove CloseType, this is taken care by
2367 * decl.cs: CloseType is now an virtual method, the default
2368 implementation just closes this type.
2370 2001-12-28 Ravi Pratap <ravi@ximian.com>
2372 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
2373 to PreserveSig by default. Also emit HideBySig on such methods.
2375 Basically, set the defaults to standard values.
2377 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
2378 argument, if candidate is better, it can't be worse than the best !
2380 (Invocation): Re-write bits to differentiate between methods being
2381 applicable in their expanded form and their normal form - for params
2384 Get rid of use_standard everywhere as only standard conversions are allowed
2385 in overload resolution.
2387 More spec conformance.
2389 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2391 * driver.cs: Add --timestamp, to see where the compiler spends
2394 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
2395 `this' in static code.
2397 (SimpleName.DoResolve): Implement in terms of a helper function
2398 that allows static-references to be passed upstream to
2401 (Expression.ResolveWithSimpleName): Resolve specially simple
2402 names when called by MemberAccess to implement the special
2405 (Expression.ImplicitReferenceConversion): Handle conversions from
2406 Null to reference types before others, as Null's type is
2409 * expression.cs (Invocation.EmitCall): Handle the special case of
2410 calling methods declared on a reference type from a ValueType
2411 (Base classes System.Object and System.Enum)
2413 (MemberAccess.Resolve): Only perform lookups on Enumerations if
2414 the left hand side is a TypeExpr, not on every enumeration.
2416 (Binary.Resolve): If types are reference types, then do a cast to
2417 object on operators != and == of both arguments.
2419 * typemanager.cs (FindMembers): Extract instance and static
2420 members if requested.
2422 * interface.cs (PopulateProperty): Use void_type instead of null
2423 as the return type for the setter method.
2425 (PopulateIndexer): ditto.
2427 2001-12-27 Ravi Pratap <ravi@ximian.com>
2429 * support.cs (ReflectionParameters): Fix minor bug where we
2430 were examining the wrong parameter for the ParamArray attribute.
2432 Cope with requests for the type of the parameter at position
2433 greater than the params parameter's. We now return the element
2434 type of the params array as that makes more sense.
2436 * expression.cs (Invocation.IsParamsMethodApplicable): Update
2437 accordingly as we no longer have to extract the element type
2440 (Invocation.OverloadResolve): Update.
2442 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2444 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
2445 against IEnumerator, test whether the return value is a descendant
2446 of the IEnumerator interface.
2448 * class.cs (Indexer.Define): Use an auxiliary method to implement
2449 the other bits of the method definition. Begin support for
2450 explicit interface implementation.
2452 (Property.DefineMethod): Use TypeManager.void_type instead of null
2453 for an empty return value.
2455 2001-12-26 Miguel de Icaza <miguel@ximian.com>
2457 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
2458 dealing with a FieldExpr which is composed of a FieldBuilder, in
2459 the code path we did extract the constant, but we should have
2460 obtained the underlying value to be able to cast it (otherwise we
2461 end up in an infinite loop, this is what Ravi was running into).
2463 (ArrayCreation.UpdateIndices): Arrays might be empty.
2465 (MemberAccess.ResolveMemberAccess): Add support for section
2466 14.5.4.1 that deals with the special case of E.I when E is a type
2467 and something else, that I can be a reference to a static member.
2469 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
2470 handle a particular array type to create byte blobs, it is just
2471 something we dont generate byteblobs for.
2473 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
2476 * location.cs (Push): remove the key from the hashtable that we
2477 are about to add. This happens for empty files.
2479 * driver.cs: Dispose files after we have parsed them.
2481 (tokenize): new function that only runs the tokenizer on its
2482 input, for speed testing.
2484 2001-12-26 Ravi Pratap <ravi@ximian.com>
2486 * class.cs (Event.Define): Define the private field only if there
2487 are no accessors defined.
2489 * expression.cs (ResolveMemberAccess): If there is no associated
2490 field with the event, that means we have an event defined with its
2491 own accessors and we should flag error cs0070 since transforming
2492 ourselves into a field is not valid in that case.
2494 * ecore.cs (SimpleName.DoResolve): Same as above.
2496 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
2497 and charset to sane values.
2499 2001-12-25 Ravi Pratap <ravi@ximian.com>
2501 * assign.cs (DoResolve): Perform check on events only if they
2502 are being accessed outside the declaring type.
2504 * cs-parser.jay (event_declarations): Update rules to correctly
2505 set the type of the implicit parameter etc.
2507 (add_accessor, remove_accessor): Set current local parameters.
2509 * expression.cs (Binary): For delegate addition and subtraction,
2510 cast the return value from the method into the appropriate delegate
2513 2001-12-24 Ravi Pratap <ravi@ximian.com>
2515 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
2516 of these as the workaround is unnecessary.
2518 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
2519 delegate data - none of that is needed at all.
2521 Re-write bits to extract the instance expression and the delegate method
2524 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
2527 * attribute.cs (ApplyAttributes): New method to take care of common tasks
2528 of attaching attributes instead of duplicating code everywhere.
2530 * everywhere : Update code to do attribute emission using the above method.
2532 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2534 * expression.cs (IsParamsMethodApplicable): if there are not
2535 parameters, return immediately.
2537 * ecore.cs: The 0 literal can be implicity converted to an enum
2540 (SimpleName.DoResolve): First lookup the type, then lookup the
2543 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
2544 want to get its address. If the InstanceExpression is not
2545 addressable, store the result in a temporary variable, then get
2548 * codegen.cs: Only display 219 errors on warning level or above.
2550 * expression.cs (ArrayAccess): Make it implement the
2551 IMemoryLocation interface.
2553 (Binary.DoResolve): handle the operator == (object a, object b)
2554 and operator != (object a, object b) without incurring into a
2555 BoxedCast (because 5 != o should never be performed).
2557 Handle binary enumerator operators.
2559 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
2560 value type, otherwise use Ldelem_ref.
2562 Use precomputed names;
2564 (AddressOf): Implement address of
2566 * cs-parser.jay (labeled_statement): Fix recursive block
2567 addition by reworking the production.
2569 * expression.cs (New.DoEmit): New has a special case:
2571 If we are dealing with a ValueType, we have a few
2572 situations to deal with:
2574 * The target of New is a ValueType variable, that is
2575 easy, we just pass this as the variable reference
2577 * The target of New is being passed as an argument,
2578 to a boxing operation or a function that takes a
2581 In this case, we need to create a temporary variable
2582 that is the argument of New.
2585 2001-12-23 Ravi Pratap <ravi@ximian.com>
2587 * rootcontext.cs (LookupType): Check that current_type is not null before
2588 going about looking at nested types.
2590 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
2591 not implement the IAssignMethod interface any more.
2593 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
2594 where we tranform them into FieldExprs if they are being resolved from within
2597 * ecore.cs (SimpleName.DoResolve): Do the same here.
2599 * assign.cs (DoResolve, Emit): Clean up code considerably.
2601 * ../errors/bug10.cs : Add.
2603 * ../errors/cs0070.cs : Add.
2605 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
2607 * assign.cs : Get rid of EventIsLocal everywhere.
2609 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2611 * ecore.cs (ConvertIntLiteral): finished the implementation.
2613 * statement.cs (SwitchLabel): Convert the value we are using as a
2614 key before looking up the table.
2616 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2618 * codegen.cs (EmitTopBlock): Require a Location argument now.
2620 * cs-parser.jay (constructor_declarator): We need to setup
2621 current_local_parameters before we parse the
2622 opt_constructor_initializer, to allow the variables to be bound
2623 to the constructor arguments.
2625 * rootcontext.cs (LookupType): First lookup nested classes in our
2626 class and our parents before we go looking outside our class.
2628 * expression.cs (ConstantFold): Extract/debox the values at the
2631 * rootcontext.cs (EmitCode): Resolve the constants first before we
2632 resolve the types. This is not really needed, but it helps debugging.
2634 * statement.cs: report location.
2636 * cs-parser.jay: pass location to throw statement.
2638 * driver.cs: Small bug fix.
2640 * report.cs: Updated format to be 4-zero filled digits.
2642 2001-12-22 Ravi Pratap <ravi@ximian.com>
2644 * expression.cs (CheckIndices): Fix minor bug where the wrong
2645 variable was being referred to ;-)
2647 (DoEmit): Do not call EmitStaticInitializers when the
2648 underlying type is System.Object.
2650 2001-12-21 Ravi Pratap <ravi@ximian.com>
2652 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
2653 and do the usual workaround for SRE.
2655 * class.cs (MyEventBuilder.EventType): New member to get at the type
2656 of the event, quickly.
2658 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
2660 * assign.cs (Assign.DoResolve): Handle the case when the target
2661 is an EventExpr and perform the necessary checks.
2663 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
2666 (SimpleName.MemberStaticCheck): Include check for EventExpr.
2668 (EventExpr): Set the type in the constructor itself since we
2669 are meant to be born fully resolved.
2671 (EventExpr.Define): Revert code I wrote earlier.
2673 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
2674 instance expression is null. The instance expression is a This in that case
2675 or a null, depending on whether it is a static method or not.
2677 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
2678 refers to more than one method.
2680 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
2681 and accordingly flag errors.
2683 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2685 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
2687 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2689 * location.cs (ToString): Provide useful rutine.
2691 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2693 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
2694 objects, return the actual integral boxed.
2696 * statement.cs (SwitchLabel): define an ILLabel for each
2699 (Switch.CheckSwitch): If the value is a Literal, extract
2700 the underlying literal.
2702 Also in the unused hashtable we had, add the SwitchLabel so we can
2703 quickly look this value up.
2705 * constant.cs: Implement a bunch of new constants. Rewrite
2706 Literal based on this. Made changes everywhere to adapt to this.
2708 * expression.cs (Expression.MakeByteBlob): Optimize routine by
2709 dereferencing array only once, and also copes with enumrations.
2711 bytes are two bytes wide, not one.
2713 (Cast): Perform constant conversions.
2715 * ecore.cs (TryImplicitIntConversion): Return literals instead of
2716 wrappers to the literals here.
2718 * expression.cs (DoNumericPromotions): long literals can converted
2719 to ulong implicity (this is taken care of elsewhere, but I was
2722 * ecore.cs (Expression.Literalize): Make the return type Literal,
2723 to improve type checking.
2725 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
2727 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2729 * literal.cs: Revert code from ravi that checked the bounds. The
2730 bounds are sane by the definition of the type itself.
2732 * typemanager.cs: Fix implementation of ImplementsInterface. We
2733 need to actually look up in our parent hierarchy for interfaces
2736 * const.cs: Use the underlying type for enumerations
2738 * delegate.cs: Compute the basename for the delegate creation,
2739 that should fix the delegate test case, and restore the correct
2740 Type Lookup semantics in rootcontext
2742 * rootcontext.cs: Revert Ravi's last patch. The correct way of
2743 referencing a nested type with the Reflection API is using the "+"
2746 * cs-parser.jay: Do not require EOF token at the end.
2748 2001-12-20 Ravi Pratap <ravi@ximian.com>
2750 * rootcontext.cs (LookupType): Concatenate type names with
2751 a '.' instead of a '+' The test suite passes again.
2753 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
2754 field of the enumeration.
2756 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
2757 the case when the member is an EventExpr.
2759 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
2760 static has an associated instance expression.
2762 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
2764 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
2766 * class.cs (Event.Define): Register event and perform appropriate checks
2769 We define the Add and Remove methods even if the use provides none because
2770 in that case, we provide default implementations ourselves.
2772 Define a private field of the type of the event. This is done by the CSC compiler
2773 and we should be doing it too ;-)
2775 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
2776 More methods we use in code we generate.
2778 (multicast_delegate_type, delegate_type): Two separate types since the distinction
2781 (InitCoreTypes): Update accordingly for the above.
2783 * class.cs (Event.Emit): Generate code for default accessors that we provide
2785 (EmitDefaultMethod): Do the job in the above.
2787 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
2790 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2792 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
2793 builders even if we were missing one.
2795 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
2796 pass the Basename as our class name instead of the Name. The
2797 basename will be correctly composed for us.
2799 * parameter.cs (Paramters): Now takes a Location argument.
2801 * decl.cs (DeclSpace.LookupType): Removed convenience function and
2802 make all the code call directly LookupType in RootContext and take
2803 this chance to pass the Location information everywhere.
2805 * Everywhere: pass Location information.
2807 2001-12-19 Miguel de Icaza <miguel@ximian.com>
2809 * class.cs (Constructor.Define): Updated way of detecting the
2810 length of the parameters.
2812 (TypeContainer.DefineType): Use basename as the type name for
2815 (TypeContainer.Define): Do not recursively define types here, as
2816 definition is taken care in order by the RootContext.
2818 * tree.cs: Keep track of namespaces in a per-file basis.
2820 * parameter.cs (Parameter.ComputeSignature): Update to use
2823 (Parameters.GetSignature): ditto.
2825 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
2826 instead of a TypeContainer.
2828 (Interface.SemanticAnalysis): Use `this' instead of our parent to
2829 resolve names. Because we need to be resolve in our context, not
2832 * driver.cs: Implement response files.
2834 * class.cs (TypeContainer.DefineType): If we are defined, do not
2837 (Event.Emit): Emit the code for add/remove handlers.
2838 (Event.Define): Save the MethodBuilders for add/remove.
2840 * typemanager.cs: Use pair here too.
2842 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
2843 DictionaryEntry requires the first argument to be non-null.
2845 (enum_declaration): Compute full name for registering the
2848 (delegate_declaration): Instead of using
2849 formal_parameter_list, use opt_formal_parameter_list as the list
2852 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
2853 (EventParsing): New property that controls whether `add' and
2854 `remove' are returned as tokens or identifiers (for events);
2856 2001-12-19 Ravi Pratap <ravi@ximian.com>
2858 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
2859 use MyEventBuilder only and let it wrap the real builder for us.
2861 (MyEventBuilder): Revamp constructor etc.
2863 Implement all operations that we perform on EventBuilder in precisely the same
2866 (FindMembers): Update to use the EventBuilder member.
2868 (Event.Emit): Update accordingly.
2870 2001-12-18 Ravi Pratap <ravi@ximian.com>
2872 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
2873 by calling the appropriate methods.
2875 (GetCustomAttributes): Make stubs as they cannot possibly do anything
2878 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
2880 2001-12-17 Ravi Pratap <ravi@ximian.com>
2882 * delegate.cs (Delegate.Populate): Check that the return type
2883 and various parameters types are indeed accessible.
2885 * class.cs (Constructor.Define): Same here.
2887 (Field.Define): Ditto.
2889 (Event.Define): Ditto.
2891 (Operator.Define): Check that the underlying Method defined itself
2892 correctly - so it's MethodBuilder should not be null.
2894 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
2895 expression happens to be null.
2897 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
2898 members but as of now we don't seem to be able to do anything really useful with it.
2900 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
2901 not the EventBuilder.
2903 2001-12-18 Miguel de Icaza <miguel@ximian.com>
2905 * cs-tokenizer.cs: Add support for defines.
2906 Add support for #if, #elif, #else, #endif
2908 (eval_var): evaluates a variable.
2909 (eval): stubbed for evaluating functions.
2911 * cs-parser.jay: Pass the defines information
2913 * driver.cs: Add --define command line option.
2915 * decl.cs: Move MemberCore here.
2917 Make it the base class for DeclSpace. This allows us to catch and
2918 report 108 and 109 for everything now.
2920 * class.cs (TypeContainer.Define): Extract all the members
2921 before populating and emit the warning 108 (new keyword required
2922 to override) instead of having each member implement this.
2924 (MemberCore.Define): New abstract method, we will be using this in
2925 the warning reporting engine in Populate.
2927 (Operator.Define): Adjust to new MemberCore protocol.
2929 * const.cs (Const): This does not derive from Expression, it is a
2930 temporary object we use to create fields, it is a MemberCore.
2932 * class.cs (Method.Define): Allow the entry point to be in a
2935 * driver.cs: Rewrite the argument handler to clean it up a bit.
2937 * rootcontext.cs: Made it just an auxiliary namespace feature by
2938 making everything static.
2940 * driver.cs: Adapt code to use RootContext type name instead of
2943 * delegate.cs: Remove RootContext argument.
2945 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
2948 * class.cs (Event.Define): The lookup can fail.
2950 * cs-tokenizer.cs: Begin implementation of pre-procesor.
2952 * expression.cs: Resolve the this instance before invoking the code.
2954 2001-12-17 Miguel de Icaza <miguel@ximian.com>
2956 * cs-parser.jay: Add a production in element_access that allows
2957 the thing to become a "type" reference. This way we can parse
2958 things like "(string [])" as a type.
2960 Note that this still does not handle the more complex rules of
2964 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
2966 * ecore.cs: (CopyNewMethods): new utility function used to
2967 assemble the list of methods from running FindMembers.
2969 (MemberLookup): Rework FindMembers so that
2971 2001-12-16 Miguel de Icaza <miguel@ximian.com>
2973 * class.cs (TypeContainer): Remove Delegates who fail to be
2976 * delegate.cs (Populate): Verify that we dont get null return
2977 values. TODO: Check for AsAccessible.
2979 * cs-parser.jay: Use basename to emit error 574 (destructor should
2980 have the same name as container class), not the full name.
2982 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
2983 possible representation.
2985 Also implements integer type suffixes U and L.
2987 2001-12-15 Miguel de Icaza <miguel@ximian.com>
2989 * expression.cs (ArrayCreation.DoResolve): We need to do the
2990 argument resolution *always*.
2992 * decl.cs: Make this hold the namespace. Hold the root context as
2994 (LookupType): Move here.
2996 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
2998 * location.cs (Row, Name): Fixed the code, it was always returning
2999 references to the first file.
3001 * interface.cs: Register properties defined through interfaces.
3003 * driver.cs: Add support for globbing on the command line
3005 * class.cs (Field): Make it derive from MemberCore as well.
3008 2001-12-15 Ravi Pratap <ravi@ximian.com>
3010 * class.cs (Event::Define): Check that the type of the event is a delegate
3011 type else flag error #66.
3013 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
3016 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
3017 values of EntryPoint, CharSet etc etc.
3019 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
3021 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
3022 be null and we should ignore this. I am not sure if this is really clean. Apparently,
3023 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
3024 which needs this to do its work.
3026 * ../errors/cs0066.cs : Add.
3028 2001-12-14 Miguel de Icaza <miguel@ximian.com>
3030 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
3033 * class.cs: (MethodSignature.MethodSignature): Removed hack that
3034 clears out the parameters field.
3035 (MemberSignatureCompare): Cleanup
3037 (MemberCore): New base class used to share code between MethodCore
3040 (RegisterRequiredImplementations) BindingFlags.Public requires
3041 either BindingFlags.Instace or Static. Use instance here.
3043 (Property): Refactored code to cope better with the full spec.
3045 * parameter.cs (GetParameterInfo): Return an empty array instead
3048 * class.cs (Property): Abstract or extern properties have no bodies.
3050 * parameter.cs (GetParameterInfo): return a zero-sized array.
3052 * class.cs (TypeContainer.MethodModifiersValid): Move all the
3053 method modifier validation to the typecontainer so we can reuse
3056 (MethodCore.ParameterTypes): return an empty sized array of types.
3058 (Property.Define): Test property modifier validity.
3060 Add tests for sealed/override too.
3062 (Method.Emit): abstract or extern methods have no bodies.
3064 2001-12-14 Ravi Pratap <ravi@ximian.com>
3066 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
3069 (Method::Define, ::Emit): Modify accordingly.
3071 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
3073 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
3075 * makefile: Pass in /unsafe.
3077 2001-12-13 Miguel de Icaza <miguel@ximian.com>
3079 * class.cs (MakeKey): Kill routine.
3081 * class.cs (TypeContainer.Define): Correctly define explicit
3082 method implementations (they require the full interface name plus
3085 * typemanager.cs: Deply the PtrHashtable here and stop using the
3086 lame keys. Things work so much better.
3088 This of course broke everyone who depended on `RegisterMethod' to
3089 do the `test for existance' test. This has to be done elsewhere.
3091 * support.cs (PtrHashtable): A hashtable that avoid comparing with
3092 the object stupid Equals method (because, that like fails all over
3093 the place). We still do not use it.
3095 * class.cs (TypeContainer.SetRequiredInterface,
3096 TypeContainer.RequireMethods): Killed these two routines and moved
3097 all the functionality to RegisterRequiredImplementations.
3099 (TypeContainer.RegisterRequiredImplementations): This routine now
3100 registers all the implementations required in an array for the
3101 interfaces and abstract methods. We use an array of structures
3102 which can be computed ahead of time to reduce memory usage and we
3103 also assume that lookups are cheap as most classes will not
3104 implement too many interfaces.
3106 We also avoid creating too many MethodSignatures.
3108 (TypeContainer.IsInterfaceMethod): Update and optionally does not
3109 clear the "pending" bit if we find that there are problems with
3112 (TypeContainer.VerifyPendingMethods): Update to report errors of
3113 methods that look like implementations but are not.
3115 (TypeContainer.Define): Add support for explicit interface method
3118 2001-12-12 Miguel de Icaza <miguel@ximian.com>
3120 * typemanager.cs: Keep track of the parameters here instead of
3121 being a feature of the TypeContainer.
3123 * class.cs: Drop the registration of parameters here, as
3124 InterfaceMethods are also interface declarations.
3126 * delegate.cs: Register methods with the TypeManager not only with
3127 the TypeContainer. This code was buggy.
3129 * interface.cs: Full registation here.
3131 2001-12-11 Miguel de Icaza <miguel@ximian.com>
3133 * expression.cs: Remove reducer for binary expressions, it can not
3136 * const.cs: Put here the code that used to go into constant.cs
3138 * constant.cs: Put here the code for constants, this is a new base
3141 * literal.cs: Make Literal derive from Constant.
3143 2001-12-09 Miguel de Icaza <miguel@ximian.com>
3145 * statement.cs (Return.Emit): Report error 157 if the user
3146 attempts to return from a finally block.
3148 (Return.Emit): Instead of emitting a return, jump to the end of
3151 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
3152 LocalBuilder to store the result of the function. ReturnLabel is
3153 the target where we jump.
3156 2001-12-09 Radek Doulik <rodo@ximian.com>
3158 * cs-parser.jay: remember alias in current namespace
3160 * ecore.cs (SimpleName::DoResolve): use aliases for types or
3163 * class.cs (LookupAlias): lookup alias in my_namespace
3165 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
3167 (LookupAlias): lookup alias in this and if needed in parent
3170 2001-12-08 Miguel de Icaza <miguel@ximian.com>
3174 * rootcontext.cs: (ModuleBuilder) Made static, first step into
3175 making things static. I need this to avoid passing the
3176 TypeContainer when calling ParameterType.
3178 * support.cs (InternalParameters.ParameterType): Remove ugly hack
3179 that did string manipulation to compute the type and then call
3180 GetType. Use Parameter.ParameterType instead.
3182 * cs-tokenizer.cs: Consume the suffix for floating values.
3184 * expression.cs (ParameterReference): figure out whether this is a
3185 reference parameter or not. Kill an extra variable by computing
3186 the arg_idx during emission.
3188 * parameter.cs (Parameters.GetParameterInfo): New overloaded
3189 function that returns whether a parameter is an out/ref value or not.
3191 (Parameter.ParameterType): The type of the parameter (base,
3192 without ref/out applied).
3194 (Parameter.Resolve): Perform resolution here.
3195 (Parameter.ExternalType): The full type (with ref/out applied).
3197 * statement.cs (Using.Emit, Using.EmitExpression): Implement
3198 support for expressions on the using statement.
3200 2001-12-07 Miguel de Icaza <miguel@ximian.com>
3202 * statement.cs (Using.EmitLocalVariableDecls): Split the
3203 localvariable handling of the using statement.
3205 (Block.EmitMeta): Keep track of variable count across blocks. We
3206 were reusing slots on separate branches of blocks.
3208 (Try.Emit): Emit the general code block, we were not emitting it.
3210 Check the type of the declaration to be an IDisposable or
3211 something that can be implicity converted to it.
3213 Emit conversions if required.
3215 * ecore.cs (EmptyExpression): New utility class.
3216 (Expression.ImplicitConversionExists): New utility function.
3218 2001-12-06 Miguel de Icaza <miguel@ximian.com>
3220 * statement.cs (Using): Implement.
3222 * expression.cs (LocalVariableReference): Support read only variables.
3224 * statement.cs: Remove the explicit emit for the Leave opcode.
3225 (VariableInfo): Add a readonly field.
3227 2001-12-05 Miguel de Icaza <miguel@ximian.com>
3229 * ecore.cs (ConvCast): new class used to encapsulate the various
3230 explicit integer conversions that works in both checked and
3233 (Expression.ConvertNumericExplicit): Use new ConvCast class to
3234 properly generate the overflow opcodes.
3236 2001-12-04 Miguel de Icaza <miguel@ximian.com>
3238 * statement.cs: The correct type for the EmptyExpression is the
3239 element_type, not the variable type. Ravi pointed this out.
3241 2001-12-04 Ravi Pratap <ravi@ximian.com>
3243 * class.cs (Method::Define): Handle PInvoke methods specially
3244 by using DefinePInvokeMethod instead of the usual one.
3246 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
3247 above to do the task of extracting information and defining the method.
3249 2001-12-04 Ravi Pratap <ravi@ximian.com>
3251 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
3252 of the condition for string type.
3254 (Emit): Move that here.
3256 (ArrayCreation::CheckIndices): Keep string literals in their expression
3259 (EmitDynamicInitializers): Handle strings appropriately.
3261 2001-12-04 Miguel de Icaza <miguel@ximian.com>
3263 * codegen.cs (EmitContext): Replace multiple variables with a
3264 single pointer to the current Switch statement.
3266 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
3269 2001-12-03 Miguel de Icaza <miguel@ximian.com>
3273 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
3276 (Foreach.Emit): Foreach on arrays was not setting
3277 up the loop variables (for break/continue).
3279 (GotoCase): Semi-implented.
3281 2001-12-03 Ravi Pratap <ravi@ximian.com>
3283 * attribute.cs (CheckAttribute): Handle system attributes by using
3284 Attribute.GetAttributes to examine information we need.
3286 (GetValidPlaces): Same here.
3288 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
3290 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
3292 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
3294 (Method::Define): Set appropriate flags if we have a DllImport attribute.
3296 (Method::Emit): Handle the case when we are a PInvoke method.
3298 2001-12-03 Miguel de Icaza <miguel@ximian.com>
3300 * expression.cs: Use ResolveWithSimpleName on compound names.
3302 2001-12-02 Ravi Pratap <ravi@ximian.com>
3304 * constant.cs (EmitConstant): Make sure we resolve the associated expression
3305 before trying to reduce it.
3307 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
3309 * constant.cs (LookupConstantValue): Implement.
3311 (EmitConstant): Use the above in emitting the constant.
3313 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
3314 that are user-defined by doing a LookupConstantValue on them.
3316 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
3319 2001-11-29 Miguel de Icaza <miguel@ximian.com>
3321 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
3323 (BaseAccess.DoResolve): Implement.
3325 (MemberAccess.DoResolve): Split this routine into a
3326 ResolveMemberAccess routine that can be used independently
3328 2001-11-28 Miguel de Icaza <miguel@ximian.com>
3330 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
3331 As that share bits of the implementation. Is returns a boolean,
3332 while As returns the Type that is being probed.
3334 2001-12-01 Ravi Pratap <ravi@ximian.com>
3336 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
3337 instead of a Literal - much easier.
3339 (EnumInTransit): Remove - utterly useless :-)
3341 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
3343 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
3345 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
3346 chain when we have no associated expression.
3348 2001-11-30 Ravi Pratap <ravi@ximian.com>
3350 * constant.cs (Define): Use Location while reporting the errror.
3352 Also emit a warning when 'new' is used and there is no inherited
3355 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
3358 (LookupEnumValue): Implement to lookup an enum member's value and define it
3361 (Populate): Re-write accordingly to use the above routine.
3363 2001-11-27 Miguel de Icaza <miguel@ximian.com>
3365 * expression.cs (This): Fix prototype for DoResolveLValue to
3366 override the base class DoResolveLValue.
3368 * cs-parser.cs: Report errors cs574 and cs575 (destructor
3371 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
3372 (we need to load the address of the field here). This fixes
3375 (FieldExpr.DoResolveLValue): Call the DoResolve
3376 function to initialize the Instance expression.
3378 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
3379 correctly the GetEnumerator operation on a value type.
3381 * cs-parser.jay: Add more simple parsing error catches.
3383 * statement.cs (Switch): Add support for string switches.
3384 Handle null specially.
3386 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
3388 2001-11-28 Ravi Pratap <ravi@ximian.com>
3390 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
3392 (declare_local_constant): New helper function.
3394 * statement.cs (AddConstant): Keep a separate record of constants
3396 (IsConstant): Implement to determine if a variable is a constant.
3398 (GetConstantExpression): Implement.
3400 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
3402 * statement.cs (IsVariableDefined): Re-write.
3404 2001-11-27 Ravi Pratap <ravi@ximian.com>
3406 * class.cs (TypeContainer::FindMembers): Look for constants
3407 in the case when we are looking for MemberTypes.Field
3409 * expression.cs (MemberAccess::DoResolve): Check that in the
3410 case we are a FieldExpr and a Literal, we are not being accessed
3411 by an instance reference.
3413 * cs-parser.jay (local_constant_declaration): Implement.
3415 (declaration_statement): Implement for constant declarations.
3417 2001-11-26 Miguel de Icaza <miguel@ximian.com>
3419 * statement.cs (Switch): Catch double defaults.
3421 (Switch): More work on the switch() statement
3422 implementation. It works for integral values now, need to finish
3426 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3428 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
3429 integer literals into other integer literals. To be used by
3432 2001-11-24 Ravi Pratap <ravi@ximian.com>
3434 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
3437 (EmitDynamicInitializers): Cope with the above since we extract data
3438 directly from ArrayData now.
3440 (ExpectInitializers): Keep track of whether initializers are mandatory
3443 (Bounds): Make it a hashtable to prevent the same dimension being
3444 recorded for every element in that dimension.
3446 (EmitDynamicInitializers): Fix bug which prevented the Set array method
3449 Also fix bug which was causing the indices to be emitted in the reverse
3452 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3454 * expression.cs (ArrayCreation): Implement the bits that Ravi left
3455 unfinished. They do not work, because the underlying code is
3458 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3460 * cs-parser.jay: Remove bogus fixme.
3462 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
3463 on Switch statement.
3465 2001-11-23 Ravi Pratap <ravi@ximian.com>
3467 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
3470 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
3471 parameter. Apparently, any expression is allowed.
3473 (ValidateInitializers): Update accordingly.
3475 (CheckIndices): Fix some tricky bugs thanks to recursion.
3477 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
3478 I was being completely brain-dead.
3480 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
3481 and re-write acordingly.
3483 (DelegateInvocation): Re-write accordingly.
3485 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
3487 (MakeByteBlob): Handle types more correctly.
3489 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
3490 initialization from expressions but it is incomplete because I am a complete
3493 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3495 * statement.cs (If.Emit): Fix a bug that generated incorrect code
3496 on If. Basically, we have to return `true' (ie, we do return to
3497 our caller) only if both branches of the if return.
3499 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
3500 short-circuit operators, handle them as short circuit operators.
3502 (Cast.DoResolve): Resolve type.
3503 (Cast.Cast): Take an expression as the target type.
3505 * cs-parser.jay (cast_expression): Remove old hack that only
3506 allowed a limited set of types to be handled. Now we take a
3507 unary_expression and we resolve to a type during semantic
3510 Use the grammar productions from Rhys to handle casts (this is
3511 not complete like Rhys syntax yet, we fail to handle that corner
3512 case that C# has regarding (-x), but we will get there.
3514 2001-11-22 Ravi Pratap <ravi@ximian.com>
3516 * class.cs (EmitFieldInitializer): Take care of the case when we have a
3517 field which is an array type.
3519 * cs-parser.jay (declare_local_variables): Support array initialization too.
3521 * typemanager.cs (MakeKey): Implement.
3523 (everywhere): Use the above appropriately.
3525 * cs-parser.jay (for_statement): Update for array initialization while
3526 declaring variables.
3528 * ecore.cs : The error message was correct, it's the variable's names that
3529 were misleading ;-) Make the code more readable.
3531 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
3532 the correct type etc.
3534 (ConvertExplicit): Handle Enum types by examining the underlying type.
3536 2001-11-21 Ravi Pratap <ravi@ximian.com>
3538 * parameter.cs (GetCallingConvention): Always return
3539 CallingConventions.Standard for now.
3541 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3543 * expression.cs (Binary.ResolveOperator): Update the values of `l'
3544 and `r' after calling DoNumericPromotions.
3546 * ecore.cs: Fix error message (the types were in the wrong order).
3548 * statement.cs (Foreach.ProbeCollectionType): Need to pass
3549 BindingFlags.Instance as well
3551 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
3552 implicit int literal conversion in an empty cast so that we
3553 propagate the right type upstream.
3555 (UnboxCast): new class used to unbox value types.
3556 (Expression.ConvertExplicit): Add explicit type conversions done
3559 (Expression.ImplicitNumericConversion): Oops, forgot to test for
3560 the target type before applying the implicit LongLiterals to ULong
3563 2001-11-21 Miguel de Icaza <miguel@ximian.com>
3565 * cs-parser.jay (for_statement): Reworked the way For works: now
3566 we declare manually any variables that are introduced in
3567 for_initializer to solve the problem of having out-of-band code
3568 emition (that is what got for broken).
3570 (declaration_statement): Perform the actual variable declaration
3571 that used to be done in local_variable_declaration here.
3573 (local_variable_declaration): Do not declare anything, just pass
3574 the information on a DictionaryEntry
3576 2001-11-20 Ravi Pratap <ravi@ximian.com>
3578 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
3579 re-write of the logic to now make it recursive.
3581 (UpdateIndices): Re-write accordingly.
3583 Store element data in a separate ArrayData list in the above methods.
3585 (MakeByteBlob): Implement to dump the array data into a byte array.
3587 2001-11-19 Ravi Pratap <ravi@ximian.com>
3589 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
3592 * constant.cs (Define): Implement.
3594 (EmitConstant): Re-write fully.
3596 Pass in location info.
3598 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
3601 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
3602 DictionaryEntry since we need location info too.
3604 (constant_declaration): Update accordingly.
3606 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
3607 code into another method : UpdateIndices.
3609 2001-11-18 Ravi Pratap <ravi@ximian.com>
3611 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
3612 some type checking etc.
3614 2001-11-17 Ravi Pratap <ravi@ximian.com>
3616 * expression.cs (ArrayCreation::ValidateInitializers): Implement
3617 bits to provide dimension info if the user skips doing that.
3619 Update second constructor to store the rank correctly.
3621 2001-11-16 Ravi Pratap <ravi@ximian.com>
3623 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
3624 and try to implement.
3626 * ../errors/cs0150.cs : Add.
3628 * ../errors/cs0178.cs : Add.
3630 2001-11-16 Miguel de Icaza <miguel@ximian.com>
3632 * statement.cs: Implement foreach on multi-dimensional arrays.
3634 * parameter.cs (Parameters.GetParameterByName): Also lookup the
3635 name of the params argument.
3637 * expression.cs: Use EmitStoreOpcode to get the right opcode while
3638 initializing the array.
3640 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
3641 we can use this elsewhere.
3643 * statement.cs: Finish implementation of foreach for single
3646 * cs-parser.jay: Use an out-of-band stack to pass information
3647 around, I wonder why I need this.
3649 foreach_block: Make the new foreach_block the current_block.
3651 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
3652 function used to return a static Parameters structure. Used for
3653 empty parameters, as those are created very frequently.
3655 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
3657 2001-11-15 Ravi Pratap <ravi@ximian.com>
3659 * interface.cs : Default modifier is private, not public. The
3660 make verify test passes again.
3662 2001-11-15 Ravi Pratap <ravi@ximian.com>
3664 * support.cs (ReflectionParameters): Fix logic to determine
3665 whether the last parameter is a params one. Test 9 passes again.
3667 * delegate.cs (Populate): Register the builders we define with
3668 RegisterParameterForBuilder. Test 19 passes again.
3670 * cs-parser.jay (property_declaration): Reference $6 instead
3671 of $$ to get at the location.
3673 (indexer_declaration): Similar stuff.
3677 * class.cs (Property): Register parameters for the Get and Set methods
3678 if they exist. Test 23 passes again.
3680 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
3681 call to EmitArguments as we are sure there aren't any params arguments.
3682 Test 32 passes again.
3684 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
3685 IndexOutOfRangeException.
3687 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
3688 Test 33 now passes again.
3690 2001-11-15 Miguel de Icaza <miguel@ximian.com>
3692 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
3693 broke a bunch of things. Will have to come up with a better way
3694 of tracking locations.
3696 * statement.cs: Implemented foreach for single dimension arrays.
3698 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3700 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
3701 an error. This removes the lookup from the critical path.
3703 * cs-parser.jay: Removed use of temporary_loc, which is completely
3706 2001-11-14 Miguel de Icaza <miguel@ximian.com>
3708 * support.cs (ReflectionParameters.ParameterModifier): Report
3709 whether the argument is a PARAMS argument or not.
3711 * class.cs: Set the attribute `ParamArrayAttribute' on the
3714 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
3715 and cons_param_array_attribute (ConstructorInfo for
3716 ParamArrayAttribute).,
3718 * codegen.cs: Emit the return using the `Return' statement, that
3719 way we can report the error correctly for missing return values.
3721 * class.cs (Method.Emit): Clean up.
3723 * expression.cs (Argument.Resolve): Take another argument: the
3724 location where this argument is used. Notice that this is not
3725 part of the "Argument" class as to reduce the size of the
3726 structure (we know the approximate location anyways).
3728 Test if the argument is a variable-reference, if not, then
3729 complain with a 206.
3731 (Argument.Emit): Emit addresses of variables.
3733 (Argument.FullDesc): Simplify.
3735 (Invocation.DoResolve): Update for Argument.Resolve.
3737 (ElementAccess.DoResolve): ditto.
3739 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
3740 method should be virtual, as this method is always virtual.
3742 (NewDelegate.DoResolve): Update for Argument.Resolve.
3744 * class.cs (ConstructorInitializer.DoResolve): ditto.
3746 * attribute.cs (Attribute.Resolve): ditto.
3748 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3750 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
3752 * expression.cs (ParameterReference): Drop IStackStorage and implement
3753 IAssignMethod instead.
3755 (LocalVariableReference): ditto.
3757 * ecore.cs (FieldExpr): Drop IStackStorage and implement
3758 IAssignMethod instead.
3760 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3762 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
3763 enumerations that are used in heavily used structures derive from
3764 byte in a laughable and pathetic attempt to reduce memory usage.
3765 This is the kind of pre-optimzations that you should not do at
3766 home without adult supervision.
3768 * expression.cs (UnaryMutator): New class, used to handle ++ and
3769 -- separatedly from the other unary operators. Cleans up the
3770 code, and kills the ExpressionStatement dependency in Unary.
3772 (Unary): Removed `method' and `Arguments' from this class, making
3773 it smaller, and moving it all to SimpleCall, so I can reuse this
3774 code in other locations and avoid creating a lot of transient data
3775 strucutres when not required.
3777 * cs-parser.jay: Adjust for new changes.
3779 2001-11-11 Miguel de Icaza <miguel@ximian.com>
3781 * enum.cs (Enum.Populate): If there is a failure during
3784 * cs-parser.jay (opt_enum_base): we used to catch type errors
3785 here, but this is really incorrect. The type error should be
3786 catched during semantic analysis.
3788 2001-12-11 Ravi Pratap <ravi@ximian.com>
3790 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
3791 current_local_parameters as expected since I, in my stupidity, had forgotten
3794 * attribute.cs (GetValidPlaces): Fix stupid bug.
3796 * class.cs (Method::Emit): Perform check on applicability of attributes.
3798 (Constructor::Emit): Ditto.
3800 (Field::Emit): Ditto.
3802 (Field.Location): Store location information.
3804 (Property, Event, Indexer, Operator): Ditto.
3806 * cs-parser.jay (field_declaration): Pass in location for each field.
3808 * ../errors/cs0592.cs : Add.
3810 2001-11-12 Ravi Pratap <ravi@ximian.com>
3812 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
3814 (InitCoreTypes): Update accordingly.
3816 (RegisterAttrType, LookupAttr): Implement.
3818 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
3819 info about the same.
3821 (Resolve): Update to populate the above as necessary.
3825 (GetValidPlaces): Helper to the above.
3827 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
3829 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
3831 2001-11-12 Ravi Pratap <ravi@ximian.com>
3833 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
3835 * ../errors/cs0617.cs : Add.
3837 2001-11-11 Ravi Pratap <ravi@ximian.com>
3839 * enum.cs (Emit): Rename to Populate to be more consistent with what
3840 we expect it to do and when exactly it is called.
3842 * class.cs, rootcontext.cs : Update accordingly.
3844 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
3845 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
3847 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
3849 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
3850 of a fieldinfo using the above, when dealing with a FieldBuilder.
3852 2001-11-10 Ravi Pratap <ravi@ximian.com>
3854 * ../errors/cs0031.cs : Add.
3856 * ../errors/cs1008.cs : Add.
3858 * ../errrors/cs0543.cs : Add.
3860 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
3863 (FindMembers): Implement.
3865 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
3866 enums and delegates too.
3868 (enum_types): Rename to builder_to_enum.
3870 (delegate_types): Rename to builder_to_delegate.
3872 * delegate.cs (FindMembers): Implement.
3874 2001-11-09 Ravi Pratap <ravi@ximian.com>
3876 * typemanager.cs (IsEnumType): Implement.
3878 * enum.cs (Emit): Re-write parts to account for the underlying type
3879 better and perform checking etc.
3881 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
3882 of the underlying type.
3884 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
3887 * enum.cs (error31): Helper to report error #31.
3889 * cs-parser.jay (enum_declaration): Store location of each member too.
3891 * enum.cs (member_to_location): New hashtable.
3893 (AddEnumMember): Update location hashtable.
3895 (Emit): Use the location of each member while reporting errors.
3897 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3899 * cs-parser.jay: A for_initializer if is a
3900 local_variable_declaration really ammount to have an implicit
3901 block with the variable declaration and no initializer for for.
3903 * statement.cs (For.Emit): Cope with null initializers.
3905 This fixes the infinite loop on for initializers.
3907 2001-11-08 Miguel de Icaza <miguel@ximian.com>
3909 * enum.cs: More cleanup.
3911 * ecore.cs: Remove dead code.
3913 * class.cs (Property.Emit): More simplification.
3914 (Event.Emit): ditto.
3916 Reworked to have less levels of indentation.
3918 2001-11-08 Ravi Pratap <ravi@ximian.com>
3920 * class.cs (Property): Emit attributes.
3930 * enum.cs (Emit): Ditto.
3932 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
3935 * class.cs (Field, Event, etc.): Move attribute generation into the
3936 Emit method everywhere.
3938 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
3939 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
3940 as we had no way of defining nested enums !
3942 * rootcontext.cs : Adjust code accordingly.
3944 * typemanager.cs (AddEnumType): To keep track of enum types separately.
3946 2001-11-07 Ravi Pratap <ravi@ximian.com>
3948 * expression.cs (EvalConstantExpression): Move into ecore.cs
3950 * enum.cs (Enum): Rename some members and make them public and readonly
3951 according to our convention.
3953 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
3956 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
3958 (Enum::Emit): Write a simple version for now which doesn't try to compute
3959 expressions. I shall modify this to be more robust in just a while.
3961 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
3963 (TypeContainer::CloseType): Create the Enum types too.
3965 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
3967 * expression.cs (EvalConstantExpression): Get rid of completely.
3969 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
3970 user-defined values and other cases.
3972 (IsValidEnumLiteral): Helper function.
3974 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
3975 out there in the case we had a literal FieldExpr.
3977 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
3979 (Literalize): Revamp a bit to take two arguments.
3981 (EnumLiteral): New class which derives from Literal to wrap enum literals.
3983 2001-11-06 Ravi Pratap <ravi@ximian.com>
3985 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
3987 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
3989 (Resolve): Use the above to ensure we have proper initializers.
3991 2001-11-05 Ravi Pratap <ravi@ximian.com>
3993 * expression.cs (Expression::EvalConstantExpression): New method to
3994 evaluate constant expressions.
3996 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
3998 2001-11-07 Miguel de Icaza <miguel@ximian.com>
4000 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
4003 (Binary.ResolveOperator): Handle operator != (object a, object b)
4004 and operator == (object a, object b);
4006 (Binary.DoNumericPromotions): Indicate whether the numeric
4007 promotion was possible.
4009 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
4012 Made the ArrayAccess implement interface IAssignMethod instead of
4013 IStackStore as the order in which arguments are passed reflects
4016 * assign.cs: Instead of using expr.ExprClass to select the way of
4017 assinging, probe for the IStackStore/IAssignMethod interfaces.
4019 * typemanager.cs: Load InitializeArray definition.
4021 * rootcontext.cs (RootContext.MakeStaticData): Used to define
4022 static data that can be used to initialize arrays.
4024 2001-11-05 Miguel de Icaza <miguel@ximian.com>
4026 * expression.cs: Handle operator== and operator!= for booleans.
4028 (Conditioal.Reduce): Implement reducer for the ?: operator.
4030 (Conditional.Resolve): Implement dead code elimination.
4032 (Binary.Resolve): Catch string literals and return a new
4033 concatenated string.
4035 (Unary.Reduce): Implement reduction of unary expressions.
4037 * ecore.cs: Split out the expression core handling here.
4039 (Expression.Reduce): New method used to perform constant folding
4040 and CSE. This is needed to support constant-expressions.
4042 * statement.cs (Statement.EmitBoolExpression): Pass true and false
4043 targets, and optimize for !x.
4045 2001-11-04 Ravi Pratap <ravi@ximian.com>
4047 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
4048 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
4049 set custom atttributes.
4051 * literal.cs (Literal::GetValue): New abstract method to return the actual
4052 value of the literal, cast as an object.
4054 (*Literal): Implement GetValue method.
4056 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
4057 expressions to the arraylist but objects of type Argument.
4059 * class.cs (TypeContainer::Emit): Emit our attributes too.
4061 (Method::Emit, Constructor::Emit): Ditto.
4063 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
4064 to be ignoring earlier.
4066 2001-11-03 Ravi Pratap <ravi@ximian.com>
4068 * attribute.cs (AttributeSection::Define): Implement to do the business
4069 of constructing a CustomAttributeBuilder.
4071 (Attribute): New trivial class. Increases readability of code.
4073 * cs-parser.jay : Update accordingly.
4075 (positional_argument_list, named_argument_list, named_argument): New rules
4077 (attribute_arguments): Use the above so that we are more correct.
4079 2001-11-02 Ravi Pratap <ravi@ximian.com>
4081 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
4082 to perform all checks for a method with a params parameter.
4084 (Invocation::OverloadResolve): Update to use the above method and therefore
4085 cope correctly with params method invocations.
4087 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
4090 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
4091 constructors in our parent too because we can't afford to miss out on
4094 * attribute.cs (AttributeSection): New name for the class Attribute
4096 Other trivial changes to improve readability.
4098 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
4099 use the new class names.
4101 2001-11-01 Ravi Pratap <ravi@ximian.com>
4103 * class.cs (Method::Define): Complete definition for params types too
4105 (Indexer::Define): Ditto.
4107 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
4108 Cope everywhere with a request for info about the array parameter.
4110 2001-11-01 Ravi Pratap <ravi@ximian.com>
4112 * tree.cs (RecordNamespace): Fix up to check for the correct key.
4114 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
4115 local_variable_type to extract the string corresponding to the type.
4117 (local_variable_type): Fixup the action to use the new helper method.
4119 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
4122 * expression.cs : Clean out code which uses the above.
4124 2001-10-31 Ravi Pratap <ravi@ximian.com>
4126 * typemanager.cs (RegisterMethod): Check if we already have an existing key
4127 and bale out if necessary by returning a false.
4129 (RegisterProperty): Ditto.
4131 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
4132 and print out appropriate error messages.
4134 * interface.cs (everywhere): Ditto.
4136 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
4137 location to constructor.
4139 * class.cs (Property, Event, Indexer): Update accordingly.
4141 * ../errors/cs111.cs : Added.
4143 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
4144 of a method, as laid down by the spec.
4146 (Invocation::OverloadResolve): Use the above method.
4148 2001-10-31 Ravi Pratap <ravi@ximian.com>
4150 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
4151 now take a TypeContainer and a Parameters object.
4153 (ParameterData): Modify return type of ParameterModifier method to be
4154 Parameter.Modifier and not a string.
4156 (ReflectionParameters, InternalParameters): Update accordingly.
4158 * expression.cs (Argument::GetParameterModifier): Same here.
4160 * support.cs (InternalParameters::ParameterType): Find a better way of determining
4161 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
4162 symbol in it at all so maybe this is only for now.
4164 2001-10-30 Ravi Pratap <ravi@ximian.com>
4166 * support.cs (InternalParameters): Constructor now takes an extra argument
4167 which is the actual Parameters class.
4169 (ParameterDesc): Update to provide info on ref/out modifiers.
4171 * class.cs (everywhere): Update call to InternalParameters to pass in
4172 the second argument too.
4174 * support.cs (ParameterData): Add ParameterModifier, which is a method
4175 to return the modifier info [ref/out etc]
4177 (InternalParameters, ReflectionParameters): Implement the above.
4179 * expression.cs (Argument::ParameterModifier): Similar function to return
4180 info about the argument's modifiers.
4182 (Invocation::OverloadResolve): Update to take into account matching modifiers
4185 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
4186 a new SetFormalParameters object which we pass to InternalParameters.
4188 2001-10-30 Ravi Pratap <ravi@ximian.com>
4190 * expression.cs (NewArray): Merge into the ArrayCreation class.
4192 2001-10-29 Ravi Pratap <ravi@ximian.com>
4194 * expression.cs (NewArray): Merge classes NewBuiltinArray and
4195 NewUserdefinedArray into one as there wasn't much of a use in having
4198 * expression.cs (Argument): Change field's name to ArgType from Type.
4200 (Type): New readonly property which returns the proper type, taking into
4201 account ref/out modifiers.
4203 (everywhere): Adjust code accordingly for the above.
4205 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
4206 whether we are emitting for a ref or out parameter.
4208 * expression.cs (Argument::Emit): Use the above field to set the state.
4210 (LocalVariableReference::Emit): Update to honour the flag and emit the
4213 * parameter.cs (Attributes): Set the correct flags for ref parameters.
4215 * expression.cs (Argument::FullDesc): New function to provide a full desc.
4217 * support.cs (ParameterData): Add method ParameterDesc to the interface.
4219 (ReflectionParameters, InternalParameters): Implement the above method.
4221 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
4224 (Invocation::FullMethodDesc): Ditto.
4226 2001-10-29 Miguel de Icaza <miguel@ximian.com>
4228 * cs-parser.jay: Add extra production for the second form of array
4231 * expression.cs (ArrayCreation): Update to reflect the above
4234 * Small changes to prepare for Array initialization.
4236 2001-10-28 Miguel de Icaza <miguel@ximian.com>
4238 * typemanager.cs (ImplementsInterface): interface might be null;
4239 Deal with this problem;
4241 Also, we do store negative hits on the cache (null values), so use
4242 this instead of calling t.GetInterfaces on the type everytime.
4244 2001-10-28 Ravi Pratap <ravi@ximian.com>
4246 * typemanager.cs (IsBuiltinType): New method to help determine the same.
4248 * expression.cs (New::DoResolve): Get rid of array creation code and instead
4249 split functionality out into different classes.
4251 (New::FormArrayType): Move into NewBuiltinArray.
4253 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
4256 (NewBuiltinArray): New class to handle creation of built-in arrays.
4258 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
4259 account creation of one-dimensional arrays.
4261 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
4263 (NewUserdefinedArray::DoResolve): Implement.
4265 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
4267 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
4268 we maintain inside the TypeManager. This is necessary to perform lookups on the
4271 (LookupType): Update to perform GetType on the module builders too.
4273 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
4275 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
4277 2001-10-23 Ravi Pratap <ravi@ximian.com>
4279 * expression.cs (New::DoResolve): Implement guts of array creation.
4281 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
4283 2001-10-27 Miguel de Icaza <miguel@ximian.com>
4285 * expression.cs: Fix bug I introduced lsat night that broke
4288 (Expression.Resolve): Report a 246 error (can not resolve name)
4289 if we find a SimpleName in the stream.
4291 (Expression.ResolveLValue): Ditto.
4293 (Expression.ResolveWithSimpleName): This function is a variant of
4294 ResolveName, this one allows SimpleNames to be returned without a
4295 warning. The only consumer of SimpleNames is MemberAccess
4297 2001-10-26 Miguel de Icaza <miguel@ximian.com>
4299 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
4300 might arrive here. I have my doubts that this is correct.
4302 * statement.cs (Lock): Implement lock statement.
4304 * cs-parser.jay: Small fixes to support `lock' and `using'
4306 * cs-tokenizer.cs: Remove extra space
4308 * driver.cs: New flag --checked, allows to turn on integer math
4311 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
4312 Threading.Monitor.Exit
4314 2001-10-23 Miguel de Icaza <miguel@ximian.com>
4316 * expression.cs (IndexerAccess::DoResolveLValue): Set the
4317 Expression Class to be IndexerAccess.
4319 Notice that Indexer::DoResolve sets the eclass to Value.
4321 2001-10-22 Miguel de Icaza <miguel@ximian.com>
4323 * class.cs (TypeContainer::Emit): Emit code for indexers.
4325 * assign.cs (IAssignMethod): New interface implemented by Indexers
4326 and Properties for handling assignment.
4328 (Assign::Emit): Simplify and reuse code.
4330 * expression.cs (IndexerAccess, PropertyExpr): Implement
4331 IAssignMethod, clean up old code.
4333 2001-10-22 Ravi Pratap <ravi@ximian.com>
4335 * typemanager.cs (ImplementsInterface): New method to determine if a type
4336 implements a given interface. Provides a nice cache too.
4338 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
4341 (ConvertReferenceExplicit): Ditto.
4343 * delegate.cs (Delegate::Populate): Update to define the parameters on the
4344 various methods, with correct names etc.
4346 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
4347 Operator.UnaryNegation.
4349 * cs-parser.jay (operator_declarator): Be a little clever in the case where
4350 we have a unary plus or minus operator.
4352 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
4355 * everywhere : update accordingly.
4357 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
4360 * class.cs (Method::Define): For the case where we are implementing a method
4361 inherited from an interface, we need to set the MethodAttributes.Final flag too.
4362 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
4364 2001-10-21 Ravi Pratap <ravi@ximian.com>
4366 * interface.cs (FindMembers): Implement to work around S.R.E
4369 * typemanager.cs (IsInterfaceType): Implement.
4371 (FindMembers): Update to handle interface types too.
4373 * expression.cs (ImplicitReferenceConversion): Re-write bits which
4374 use IsAssignableFrom as that is not correct - it doesn't work.
4376 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
4377 and accordingly override EmitStatement.
4379 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
4380 using the correct logic :-)
4382 2001-10-19 Ravi Pratap <ravi@ximian.com>
4384 * ../errors/cs-11.cs : Add to demonstrate error -11
4386 2001-10-17 Miguel de Icaza <miguel@ximian.com>
4388 * assign.cs (Assign::Resolve): Resolve right hand side first, and
4389 then pass this as a hint to ResolveLValue.
4391 * expression.cs (FieldExpr): Add Location information
4393 (FieldExpr::LValueResolve): Report assignment to readonly
4396 (Expression::ExprClassFromMemberInfo): Pass location information.
4398 (Expression::ResolveLValue): Add new method that resolves an
4401 (Expression::DoResolveLValue): Default invocation calls
4404 (Indexers): New class used to keep track of indexers in a given
4407 (IStackStore): Renamed from LValue, as it did not really describe
4408 what this did. Also ResolveLValue is gone from this interface and
4409 now is part of Expression.
4411 (ElementAccess): Depending on the element access type
4413 * typemanager.cs: Add `indexer_name_type' as a Core type
4414 (System.Runtime.CompilerServices.IndexerNameAttribute)
4416 * statement.cs (Goto): Take a location.
4418 2001-10-18 Ravi Pratap <ravi@ximian.com>
4420 * delegate.cs (Delegate::VerifyDelegate): New method to verify
4421 if two delegates are compatible.
4423 (NewDelegate::DoResolve): Update to take care of the case when
4424 we instantiate a delegate from another delegate.
4426 * typemanager.cs (FindMembers): Don't even try to look up members
4427 of Delegate types for now.
4429 2001-10-18 Ravi Pratap <ravi@ximian.com>
4431 * delegate.cs (NewDelegate): New class to take care of delegate
4434 * expression.cs (New): Split the delegate related code out into
4435 the NewDelegate class.
4437 * delegate.cs (DelegateInvocation): New class to handle delegate
4440 * expression.cs (Invocation): Split out delegate related code into
4441 the DelegateInvocation class.
4443 2001-10-17 Ravi Pratap <ravi@ximian.com>
4445 * expression.cs (New::DoResolve): Implement delegate creation fully
4446 and according to the spec.
4448 (New::DoEmit): Update to handle delegates differently.
4450 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
4451 because of which we were printing out arguments in reverse order !
4453 * delegate.cs (VerifyMethod): Implement to check if the given method
4454 matches the delegate.
4456 (FullDelegateDesc): Implement.
4458 (VerifyApplicability): Implement.
4460 * expression.cs (Invocation::DoResolve): Update to accordingly handle
4461 delegate invocations too.
4463 (Invocation::Emit): Ditto.
4465 * ../errors/cs1593.cs : Added.
4467 * ../errors/cs1594.cs : Added.
4469 * delegate.cs (InstanceExpression, TargetMethod): New properties.
4471 2001-10-16 Ravi Pratap <ravi@ximian.com>
4473 * typemanager.cs (intptr_type): Core type for System.IntPtr
4475 (InitCoreTypes): Update for the same.
4477 (iasyncresult_type, asynccallback_type): Ditto.
4479 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
4482 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
4485 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
4486 the builders for the 4 members of a delegate type :-)
4488 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
4491 * expression.cs (New::DoResolve): Implement guts for delegate creation.
4493 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
4495 2001-10-15 Miguel de Icaza <miguel@ximian.com>
4497 * statement.cs (Break::Emit): Implement.
4498 (Continue::Emit): Implement.
4500 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
4501 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
4502 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
4503 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
4506 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
4507 properties that track the label for the current loop (begin of the
4508 loop and end of the loop).
4510 2001-10-15 Ravi Pratap <ravi@ximian.com>
4512 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
4513 use of emitting anything at all.
4515 * class.cs, rootcontext.cs : Get rid of calls to the same.
4517 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
4519 (Populate): Define the constructor correctly and set the implementation
4522 * typemanager.cs (delegate_types): New hashtable to hold delegates that
4525 (AddDelegateType): Implement.
4527 (IsDelegateType): Implement helper method.
4529 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
4531 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
4532 and accordingly handle it.
4534 * delegate.cs (Populate): Take TypeContainer argument.
4535 Implement bits to define the Invoke method. However, I still haven't figured out
4536 how to take care of the native int bit :-(
4538 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
4539 Qualify the name of the delegate, not its return type !
4541 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
4544 (StandardConversionExists): Checking for array types turns out to be recursive.
4546 (ConvertReferenceExplicit): Implement array conversion.
4548 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
4550 2001-10-12 Ravi Pratap <ravi@ximian.com>
4552 * cs-parser.jay (delegate_declaration): Store the fully qualified
4553 name as it is a type declaration.
4555 * delegate.cs (ReturnType, Name): Rename members to these. Make them
4558 (DefineDelegate): Renamed from Define. Does the same thing essentially,
4559 as TypeContainer::DefineType.
4561 (Populate): Method in which all the definition of the various methods (Invoke)
4564 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
4567 (CloseDelegate): Finally creates the delegate.
4569 * class.cs (TypeContainer::DefineType): Update to define delegates.
4570 (Populate, Emit and CloseType): Do the same thing here too.
4572 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
4573 delegates in all these operations.
4575 2001-10-14 Miguel de Icaza <miguel@ximian.com>
4577 * expression.cs: LocalTemporary: a new expression used to
4578 reference a temporary that has been created.
4580 * assign.cs: Handle PropertyAccess back here, so that we can
4581 provide the proper semantic access to properties.
4583 * expression.cs (Expression::ConvertReferenceExplicit): Implement
4584 a few more explicit conversions.
4586 * modifiers.cs: `NEW' modifier maps to HideBySig.
4588 * expression.cs (PropertyExpr): Make this into an
4589 ExpressionStatement, and support the EmitStatement code path.
4591 Perform get/set error checking, clean up the interface.
4593 * assign.cs: recognize PropertyExprs as targets, and if so, turn
4594 them into toplevel access objects.
4596 2001-10-12 Miguel de Icaza <miguel@ximian.com>
4598 * expression.cs: PropertyExpr::PropertyExpr: use work around the
4601 * typemanager.cs: Keep track here of our PropertyBuilders again to
4602 work around lameness in SRE.
4604 2001-10-11 Miguel de Icaza <miguel@ximian.com>
4606 * expression.cs (LValue::LValueResolve): New method in the
4607 interface, used to perform a second resolution pass for LValues.
4609 (This::DoResolve): Catch the use of this in static methods.
4611 (This::LValueResolve): Implement.
4613 (This::Store): Remove warning, assigning to `this' in structures
4616 (Invocation::Emit): Deal with invocation of
4617 methods on value types. We need to pass the address to structure
4618 methods rather than the object itself. (The equivalent code to
4619 emit "this" for structures leaves the entire structure on the
4620 stack instead of a pointer to it).
4622 (ParameterReference::DoResolve): Compute the real index for the
4623 argument based on whether the method takes or not a `this' pointer
4624 (ie, the method is static).
4626 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
4627 value types returned from functions when we need to invoke a
4628 method on the sturcture.
4631 2001-10-11 Ravi Pratap <ravi@ximian.com>
4633 * class.cs (TypeContainer::DefineType): Method to actually do the business of
4634 defining the type in the Modulebuilder or Typebuilder. This is to take
4635 care of nested types which need to be defined on the TypeBuilder using
4638 (TypeContainer::GetClassBases): Implement. Essentially the code from the
4639 methods in RootContext, only ported to be part of TypeContainer.
4641 (TypeContainer::GetInterfaceOrClass): Ditto.
4643 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
4645 * interface.cs (Interface::DefineInterface): New method. Does exactly
4646 what RootContext.CreateInterface did earlier, only it takes care of nested types
4649 (Interface::GetInterfaces): Move from RootContext here and port.
4651 (Interface::GetInterfaceByName): Same here.
4653 * rootcontext.cs (ResolveTree): Re-write.
4655 (PopulateTypes): Re-write.
4657 * class.cs (TypeContainer::Populate): Populate nested types too.
4658 (TypeContainer::Emit): Emit nested members too.
4660 * typemanager.cs (AddUserType): Do not make use of the FullName property,
4661 instead just use the name argument passed in as it is already fully
4664 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
4665 to TypeContainer mapping to see if a type is user-defined.
4667 * class.cs (TypeContainer::CloseType): Implement.
4669 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
4670 the default constructor.
4672 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
4675 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
4677 * interface.cs (CloseType): Create the type here.
4679 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
4682 Remove all the methods which are now in TypeContainer.
4684 2001-10-10 Ravi Pratap <ravi@ximian.com>
4686 * delegate.cs (Define): Re-write bits to define the delegate
4689 2001-10-10 Miguel de Icaza <miguel@ximian.com>
4691 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
4693 * expression.cs (ImplicitReferenceConversion): handle null as well
4694 as a source to convert to any reference type.
4696 * statement.cs (Return): Perform any implicit conversions to
4697 expected return type.
4699 Validate use of return statement.
4701 * codegen.cs (EmitContext): Pass the expected return type here.
4703 * class.cs (Method, Constructor, Property): Pass expected return
4704 type to EmitContext.
4706 2001-10-09 Miguel de Icaza <miguel@ximian.com>
4708 * expression.cs: Make DoResolve take an EmitContext instead of a
4711 Replaced `l' and `location' for `loc', for consistency.
4713 (Error, Warning): Remove unneeded Tc argument.
4715 * assign.cs, literal.cs, constant.cs: Update to new calling
4718 * codegen.cs: EmitContext now contains a flag indicating whether
4719 code is being generated in a static method or not.
4721 * cs-parser.jay: DecomposeQI, new function that replaces the old
4722 QualifiedIdentifier. Now we always decompose the assembled
4723 strings from qualified_identifier productions into a group of
4726 2001-10-08 Miguel de Icaza <miguel@ximian.com>
4728 * rootcontext.cs: Deal with field-less struct types correctly now
4729 by passing the size option to Define Type.
4731 * class.cs: Removed hack that created one static field.
4733 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4735 * statement.cs: Moved most of the code generation here.
4737 2001-10-09 Ravi Pratap <ravi@ximian.com>
4739 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
4742 (ElementAccess): Remove useless bits for now - keep checks as the spec
4745 2001-10-08 Ravi Pratap <ravi@ximian.com>
4747 * expression.cs (ElementAccess::DoResolve): Remove my crap code
4748 and start performing checks according to the spec.
4750 2001-10-07 Ravi Pratap <ravi@ximian.com>
4752 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
4753 rank_specifiers instead.
4755 (rank_specifiers): Change the order in which the rank specifiers are stored
4757 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
4759 * expression.cs (ElementAccess): Implement the LValue interface too.
4761 2001-10-06 Ravi Pratap <ravi@ximian.com>
4763 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
4764 except that user defined conversions are not included.
4766 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
4767 perform the conversion of the return type, if necessary.
4769 (New::DoResolve): Check whether we are creating an array or an object
4770 and accordingly do the needful.
4772 (New::Emit): Same here.
4774 (New::DoResolve): Implement guts of array creation.
4776 (New::FormLookupType): Helper function.
4778 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4780 * codegen.cs: Removed most of the code generation here, and move the
4781 corresponding code generation bits to the statement classes.
4783 Added support for try/catch/finalize and throw.
4785 * cs-parser.jay: Added support for try/catch/finalize.
4787 * class.cs: Catch static methods having the flags override,
4788 virtual or abstract.
4790 * expression.cs (UserCast): This user cast was not really doing
4791 what it was supposed to do. Which is to be born in fully resolved
4792 state. Parts of the resolution were being performed at Emit time!
4796 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4798 * expression.cs: Implicity convert the result from UserCast.
4800 2001-10-05 Ravi Pratap <ravi@ximian.com>
4802 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
4803 prevented it from working correctly.
4805 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
4806 merely ConvertImplicit.
4808 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4810 * typemanager.cs: Make the LookupTypeContainer function static,
4811 and not per-instance.
4813 * class.cs: Make static FindMembers (the one that takes a Type
4816 * codegen.cs: Add EmitForeach here.
4818 * cs-parser.jay: Make foreach a toplevel object instead of the
4819 inline expansion, as we need to perform semantic analysis on it.
4821 2001-10-05 Ravi Pratap <ravi@ximian.com>
4823 * expression.cs (Expression::ImplicitUserConversion): Rename to
4824 UserDefinedConversion.
4826 (Expression::UserDefinedConversion): Take an extra argument specifying
4827 whether we look for explicit user conversions too.
4829 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
4831 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
4833 (ExplicitUserConversion): Make it a call to UserDefinedConversion
4834 with the appropriate arguments.
4836 * cs-parser.jay (cast_expression): Record location too.
4838 * expression.cs (Cast): Record location info.
4840 (Expression::ConvertExplicit): Take location argument.
4842 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
4843 to determine if we are doing explicit conversions.
4845 (UserCast::Emit): Update accordingly.
4847 (Expression::ConvertExplicit): Report an error if everything fails.
4849 * ../errors/cs0030.cs : Add.
4851 2001-10-04 Miguel de Icaza <miguel@ximian.com>
4853 * modifiers.cs: If the ABSTRACT keyword is present, also set the
4854 virtual and newslot bits.
4856 * class.cs (TypeContainer::RegisterRequiredImplementations):
4857 Record methods we need.
4859 (TypeContainer::MakeKey): Helper function to make keys for
4860 MethodBases, since the Methodbase key is useless.
4862 (TypeContainer::Populate): Call RegisterRequiredImplementations
4863 before defining the methods.
4865 Create a mapping for method_builders_to_methods ahead of time
4866 instead of inside a tight loop.
4868 (::RequireMethods): Accept an object as the data to set into the
4869 hashtable so we can report interface vs abstract method mismatch.
4871 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4873 * report.cs: Make all of it static.
4875 * rootcontext.cs: Drop object_type and value_type computations, as
4876 we have those in the TypeManager anyways.
4878 Drop report instance variable too, now it is a global.
4880 * driver.cs: Use try/catch on command line handling.
4882 Add --probe option to debug the error reporting system with a test
4885 * report.cs: Add support for exiting program when a probe
4886 condition is reached.
4888 2001-10-03 Ravi Pratap <ravi@ximian.com>
4890 * expression.cs (Binary::DoNumericPromotions): Fix the case when
4891 we do a forcible conversion regardless of type, to check if
4892 ForceConversion returns a null.
4894 (Binary::error19): Use location to report error.
4896 (Unary::error23): Use location here too.
4898 * ../errors/cs0019.cs : Check in.
4900 * ../errors/cs0023.cs : Check in.
4902 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
4903 case of a non-null MethodInfo object with a length of 0 !
4905 (Binary::ResolveOperator): Flag error if overload resolution fails to find
4906 an applicable member - according to the spec :-)
4907 Also fix logic to find members in base types.
4909 (Unary::ResolveOperator): Same here.
4911 (Unary::report23): Change name to error23 and make first argument a TypeContainer
4912 as I was getting thoroughly confused between this and error19 :-)
4914 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
4915 (::FindMostEncompassedType): Implement.
4916 (::FindMostEncompassingType): Implement.
4917 (::StandardConversionExists): Implement.
4919 (UserImplicitCast): Re-vamp. We now need info about most specific
4920 source and target types so that we can do the necessary conversions.
4922 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
4923 mathematical union with no duplicates.
4925 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4927 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
4928 in order from base classes to child classes, so that we can in
4929 child classes look up in our parent for method names and
4930 attributes (required for handling abstract, virtual, new, override
4931 constructs: we need to instrospect our base class, and if we dont
4932 populate the classes in order, the introspection might be
4933 incorrect. For example, a method could query its parent before
4934 the parent has any methods and would determine that the parent has
4935 no abstract methods (while it could have had them)).
4937 (RootContext::CreateType): Record the order in which we define the
4940 2001-10-02 Miguel de Icaza <miguel@ximian.com>
4942 * class.cs (TypeContainer::Populate): Also method definitions can
4943 fail now, keep track of this.
4945 (TypeContainer::FindMembers): Implement support for
4946 DeclaredOnly/noDeclaredOnly flag.
4948 (Constructor::Emit) Return the ConstructorBuilder.
4950 (Method::Emit) Return the MethodBuilder.
4951 Check for abstract or virtual methods to be public.
4953 * rootcontext.cs (RootContext::CreateType): Register all the
4954 abstract methods required for the class to be complete and the
4955 interface methods that must be implemented.
4957 * cs-parser.jay: Report error 501 (method requires body if it is
4958 not marked abstract or extern).
4960 * expression.cs (TypeOf::Emit): Implement.
4962 * typemanager.cs: runtime_handle_type, new global type.
4964 * class.cs (Property::Emit): Generate code for properties.
4966 2001-10-02 Ravi Pratap <ravi@ximian.com>
4968 * expression.cs (Unary::ResolveOperator): Find operators on base type
4969 too - we now conform exactly to the spec.
4971 (Binary::ResolveOperator): Same here.
4973 * class.cs (Operator::Define): Fix minor quirk in the tests.
4975 * ../errors/cs0215.cs : Added.
4977 * ../errors/cs0556.cs : Added.
4979 * ../errors/cs0555.cs : Added.
4981 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4983 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
4984 single integer which is really efficient
4986 2001-10-01 Ravi Pratap <ravi@ximian.com>
4988 * expression.cs (Expression::ImplicitUserConversion): Use location
4989 even in the case when we are examining True operators.
4991 * class.cs (Operator::Define): Perform extensive checks to conform
4992 with the rules for operator overloading in the spec.
4994 * expression.cs (Expression::ImplicitReferenceConversion): Implement
4995 some of the other conversions mentioned in the spec.
4997 * typemanager.cs (array_type): New static member for the System.Array built-in
5000 (cloneable_interface): For System.ICloneable interface.
5002 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
5003 we start resolving the tree and populating types.
5005 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
5007 2001-10-01 Miguel de Icaza <miguel@ximian.com>
5009 * expression.cs (Expression::ExprClassFromMemberInfo,
5010 Expression::Literalize): Create literal expressions from
5011 FieldInfos which are literals.
5013 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
5014 type casts, because they were wrong. The test suite in tests
5017 (ImplicitNumericConversion): ushort to ulong requires a widening
5020 Int32 constant to long requires widening cast as well.
5022 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
5023 for integers because the type on the stack is not i4.
5025 2001-09-30 Miguel de Icaza <miguel@ximian.com>
5027 * expression.cs (report118): require location argument.
5029 * parameter.cs: Do not dereference potential null value.
5031 * class.cs: Catch methods that lack the `new' keyword when
5032 overriding a name. Report warnings when `new' is used without
5033 anything being there to override.
5035 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
5037 * class.cs: Only add constructor to hashtable if it is non-null
5038 (as now constructors can fail on define).
5040 (TypeManager, Class, Struct): Take location arguments.
5042 Catch field instance initialization in structs as errors.
5044 accepting_filter: a new filter for FindMembers that is static so
5045 that we dont create an instance per invocation.
5047 (Constructor::Define): Catch errors where a struct constructor is
5050 * cs-parser.jay: Pass location information for various new
5053 * delegate.cs (Delegate): take a location argument.
5055 * driver.cs: Do not call EmitCode if there were problesm in the
5056 Definition of the types, as many Builders wont be there.
5058 * decl.cs (Decl::Decl): Require a location argument.
5060 * cs-tokenizer.cs: Handle properly hex constants that can not fit
5061 into integers, and find the most appropiate integer for it.
5063 * literal.cs: Implement ULongLiteral.
5065 * rootcontext.cs: Provide better information about the location of
5066 failure when CreateType fails.
5068 2001-09-29 Miguel de Icaza <miguel@ximian.com>
5070 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
5073 * expression.cs (Binary::CheckShiftArguments): Add missing type
5075 (Binary::ResolveOperator): Add type to the logical and and logical
5076 or, Bitwise And/Or and Exclusive Or code paths, it was missing
5079 (Binary::DoNumericPromotions): In the case where either argument
5080 is ulong (and most signed types combined with ulong cause an
5081 error) perform implicit integer constant conversions as well.
5083 2001-09-28 Miguel de Icaza <miguel@ximian.com>
5085 * expression.cs (UserImplicitCast): Method should always be
5087 (Invocation::BetterConversion): Simplified test for IntLiteral.
5089 (Expression::ImplicitNumericConversion): Split this routine out.
5090 Put the code that performs implicit constant integer conversions
5093 (Expression::Resolve): Become a wrapper around DoResolve so we can
5094 check eclass and type being set after resolve.
5096 (Invocation::Badness): Remove this dead function
5098 (Binary::ResolveOperator): Do not compute the expensive argumnets
5099 unless we have a union for it.
5101 (Probe::Emit): Is needs to do an isinst and then
5102 compare against null.
5104 (::CanConvert): Added Location argument. If the Location argument
5105 is null (Location.Null), then we do not report errors. This is
5106 used by the `probe' mechanism of the Explicit conversion. We do
5107 not want to generate an error for something that the user
5108 explicitly requested to be casted. But the pipeline for an
5109 explicit cast first tests for potential implicit casts.
5111 So for now, if the Location is null, it means `Probe only' to
5112 avoid adding another argument. Might have to revise this
5115 (ClassCast): New class used to type cast objects into arbitrary
5116 classes (used in Explicit Reference Conversions).
5118 Implement `as' as well.
5120 Reverted all the patches from Ravi below: they were broken:
5122 * The use of `level' as a mechanism to stop recursive
5123 invocations is wrong. That was there just to catch the
5124 bug with a strack trace but not as a way of addressing
5127 To fix the problem we have to *understand* what is going
5128 on and the interactions and come up with a plan, not
5129 just get things going.
5131 * The use of the type conversion cache that I proposed
5132 last night had an open topic: How does this work across
5133 protection domains. A user defined conversion might not
5134 be public in the location where we are applying the
5135 conversion, a different conversion might be selected
5136 (ie, private A->B (better) but public B->A (worse),
5137 inside A, A->B applies, but outside it, B->A will
5140 * On top of that (ie, even if the above is solved),
5141 conversions in a cache need to be abstract. Ie, `To
5142 convert from an Int to a Short use an OpcodeCast', not
5143 `To convert from an Int to a Short use the OpcodeCast on
5144 the variable 5' (which is what this patch was doing).
5146 2001-09-28 Ravi Pratap <ravi@ximian.com>
5148 * expression.cs (Invocation::ConversionExists): Re-write to use
5149 the conversion cache
5151 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
5152 cache all conversions done, not just user-defined ones.
5154 (Invocation::BetterConversion): The real culprit. Use ConversionExists
5155 to determine if a conversion exists instead of acutually trying to
5156 perform the conversion. It's faster too.
5158 (Expression::ConvertExplicit): Modify to use ConversionExists to check
5159 and only then attempt the implicit conversion.
5161 2001-09-28 Ravi Pratap <ravi@ximian.com>
5163 * expression.cs (ConvertImplicit): Use a cache for conversions
5164 already found. Check level of recursion and bail out if necessary.
5166 2001-09-28 Miguel de Icaza <miguel@ximian.com>
5168 * typemanager.cs (string_concat_string_string, string_concat_object_object):
5169 Export standard methods that we expect for string operations.
5171 * statement.cs (Block::UsageWarning): Track usage of variables and
5172 report the errors for not used variables.
5174 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
5177 2001-09-27 Miguel de Icaza <miguel@ximian.com>
5179 * codegen.cs: remove unnneded code
5181 * expression.cs: Removed BuiltinTypeAccess class
5183 Fix the order in which implicit conversions are
5186 The previous fixed dropped support for boxed conversions (adding a
5187 test to the test suite now)
5189 (UserImplicitCast::CanConvert): Remove test for source being null,
5190 that code is broken. We should not feed a null to begin with, if
5191 we do, then we should track the bug where the problem originates
5192 and not try to cover it up here.
5194 Return a resolved expression of type UserImplicitCast on success
5195 rather than true/false. Ravi: this is what I was talking about,
5196 the pattern is to use a static method as a "constructor" for
5199 Also, do not create arguments until the very last minute,
5200 otherwise we always create the arguments even for lookups that
5201 will never be performed.
5203 (UserImplicitCast::Resolve): Eliminate, objects of type
5204 UserImplicitCast are born in a fully resolved state.
5206 * typemanager.cs (InitCoreTypes): Init also value_type
5209 * expression.cs (Cast::Resolve): First resolve the child expression.
5211 (LValue): Add new method AddressOf to be used by
5214 Change the argument of Store to take an EmitContext instead of an
5215 ILGenerator, because things like FieldExpr need to be able to call
5216 their children expression to generate the instance code.
5218 (Expression::Error, Expression::Warning): Sugar functions for
5221 (Expression::MemberLookup): Accept a TypeContainer instead of a
5222 Report as the first argument.
5224 (Expression::ResolvePrimary): Killed. I still want to improve
5225 this as currently the code is just not right.
5227 (Expression::ResolveMemberAccess): Simplify, but it is still
5230 (Unary::Resolve): Catch errors in AddressOf operators.
5232 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
5233 index to a byte for the short-version, or the compiler will choose
5234 the wrong Emit call, which generates the wrong data.
5236 (ParameterReference::Emit, ::Store): same.
5238 (FieldExpr::AddressOf): Implement.
5240 * typemanager.cs: TypeManager: made public variable instead of
5243 * driver.cs: document --fatal.
5245 * report.cs (ErrorMessage, WarningMessage): new names for the old
5246 Error and Warning classes.
5248 * cs-parser.jay (member_access): Turn built-in access to types
5249 into a normal simplename
5251 2001-09-27 Ravi Pratap <ravi@ximian.com>
5253 * expression.cs (Invocation::BetterConversion): Fix to cope
5254 with q being null, since this was introducing a bug.
5256 * expression.cs (ConvertImplicit): Do built-in conversions first.
5258 2001-09-27 Ravi Pratap <ravi@ximian.com>
5260 * expression.cs (UserImplicitCast::Resolve): Fix bug.
5262 2001-09-27 Ravi Pratap <ravi@ximian.com>
5264 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
5265 I had introduced long ago (what's new ?).
5267 * expression.cs (UserImplicitCast::CanConvert): Static method to do
5268 the work of all the checking.
5269 (ConvertImplicit): Call CanConvert and only then create object if necessary.
5270 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
5272 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
5273 that is the right way.
5275 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
5276 overloading resolution. Use everywhere instead of cutting and pasting code.
5278 (Binary::ResolveOperator): Use MakeUnionSet.
5280 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
5281 we have to convert to bool types. Not complete yet.
5283 2001-09-27 Miguel de Icaza <miguel@ximian.com>
5285 * typemanager.cs (TypeManager::CSharpName): support ushort.
5287 * expression.cs (Expression::TryImplicitIntConversion): Attempts
5288 to provide an expression that performsn an implicit constant int
5289 conversion (section 6.1.6).
5290 (Expression::ConvertImplicitRequired): Reworked to include
5291 implicit constant expression conversions.
5293 (Expression::ConvertNumericExplicit): Finished.
5295 (Invocation::Emit): If InstanceExpression is null, then it means
5296 that we perform a call on this.
5298 2001-09-26 Miguel de Icaza <miguel@ximian.com>
5300 * expression.cs (Unary::Emit): Remove some dead code.
5301 (Probe): Implement Resolve and Emit for `is'.
5302 (Expression::ConvertImplicitRequired): Attempt to do constant
5303 expression conversions here. Maybe should be moved to
5304 ConvertImplicit, but I am not sure.
5305 (Expression::ImplicitLongConstantConversionPossible,
5306 Expression::ImplicitIntConstantConversionPossible): New functions
5307 that tell whether is it possible to apply an implicit constant
5308 expression conversion.
5310 (ConvertNumericExplicit): Started work on explicit numeric
5313 * cs-parser.jay: Update operator constants.
5315 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
5316 (Parameters::GetSignature): Hook up VerifyArgs here.
5317 (Parameters::VerifyArgs): Verifies that no two arguments have the
5320 * class.cs (Operator): Update the operator names to reflect the
5321 ones that the spec expects (as we are just stringizing the
5324 * expression.cs (Unary::ResolveOperator): Fix bug: Use
5325 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
5326 previous usage did only work for our methods.
5327 (Expression::ConvertImplicit): Handle decimal implicit numeric
5328 conversions as well.
5329 (Expression::InternalTypeConstructor): Used to invoke constructors
5330 on internal types for default promotions.
5332 (Unary::Emit): Implement special handling for the pre/post
5333 increment/decrement for overloaded operators, as they need to have
5334 the same semantics as the other operators.
5336 (Binary::ResolveOperator): ditto.
5337 (Invocation::ConversionExists): ditto.
5338 (UserImplicitCast::Resolve): ditto.
5340 2001-09-26 Ravi Pratap <ravi@ximian.com>
5342 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
5343 operator, return after emitting body. Regression tests pass again !
5345 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
5346 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
5347 (Invocation::OverloadResolve): Ditto.
5348 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
5350 * everywhere : update calls to the above methods accordingly.
5352 2001-09-26 Miguel de Icaza <miguel@ximian.com>
5354 * assign.cs (Assign): Make it inherit from ExpressionStatement.
5356 * expression.cs (ExpressionStatement): New base class used for
5357 expressions that can appear in statements, so that we can provide
5358 an alternate path to generate expression that do not leave a value
5361 (Expression::Emit, and all the derivatives): We no longer return
5362 whether a value is left on the stack or not. Every expression
5363 after being emitted leaves a single value on the stack.
5365 * codegen.cs (EmitContext::EmitStatementExpression): Use the
5366 facilties of ExpressionStatement if possible.
5368 * cs-parser.jay: Update statement_expression.
5370 2001-09-25 Miguel de Icaza <miguel@ximian.com>
5372 * driver.cs: Change the wording of message
5374 2001-09-25 Ravi Pratap <ravi@ximian.com>
5376 * expression.cs (Binary::ResolveOperator): Had forgottten to set
5377 the type of the expression to the return type of the method if
5378 we have an overloaded operator match ! The regression tests pass again !
5379 (Unary::ResolveOperator): Ditto.
5381 * expression.cs (Invocation::ConversionExists): Correct the member lookup
5382 to find "op_Implicit", not "implicit" ;-)
5383 (UserImplicitCast): New class to take care of user-defined implicit conversions.
5384 (ConvertImplicit, ForceConversion): Take TypeContainer argument
5386 * everywhere : Correct calls to the above accordingly.
5388 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
5389 (ConvertImplicit): Do user-defined conversion if it exists.
5391 2001-09-24 Miguel de Icaza <miguel@ximian.com>
5393 * assign.cs: track location.
5394 (Resolve): Use implicit conversions on assignment.
5396 * literal.cs: Oops. Not good, Emit of short access values should
5397 pass (Bytes) or the wrong argument will be selected.
5399 * expression.cs (Unary::Emit): Emit code for -expr.
5401 (Unary::ResolveOperator): Handle `Substract' for non-constants
5402 (substract from zero from the non-constants).
5403 Deal with Doubles as well.
5405 (Expression::ConvertImplicitRequired): New routine that reports an
5406 error if no implicit conversion exists.
5408 (Invocation::OverloadResolve): Store the converted implicit
5409 expressions if we make them
5411 2001-09-24 Ravi Pratap <ravi@ximian.com>
5413 * class.cs (ConstructorInitializer): Take a Location argument.
5414 (ConstructorBaseInitializer): Same here.
5415 (ConstructorThisInitializer): Same here.
5417 * cs-parser.jay : Update all calls accordingly.
5419 * expression.cs (Unary, Binary, New): Take location argument.
5420 Update accordingly everywhere.
5422 * cs-parser.jay : Update all calls to the above to take a location
5427 2001-09-24 Ravi Pratap <ravi@ximian.com>
5429 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
5430 (Invocation::BetterConversion): Same here
5431 (Invocation::ConversionExists): Ditto.
5433 (Invocation::ConversionExists): Implement.
5435 2001-09-22 Ravi Pratap <ravi@ximian.com>
5437 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
5438 Also take an additional TypeContainer argument.
5440 * All over : Pass in TypeContainer as argument to OverloadResolve.
5442 * typemanager.cs (CSharpName): Update to check for the string type and return
5445 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
5448 2001-09-21 Ravi Pratap <ravi@ximian.com>
5450 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
5451 (Invocation::BetterFunction): Implement.
5452 (Invocation::BetterConversion): Implement.
5453 (Invocation::ConversionExists): Skeleton, no implementation yet.
5455 Okay, things work fine !
5457 2001-09-21 Miguel de Icaza <miguel@ximian.com>
5459 * typemanager.cs: declare and load enum_type, delegate_type and
5462 * expression.cs (Expression::Emit): Now emit returns a value that
5463 tells whether a value is left on the stack or not. This strategy
5464 might be reveted tomorrow with a mechanism that would address
5465 multiple assignments.
5466 (Expression::report118): Utility routine to report mismatches on
5469 (Unary::Report23): Report impossible type/operator combination
5472 (Unary::IsIncrementableNumber): Whether the type can be
5473 incremented or decremented with add.
5474 (Unary::ResolveOperator): Also allow enumerations to be bitwise
5476 (Unary::ResolveOperator): Implement ++, !, ~,
5478 (Invocation::Emit): Deal with new Emit convetion.
5480 * All Expression derivatives: Updated their Emit method to return
5481 whether they leave values on the stack or not.
5483 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
5484 stack for expressions that are statements.
5486 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5488 * expression.cs (LValue): New interface. Must be implemented by
5490 (LocalVariableReference, ParameterReference, FieldExpr): Implement
5493 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
5494 interface for generating code, simplifies the code.
5496 2001-09-20 Ravi Pratap <ravi@ximian.com>
5498 * expression.cs (everywhere): Comment out return statements in ::Resolve
5499 methods to avoid the warnings.
5501 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5503 * driver.cs (parse): Report error 2001 if we can not open the
5506 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
5509 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
5512 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
5513 otherwise nested blocks end up with the same index.
5515 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
5517 * expression.cs: Instead of having FIXMEs in the Resolve
5518 functions, throw exceptions so it is obvious that we are facing a
5521 * cs-parser.jay (invocation_expression): Pass Location information.
5523 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
5524 Use a basename for those routines because .NET does not like paths
5527 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
5530 2001-09-19 Miguel de Icaza <miguel@ximian.com>
5532 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
5533 are loading the correct data types (throws an exception if not).
5534 (TypeManager::InitCoreTypes): Use CoreLookupType
5536 * expression.cs (Unary::ResolveOperator): return the child
5537 expression for expressions which are just +expr.
5538 (Unary::ResolveOperator): Return negative literals for -LITERAL
5539 expressions (otherwise they are Unary {Literal}).
5540 (Invocation::Badness): Take into account `Implicit constant
5541 expression conversions'.
5543 * literal.cs (LongLiteral): Implement long literal class.
5544 (IntLiteral): export the `Value' of the intliteral.
5546 2001-09-19 Ravi Pratap <ravi@ximian.com>
5548 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
5550 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
5551 instead of 'Operator'
5553 * expression.cs (Binary::ResolveOperator): Update accordingly.
5554 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
5557 * cs-parser.jay (unary_expression): Update to use the new names.
5559 * gen-treedump.cs (GetUnary): Same here.
5561 * expression.cs (Unary::Resolve): Implement.
5562 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
5563 operators are found instead of making noise ;-)
5564 (Unary::ResolveOperator): New method to do precisely the same thing which
5565 Binary::ResolveOperator does for Binary expressions.
5566 (Unary.method, .Arguments): Add.
5567 (Unary::OperName): Implement.
5568 (Unary::ForceConversion): Copy and Paste !
5570 * class.cs (Operator::Define): Fix a small bug for the case when we have
5573 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
5574 for the inbuilt operators. Only overloading works for now ;-)
5576 2001-09-18 Miguel de Icaza <miguel@ximian.com>
5578 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
5579 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
5581 * expression.cs (This::Emit): Implement.
5582 (This::Resolve): Implement.
5583 (TypeOf:Resolve): Implement.
5584 (Expression::ResolveSimpleName): Add an implicit this to instance
5586 (MemberAccess::Resolve): Deal with Parameters and Fields.
5587 Bind instance variable to Field expressions.
5588 (FieldExpr::Instance): New field used to track the expression that
5589 represents the object instance.
5590 (FieldExpr::Resolve): Track potential errors from MemberLookup not
5592 (FieldExpr::Emit): Implement.
5594 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
5595 the last instruction contains a return opcode to avoid generating
5596 the last `ret' instruction (this generates correct code, and it is
5597 nice to pass the peverify output).
5599 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
5600 initializer for static and instance variables.
5601 (Constructor::Emit): Allow initializer to be null in the case of
5602 static constructors. Only emit initializer for instance
5605 (TypeContainer::FindMembers): Return a null array if there are no
5608 Also fix the code for the MemberTypes.Method branch, as it was not
5609 scanning that for operators (or tried to access null variables before).
5611 * assign.cs (Assign::Emit): Handle instance and static fields.
5615 * driver.cs: Stop compilation if there are parse errors.
5617 * cs-parser.jay (constructor_declaration): Provide default base
5618 initializer for non-static constructors.
5619 (constructor_declarator): Do not provide a default base
5620 initializers if none was specified.
5621 Catch the fact that constructors should not have parameters.
5623 * class.cs: Do not emit parent class initializers for static
5624 constructors, that should be flagged as an error.
5626 2001-09-18 Ravi Pratap <ravi@ximian.com>
5628 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
5629 Move back code into TypeContainer::Populate.
5631 2001-09-18 Ravi Pratap <ravi@ximian.com>
5633 * class.cs (TypeContainer::AddConstructor): Fix the check to
5634 compare against Name, not Basename.
5635 (Operator::OpType): Change Plus and Minus to Add and Subtract.
5637 * cs-parser.jay : Update accordingly.
5639 * class.cs (TypeContainer::FindMembers): For the case where we are searching
5640 for methods, don't forget to look into the operators too.
5641 (RegisterMethodBuilder): Helper method to take care of this for
5642 methods, constructors and operators.
5643 (Operator::Define): Completely revamp.
5644 (Operator.OperatorMethod, MethodName): New fields.
5645 (TypeContainer::Populate): Move the registering of builders into
5646 RegisterMethodBuilder.
5647 (Operator::Emit): Re-write.
5649 * expression.cs (Binary::Emit): Comment out code path to emit method
5650 invocation stuff for the case when we have a user defined operator. I am
5651 just not able to get it right !
5653 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5655 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
5658 (Expression::MemberLookup): Provide a version that allows to
5659 specify the MemberTypes and BindingFlags.
5661 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
5662 so it was not fetching variable information from outer blocks.
5664 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
5665 Beforefieldinit as it was buggy.
5667 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
5670 * class.cs (Constructor::Emit): Only emit if block is not null.
5671 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
5672 deal with this by semantically definining it as if the user had
5675 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
5676 constructors as we now "emit" them at a higher level.
5678 (TypeContainer::DefineDefaultConstructor): Used to define the
5679 default constructors if none was provided.
5681 (ConstructorInitializer): Add methods Resolve and Emit.
5683 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
5685 2001-09-17 Ravi Pratap <ravi@ximian.com>
5687 * class.cs (TypeContainer::EmitDefaultConstructor): Register
5688 the default constructor builder with our hashtable for methodbuilders
5691 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
5692 and argument_count is 0 in which case we have a match.
5693 (Binary::ResolveOperator): More null checking and miscellaneous coding
5696 2001-09-17 Ravi Pratap <ravi@ximian.com>
5698 * rootcontext.cs (IsNameSpace): Compare against null.
5700 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
5702 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
5703 and Unary::Operator.
5705 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
5708 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
5709 we have overloaded operators.
5710 (Binary::ResolveOperator): Implement the part which does the operator overload
5713 * class.cs (Operator::Emit): Implement.
5714 (TypeContainer::Emit): Emit the operators we have too.
5716 * expression.cs (Binary::Emit): Update to emit the appropriate code for
5717 the case when we have a user-defined operator.
5719 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5721 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
5723 2001-09-16 Ravi Pratap <ravi@ximian.com>
5725 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
5726 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
5727 (Constructor::Emit): Implement.
5728 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
5729 if we have no work to do.
5730 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
5733 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
5734 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
5736 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
5739 2001-09-15 Ravi Pratap <ravi@ximian.com>
5741 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
5743 (Tree::RecordNamespace): Method to do what the name says ;-)
5744 (Tree::Namespaces): Property to get at the namespaces hashtable.
5746 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
5749 * rootcontext.cs (IsNamespace): Fixed it :-)
5751 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5753 * class.cs (TypeContainer::FindMembers): Add support for
5755 (MethodCore): New class that encapsulates both the shared aspects
5756 of a Constructor and a Method.
5757 (Method, Constructor): Factored pieces into MethodCore.
5759 * driver.cs: Added --fatal which makes errors throw exceptions.
5760 Load System assembly as well as part of the standard library.
5762 * report.cs: Allow throwing exceptions on errors for debugging.
5764 * modifiers.cs: Do not use `parent', instead use the real type
5765 container to evaluate permission settings.
5767 * class.cs: Put Ravi's patch back in. He is right, and we will
5768 have to cope with the
5770 2001-09-14 Ravi Pratap <ravi@ximian.com>
5772 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
5773 FamORAssem, not FamANDAssem.
5775 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5777 * driver.cs: Added --parse option that only parses its input files
5780 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
5781 incorrect. IsTopLevel is not used to tell whether an object is
5782 root_types or not (that can be achieved by testing this ==
5783 root_types). But to see if this is a top-level *class* (not
5784 necessarly our "toplevel" container).
5786 2001-09-14 Ravi Pratap <ravi@ximian.com>
5788 * enum.cs (Enum::Define): Modify to call the Lookup method on the
5789 parent instead of a direct call to GetType.
5791 2001-09-14 Ravi Pratap <ravi@ximian.com>
5793 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
5794 Modifiers.TypeAttr. This should just be a call to that method.
5796 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
5797 object so that we can determine if we are top-level or not.
5799 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
5802 * enum.cs (Enum::Define): Ditto.
5804 * modifiers.cs (FieldAttr): Re-write.
5806 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
5807 (TypeContainer::HaveStaticConstructor): New property to provide access
5808 to precisely that info.
5810 * modifiers.cs (MethodAttr): Re-write.
5811 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
5813 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
5814 of top-level types as claimed.
5816 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5818 * expression.cs (MemberLookup): Fruitless attempt to lookup
5819 constructors. Maybe I need to emit default constructors? That
5820 might be it (currently .NET emits this for me automatically).
5821 (Invocation::OverloadResolve): Cope with Arguments == null.
5822 (Invocation::EmitArguments): new function, shared by the new
5824 (Invocation::Emit): Handle static and instance methods. Emit
5825 proper call instruction for virtual or non-virtual invocations.
5826 (New::Emit): Implement.
5827 (New::Resolve): Implement.
5828 (MemberAccess:Resolve): Implement.
5829 (MethodGroupExpr::InstanceExpression): used conforming to the spec
5831 (FieldExpr::Resolve): Set type.
5833 * support.cs: Handle empty arguments.
5835 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
5836 SimpleLookup): Auxiliary routines to help parse a qualifier
5839 Update qualifier_identifier rule.
5841 * codegen.cs: Removed debugging messages.
5843 * class.cs: Make this a global thing, this acts just as a "key" to
5844 objects that we might have around.
5846 (Populate): Only initialize method_builders_to_methods once.
5848 * expression.cs (PropertyExpr): Initialize type from the
5851 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
5852 Resolve pattern. Attempt to implicitly convert value to boolean.
5855 * expression.cs: Set the type for the int32/int32 argument case.
5856 (Binary::ResolveOperator): Set the return type to boolean for
5857 comparission operators
5859 * typemanager.cs: Remove debugging print code.
5861 (Invocation::Resolve): resolve type.
5863 * class.cs: Allocate a MemberInfo of the correct size, as the code
5864 elsewhere depends on the test to reflect the correct contents.
5866 (Method::) Keep track of parameters, due to System.Reflection holes
5868 (TypeContainer::Populate): Keep track of MethodBuilders to Method
5871 (TypeContainer::FindMembers): Use ArrayList and then copy an array
5872 of the exact size and return that.
5874 (Class::LookupMethodByBuilder): New function that maps
5875 MethodBuilders to its methods. Required to locate the information
5876 on methods because System.Reflection bit us again.
5878 * support.cs: New file, contains an interface ParameterData and
5879 two implementations: ReflectionParameters and InternalParameters
5880 used to access Parameter information. We will need to grow this
5883 * expression.cs (Invocation::GetParameterData): implement a cache
5884 and a wrapper around the ParameterData creation for methods.
5885 (Invocation::OverloadResolve): Use new code.
5887 2001-09-13 Ravi Pratap <ravi@ximian.com>
5889 * class.cs (TypeContainer::EmitField): Remove and move into
5890 (Field::Define): here and modify accordingly.
5891 (Field.FieldBuilder): New member.
5892 (TypeContainer::Populate): Update accordingly.
5893 (TypeContainer::FindMembers): Implement.
5895 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5897 * statement.cs: (VariableInfo::VariableType): New field to be
5898 initialized with the full type once it is resolved.
5900 2001-09-12 Miguel de Icaza <miguel@ximian.com>
5902 * parameter.cs (GetParameterInfo): Use a type cache to compute
5903 things only once, and to reuse this information
5905 * expression.cs (LocalVariableReference::Emit): Implement.
5906 (OpcodeCast::Emit): fix.
5908 (ParameterReference::Resolve): Implement.
5909 (ParameterReference::Emit): Implement.
5911 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
5912 that are expressions need to stay as Expressions.
5914 * typemanager.cs (CSharpName): Returns the C# name of a type if
5917 * expression.cs (Expression::ConvertImplicit): New function that
5918 implements implicit type conversions.
5920 (Expression::ImplicitReferenceConversion): Implements implicit
5921 reference conversions.
5923 (EmptyCast): New type for transparent casts.
5925 (OpcodeCast): New type for casts of types that are performed with
5926 a sequence of bytecodes.
5928 (BoxedCast): New type used for casting value types into reference
5929 types. Emits a box opcode.
5931 (Binary::DoNumericPromotions): Implements numeric promotions of
5932 and computation of the Binary::Type.
5934 (Binary::EmitBranchable): Optimization.
5936 (Binary::Emit): Implement code emission for expressions.
5938 * typemanager.cs (TypeManager): Added two new core types: sbyte
5941 2001-09-12 Ravi Pratap <ravi@ximian.com>
5943 * class.cs (TypeContainer::FindMembers): Method which does exactly
5944 what Type.FindMembers does, only we don't have to use reflection. No
5947 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
5948 typecontainer objects as we need to get at them.
5949 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
5951 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
5952 typecontainer object.
5954 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
5955 of just a Report object.
5957 2001-09-11 Ravi Pratap <ravi@ximian.com>
5959 * class.cs (Event::Define): Go back to using the prefixes "add_" and
5961 (TypeContainer::Populate): Now define the delegates of the type too.
5962 (TypeContainer.Delegates): Property to access the list of delegates defined
5965 * delegates.cs (Delegate::Define): Implement partially.
5967 * modifiers.cs (TypeAttr): Handle more flags.
5969 2001-09-11 Ravi Pratap <ravi@ximian.com>
5971 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
5973 (Operator::Define): Re-write logic to get types by using the LookupType method
5974 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
5975 (Indexer::Define): Ditto.
5976 (Event::Define): Ditto.
5977 (Property::Define): Ditto.
5979 2001-09-10 Ravi Pratap <ravi@ximian.com>
5981 * class.cs (TypeContainer::Populate): Now define operators too.
5982 (TypeContainer.Operators): New property to access the list of operators
5984 (Operator.OperatorMethodBuilder): New member to hold the method builder
5985 for the operator we are defining.
5986 (Operator::Define): Implement.
5988 2001-09-10 Ravi Pratap <ravi@ximian.com>
5990 * class.cs (Event::Define): Make the prefixes of the accessor methods
5991 addOn_ and removeOn_
5993 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
5994 of the location being passed in too. Ideally, this should go later since all
5995 error reporting should be done through the Report object.
5997 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
5998 (Populate): Iterate thru the indexers we have and define them too.
5999 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
6000 for the get and set accessors.
6001 (Indexer::Define): Implement.
6003 2001-09-09 Miguel de Icaza <miguel@ximian.com>
6005 * expression.cs (Binary::Resolve): Beginning of it. I scratched
6006 my previous implementation, did not work.
6008 * typemanager.cs: Add a couple of missing types (the longs).
6010 * literal.cs: Use TypeManager.bool_type instead of getting it.
6012 * expression.cs (EventExpr): New kind of expressions.
6013 (Expressio::ExprClassFromMemberInfo): finish
6015 2001-09-08 Miguel de Icaza <miguel@ximian.com>
6017 * assign.cs: Emit stores to static fields differently.
6019 2001-09-08 Ravi Pratap <ravi@ximian.com>
6021 * Merge in changes and adjust code to tackle conflicts. Backed out my
6022 code in Assign::Resolve ;-)
6024 2001-09-08 Ravi Pratap <ravi@ximian.com>
6026 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
6027 instead Report.Error and also pass in the location.
6028 (CSharpParser::Lexer): New readonly property to return the reference
6029 to the Tokenizer object.
6030 (declare_local_variables): Use Report.Error with location instead of plain
6034 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
6035 (Operator.CheckBinaryOperator): Ditto.
6037 * cs-parser.jay (operator_declarator): Update accordingly.
6039 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
6040 (CheckBinaryOperator): Same here.
6042 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
6043 on the name without any prefixes of namespace names etc. This is because we
6044 already might have something already fully qualified like
6045 'System.Console.WriteLine'
6047 * assign.cs (Resolve): Begin implementation. Stuck ;-)
6049 2001-09-07 Ravi Pratap <ravi@ximian.com>
6051 * cs-tokenizer.cs (location): Return a string which also contains
6054 * expression.cs (ElementAccess): New class for expressions of the
6055 type 'element access.'
6056 (BaseAccess): New class for expressions of the type 'base access.'
6057 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
6060 * cs-parser.jay (element_access): Implement action.
6061 (base_access): Implement actions.
6062 (checked_expression, unchecked_expression): Implement.
6064 * cs-parser.jay (local_variable_type): Correct and implement.
6065 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
6067 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
6069 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
6070 name and the specifiers.
6072 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
6074 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
6075 making them all public ;-)
6077 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
6080 2001-09-07 Miguel de Icaza <miguel@ximian.com>
6082 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
6084 (FieldExpr, PropertyExprs): New resolved expressions.
6085 (SimpleName::MemberStaticCheck): Perform static checks for access
6086 to non-static fields on static methods. Maybe this should be
6087 generalized for MemberAccesses.
6088 (SimpleName::ResolveSimpleName): More work on simple name
6091 * cs-parser.jay (primary_expression/qualified_identifier): track
6092 the parameter index.
6094 * codegen.cs (CodeGen::Save): Catch save exception, report error.
6095 (EmitContext::EmitBoolExpression): Chain to expression generation
6096 instead of temporary hack.
6097 (::EmitStatementExpression): Put generic expression code generation.
6099 * assign.cs (Assign::Emit): Implement variable assignments to
6100 local variables, parameters and fields.
6102 2001-09-06 Miguel de Icaza <miguel@ximian.com>
6104 * statement.cs (Block::GetVariableInfo): New method, returns the
6105 VariableInfo for a variable name in a block.
6106 (Block::GetVariableType): Implement in terms of GetVariableInfo
6108 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
6109 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
6111 2001-09-06 Ravi Pratap <ravi@ximian.com>
6113 * cs-parser.jay (operator_declaration): Continue on my quest : update
6114 to take attributes argument.
6115 (event_declaration): Ditto.
6116 (enum_declaration): Ditto.
6117 (indexer_declaration): Ditto.
6119 * class.cs (Operator::Operator): Update constructor accordingly.
6120 (Event::Event): Ditto.
6122 * delegate.cs (Delegate::Delegate): Same here.
6124 * enum.cs (Enum::Enum): Same here.
6126 2001-09-05 Ravi Pratap <ravi@ximian.com>
6128 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
6130 * ../tests/cs0658.cs : New file to demonstrate error 0658.
6132 * attribute.cs (Attributes): New class to encapsulate all attributes which were
6133 being passed around as an arraylist.
6134 (Attributes::AddAttribute): Method to add attribute sections.
6136 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
6137 (struct_declaration): Update accordingly.
6138 (constant_declaration): Update.
6139 (field_declaration): Update.
6140 (method_header): Update.
6141 (fixed_parameter): Update.
6142 (parameter_array): Ditto.
6143 (property_declaration): Ditto.
6144 (destructor_declaration): Ditto.
6146 * class.cs (Struct::Struct): Update constructors accordingly.
6147 (Class::Class): Ditto.
6148 (Field::Field): Ditto.
6149 (Method::Method): Ditto.
6150 (Property::Property): Ditto.
6151 (TypeContainer::OptAttribute): update property's return type.
6153 * interface.cs (Interface.opt_attributes): New member.
6154 (Interface::Interface): Update to take the extra Attributes argument.
6156 * parameter.cs (Parameter::Parameter): Ditto.
6158 * constant.cs (Constant::Constant): Ditto.
6160 * interface.cs (InterfaceMemberBase): New OptAttributes field.
6161 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
6162 the attributes as a parameter.
6163 (InterfaceProperty): Update constructor call.
6164 (InterfaceEvent): Ditto.
6165 (InterfaceMethod): Ditto.
6166 (InterfaceIndexer): Ditto.
6168 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
6169 pass the attributes too.
6170 (interface_event_declaration): Ditto.
6171 (interface_property_declaration): Ditto.
6172 (interface_method_declaration): Ditto.
6173 (interface_declaration): Ditto.
6175 2001-09-05 Miguel de Icaza <miguel@ximian.com>
6177 * class.cs (Method::Define): Track the "static Main" definition to
6178 create an entry point.
6180 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
6181 EntryPoint if we find it.
6183 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
6184 (EmitContext::ig): Make this variable public.
6186 * driver.cs: Make the default output file be the first file name
6187 with the .exe extension.
6189 Detect empty compilations
6191 Handle various kinds of output targets. Handle --target and
6192 rename -t to --dumper.
6194 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
6195 methods inherited from Expression return now an Expression. This
6196 will is used during the tree rewriting as we resolve them during
6199 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
6200 the spec. Missing entirely is the information about
6201 accessability of elements of it.
6203 (Expression::ExprClassFromMemberInfo): New constructor for
6204 Expressions that creates a fully initialized Expression based on
6205 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
6208 (Invocation::Resolve): Begin implementing resolution of invocations.
6210 * literal.cs (StringLiteral): Implement Emit.
6212 2001-09-05 Ravi Pratap <ravi@ximian.com>
6214 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
6217 2001-09-04 Ravi Pratap <ravi@ximian.com>
6219 * cs-parser.jay (attribute_arguments): Implement actions.
6220 (attribute): Fix bug in production. Implement action.
6221 (attribute_list): Implement.
6222 (attribute_target): Implement.
6223 (attribute_target_specifier, opt_target_specifier): Implement
6224 (CheckAttributeTarget): New method to check if the attribute target
6226 (attribute_section): Implement.
6227 (opt_attributes): Implement.
6229 * attribute.cs : New file to handle attributes.
6230 (Attribute): Class to hold attribute info.
6232 * cs-parser.jay (opt_attribute_target_specifier): Remove production
6233 (attribute_section): Modify production to use 2 different rules to
6234 achieve the same thing. 1 s/r conflict down !
6235 Clean out commented, useless, non-reducing dimension_separator rules.
6237 * class.cs (TypeContainer.attributes): New member to hold list
6238 of attributes for a type.
6239 (Struct::Struct): Modify to take one more argument, the attribute list.
6240 (Class::Class): Ditto.
6241 (Field::Field): Ditto.
6242 (Method::Method): Ditto.
6243 (Property::Property): Ditto.
6245 * cs-parser.jay (struct_declaration): Update constructor call to
6246 pass in the attributes too.
6247 (class_declaration): Ditto.
6248 (constant_declaration): Ditto.
6249 (field_declaration): Ditto.
6250 (method_header): Ditto.
6251 (fixed_parameter): Ditto.
6252 (parameter_array): Ditto.
6253 (property_declaration): Ditto.
6255 * constant.cs (Constant::Constant): Update constructor similarly.
6256 Use System.Collections.
6258 * parameter.cs (Parameter::Parameter): Update as above.
6260 2001-09-02 Ravi Pratap <ravi@ximian.com>
6262 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
6263 (TypeContainer.delegates): New member to hold list of delegates.
6265 * cs-parser.jay (delegate_declaration): Implement the action correctly
6266 this time as I seem to be on crack ;-)
6268 2001-09-02 Miguel de Icaza <miguel@ximian.com>
6270 * rootcontext.cs (RootContext::IsNamespace): new function, used to
6271 tell whether an identifier represents a namespace.
6273 * expression.cs (NamespaceExpr): A namespace expression, used only
6274 temporarly during expression resolution.
6275 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
6276 utility functions to resolve names on expressions.
6278 2001-09-01 Miguel de Icaza <miguel@ximian.com>
6280 * codegen.cs: Add hook for StatementExpressions.
6282 * class.cs: Fix inverted test for static flag in methods.
6284 2001-09-02 Ravi Pratap <ravi@ximian.com>
6286 * class.cs (Operator::CheckUnaryOperator): Correct error number used
6287 to make it coincide with MS' number.
6288 (Operator::CheckBinaryOperator): Ditto.
6290 * ../errors/errors.txt : Remove error numbers added earlier.
6292 * ../errors/cs1019.cs : Test case for error # 1019
6294 * ../errros/cs1020.cs : Test case for error # 1020
6296 * cs-parser.jay : Clean out commented cruft.
6297 (dimension_separators, dimension_separator): Comment out. Ostensibly not
6298 used anywhere - non-reducing rule.
6299 (namespace_declarations): Non-reducing rule - comment out.
6301 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
6302 with TypeContainer::AddEnum.
6304 * delegate.cs : New file for delegate handling classes.
6305 (Delegate): Class for declaring delegates.
6307 * makefile : Update.
6309 * cs-parser.jay (delegate_declaration): Implement.
6311 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
6313 * class.cs (Event::Define): Implement.
6314 (Event.EventBuilder): New member.
6316 * class.cs (TypeContainer::Populate): Update to define all enums and events
6318 (Events): New property for the events arraylist we hold. Shouldn't we move to using
6319 readonly fields for all these cases ?
6321 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
6323 * class.cs (Property): Revamp to use the convention of making fields readonly.
6324 Accordingly modify code elsewhere.
6326 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
6327 the Define method of the Property class.
6329 * class.cs : Clean up applied patch and update references to variables etc. Fix
6331 (TypeContainer::Populate): Update to define all the properties we have. Also
6332 define all enumerations.
6334 * enum.cs (Define): Implement.
6336 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
6338 * cs-parser.jay (overloadable_operator): The semantic value is an
6339 enum of the Operator class.
6340 (operator_declarator): Implement actions.
6341 (operator_declaration): Implement.
6343 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
6344 validity of definitions.
6345 (Operator::CheckBinaryOperator): Static method to check for binary operators
6346 (TypeContainer::AddOperator): New method to add an operator to a type.
6348 * cs-parser.jay (indexer_declaration): Added line to actually call the
6349 AddIndexer method so it gets added ;-)
6351 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
6352 already taken care of by the MS compiler ?
6354 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
6356 * class.cs (Operator): New class for operator declarations.
6357 (Operator::OpType): Enum for the various operators.
6359 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
6361 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
6362 ostensibly handle this in semantic analysis.
6364 * cs-parser.jay (general_catch_clause): Comment out
6365 (specific_catch_clauses, specific_catch_clause): Ditto.
6366 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
6367 (catch_args, opt_catch_args): New productions.
6368 (catch_clause): Rewrite to use the new productions above
6369 (catch_clauses): Modify accordingly.
6370 (opt_catch_clauses): New production to use in try_statement
6371 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
6372 and re-write the code in the actions to extract the specific and
6373 general catch clauses by being a little smart ;-)
6375 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
6376 Hooray, try and catch statements parse fine !
6378 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6380 * statement.cs (Block::GetVariableType): Fix logic to extract the type
6381 string from the hashtable of variables.
6383 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
6384 I end up making that mistake ;-)
6385 (catch_clauses): Fixed gross error which made Key and Value of the
6386 DictionaryEntry the same : $1 !!
6388 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6390 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
6392 * cs-parser.jay (event_declaration): Correct to remove the semicolon
6393 when the add and remove accessors are specified.
6395 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6397 * cs-parser.jay (IndexerDeclaration): New helper class to hold
6398 information about indexer_declarator.
6399 (indexer_declarator): Implement actions.
6400 (parsing_indexer): New local boolean used to keep track of whether
6401 we are parsing indexers or properties. This is necessary because
6402 implicit_parameters come into picture even for the get accessor in the
6404 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
6406 * class.cs (Indexer): New class for indexer declarations.
6407 (TypeContainer::AddIndexer): New method to add an indexer to a type.
6408 (TypeContainer::indexers): New member to hold list of indexers for the
6411 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6413 * cs-parser.jay (add_accessor_declaration): Implement action.
6414 (remove_accessor_declaration): Implement action.
6415 (event_accessors_declaration): Implement
6416 (variable_declarators): swap statements for first rule - trivial.
6418 * class.cs (Event): New class to hold information about event
6420 (TypeContainer::AddEvent): New method to add an event to a type
6421 (TypeContainer::events): New member to hold list of events.
6423 * cs-parser.jay (event_declaration): Implement actions.
6425 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6427 * cs-parser.jay (dim_separators): Implement. Make it a string
6428 concatenating all the commas together, just as they appear.
6429 (opt_dim_separators): Modify accordingly
6430 (rank_specifiers): Update accordingly. Basically do the same
6431 thing - instead, collect the brackets here.
6432 (opt_rank_sepcifiers): Modify accordingly.
6433 (array_type): Modify to actually return the complete type string
6434 instead of ignoring the rank_specifiers.
6435 (expression_list): Implement to collect the expressions
6436 (variable_initializer): Implement. We make it a list of expressions
6437 essentially so that we can handle the array_initializer case neatly too.
6438 (variable_initializer_list): Implement.
6439 (array_initializer): Make it a list of variable_initializers
6440 (opt_array_initializer): Modify accordingly.
6442 * expression.cs (New::NType): Add enumeration to help us
6443 keep track of whether we have an object/delegate creation
6444 or an array creation.
6445 (New:NewType, New::Rank, New::Indices, New::Initializers): New
6446 members to hold data about array creation.
6447 (New:New): Modify to update NewType
6448 (New:New): New Overloaded contructor for the array creation
6451 * cs-parser.jay (array_creation_expression): Implement to call
6452 the overloaded New constructor.
6454 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
6456 * class.cs (TypeContainer::Constructors): Return member
6457 constructors instead of returning null.
6459 2001-08-26 Miguel de Icaza <miguel@ximian.com>
6461 * typemanager.cs (InitCoreTypes): Initialize the various core
6462 types after we have populated the type manager with the user
6463 defined types (this distinction will be important later while
6464 compiling corlib.dll)
6466 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
6467 on Expression Classification. Now all expressions have a method
6468 `Resolve' and a method `Emit'.
6470 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
6471 generation from working. Also add some temporary debugging
6474 2001-08-24 Miguel de Icaza <miguel@ximian.com>
6476 * codegen.cs: Lots of code generation pieces. This is only the
6477 beginning, will continue tomorrow with more touches of polish. We
6478 handle the fundamentals of if, while, do, for, return. Others are
6479 trickier and I need to start working on invocations soon.
6481 * gen-treedump.cs: Bug fix, use s.Increment here instead of
6484 * codegen.cs (EmitContext): New struct, used during code
6485 emission to keep a context. Most of the code generation will be
6488 * cs-parser.jay: Add embedded blocks to the list of statements of
6489 this block. So code generation proceeds in a top down fashion.
6491 2001-08-23 Miguel de Icaza <miguel@ximian.com>
6493 * statement.cs: Add support for multiple child blocks.
6495 2001-08-22 Miguel de Icaza <miguel@ximian.com>
6497 * codegen.cs (EmitCode): New function, will emit the code for a
6498 Block of code given a TypeContainer and its ILGenerator.
6500 * statement.cs (Block): Standard public readonly optimization.
6501 (Block::Block constructors): Link children.
6502 (Block::Child): Child Linker.
6503 (Block::EmitVariables): Emits IL variable declarations.
6505 * class.cs: Drop support for MethodGroups here, delay until
6507 (Method::): Applied the same simplification that I did before, and
6508 move from Properties to public readonly fields.
6509 (Method::ParameterTypes): Returns the parameter types for the
6510 function, and implements a cache that will be useful later when I
6511 do error checking and the semantic analysis on the methods is
6513 (Constructor::GetCallingConvention): Renamed from CallingConvetion
6514 and made a method, optional argument tells whether this is a class
6515 or a structure to apply the `has-this' bit.
6516 (Method::GetCallingConvention): Implement, returns the calling
6518 (Method::Define): Defines the type, a second pass is performed
6519 later to populate the methods.
6521 (Constructor::ParameterTypes): implement a cache similar to the
6522 one on Method::ParameterTypes, useful later when we do semantic
6525 (TypeContainer::EmitMethod): New method. Emits methods.
6527 * expression.cs: Removed MethodGroup class from here.
6529 * parameter.cs (Parameters::GetCallingConvention): new method.
6531 2001-08-21 Miguel de Icaza <miguel@ximian.com>
6533 * class.cs (TypeContainer::Populate): Drop RootContext from the
6536 (Constructor::CallingConvention): Returns the calling convention.
6537 (Constructor::ParameterTypes): Returns the constructor parameter
6540 (TypeContainer::AddConstructor): Keep track of default constructor
6541 and the default static constructor.
6543 (Constructor::) Another class that starts using `public readonly'
6544 instead of properties.
6546 (Constructor::IsDefault): Whether this is a default constructor.
6548 (Field::) use readonly public fields instead of properties also.
6550 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
6551 track of static constructors; If none is used, turn on
6552 BeforeFieldInit in the TypeAttributes.
6554 * cs-parser.jay (opt_argument_list): now the return can be null
6555 for the cases where there are no arguments.
6557 (constructor_declarator): If there is no implicit `base' or
6558 `this', then invoke the default parent constructor.
6560 * modifiers.cs (MethodAttr): New static function maps a set of
6561 modifiers flags into a MethodAttributes enum
6562 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
6563 MethodAttr, TypeAttr to represent the various mappings where the
6565 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
6567 2001-08-19 Miguel de Icaza <miguel@ximian.com>
6569 * parameter.cs (GetParameterInfo): Fix bug where there would be no
6572 * interface.cs (PopulateIndexer): Implemented the code generator
6573 for interface indexers.
6575 2001-08-17 Miguel de Icaza <miguel@ximian.com>
6577 * interface.cs (InterfaceMemberBase): Now we track the new status
6580 (PopulateProperty): Implement property population. Woohoo! Got
6581 Methods and Properties going today.
6583 Removed all the properties for interfaces, and replaced them with
6584 `public readonly' fields.
6586 2001-08-16 Miguel de Icaza <miguel@ximian.com>
6588 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
6589 initialize their hashtables/arraylists only when they are needed
6590 instead of doing this always.
6592 * parameter.cs: Handle refs and out parameters.
6594 * cs-parser.jay: Use an ArrayList to construct the arguments
6595 instead of the ParameterCollection, and then cast that to a
6598 * parameter.cs: Drop the use of ParameterCollection and use
6599 instead arrays of Parameters.
6601 (GetParameterInfo): Use the Type, not the Name when resolving
6604 2001-08-13 Miguel de Icaza <miguel@ximian.com>
6606 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
6607 and instead use public readonly fields.
6609 * class.cs: Put back walking code for type containers.
6611 2001-08-11 Miguel de Icaza <miguel@ximian.com>
6613 * class.cs (MakeConstant): Code to define constants.
6615 * rootcontext.cs (LookupType): New function. Used to locate types
6618 2001-08-08 Miguel de Icaza <miguel@ximian.com>
6620 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
6621 this System.Reflection code is. Kudos to Microsoft
6623 * typemanager.cs: Implement a type cache and avoid loading all
6624 types at boot time. Wrap in LookupType the internals. This made
6625 the compiler so much faster. Wow. I rule!
6627 * driver.cs: Make sure we always load mscorlib first (for
6628 debugging purposes, nothing really important).
6630 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
6631 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
6633 * rootcontext.cs: Lookup types on their namespace; Lookup types
6634 on namespaces that have been imported using the `using' keyword.
6636 * class.cs (TypeContainer::TypeAttr): Virtualize.
6637 (Class::TypeAttr): Return attributes suitable for this bad boy.
6638 (Struct::TypeAttr): ditto.
6639 Handle nested classes.
6640 (TypeContainer::) Remove all the type visiting code, it is now
6641 replaced with the rootcontext.cs code
6643 * rootcontext.cs (GetClassBases): Added support for structs.
6645 2001-08-06 Miguel de Icaza <miguel@ximian.com>
6647 * interface.cs, statement.cs, class.cs, parameter.cs,
6648 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
6649 Drop use of TypeRefs, and use strings instead.
6651 2001-08-04 Miguel de Icaza <miguel@ximian.com>
6655 * class.cs (Struct::Struct): set the SEALED flags after
6656 checking the modifiers.
6657 (TypeContainer::TypeAttr): new property, returns the
6658 TypeAttributes for a class.
6660 * cs-parser.jay (type_list): Oops, list production was creating a
6661 new list of base types.
6663 * rootcontext.cs (StdLib): New property.
6664 (GetInterfaceTypeByName): returns an interface by type name, and
6665 encapsulates error handling here.
6666 (GetInterfaces): simplified.
6667 (ResolveTree): Encapsulated all the tree resolution here.
6668 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
6671 * driver.cs: Add support for --nostdlib, to avoid loading the
6673 (Main): Do not put tree resolution here.
6675 * rootcontext.cs: Beginning of the class resolution.
6677 2001-08-03 Miguel de Icaza <miguel@ximian.com>
6679 * rootcontext.cs: Provide better error reporting.
6681 * cs-parser.jay (interface_base): set our $$ to be interfaces.
6683 * rootcontext.cs (CreateInterface): Handle the case where there
6684 are no parent interfaces.
6686 (CloseTypes): Routine to flush types at the end.
6687 (CreateInterface): Track types.
6688 (GetInterfaces): Returns an array of Types from the list of
6691 * typemanager.c (AddUserType): Mechanism to track user types (puts
6692 the type on the global type hash, and allows us to close it at the
6695 2001-08-02 Miguel de Icaza <miguel@ximian.com>
6697 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
6698 RecordInterface instead.
6700 * cs-parser.jay: Updated to reflect changes above.
6702 * decl.cs (Definition): Keep track of the TypeBuilder type that
6703 represents this type here. Not sure we will use it in the long
6704 run, but wont hurt for now.
6706 * driver.cs: Smaller changes to accomodate the new code.
6708 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
6711 * rootcontext.cs (CreateInterface): New method, used to create
6712 the System.TypeBuilder type for interfaces.
6713 (ResolveInterfaces): new entry point to resolve the interface
6715 (CodeGen): Property, used to keep track of the code generator.
6717 2001-07-26 Miguel de Icaza <miguel@ximian.com>
6719 * cs-parser.jay: Add a second production for delegate_declaration
6722 (enum_body): Put an opt_comma here instead of putting it on
6723 enum_body or enum_member_declarations so we can handle trailing
6724 commas on enumeration members. Gets rid of a shift/reduce.
6726 (type_list): Need a COMMA in the middle.
6728 (indexer_declaration): Tell tokenizer to recognize get/set
6730 * Remove old targets.
6732 * Re-add the parser target.
6734 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6736 * cs-parser.jay: Add precendence rules for a number of operators
6737 ot reduce the number of shift/reduce conflicts in the grammar.
6739 2001-07-17 Miguel de Icaza <miguel@ximian.com>
6741 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
6744 Get rid of old crufty code.
6746 * rootcontext.cs: Use this to keep track of the parsed
6747 representation and the defined types available to the program.
6749 * gen-treedump.cs: adjust for new convention.
6751 * type.cs: Split out the type manager, and the assembly builder
6754 * typemanager.cs: the type manager will live here now.
6756 * cil-codegen.cs: And the code generator here.
6758 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
6760 * makefile: Fixed up for easy making.
6762 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6764 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
6767 (unary_expression): Expand pre_increment_expression and
6768 post_decrement_expression to reduce a shift/reduce.
6770 2001-07-11 Simon Cozens
6772 * cs-tokenizer.cs: Hex numbers should begin with a 0.
6774 Improve allow_keyword_as_indent name.
6776 2001-06-19 Miguel de Icaza <miguel@ximian.com>
6778 * Adjustments for Beta2.
6780 2001-06-13 Miguel de Icaza <miguel@ximian.com>
6782 * decl.cs: Added `Define' abstract method.
6783 (InTransit): new property, used to catch recursive definitions.
6785 * interface.cs: Implement `Define'.
6787 * modifiers.cs: Map Modifiers.constants to
6788 System.Reflection.TypeAttribute flags.
6790 * class.cs: Keep track of types and user-defined types.
6791 (BuilderInit): New method for creating an assembly
6792 (ResolveType): New function to launch the resolution process, only
6793 used by interfaces for now.
6795 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
6796 that are inserted into the name space.
6798 2001-06-08 Miguel de Icaza <miguel@ximian.com>
6800 * ARGH. I have screwed up my tree so many times due to the use of
6801 rsync rather than using CVS. Going to fix this at once.
6803 * driver.cs: Objetify driver. Load assemblies, use assemblies to
6806 2001-06-07 Miguel de Icaza <miguel@ximian.com>
6808 * Experiment successful: Use System.Type rather that our own
6811 2001-05-25 Miguel de Icaza <miguel@ximian.com>
6813 * cs-parser.jay: Removed nsAliases from here.
6815 Use new namespaces, handle `using XXX;'
6817 * namespace.cs: Reimplemented namespace handling, use a recursive
6818 definition of the class. Now we can keep track of using clauses
6819 and catch invalid using clauses.
6821 2001-05-24 Miguel de Icaza <miguel@ximian.com>
6823 * gen-treedump.cs: Adapted for all the renaming.
6825 * expression.cs (Expression): this class now has a Type property
6826 which returns an expression Type.
6828 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
6829 `Type', as this has a different meaning now in the base
6831 2001-05-22 Miguel de Icaza <miguel@ximian.com>
6833 * interface.cs, class.cs: Removed from all the sources the
6834 references to signature computation, as we can not do method
6835 signature computation during the parsing time, as we are not
6836 trying to solve at that point distinguishing:
6840 void a (NS.Blah x) {}
6843 Which depending on the context might be valid or not, as we do not
6844 know if Blah is the same thing as NS.Blah at that point.
6846 * Redid everything so the code uses TypeRefs now instead of
6847 Types. TypeRefs are just temporary type placeholders, that need
6848 to be resolved. They initially have a pointer to a string and the
6849 current scope in which they are used. This is used later by the
6850 compiler to resolve the reference to an actual Type.
6852 * DeclSpace is no longer a CIR.Type, and neither are
6853 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
6854 are all DeclSpaces, but no Types.
6856 * type.cs (TypeRefManager): This implements the TypeRef manager,
6857 which keeps track of all the types that need to be resolved after
6858 the parsing has finished.
6860 2001-05-13 Miguel de Icaza <miguel@ximian.com>
6862 * ARGH. We are going to have to store `foreach' as a class rather
6863 than resolving it, as we need to verify error 1579 after name
6864 resolution. *OR* we could keep a flag that says `This request to
6865 IEnumerator comes from a foreach statement' which we can then use
6866 to generate the error.
6868 2001-05-10 Miguel de Icaza <miguel@ximian.com>
6870 * class.cs (TypeContainer.AddMethod): we now add methods to the
6871 MethodGroup instead of the method hashtable.
6873 * expression.cs: Add MethodGroup abstraction, which gets us one
6874 step closer to the specification in the way we handle method
6877 * cs-parser.jay (primary_expression): qualified_identifier now
6878 tried to match up an identifier to a local variable reference or
6879 to a parameter reference.
6881 current_local_parameters is now a parser global variable that
6882 points to the current parameters for the block, used during name
6885 (property_declaration): Now creates an implicit `value' argument to
6888 2001-05-09 Miguel de Icaza <miguel@ximian.com>
6890 * parameter.cs: Do not use `param' arguments as part of the
6891 signature, per the spec.
6893 2001-05-08 Miguel de Icaza <miguel@ximian.com>
6895 * decl.cs: Base class for classes, structs and interfaces. This
6896 is the "Declaration Space"
6898 * cs-parser.jay: Use CheckDef for checking declaration errors
6899 instead of having one on each function.
6901 * class.cs: Factor out some code for handling error handling in
6902 accordance to the "Declarations" section in the "Basic Concepts"
6903 chapter in the ECMA C# spec.
6905 * interface.cs: Make all interface member classes derive from
6906 InterfaceMemberBase.
6908 2001-05-07 Miguel de Icaza <miguel@ximian.com>
6910 * Many things: all interfaces are parsed and generated in
6911 gen-treedump. Support for member variables, constructors,
6912 destructors, properties, constants is there.
6914 Beginning of the IL backend, but very little done, just there for
6917 2001-04-29 Miguel de Icaza <miguel@ximian.com>
6919 * cs-parser.jay: Fix labeled statement.
6921 * cs-tokenizer.cs (escape): Escape " and ' always.
6922 ref_line, ref_name: keep track of the line/filename as instructed
6923 by #line by the compiler.
6926 2001-04-27 Miguel de Icaza <miguel@ximian.com>
6928 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
6929 to match the values in System.CodeDOM.
6931 Divid renamed to Divide.
6933 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
6935 (Statements.set): remove.
6937 * System.CodeDOM/CodeCatchClause.cs: always have a valid
6940 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
6941 falseStatements always have valid values.
6943 * cs-parser.jay: Use System.CodeDOM now.