1 2002-05-16 Miguel de Icaza <miguel@ximian.com>
3 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
4 method is invoked before any code generation takes place, and it
5 is a mechanism to inform that the expression will be invoked more
6 than once, and that the method should use temporary values to
7 avoid having side effects
9 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
11 * ecore.cs (Expression.CacheTemporaries): Provide empty default
14 * expression.cs (Indirection, ArrayAccess): Add support for
15 CacheTemporaries in these two bad boys.
17 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
19 (StoreFromPtr): Handle stobj as well.
21 * expression.cs (UnaryMutator): Share more code.
23 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
24 down: I was not tracking the Filter function as well, which
25 was affecting the results of the cache.
27 2002-05-15 Miguel de Icaza <miguel@ximian.com>
29 * attribute.cs: Remove the hack to handle the CharSet property on
32 2002-05-14 Miguel de Icaza <miguel@ximian.com>
34 * attribute.cs (DoResolve): More uglyness, we now only try to
35 resolve the attribute partially, to extract the CharSet
36 information (only if we are a StructLayout attribute). Otherwise
38 (GetExtraTypeInfo): Add some code to conditionally kill in the
39 future this. I am more and more convinced that the .NET
40 framework has special code to handle the attribute setting on
43 * expression.cs (IsParamsMethodApplicable): Revert my previous
44 foreach change here, it was wrong.
46 2002-05-13 Miguel de Icaza <miguel@ximian.com>
48 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
49 (pp_expr): do not abort on unknown input, just return.
50 (eval): abort if there are pending chars.
52 * attribute.cs (Attribute.Resolve): Positional parameters are
53 optional. Deal with that case.
55 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
56 the Ansi/Unicode/Auto information for the type.
58 (TypeContainer.DefineType): instantiate the EmitContext here, as
59 we will be using it during the type definition (to resolve
60 attributes) and during the emit phase.
62 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
63 to pull type information out of the attributes
65 (Attribute.Resolve): track the constructor builder, and allow for
66 multiple invocations (structs and classes will use this).
68 * ecore.cs (MemberLookupFinal): new version with all the
69 parameters customizable.
71 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
72 constructors. Return if the result value is null (as the error
73 would have been flagged already by MemberLookupFinal)
75 Do not allow instances of abstract classes or interfaces to be
78 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
79 We have to compare the assembly property here when dealing with
80 FamANDAssem and Assembly access modifiers, because we might be
81 creating an assembly from *modules* (that means that we are not
82 getting TypeBuilders for types defined in other modules that are
83 part of this assembly).
85 (Method.Emit): If the method is marked abstract and has a body,
88 (TypeContainer.DefineMembers): If both the defined member and the
89 parent name match are methods, then do not emit any warnings: let
90 the Method.Define routine take care of flagging warnings. But if
91 there is a mismatch (method overrides something else, or method is
92 overriwritten by something, then emit warning).
94 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
95 set to null, this means `do not check for the return type on the
98 (Method.Define): set the return type for the method signature to
99 null, so that we get methods with the same name and parameters and
100 different return types. This is used to flag warning 114 (you are
101 hiding a method, and you probably want to use the new/override
104 * typemanager.cs (MemberLookup): Implemented proper access
105 control, closing a long standing set of bug reports. The problem
106 was that the Framework only has two bits: Public and NonPublic,
107 and NonPublic includes private and protected methods, but we need
108 to enforce the FamANDAssem, FamOrAssem and Family.
110 2002-05-11 Miguel de Icaza <miguel@ximian.com>
112 * statement.cs (GotoCase): Return true: Ammounts to giving up
113 knowledge on whether we return or not, and letting the other case
114 be responsible for it.
116 2002-05-10 Miguel de Icaza <miguel@ximian.com>
118 * driver.cs: Do not load directories for each file processed, only
119 do it if there is a pattern.
121 * ecore.cs: Report readonly assigns here as well, as we might have
122 been resolved only by MemberAccess.
124 (SimpleName.SimpleNameResolve): Also be useful for LValue
125 resolution. We need this to propagate assign to local readonly variables
127 * typemanager.cs: Use a ptrhashtable for the criteria, because we
128 do not want to reuse potential criteria memory.
130 * class.cs (MyEventBuilder): Set reflected_type;
132 * ecore.cs (Constantify): Added support for constifying bools.
134 (RootContext.LookupType): Added a cache for values looked up in
135 the declaration space.
137 * typemanager.cs (FindMembers): Now is a front-end to
138 RealFindMembers, and provides a two-level hashtable-based cache to
141 15% performance improvement: from 22.5 to 19.2 seconds.
143 * expression.cs (IsParamsMethodApplicable): use foreach.
144 (Invocation.DoResolve): ditto.
145 (New.DoResolve): ditto.
146 (ArrayCreation.DoResolve): ditto.
148 * ecore.cs (FindMostEncompassingType): use foreach.
150 * delegate.cs (NewDelegate.DoResolve): Use foreach
152 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
153 (RemoveMethods): use foreach.
155 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
156 nested foreach statements instead of for, and also break out of
157 the inner loop once a match is found.
159 (Invocation.OverloadResolve): Use foreach, simplify the code.
161 2002-05-08 Miguel de Icaza <miguel@ximian.com>
163 * cfold.cs (BinaryFold): During an enumeration evaluation context,
164 we actually unwrap the expression to allow for extra information
167 * expression.cs: Use Shr_Un on unsigned operations.
169 2002-05-08 Ravi Pratap <ravi@ximian.com>
171 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
172 applicable operators was not being considered correctly. This closes
173 the bug Miguel reported.
175 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
177 * attribute.cs: check that the type derives from System.Attribute
178 and report the correct error in that case (moved the duplicate code to
179 its own method, too).
181 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
183 * attribute.cs: lookup attribute type name as the spec says: first the
184 bare attribute name and then name + "Attribute" (nant compiles with
187 2002-05-07 Miguel de Icaza <miguel@ximian.com>
189 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
190 Because of the way we parse things, we should try to see if a
191 UIntConstant can fit in an integer.
193 2002-05-07 Ravi Pratap <ravi@ximian.com>
195 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
196 when we are in an explicit context.
198 (ConvertReferenceExplicit): When converting from Iface type S to Class
199 T make sure the rules are implemented as an OR.
201 * parameter.cs (ParameterType): Make it a property for now although the
202 purpose really isn't anything immediate.
204 * expression.cs (Is*Applicable): Do better checking on the parameter type
205 of a ref/out parameter. The ones from the system assemblies are already
206 marked with the correct type so we don't need to do any correction.
208 * ecore.cs (StandardConversionExists): Conversion from Interface types to
209 the object type is standard too so include that.
211 2002-05-06 Miguel de Icaza <miguel@ximian.com>
213 * ecore.cs (StandardConversionExists): Augment with missing code:
214 deal with IntConstant, LongConstants and Enumerations.
216 * assign.cs: Report the error, instead of failing silently
218 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
219 typecontainer that they are declared, because the
220 typecontainer/namespace will have the list of using clauses that
223 Assembly Attributes were escaping the normal registration
226 (EmitCode): Apply attributes within an EmitContext that represents
227 the container they were declared on.
229 * cs-parser.jay: Track bases for structs. How did I get this wrong?
231 2002-05-06 Ravi Pratap <ravi@ximian.com>
233 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
234 Revamp completely - make much cleaner as we now operate only
237 (FindMostSpecificSource, FindMostSpecificTarget): New methods
238 to implement the logic detailed in the spec more correctly.
240 (UserDefinedConversion): Update accordingly.
242 2002-05-06 Miguel de Icaza <miguel@ximian.com>
244 * statement.cs: Return flow analysis information up.
246 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
249 (token): Do not consume an extra character before calling
252 2002-05-06 Piers Haken <piersh@friskit.com>
254 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
256 2002-05-06 Miguel de Icaza <miguel@ximian.com>
258 * class.cs (Constructor.Emit): Set the IsStatic flag in the
259 EmitContext during the instance constructor initializer
260 resolution, to stop access to instance variables.
262 This is mandated by the spec, last paragraph of the `constructor
263 initializers' section.
265 2002-05-05 Miguel de Icaza <miguel@ximian.com>
267 * cs-parser.jay, class.cs (Accessor): new class used to represent
268 an accessor (get or set). In the past we used `null' to represent
269 a missing accessor. But this is ambiguous because there was no
270 way to tell in abstract indexers/properties if one of them was
273 Now there is a way of addressing that.
275 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
276 instead of FindMembers.
278 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
279 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
281 * attribute.cs: Treat indexers and properties as the same in terms
282 of applying attributes
284 * ecore.cs (FindMostEncompassedType): Use statically initialized
285 EmptyExpressions()s like we do elsewhere to avoid creating useless
286 objects (and we take this out of the tight loop).
288 (GetConversionOperators): Move the code to extract the actual
289 operators to a separate routine to clean things up.
291 2002-05-04 Miguel de Icaza <miguel@ximian.com>
293 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
294 events are always registered FieldBuilders.
296 * class.cs (FieldBase): New class shared by Fields
298 * delegate.cs: If we are a toplevel delegate, use our full name.
299 If we are a nested delegate, then only use our tail name.
301 2002-05-02 Ravi Pratap <ravi@ximian.com>
303 * expression.cs (IsApplicable): Ensure that we add the "&" to
304 ref/out types before comparing it with the type of the argument.
306 (IsParamsMethodApplicable): Ditto.
308 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
311 * delegate.cs : Handle the case when we have more than one applicable
312 method. Flag an error only when we finish checking all.
314 2002-05-02 Miguel de Icaza <miguel@ximian.com>
316 * expression.cs: Add support for boolean static initializers.
318 2002-05-01 Miguel de Icaza <miguel@ximian.com>
320 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
322 * parameter.cs (ComputeParameterTypes,
323 ComputeAndDefineParameterTypes): Better error handling: now we
324 clear the `types' cache if we fail during any of the type lookups.
325 We also return the status code correctly to our caller
327 * delegate.cs: If we fail to define a delegate, abort the extra
330 * expression.cs (Binary.ResolveOperator): for
331 operator==(object,object) and operator !=(object, object) we also
332 have to verify that there is an implicit conversion from one to
335 (ArrayAccess.DoResolve): Array Access can operate on
338 2002-04-30 Miguel de Icaza <miguel@ximian.com>
340 * assign.cs (CompoundAssign): A new class used as a "flag" that
341 the assignment actually is happening as part of a compound
344 During compound assignment, a few new rules exist to enable things
351 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
352 to the type of x) if y is implicitly convertible to the type of x,
353 and the operator is a builtin operator and the return type of the
354 operator is explicitly convertible to the type of x.
356 * rootcontext.cs: Reset warning level to 2. 4 catches various
357 "interesting" features in mcs, we must clean this up at some
358 point, but currently am trying to kill other bugs ;-)
360 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
361 in container classes as well.
363 * expression.cs (Binary.ResolveOperator): Handle string case
364 before anything else (as operator overloading does emit an error
365 before doing anything else).
367 This code could go away when we move to a table driven model, but
368 i could not come up with a good plan last night.
370 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
372 * typemanager.cs (CSharpName): reimplementation using regex.
373 * class.cs: added null check for fields in Emit
374 * rootcontext.cs: set warninglevel to 4
376 2002-04-29 Miguel de Icaza <miguel@ximian.com>
378 * typemanager.cs (CSharpName): reimplemented with Lupus
381 2002-04-28 Miguel de Icaza <miguel@ximian.com>
383 * statement.cs (If): correclty implement Resolve, because we were
384 not catching sem errors in there. The same process is needed
386 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
389 (Statement.Warning_DeadCodeFound): Factorize code.
390 (While): Report dead code here too.
392 (Statement): Added Resolve virtual method to allow
393 for resolution split from the emit code.
395 2002-04-26 Miguel de Icaza <miguel@ximian.com>
397 * statement.cs (EmitBoolExpression): No longer try to resolve the
399 (MakeBoolean): New utility function that resolve, implicitly
400 converts to boolean and tags the expression.
403 (If, Do): Implement dead code elimination.
404 (While): Implement loop inversion
406 (Do, While, For, If): Resolve the expression prior to calling our
409 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
412 - added method Report28 (warning: program has more than one entry point)
413 - added method IsEntryPoint, implements paragraph 10.1 of the spec
414 - modified method Method.Define, the part at the end of the method
416 * rootcontext.cs: added static public Location EntryPointLocation;
418 * ../errors/cs0028.cs : Add test case for the above warning.
421 - modified method CSharpName to allow arrays of primitive type to
422 be printed nicely (e.g. instead of System.Int32[][] it now prints
424 - added method CSharpSignature: returns the signature of a method
425 in string format to be used in reporting errors, warnings, etc.
427 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
430 2002-04-26 Ravi Pratap <ravi@ximian.com>
432 * delegate.cs (Define): Fix extremely silly bug where I was
433 setting the type of the 'object' parameter of the BeginInvoke
434 method to System.IAsyncResult instead of System.Object ;-)
436 2002-04-26 Miguel de Icaza <miguel@ximian.com>
438 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
441 (Constructor.Emit): return if we fail to initialize the
442 constructor. Another door closed!
444 * expression.cs (New.DoResolve): Improve error message (from -6 to
445 1501). Use DeclaredOnly lookup to find the exact constructor.
447 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
448 loop. This is useful.
450 * cs-parser.jay: Adjust the default parameters so that destructors
451 have the proper signature.
453 2002-04-26 Martin Baulig <martin@gnome.org>
455 * driver.cs (LoadAssembly): If `assembly' contains any characters
456 which are only valid in path names and not in assembly names
457 (currently slash, backslash and point), use Assembly.LoadFrom ()
458 instead of Assembly.Load () on the `assembly' (before iteration
459 over the link_paths).
461 2002-04-26 Martin Baulig <martin@gnome.org>
463 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
465 2002-04-25 Miguel de Icaza <miguel@ximian.com>
467 * class.cs (Property): use the new typemanager.MemberLookup
469 (TypeContainer.MemberLookup): Implement using the
470 TypeManager.MemberLookup now.
472 * typemanager.cs: Make MemberLookup a function of the TypeManager,
473 and return MemberInfos, so that these can be used without an
474 EmitContext (what we had before).
476 2002-04-24 Miguel de Icaza <miguel@ximian.com>
478 * expression.cs: Fix the case where the argument to params if the
479 type of the params. I omitted handling this before. Fixed
481 2002-04-22 Miguel de Icaza <miguel@ximian.com>
483 * driver.cs: Call BootCorlib_PopulateCoreType
485 * class.cs (Property.CheckBase): Check for properties only, not
488 * interface.cs: Temporary hack: try/catch around the
489 CustomAttributeBuilder, because I am getting an exception that I
492 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
493 types whose definitions are required to be there (attributes are
494 defined before standard types).
496 Compute definitions as we boot the various types, as they are used
497 immediately (value_type class will need object_type, but if we do
498 not initialize object_type, we will pass a null, which will let
499 the runtime pick the System.Object from the existing corlib, which
500 is not what we want).
502 2002-04-22 Patrik Torstensson <totte@labs2.com>
504 * cs-tokenizer.cs: fixed a number of trim() issues.
506 2002-04-22 Ravi Pratap <ravi@ximian.com>
508 * expression.cs (Argument.Type): Ensure that we return the correct
509 type when we have out or ref parameters [in which case we
512 2002-04-22 Miguel de Icaza <miguel@ximian.com>
514 * class.cs (Property, Indexer): Allow extern modifier in there.
516 * typemanager.cs (InitBaseTypes): Initializes object_type and
517 value_type, since those will be used early on during the bootstrap
518 process to compile corlib.
520 (InitCoreTypes): Move code from here to InitBaseTypes.
522 2002-04-21 Miguel de Icaza <miguel@ximian.com>
524 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
525 single-dimension arrays as using the ldlen opcode.
527 Daniel Lewis discovered this optimization.
529 * typemanager.cs: Add signature for System.Array::get_Length
531 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
533 * statement.cs: report the error when the foreach does not apply to an
534 array nor a collection.
536 2002-04-19 Miguel de Icaza <miguel@ximian.com>
538 * expression.cs: Add implicit conversions to the operator ~.
540 * constant.cs (DecimalConstant.Emit): Emit decimal value.
542 * typemanager.cs: Locate the decimal constructor.
544 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
546 * attribute.cs: use the new property of TypeOf.
547 * expression.cs: added 'get' property around typearg.
549 These changes fix a build breaker reported by NickD. Is this the
550 correct way to fix? If not, please, revert my changes and make it
553 2002-04-17 Miguel de Icaza <miguel@ximian.com>
555 * attribute.cs: Add support for typeof in attribute invocations.
556 I am not sure that this is right though.
558 2002-04-14 Duncan Mak <duncan@ximian.com>
560 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
561 Binary.Operator.Division case.
563 2002-04-13 Ravi Pratap <ravi@ximian.com>
565 * class.cs (DefineType): Ensure that we do a proper check on
566 attribute types and also register it with the TypeManager.
568 (TypeContainer.Targets): The default for attribute types is
569 AttributeTargets.All.
571 * attribute.cs (ApplyAttributes): Registering the attribute type
572 is done elsewhere, not when we discover we have a Usage attribute.
574 2002-04-12 Ravi Pratap <ravi@ximian.com>
576 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
577 and get rid of is_delegate parameter.
579 * everywhere : update.
581 2002-04-12 Ravi Pratap <ravi@ximian.com>
583 * cs-parser.jay (compilation_unit): Revamp completely to use
584 some new ideas that I got from Rhys' grammar to solve the problems
585 with assembly level attributes.
587 (outer_declaration): New grammar production.
589 (attribute_sections): Add.
591 (opt_attributes): Base on attribute_sections
593 (namespace_declaration): Allow opt_attributes to tackle the case
594 when we have assembly level attributes - we are clever in this
597 * attribute.cs (ApplyAttributes): Do not worry about assembly
598 attributes in the non-global context.
600 * rootcontext.cs (AddGlobalAttributes): Go back to using this
601 instead of SetGlobalAttributes.
603 * class.cs, rootcontext.cs : Ensure we define and generate
604 attribute types before anything else.
606 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
607 and flag the new error -20 for the case when the attribute type
608 does not have valid targets specified. csc does not catch this.
610 * ../errors/errors.txt : update for error # -20
612 2002-04-11 Ravi Pratap <ravi@ximian.com>
614 * support.cs (InternalParameters.ParameterModifier): Do some null
615 checking and return sane values.
617 * class.cs (Method.Define): If we are a PInvoke method, ensure
618 that we are static and extern. Report error # 601
620 * ../errors/cs0601.cs : Add test case for the above error.
622 2002-04-07 Ravi Pratap <ravi@ximian.com>
624 * rootcontext.cs (attribute_types): We need to keep type of
625 all attribute types separately and emit code for them first.
627 (RegisterAttribute) : Implement.
629 * class.cs (DefineType): Check if the current Type is a custom
630 attribute type and register it accordingly.
632 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
633 adding the first attribute twice and rename to
635 (SetGlobalAttributes): this.
637 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
640 * attribute.cs (ApplyAttributes): Take an additional argument telling us
641 if we are processing global arguments. Hmm, I am unsure of this.
643 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
645 * expression.cs: added static array of strings to avoid calling
646 Enum.ToString () for Operator in Binary. Significant recover of
649 2002-04-10 Miguel de Icaza <miguel@ximian.com>
651 * class.cs (FindMembers): Allow the Builders of the various
652 members to be null. If they are skip them. This only happens
653 during the PInvoke declaration.
655 2002-04-09 Miguel de Icaza <miguel@ximian.com>
657 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
658 failure, so we do not keep going afterwards.
660 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
661 wanted to pass `false' as the `is_delegate' argument. If this is
662 the case, why not use delegate_type == null to mean `is_delegate =
663 false' and anything else as is_delegate = true.
665 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
667 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
668 code for the section, not the beginning of the tests.
670 2002-04-08 Miguel de Icaza <miguel@ximian.com>
672 * cfold.cs: Handle operator + (Enum x, Underlying x)
674 * expression.cs (Binary): same. Warn about errors where we have
675 Enum/Enum in operator + as well.
677 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
680 - added support for switch(bool)
681 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
682 - add TableSwitchEmit() to handle table-based switch statements
684 2002-04-05 Ravi Pratap <ravi@ximian.com>
686 * expression.cs (Invocation.OverloadResolve): Factor out code which
687 does parameter compatibility checking with arguments so that we can
688 re-use the code even from Delegate.VerifyApplicability
690 (VerifyArgumentsCompat): Move above code here.
692 * delegate.cs (VerifyApplicability): Get rid of duplicate code
693 and instead make a call to the above method.
695 2002-03-31 Ravi Pratap <ravi@ximian.com>
697 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
698 We use it to keep track of classes which are attribute types.
700 2002-04-02 Miguel de Icaza <miguel@ximian.com>
702 * delegate.cs (Delegate.Define): Correctly define the types in the
703 presence of fixed and array parameters.
705 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
708 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
709 include NonPublic after the first iteration.
711 * class.cs (Indexer.CheckBase): Only check if both parents are
714 * cs-parser.jay (accessor_body): If empty, set to null.
716 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
717 same code path here to resolve constants names that we did have in
718 MemberAccess.DoResolve. There is too much code duplicated here.
720 2002-04-01 Miguel de Icaza <miguel@ximian.com>
722 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
724 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
727 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
728 tokens, numbers and strings.
730 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
733 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
734 asyncronous parameters and the regular parameters.
736 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
737 specify the target directory.
739 * expression.cs: (This.DoResolve): Simplify
740 (As.Emit): Optimize, do not generate IsInst if the expression is
741 always of the given type.
743 (Is.DoResolve): Bug fix, we were reporting both always/never for
746 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
747 creating too many unnecessary arrays.
749 2002-03-31 Miguel de Icaza <miguel@ximian.com>
751 * class.cs (EmitFieldInitializer): Use Assign expression to assign
752 fields instead of rolling our own initializer. Takes care of all
753 implicit conversions, and drops unnecessary static checks/argument.
755 2002-03-31 Dick Porter <dick@ximian.com>
757 * driver.cs: use the GetDirectories() return values properly, and
758 use "/" as path separator.
760 2002-03-30 Miguel de Icaza <miguel@ximian.com>
762 * expression.cs (Unary): Optimize - - expr into expr.
763 (Binary): Optimize a + (-b) into a -b.
765 * codegen.cs (CodeGen): Made all methods static.
767 2002-03-29 Miguel de Icaza <miguel@ximian.com>
771 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
772 TypeBuilder property.
774 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
777 * tree.cs: Removed the various RecordXXXX, and replaced with a
778 single RecordDecl. Removed all the accessor methods, and just
779 left a single access point Type
781 * enum.cs: Rename DefineEnum to DefineType.
783 * decl.cs: New abstract method `DefineType' used to unify the
784 Defines for Enumerations, Interfaces, TypeContainers and
787 (FindType): Moved LookupInterfaceOrClass here. Moved the
788 LookupBaseClasses method that used to live in class.cs and
789 interface.cs here, and renamed to FindType.
791 * delegate.cs: Implement DefineType. Take advantage of the
792 refactored pattern for locating the parent builder without taking
793 the parent_builder argument (which we know does not work if we are
794 nested, and triggering a toplevel definition).
796 2002-03-28 Miguel de Icaza <miguel@ximian.com>
798 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
799 accessibility of a member has changed during override and report
802 * class.cs (Method.Define, Property.Define): Only complain on
803 overrides if the method is private, any other accessibility is
804 fine (and since we just checked the permission is the same, we are
807 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
808 and elif are processed always. The other pre-processing
809 directives are only processed if we are "taking" the path
811 2002-03-29 Martin Baulig <martin@gnome.org>
813 * class.cs (Method.Emit): Only emit symbolic debugging info if the
814 current location is not Null.
816 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
817 a separate method so we can profile it.
819 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
820 `span.Seconds' are just seconds, but no minutes or hours.
821 (MainDriver): Profile the CodeGen.SaveSymbols calls.
823 2002-03-28 Miguel de Icaza <miguel@ximian.com>
825 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
826 Remove the gratuitous set of Final:
828 // If an interface implementation, then we can set Final.
829 if (((flags & MethodAttributes.Abstract) == 0) &&
830 implementing.DeclaringType.IsInterface)
831 flags |= MethodAttributes.Final;
833 I do not know what I was smoking when I used that.
836 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
837 step into fixing the name resolution issues for delegates and
838 unifying the toplevel name resolution.
840 2002-03-28 Martin Baulig <martin@gnome.org>
842 * class.cs (Method.Emit): If we have a symbol writer, call its
843 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
844 tell it about the current method.
846 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
847 writer that we're going to emit the first byte of IL code for a new
848 statement (a new source line).
849 (EmitContext.EmitTopBlock): If we have a symbol writer, call
850 EmitContext.Mark() before emitting any code.
852 * location.cs (SymbolDocument): Return null when we're Null.
854 * statement.cs (Statement): Moved the `Location loc' variable here.
855 (Statement.EmitBoolExpression): If we have a symbol writer, call
856 ec.Mark() before emitting any code to tell it that we're at the
857 beginning of a new statement.
858 (StatementExpression): Added `Location' argument to the constructor.
859 (Block): Added public readonly variable `StartLocation' and public
860 variable `EndLocation'. The latter is to be set using SetEndLocation().
861 (Block): Added constructor which takes a start and end location.
862 (Block.SetEndLocation): New method. This sets the end location.
863 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
864 local variables we create.
865 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
866 each statement and do also mark the begin and end of the block.
868 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
869 tell it the current lexer.Location, use Location.Null for the end of the
871 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
872 current block, set its end location using SetEndLocation().
873 (statement_expression): StatementExpression constructor now takes the
874 lexer.Location as additional argument.
875 (for_statement, declare_local_variables): Likewise.
876 (declare_local_variables): When creating a new implicit block, use the
877 new Block constructor and pass it the lexer.Location.
879 2002-03-28 Miguel de Icaza <miguel@ximian.com>
881 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
882 members also on the parent interfaces recursively.
884 2002-03-27 Miguel de Icaza <miguel@ximian.com>
886 * report.cs: Use new formats, since Gonzalo finished the missing
889 * expression.cs (Binary.ResolveOperator): added missing operator|
890 operator& and operator^ for bool/bool.
892 * cs-parser.jay: CheckDef now takes a Location argument that is
893 used to report errors more precisly (instead of reporting the end
894 of a definition, we try to track something which is a lot closer
895 to the source of the problem).
897 * cs-tokenizer.cs: Track global token use, so we can properly flag
898 the use of #define/#undef after the first token has been seen.
900 Also, rename the reportXXXX to Error_DescriptiveName
902 * decl.cs (DeclSpace.IsTopLevel): Move property here from
903 TypeContainer, so that Enum and Interface can use this too.
905 * class.cs (TypeContainer.LookupInterfaceOrClass,
906 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
907 `builder' argument. Typically this was used to pass the parent
908 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
911 The problem is that a nested class could trigger the definition of
912 a toplevel class, and the builder would be obviously wrong in that
915 So we drop this argument, and we compute dynamically the
916 TypeBuilder/ModuleBuilder (the correct information was available
917 to us anyways from DeclSpace.Parent)
919 * interface.cs (Interface.DefineInterface): Drop builder
920 parameter cleanup like class.cs
922 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
925 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
928 (Try.Emit): Propagate the returns value from the statement.
930 (Return.Emit): Even if we are leavning
932 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
934 * modifiers.cs: Fix the computation of MethodAttributes flags.
936 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
938 * driver.cs: allow compilation of files that start with '/'.
939 Add a default case when checking the argument of --target.
941 2002-03-25 Miguel de Icaza <miguel@ximian.com>
943 * interface.cs: Implement the same search algorithm for types in
946 * delegate.cs: Do not allow multiple definition.
948 * Recovered ChangeLog that got accidentally amputated
950 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
952 * rootcontext.cs: Load manually enum to allow core classes to
953 contain enumerations.
955 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
956 Update to new static methods in TypeManager.
958 * typemanager.cs (GetMethod, GetConstructor): Use our
959 implementation of FindMembers to find the members, since during
960 corlib compilation, the types are TypeBuilders and GetMethod and
961 GetConstructor do not work.
963 Make all methods in TypeManager static.
965 (InitCodeHelpers): Split the functionality from
966 the InitCodeTypes function.
968 * driver.cs: Call InitCodeHelpers after we have populated the
971 * cs-parser.jay (delegate_declaration): we did not used to compute
972 the delegate name correctly for void delegates.
974 2002-03-24 Miguel de Icaza <miguel@ximian.com>
976 * rootcontext.cs (RootContext): Init the interface_resolve_order
977 and type_container_resolve_order always.
979 (ResolveCore, BootstrapCorlib_ResolveClass,
980 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
981 compiler when compiling with --nostdlib
983 * class.cs (TypeContainer.DefineType): Check that our parent is
984 not null. This test is most important when we are bootstraping
987 * codegen.cs: Split out the symbol writing code.
989 2002-03-25 Martin Baulig <martin@gnome.org>
991 * driver.cs (-g): Made -g an alias for --debug.
993 2002-03-24 Martin Baulig <martin@gnome.org>
995 * codegen.cs (SymbolWriter): New public variable. Returns the
996 current symbol writer.
997 (CodeGen): Added `bool want_debugging_support' argument to the
998 constructor. If true, tell the ModuleBuild that we want debugging
999 support and ask it for the ISymbolWriter.
1000 (Save): If we have a symbol writer, call it's Close() method after
1001 saving the assembly.
1003 * driver.c (--debug): New command line argument to create a
1004 debugger information file.
1006 * location.cs (SymbolDocument): New public property. Returns an
1007 ISymbolDocumentWriter object for the current source file or null
1008 if we don't have a symbol writer.
1010 2002-03-21 Miguel de Icaza <miguel@ximian.com>
1012 * driver.cs (LoadAssembly): Correctly return when all the paths
1013 have been tried and not before.
1015 * statement.cs (Switch.Emit): return the actual coverage for this
1016 statement (returns/not-returns)
1018 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
1019 switch of the statement if we are the last switch section. That
1020 kills two problems: try/catch problems (we used to emit an empty
1021 nop at the end) and switch statements where all branches would
1024 2002-03-19 Miguel de Icaza <miguel@ximian.com>
1026 * driver.cs: Add default assemblies (the equivalent to the
1027 Microsoft CSC.RSP file)
1029 * cs-tokenizer.cs: When updating `cols and setting it to zero,
1030 also update tokens_seen and set it to false.
1032 * driver.cs: Implement --recurse for Mike.
1034 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
1035 correctly splitting out the paths.
1037 2002-03-18 Miguel de Icaza <miguel@ximian.com>
1039 * interface.cs (Interface.PopulateProperty): Instead of using
1040 `parent' as the declaration space for the set parameters, use
1043 * support.cs (InternalParameters): InternalParameters constructor
1044 takes a DeclSpace instead of a TypeContainer.
1046 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
1047 types are being initialized, load the address of it before calling
1050 (New): Provide a mechanism to disable the generation of local
1051 value type temporaries when the caller will be providing us with
1052 an address to store it.
1054 (ArrayCreation.EmitDynamicInitializers): Use it.
1056 2002-03-17 Miguel de Icaza <miguel@ximian.com>
1058 * expression.cs (Invocation.EmitArguments): Only probe for array
1059 property if there is more than one argument. Sorry about that.
1061 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
1064 * class.cs (Method.LabelParameters): Fix incorrect code path that
1065 prevented the `ParamArrayAttribute' from being applied to the
1068 2002-03-16 Miguel de Icaza <miguel@ximian.com>
1070 * support.cs (ReflectionParameters): Correctly compute whether the
1071 last argument is a params array. Fixes the problem with
1074 * typemanager.cs: Make the assemblies array always be non-null
1075 (empty, but non-null)
1077 * tree.cs (RecordDecl): New function that abstracts the recording
1078 of names. This reports error 101, and provides a pointer to the
1079 previous declaration. Fixes a crash in the compiler.
1081 * cs-parser.jay (constructor_declaration): Update to new grammar,
1082 and provide a constructor_body that can be empty.
1084 2002-03-15 Miguel de Icaza <miguel@ximian.com>
1086 * driver.cs: Add support for --resources.
1088 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
1089 Make all types for the various array helper methods be integer.
1091 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
1092 CheckState to ConvCast.
1094 (ConvCast): Now it takes a `checked' state argument, to avoid
1095 depending on the emit context for the conversion, and just using
1096 the resolve time setting.
1098 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
1099 instead of Invocation.EmitArguments. We do not emit the original
1100 arguments, instead we emit those which have been converted to
1101 unsigned int expressions.
1103 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
1105 * codegen.cs: ditto.
1107 * expression.cs (LocalVariableReference): Drop the use of the
1108 Store function that depended on the variable index.
1110 * statement.cs (VariableInfo): Drop the `Idx' property from this
1111 class, as this is not taking into account the indexes for
1112 temporaries tat we generate during the execution, getting the
1115 * class.cs: First emit class initializers, then call the parent
1118 * expression.cs (Binary): Fix opcode emision.
1119 (UnaryMutator.EmitCode): Support checked code generation
1121 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
1122 matches for events for both the Static and Instance scans,
1123 pointing to the same element. Fix that.
1125 2002-03-14 Miguel de Icaza <miguel@ximian.com>
1127 * rootcontext.cs (ResolveTree): Always set the
1128 interface_resolve_order, because nested interfaces will be calling
1131 * class.cs (GetInterfaceOrClass): Track the same resolution
1132 process used by TypeManager.LookupType. This fixes the nested
1133 type lookups in class declarations (separate path from
1136 (TypeContainer.DefineType): Also define nested interfaces.
1137 (TypeContainer.RegisterOrder): New public function used to
1138 register the order in which child interfaces need to be closed.
1140 Nested interfaces need to be closed after their parents have been
1143 * interface.cs (InterfaceAttr): Put all the logic for computing
1144 the interface attribute here.
1146 (DefineInterface): Register our interface order with the
1147 RootContext or with the TypeContainer depending on the case.
1149 2002-03-12 Miguel de Icaza <miguel@ximian.com>
1151 * cs-parser.jay: rework foreach statement to work with the new
1152 changes to the policy on SimpleNames.
1154 * report.cs: support Stacktrace on warnings as well.
1156 * makefile: drop --unsafe and /unsafe from the compile.
1158 2002-03-13 Ravi Pratap <ravi@ximian.com>
1160 * ecore.cs (StandardConversionExists): Modify to take an Expression
1161 as the first parameter. Ensure we do null -> reference type conversion
1164 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
1165 temporary Expression objects.
1167 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
1169 * interface.cs: workaround bug in method overloading resolution
1170 (there is already a bugzilla bug for it).
1172 2002-03-12 Miguel de Icaza <miguel@ximian.com>
1174 We could also solve this problem by having a separate path for
1175 performing type lookups, instead of DoResolve, we could have a
1176 ResolveType entry point, and only participating pieces of the
1177 production (simplename, deref, array) would implement this.
1179 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
1180 signal SimpleName to only resolve type names and not attempt to
1181 resolve anything else.
1183 * expression.cs (Cast): Set the flag.
1185 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
1187 * class.cs: Only report 108 if there is no `new' modifier.
1189 * cs-parser.jay: rework foreach statement to work with the new
1190 changes to the policy on SimpleNames.
1192 * report.cs: support Stacktrace on warnings as well.
1194 * makefile: drop --unsafe and /unsafe from the compile.
1196 2002-03-11 Miguel de Icaza <miguel@ximian.com>
1198 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1199 lookups here, instead of doing that at parse time. This means
1200 that our grammar will not introduce `LocalVariableReferences' as
1201 expressions at this point. That solves the problem of code like
1209 This is only half the fix. The full fix requires parameters to
1210 also be handled in this way.
1212 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
1213 makes the use more obvious of the DeclSpace. The
1214 ec.TypeContainer.TypeBuilder is now only used to pull the
1217 My theory is that I can get rid of the TypeBuilder completely from
1218 the EmitContext, and have typecasts where it is used (from
1219 DeclSpace to where it matters).
1221 The only pending problem is that the code that implements Aliases
1222 is on TypeContainer, and probably should go in DeclSpace.
1224 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1225 lookups here, instead of doing that at parse time. This means
1226 that our grammar will not introduce `LocalVariableReferences' as
1227 expressions at this point. That solves the problem of code like
1235 This is only half the fix. The full fix requires parameters to
1236 also be handled in this way.
1238 * class.cs (Property.DefineMethod): When implementing an interface
1239 method, set newslot, when implementing an abstract method, do not
1240 set the flag (before we tried never setting it, or always setting
1241 it, which is the difference).
1242 (Indexer.DefineMethod): same.
1243 (Method.DefineMethod): same.
1245 * ecore.cs: Only set the status used flag if we get back a Field.
1247 * attribute.cs: Temporary hack, so Paolo can keep working.
1249 2002-03-08 Ravi Pratap <ravi@ximian.com>
1251 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
1252 the unmanaged type in the case we have a MarshalAs attribute.
1254 (Resolve): Handle the case when we are parsing the special MarshalAs
1255 attribute [we need to store the unmanaged type to use later]
1257 * typemanager.cs (marshal_as_attr_type): Built in type for the
1258 MarshalAs Attribute.
1260 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
1261 on parameters and accordingly set the marshalling info.
1263 2002-03-09 Miguel de Icaza <miguel@ximian.com>
1265 * class.cs: Optimizing slightly by removing redundant code after
1266 we switched to the `NoTypes' return value.
1267 (Property.DefineMethod): use NoTypes here too.
1269 This fixes the bug I introduced in my last batch of changes.
1271 2002-03-05 Ravi Pratap <ravi@ximian.com>
1273 * tree.cs (RecordEnum): Add. We now keep track of enums too.
1275 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
1276 Enums since those are types too.
1278 * cs-parser.jay (enum_declaration): Record enums as we parse them.
1280 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
1281 thanks to a call during the lookup process.
1283 2002-03-07 Miguel de Icaza <miguel@ximian.com>
1285 * statement.cs (Foreach): Lots of work to accomodate a particular
1286 kind of foreach statement that I had not kept in mind. It is
1287 possible to have foreachs on classes that provide a GetEnumerator
1288 method that return objects that implement the "pattern" for using
1289 a foreach, there is no need to support GetEnumerator
1292 This is needed to compile nant.
1294 * decl.cs: Only report 114 if the member is not `Finalize' and if
1295 the warning level is at least 2.
1297 * class.cs: Moved the compare function from Method to
1300 (MethodSignature.InheritableMemberSignatureCompare): Add new
1301 filter function that is used to extract inheritable methods from a
1304 (Method.Define): Use the new `inheritable_method_signature_filter'
1307 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
1310 2002-03-06 Miguel de Icaza <miguel@ximian.com>
1312 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
1314 * cs-parser.jay: Add opt_semicolon to the interface declaration.
1316 * expression.cs: Pass location information to
1317 ConvertImplicitStandard.
1319 * class.cs: Added debugging code to track return values from
1322 2002-03-05 Miguel de Icaza <miguel@ximian.com>
1324 * expression.cs (Is.DoResolve): If either side of the `is' is an
1325 interface, do not flag the warning.
1327 * ecore.cs (ImplicitReferenceConversion): We need a separate test
1330 * report.cs: Allow for --fatal to be used with --probe.
1332 * typemanager.cs (NoTypes): Move the definition for the empty Type
1335 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
1337 (TypeContainer.DefineProxy): New function used to proxy to parent
1338 implementations when implementing interfaces.
1339 (TypeContainer.ParentImplements): used to lookup if our parent
1340 implements a public function that is required by an interface.
1341 (TypeContainer.VerifyPendingMethods): Hook this up.
1343 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
1344 `modules' and `assemblies' arraylists into arrays. We only grow
1345 these are the very early start up of the program, so this improves
1346 the speedof LookupType (nicely measured).
1348 * expression.cs (MakeByteBlob): Replaced unsafe code with
1349 BitConverter, as suggested by Paolo.
1351 * cfold.cs (ConstantFold.Binary): Special case: perform constant
1352 folding of string concatenation, but if either side is a string,
1353 and the other is not, then return null, and let the runtime use
1354 the concatenation on the string plus the object (using
1357 2002-03-04 Miguel de Icaza <miguel@ximian.com>
1359 Constant Folding has been implemented now.
1361 * expression.cs (Unary.Reduce): Do not throw an exception, catch
1362 the error instead on types that are not supported in one's
1365 * constant.cs (Constant and all children): New set of functions to
1366 perform implict and explicit conversions.
1368 * ecore.cs (EnumConstant): Implement the new functions to perform
1369 conversion by proxying to the child expression.
1371 * codegen.cs: (ConstantCheckState): Constant evaluation has its
1372 own separate setting that can not be turned off from the command
1373 line using --unchecked or --checked and is only controlled using
1374 the checked/unchecked statements and expressions. This setting is
1375 used by the constant folder to flag errors.
1377 * expression.cs (CheckedExpr, UncheckedExpr): Set the
1378 ConstantCheckState as well.
1380 During Resolve, they also have to flag the state, because the
1381 constant folder runs completely in the Resolve phase.
1383 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
1386 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1388 * cfold.cs: New file, this file contains the constant folder.
1390 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
1391 argument to track whether we are using the resulting address to
1392 load or store a value and provide better error messages.
1394 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
1395 new AddressOf arguments.
1397 * statement.cs (Foreach.EmitCollectionForeach): Update
1399 * expression.cs (Argument.Emit): Call AddressOf with proper
1400 arguments to track usage.
1402 (New.DoEmit): Call AddressOf with new arguments.
1404 (Unary.Emit): Adjust AddressOf call.
1406 2002-03-01 Ravi Pratap <ravi@ximian.com>
1408 * cs-parser.jay (member_access): Change the case for pre-defined types
1409 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
1412 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
1415 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
1416 essentially like methods and apply attributes like MethodImplOptions to them too.
1418 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
1421 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
1422 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
1425 * Update code everywhere accordingly.
1427 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
1429 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
1431 2002-02-28 Ravi Pratap <ravi@ximian.com>
1433 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
1434 try performing lookups against those instead of jumping straight into using
1435 the 'using' clauses.
1437 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
1439 (LookupType): Perform lookups in implicit parents too.
1441 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
1442 sequence as RootContext.LookupType.
1444 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
1445 the various cases of namespace lookups into this method.
1447 2002-03-01 Miguel de Icaza <miguel@ximian.com>
1449 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
1450 in positional arguments)
1452 * class.cs (Operator): Update the AllowedModifiers to contain
1455 * cs-parser.jay: Update operator declaration to allow for the
1456 operator body to be empty.
1458 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
1461 2002-02-27 Miguel de Icaza <miguel@ximian.com>
1463 * class.cs (Method.Emit): Label parameters.
1465 * driver.cs: Return 1 or 0 as the program exit code.
1467 2002-02-26 Miguel de Icaza <miguel@ximian.com>
1469 * expression.cs: Special case the `null' object when trying to
1470 auto-compute the type, as anything can be explicitly converted to
1473 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
1474 spotting this Paolo.
1476 (Expression.ImplicitNumericConversion): Perform comparissions of
1477 the type using the underlying type in the case of an enumeration
1478 rather than using the enumeration type for the compare.
1480 Cope with the underlying == type case, which is not possible to
1483 (Expression.ConvertNumericExplicit): Perform comparissions of
1484 the type using the underlying type in the case of an enumeration
1485 rather than using the enumeration type for the compare.
1487 * driver.cs: If the user does not supply an extension, assume .exe
1489 * cs-parser.jay (if_statement): Rewrote so that we can track the
1490 location for the if statement.
1492 * expression.cs (Binary.ConstantFold): Only concat strings when
1493 the operation is "+", not everything ;-)
1495 * statement.cs (Statement.EmitBoolExpression): Take a location
1497 (If, While, Do): Track location.
1499 * expression.cs (Binary.ResolveOperator): In the object + string
1500 case, I was missing a call to ConvertImplicit
1502 2002-02-25 Ravi Pratap <ravi@ximian.com>
1504 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
1505 Location arguments. Ensure we use RootContext.LookupType to do our work
1506 and not try to do a direct Type.GetType and ModuleBuilder.GetType
1508 * interface.cs (PopulateMethod): Handle the type of the parameter being
1511 * expression.cs (Invocation.BetterFunction): Handle the case when we
1512 have a params method with no fixed arguments and a call is made with no
1515 2002-02-25 Miguel de Icaza <miguel@ximian.com>
1517 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
1518 the verbatim-string-literal
1520 * support.cs (InternalParameters.ParameterModifier): handle null
1522 (InternalParameters.ParameterType): ditto.
1524 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
1525 duplicating the name of the variable parameter.
1526 (GetParameterByName): Fix bug where we were not looking up array
1527 paramters if they were the only present (thanks Paolo!).
1528 (GetParameterInfo): We only have an empty set of types if both
1529 fixed and array are set to null.
1530 (GetParameterInfo-idx): Handle FixedParameter == null
1532 * cs-parser.jay: Handle the case where there is no catch
1533 statements (missing null test).
1535 2002-02-22 Miguel de Icaza <miguel@ximian.com>
1537 * driver.cs (MainDriver): Be conservative on our command line
1540 Catch DirectoryNotFoundException when calling GetFiles.
1542 (SplitPathAndPattern): Used to split the input specification into
1543 a path and a pattern that we can feed to Directory.GetFiles.
1545 2002-02-21 Miguel de Icaza <miguel@ximian.com>
1547 * statement.cs (Fixed): Implement the last case of the Fixed
1548 statement (string handling).
1550 * expression.cs (StringPtr): New class used to return a char * to
1551 a string; Used by the Fixed statement.
1553 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
1555 * expression.cs (Binary.ResolveOperator): Remove redundant
1556 MemberLookup pn parent type.
1557 Optimize union call, we do not need a union if the types are the same.
1558 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
1561 Specialize the use of MemberLookup everywhere, instead of using
1562 the default settings.
1564 (StackAlloc): Implement stackalloc keyword.
1566 * cs-parser.jay: Add rule to parse stackalloc.
1568 * driver.cs: Handle /h, /help, /?
1570 * expression.cs (MakeByteBlob): Removed the hacks we had in place
1571 before we supported unsafe code.
1573 * makefile: add --unsafe to the self compilation of mcs.
1575 2002-02-20 Miguel de Icaza <miguel@ximian.com>
1577 * expression.cs (PointerArithmetic): New class that is used to
1578 perform pointer arithmetic.
1579 (Binary.Resolve): Handle pointer arithmetic
1580 Handle pointer comparission.
1581 (ArrayPtr): Utility expression class that is used to take the
1582 address of an array.
1584 (ElementAccess): Implement array access for pointers
1586 * statement.cs (Fixed): Implement fixed statement for arrays, we
1587 are missing one more case before we are done.
1589 * expression.cs (Indirection): Implement EmitAssign and set the
1590 ExprClass to Variable. This allows pointer dereferences to be
1591 treated as variables, and to have values assigned to them.
1593 * ecore.cs (Expression.StoreFromPtr): New utility function to
1594 store values dereferencing.
1596 2002-02-20 Ravi Pratap <ravi@ximian.com>
1598 * expression.cs (Binary.ResolveOperator): Ensure that we are
1599 not trying to operate on a void type - this fixes the reported
1602 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
1603 the parent implementation is sealed.
1605 * ../errors/cs0239.cs : Add.
1607 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
1609 * typemanager.cs (unverifiable_code_type): Corresponds to
1610 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
1611 which have unsafe code in them.
1613 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
1616 2002-02-19 Miguel de Icaza <miguel@ximian.com>
1618 * cs-tokenizer.cs: Add support for @"litreal strings"
1620 Make tokenizer accept pre-processor directives
1621 on any column (remove the old C-like limitation).
1623 * rootcontext.cs (EmitCode): Emit any global attributes.
1624 (AddGlobalAttributes): Used to keep track of assembly attributes.
1626 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
1628 * cs-parser.jay: Add support for global attributes.
1630 2002-02-17 Miguel de Icaza <miguel@ximian.com>
1632 * expression.cs (Indirection): New helper class. Unary will
1633 create Indirection classes to be able to implement the
1634 IMemoryLocation interface on it.
1636 2002-02-16 Miguel de Icaza <miguel@ximian.com>
1638 * cs-parser.jay (fixed_statement): reference the right statement.
1640 * statement.cs (Fixed.Emit): Finish implementing the fixed
1641 statement for the &x case.
1643 2002-02-14 Miguel de Icaza <miguel@ximian.com>
1645 * class.cs (Property.Define, Method.Define): Remove newslot when
1648 * modifiers.cs: My use of NewSlot when `Abstract' was set was
1649 wrong. NewSlot should only be used if the `new' keyword is present.
1651 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
1652 locating our system dir. Sorry about this.
1654 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1656 * driver.cs (GetSystemDir): Compute correctly the location of our
1657 system assemblies. I was using the compiler directory instead of
1658 the library directory.
1660 2002-02-13 Ravi Pratap <ravi@ximian.com>
1662 * expression.cs (BetterFunction): Put back in what Miguel commented out
1663 since it is the correct fix. The problem is elsewhere ;-)
1665 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
1666 parameters of the parms method are themselves compatible or not !
1668 (StandardConversionExists): Fix very dangerous bug where we were forgetting
1669 to check that a class implements an interface before saying that an implicit
1670 conversion was allowed. Use ImplementsInterface to do the checking.
1672 2002-02-13 Miguel de Icaza <miguel@ximian.com>
1674 * class.cs (Method.Define): Track whether we are an explicit
1675 implementation or not. And only call DefineMethodOverride if we
1676 are an explicit implementation.
1678 (Property.DefineMethod): Ditto.
1680 2002-02-11 Ravi Pratap <ravi@ximian.com>
1682 * expression.cs (BetterFunction): Catch hideous bug which was
1683 preventing us from detecting ambiguous calls due to implicit casts i.e
1686 2002-01-29 Miguel de Icaza <miguel@ximian.com>
1688 * support.cs (Pair): Remove un-needed method. I figured why I was
1689 getting the error in cs-parser.jay, the variable in a foreach loop
1690 is readonly, and the compiler does not really treat this as a variable.
1692 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
1693 instead of EQUALS in grammar.
1695 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
1697 * expression.cs (Unary.DoResolve): Check whether the argument is
1700 2002-01-28 Miguel de Icaza <miguel@ximian.com>
1702 * support.cs: Api for Pair to set a value. Despite the fact that
1703 the variables are public the MS C# compiler refuses to compile
1704 code that accesses the field if the variable is part of a foreach
1707 * statement.cs (Fixed): Begin implementation of the fixed
1710 (Block.AddVariable): Return the VariableInfo on success and null
1711 on failure instead of true/false.
1713 * cs-parser.jay (foreach): Catch errors on variables already
1714 defined (we were ignoring this value before) and properly unwind
1717 (fixed_statement): grammar for the fixed statement.
1719 2002-01-25 Miguel de Icaza <miguel@ximian.com>
1721 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
1722 pointer types to be incretemented.
1724 (SizeOf): Implement.
1726 * cs-parser.jay (pointer_member_access): Implement
1727 expr->IDENTIFIER production.
1729 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
1730 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
1733 (Unary): Implement indirection.
1735 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
1736 use in non-unsafe context).
1738 (SimpleName.DoResolve): Check for pointers in field access on safe
1741 (Expression.LoadFromPtr): Factor the load-indirect code in this
1742 function. This was duplicated in UnboxCast and ParameterReference
1744 2002-01-24 Miguel de Icaza <miguel@ximian.com>
1746 * expression.cs (ComposedCast): report an error if a pointer cast
1747 is used in a safe region.
1749 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
1750 pointer type casts in unsafe context.
1752 * codegen.cs (EmitContext): Set up IsUnsafe.
1754 * cs-parser.jay (non_expression_type): Add productions for pointer
1757 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
1758 code. We should not use force into static mode if the method is
1759 not virtual. Fixes bug in MIS
1761 * statement.cs (Do.Emit, While.Emit, For.Emit,
1762 Statement.EmitBoolExpression): Add support to Do and While to
1763 propagate infinite loop as `I do return' semantics.
1765 Improve the For case to also test for boolean constants.
1767 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
1768 to the list of attributes we can add.
1770 Remove `EmitContext' argument.
1772 * class.cs (Method.Define): Apply parameter attributes.
1773 (Constructor.Define): Apply parameter attributes.
1774 (MethodCore.LabelParameters): Move here the core of labeling
1777 * support.cs (ReflectionParameters.ParameterModifier,
1778 InternalParameters.ParameterModifier): Use IsByRef on the type and
1779 only return the OUT bit for these parameters instead of in/out/ref
1782 This is because I miss-understood things. The ParameterInfo.IsIn
1783 and IsOut represent whether the parameter has the [In] and [Out]
1786 2002-01-22 Miguel de Icaza <miguel@ximian.com>
1788 * ecore.cs (FieldExpr.Emit): Release temporaries.
1790 * assign.cs (LocalTemporary.Release): new function.
1792 * codegen.cs (EmitContext.GetTemporaryStorage,
1793 EmitContext.FreeTemporaryStorage): Rework the way we deal with
1794 temporary storage. Now we can "put back" localbuilders when we
1797 2002-01-21 Miguel de Icaza <miguel@ximian.com>
1799 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
1800 need to make a copy of the variable to generate verifiable code.
1802 2002-01-19 Miguel de Icaza <miguel@ximian.com>
1804 * driver.cs: Compute dynamically the system directory.
1806 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
1807 Slower, but more generally useful. Used by the abstract
1808 registering implementation.
1810 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
1811 the rules for the special rule on Type/instances. First check if
1812 we have the same name, and if so, try that special static path
1813 rather than the instance path.
1815 2002-01-18 Miguel de Icaza <miguel@ximian.com>
1817 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
1820 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
1821 Enum, ValueType, Delegate or Array for non-corlib compiles.
1823 * cs-tokenizer.cs: Catch long identifiers (645)
1825 * typemanager.cs (IndexerPropetyName): Ravi never tested this
1828 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
1829 fix, we were returning too early, so we were not registering
1830 pending methods from abstract classes.
1832 Do not register pending methods if the class is abstract.
1834 * expression.cs (Conditional.DoResolve): Report circular implicit
1835 conversions when we neecd to compute it for conditional
1838 (Is.DoResolve): If the expression is always of the provided type,
1839 flag warning 183. If the expression can not ever be of the
1840 provided type flag warning 184.
1842 * class.cs: Catch 169 as well.
1844 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
1847 2002-01-18 Nick Drochak <ndrochak@gol.com>
1849 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
1851 2002-01-17 Miguel de Icaza <miguel@ximian.com>
1853 * interface.cs: (PopulateMethod): Check for pointers being defined
1854 only if the unsafe context is active.
1855 (PopulateProperty): ditto.
1856 (PopulateIndexer): ditto.
1858 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
1859 specified. If pointers are present, make sure that they are
1860 present in an unsafe context.
1861 (Constructor, Constructor.Define): ditto.
1862 (Field, Field.Define): ditto.
1863 (Property, Property.Define): ditto.
1864 (Event, Event.Define): ditto.
1866 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
1867 hashtable if there are classes or structs defined.
1869 * expression.cs (LocalVariableReference.DoResolve): Simplify this
1870 code, as the constant resolution moved.
1872 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
1873 the metadata, so we can flag error 133.
1875 * decl.cs (MemberCore.UnsafeOK): New function to test that a
1876 pointer is being declared in an unsafe context.
1878 2002-01-16 Miguel de Icaza <miguel@ximian.com>
1880 * modifiers.cs (Modifiers.Check): Require a Location argument.
1881 Report error 227 for Unsafe use.
1883 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
1885 * statement.cs (For.Emit): If the test is null, then report that
1886 we do `return', as we wont reach anything afterwards.
1888 (Switch.SwitchGoverningType): Track the expression that matched
1891 * driver.cs: Allow negative numbers as an error code to flag.
1893 * cs-parser.jay: Handle 1551.
1895 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
1897 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1899 * cs-parser.jay: Report 1518 (type declaration can only contain
1900 class, struct, interface, enum or delegate)
1902 (switch_label): Report 1523 (keywords `case' or `default' must
1905 (opt_switch_sections): Report 1522 (empty switch)
1907 * driver.cs: Report 1515 (response file specified multiple times)
1908 Report 1516 (Source file specified multiple times).
1910 * expression.cs (Argument.Resolve): Signal 1510
1912 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
1913 access not allowed in static code)
1915 2002-01-11 Ravi Pratap <ravi@ximian.com>
1917 * typemanager.cs (IsPointerType): Utility method which we are going
1920 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
1921 the object type, so we take care of that.
1923 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
1925 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
1926 added to non-params parameters :-)
1928 * typemanager.cs (CSharpName): Include 'void' type too.
1930 (void_ptr_type): Include in the set of core types.
1932 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
1935 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
1938 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
1939 completely forgotten about it.
1941 2002-01-10 Ravi Pratap <ravi@ximian.com>
1943 * cs-parser.jay (pointer_type): Add. This begins our implementation
1944 of parsing rules for unsafe code.
1946 (unsafe_statement): Implement.
1948 (embedded_statement): Modify to include the above.
1950 * statement.cs (Unsafe): Implement new class for unsafe blocks.
1952 * codegen.cs (EmitContext.InUnsafe): Add. This determines
1953 if the current context is an unsafe one.
1955 * cs-parser.jay (local_variable_pointer_type): Since local variable types
1956 are handled differently, we need separate rules for them.
1958 (local_variable_declaration): Update to use local_variable_pointer_type
1959 to allow variable declarations of unmanaged pointer types.
1961 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
1964 * ../errors/cs0214.cs : Add.
1966 2002-01-16 Nick Drochak <ndrochak@gol.com>
1968 * makefile: remove 'response' file when cleaning.
1970 2002-01-15 Miguel de Icaza <miguel@ximian.com>
1972 * cs-parser.jay: Report 1524.
1974 2002-01-14 Miguel de Icaza <miguel@ximian.com>
1976 * typemanager.cs (RegisterMethod): drop checking if we have
1977 registered this from here
1979 2002-01-12 Miguel de Icaza <miguel@ximian.com>
1981 * class.cs (Method.EmitDestructor): Implement calling our base
1984 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
1987 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
1988 this routine and will wrap the call in a try/catch block. Deal
1991 2002-01-11 Miguel de Icaza <miguel@ximian.com>
1993 * ecore.cs (Expression.MemberLookup): instead of taking a
1994 parameter `same_type' that was used to tell whether we could
1995 access private members we compute our containing type from the
1998 (FieldExpr): Added partial support for volatile fields. This does
1999 not work for volatile fields exposed from assemblies, as I can not
2000 figure out how to extract the modreq from it.
2002 Updated all the source files to use this.
2004 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
2005 because it is referenced by MemberLookup very often.
2007 2002-01-09 Ravi Pratap <ravi@ximian.com>
2009 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
2010 TypeBuilder.GetCustomAttributes to retrieve what we need.
2012 Get rid of redundant default_member_attr_type as this is the same as
2013 default_member_type which already exists.
2015 * interface.cs, attribute.cs : Update accordingly.
2017 2002-01-08 Miguel de Icaza <miguel@ximian.com>
2019 * typemanager.cs: Enable IndexerPropertyName again. It does not
2020 work for TYpeBuilders though. Ravi, can you please fix this?
2022 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
2024 * expression.cs (Argument.Emit): Handle the case of ref objects
2025 being passed to ref functions;
2027 (ParameterReference.EmitLoad): Loads the content of the pointer
2028 without dereferencing.
2030 2002-01-07 Miguel de Icaza <miguel@ximian.com>
2032 * cs-tokenizer.cs: Implemented the pre-processing expressions.
2034 2002-01-08 Ravi Pratap <ravi@ximian.com>
2036 * class.cs (Indexer.DefineMethod): Incorporate the interface
2037 type in the name of the method if we are doing explicit interface
2040 * expression.cs (ConversionExists): Remove as it is completely obsolete.
2042 (BetterConversion): Fix extremely trivial bug where we were referring to
2043 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
2046 * ../errors/bug16.cs : Add although we have fixed it.
2048 2002-01-07 Miguel de Icaza <miguel@ximian.com>
2050 * expression.cs (BaseIndexer): Begin implementation.
2052 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
2054 * cs-parser.jay (indexer_declarator): Use qualified_identifier
2055 production directly to remove a shift/reduce, and implement
2056 explicit interface implementation.
2058 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
2059 after a floating point suffix.
2061 * expression.cs (DoNumericPromotions): Improved the conversion for
2062 uint/uint. If we have a constant, we avoid doing a typecast to a
2065 * class.cs (Indexer): Implement explicit interface implementation
2068 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
2070 * class.cs: make the default instance constructor public and hidebysig.
2072 2001-01-03 Ravi Pratap <ravi@ximian.com>
2074 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
2075 so we can call it from elsewhere.
2077 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
2078 we emit it internally if the class has a defined indexer; otherwise the user
2079 emits it by decorating the class definition with the DefaultMemberAttribute.
2081 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
2082 attribute is not used on a type which defines an indexer.
2084 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
2085 character when we skip whitespace.
2087 * ../errors/cs0646.cs : Add.
2089 2002-01-03 Miguel de Icaza <miguel@ximian.com>
2091 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
2094 * makefile: Add practical target `mcs3.exe' which builds the third
2095 generation compiler.
2097 * expression.cs (New): Fix structures constructor calling.
2099 * class.cs (Property, Method, Indexer): Emit Final flag on the
2100 method if we are an interface implementation and we are not
2103 * ecore.cs (PropertyExpr): New public field `IsBase', tells
2104 whether this property is referencing a `base' method.
2106 * expression.cs (Invocation.EmitCall): take an extra argument:
2107 is_base, this is used to determine whether the `call' or
2108 `callvirt' opcode should be used.
2111 * delegate.cs: update EmitCall.
2113 * class.cs (Method.Define): Set NewSlot for the cases where we are
2114 not implementing an interface method.
2116 (Property.Define): ditto.
2118 2002-01-02 Miguel de Icaza <miguel@ximian.com>
2120 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
2121 'r'. Allows mcs to parse itself fully.
2123 2002-01-02 Ravi Pratap <ravi@ximian.com>
2125 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
2126 of the number of initializers that require the InitializeArray method.
2128 (CheckIndices): Store the Expression in all cases - not the plain value. Also
2129 update the above field where necessary.
2131 (MakeByteBlob): Update accordingly.
2133 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
2136 (EmitDynamicInitializers): Update in accordance with the new optimization.
2138 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
2139 same OpCode applies.
2141 * cs-parser.jay : Fix some glaring errors I introduced.
2143 2002-01-01 Ravi Pratap <ravi@ximian.com>
2145 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
2146 so that we can check for name clashes there too.
2148 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
2149 for interface indexers.
2151 * interfaces.cs (Define): Emit the default member attribute.
2153 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
2154 variable was being referred to while setting the value ;-)
2156 2002-01-01 Miguel de Icaza <miguel@ximian.com>
2158 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
2159 byte-by-byte information when we know the data is zero.
2161 Make the block always a multiple of 4, because
2162 DefineInitializedData has a bug.
2164 * assign.cs: Fix, we should assign from the temporary, not from
2167 * expression.cs (MakeByteBlob): Fix my incorrect code.
2169 2001-12-31 Miguel de Icaza <miguel@ximian.com>
2171 * typemanager.cs (EnumToUnderlying): This function is used to get
2172 the underlying type from an enumeration, because it does not
2175 * constant.cs: Use the I4_S form for values between -128 and 127.
2177 * statement.cs (Block.LookupLabel): Looks up a label.
2178 (Block): Drop support for labeled blocks.
2180 (LabeledStatement): New kind of statement that represents a label
2183 (Goto): Finally implement this bad boy.
2185 * cs-parser.jay: Update to reflect new mechanism to implement
2188 2001-12-30 Miguel de Icaza <miguel@ximian.com>
2190 * codegen.cs (EmitContext.This): a codegen property that keeps the
2191 a single instance of this instead of creating many different this
2194 * delegate.cs (Delegate.DoResolve): Update to use the property;
2196 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
2198 * expression.cs (BaseAccess.DoResolve): Ditto.
2200 2001-12-29 Ravi Pratap <ravi@ximian.com>
2202 * typemanager.cs (methodimpl_attr_type): Add to hold the type
2203 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
2205 (InitCoreTypes): Update accordingly.
2207 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
2208 so we can quickly store the state.
2210 (ApplyAttributes): Set the correct implementation flags
2211 for InternalCall methods.
2213 2001-12-29 Miguel de Icaza <miguel@ximian.com>
2215 * expression.cs (EmitCall): if a method is not virtual, then do
2216 not use callvirt on it.
2218 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
2219 user defined stuff) requires the use of stobj, which takes an
2220 address on the stack instead of an array and an index. So emit
2221 the Ldelema operation for it.
2223 (EmitStoreOpcode): Use stobj for valuetypes.
2225 (UnaryMutator.EmitCode): Use the right 1 value depending on
2226 whether we are dealing with int64/uint64, float or doubles.
2228 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
2229 constructors that I implemented last night.
2231 (Constructor.IsDefault): Fix to work properly for static
2234 * cs-parser.jay (CheckDef): report method signature errors.
2235 Update error number 103 to be 132.
2237 * decl.cs: New AdditionResult enumeration value: MethodExists.
2238 Although we do this check for methods later on in the semantic
2239 analysis, catching repeated default constructors is so easy that
2240 we catch these here.
2242 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
2245 (ParameterReference.EmitAssign, Emit): handle
2248 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
2249 (ArrayAccess.EmitStoreOpcode): ditto.
2251 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
2253 * expression.cs (MakeByteBlob): Complete all the missing types
2254 (uint, short, ushort, byte, sbyte)
2256 * class.cs: Only init instance field initializers on instance
2259 Rename `constructors' to instance_constructors.
2261 (TypeContainer.AddConstructor): Only add constructors to the list
2262 if it is not static.
2264 Make sure that we handle default_static_constructor independently
2265 everywhere where we handle instance_constructors
2267 2001-12-28 Miguel de Icaza <miguel@ximian.com>
2269 * class.cs: Do not lookup or create a base initializer for a
2272 (ConstructorInitializer.Resolve): use the proper type to lookup
2275 * cs-parser.jay: Report error 1585 (modifiers between type and name).
2277 * enum.cs, interface.cs: Remove CloseType, this is taken care by
2280 * decl.cs: CloseType is now an virtual method, the default
2281 implementation just closes this type.
2283 2001-12-28 Ravi Pratap <ravi@ximian.com>
2285 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
2286 to PreserveSig by default. Also emit HideBySig on such methods.
2288 Basically, set the defaults to standard values.
2290 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
2291 argument, if candidate is better, it can't be worse than the best !
2293 (Invocation): Re-write bits to differentiate between methods being
2294 applicable in their expanded form and their normal form - for params
2297 Get rid of use_standard everywhere as only standard conversions are allowed
2298 in overload resolution.
2300 More spec conformance.
2302 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2304 * driver.cs: Add --timestamp, to see where the compiler spends
2307 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
2308 `this' in static code.
2310 (SimpleName.DoResolve): Implement in terms of a helper function
2311 that allows static-references to be passed upstream to
2314 (Expression.ResolveWithSimpleName): Resolve specially simple
2315 names when called by MemberAccess to implement the special
2318 (Expression.ImplicitReferenceConversion): Handle conversions from
2319 Null to reference types before others, as Null's type is
2322 * expression.cs (Invocation.EmitCall): Handle the special case of
2323 calling methods declared on a reference type from a ValueType
2324 (Base classes System.Object and System.Enum)
2326 (MemberAccess.Resolve): Only perform lookups on Enumerations if
2327 the left hand side is a TypeExpr, not on every enumeration.
2329 (Binary.Resolve): If types are reference types, then do a cast to
2330 object on operators != and == of both arguments.
2332 * typemanager.cs (FindMembers): Extract instance and static
2333 members if requested.
2335 * interface.cs (PopulateProperty): Use void_type instead of null
2336 as the return type for the setter method.
2338 (PopulateIndexer): ditto.
2340 2001-12-27 Ravi Pratap <ravi@ximian.com>
2342 * support.cs (ReflectionParameters): Fix minor bug where we
2343 were examining the wrong parameter for the ParamArray attribute.
2345 Cope with requests for the type of the parameter at position
2346 greater than the params parameter's. We now return the element
2347 type of the params array as that makes more sense.
2349 * expression.cs (Invocation.IsParamsMethodApplicable): Update
2350 accordingly as we no longer have to extract the element type
2353 (Invocation.OverloadResolve): Update.
2355 2001-12-27 Miguel de Icaza <miguel@ximian.com>
2357 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
2358 against IEnumerator, test whether the return value is a descendant
2359 of the IEnumerator interface.
2361 * class.cs (Indexer.Define): Use an auxiliary method to implement
2362 the other bits of the method definition. Begin support for
2363 explicit interface implementation.
2365 (Property.DefineMethod): Use TypeManager.void_type instead of null
2366 for an empty return value.
2368 2001-12-26 Miguel de Icaza <miguel@ximian.com>
2370 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
2371 dealing with a FieldExpr which is composed of a FieldBuilder, in
2372 the code path we did extract the constant, but we should have
2373 obtained the underlying value to be able to cast it (otherwise we
2374 end up in an infinite loop, this is what Ravi was running into).
2376 (ArrayCreation.UpdateIndices): Arrays might be empty.
2378 (MemberAccess.ResolveMemberAccess): Add support for section
2379 14.5.4.1 that deals with the special case of E.I when E is a type
2380 and something else, that I can be a reference to a static member.
2382 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
2383 handle a particular array type to create byte blobs, it is just
2384 something we dont generate byteblobs for.
2386 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
2389 * location.cs (Push): remove the key from the hashtable that we
2390 are about to add. This happens for empty files.
2392 * driver.cs: Dispose files after we have parsed them.
2394 (tokenize): new function that only runs the tokenizer on its
2395 input, for speed testing.
2397 2001-12-26 Ravi Pratap <ravi@ximian.com>
2399 * class.cs (Event.Define): Define the private field only if there
2400 are no accessors defined.
2402 * expression.cs (ResolveMemberAccess): If there is no associated
2403 field with the event, that means we have an event defined with its
2404 own accessors and we should flag error cs0070 since transforming
2405 ourselves into a field is not valid in that case.
2407 * ecore.cs (SimpleName.DoResolve): Same as above.
2409 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
2410 and charset to sane values.
2412 2001-12-25 Ravi Pratap <ravi@ximian.com>
2414 * assign.cs (DoResolve): Perform check on events only if they
2415 are being accessed outside the declaring type.
2417 * cs-parser.jay (event_declarations): Update rules to correctly
2418 set the type of the implicit parameter etc.
2420 (add_accessor, remove_accessor): Set current local parameters.
2422 * expression.cs (Binary): For delegate addition and subtraction,
2423 cast the return value from the method into the appropriate delegate
2426 2001-12-24 Ravi Pratap <ravi@ximian.com>
2428 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
2429 of these as the workaround is unnecessary.
2431 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
2432 delegate data - none of that is needed at all.
2434 Re-write bits to extract the instance expression and the delegate method
2437 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
2440 * attribute.cs (ApplyAttributes): New method to take care of common tasks
2441 of attaching attributes instead of duplicating code everywhere.
2443 * everywhere : Update code to do attribute emission using the above method.
2445 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2447 * expression.cs (IsParamsMethodApplicable): if there are not
2448 parameters, return immediately.
2450 * ecore.cs: The 0 literal can be implicity converted to an enum
2453 (SimpleName.DoResolve): First lookup the type, then lookup the
2456 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
2457 want to get its address. If the InstanceExpression is not
2458 addressable, store the result in a temporary variable, then get
2461 * codegen.cs: Only display 219 errors on warning level or above.
2463 * expression.cs (ArrayAccess): Make it implement the
2464 IMemoryLocation interface.
2466 (Binary.DoResolve): handle the operator == (object a, object b)
2467 and operator != (object a, object b) without incurring into a
2468 BoxedCast (because 5 != o should never be performed).
2470 Handle binary enumerator operators.
2472 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
2473 value type, otherwise use Ldelem_ref.
2475 Use precomputed names;
2477 (AddressOf): Implement address of
2479 * cs-parser.jay (labeled_statement): Fix recursive block
2480 addition by reworking the production.
2482 * expression.cs (New.DoEmit): New has a special case:
2484 If we are dealing with a ValueType, we have a few
2485 situations to deal with:
2487 * The target of New is a ValueType variable, that is
2488 easy, we just pass this as the variable reference
2490 * The target of New is being passed as an argument,
2491 to a boxing operation or a function that takes a
2494 In this case, we need to create a temporary variable
2495 that is the argument of New.
2498 2001-12-23 Ravi Pratap <ravi@ximian.com>
2500 * rootcontext.cs (LookupType): Check that current_type is not null before
2501 going about looking at nested types.
2503 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
2504 not implement the IAssignMethod interface any more.
2506 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
2507 where we tranform them into FieldExprs if they are being resolved from within
2510 * ecore.cs (SimpleName.DoResolve): Do the same here.
2512 * assign.cs (DoResolve, Emit): Clean up code considerably.
2514 * ../errors/bug10.cs : Add.
2516 * ../errors/cs0070.cs : Add.
2518 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
2520 * assign.cs : Get rid of EventIsLocal everywhere.
2522 2001-12-23 Miguel de Icaza <miguel@ximian.com>
2524 * ecore.cs (ConvertIntLiteral): finished the implementation.
2526 * statement.cs (SwitchLabel): Convert the value we are using as a
2527 key before looking up the table.
2529 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2531 * codegen.cs (EmitTopBlock): Require a Location argument now.
2533 * cs-parser.jay (constructor_declarator): We need to setup
2534 current_local_parameters before we parse the
2535 opt_constructor_initializer, to allow the variables to be bound
2536 to the constructor arguments.
2538 * rootcontext.cs (LookupType): First lookup nested classes in our
2539 class and our parents before we go looking outside our class.
2541 * expression.cs (ConstantFold): Extract/debox the values at the
2544 * rootcontext.cs (EmitCode): Resolve the constants first before we
2545 resolve the types. This is not really needed, but it helps debugging.
2547 * statement.cs: report location.
2549 * cs-parser.jay: pass location to throw statement.
2551 * driver.cs: Small bug fix.
2553 * report.cs: Updated format to be 4-zero filled digits.
2555 2001-12-22 Ravi Pratap <ravi@ximian.com>
2557 * expression.cs (CheckIndices): Fix minor bug where the wrong
2558 variable was being referred to ;-)
2560 (DoEmit): Do not call EmitStaticInitializers when the
2561 underlying type is System.Object.
2563 2001-12-21 Ravi Pratap <ravi@ximian.com>
2565 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
2566 and do the usual workaround for SRE.
2568 * class.cs (MyEventBuilder.EventType): New member to get at the type
2569 of the event, quickly.
2571 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
2573 * assign.cs (Assign.DoResolve): Handle the case when the target
2574 is an EventExpr and perform the necessary checks.
2576 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
2579 (SimpleName.MemberStaticCheck): Include check for EventExpr.
2581 (EventExpr): Set the type in the constructor itself since we
2582 are meant to be born fully resolved.
2584 (EventExpr.Define): Revert code I wrote earlier.
2586 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
2587 instance expression is null. The instance expression is a This in that case
2588 or a null, depending on whether it is a static method or not.
2590 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
2591 refers to more than one method.
2593 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
2594 and accordingly flag errors.
2596 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2598 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
2600 2001-12-22 Miguel de Icaza <miguel@ximian.com>
2602 * location.cs (ToString): Provide useful rutine.
2604 2001-12-21 Miguel de Icaza <miguel@ximian.com>
2606 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
2607 objects, return the actual integral boxed.
2609 * statement.cs (SwitchLabel): define an ILLabel for each
2612 (Switch.CheckSwitch): If the value is a Literal, extract
2613 the underlying literal.
2615 Also in the unused hashtable we had, add the SwitchLabel so we can
2616 quickly look this value up.
2618 * constant.cs: Implement a bunch of new constants. Rewrite
2619 Literal based on this. Made changes everywhere to adapt to this.
2621 * expression.cs (Expression.MakeByteBlob): Optimize routine by
2622 dereferencing array only once, and also copes with enumrations.
2624 bytes are two bytes wide, not one.
2626 (Cast): Perform constant conversions.
2628 * ecore.cs (TryImplicitIntConversion): Return literals instead of
2629 wrappers to the literals here.
2631 * expression.cs (DoNumericPromotions): long literals can converted
2632 to ulong implicity (this is taken care of elsewhere, but I was
2635 * ecore.cs (Expression.Literalize): Make the return type Literal,
2636 to improve type checking.
2638 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
2640 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2642 * literal.cs: Revert code from ravi that checked the bounds. The
2643 bounds are sane by the definition of the type itself.
2645 * typemanager.cs: Fix implementation of ImplementsInterface. We
2646 need to actually look up in our parent hierarchy for interfaces
2649 * const.cs: Use the underlying type for enumerations
2651 * delegate.cs: Compute the basename for the delegate creation,
2652 that should fix the delegate test case, and restore the correct
2653 Type Lookup semantics in rootcontext
2655 * rootcontext.cs: Revert Ravi's last patch. The correct way of
2656 referencing a nested type with the Reflection API is using the "+"
2659 * cs-parser.jay: Do not require EOF token at the end.
2661 2001-12-20 Ravi Pratap <ravi@ximian.com>
2663 * rootcontext.cs (LookupType): Concatenate type names with
2664 a '.' instead of a '+' The test suite passes again.
2666 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
2667 field of the enumeration.
2669 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
2670 the case when the member is an EventExpr.
2672 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
2673 static has an associated instance expression.
2675 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
2677 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
2679 * class.cs (Event.Define): Register event and perform appropriate checks
2682 We define the Add and Remove methods even if the use provides none because
2683 in that case, we provide default implementations ourselves.
2685 Define a private field of the type of the event. This is done by the CSC compiler
2686 and we should be doing it too ;-)
2688 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
2689 More methods we use in code we generate.
2691 (multicast_delegate_type, delegate_type): Two separate types since the distinction
2694 (InitCoreTypes): Update accordingly for the above.
2696 * class.cs (Event.Emit): Generate code for default accessors that we provide
2698 (EmitDefaultMethod): Do the job in the above.
2700 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
2703 2001-12-20 Miguel de Icaza <miguel@ximian.com>
2705 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
2706 builders even if we were missing one.
2708 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
2709 pass the Basename as our class name instead of the Name. The
2710 basename will be correctly composed for us.
2712 * parameter.cs (Paramters): Now takes a Location argument.
2714 * decl.cs (DeclSpace.LookupType): Removed convenience function and
2715 make all the code call directly LookupType in RootContext and take
2716 this chance to pass the Location information everywhere.
2718 * Everywhere: pass Location information.
2720 2001-12-19 Miguel de Icaza <miguel@ximian.com>
2722 * class.cs (Constructor.Define): Updated way of detecting the
2723 length of the parameters.
2725 (TypeContainer.DefineType): Use basename as the type name for
2728 (TypeContainer.Define): Do not recursively define types here, as
2729 definition is taken care in order by the RootContext.
2731 * tree.cs: Keep track of namespaces in a per-file basis.
2733 * parameter.cs (Parameter.ComputeSignature): Update to use
2736 (Parameters.GetSignature): ditto.
2738 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
2739 instead of a TypeContainer.
2741 (Interface.SemanticAnalysis): Use `this' instead of our parent to
2742 resolve names. Because we need to be resolve in our context, not
2745 * driver.cs: Implement response files.
2747 * class.cs (TypeContainer.DefineType): If we are defined, do not
2750 (Event.Emit): Emit the code for add/remove handlers.
2751 (Event.Define): Save the MethodBuilders for add/remove.
2753 * typemanager.cs: Use pair here too.
2755 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
2756 DictionaryEntry requires the first argument to be non-null.
2758 (enum_declaration): Compute full name for registering the
2761 (delegate_declaration): Instead of using
2762 formal_parameter_list, use opt_formal_parameter_list as the list
2765 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
2766 (EventParsing): New property that controls whether `add' and
2767 `remove' are returned as tokens or identifiers (for events);
2769 2001-12-19 Ravi Pratap <ravi@ximian.com>
2771 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
2772 use MyEventBuilder only and let it wrap the real builder for us.
2774 (MyEventBuilder): Revamp constructor etc.
2776 Implement all operations that we perform on EventBuilder in precisely the same
2779 (FindMembers): Update to use the EventBuilder member.
2781 (Event.Emit): Update accordingly.
2783 2001-12-18 Ravi Pratap <ravi@ximian.com>
2785 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
2786 by calling the appropriate methods.
2788 (GetCustomAttributes): Make stubs as they cannot possibly do anything
2791 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
2793 2001-12-17 Ravi Pratap <ravi@ximian.com>
2795 * delegate.cs (Delegate.Populate): Check that the return type
2796 and various parameters types are indeed accessible.
2798 * class.cs (Constructor.Define): Same here.
2800 (Field.Define): Ditto.
2802 (Event.Define): Ditto.
2804 (Operator.Define): Check that the underlying Method defined itself
2805 correctly - so it's MethodBuilder should not be null.
2807 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
2808 expression happens to be null.
2810 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
2811 members but as of now we don't seem to be able to do anything really useful with it.
2813 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
2814 not the EventBuilder.
2816 2001-12-18 Miguel de Icaza <miguel@ximian.com>
2818 * cs-tokenizer.cs: Add support for defines.
2819 Add support for #if, #elif, #else, #endif
2821 (eval_var): evaluates a variable.
2822 (eval): stubbed for evaluating functions.
2824 * cs-parser.jay: Pass the defines information
2826 * driver.cs: Add --define command line option.
2828 * decl.cs: Move MemberCore here.
2830 Make it the base class for DeclSpace. This allows us to catch and
2831 report 108 and 109 for everything now.
2833 * class.cs (TypeContainer.Define): Extract all the members
2834 before populating and emit the warning 108 (new keyword required
2835 to override) instead of having each member implement this.
2837 (MemberCore.Define): New abstract method, we will be using this in
2838 the warning reporting engine in Populate.
2840 (Operator.Define): Adjust to new MemberCore protocol.
2842 * const.cs (Const): This does not derive from Expression, it is a
2843 temporary object we use to create fields, it is a MemberCore.
2845 * class.cs (Method.Define): Allow the entry point to be in a
2848 * driver.cs: Rewrite the argument handler to clean it up a bit.
2850 * rootcontext.cs: Made it just an auxiliary namespace feature by
2851 making everything static.
2853 * driver.cs: Adapt code to use RootContext type name instead of
2856 * delegate.cs: Remove RootContext argument.
2858 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
2861 * class.cs (Event.Define): The lookup can fail.
2863 * cs-tokenizer.cs: Begin implementation of pre-procesor.
2865 * expression.cs: Resolve the this instance before invoking the code.
2867 2001-12-17 Miguel de Icaza <miguel@ximian.com>
2869 * cs-parser.jay: Add a production in element_access that allows
2870 the thing to become a "type" reference. This way we can parse
2871 things like "(string [])" as a type.
2873 Note that this still does not handle the more complex rules of
2877 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
2879 * ecore.cs: (CopyNewMethods): new utility function used to
2880 assemble the list of methods from running FindMembers.
2882 (MemberLookup): Rework FindMembers so that
2884 2001-12-16 Miguel de Icaza <miguel@ximian.com>
2886 * class.cs (TypeContainer): Remove Delegates who fail to be
2889 * delegate.cs (Populate): Verify that we dont get null return
2890 values. TODO: Check for AsAccessible.
2892 * cs-parser.jay: Use basename to emit error 574 (destructor should
2893 have the same name as container class), not the full name.
2895 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
2896 possible representation.
2898 Also implements integer type suffixes U and L.
2900 2001-12-15 Miguel de Icaza <miguel@ximian.com>
2902 * expression.cs (ArrayCreation.DoResolve): We need to do the
2903 argument resolution *always*.
2905 * decl.cs: Make this hold the namespace. Hold the root context as
2907 (LookupType): Move here.
2909 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
2911 * location.cs (Row, Name): Fixed the code, it was always returning
2912 references to the first file.
2914 * interface.cs: Register properties defined through interfaces.
2916 * driver.cs: Add support for globbing on the command line
2918 * class.cs (Field): Make it derive from MemberCore as well.
2921 2001-12-15 Ravi Pratap <ravi@ximian.com>
2923 * class.cs (Event::Define): Check that the type of the event is a delegate
2924 type else flag error #66.
2926 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
2929 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
2930 values of EntryPoint, CharSet etc etc.
2932 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
2934 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
2935 be null and we should ignore this. I am not sure if this is really clean. Apparently,
2936 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
2937 which needs this to do its work.
2939 * ../errors/cs0066.cs : Add.
2941 2001-12-14 Miguel de Icaza <miguel@ximian.com>
2943 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
2946 * class.cs: (MethodSignature.MethodSignature): Removed hack that
2947 clears out the parameters field.
2948 (MemberSignatureCompare): Cleanup
2950 (MemberCore): New base class used to share code between MethodCore
2953 (RegisterRequiredImplementations) BindingFlags.Public requires
2954 either BindingFlags.Instace or Static. Use instance here.
2956 (Property): Refactored code to cope better with the full spec.
2958 * parameter.cs (GetParameterInfo): Return an empty array instead
2961 * class.cs (Property): Abstract or extern properties have no bodies.
2963 * parameter.cs (GetParameterInfo): return a zero-sized array.
2965 * class.cs (TypeContainer.MethodModifiersValid): Move all the
2966 method modifier validation to the typecontainer so we can reuse
2969 (MethodCore.ParameterTypes): return an empty sized array of types.
2971 (Property.Define): Test property modifier validity.
2973 Add tests for sealed/override too.
2975 (Method.Emit): abstract or extern methods have no bodies.
2977 2001-12-14 Ravi Pratap <ravi@ximian.com>
2979 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
2982 (Method::Define, ::Emit): Modify accordingly.
2984 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
2986 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
2988 * makefile: Pass in /unsafe.
2990 2001-12-13 Miguel de Icaza <miguel@ximian.com>
2992 * class.cs (MakeKey): Kill routine.
2994 * class.cs (TypeContainer.Define): Correctly define explicit
2995 method implementations (they require the full interface name plus
2998 * typemanager.cs: Deply the PtrHashtable here and stop using the
2999 lame keys. Things work so much better.
3001 This of course broke everyone who depended on `RegisterMethod' to
3002 do the `test for existance' test. This has to be done elsewhere.
3004 * support.cs (PtrHashtable): A hashtable that avoid comparing with
3005 the object stupid Equals method (because, that like fails all over
3006 the place). We still do not use it.
3008 * class.cs (TypeContainer.SetRequiredInterface,
3009 TypeContainer.RequireMethods): Killed these two routines and moved
3010 all the functionality to RegisterRequiredImplementations.
3012 (TypeContainer.RegisterRequiredImplementations): This routine now
3013 registers all the implementations required in an array for the
3014 interfaces and abstract methods. We use an array of structures
3015 which can be computed ahead of time to reduce memory usage and we
3016 also assume that lookups are cheap as most classes will not
3017 implement too many interfaces.
3019 We also avoid creating too many MethodSignatures.
3021 (TypeContainer.IsInterfaceMethod): Update and optionally does not
3022 clear the "pending" bit if we find that there are problems with
3025 (TypeContainer.VerifyPendingMethods): Update to report errors of
3026 methods that look like implementations but are not.
3028 (TypeContainer.Define): Add support for explicit interface method
3031 2001-12-12 Miguel de Icaza <miguel@ximian.com>
3033 * typemanager.cs: Keep track of the parameters here instead of
3034 being a feature of the TypeContainer.
3036 * class.cs: Drop the registration of parameters here, as
3037 InterfaceMethods are also interface declarations.
3039 * delegate.cs: Register methods with the TypeManager not only with
3040 the TypeContainer. This code was buggy.
3042 * interface.cs: Full registation here.
3044 2001-12-11 Miguel de Icaza <miguel@ximian.com>
3046 * expression.cs: Remove reducer for binary expressions, it can not
3049 * const.cs: Put here the code that used to go into constant.cs
3051 * constant.cs: Put here the code for constants, this is a new base
3054 * literal.cs: Make Literal derive from Constant.
3056 2001-12-09 Miguel de Icaza <miguel@ximian.com>
3058 * statement.cs (Return.Emit): Report error 157 if the user
3059 attempts to return from a finally block.
3061 (Return.Emit): Instead of emitting a return, jump to the end of
3064 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
3065 LocalBuilder to store the result of the function. ReturnLabel is
3066 the target where we jump.
3069 2001-12-09 Radek Doulik <rodo@ximian.com>
3071 * cs-parser.jay: remember alias in current namespace
3073 * ecore.cs (SimpleName::DoResolve): use aliases for types or
3076 * class.cs (LookupAlias): lookup alias in my_namespace
3078 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
3080 (LookupAlias): lookup alias in this and if needed in parent
3083 2001-12-08 Miguel de Icaza <miguel@ximian.com>
3087 * rootcontext.cs: (ModuleBuilder) Made static, first step into
3088 making things static. I need this to avoid passing the
3089 TypeContainer when calling ParameterType.
3091 * support.cs (InternalParameters.ParameterType): Remove ugly hack
3092 that did string manipulation to compute the type and then call
3093 GetType. Use Parameter.ParameterType instead.
3095 * cs-tokenizer.cs: Consume the suffix for floating values.
3097 * expression.cs (ParameterReference): figure out whether this is a
3098 reference parameter or not. Kill an extra variable by computing
3099 the arg_idx during emission.
3101 * parameter.cs (Parameters.GetParameterInfo): New overloaded
3102 function that returns whether a parameter is an out/ref value or not.
3104 (Parameter.ParameterType): The type of the parameter (base,
3105 without ref/out applied).
3107 (Parameter.Resolve): Perform resolution here.
3108 (Parameter.ExternalType): The full type (with ref/out applied).
3110 * statement.cs (Using.Emit, Using.EmitExpression): Implement
3111 support for expressions on the using statement.
3113 2001-12-07 Miguel de Icaza <miguel@ximian.com>
3115 * statement.cs (Using.EmitLocalVariableDecls): Split the
3116 localvariable handling of the using statement.
3118 (Block.EmitMeta): Keep track of variable count across blocks. We
3119 were reusing slots on separate branches of blocks.
3121 (Try.Emit): Emit the general code block, we were not emitting it.
3123 Check the type of the declaration to be an IDisposable or
3124 something that can be implicity converted to it.
3126 Emit conversions if required.
3128 * ecore.cs (EmptyExpression): New utility class.
3129 (Expression.ImplicitConversionExists): New utility function.
3131 2001-12-06 Miguel de Icaza <miguel@ximian.com>
3133 * statement.cs (Using): Implement.
3135 * expression.cs (LocalVariableReference): Support read only variables.
3137 * statement.cs: Remove the explicit emit for the Leave opcode.
3138 (VariableInfo): Add a readonly field.
3140 2001-12-05 Miguel de Icaza <miguel@ximian.com>
3142 * ecore.cs (ConvCast): new class used to encapsulate the various
3143 explicit integer conversions that works in both checked and
3146 (Expression.ConvertNumericExplicit): Use new ConvCast class to
3147 properly generate the overflow opcodes.
3149 2001-12-04 Miguel de Icaza <miguel@ximian.com>
3151 * statement.cs: The correct type for the EmptyExpression is the
3152 element_type, not the variable type. Ravi pointed this out.
3154 2001-12-04 Ravi Pratap <ravi@ximian.com>
3156 * class.cs (Method::Define): Handle PInvoke methods specially
3157 by using DefinePInvokeMethod instead of the usual one.
3159 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
3160 above to do the task of extracting information and defining the method.
3162 2001-12-04 Ravi Pratap <ravi@ximian.com>
3164 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
3165 of the condition for string type.
3167 (Emit): Move that here.
3169 (ArrayCreation::CheckIndices): Keep string literals in their expression
3172 (EmitDynamicInitializers): Handle strings appropriately.
3174 2001-12-04 Miguel de Icaza <miguel@ximian.com>
3176 * codegen.cs (EmitContext): Replace multiple variables with a
3177 single pointer to the current Switch statement.
3179 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
3182 2001-12-03 Miguel de Icaza <miguel@ximian.com>
3186 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
3189 (Foreach.Emit): Foreach on arrays was not setting
3190 up the loop variables (for break/continue).
3192 (GotoCase): Semi-implented.
3194 2001-12-03 Ravi Pratap <ravi@ximian.com>
3196 * attribute.cs (CheckAttribute): Handle system attributes by using
3197 Attribute.GetAttributes to examine information we need.
3199 (GetValidPlaces): Same here.
3201 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
3203 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
3205 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
3207 (Method::Define): Set appropriate flags if we have a DllImport attribute.
3209 (Method::Emit): Handle the case when we are a PInvoke method.
3211 2001-12-03 Miguel de Icaza <miguel@ximian.com>
3213 * expression.cs: Use ResolveWithSimpleName on compound names.
3215 2001-12-02 Ravi Pratap <ravi@ximian.com>
3217 * constant.cs (EmitConstant): Make sure we resolve the associated expression
3218 before trying to reduce it.
3220 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
3222 * constant.cs (LookupConstantValue): Implement.
3224 (EmitConstant): Use the above in emitting the constant.
3226 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
3227 that are user-defined by doing a LookupConstantValue on them.
3229 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
3232 2001-11-29 Miguel de Icaza <miguel@ximian.com>
3234 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
3236 (BaseAccess.DoResolve): Implement.
3238 (MemberAccess.DoResolve): Split this routine into a
3239 ResolveMemberAccess routine that can be used independently
3241 2001-11-28 Miguel de Icaza <miguel@ximian.com>
3243 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
3244 As that share bits of the implementation. Is returns a boolean,
3245 while As returns the Type that is being probed.
3247 2001-12-01 Ravi Pratap <ravi@ximian.com>
3249 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
3250 instead of a Literal - much easier.
3252 (EnumInTransit): Remove - utterly useless :-)
3254 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
3256 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
3258 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
3259 chain when we have no associated expression.
3261 2001-11-30 Ravi Pratap <ravi@ximian.com>
3263 * constant.cs (Define): Use Location while reporting the errror.
3265 Also emit a warning when 'new' is used and there is no inherited
3268 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
3271 (LookupEnumValue): Implement to lookup an enum member's value and define it
3274 (Populate): Re-write accordingly to use the above routine.
3276 2001-11-27 Miguel de Icaza <miguel@ximian.com>
3278 * expression.cs (This): Fix prototype for DoResolveLValue to
3279 override the base class DoResolveLValue.
3281 * cs-parser.cs: Report errors cs574 and cs575 (destructor
3284 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
3285 (we need to load the address of the field here). This fixes
3288 (FieldExpr.DoResolveLValue): Call the DoResolve
3289 function to initialize the Instance expression.
3291 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
3292 correctly the GetEnumerator operation on a value type.
3294 * cs-parser.jay: Add more simple parsing error catches.
3296 * statement.cs (Switch): Add support for string switches.
3297 Handle null specially.
3299 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
3301 2001-11-28 Ravi Pratap <ravi@ximian.com>
3303 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
3305 (declare_local_constant): New helper function.
3307 * statement.cs (AddConstant): Keep a separate record of constants
3309 (IsConstant): Implement to determine if a variable is a constant.
3311 (GetConstantExpression): Implement.
3313 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
3315 * statement.cs (IsVariableDefined): Re-write.
3317 2001-11-27 Ravi Pratap <ravi@ximian.com>
3319 * class.cs (TypeContainer::FindMembers): Look for constants
3320 in the case when we are looking for MemberTypes.Field
3322 * expression.cs (MemberAccess::DoResolve): Check that in the
3323 case we are a FieldExpr and a Literal, we are not being accessed
3324 by an instance reference.
3326 * cs-parser.jay (local_constant_declaration): Implement.
3328 (declaration_statement): Implement for constant declarations.
3330 2001-11-26 Miguel de Icaza <miguel@ximian.com>
3332 * statement.cs (Switch): Catch double defaults.
3334 (Switch): More work on the switch() statement
3335 implementation. It works for integral values now, need to finish
3339 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3341 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
3342 integer literals into other integer literals. To be used by
3345 2001-11-24 Ravi Pratap <ravi@ximian.com>
3347 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
3350 (EmitDynamicInitializers): Cope with the above since we extract data
3351 directly from ArrayData now.
3353 (ExpectInitializers): Keep track of whether initializers are mandatory
3356 (Bounds): Make it a hashtable to prevent the same dimension being
3357 recorded for every element in that dimension.
3359 (EmitDynamicInitializers): Fix bug which prevented the Set array method
3362 Also fix bug which was causing the indices to be emitted in the reverse
3365 2001-11-24 Miguel de Icaza <miguel@ximian.com>
3367 * expression.cs (ArrayCreation): Implement the bits that Ravi left
3368 unfinished. They do not work, because the underlying code is
3371 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3373 * cs-parser.jay: Remove bogus fixme.
3375 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
3376 on Switch statement.
3378 2001-11-23 Ravi Pratap <ravi@ximian.com>
3380 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
3383 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
3384 parameter. Apparently, any expression is allowed.
3386 (ValidateInitializers): Update accordingly.
3388 (CheckIndices): Fix some tricky bugs thanks to recursion.
3390 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
3391 I was being completely brain-dead.
3393 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
3394 and re-write acordingly.
3396 (DelegateInvocation): Re-write accordingly.
3398 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
3400 (MakeByteBlob): Handle types more correctly.
3402 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
3403 initialization from expressions but it is incomplete because I am a complete
3406 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3408 * statement.cs (If.Emit): Fix a bug that generated incorrect code
3409 on If. Basically, we have to return `true' (ie, we do return to
3410 our caller) only if both branches of the if return.
3412 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
3413 short-circuit operators, handle them as short circuit operators.
3415 (Cast.DoResolve): Resolve type.
3416 (Cast.Cast): Take an expression as the target type.
3418 * cs-parser.jay (cast_expression): Remove old hack that only
3419 allowed a limited set of types to be handled. Now we take a
3420 unary_expression and we resolve to a type during semantic
3423 Use the grammar productions from Rhys to handle casts (this is
3424 not complete like Rhys syntax yet, we fail to handle that corner
3425 case that C# has regarding (-x), but we will get there.
3427 2001-11-22 Ravi Pratap <ravi@ximian.com>
3429 * class.cs (EmitFieldInitializer): Take care of the case when we have a
3430 field which is an array type.
3432 * cs-parser.jay (declare_local_variables): Support array initialization too.
3434 * typemanager.cs (MakeKey): Implement.
3436 (everywhere): Use the above appropriately.
3438 * cs-parser.jay (for_statement): Update for array initialization while
3439 declaring variables.
3441 * ecore.cs : The error message was correct, it's the variable's names that
3442 were misleading ;-) Make the code more readable.
3444 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
3445 the correct type etc.
3447 (ConvertExplicit): Handle Enum types by examining the underlying type.
3449 2001-11-21 Ravi Pratap <ravi@ximian.com>
3451 * parameter.cs (GetCallingConvention): Always return
3452 CallingConventions.Standard for now.
3454 2001-11-22 Miguel de Icaza <miguel@ximian.com>
3456 * expression.cs (Binary.ResolveOperator): Update the values of `l'
3457 and `r' after calling DoNumericPromotions.
3459 * ecore.cs: Fix error message (the types were in the wrong order).
3461 * statement.cs (Foreach.ProbeCollectionType): Need to pass
3462 BindingFlags.Instance as well
3464 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
3465 implicit int literal conversion in an empty cast so that we
3466 propagate the right type upstream.
3468 (UnboxCast): new class used to unbox value types.
3469 (Expression.ConvertExplicit): Add explicit type conversions done
3472 (Expression.ImplicitNumericConversion): Oops, forgot to test for
3473 the target type before applying the implicit LongLiterals to ULong
3476 2001-11-21 Miguel de Icaza <miguel@ximian.com>
3478 * cs-parser.jay (for_statement): Reworked the way For works: now
3479 we declare manually any variables that are introduced in
3480 for_initializer to solve the problem of having out-of-band code
3481 emition (that is what got for broken).
3483 (declaration_statement): Perform the actual variable declaration
3484 that used to be done in local_variable_declaration here.
3486 (local_variable_declaration): Do not declare anything, just pass
3487 the information on a DictionaryEntry
3489 2001-11-20 Ravi Pratap <ravi@ximian.com>
3491 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
3492 re-write of the logic to now make it recursive.
3494 (UpdateIndices): Re-write accordingly.
3496 Store element data in a separate ArrayData list in the above methods.
3498 (MakeByteBlob): Implement to dump the array data into a byte array.
3500 2001-11-19 Ravi Pratap <ravi@ximian.com>
3502 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
3505 * constant.cs (Define): Implement.
3507 (EmitConstant): Re-write fully.
3509 Pass in location info.
3511 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
3514 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
3515 DictionaryEntry since we need location info too.
3517 (constant_declaration): Update accordingly.
3519 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
3520 code into another method : UpdateIndices.
3522 2001-11-18 Ravi Pratap <ravi@ximian.com>
3524 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
3525 some type checking etc.
3527 2001-11-17 Ravi Pratap <ravi@ximian.com>
3529 * expression.cs (ArrayCreation::ValidateInitializers): Implement
3530 bits to provide dimension info if the user skips doing that.
3532 Update second constructor to store the rank correctly.
3534 2001-11-16 Ravi Pratap <ravi@ximian.com>
3536 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
3537 and try to implement.
3539 * ../errors/cs0150.cs : Add.
3541 * ../errors/cs0178.cs : Add.
3543 2001-11-16 Miguel de Icaza <miguel@ximian.com>
3545 * statement.cs: Implement foreach on multi-dimensional arrays.
3547 * parameter.cs (Parameters.GetParameterByName): Also lookup the
3548 name of the params argument.
3550 * expression.cs: Use EmitStoreOpcode to get the right opcode while
3551 initializing the array.
3553 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
3554 we can use this elsewhere.
3556 * statement.cs: Finish implementation of foreach for single
3559 * cs-parser.jay: Use an out-of-band stack to pass information
3560 around, I wonder why I need this.
3562 foreach_block: Make the new foreach_block the current_block.
3564 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
3565 function used to return a static Parameters structure. Used for
3566 empty parameters, as those are created very frequently.
3568 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
3570 2001-11-15 Ravi Pratap <ravi@ximian.com>
3572 * interface.cs : Default modifier is private, not public. The
3573 make verify test passes again.
3575 2001-11-15 Ravi Pratap <ravi@ximian.com>
3577 * support.cs (ReflectionParameters): Fix logic to determine
3578 whether the last parameter is a params one. Test 9 passes again.
3580 * delegate.cs (Populate): Register the builders we define with
3581 RegisterParameterForBuilder. Test 19 passes again.
3583 * cs-parser.jay (property_declaration): Reference $6 instead
3584 of $$ to get at the location.
3586 (indexer_declaration): Similar stuff.
3590 * class.cs (Property): Register parameters for the Get and Set methods
3591 if they exist. Test 23 passes again.
3593 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
3594 call to EmitArguments as we are sure there aren't any params arguments.
3595 Test 32 passes again.
3597 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
3598 IndexOutOfRangeException.
3600 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
3601 Test 33 now passes again.
3603 2001-11-15 Miguel de Icaza <miguel@ximian.com>
3605 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
3606 broke a bunch of things. Will have to come up with a better way
3607 of tracking locations.
3609 * statement.cs: Implemented foreach for single dimension arrays.
3611 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3613 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
3614 an error. This removes the lookup from the critical path.
3616 * cs-parser.jay: Removed use of temporary_loc, which is completely
3619 2001-11-14 Miguel de Icaza <miguel@ximian.com>
3621 * support.cs (ReflectionParameters.ParameterModifier): Report
3622 whether the argument is a PARAMS argument or not.
3624 * class.cs: Set the attribute `ParamArrayAttribute' on the
3627 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
3628 and cons_param_array_attribute (ConstructorInfo for
3629 ParamArrayAttribute).,
3631 * codegen.cs: Emit the return using the `Return' statement, that
3632 way we can report the error correctly for missing return values.
3634 * class.cs (Method.Emit): Clean up.
3636 * expression.cs (Argument.Resolve): Take another argument: the
3637 location where this argument is used. Notice that this is not
3638 part of the "Argument" class as to reduce the size of the
3639 structure (we know the approximate location anyways).
3641 Test if the argument is a variable-reference, if not, then
3642 complain with a 206.
3644 (Argument.Emit): Emit addresses of variables.
3646 (Argument.FullDesc): Simplify.
3648 (Invocation.DoResolve): Update for Argument.Resolve.
3650 (ElementAccess.DoResolve): ditto.
3652 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
3653 method should be virtual, as this method is always virtual.
3655 (NewDelegate.DoResolve): Update for Argument.Resolve.
3657 * class.cs (ConstructorInitializer.DoResolve): ditto.
3659 * attribute.cs (Attribute.Resolve): ditto.
3661 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3663 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
3665 * expression.cs (ParameterReference): Drop IStackStorage and implement
3666 IAssignMethod instead.
3668 (LocalVariableReference): ditto.
3670 * ecore.cs (FieldExpr): Drop IStackStorage and implement
3671 IAssignMethod instead.
3673 2001-11-13 Miguel de Icaza <miguel@ximian.com>
3675 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
3676 enumerations that are used in heavily used structures derive from
3677 byte in a laughable and pathetic attempt to reduce memory usage.
3678 This is the kind of pre-optimzations that you should not do at
3679 home without adult supervision.
3681 * expression.cs (UnaryMutator): New class, used to handle ++ and
3682 -- separatedly from the other unary operators. Cleans up the
3683 code, and kills the ExpressionStatement dependency in Unary.
3685 (Unary): Removed `method' and `Arguments' from this class, making
3686 it smaller, and moving it all to SimpleCall, so I can reuse this
3687 code in other locations and avoid creating a lot of transient data
3688 strucutres when not required.
3690 * cs-parser.jay: Adjust for new changes.
3692 2001-11-11 Miguel de Icaza <miguel@ximian.com>
3694 * enum.cs (Enum.Populate): If there is a failure during
3697 * cs-parser.jay (opt_enum_base): we used to catch type errors
3698 here, but this is really incorrect. The type error should be
3699 catched during semantic analysis.
3701 2001-12-11 Ravi Pratap <ravi@ximian.com>
3703 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
3704 current_local_parameters as expected since I, in my stupidity, had forgotten
3707 * attribute.cs (GetValidPlaces): Fix stupid bug.
3709 * class.cs (Method::Emit): Perform check on applicability of attributes.
3711 (Constructor::Emit): Ditto.
3713 (Field::Emit): Ditto.
3715 (Field.Location): Store location information.
3717 (Property, Event, Indexer, Operator): Ditto.
3719 * cs-parser.jay (field_declaration): Pass in location for each field.
3721 * ../errors/cs0592.cs : Add.
3723 2001-11-12 Ravi Pratap <ravi@ximian.com>
3725 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
3727 (InitCoreTypes): Update accordingly.
3729 (RegisterAttrType, LookupAttr): Implement.
3731 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
3732 info about the same.
3734 (Resolve): Update to populate the above as necessary.
3738 (GetValidPlaces): Helper to the above.
3740 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
3742 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
3744 2001-11-12 Ravi Pratap <ravi@ximian.com>
3746 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
3748 * ../errors/cs0617.cs : Add.
3750 2001-11-11 Ravi Pratap <ravi@ximian.com>
3752 * enum.cs (Emit): Rename to Populate to be more consistent with what
3753 we expect it to do and when exactly it is called.
3755 * class.cs, rootcontext.cs : Update accordingly.
3757 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
3758 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
3760 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
3762 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
3763 of a fieldinfo using the above, when dealing with a FieldBuilder.
3765 2001-11-10 Ravi Pratap <ravi@ximian.com>
3767 * ../errors/cs0031.cs : Add.
3769 * ../errors/cs1008.cs : Add.
3771 * ../errrors/cs0543.cs : Add.
3773 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
3776 (FindMembers): Implement.
3778 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
3779 enums and delegates too.
3781 (enum_types): Rename to builder_to_enum.
3783 (delegate_types): Rename to builder_to_delegate.
3785 * delegate.cs (FindMembers): Implement.
3787 2001-11-09 Ravi Pratap <ravi@ximian.com>
3789 * typemanager.cs (IsEnumType): Implement.
3791 * enum.cs (Emit): Re-write parts to account for the underlying type
3792 better and perform checking etc.
3794 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
3795 of the underlying type.
3797 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
3800 * enum.cs (error31): Helper to report error #31.
3802 * cs-parser.jay (enum_declaration): Store location of each member too.
3804 * enum.cs (member_to_location): New hashtable.
3806 (AddEnumMember): Update location hashtable.
3808 (Emit): Use the location of each member while reporting errors.
3810 2001-11-09 Miguel de Icaza <miguel@ximian.com>
3812 * cs-parser.jay: A for_initializer if is a
3813 local_variable_declaration really ammount to have an implicit
3814 block with the variable declaration and no initializer for for.
3816 * statement.cs (For.Emit): Cope with null initializers.
3818 This fixes the infinite loop on for initializers.
3820 2001-11-08 Miguel de Icaza <miguel@ximian.com>
3822 * enum.cs: More cleanup.
3824 * ecore.cs: Remove dead code.
3826 * class.cs (Property.Emit): More simplification.
3827 (Event.Emit): ditto.
3829 Reworked to have less levels of indentation.
3831 2001-11-08 Ravi Pratap <ravi@ximian.com>
3833 * class.cs (Property): Emit attributes.
3843 * enum.cs (Emit): Ditto.
3845 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
3848 * class.cs (Field, Event, etc.): Move attribute generation into the
3849 Emit method everywhere.
3851 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
3852 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
3853 as we had no way of defining nested enums !
3855 * rootcontext.cs : Adjust code accordingly.
3857 * typemanager.cs (AddEnumType): To keep track of enum types separately.
3859 2001-11-07 Ravi Pratap <ravi@ximian.com>
3861 * expression.cs (EvalConstantExpression): Move into ecore.cs
3863 * enum.cs (Enum): Rename some members and make them public and readonly
3864 according to our convention.
3866 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
3869 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
3871 (Enum::Emit): Write a simple version for now which doesn't try to compute
3872 expressions. I shall modify this to be more robust in just a while.
3874 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
3876 (TypeContainer::CloseType): Create the Enum types too.
3878 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
3880 * expression.cs (EvalConstantExpression): Get rid of completely.
3882 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
3883 user-defined values and other cases.
3885 (IsValidEnumLiteral): Helper function.
3887 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
3888 out there in the case we had a literal FieldExpr.
3890 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
3892 (Literalize): Revamp a bit to take two arguments.
3894 (EnumLiteral): New class which derives from Literal to wrap enum literals.
3896 2001-11-06 Ravi Pratap <ravi@ximian.com>
3898 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
3900 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
3902 (Resolve): Use the above to ensure we have proper initializers.
3904 2001-11-05 Ravi Pratap <ravi@ximian.com>
3906 * expression.cs (Expression::EvalConstantExpression): New method to
3907 evaluate constant expressions.
3909 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
3911 2001-11-07 Miguel de Icaza <miguel@ximian.com>
3913 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
3916 (Binary.ResolveOperator): Handle operator != (object a, object b)
3917 and operator == (object a, object b);
3919 (Binary.DoNumericPromotions): Indicate whether the numeric
3920 promotion was possible.
3922 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
3925 Made the ArrayAccess implement interface IAssignMethod instead of
3926 IStackStore as the order in which arguments are passed reflects
3929 * assign.cs: Instead of using expr.ExprClass to select the way of
3930 assinging, probe for the IStackStore/IAssignMethod interfaces.
3932 * typemanager.cs: Load InitializeArray definition.
3934 * rootcontext.cs (RootContext.MakeStaticData): Used to define
3935 static data that can be used to initialize arrays.
3937 2001-11-05 Miguel de Icaza <miguel@ximian.com>
3939 * expression.cs: Handle operator== and operator!= for booleans.
3941 (Conditioal.Reduce): Implement reducer for the ?: operator.
3943 (Conditional.Resolve): Implement dead code elimination.
3945 (Binary.Resolve): Catch string literals and return a new
3946 concatenated string.
3948 (Unary.Reduce): Implement reduction of unary expressions.
3950 * ecore.cs: Split out the expression core handling here.
3952 (Expression.Reduce): New method used to perform constant folding
3953 and CSE. This is needed to support constant-expressions.
3955 * statement.cs (Statement.EmitBoolExpression): Pass true and false
3956 targets, and optimize for !x.
3958 2001-11-04 Ravi Pratap <ravi@ximian.com>
3960 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
3961 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
3962 set custom atttributes.
3964 * literal.cs (Literal::GetValue): New abstract method to return the actual
3965 value of the literal, cast as an object.
3967 (*Literal): Implement GetValue method.
3969 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
3970 expressions to the arraylist but objects of type Argument.
3972 * class.cs (TypeContainer::Emit): Emit our attributes too.
3974 (Method::Emit, Constructor::Emit): Ditto.
3976 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
3977 to be ignoring earlier.
3979 2001-11-03 Ravi Pratap <ravi@ximian.com>
3981 * attribute.cs (AttributeSection::Define): Implement to do the business
3982 of constructing a CustomAttributeBuilder.
3984 (Attribute): New trivial class. Increases readability of code.
3986 * cs-parser.jay : Update accordingly.
3988 (positional_argument_list, named_argument_list, named_argument): New rules
3990 (attribute_arguments): Use the above so that we are more correct.
3992 2001-11-02 Ravi Pratap <ravi@ximian.com>
3994 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
3995 to perform all checks for a method with a params parameter.
3997 (Invocation::OverloadResolve): Update to use the above method and therefore
3998 cope correctly with params method invocations.
4000 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
4003 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
4004 constructors in our parent too because we can't afford to miss out on
4007 * attribute.cs (AttributeSection): New name for the class Attribute
4009 Other trivial changes to improve readability.
4011 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
4012 use the new class names.
4014 2001-11-01 Ravi Pratap <ravi@ximian.com>
4016 * class.cs (Method::Define): Complete definition for params types too
4018 (Indexer::Define): Ditto.
4020 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
4021 Cope everywhere with a request for info about the array parameter.
4023 2001-11-01 Ravi Pratap <ravi@ximian.com>
4025 * tree.cs (RecordNamespace): Fix up to check for the correct key.
4027 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
4028 local_variable_type to extract the string corresponding to the type.
4030 (local_variable_type): Fixup the action to use the new helper method.
4032 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
4035 * expression.cs : Clean out code which uses the above.
4037 2001-10-31 Ravi Pratap <ravi@ximian.com>
4039 * typemanager.cs (RegisterMethod): Check if we already have an existing key
4040 and bale out if necessary by returning a false.
4042 (RegisterProperty): Ditto.
4044 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
4045 and print out appropriate error messages.
4047 * interface.cs (everywhere): Ditto.
4049 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
4050 location to constructor.
4052 * class.cs (Property, Event, Indexer): Update accordingly.
4054 * ../errors/cs111.cs : Added.
4056 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
4057 of a method, as laid down by the spec.
4059 (Invocation::OverloadResolve): Use the above method.
4061 2001-10-31 Ravi Pratap <ravi@ximian.com>
4063 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
4064 now take a TypeContainer and a Parameters object.
4066 (ParameterData): Modify return type of ParameterModifier method to be
4067 Parameter.Modifier and not a string.
4069 (ReflectionParameters, InternalParameters): Update accordingly.
4071 * expression.cs (Argument::GetParameterModifier): Same here.
4073 * support.cs (InternalParameters::ParameterType): Find a better way of determining
4074 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
4075 symbol in it at all so maybe this is only for now.
4077 2001-10-30 Ravi Pratap <ravi@ximian.com>
4079 * support.cs (InternalParameters): Constructor now takes an extra argument
4080 which is the actual Parameters class.
4082 (ParameterDesc): Update to provide info on ref/out modifiers.
4084 * class.cs (everywhere): Update call to InternalParameters to pass in
4085 the second argument too.
4087 * support.cs (ParameterData): Add ParameterModifier, which is a method
4088 to return the modifier info [ref/out etc]
4090 (InternalParameters, ReflectionParameters): Implement the above.
4092 * expression.cs (Argument::ParameterModifier): Similar function to return
4093 info about the argument's modifiers.
4095 (Invocation::OverloadResolve): Update to take into account matching modifiers
4098 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
4099 a new SetFormalParameters object which we pass to InternalParameters.
4101 2001-10-30 Ravi Pratap <ravi@ximian.com>
4103 * expression.cs (NewArray): Merge into the ArrayCreation class.
4105 2001-10-29 Ravi Pratap <ravi@ximian.com>
4107 * expression.cs (NewArray): Merge classes NewBuiltinArray and
4108 NewUserdefinedArray into one as there wasn't much of a use in having
4111 * expression.cs (Argument): Change field's name to ArgType from Type.
4113 (Type): New readonly property which returns the proper type, taking into
4114 account ref/out modifiers.
4116 (everywhere): Adjust code accordingly for the above.
4118 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
4119 whether we are emitting for a ref or out parameter.
4121 * expression.cs (Argument::Emit): Use the above field to set the state.
4123 (LocalVariableReference::Emit): Update to honour the flag and emit the
4126 * parameter.cs (Attributes): Set the correct flags for ref parameters.
4128 * expression.cs (Argument::FullDesc): New function to provide a full desc.
4130 * support.cs (ParameterData): Add method ParameterDesc to the interface.
4132 (ReflectionParameters, InternalParameters): Implement the above method.
4134 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
4137 (Invocation::FullMethodDesc): Ditto.
4139 2001-10-29 Miguel de Icaza <miguel@ximian.com>
4141 * cs-parser.jay: Add extra production for the second form of array
4144 * expression.cs (ArrayCreation): Update to reflect the above
4147 * Small changes to prepare for Array initialization.
4149 2001-10-28 Miguel de Icaza <miguel@ximian.com>
4151 * typemanager.cs (ImplementsInterface): interface might be null;
4152 Deal with this problem;
4154 Also, we do store negative hits on the cache (null values), so use
4155 this instead of calling t.GetInterfaces on the type everytime.
4157 2001-10-28 Ravi Pratap <ravi@ximian.com>
4159 * typemanager.cs (IsBuiltinType): New method to help determine the same.
4161 * expression.cs (New::DoResolve): Get rid of array creation code and instead
4162 split functionality out into different classes.
4164 (New::FormArrayType): Move into NewBuiltinArray.
4166 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
4169 (NewBuiltinArray): New class to handle creation of built-in arrays.
4171 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
4172 account creation of one-dimensional arrays.
4174 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
4176 (NewUserdefinedArray::DoResolve): Implement.
4178 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
4180 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
4181 we maintain inside the TypeManager. This is necessary to perform lookups on the
4184 (LookupType): Update to perform GetType on the module builders too.
4186 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
4188 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
4190 2001-10-23 Ravi Pratap <ravi@ximian.com>
4192 * expression.cs (New::DoResolve): Implement guts of array creation.
4194 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
4196 2001-10-27 Miguel de Icaza <miguel@ximian.com>
4198 * expression.cs: Fix bug I introduced lsat night that broke
4201 (Expression.Resolve): Report a 246 error (can not resolve name)
4202 if we find a SimpleName in the stream.
4204 (Expression.ResolveLValue): Ditto.
4206 (Expression.ResolveWithSimpleName): This function is a variant of
4207 ResolveName, this one allows SimpleNames to be returned without a
4208 warning. The only consumer of SimpleNames is MemberAccess
4210 2001-10-26 Miguel de Icaza <miguel@ximian.com>
4212 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
4213 might arrive here. I have my doubts that this is correct.
4215 * statement.cs (Lock): Implement lock statement.
4217 * cs-parser.jay: Small fixes to support `lock' and `using'
4219 * cs-tokenizer.cs: Remove extra space
4221 * driver.cs: New flag --checked, allows to turn on integer math
4224 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
4225 Threading.Monitor.Exit
4227 2001-10-23 Miguel de Icaza <miguel@ximian.com>
4229 * expression.cs (IndexerAccess::DoResolveLValue): Set the
4230 Expression Class to be IndexerAccess.
4232 Notice that Indexer::DoResolve sets the eclass to Value.
4234 2001-10-22 Miguel de Icaza <miguel@ximian.com>
4236 * class.cs (TypeContainer::Emit): Emit code for indexers.
4238 * assign.cs (IAssignMethod): New interface implemented by Indexers
4239 and Properties for handling assignment.
4241 (Assign::Emit): Simplify and reuse code.
4243 * expression.cs (IndexerAccess, PropertyExpr): Implement
4244 IAssignMethod, clean up old code.
4246 2001-10-22 Ravi Pratap <ravi@ximian.com>
4248 * typemanager.cs (ImplementsInterface): New method to determine if a type
4249 implements a given interface. Provides a nice cache too.
4251 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
4254 (ConvertReferenceExplicit): Ditto.
4256 * delegate.cs (Delegate::Populate): Update to define the parameters on the
4257 various methods, with correct names etc.
4259 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
4260 Operator.UnaryNegation.
4262 * cs-parser.jay (operator_declarator): Be a little clever in the case where
4263 we have a unary plus or minus operator.
4265 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
4268 * everywhere : update accordingly.
4270 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
4273 * class.cs (Method::Define): For the case where we are implementing a method
4274 inherited from an interface, we need to set the MethodAttributes.Final flag too.
4275 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
4277 2001-10-21 Ravi Pratap <ravi@ximian.com>
4279 * interface.cs (FindMembers): Implement to work around S.R.E
4282 * typemanager.cs (IsInterfaceType): Implement.
4284 (FindMembers): Update to handle interface types too.
4286 * expression.cs (ImplicitReferenceConversion): Re-write bits which
4287 use IsAssignableFrom as that is not correct - it doesn't work.
4289 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
4290 and accordingly override EmitStatement.
4292 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
4293 using the correct logic :-)
4295 2001-10-19 Ravi Pratap <ravi@ximian.com>
4297 * ../errors/cs-11.cs : Add to demonstrate error -11
4299 2001-10-17 Miguel de Icaza <miguel@ximian.com>
4301 * assign.cs (Assign::Resolve): Resolve right hand side first, and
4302 then pass this as a hint to ResolveLValue.
4304 * expression.cs (FieldExpr): Add Location information
4306 (FieldExpr::LValueResolve): Report assignment to readonly
4309 (Expression::ExprClassFromMemberInfo): Pass location information.
4311 (Expression::ResolveLValue): Add new method that resolves an
4314 (Expression::DoResolveLValue): Default invocation calls
4317 (Indexers): New class used to keep track of indexers in a given
4320 (IStackStore): Renamed from LValue, as it did not really describe
4321 what this did. Also ResolveLValue is gone from this interface and
4322 now is part of Expression.
4324 (ElementAccess): Depending on the element access type
4326 * typemanager.cs: Add `indexer_name_type' as a Core type
4327 (System.Runtime.CompilerServices.IndexerNameAttribute)
4329 * statement.cs (Goto): Take a location.
4331 2001-10-18 Ravi Pratap <ravi@ximian.com>
4333 * delegate.cs (Delegate::VerifyDelegate): New method to verify
4334 if two delegates are compatible.
4336 (NewDelegate::DoResolve): Update to take care of the case when
4337 we instantiate a delegate from another delegate.
4339 * typemanager.cs (FindMembers): Don't even try to look up members
4340 of Delegate types for now.
4342 2001-10-18 Ravi Pratap <ravi@ximian.com>
4344 * delegate.cs (NewDelegate): New class to take care of delegate
4347 * expression.cs (New): Split the delegate related code out into
4348 the NewDelegate class.
4350 * delegate.cs (DelegateInvocation): New class to handle delegate
4353 * expression.cs (Invocation): Split out delegate related code into
4354 the DelegateInvocation class.
4356 2001-10-17 Ravi Pratap <ravi@ximian.com>
4358 * expression.cs (New::DoResolve): Implement delegate creation fully
4359 and according to the spec.
4361 (New::DoEmit): Update to handle delegates differently.
4363 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
4364 because of which we were printing out arguments in reverse order !
4366 * delegate.cs (VerifyMethod): Implement to check if the given method
4367 matches the delegate.
4369 (FullDelegateDesc): Implement.
4371 (VerifyApplicability): Implement.
4373 * expression.cs (Invocation::DoResolve): Update to accordingly handle
4374 delegate invocations too.
4376 (Invocation::Emit): Ditto.
4378 * ../errors/cs1593.cs : Added.
4380 * ../errors/cs1594.cs : Added.
4382 * delegate.cs (InstanceExpression, TargetMethod): New properties.
4384 2001-10-16 Ravi Pratap <ravi@ximian.com>
4386 * typemanager.cs (intptr_type): Core type for System.IntPtr
4388 (InitCoreTypes): Update for the same.
4390 (iasyncresult_type, asynccallback_type): Ditto.
4392 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
4395 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
4398 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
4399 the builders for the 4 members of a delegate type :-)
4401 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
4404 * expression.cs (New::DoResolve): Implement guts for delegate creation.
4406 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
4408 2001-10-15 Miguel de Icaza <miguel@ximian.com>
4410 * statement.cs (Break::Emit): Implement.
4411 (Continue::Emit): Implement.
4413 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
4414 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
4415 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
4416 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
4419 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
4420 properties that track the label for the current loop (begin of the
4421 loop and end of the loop).
4423 2001-10-15 Ravi Pratap <ravi@ximian.com>
4425 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
4426 use of emitting anything at all.
4428 * class.cs, rootcontext.cs : Get rid of calls to the same.
4430 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
4432 (Populate): Define the constructor correctly and set the implementation
4435 * typemanager.cs (delegate_types): New hashtable to hold delegates that
4438 (AddDelegateType): Implement.
4440 (IsDelegateType): Implement helper method.
4442 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
4444 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
4445 and accordingly handle it.
4447 * delegate.cs (Populate): Take TypeContainer argument.
4448 Implement bits to define the Invoke method. However, I still haven't figured out
4449 how to take care of the native int bit :-(
4451 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
4452 Qualify the name of the delegate, not its return type !
4454 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
4457 (StandardConversionExists): Checking for array types turns out to be recursive.
4459 (ConvertReferenceExplicit): Implement array conversion.
4461 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
4463 2001-10-12 Ravi Pratap <ravi@ximian.com>
4465 * cs-parser.jay (delegate_declaration): Store the fully qualified
4466 name as it is a type declaration.
4468 * delegate.cs (ReturnType, Name): Rename members to these. Make them
4471 (DefineDelegate): Renamed from Define. Does the same thing essentially,
4472 as TypeContainer::DefineType.
4474 (Populate): Method in which all the definition of the various methods (Invoke)
4477 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
4480 (CloseDelegate): Finally creates the delegate.
4482 * class.cs (TypeContainer::DefineType): Update to define delegates.
4483 (Populate, Emit and CloseType): Do the same thing here too.
4485 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
4486 delegates in all these operations.
4488 2001-10-14 Miguel de Icaza <miguel@ximian.com>
4490 * expression.cs: LocalTemporary: a new expression used to
4491 reference a temporary that has been created.
4493 * assign.cs: Handle PropertyAccess back here, so that we can
4494 provide the proper semantic access to properties.
4496 * expression.cs (Expression::ConvertReferenceExplicit): Implement
4497 a few more explicit conversions.
4499 * modifiers.cs: `NEW' modifier maps to HideBySig.
4501 * expression.cs (PropertyExpr): Make this into an
4502 ExpressionStatement, and support the EmitStatement code path.
4504 Perform get/set error checking, clean up the interface.
4506 * assign.cs: recognize PropertyExprs as targets, and if so, turn
4507 them into toplevel access objects.
4509 2001-10-12 Miguel de Icaza <miguel@ximian.com>
4511 * expression.cs: PropertyExpr::PropertyExpr: use work around the
4514 * typemanager.cs: Keep track here of our PropertyBuilders again to
4515 work around lameness in SRE.
4517 2001-10-11 Miguel de Icaza <miguel@ximian.com>
4519 * expression.cs (LValue::LValueResolve): New method in the
4520 interface, used to perform a second resolution pass for LValues.
4522 (This::DoResolve): Catch the use of this in static methods.
4524 (This::LValueResolve): Implement.
4526 (This::Store): Remove warning, assigning to `this' in structures
4529 (Invocation::Emit): Deal with invocation of
4530 methods on value types. We need to pass the address to structure
4531 methods rather than the object itself. (The equivalent code to
4532 emit "this" for structures leaves the entire structure on the
4533 stack instead of a pointer to it).
4535 (ParameterReference::DoResolve): Compute the real index for the
4536 argument based on whether the method takes or not a `this' pointer
4537 (ie, the method is static).
4539 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
4540 value types returned from functions when we need to invoke a
4541 method on the sturcture.
4544 2001-10-11 Ravi Pratap <ravi@ximian.com>
4546 * class.cs (TypeContainer::DefineType): Method to actually do the business of
4547 defining the type in the Modulebuilder or Typebuilder. This is to take
4548 care of nested types which need to be defined on the TypeBuilder using
4551 (TypeContainer::GetClassBases): Implement. Essentially the code from the
4552 methods in RootContext, only ported to be part of TypeContainer.
4554 (TypeContainer::GetInterfaceOrClass): Ditto.
4556 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
4558 * interface.cs (Interface::DefineInterface): New method. Does exactly
4559 what RootContext.CreateInterface did earlier, only it takes care of nested types
4562 (Interface::GetInterfaces): Move from RootContext here and port.
4564 (Interface::GetInterfaceByName): Same here.
4566 * rootcontext.cs (ResolveTree): Re-write.
4568 (PopulateTypes): Re-write.
4570 * class.cs (TypeContainer::Populate): Populate nested types too.
4571 (TypeContainer::Emit): Emit nested members too.
4573 * typemanager.cs (AddUserType): Do not make use of the FullName property,
4574 instead just use the name argument passed in as it is already fully
4577 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
4578 to TypeContainer mapping to see if a type is user-defined.
4580 * class.cs (TypeContainer::CloseType): Implement.
4582 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
4583 the default constructor.
4585 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
4588 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
4590 * interface.cs (CloseType): Create the type here.
4592 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
4595 Remove all the methods which are now in TypeContainer.
4597 2001-10-10 Ravi Pratap <ravi@ximian.com>
4599 * delegate.cs (Define): Re-write bits to define the delegate
4602 2001-10-10 Miguel de Icaza <miguel@ximian.com>
4604 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
4606 * expression.cs (ImplicitReferenceConversion): handle null as well
4607 as a source to convert to any reference type.
4609 * statement.cs (Return): Perform any implicit conversions to
4610 expected return type.
4612 Validate use of return statement.
4614 * codegen.cs (EmitContext): Pass the expected return type here.
4616 * class.cs (Method, Constructor, Property): Pass expected return
4617 type to EmitContext.
4619 2001-10-09 Miguel de Icaza <miguel@ximian.com>
4621 * expression.cs: Make DoResolve take an EmitContext instead of a
4624 Replaced `l' and `location' for `loc', for consistency.
4626 (Error, Warning): Remove unneeded Tc argument.
4628 * assign.cs, literal.cs, constant.cs: Update to new calling
4631 * codegen.cs: EmitContext now contains a flag indicating whether
4632 code is being generated in a static method or not.
4634 * cs-parser.jay: DecomposeQI, new function that replaces the old
4635 QualifiedIdentifier. Now we always decompose the assembled
4636 strings from qualified_identifier productions into a group of
4639 2001-10-08 Miguel de Icaza <miguel@ximian.com>
4641 * rootcontext.cs: Deal with field-less struct types correctly now
4642 by passing the size option to Define Type.
4644 * class.cs: Removed hack that created one static field.
4646 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4648 * statement.cs: Moved most of the code generation here.
4650 2001-10-09 Ravi Pratap <ravi@ximian.com>
4652 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
4655 (ElementAccess): Remove useless bits for now - keep checks as the spec
4658 2001-10-08 Ravi Pratap <ravi@ximian.com>
4660 * expression.cs (ElementAccess::DoResolve): Remove my crap code
4661 and start performing checks according to the spec.
4663 2001-10-07 Ravi Pratap <ravi@ximian.com>
4665 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
4666 rank_specifiers instead.
4668 (rank_specifiers): Change the order in which the rank specifiers are stored
4670 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
4672 * expression.cs (ElementAccess): Implement the LValue interface too.
4674 2001-10-06 Ravi Pratap <ravi@ximian.com>
4676 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
4677 except that user defined conversions are not included.
4679 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
4680 perform the conversion of the return type, if necessary.
4682 (New::DoResolve): Check whether we are creating an array or an object
4683 and accordingly do the needful.
4685 (New::Emit): Same here.
4687 (New::DoResolve): Implement guts of array creation.
4689 (New::FormLookupType): Helper function.
4691 2001-10-07 Miguel de Icaza <miguel@ximian.com>
4693 * codegen.cs: Removed most of the code generation here, and move the
4694 corresponding code generation bits to the statement classes.
4696 Added support for try/catch/finalize and throw.
4698 * cs-parser.jay: Added support for try/catch/finalize.
4700 * class.cs: Catch static methods having the flags override,
4701 virtual or abstract.
4703 * expression.cs (UserCast): This user cast was not really doing
4704 what it was supposed to do. Which is to be born in fully resolved
4705 state. Parts of the resolution were being performed at Emit time!
4709 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4711 * expression.cs: Implicity convert the result from UserCast.
4713 2001-10-05 Ravi Pratap <ravi@ximian.com>
4715 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
4716 prevented it from working correctly.
4718 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
4719 merely ConvertImplicit.
4721 2001-10-05 Miguel de Icaza <miguel@ximian.com>
4723 * typemanager.cs: Make the LookupTypeContainer function static,
4724 and not per-instance.
4726 * class.cs: Make static FindMembers (the one that takes a Type
4729 * codegen.cs: Add EmitForeach here.
4731 * cs-parser.jay: Make foreach a toplevel object instead of the
4732 inline expansion, as we need to perform semantic analysis on it.
4734 2001-10-05 Ravi Pratap <ravi@ximian.com>
4736 * expression.cs (Expression::ImplicitUserConversion): Rename to
4737 UserDefinedConversion.
4739 (Expression::UserDefinedConversion): Take an extra argument specifying
4740 whether we look for explicit user conversions too.
4742 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
4744 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
4746 (ExplicitUserConversion): Make it a call to UserDefinedConversion
4747 with the appropriate arguments.
4749 * cs-parser.jay (cast_expression): Record location too.
4751 * expression.cs (Cast): Record location info.
4753 (Expression::ConvertExplicit): Take location argument.
4755 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
4756 to determine if we are doing explicit conversions.
4758 (UserCast::Emit): Update accordingly.
4760 (Expression::ConvertExplicit): Report an error if everything fails.
4762 * ../errors/cs0030.cs : Add.
4764 2001-10-04 Miguel de Icaza <miguel@ximian.com>
4766 * modifiers.cs: If the ABSTRACT keyword is present, also set the
4767 virtual and newslot bits.
4769 * class.cs (TypeContainer::RegisterRequiredImplementations):
4770 Record methods we need.
4772 (TypeContainer::MakeKey): Helper function to make keys for
4773 MethodBases, since the Methodbase key is useless.
4775 (TypeContainer::Populate): Call RegisterRequiredImplementations
4776 before defining the methods.
4778 Create a mapping for method_builders_to_methods ahead of time
4779 instead of inside a tight loop.
4781 (::RequireMethods): Accept an object as the data to set into the
4782 hashtable so we can report interface vs abstract method mismatch.
4784 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4786 * report.cs: Make all of it static.
4788 * rootcontext.cs: Drop object_type and value_type computations, as
4789 we have those in the TypeManager anyways.
4791 Drop report instance variable too, now it is a global.
4793 * driver.cs: Use try/catch on command line handling.
4795 Add --probe option to debug the error reporting system with a test
4798 * report.cs: Add support for exiting program when a probe
4799 condition is reached.
4801 2001-10-03 Ravi Pratap <ravi@ximian.com>
4803 * expression.cs (Binary::DoNumericPromotions): Fix the case when
4804 we do a forcible conversion regardless of type, to check if
4805 ForceConversion returns a null.
4807 (Binary::error19): Use location to report error.
4809 (Unary::error23): Use location here too.
4811 * ../errors/cs0019.cs : Check in.
4813 * ../errors/cs0023.cs : Check in.
4815 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
4816 case of a non-null MethodInfo object with a length of 0 !
4818 (Binary::ResolveOperator): Flag error if overload resolution fails to find
4819 an applicable member - according to the spec :-)
4820 Also fix logic to find members in base types.
4822 (Unary::ResolveOperator): Same here.
4824 (Unary::report23): Change name to error23 and make first argument a TypeContainer
4825 as I was getting thoroughly confused between this and error19 :-)
4827 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
4828 (::FindMostEncompassedType): Implement.
4829 (::FindMostEncompassingType): Implement.
4830 (::StandardConversionExists): Implement.
4832 (UserImplicitCast): Re-vamp. We now need info about most specific
4833 source and target types so that we can do the necessary conversions.
4835 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
4836 mathematical union with no duplicates.
4838 2001-10-03 Miguel de Icaza <miguel@ximian.com>
4840 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
4841 in order from base classes to child classes, so that we can in
4842 child classes look up in our parent for method names and
4843 attributes (required for handling abstract, virtual, new, override
4844 constructs: we need to instrospect our base class, and if we dont
4845 populate the classes in order, the introspection might be
4846 incorrect. For example, a method could query its parent before
4847 the parent has any methods and would determine that the parent has
4848 no abstract methods (while it could have had them)).
4850 (RootContext::CreateType): Record the order in which we define the
4853 2001-10-02 Miguel de Icaza <miguel@ximian.com>
4855 * class.cs (TypeContainer::Populate): Also method definitions can
4856 fail now, keep track of this.
4858 (TypeContainer::FindMembers): Implement support for
4859 DeclaredOnly/noDeclaredOnly flag.
4861 (Constructor::Emit) Return the ConstructorBuilder.
4863 (Method::Emit) Return the MethodBuilder.
4864 Check for abstract or virtual methods to be public.
4866 * rootcontext.cs (RootContext::CreateType): Register all the
4867 abstract methods required for the class to be complete and the
4868 interface methods that must be implemented.
4870 * cs-parser.jay: Report error 501 (method requires body if it is
4871 not marked abstract or extern).
4873 * expression.cs (TypeOf::Emit): Implement.
4875 * typemanager.cs: runtime_handle_type, new global type.
4877 * class.cs (Property::Emit): Generate code for properties.
4879 2001-10-02 Ravi Pratap <ravi@ximian.com>
4881 * expression.cs (Unary::ResolveOperator): Find operators on base type
4882 too - we now conform exactly to the spec.
4884 (Binary::ResolveOperator): Same here.
4886 * class.cs (Operator::Define): Fix minor quirk in the tests.
4888 * ../errors/cs0215.cs : Added.
4890 * ../errors/cs0556.cs : Added.
4892 * ../errors/cs0555.cs : Added.
4894 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4896 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
4897 single integer which is really efficient
4899 2001-10-01 Ravi Pratap <ravi@ximian.com>
4901 * expression.cs (Expression::ImplicitUserConversion): Use location
4902 even in the case when we are examining True operators.
4904 * class.cs (Operator::Define): Perform extensive checks to conform
4905 with the rules for operator overloading in the spec.
4907 * expression.cs (Expression::ImplicitReferenceConversion): Implement
4908 some of the other conversions mentioned in the spec.
4910 * typemanager.cs (array_type): New static member for the System.Array built-in
4913 (cloneable_interface): For System.ICloneable interface.
4915 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
4916 we start resolving the tree and populating types.
4918 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
4920 2001-10-01 Miguel de Icaza <miguel@ximian.com>
4922 * expression.cs (Expression::ExprClassFromMemberInfo,
4923 Expression::Literalize): Create literal expressions from
4924 FieldInfos which are literals.
4926 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
4927 type casts, because they were wrong. The test suite in tests
4930 (ImplicitNumericConversion): ushort to ulong requires a widening
4933 Int32 constant to long requires widening cast as well.
4935 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
4936 for integers because the type on the stack is not i4.
4938 2001-09-30 Miguel de Icaza <miguel@ximian.com>
4940 * expression.cs (report118): require location argument.
4942 * parameter.cs: Do not dereference potential null value.
4944 * class.cs: Catch methods that lack the `new' keyword when
4945 overriding a name. Report warnings when `new' is used without
4946 anything being there to override.
4948 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
4950 * class.cs: Only add constructor to hashtable if it is non-null
4951 (as now constructors can fail on define).
4953 (TypeManager, Class, Struct): Take location arguments.
4955 Catch field instance initialization in structs as errors.
4957 accepting_filter: a new filter for FindMembers that is static so
4958 that we dont create an instance per invocation.
4960 (Constructor::Define): Catch errors where a struct constructor is
4963 * cs-parser.jay: Pass location information for various new
4966 * delegate.cs (Delegate): take a location argument.
4968 * driver.cs: Do not call EmitCode if there were problesm in the
4969 Definition of the types, as many Builders wont be there.
4971 * decl.cs (Decl::Decl): Require a location argument.
4973 * cs-tokenizer.cs: Handle properly hex constants that can not fit
4974 into integers, and find the most appropiate integer for it.
4976 * literal.cs: Implement ULongLiteral.
4978 * rootcontext.cs: Provide better information about the location of
4979 failure when CreateType fails.
4981 2001-09-29 Miguel de Icaza <miguel@ximian.com>
4983 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
4986 * expression.cs (Binary::CheckShiftArguments): Add missing type
4988 (Binary::ResolveOperator): Add type to the logical and and logical
4989 or, Bitwise And/Or and Exclusive Or code paths, it was missing
4992 (Binary::DoNumericPromotions): In the case where either argument
4993 is ulong (and most signed types combined with ulong cause an
4994 error) perform implicit integer constant conversions as well.
4996 2001-09-28 Miguel de Icaza <miguel@ximian.com>
4998 * expression.cs (UserImplicitCast): Method should always be
5000 (Invocation::BetterConversion): Simplified test for IntLiteral.
5002 (Expression::ImplicitNumericConversion): Split this routine out.
5003 Put the code that performs implicit constant integer conversions
5006 (Expression::Resolve): Become a wrapper around DoResolve so we can
5007 check eclass and type being set after resolve.
5009 (Invocation::Badness): Remove this dead function
5011 (Binary::ResolveOperator): Do not compute the expensive argumnets
5012 unless we have a union for it.
5014 (Probe::Emit): Is needs to do an isinst and then
5015 compare against null.
5017 (::CanConvert): Added Location argument. If the Location argument
5018 is null (Location.Null), then we do not report errors. This is
5019 used by the `probe' mechanism of the Explicit conversion. We do
5020 not want to generate an error for something that the user
5021 explicitly requested to be casted. But the pipeline for an
5022 explicit cast first tests for potential implicit casts.
5024 So for now, if the Location is null, it means `Probe only' to
5025 avoid adding another argument. Might have to revise this
5028 (ClassCast): New class used to type cast objects into arbitrary
5029 classes (used in Explicit Reference Conversions).
5031 Implement `as' as well.
5033 Reverted all the patches from Ravi below: they were broken:
5035 * The use of `level' as a mechanism to stop recursive
5036 invocations is wrong. That was there just to catch the
5037 bug with a strack trace but not as a way of addressing
5040 To fix the problem we have to *understand* what is going
5041 on and the interactions and come up with a plan, not
5042 just get things going.
5044 * The use of the type conversion cache that I proposed
5045 last night had an open topic: How does this work across
5046 protection domains. A user defined conversion might not
5047 be public in the location where we are applying the
5048 conversion, a different conversion might be selected
5049 (ie, private A->B (better) but public B->A (worse),
5050 inside A, A->B applies, but outside it, B->A will
5053 * On top of that (ie, even if the above is solved),
5054 conversions in a cache need to be abstract. Ie, `To
5055 convert from an Int to a Short use an OpcodeCast', not
5056 `To convert from an Int to a Short use the OpcodeCast on
5057 the variable 5' (which is what this patch was doing).
5059 2001-09-28 Ravi Pratap <ravi@ximian.com>
5061 * expression.cs (Invocation::ConversionExists): Re-write to use
5062 the conversion cache
5064 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
5065 cache all conversions done, not just user-defined ones.
5067 (Invocation::BetterConversion): The real culprit. Use ConversionExists
5068 to determine if a conversion exists instead of acutually trying to
5069 perform the conversion. It's faster too.
5071 (Expression::ConvertExplicit): Modify to use ConversionExists to check
5072 and only then attempt the implicit conversion.
5074 2001-09-28 Ravi Pratap <ravi@ximian.com>
5076 * expression.cs (ConvertImplicit): Use a cache for conversions
5077 already found. Check level of recursion and bail out if necessary.
5079 2001-09-28 Miguel de Icaza <miguel@ximian.com>
5081 * typemanager.cs (string_concat_string_string, string_concat_object_object):
5082 Export standard methods that we expect for string operations.
5084 * statement.cs (Block::UsageWarning): Track usage of variables and
5085 report the errors for not used variables.
5087 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
5090 2001-09-27 Miguel de Icaza <miguel@ximian.com>
5092 * codegen.cs: remove unnneded code
5094 * expression.cs: Removed BuiltinTypeAccess class
5096 Fix the order in which implicit conversions are
5099 The previous fixed dropped support for boxed conversions (adding a
5100 test to the test suite now)
5102 (UserImplicitCast::CanConvert): Remove test for source being null,
5103 that code is broken. We should not feed a null to begin with, if
5104 we do, then we should track the bug where the problem originates
5105 and not try to cover it up here.
5107 Return a resolved expression of type UserImplicitCast on success
5108 rather than true/false. Ravi: this is what I was talking about,
5109 the pattern is to use a static method as a "constructor" for
5112 Also, do not create arguments until the very last minute,
5113 otherwise we always create the arguments even for lookups that
5114 will never be performed.
5116 (UserImplicitCast::Resolve): Eliminate, objects of type
5117 UserImplicitCast are born in a fully resolved state.
5119 * typemanager.cs (InitCoreTypes): Init also value_type
5122 * expression.cs (Cast::Resolve): First resolve the child expression.
5124 (LValue): Add new method AddressOf to be used by
5127 Change the argument of Store to take an EmitContext instead of an
5128 ILGenerator, because things like FieldExpr need to be able to call
5129 their children expression to generate the instance code.
5131 (Expression::Error, Expression::Warning): Sugar functions for
5134 (Expression::MemberLookup): Accept a TypeContainer instead of a
5135 Report as the first argument.
5137 (Expression::ResolvePrimary): Killed. I still want to improve
5138 this as currently the code is just not right.
5140 (Expression::ResolveMemberAccess): Simplify, but it is still
5143 (Unary::Resolve): Catch errors in AddressOf operators.
5145 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
5146 index to a byte for the short-version, or the compiler will choose
5147 the wrong Emit call, which generates the wrong data.
5149 (ParameterReference::Emit, ::Store): same.
5151 (FieldExpr::AddressOf): Implement.
5153 * typemanager.cs: TypeManager: made public variable instead of
5156 * driver.cs: document --fatal.
5158 * report.cs (ErrorMessage, WarningMessage): new names for the old
5159 Error and Warning classes.
5161 * cs-parser.jay (member_access): Turn built-in access to types
5162 into a normal simplename
5164 2001-09-27 Ravi Pratap <ravi@ximian.com>
5166 * expression.cs (Invocation::BetterConversion): Fix to cope
5167 with q being null, since this was introducing a bug.
5169 * expression.cs (ConvertImplicit): Do built-in conversions first.
5171 2001-09-27 Ravi Pratap <ravi@ximian.com>
5173 * expression.cs (UserImplicitCast::Resolve): Fix bug.
5175 2001-09-27 Ravi Pratap <ravi@ximian.com>
5177 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
5178 I had introduced long ago (what's new ?).
5180 * expression.cs (UserImplicitCast::CanConvert): Static method to do
5181 the work of all the checking.
5182 (ConvertImplicit): Call CanConvert and only then create object if necessary.
5183 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
5185 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
5186 that is the right way.
5188 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
5189 overloading resolution. Use everywhere instead of cutting and pasting code.
5191 (Binary::ResolveOperator): Use MakeUnionSet.
5193 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
5194 we have to convert to bool types. Not complete yet.
5196 2001-09-27 Miguel de Icaza <miguel@ximian.com>
5198 * typemanager.cs (TypeManager::CSharpName): support ushort.
5200 * expression.cs (Expression::TryImplicitIntConversion): Attempts
5201 to provide an expression that performsn an implicit constant int
5202 conversion (section 6.1.6).
5203 (Expression::ConvertImplicitRequired): Reworked to include
5204 implicit constant expression conversions.
5206 (Expression::ConvertNumericExplicit): Finished.
5208 (Invocation::Emit): If InstanceExpression is null, then it means
5209 that we perform a call on this.
5211 2001-09-26 Miguel de Icaza <miguel@ximian.com>
5213 * expression.cs (Unary::Emit): Remove some dead code.
5214 (Probe): Implement Resolve and Emit for `is'.
5215 (Expression::ConvertImplicitRequired): Attempt to do constant
5216 expression conversions here. Maybe should be moved to
5217 ConvertImplicit, but I am not sure.
5218 (Expression::ImplicitLongConstantConversionPossible,
5219 Expression::ImplicitIntConstantConversionPossible): New functions
5220 that tell whether is it possible to apply an implicit constant
5221 expression conversion.
5223 (ConvertNumericExplicit): Started work on explicit numeric
5226 * cs-parser.jay: Update operator constants.
5228 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
5229 (Parameters::GetSignature): Hook up VerifyArgs here.
5230 (Parameters::VerifyArgs): Verifies that no two arguments have the
5233 * class.cs (Operator): Update the operator names to reflect the
5234 ones that the spec expects (as we are just stringizing the
5237 * expression.cs (Unary::ResolveOperator): Fix bug: Use
5238 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
5239 previous usage did only work for our methods.
5240 (Expression::ConvertImplicit): Handle decimal implicit numeric
5241 conversions as well.
5242 (Expression::InternalTypeConstructor): Used to invoke constructors
5243 on internal types for default promotions.
5245 (Unary::Emit): Implement special handling for the pre/post
5246 increment/decrement for overloaded operators, as they need to have
5247 the same semantics as the other operators.
5249 (Binary::ResolveOperator): ditto.
5250 (Invocation::ConversionExists): ditto.
5251 (UserImplicitCast::Resolve): ditto.
5253 2001-09-26 Ravi Pratap <ravi@ximian.com>
5255 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
5256 operator, return after emitting body. Regression tests pass again !
5258 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
5259 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
5260 (Invocation::OverloadResolve): Ditto.
5261 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
5263 * everywhere : update calls to the above methods accordingly.
5265 2001-09-26 Miguel de Icaza <miguel@ximian.com>
5267 * assign.cs (Assign): Make it inherit from ExpressionStatement.
5269 * expression.cs (ExpressionStatement): New base class used for
5270 expressions that can appear in statements, so that we can provide
5271 an alternate path to generate expression that do not leave a value
5274 (Expression::Emit, and all the derivatives): We no longer return
5275 whether a value is left on the stack or not. Every expression
5276 after being emitted leaves a single value on the stack.
5278 * codegen.cs (EmitContext::EmitStatementExpression): Use the
5279 facilties of ExpressionStatement if possible.
5281 * cs-parser.jay: Update statement_expression.
5283 2001-09-25 Miguel de Icaza <miguel@ximian.com>
5285 * driver.cs: Change the wording of message
5287 2001-09-25 Ravi Pratap <ravi@ximian.com>
5289 * expression.cs (Binary::ResolveOperator): Had forgottten to set
5290 the type of the expression to the return type of the method if
5291 we have an overloaded operator match ! The regression tests pass again !
5292 (Unary::ResolveOperator): Ditto.
5294 * expression.cs (Invocation::ConversionExists): Correct the member lookup
5295 to find "op_Implicit", not "implicit" ;-)
5296 (UserImplicitCast): New class to take care of user-defined implicit conversions.
5297 (ConvertImplicit, ForceConversion): Take TypeContainer argument
5299 * everywhere : Correct calls to the above accordingly.
5301 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
5302 (ConvertImplicit): Do user-defined conversion if it exists.
5304 2001-09-24 Miguel de Icaza <miguel@ximian.com>
5306 * assign.cs: track location.
5307 (Resolve): Use implicit conversions on assignment.
5309 * literal.cs: Oops. Not good, Emit of short access values should
5310 pass (Bytes) or the wrong argument will be selected.
5312 * expression.cs (Unary::Emit): Emit code for -expr.
5314 (Unary::ResolveOperator): Handle `Substract' for non-constants
5315 (substract from zero from the non-constants).
5316 Deal with Doubles as well.
5318 (Expression::ConvertImplicitRequired): New routine that reports an
5319 error if no implicit conversion exists.
5321 (Invocation::OverloadResolve): Store the converted implicit
5322 expressions if we make them
5324 2001-09-24 Ravi Pratap <ravi@ximian.com>
5326 * class.cs (ConstructorInitializer): Take a Location argument.
5327 (ConstructorBaseInitializer): Same here.
5328 (ConstructorThisInitializer): Same here.
5330 * cs-parser.jay : Update all calls accordingly.
5332 * expression.cs (Unary, Binary, New): Take location argument.
5333 Update accordingly everywhere.
5335 * cs-parser.jay : Update all calls to the above to take a location
5340 2001-09-24 Ravi Pratap <ravi@ximian.com>
5342 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
5343 (Invocation::BetterConversion): Same here
5344 (Invocation::ConversionExists): Ditto.
5346 (Invocation::ConversionExists): Implement.
5348 2001-09-22 Ravi Pratap <ravi@ximian.com>
5350 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
5351 Also take an additional TypeContainer argument.
5353 * All over : Pass in TypeContainer as argument to OverloadResolve.
5355 * typemanager.cs (CSharpName): Update to check for the string type and return
5358 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
5361 2001-09-21 Ravi Pratap <ravi@ximian.com>
5363 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
5364 (Invocation::BetterFunction): Implement.
5365 (Invocation::BetterConversion): Implement.
5366 (Invocation::ConversionExists): Skeleton, no implementation yet.
5368 Okay, things work fine !
5370 2001-09-21 Miguel de Icaza <miguel@ximian.com>
5372 * typemanager.cs: declare and load enum_type, delegate_type and
5375 * expression.cs (Expression::Emit): Now emit returns a value that
5376 tells whether a value is left on the stack or not. This strategy
5377 might be reveted tomorrow with a mechanism that would address
5378 multiple assignments.
5379 (Expression::report118): Utility routine to report mismatches on
5382 (Unary::Report23): Report impossible type/operator combination
5385 (Unary::IsIncrementableNumber): Whether the type can be
5386 incremented or decremented with add.
5387 (Unary::ResolveOperator): Also allow enumerations to be bitwise
5389 (Unary::ResolveOperator): Implement ++, !, ~,
5391 (Invocation::Emit): Deal with new Emit convetion.
5393 * All Expression derivatives: Updated their Emit method to return
5394 whether they leave values on the stack or not.
5396 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
5397 stack for expressions that are statements.
5399 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5401 * expression.cs (LValue): New interface. Must be implemented by
5403 (LocalVariableReference, ParameterReference, FieldExpr): Implement
5406 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
5407 interface for generating code, simplifies the code.
5409 2001-09-20 Ravi Pratap <ravi@ximian.com>
5411 * expression.cs (everywhere): Comment out return statements in ::Resolve
5412 methods to avoid the warnings.
5414 2001-09-20 Miguel de Icaza <miguel@ximian.com>
5416 * driver.cs (parse): Report error 2001 if we can not open the
5419 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
5422 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
5425 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
5426 otherwise nested blocks end up with the same index.
5428 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
5430 * expression.cs: Instead of having FIXMEs in the Resolve
5431 functions, throw exceptions so it is obvious that we are facing a
5434 * cs-parser.jay (invocation_expression): Pass Location information.
5436 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
5437 Use a basename for those routines because .NET does not like paths
5440 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
5443 2001-09-19 Miguel de Icaza <miguel@ximian.com>
5445 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
5446 are loading the correct data types (throws an exception if not).
5447 (TypeManager::InitCoreTypes): Use CoreLookupType
5449 * expression.cs (Unary::ResolveOperator): return the child
5450 expression for expressions which are just +expr.
5451 (Unary::ResolveOperator): Return negative literals for -LITERAL
5452 expressions (otherwise they are Unary {Literal}).
5453 (Invocation::Badness): Take into account `Implicit constant
5454 expression conversions'.
5456 * literal.cs (LongLiteral): Implement long literal class.
5457 (IntLiteral): export the `Value' of the intliteral.
5459 2001-09-19 Ravi Pratap <ravi@ximian.com>
5461 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
5463 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
5464 instead of 'Operator'
5466 * expression.cs (Binary::ResolveOperator): Update accordingly.
5467 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
5470 * cs-parser.jay (unary_expression): Update to use the new names.
5472 * gen-treedump.cs (GetUnary): Same here.
5474 * expression.cs (Unary::Resolve): Implement.
5475 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
5476 operators are found instead of making noise ;-)
5477 (Unary::ResolveOperator): New method to do precisely the same thing which
5478 Binary::ResolveOperator does for Binary expressions.
5479 (Unary.method, .Arguments): Add.
5480 (Unary::OperName): Implement.
5481 (Unary::ForceConversion): Copy and Paste !
5483 * class.cs (Operator::Define): Fix a small bug for the case when we have
5486 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
5487 for the inbuilt operators. Only overloading works for now ;-)
5489 2001-09-18 Miguel de Icaza <miguel@ximian.com>
5491 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
5492 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
5494 * expression.cs (This::Emit): Implement.
5495 (This::Resolve): Implement.
5496 (TypeOf:Resolve): Implement.
5497 (Expression::ResolveSimpleName): Add an implicit this to instance
5499 (MemberAccess::Resolve): Deal with Parameters and Fields.
5500 Bind instance variable to Field expressions.
5501 (FieldExpr::Instance): New field used to track the expression that
5502 represents the object instance.
5503 (FieldExpr::Resolve): Track potential errors from MemberLookup not
5505 (FieldExpr::Emit): Implement.
5507 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
5508 the last instruction contains a return opcode to avoid generating
5509 the last `ret' instruction (this generates correct code, and it is
5510 nice to pass the peverify output).
5512 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
5513 initializer for static and instance variables.
5514 (Constructor::Emit): Allow initializer to be null in the case of
5515 static constructors. Only emit initializer for instance
5518 (TypeContainer::FindMembers): Return a null array if there are no
5521 Also fix the code for the MemberTypes.Method branch, as it was not
5522 scanning that for operators (or tried to access null variables before).
5524 * assign.cs (Assign::Emit): Handle instance and static fields.
5528 * driver.cs: Stop compilation if there are parse errors.
5530 * cs-parser.jay (constructor_declaration): Provide default base
5531 initializer for non-static constructors.
5532 (constructor_declarator): Do not provide a default base
5533 initializers if none was specified.
5534 Catch the fact that constructors should not have parameters.
5536 * class.cs: Do not emit parent class initializers for static
5537 constructors, that should be flagged as an error.
5539 2001-09-18 Ravi Pratap <ravi@ximian.com>
5541 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
5542 Move back code into TypeContainer::Populate.
5544 2001-09-18 Ravi Pratap <ravi@ximian.com>
5546 * class.cs (TypeContainer::AddConstructor): Fix the check to
5547 compare against Name, not Basename.
5548 (Operator::OpType): Change Plus and Minus to Add and Subtract.
5550 * cs-parser.jay : Update accordingly.
5552 * class.cs (TypeContainer::FindMembers): For the case where we are searching
5553 for methods, don't forget to look into the operators too.
5554 (RegisterMethodBuilder): Helper method to take care of this for
5555 methods, constructors and operators.
5556 (Operator::Define): Completely revamp.
5557 (Operator.OperatorMethod, MethodName): New fields.
5558 (TypeContainer::Populate): Move the registering of builders into
5559 RegisterMethodBuilder.
5560 (Operator::Emit): Re-write.
5562 * expression.cs (Binary::Emit): Comment out code path to emit method
5563 invocation stuff for the case when we have a user defined operator. I am
5564 just not able to get it right !
5566 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5568 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
5571 (Expression::MemberLookup): Provide a version that allows to
5572 specify the MemberTypes and BindingFlags.
5574 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
5575 so it was not fetching variable information from outer blocks.
5577 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
5578 Beforefieldinit as it was buggy.
5580 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
5583 * class.cs (Constructor::Emit): Only emit if block is not null.
5584 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
5585 deal with this by semantically definining it as if the user had
5588 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
5589 constructors as we now "emit" them at a higher level.
5591 (TypeContainer::DefineDefaultConstructor): Used to define the
5592 default constructors if none was provided.
5594 (ConstructorInitializer): Add methods Resolve and Emit.
5596 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
5598 2001-09-17 Ravi Pratap <ravi@ximian.com>
5600 * class.cs (TypeContainer::EmitDefaultConstructor): Register
5601 the default constructor builder with our hashtable for methodbuilders
5604 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
5605 and argument_count is 0 in which case we have a match.
5606 (Binary::ResolveOperator): More null checking and miscellaneous coding
5609 2001-09-17 Ravi Pratap <ravi@ximian.com>
5611 * rootcontext.cs (IsNameSpace): Compare against null.
5613 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
5615 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
5616 and Unary::Operator.
5618 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
5621 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
5622 we have overloaded operators.
5623 (Binary::ResolveOperator): Implement the part which does the operator overload
5626 * class.cs (Operator::Emit): Implement.
5627 (TypeContainer::Emit): Emit the operators we have too.
5629 * expression.cs (Binary::Emit): Update to emit the appropriate code for
5630 the case when we have a user-defined operator.
5632 2001-09-17 Miguel de Icaza <miguel@ximian.com>
5634 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
5636 2001-09-16 Ravi Pratap <ravi@ximian.com>
5638 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
5639 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
5640 (Constructor::Emit): Implement.
5641 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
5642 if we have no work to do.
5643 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
5646 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
5647 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
5649 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
5652 2001-09-15 Ravi Pratap <ravi@ximian.com>
5654 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
5656 (Tree::RecordNamespace): Method to do what the name says ;-)
5657 (Tree::Namespaces): Property to get at the namespaces hashtable.
5659 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
5662 * rootcontext.cs (IsNamespace): Fixed it :-)
5664 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5666 * class.cs (TypeContainer::FindMembers): Add support for
5668 (MethodCore): New class that encapsulates both the shared aspects
5669 of a Constructor and a Method.
5670 (Method, Constructor): Factored pieces into MethodCore.
5672 * driver.cs: Added --fatal which makes errors throw exceptions.
5673 Load System assembly as well as part of the standard library.
5675 * report.cs: Allow throwing exceptions on errors for debugging.
5677 * modifiers.cs: Do not use `parent', instead use the real type
5678 container to evaluate permission settings.
5680 * class.cs: Put Ravi's patch back in. He is right, and we will
5681 have to cope with the
5683 2001-09-14 Ravi Pratap <ravi@ximian.com>
5685 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
5686 FamORAssem, not FamANDAssem.
5688 2001-09-14 Miguel de Icaza <miguel@ximian.com>
5690 * driver.cs: Added --parse option that only parses its input files
5693 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
5694 incorrect. IsTopLevel is not used to tell whether an object is
5695 root_types or not (that can be achieved by testing this ==
5696 root_types). But to see if this is a top-level *class* (not
5697 necessarly our "toplevel" container).
5699 2001-09-14 Ravi Pratap <ravi@ximian.com>
5701 * enum.cs (Enum::Define): Modify to call the Lookup method on the
5702 parent instead of a direct call to GetType.
5704 2001-09-14 Ravi Pratap <ravi@ximian.com>
5706 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
5707 Modifiers.TypeAttr. This should just be a call to that method.
5709 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
5710 object so that we can determine if we are top-level or not.
5712 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
5715 * enum.cs (Enum::Define): Ditto.
5717 * modifiers.cs (FieldAttr): Re-write.
5719 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
5720 (TypeContainer::HaveStaticConstructor): New property to provide access
5721 to precisely that info.
5723 * modifiers.cs (MethodAttr): Re-write.
5724 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
5726 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
5727 of top-level types as claimed.
5729 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5731 * expression.cs (MemberLookup): Fruitless attempt to lookup
5732 constructors. Maybe I need to emit default constructors? That
5733 might be it (currently .NET emits this for me automatically).
5734 (Invocation::OverloadResolve): Cope with Arguments == null.
5735 (Invocation::EmitArguments): new function, shared by the new
5737 (Invocation::Emit): Handle static and instance methods. Emit
5738 proper call instruction for virtual or non-virtual invocations.
5739 (New::Emit): Implement.
5740 (New::Resolve): Implement.
5741 (MemberAccess:Resolve): Implement.
5742 (MethodGroupExpr::InstanceExpression): used conforming to the spec
5744 (FieldExpr::Resolve): Set type.
5746 * support.cs: Handle empty arguments.
5748 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
5749 SimpleLookup): Auxiliary routines to help parse a qualifier
5752 Update qualifier_identifier rule.
5754 * codegen.cs: Removed debugging messages.
5756 * class.cs: Make this a global thing, this acts just as a "key" to
5757 objects that we might have around.
5759 (Populate): Only initialize method_builders_to_methods once.
5761 * expression.cs (PropertyExpr): Initialize type from the
5764 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
5765 Resolve pattern. Attempt to implicitly convert value to boolean.
5768 * expression.cs: Set the type for the int32/int32 argument case.
5769 (Binary::ResolveOperator): Set the return type to boolean for
5770 comparission operators
5772 * typemanager.cs: Remove debugging print code.
5774 (Invocation::Resolve): resolve type.
5776 * class.cs: Allocate a MemberInfo of the correct size, as the code
5777 elsewhere depends on the test to reflect the correct contents.
5779 (Method::) Keep track of parameters, due to System.Reflection holes
5781 (TypeContainer::Populate): Keep track of MethodBuilders to Method
5784 (TypeContainer::FindMembers): Use ArrayList and then copy an array
5785 of the exact size and return that.
5787 (Class::LookupMethodByBuilder): New function that maps
5788 MethodBuilders to its methods. Required to locate the information
5789 on methods because System.Reflection bit us again.
5791 * support.cs: New file, contains an interface ParameterData and
5792 two implementations: ReflectionParameters and InternalParameters
5793 used to access Parameter information. We will need to grow this
5796 * expression.cs (Invocation::GetParameterData): implement a cache
5797 and a wrapper around the ParameterData creation for methods.
5798 (Invocation::OverloadResolve): Use new code.
5800 2001-09-13 Ravi Pratap <ravi@ximian.com>
5802 * class.cs (TypeContainer::EmitField): Remove and move into
5803 (Field::Define): here and modify accordingly.
5804 (Field.FieldBuilder): New member.
5805 (TypeContainer::Populate): Update accordingly.
5806 (TypeContainer::FindMembers): Implement.
5808 2001-09-13 Miguel de Icaza <miguel@ximian.com>
5810 * statement.cs: (VariableInfo::VariableType): New field to be
5811 initialized with the full type once it is resolved.
5813 2001-09-12 Miguel de Icaza <miguel@ximian.com>
5815 * parameter.cs (GetParameterInfo): Use a type cache to compute
5816 things only once, and to reuse this information
5818 * expression.cs (LocalVariableReference::Emit): Implement.
5819 (OpcodeCast::Emit): fix.
5821 (ParameterReference::Resolve): Implement.
5822 (ParameterReference::Emit): Implement.
5824 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
5825 that are expressions need to stay as Expressions.
5827 * typemanager.cs (CSharpName): Returns the C# name of a type if
5830 * expression.cs (Expression::ConvertImplicit): New function that
5831 implements implicit type conversions.
5833 (Expression::ImplicitReferenceConversion): Implements implicit
5834 reference conversions.
5836 (EmptyCast): New type for transparent casts.
5838 (OpcodeCast): New type for casts of types that are performed with
5839 a sequence of bytecodes.
5841 (BoxedCast): New type used for casting value types into reference
5842 types. Emits a box opcode.
5844 (Binary::DoNumericPromotions): Implements numeric promotions of
5845 and computation of the Binary::Type.
5847 (Binary::EmitBranchable): Optimization.
5849 (Binary::Emit): Implement code emission for expressions.
5851 * typemanager.cs (TypeManager): Added two new core types: sbyte
5854 2001-09-12 Ravi Pratap <ravi@ximian.com>
5856 * class.cs (TypeContainer::FindMembers): Method which does exactly
5857 what Type.FindMembers does, only we don't have to use reflection. No
5860 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
5861 typecontainer objects as we need to get at them.
5862 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
5864 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
5865 typecontainer object.
5867 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
5868 of just a Report object.
5870 2001-09-11 Ravi Pratap <ravi@ximian.com>
5872 * class.cs (Event::Define): Go back to using the prefixes "add_" and
5874 (TypeContainer::Populate): Now define the delegates of the type too.
5875 (TypeContainer.Delegates): Property to access the list of delegates defined
5878 * delegates.cs (Delegate::Define): Implement partially.
5880 * modifiers.cs (TypeAttr): Handle more flags.
5882 2001-09-11 Ravi Pratap <ravi@ximian.com>
5884 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
5886 (Operator::Define): Re-write logic to get types by using the LookupType method
5887 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
5888 (Indexer::Define): Ditto.
5889 (Event::Define): Ditto.
5890 (Property::Define): Ditto.
5892 2001-09-10 Ravi Pratap <ravi@ximian.com>
5894 * class.cs (TypeContainer::Populate): Now define operators too.
5895 (TypeContainer.Operators): New property to access the list of operators
5897 (Operator.OperatorMethodBuilder): New member to hold the method builder
5898 for the operator we are defining.
5899 (Operator::Define): Implement.
5901 2001-09-10 Ravi Pratap <ravi@ximian.com>
5903 * class.cs (Event::Define): Make the prefixes of the accessor methods
5904 addOn_ and removeOn_
5906 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
5907 of the location being passed in too. Ideally, this should go later since all
5908 error reporting should be done through the Report object.
5910 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
5911 (Populate): Iterate thru the indexers we have and define them too.
5912 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
5913 for the get and set accessors.
5914 (Indexer::Define): Implement.
5916 2001-09-09 Miguel de Icaza <miguel@ximian.com>
5918 * expression.cs (Binary::Resolve): Beginning of it. I scratched
5919 my previous implementation, did not work.
5921 * typemanager.cs: Add a couple of missing types (the longs).
5923 * literal.cs: Use TypeManager.bool_type instead of getting it.
5925 * expression.cs (EventExpr): New kind of expressions.
5926 (Expressio::ExprClassFromMemberInfo): finish
5928 2001-09-08 Miguel de Icaza <miguel@ximian.com>
5930 * assign.cs: Emit stores to static fields differently.
5932 2001-09-08 Ravi Pratap <ravi@ximian.com>
5934 * Merge in changes and adjust code to tackle conflicts. Backed out my
5935 code in Assign::Resolve ;-)
5937 2001-09-08 Ravi Pratap <ravi@ximian.com>
5939 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
5940 instead Report.Error and also pass in the location.
5941 (CSharpParser::Lexer): New readonly property to return the reference
5942 to the Tokenizer object.
5943 (declare_local_variables): Use Report.Error with location instead of plain
5947 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
5948 (Operator.CheckBinaryOperator): Ditto.
5950 * cs-parser.jay (operator_declarator): Update accordingly.
5952 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
5953 (CheckBinaryOperator): Same here.
5955 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
5956 on the name without any prefixes of namespace names etc. This is because we
5957 already might have something already fully qualified like
5958 'System.Console.WriteLine'
5960 * assign.cs (Resolve): Begin implementation. Stuck ;-)
5962 2001-09-07 Ravi Pratap <ravi@ximian.com>
5964 * cs-tokenizer.cs (location): Return a string which also contains
5967 * expression.cs (ElementAccess): New class for expressions of the
5968 type 'element access.'
5969 (BaseAccess): New class for expressions of the type 'base access.'
5970 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
5973 * cs-parser.jay (element_access): Implement action.
5974 (base_access): Implement actions.
5975 (checked_expression, unchecked_expression): Implement.
5977 * cs-parser.jay (local_variable_type): Correct and implement.
5978 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
5980 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
5982 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
5983 name and the specifiers.
5985 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
5987 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
5988 making them all public ;-)
5990 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
5993 2001-09-07 Miguel de Icaza <miguel@ximian.com>
5995 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
5997 (FieldExpr, PropertyExprs): New resolved expressions.
5998 (SimpleName::MemberStaticCheck): Perform static checks for access
5999 to non-static fields on static methods. Maybe this should be
6000 generalized for MemberAccesses.
6001 (SimpleName::ResolveSimpleName): More work on simple name
6004 * cs-parser.jay (primary_expression/qualified_identifier): track
6005 the parameter index.
6007 * codegen.cs (CodeGen::Save): Catch save exception, report error.
6008 (EmitContext::EmitBoolExpression): Chain to expression generation
6009 instead of temporary hack.
6010 (::EmitStatementExpression): Put generic expression code generation.
6012 * assign.cs (Assign::Emit): Implement variable assignments to
6013 local variables, parameters and fields.
6015 2001-09-06 Miguel de Icaza <miguel@ximian.com>
6017 * statement.cs (Block::GetVariableInfo): New method, returns the
6018 VariableInfo for a variable name in a block.
6019 (Block::GetVariableType): Implement in terms of GetVariableInfo
6021 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
6022 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
6024 2001-09-06 Ravi Pratap <ravi@ximian.com>
6026 * cs-parser.jay (operator_declaration): Continue on my quest : update
6027 to take attributes argument.
6028 (event_declaration): Ditto.
6029 (enum_declaration): Ditto.
6030 (indexer_declaration): Ditto.
6032 * class.cs (Operator::Operator): Update constructor accordingly.
6033 (Event::Event): Ditto.
6035 * delegate.cs (Delegate::Delegate): Same here.
6037 * enum.cs (Enum::Enum): Same here.
6039 2001-09-05 Ravi Pratap <ravi@ximian.com>
6041 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
6043 * ../tests/cs0658.cs : New file to demonstrate error 0658.
6045 * attribute.cs (Attributes): New class to encapsulate all attributes which were
6046 being passed around as an arraylist.
6047 (Attributes::AddAttribute): Method to add attribute sections.
6049 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
6050 (struct_declaration): Update accordingly.
6051 (constant_declaration): Update.
6052 (field_declaration): Update.
6053 (method_header): Update.
6054 (fixed_parameter): Update.
6055 (parameter_array): Ditto.
6056 (property_declaration): Ditto.
6057 (destructor_declaration): Ditto.
6059 * class.cs (Struct::Struct): Update constructors accordingly.
6060 (Class::Class): Ditto.
6061 (Field::Field): Ditto.
6062 (Method::Method): Ditto.
6063 (Property::Property): Ditto.
6064 (TypeContainer::OptAttribute): update property's return type.
6066 * interface.cs (Interface.opt_attributes): New member.
6067 (Interface::Interface): Update to take the extra Attributes argument.
6069 * parameter.cs (Parameter::Parameter): Ditto.
6071 * constant.cs (Constant::Constant): Ditto.
6073 * interface.cs (InterfaceMemberBase): New OptAttributes field.
6074 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
6075 the attributes as a parameter.
6076 (InterfaceProperty): Update constructor call.
6077 (InterfaceEvent): Ditto.
6078 (InterfaceMethod): Ditto.
6079 (InterfaceIndexer): Ditto.
6081 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
6082 pass the attributes too.
6083 (interface_event_declaration): Ditto.
6084 (interface_property_declaration): Ditto.
6085 (interface_method_declaration): Ditto.
6086 (interface_declaration): Ditto.
6088 2001-09-05 Miguel de Icaza <miguel@ximian.com>
6090 * class.cs (Method::Define): Track the "static Main" definition to
6091 create an entry point.
6093 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
6094 EntryPoint if we find it.
6096 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
6097 (EmitContext::ig): Make this variable public.
6099 * driver.cs: Make the default output file be the first file name
6100 with the .exe extension.
6102 Detect empty compilations
6104 Handle various kinds of output targets. Handle --target and
6105 rename -t to --dumper.
6107 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
6108 methods inherited from Expression return now an Expression. This
6109 will is used during the tree rewriting as we resolve them during
6112 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
6113 the spec. Missing entirely is the information about
6114 accessability of elements of it.
6116 (Expression::ExprClassFromMemberInfo): New constructor for
6117 Expressions that creates a fully initialized Expression based on
6118 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
6121 (Invocation::Resolve): Begin implementing resolution of invocations.
6123 * literal.cs (StringLiteral): Implement Emit.
6125 2001-09-05 Ravi Pratap <ravi@ximian.com>
6127 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
6130 2001-09-04 Ravi Pratap <ravi@ximian.com>
6132 * cs-parser.jay (attribute_arguments): Implement actions.
6133 (attribute): Fix bug in production. Implement action.
6134 (attribute_list): Implement.
6135 (attribute_target): Implement.
6136 (attribute_target_specifier, opt_target_specifier): Implement
6137 (CheckAttributeTarget): New method to check if the attribute target
6139 (attribute_section): Implement.
6140 (opt_attributes): Implement.
6142 * attribute.cs : New file to handle attributes.
6143 (Attribute): Class to hold attribute info.
6145 * cs-parser.jay (opt_attribute_target_specifier): Remove production
6146 (attribute_section): Modify production to use 2 different rules to
6147 achieve the same thing. 1 s/r conflict down !
6148 Clean out commented, useless, non-reducing dimension_separator rules.
6150 * class.cs (TypeContainer.attributes): New member to hold list
6151 of attributes for a type.
6152 (Struct::Struct): Modify to take one more argument, the attribute list.
6153 (Class::Class): Ditto.
6154 (Field::Field): Ditto.
6155 (Method::Method): Ditto.
6156 (Property::Property): Ditto.
6158 * cs-parser.jay (struct_declaration): Update constructor call to
6159 pass in the attributes too.
6160 (class_declaration): Ditto.
6161 (constant_declaration): Ditto.
6162 (field_declaration): Ditto.
6163 (method_header): Ditto.
6164 (fixed_parameter): Ditto.
6165 (parameter_array): Ditto.
6166 (property_declaration): Ditto.
6168 * constant.cs (Constant::Constant): Update constructor similarly.
6169 Use System.Collections.
6171 * parameter.cs (Parameter::Parameter): Update as above.
6173 2001-09-02 Ravi Pratap <ravi@ximian.com>
6175 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
6176 (TypeContainer.delegates): New member to hold list of delegates.
6178 * cs-parser.jay (delegate_declaration): Implement the action correctly
6179 this time as I seem to be on crack ;-)
6181 2001-09-02 Miguel de Icaza <miguel@ximian.com>
6183 * rootcontext.cs (RootContext::IsNamespace): new function, used to
6184 tell whether an identifier represents a namespace.
6186 * expression.cs (NamespaceExpr): A namespace expression, used only
6187 temporarly during expression resolution.
6188 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
6189 utility functions to resolve names on expressions.
6191 2001-09-01 Miguel de Icaza <miguel@ximian.com>
6193 * codegen.cs: Add hook for StatementExpressions.
6195 * class.cs: Fix inverted test for static flag in methods.
6197 2001-09-02 Ravi Pratap <ravi@ximian.com>
6199 * class.cs (Operator::CheckUnaryOperator): Correct error number used
6200 to make it coincide with MS' number.
6201 (Operator::CheckBinaryOperator): Ditto.
6203 * ../errors/errors.txt : Remove error numbers added earlier.
6205 * ../errors/cs1019.cs : Test case for error # 1019
6207 * ../errros/cs1020.cs : Test case for error # 1020
6209 * cs-parser.jay : Clean out commented cruft.
6210 (dimension_separators, dimension_separator): Comment out. Ostensibly not
6211 used anywhere - non-reducing rule.
6212 (namespace_declarations): Non-reducing rule - comment out.
6214 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
6215 with TypeContainer::AddEnum.
6217 * delegate.cs : New file for delegate handling classes.
6218 (Delegate): Class for declaring delegates.
6220 * makefile : Update.
6222 * cs-parser.jay (delegate_declaration): Implement.
6224 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
6226 * class.cs (Event::Define): Implement.
6227 (Event.EventBuilder): New member.
6229 * class.cs (TypeContainer::Populate): Update to define all enums and events
6231 (Events): New property for the events arraylist we hold. Shouldn't we move to using
6232 readonly fields for all these cases ?
6234 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
6236 * class.cs (Property): Revamp to use the convention of making fields readonly.
6237 Accordingly modify code elsewhere.
6239 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
6240 the Define method of the Property class.
6242 * class.cs : Clean up applied patch and update references to variables etc. Fix
6244 (TypeContainer::Populate): Update to define all the properties we have. Also
6245 define all enumerations.
6247 * enum.cs (Define): Implement.
6249 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
6251 * cs-parser.jay (overloadable_operator): The semantic value is an
6252 enum of the Operator class.
6253 (operator_declarator): Implement actions.
6254 (operator_declaration): Implement.
6256 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
6257 validity of definitions.
6258 (Operator::CheckBinaryOperator): Static method to check for binary operators
6259 (TypeContainer::AddOperator): New method to add an operator to a type.
6261 * cs-parser.jay (indexer_declaration): Added line to actually call the
6262 AddIndexer method so it gets added ;-)
6264 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
6265 already taken care of by the MS compiler ?
6267 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
6269 * class.cs (Operator): New class for operator declarations.
6270 (Operator::OpType): Enum for the various operators.
6272 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
6274 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
6275 ostensibly handle this in semantic analysis.
6277 * cs-parser.jay (general_catch_clause): Comment out
6278 (specific_catch_clauses, specific_catch_clause): Ditto.
6279 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
6280 (catch_args, opt_catch_args): New productions.
6281 (catch_clause): Rewrite to use the new productions above
6282 (catch_clauses): Modify accordingly.
6283 (opt_catch_clauses): New production to use in try_statement
6284 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
6285 and re-write the code in the actions to extract the specific and
6286 general catch clauses by being a little smart ;-)
6288 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
6289 Hooray, try and catch statements parse fine !
6291 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6293 * statement.cs (Block::GetVariableType): Fix logic to extract the type
6294 string from the hashtable of variables.
6296 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
6297 I end up making that mistake ;-)
6298 (catch_clauses): Fixed gross error which made Key and Value of the
6299 DictionaryEntry the same : $1 !!
6301 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6303 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
6305 * cs-parser.jay (event_declaration): Correct to remove the semicolon
6306 when the add and remove accessors are specified.
6308 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
6310 * cs-parser.jay (IndexerDeclaration): New helper class to hold
6311 information about indexer_declarator.
6312 (indexer_declarator): Implement actions.
6313 (parsing_indexer): New local boolean used to keep track of whether
6314 we are parsing indexers or properties. This is necessary because
6315 implicit_parameters come into picture even for the get accessor in the
6317 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
6319 * class.cs (Indexer): New class for indexer declarations.
6320 (TypeContainer::AddIndexer): New method to add an indexer to a type.
6321 (TypeContainer::indexers): New member to hold list of indexers for the
6324 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6326 * cs-parser.jay (add_accessor_declaration): Implement action.
6327 (remove_accessor_declaration): Implement action.
6328 (event_accessors_declaration): Implement
6329 (variable_declarators): swap statements for first rule - trivial.
6331 * class.cs (Event): New class to hold information about event
6333 (TypeContainer::AddEvent): New method to add an event to a type
6334 (TypeContainer::events): New member to hold list of events.
6336 * cs-parser.jay (event_declaration): Implement actions.
6338 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
6340 * cs-parser.jay (dim_separators): Implement. Make it a string
6341 concatenating all the commas together, just as they appear.
6342 (opt_dim_separators): Modify accordingly
6343 (rank_specifiers): Update accordingly. Basically do the same
6344 thing - instead, collect the brackets here.
6345 (opt_rank_sepcifiers): Modify accordingly.
6346 (array_type): Modify to actually return the complete type string
6347 instead of ignoring the rank_specifiers.
6348 (expression_list): Implement to collect the expressions
6349 (variable_initializer): Implement. We make it a list of expressions
6350 essentially so that we can handle the array_initializer case neatly too.
6351 (variable_initializer_list): Implement.
6352 (array_initializer): Make it a list of variable_initializers
6353 (opt_array_initializer): Modify accordingly.
6355 * expression.cs (New::NType): Add enumeration to help us
6356 keep track of whether we have an object/delegate creation
6357 or an array creation.
6358 (New:NewType, New::Rank, New::Indices, New::Initializers): New
6359 members to hold data about array creation.
6360 (New:New): Modify to update NewType
6361 (New:New): New Overloaded contructor for the array creation
6364 * cs-parser.jay (array_creation_expression): Implement to call
6365 the overloaded New constructor.
6367 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
6369 * class.cs (TypeContainer::Constructors): Return member
6370 constructors instead of returning null.
6372 2001-08-26 Miguel de Icaza <miguel@ximian.com>
6374 * typemanager.cs (InitCoreTypes): Initialize the various core
6375 types after we have populated the type manager with the user
6376 defined types (this distinction will be important later while
6377 compiling corlib.dll)
6379 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
6380 on Expression Classification. Now all expressions have a method
6381 `Resolve' and a method `Emit'.
6383 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
6384 generation from working. Also add some temporary debugging
6387 2001-08-24 Miguel de Icaza <miguel@ximian.com>
6389 * codegen.cs: Lots of code generation pieces. This is only the
6390 beginning, will continue tomorrow with more touches of polish. We
6391 handle the fundamentals of if, while, do, for, return. Others are
6392 trickier and I need to start working on invocations soon.
6394 * gen-treedump.cs: Bug fix, use s.Increment here instead of
6397 * codegen.cs (EmitContext): New struct, used during code
6398 emission to keep a context. Most of the code generation will be
6401 * cs-parser.jay: Add embedded blocks to the list of statements of
6402 this block. So code generation proceeds in a top down fashion.
6404 2001-08-23 Miguel de Icaza <miguel@ximian.com>
6406 * statement.cs: Add support for multiple child blocks.
6408 2001-08-22 Miguel de Icaza <miguel@ximian.com>
6410 * codegen.cs (EmitCode): New function, will emit the code for a
6411 Block of code given a TypeContainer and its ILGenerator.
6413 * statement.cs (Block): Standard public readonly optimization.
6414 (Block::Block constructors): Link children.
6415 (Block::Child): Child Linker.
6416 (Block::EmitVariables): Emits IL variable declarations.
6418 * class.cs: Drop support for MethodGroups here, delay until
6420 (Method::): Applied the same simplification that I did before, and
6421 move from Properties to public readonly fields.
6422 (Method::ParameterTypes): Returns the parameter types for the
6423 function, and implements a cache that will be useful later when I
6424 do error checking and the semantic analysis on the methods is
6426 (Constructor::GetCallingConvention): Renamed from CallingConvetion
6427 and made a method, optional argument tells whether this is a class
6428 or a structure to apply the `has-this' bit.
6429 (Method::GetCallingConvention): Implement, returns the calling
6431 (Method::Define): Defines the type, a second pass is performed
6432 later to populate the methods.
6434 (Constructor::ParameterTypes): implement a cache similar to the
6435 one on Method::ParameterTypes, useful later when we do semantic
6438 (TypeContainer::EmitMethod): New method. Emits methods.
6440 * expression.cs: Removed MethodGroup class from here.
6442 * parameter.cs (Parameters::GetCallingConvention): new method.
6444 2001-08-21 Miguel de Icaza <miguel@ximian.com>
6446 * class.cs (TypeContainer::Populate): Drop RootContext from the
6449 (Constructor::CallingConvention): Returns the calling convention.
6450 (Constructor::ParameterTypes): Returns the constructor parameter
6453 (TypeContainer::AddConstructor): Keep track of default constructor
6454 and the default static constructor.
6456 (Constructor::) Another class that starts using `public readonly'
6457 instead of properties.
6459 (Constructor::IsDefault): Whether this is a default constructor.
6461 (Field::) use readonly public fields instead of properties also.
6463 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
6464 track of static constructors; If none is used, turn on
6465 BeforeFieldInit in the TypeAttributes.
6467 * cs-parser.jay (opt_argument_list): now the return can be null
6468 for the cases where there are no arguments.
6470 (constructor_declarator): If there is no implicit `base' or
6471 `this', then invoke the default parent constructor.
6473 * modifiers.cs (MethodAttr): New static function maps a set of
6474 modifiers flags into a MethodAttributes enum
6475 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
6476 MethodAttr, TypeAttr to represent the various mappings where the
6478 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
6480 2001-08-19 Miguel de Icaza <miguel@ximian.com>
6482 * parameter.cs (GetParameterInfo): Fix bug where there would be no
6485 * interface.cs (PopulateIndexer): Implemented the code generator
6486 for interface indexers.
6488 2001-08-17 Miguel de Icaza <miguel@ximian.com>
6490 * interface.cs (InterfaceMemberBase): Now we track the new status
6493 (PopulateProperty): Implement property population. Woohoo! Got
6494 Methods and Properties going today.
6496 Removed all the properties for interfaces, and replaced them with
6497 `public readonly' fields.
6499 2001-08-16 Miguel de Icaza <miguel@ximian.com>
6501 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
6502 initialize their hashtables/arraylists only when they are needed
6503 instead of doing this always.
6505 * parameter.cs: Handle refs and out parameters.
6507 * cs-parser.jay: Use an ArrayList to construct the arguments
6508 instead of the ParameterCollection, and then cast that to a
6511 * parameter.cs: Drop the use of ParameterCollection and use
6512 instead arrays of Parameters.
6514 (GetParameterInfo): Use the Type, not the Name when resolving
6517 2001-08-13 Miguel de Icaza <miguel@ximian.com>
6519 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
6520 and instead use public readonly fields.
6522 * class.cs: Put back walking code for type containers.
6524 2001-08-11 Miguel de Icaza <miguel@ximian.com>
6526 * class.cs (MakeConstant): Code to define constants.
6528 * rootcontext.cs (LookupType): New function. Used to locate types
6531 2001-08-08 Miguel de Icaza <miguel@ximian.com>
6533 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
6534 this System.Reflection code is. Kudos to Microsoft
6536 * typemanager.cs: Implement a type cache and avoid loading all
6537 types at boot time. Wrap in LookupType the internals. This made
6538 the compiler so much faster. Wow. I rule!
6540 * driver.cs: Make sure we always load mscorlib first (for
6541 debugging purposes, nothing really important).
6543 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
6544 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
6546 * rootcontext.cs: Lookup types on their namespace; Lookup types
6547 on namespaces that have been imported using the `using' keyword.
6549 * class.cs (TypeContainer::TypeAttr): Virtualize.
6550 (Class::TypeAttr): Return attributes suitable for this bad boy.
6551 (Struct::TypeAttr): ditto.
6552 Handle nested classes.
6553 (TypeContainer::) Remove all the type visiting code, it is now
6554 replaced with the rootcontext.cs code
6556 * rootcontext.cs (GetClassBases): Added support for structs.
6558 2001-08-06 Miguel de Icaza <miguel@ximian.com>
6560 * interface.cs, statement.cs, class.cs, parameter.cs,
6561 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
6562 Drop use of TypeRefs, and use strings instead.
6564 2001-08-04 Miguel de Icaza <miguel@ximian.com>
6568 * class.cs (Struct::Struct): set the SEALED flags after
6569 checking the modifiers.
6570 (TypeContainer::TypeAttr): new property, returns the
6571 TypeAttributes for a class.
6573 * cs-parser.jay (type_list): Oops, list production was creating a
6574 new list of base types.
6576 * rootcontext.cs (StdLib): New property.
6577 (GetInterfaceTypeByName): returns an interface by type name, and
6578 encapsulates error handling here.
6579 (GetInterfaces): simplified.
6580 (ResolveTree): Encapsulated all the tree resolution here.
6581 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
6584 * driver.cs: Add support for --nostdlib, to avoid loading the
6586 (Main): Do not put tree resolution here.
6588 * rootcontext.cs: Beginning of the class resolution.
6590 2001-08-03 Miguel de Icaza <miguel@ximian.com>
6592 * rootcontext.cs: Provide better error reporting.
6594 * cs-parser.jay (interface_base): set our $$ to be interfaces.
6596 * rootcontext.cs (CreateInterface): Handle the case where there
6597 are no parent interfaces.
6599 (CloseTypes): Routine to flush types at the end.
6600 (CreateInterface): Track types.
6601 (GetInterfaces): Returns an array of Types from the list of
6604 * typemanager.c (AddUserType): Mechanism to track user types (puts
6605 the type on the global type hash, and allows us to close it at the
6608 2001-08-02 Miguel de Icaza <miguel@ximian.com>
6610 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
6611 RecordInterface instead.
6613 * cs-parser.jay: Updated to reflect changes above.
6615 * decl.cs (Definition): Keep track of the TypeBuilder type that
6616 represents this type here. Not sure we will use it in the long
6617 run, but wont hurt for now.
6619 * driver.cs: Smaller changes to accomodate the new code.
6621 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
6624 * rootcontext.cs (CreateInterface): New method, used to create
6625 the System.TypeBuilder type for interfaces.
6626 (ResolveInterfaces): new entry point to resolve the interface
6628 (CodeGen): Property, used to keep track of the code generator.
6630 2001-07-26 Miguel de Icaza <miguel@ximian.com>
6632 * cs-parser.jay: Add a second production for delegate_declaration
6635 (enum_body): Put an opt_comma here instead of putting it on
6636 enum_body or enum_member_declarations so we can handle trailing
6637 commas on enumeration members. Gets rid of a shift/reduce.
6639 (type_list): Need a COMMA in the middle.
6641 (indexer_declaration): Tell tokenizer to recognize get/set
6643 * Remove old targets.
6645 * Re-add the parser target.
6647 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6649 * cs-parser.jay: Add precendence rules for a number of operators
6650 ot reduce the number of shift/reduce conflicts in the grammar.
6652 2001-07-17 Miguel de Icaza <miguel@ximian.com>
6654 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
6657 Get rid of old crufty code.
6659 * rootcontext.cs: Use this to keep track of the parsed
6660 representation and the defined types available to the program.
6662 * gen-treedump.cs: adjust for new convention.
6664 * type.cs: Split out the type manager, and the assembly builder
6667 * typemanager.cs: the type manager will live here now.
6669 * cil-codegen.cs: And the code generator here.
6671 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
6673 * makefile: Fixed up for easy making.
6675 2001-07-13 Simon Cozens <simon@simon-cozens.org>
6677 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
6680 (unary_expression): Expand pre_increment_expression and
6681 post_decrement_expression to reduce a shift/reduce.
6683 2001-07-11 Simon Cozens
6685 * cs-tokenizer.cs: Hex numbers should begin with a 0.
6687 Improve allow_keyword_as_indent name.
6689 2001-06-19 Miguel de Icaza <miguel@ximian.com>
6691 * Adjustments for Beta2.
6693 2001-06-13 Miguel de Icaza <miguel@ximian.com>
6695 * decl.cs: Added `Define' abstract method.
6696 (InTransit): new property, used to catch recursive definitions.
6698 * interface.cs: Implement `Define'.
6700 * modifiers.cs: Map Modifiers.constants to
6701 System.Reflection.TypeAttribute flags.
6703 * class.cs: Keep track of types and user-defined types.
6704 (BuilderInit): New method for creating an assembly
6705 (ResolveType): New function to launch the resolution process, only
6706 used by interfaces for now.
6708 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
6709 that are inserted into the name space.
6711 2001-06-08 Miguel de Icaza <miguel@ximian.com>
6713 * ARGH. I have screwed up my tree so many times due to the use of
6714 rsync rather than using CVS. Going to fix this at once.
6716 * driver.cs: Objetify driver. Load assemblies, use assemblies to
6719 2001-06-07 Miguel de Icaza <miguel@ximian.com>
6721 * Experiment successful: Use System.Type rather that our own
6724 2001-05-25 Miguel de Icaza <miguel@ximian.com>
6726 * cs-parser.jay: Removed nsAliases from here.
6728 Use new namespaces, handle `using XXX;'
6730 * namespace.cs: Reimplemented namespace handling, use a recursive
6731 definition of the class. Now we can keep track of using clauses
6732 and catch invalid using clauses.
6734 2001-05-24 Miguel de Icaza <miguel@ximian.com>
6736 * gen-treedump.cs: Adapted for all the renaming.
6738 * expression.cs (Expression): this class now has a Type property
6739 which returns an expression Type.
6741 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
6742 `Type', as this has a different meaning now in the base
6744 2001-05-22 Miguel de Icaza <miguel@ximian.com>
6746 * interface.cs, class.cs: Removed from all the sources the
6747 references to signature computation, as we can not do method
6748 signature computation during the parsing time, as we are not
6749 trying to solve at that point distinguishing:
6753 void a (NS.Blah x) {}
6756 Which depending on the context might be valid or not, as we do not
6757 know if Blah is the same thing as NS.Blah at that point.
6759 * Redid everything so the code uses TypeRefs now instead of
6760 Types. TypeRefs are just temporary type placeholders, that need
6761 to be resolved. They initially have a pointer to a string and the
6762 current scope in which they are used. This is used later by the
6763 compiler to resolve the reference to an actual Type.
6765 * DeclSpace is no longer a CIR.Type, and neither are
6766 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
6767 are all DeclSpaces, but no Types.
6769 * type.cs (TypeRefManager): This implements the TypeRef manager,
6770 which keeps track of all the types that need to be resolved after
6771 the parsing has finished.
6773 2001-05-13 Miguel de Icaza <miguel@ximian.com>
6775 * ARGH. We are going to have to store `foreach' as a class rather
6776 than resolving it, as we need to verify error 1579 after name
6777 resolution. *OR* we could keep a flag that says `This request to
6778 IEnumerator comes from a foreach statement' which we can then use
6779 to generate the error.
6781 2001-05-10 Miguel de Icaza <miguel@ximian.com>
6783 * class.cs (TypeContainer.AddMethod): we now add methods to the
6784 MethodGroup instead of the method hashtable.
6786 * expression.cs: Add MethodGroup abstraction, which gets us one
6787 step closer to the specification in the way we handle method
6790 * cs-parser.jay (primary_expression): qualified_identifier now
6791 tried to match up an identifier to a local variable reference or
6792 to a parameter reference.
6794 current_local_parameters is now a parser global variable that
6795 points to the current parameters for the block, used during name
6798 (property_declaration): Now creates an implicit `value' argument to
6801 2001-05-09 Miguel de Icaza <miguel@ximian.com>
6803 * parameter.cs: Do not use `param' arguments as part of the
6804 signature, per the spec.
6806 2001-05-08 Miguel de Icaza <miguel@ximian.com>
6808 * decl.cs: Base class for classes, structs and interfaces. This
6809 is the "Declaration Space"
6811 * cs-parser.jay: Use CheckDef for checking declaration errors
6812 instead of having one on each function.
6814 * class.cs: Factor out some code for handling error handling in
6815 accordance to the "Declarations" section in the "Basic Concepts"
6816 chapter in the ECMA C# spec.
6818 * interface.cs: Make all interface member classes derive from
6819 InterfaceMemberBase.
6821 2001-05-07 Miguel de Icaza <miguel@ximian.com>
6823 * Many things: all interfaces are parsed and generated in
6824 gen-treedump. Support for member variables, constructors,
6825 destructors, properties, constants is there.
6827 Beginning of the IL backend, but very little done, just there for
6830 2001-04-29 Miguel de Icaza <miguel@ximian.com>
6832 * cs-parser.jay: Fix labeled statement.
6834 * cs-tokenizer.cs (escape): Escape " and ' always.
6835 ref_line, ref_name: keep track of the line/filename as instructed
6836 by #line by the compiler.
6839 2001-04-27 Miguel de Icaza <miguel@ximian.com>
6841 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
6842 to match the values in System.CodeDOM.
6844 Divid renamed to Divide.
6846 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
6848 (Statements.set): remove.
6850 * System.CodeDOM/CodeCatchClause.cs: always have a valid
6853 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
6854 falseStatements always have valid values.
6856 * cs-parser.jay: Use System.CodeDOM now.