1 2001-10-14 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs (Expression::ConvertReferenceExplicit): Implement
4 a few more explicit conversions.
6 * modifiers.cs: `NEW' modifier maps to HideBySig.
8 * expression.cs (PropertyExpr): Make this into an
9 ExpressionStatement, and support the EmitStatement code path.
11 Perform get/set error checking, clean up the interface.
13 * assign.cs: recognize PropertyExprs as targets, and if so, turn
14 them into toplevel access objects.
16 2001-10-12 Miguel de Icaza <miguel@ximian.com>
18 * expression.cs: PropertyExpr::PropertyExpr: use work around the
21 * typemanager.cs: Keep track here of our PropertyBuilders again to
22 work around lameness in SRE.
24 2001-10-11 Miguel de Icaza <miguel@ximian.com>
26 * expression.cs (LValue::LValueResolve): New method in the
27 interface, used to perform a second resolution pass for LValues.
29 (This::DoResolve): Catch the use of this in static methods.
31 (This::LValueResolve): Implement.
33 (This::Store): Remove warning, assigning to `this' in structures
36 (Invocation::Emit): Deal with invocation of
37 methods on value types. We need to pass the address to structure
38 methods rather than the object itself. (The equivalent code to
39 emit "this" for structures leaves the entire structure on the
40 stack instead of a pointer to it).
42 (ParameterReference::DoResolve): Compute the real index for the
43 argument based on whether the method takes or not a `this' pointer
44 (ie, the method is static).
46 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
47 value types returned from functions when we need to invoke a
48 method on the sturcture.
51 2001-10-11 Ravi Pratap <ravi@ximian.com>
53 * class.cs (TypeContainer::DefineType): Method to actually do the business of
54 defining the type in the Modulebuilder or Typebuilder. This is to take
55 care of nested types which need to be defined on the TypeBuilder using
58 (TypeContainer::GetClassBases): Implement. Essentially the code from the
59 methods in RootContext, only ported to be part of TypeContainer.
61 (TypeContainer::GetInterfaceOrClass): Ditto.
63 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
65 * interface.cs (Interface::DefineInterface): New method. Does exactly
66 what RootContext.CreateInterface did earlier, only it takes care of nested types
69 (Interface::GetInterfaces): Move from RootContext here and port.
71 (Interface::GetInterfaceByName): Same here.
73 * rootcontext.cs (ResolveTree): Re-write.
75 (PopulateTypes): Re-write.
77 * class.cs (TypeContainer::Populate): Populate nested types too.
78 (TypeContainer::Emit): Emit nested members too.
80 * typemanager.cs (AddUserType): Do not make use of the FullName property,
81 instead just use the name argument passed in as it is already fully
84 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
85 to TypeContainer mapping to see if a type is user-defined.
87 * class.cs (TypeContainer::CloseType): Implement.
89 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
90 the default constructor.
92 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
95 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
97 * interface.cs (CloseType): Create the type here.
99 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
102 Remove all the methods which are now in TypeContainer.
104 2001-10-10 Ravi Pratap <ravi@ximian.com>
106 * delegate.cs (Define): Re-write bits to define the delegate
109 2001-10-10 Miguel de Icaza <miguel@ximian.com>
111 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
113 * expression.cs (ImplicitReferenceConversion): handle null as well
114 as a source to convert to any reference type.
116 * statement.cs (Return): Perform any implicit conversions to
117 expected return type.
119 Validate use of return statement.
121 * codegen.cs (EmitContext): Pass the expected return type here.
123 * class.cs (Method, Constructor, Property): Pass expected return
126 2001-10-09 Miguel de Icaza <miguel@ximian.com>
128 * expression.cs: Make DoResolve take an EmitContext instead of a
131 Replaced `l' and `location' for `loc', for consistency.
133 (Error, Warning): Remove unneeded Tc argument.
135 * assign.cs, literal.cs, constant.cs: Update to new calling
138 * codegen.cs: EmitContext now contains a flag indicating whether
139 code is being generated in a static method or not.
141 * cs-parser.jay: DecomposeQI, new function that replaces the old
142 QualifiedIdentifier. Now we always decompose the assembled
143 strings from qualified_identifier productions into a group of
146 2001-10-08 Miguel de Icaza <miguel@ximian.com>
148 * rootcontext.cs: Deal with field-less struct types correctly now
149 by passing the size option to Define Type.
151 * class.cs: Removed hack that created one static field.
153 2001-10-07 Miguel de Icaza <miguel@ximian.com>
155 * statement.cs: Moved most of the code generation here.
157 2001-10-09 Ravi Pratap <ravi@ximian.com>
159 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
162 (ElementAccess): Remove useless bits for now - keep checks as the spec
165 2001-10-08 Ravi Pratap <ravi@ximian.com>
167 * expression.cs (ElementAccess::DoResolve): Remove my crap code
168 and start performing checks according to the spec.
170 2001-10-07 Ravi Pratap <ravi@ximian.com>
172 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
173 rank_specifiers instead.
175 (rank_specifiers): Change the order in which the rank specifiers are stored
177 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
179 * expression.cs (ElementAccess): Implement the LValue interface too.
181 2001-10-06 Ravi Pratap <ravi@ximian.com>
183 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
184 except that user defined conversions are not included.
186 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
187 perform the conversion of the return type, if necessary.
189 (New::DoResolve): Check whether we are creating an array or an object
190 and accordingly do the needful.
192 (New::Emit): Same here.
194 (New::DoResolve): Implement guts of array creation.
196 (New::FormLookupType): Helper function.
198 2001-10-07 Miguel de Icaza <miguel@ximian.com>
200 * codegen.cs: Removed most of the code generation here, and move the
201 corresponding code generation bits to the statement classes.
203 Added support for try/catch/finalize and throw.
205 * cs-parser.jay: Added support for try/catch/finalize.
207 * class.cs: Catch static methods having the flags override,
210 * expression.cs (UserCast): This user cast was not really doing
211 what it was supposed to do. Which is to be born in fully resolved
212 state. Parts of the resolution were being performed at Emit time!
216 2001-10-05 Miguel de Icaza <miguel@ximian.com>
218 * expression.cs: Implicity convert the result from UserCast.
220 2001-10-05 Ravi Pratap <ravi@ximian.com>
222 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
223 prevented it from working correctly.
225 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
226 merely ConvertImplicit.
228 2001-10-05 Miguel de Icaza <miguel@ximian.com>
230 * typemanager.cs: Make the LookupTypeContainer function static,
231 and not per-instance.
233 * class.cs: Make static FindMembers (the one that takes a Type
236 * codegen.cs: Add EmitForeach here.
238 * cs-parser.jay: Make foreach a toplevel object instead of the
239 inline expansion, as we need to perform semantic analysis on it.
241 2001-10-05 Ravi Pratap <ravi@ximian.com>
243 * expression.cs (Expression::ImplicitUserConversion): Rename to
244 UserDefinedConversion.
246 (Expression::UserDefinedConversion): Take an extra argument specifying
247 whether we look for explicit user conversions too.
249 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
251 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
253 (ExplicitUserConversion): Make it a call to UserDefinedConversion
254 with the appropriate arguments.
256 * cs-parser.jay (cast_expression): Record location too.
258 * expression.cs (Cast): Record location info.
260 (Expression::ConvertExplicit): Take location argument.
262 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
263 to determine if we are doing explicit conversions.
265 (UserCast::Emit): Update accordingly.
267 (Expression::ConvertExplicit): Report an error if everything fails.
269 * ../errors/cs0030.cs : Add.
271 2001-10-04 Miguel de Icaza <miguel@ximian.com>
273 * modifiers.cs: If the ABSTRACT keyword is present, also set the
274 virtual and newslot bits.
276 * class.cs (TypeContainer::RegisterRequiredImplementations):
277 Record methods we need.
279 (TypeContainer::MakeKey): Helper function to make keys for
280 MethodBases, since the Methodbase key is useless.
282 (TypeContainer::Populate): Call RegisterRequiredImplementations
283 before defining the methods.
285 Create a mapping for method_builders_to_methods ahead of time
286 instead of inside a tight loop.
288 (::RequireMethods): Accept an object as the data to set into the
289 hashtable so we can report interface vs abstract method mismatch.
291 2001-10-03 Miguel de Icaza <miguel@ximian.com>
293 * report.cs: Make all of it static.
295 * rootcontext.cs: Drop object_type and value_type computations, as
296 we have those in the TypeManager anyways.
298 Drop report instance variable too, now it is a global.
300 * driver.cs: Use try/catch on command line handling.
302 Add --probe option to debug the error reporting system with a test
305 * report.cs: Add support for exiting program when a probe
306 condition is reached.
308 2001-10-03 Ravi Pratap <ravi@ximian.com>
310 * expression.cs (Binary::DoNumericPromotions): Fix the case when
311 we do a forcible conversion regardless of type, to check if
312 ForceConversion returns a null.
314 (Binary::error19): Use location to report error.
316 (Unary::error23): Use location here too.
318 * ../errors/cs0019.cs : Check in.
320 * ../errors/cs0023.cs : Check in.
322 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
323 case of a non-null MethodInfo object with a length of 0 !
325 (Binary::ResolveOperator): Flag error if overload resolution fails to find
326 an applicable member - according to the spec :-)
327 Also fix logic to find members in base types.
329 (Unary::ResolveOperator): Same here.
331 (Unary::report23): Change name to error23 and make first argument a TypeContainer
332 as I was getting thoroughly confused between this and error19 :-)
334 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
335 (::FindMostEncompassedType): Implement.
336 (::FindMostEncompassingType): Implement.
337 (::StandardConversionExists): Implement.
339 (UserImplicitCast): Re-vamp. We now need info about most specific
340 source and target types so that we can do the necessary conversions.
342 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
343 mathematical union with no duplicates.
345 2001-10-03 Miguel de Icaza <miguel@ximian.com>
347 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
348 in order from base classes to child classes, so that we can in
349 child classes look up in our parent for method names and
350 attributes (required for handling abstract, virtual, new, override
351 constructs: we need to instrospect our base class, and if we dont
352 populate the classes in order, the introspection might be
353 incorrect. For example, a method could query its parent before
354 the parent has any methods and would determine that the parent has
355 no abstract methods (while it could have had them)).
357 (RootContext::CreateType): Record the order in which we define the
360 2001-10-02 Miguel de Icaza <miguel@ximian.com>
362 * class.cs (TypeContainer::Populate): Also method definitions can
363 fail now, keep track of this.
365 (TypeContainer::FindMembers): Implement support for
366 DeclaredOnly/noDeclaredOnly flag.
368 (Constructor::Emit) Return the ConstructorBuilder.
370 (Method::Emit) Return the MethodBuilder.
371 Check for abstract or virtual methods to be public.
373 * rootcontext.cs (RootContext::CreateType): Register all the
374 abstract methods required for the class to be complete and the
375 interface methods that must be implemented.
377 * cs-parser.jay: Report error 501 (method requires body if it is
378 not marked abstract or extern).
380 * expression.cs (TypeOf::Emit): Implement.
382 * typemanager.cs: runtime_handle_type, new global type.
384 * class.cs (Property::Emit): Generate code for properties.
386 2001-10-02 Ravi Pratap <ravi@ximian.com>
388 * expression.cs (Unary::ResolveOperator): Find operators on base type
389 too - we now conform exactly to the spec.
391 (Binary::ResolveOperator): Same here.
393 * class.cs (Operator::Define): Fix minor quirk in the tests.
395 * ../errors/cs0215.cs : Added.
397 * ../errors/cs0556.cs : Added.
399 * ../errors/cs0555.cs : Added.
401 2001-10-01 Miguel de Icaza <miguel@ximian.com>
403 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
404 single integer which is really efficient
406 2001-10-01 Ravi Pratap <ravi@ximian.com>
408 * expression.cs (Expression::ImplicitUserConversion): Use location
409 even in the case when we are examining True operators.
411 * class.cs (Operator::Define): Perform extensive checks to conform
412 with the rules for operator overloading in the spec.
414 * expression.cs (Expression::ImplicitReferenceConversion): Implement
415 some of the other conversions mentioned in the spec.
417 * typemanager.cs (array_type): New static member for the System.Array built-in
420 (cloneable_interface): For System.ICloneable interface.
422 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
423 we start resolving the tree and populating types.
425 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
427 2001-10-01 Miguel de Icaza <miguel@ximian.com>
429 * expression.cs (Expression::ExprClassFromMemberInfo,
430 Expression::Literalize): Create literal expressions from
431 FieldInfos which are literals.
433 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
434 type casts, because they were wrong. The test suite in tests
437 (ImplicitNumericConversion): ushort to ulong requires a widening
440 Int32 constant to long requires widening cast as well.
442 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
443 for integers because the type on the stack is not i4.
445 2001-09-30 Miguel de Icaza <miguel@ximian.com>
447 * expression.cs (report118): require location argument.
449 * parameter.cs: Do not dereference potential null value.
451 * class.cs: Catch methods that lack the `new' keyword when
452 overriding a name. Report warnings when `new' is used without
453 anything being there to override.
455 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
457 * class.cs: Only add constructor to hashtable if it is non-null
458 (as now constructors can fail on define).
460 (TypeManager, Class, Struct): Take location arguments.
462 Catch field instance initialization in structs as errors.
464 accepting_filter: a new filter for FindMembers that is static so
465 that we dont create an instance per invocation.
467 (Constructor::Define): Catch errors where a struct constructor is
470 * cs-parser.jay: Pass location information for various new
473 * delegate.cs (Delegate): take a location argument.
475 * driver.cs: Do not call EmitCode if there were problesm in the
476 Definition of the types, as many Builders wont be there.
478 * decl.cs (Decl::Decl): Require a location argument.
480 * cs-tokenizer.cs: Handle properly hex constants that can not fit
481 into integers, and find the most appropiate integer for it.
483 * literal.cs: Implement ULongLiteral.
485 * rootcontext.cs: Provide better information about the location of
486 failure when CreateType fails.
488 2001-09-29 Miguel de Icaza <miguel@ximian.com>
490 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
493 * expression.cs (Binary::CheckShiftArguments): Add missing type
495 (Binary::ResolveOperator): Add type to the logical and and logical
496 or, Bitwise And/Or and Exclusive Or code paths, it was missing
499 (Binary::DoNumericPromotions): In the case where either argument
500 is ulong (and most signed types combined with ulong cause an
501 error) perform implicit integer constant conversions as well.
503 2001-09-28 Miguel de Icaza <miguel@ximian.com>
505 * expression.cs (UserImplicitCast): Method should always be
507 (Invocation::BetterConversion): Simplified test for IntLiteral.
509 (Expression::ImplicitNumericConversion): Split this routine out.
510 Put the code that performs implicit constant integer conversions
513 (Expression::Resolve): Become a wrapper around DoResolve so we can
514 check eclass and type being set after resolve.
516 (Invocation::Badness): Remove this dead function
518 (Binary::ResolveOperator): Do not compute the expensive argumnets
519 unless we have a union for it.
521 (Probe::Emit): Is needs to do an isinst and then
522 compare against null.
524 (::CanConvert): Added Location argument. If the Location argument
525 is null (Location.Null), then we do not report errors. This is
526 used by the `probe' mechanism of the Explicit conversion. We do
527 not want to generate an error for something that the user
528 explicitly requested to be casted. But the pipeline for an
529 explicit cast first tests for potential implicit casts.
531 So for now, if the Location is null, it means `Probe only' to
532 avoid adding another argument. Might have to revise this
535 (ClassCast): New class used to type cast objects into arbitrary
536 classes (used in Explicit Reference Conversions).
538 Implement `as' as well.
540 Reverted all the patches from Ravi below: they were broken:
542 * The use of `level' as a mechanism to stop recursive
543 invocations is wrong. That was there just to catch the
544 bug with a strack trace but not as a way of addressing
547 To fix the problem we have to *understand* what is going
548 on and the interactions and come up with a plan, not
549 just get things going.
551 * The use of the type conversion cache that I proposed
552 last night had an open topic: How does this work across
553 protection domains. A user defined conversion might not
554 be public in the location where we are applying the
555 conversion, a different conversion might be selected
556 (ie, private A->B (better) but public B->A (worse),
557 inside A, A->B applies, but outside it, B->A will
560 * On top of that (ie, even if the above is solved),
561 conversions in a cache need to be abstract. Ie, `To
562 convert from an Int to a Short use an OpcodeCast', not
563 `To convert from an Int to a Short use the OpcodeCast on
564 the variable 5' (which is what this patch was doing).
566 2001-09-28 Ravi Pratap <ravi@ximian.com>
568 * expression.cs (Invocation::ConversionExists): Re-write to use
571 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
572 cache all conversions done, not just user-defined ones.
574 (Invocation::BetterConversion): The real culprit. Use ConversionExists
575 to determine if a conversion exists instead of acutually trying to
576 perform the conversion. It's faster too.
578 (Expression::ConvertExplicit): Modify to use ConversionExists to check
579 and only then attempt the implicit conversion.
581 2001-09-28 Ravi Pratap <ravi@ximian.com>
583 * expression.cs (ConvertImplicit): Use a cache for conversions
584 already found. Check level of recursion and bail out if necessary.
586 2001-09-28 Miguel de Icaza <miguel@ximian.com>
588 * typemanager.cs (string_concat_string_string, string_concat_object_object):
589 Export standard methods that we expect for string operations.
591 * statement.cs (Block::UsageWarning): Track usage of variables and
592 report the errors for not used variables.
594 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
597 2001-09-27 Miguel de Icaza <miguel@ximian.com>
599 * codegen.cs: remove unnneded code
601 * expression.cs: Removed BuiltinTypeAccess class
603 Fix the order in which implicit conversions are
606 The previous fixed dropped support for boxed conversions (adding a
607 test to the test suite now)
609 (UserImplicitCast::CanConvert): Remove test for source being null,
610 that code is broken. We should not feed a null to begin with, if
611 we do, then we should track the bug where the problem originates
612 and not try to cover it up here.
614 Return a resolved expression of type UserImplicitCast on success
615 rather than true/false. Ravi: this is what I was talking about,
616 the pattern is to use a static method as a "constructor" for
619 Also, do not create arguments until the very last minute,
620 otherwise we always create the arguments even for lookups that
621 will never be performed.
623 (UserImplicitCast::Resolve): Eliminate, objects of type
624 UserImplicitCast are born in a fully resolved state.
626 * typemanager.cs (InitCoreTypes): Init also value_type
629 * expression.cs (Cast::Resolve): First resolve the child expression.
631 (LValue): Add new method AddressOf to be used by
634 Change the argument of Store to take an EmitContext instead of an
635 ILGenerator, because things like FieldExpr need to be able to call
636 their children expression to generate the instance code.
638 (Expression::Error, Expression::Warning): Sugar functions for
641 (Expression::MemberLookup): Accept a TypeContainer instead of a
642 Report as the first argument.
644 (Expression::ResolvePrimary): Killed. I still want to improve
645 this as currently the code is just not right.
647 (Expression::ResolveMemberAccess): Simplify, but it is still
650 (Unary::Resolve): Catch errors in AddressOf operators.
652 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
653 index to a byte for the short-version, or the compiler will choose
654 the wrong Emit call, which generates the wrong data.
656 (ParameterReference::Emit, ::Store): same.
658 (FieldExpr::AddressOf): Implement.
660 * typemanager.cs: TypeManager: made public variable instead of
663 * driver.cs: document --fatal.
665 * report.cs (ErrorMessage, WarningMessage): new names for the old
666 Error and Warning classes.
668 * cs-parser.jay (member_access): Turn built-in access to types
669 into a normal simplename
671 2001-09-27 Ravi Pratap <ravi@ximian.com>
673 * expression.cs (Invocation::BetterConversion): Fix to cope
674 with q being null, since this was introducing a bug.
676 * expression.cs (ConvertImplicit): Do built-in conversions first.
678 2001-09-27 Ravi Pratap <ravi@ximian.com>
680 * expression.cs (UserImplicitCast::Resolve): Fix bug.
682 2001-09-27 Ravi Pratap <ravi@ximian.com>
684 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
685 I had introduced long ago (what's new ?).
687 * expression.cs (UserImplicitCast::CanConvert): Static method to do
688 the work of all the checking.
689 (ConvertImplicit): Call CanConvert and only then create object if necessary.
690 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
692 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
693 that is the right way.
695 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
696 overloading resolution. Use everywhere instead of cutting and pasting code.
698 (Binary::ResolveOperator): Use MakeUnionSet.
700 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
701 we have to convert to bool types. Not complete yet.
703 2001-09-27 Miguel de Icaza <miguel@ximian.com>
705 * typemanager.cs (TypeManager::CSharpName): support ushort.
707 * expression.cs (Expression::TryImplicitIntConversion): Attempts
708 to provide an expression that performsn an implicit constant int
709 conversion (section 6.1.6).
710 (Expression::ConvertImplicitRequired): Reworked to include
711 implicit constant expression conversions.
713 (Expression::ConvertNumericExplicit): Finished.
715 (Invocation::Emit): If InstanceExpression is null, then it means
716 that we perform a call on this.
718 2001-09-26 Miguel de Icaza <miguel@ximian.com>
720 * expression.cs (Unary::Emit): Remove some dead code.
721 (Probe): Implement Resolve and Emit for `is'.
722 (Expression::ConvertImplicitRequired): Attempt to do constant
723 expression conversions here. Maybe should be moved to
724 ConvertImplicit, but I am not sure.
725 (Expression::ImplicitLongConstantConversionPossible,
726 Expression::ImplicitIntConstantConversionPossible): New functions
727 that tell whether is it possible to apply an implicit constant
728 expression conversion.
730 (ConvertNumericExplicit): Started work on explicit numeric
733 * cs-parser.jay: Update operator constants.
735 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
736 (Parameters::GetSignature): Hook up VerifyArgs here.
737 (Parameters::VerifyArgs): Verifies that no two arguments have the
740 * class.cs (Operator): Update the operator names to reflect the
741 ones that the spec expects (as we are just stringizing the
744 * expression.cs (Unary::ResolveOperator): Fix bug: Use
745 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
746 previous usage did only work for our methods.
747 (Expression::ConvertImplicit): Handle decimal implicit numeric
749 (Expression::InternalTypeConstructor): Used to invoke constructors
750 on internal types for default promotions.
752 (Unary::Emit): Implement special handling for the pre/post
753 increment/decrement for overloaded operators, as they need to have
754 the same semantics as the other operators.
756 (Binary::ResolveOperator): ditto.
757 (Invocation::ConversionExists): ditto.
758 (UserImplicitCast::Resolve): ditto.
760 2001-09-26 Ravi Pratap <ravi@ximian.com>
762 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
763 operator, return after emitting body. Regression tests pass again !
765 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
766 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
767 (Invocation::OverloadResolve): Ditto.
768 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
770 * everywhere : update calls to the above methods accordingly.
772 2001-09-26 Miguel de Icaza <miguel@ximian.com>
774 * assign.cs (Assign): Make it inherit from ExpressionStatement.
776 * expression.cs (ExpressionStatement): New base class used for
777 expressions that can appear in statements, so that we can provide
778 an alternate path to generate expression that do not leave a value
781 (Expression::Emit, and all the derivatives): We no longer return
782 whether a value is left on the stack or not. Every expression
783 after being emitted leaves a single value on the stack.
785 * codegen.cs (EmitContext::EmitStatementExpression): Use the
786 facilties of ExpressionStatement if possible.
788 * cs-parser.jay: Update statement_expression.
790 2001-09-25 Miguel de Icaza <miguel@ximian.com>
792 * driver.cs: Change the wording of message
794 2001-09-25 Ravi Pratap <ravi@ximian.com>
796 * expression.cs (Binary::ResolveOperator): Had forgottten to set
797 the type of the expression to the return type of the method if
798 we have an overloaded operator match ! The regression tests pass again !
799 (Unary::ResolveOperator): Ditto.
801 * expression.cs (Invocation::ConversionExists): Correct the member lookup
802 to find "op_Implicit", not "implicit" ;-)
803 (UserImplicitCast): New class to take care of user-defined implicit conversions.
804 (ConvertImplicit, ForceConversion): Take TypeContainer argument
806 * everywhere : Correct calls to the above accordingly.
808 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
809 (ConvertImplicit): Do user-defined conversion if it exists.
811 2001-09-24 Miguel de Icaza <miguel@ximian.com>
813 * assign.cs: track location.
814 (Resolve): Use implicit conversions on assignment.
816 * literal.cs: Oops. Not good, Emit of short access values should
817 pass (Bytes) or the wrong argument will be selected.
819 * expression.cs (Unary::Emit): Emit code for -expr.
821 (Unary::ResolveOperator): Handle `Substract' for non-constants
822 (substract from zero from the non-constants).
823 Deal with Doubles as well.
825 (Expression::ConvertImplicitRequired): New routine that reports an
826 error if no implicit conversion exists.
828 (Invocation::OverloadResolve): Store the converted implicit
829 expressions if we make them
831 2001-09-24 Ravi Pratap <ravi@ximian.com>
833 * class.cs (ConstructorInitializer): Take a Location argument.
834 (ConstructorBaseInitializer): Same here.
835 (ConstructorThisInitializer): Same here.
837 * cs-parser.jay : Update all calls accordingly.
839 * expression.cs (Unary, Binary, New): Take location argument.
840 Update accordingly everywhere.
842 * cs-parser.jay : Update all calls to the above to take a location
847 2001-09-24 Ravi Pratap <ravi@ximian.com>
849 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
850 (Invocation::BetterConversion): Same here
851 (Invocation::ConversionExists): Ditto.
853 (Invocation::ConversionExists): Implement.
855 2001-09-22 Ravi Pratap <ravi@ximian.com>
857 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
858 Also take an additional TypeContainer argument.
860 * All over : Pass in TypeContainer as argument to OverloadResolve.
862 * typemanager.cs (CSharpName): Update to check for the string type and return
865 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
868 2001-09-21 Ravi Pratap <ravi@ximian.com>
870 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
871 (Invocation::BetterFunction): Implement.
872 (Invocation::BetterConversion): Implement.
873 (Invocation::ConversionExists): Skeleton, no implementation yet.
875 Okay, things work fine !
877 2001-09-21 Miguel de Icaza <miguel@ximian.com>
879 * typemanager.cs: declare and load enum_type, delegate_type and
882 * expression.cs (Expression::Emit): Now emit returns a value that
883 tells whether a value is left on the stack or not. This strategy
884 might be reveted tomorrow with a mechanism that would address
885 multiple assignments.
886 (Expression::report118): Utility routine to report mismatches on
889 (Unary::Report23): Report impossible type/operator combination
892 (Unary::IsIncrementableNumber): Whether the type can be
893 incremented or decremented with add.
894 (Unary::ResolveOperator): Also allow enumerations to be bitwise
896 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
898 (Invocation::Emit): Deal with new Emit convetion.
900 * All Expression derivatives: Updated their Emit method to return
901 whether they leave values on the stack or not.
903 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
904 stack for expressions that are statements.
906 2001-09-20 Miguel de Icaza <miguel@ximian.com>
908 * expression.cs (LValue): New interface. Must be implemented by
910 (LocalVariableReference, ParameterReference, FieldExpr): Implement
913 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
914 interface for generating code, simplifies the code.
916 2001-09-20 Ravi Pratap <ravi@ximian.com>
918 * expression.cs (everywhere): Comment out return statements in ::Resolve
919 methods to avoid the warnings.
921 2001-09-20 Miguel de Icaza <miguel@ximian.com>
923 * driver.cs (parse): Report error 2001 if we can not open the
926 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
929 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
932 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
933 otherwise nested blocks end up with the same index.
935 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
937 * expression.cs: Instead of having FIXMEs in the Resolve
938 functions, throw exceptions so it is obvious that we are facing a
941 * cs-parser.jay (invocation_expression): Pass Location information.
943 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
944 Use a basename for those routines because .NET does not like paths
947 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
950 2001-09-19 Miguel de Icaza <miguel@ximian.com>
952 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
953 are loading the correct data types (throws an exception if not).
954 (TypeManager::InitCoreTypes): Use CoreLookupType
956 * expression.cs (Unary::ResolveOperator): return the child
957 expression for expressions which are just +expr.
958 (Unary::ResolveOperator): Return negative literals for -LITERAL
959 expressions (otherwise they are Unary {Literal}).
960 (Invocation::Badness): Take into account `Implicit constant
961 expression conversions'.
963 * literal.cs (LongLiteral): Implement long literal class.
964 (IntLiteral): export the `Value' of the intliteral.
966 2001-09-19 Ravi Pratap <ravi@ximian.com>
968 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
970 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
971 instead of 'Operator'
973 * expression.cs (Binary::ResolveOperator): Update accordingly.
974 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
977 * cs-parser.jay (unary_expression): Update to use the new names.
979 * gen-treedump.cs (GetUnary): Same here.
981 * expression.cs (Unary::Resolve): Implement.
982 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
983 operators are found instead of making noise ;-)
984 (Unary::ResolveOperator): New method to do precisely the same thing which
985 Binary::ResolveOperator does for Binary expressions.
986 (Unary.method, .Arguments): Add.
987 (Unary::OperName): Implement.
988 (Unary::ForceConversion): Copy and Paste !
990 * class.cs (Operator::Define): Fix a small bug for the case when we have
993 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
994 for the inbuilt operators. Only overloading works for now ;-)
996 2001-09-18 Miguel de Icaza <miguel@ximian.com>
998 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
999 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1001 * expression.cs (This::Emit): Implement.
1002 (This::Resolve): Implement.
1003 (TypeOf:Resolve): Implement.
1004 (Expression::ResolveSimpleName): Add an implicit this to instance
1006 (MemberAccess::Resolve): Deal with Parameters and Fields.
1007 Bind instance variable to Field expressions.
1008 (FieldExpr::Instance): New field used to track the expression that
1009 represents the object instance.
1010 (FieldExpr::Resolve): Track potential errors from MemberLookup not
1012 (FieldExpr::Emit): Implement.
1014 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1015 the last instruction contains a return opcode to avoid generating
1016 the last `ret' instruction (this generates correct code, and it is
1017 nice to pass the peverify output).
1019 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1020 initializer for static and instance variables.
1021 (Constructor::Emit): Allow initializer to be null in the case of
1022 static constructors. Only emit initializer for instance
1025 (TypeContainer::FindMembers): Return a null array if there are no
1028 Also fix the code for the MemberTypes.Method branch, as it was not
1029 scanning that for operators (or tried to access null variables before).
1031 * assign.cs (Assign::Emit): Handle instance and static fields.
1035 * driver.cs: Stop compilation if there are parse errors.
1037 * cs-parser.jay (constructor_declaration): Provide default base
1038 initializer for non-static constructors.
1039 (constructor_declarator): Do not provide a default base
1040 initializers if none was specified.
1041 Catch the fact that constructors should not have parameters.
1043 * class.cs: Do not emit parent class initializers for static
1044 constructors, that should be flagged as an error.
1046 2001-09-18 Ravi Pratap <ravi@ximian.com>
1048 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1049 Move back code into TypeContainer::Populate.
1051 2001-09-18 Ravi Pratap <ravi@ximian.com>
1053 * class.cs (TypeContainer::AddConstructor): Fix the check to
1054 compare against Name, not Basename.
1055 (Operator::OpType): Change Plus and Minus to Add and Subtract.
1057 * cs-parser.jay : Update accordingly.
1059 * class.cs (TypeContainer::FindMembers): For the case where we are searching
1060 for methods, don't forget to look into the operators too.
1061 (RegisterMethodBuilder): Helper method to take care of this for
1062 methods, constructors and operators.
1063 (Operator::Define): Completely revamp.
1064 (Operator.OperatorMethod, MethodName): New fields.
1065 (TypeContainer::Populate): Move the registering of builders into
1066 RegisterMethodBuilder.
1067 (Operator::Emit): Re-write.
1069 * expression.cs (Binary::Emit): Comment out code path to emit method
1070 invocation stuff for the case when we have a user defined operator. I am
1071 just not able to get it right !
1073 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1075 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1078 (Expression::MemberLookup): Provide a version that allows to
1079 specify the MemberTypes and BindingFlags.
1081 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1082 so it was not fetching variable information from outer blocks.
1084 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1085 Beforefieldinit as it was buggy.
1087 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1090 * class.cs (Constructor::Emit): Only emit if block is not null.
1091 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1092 deal with this by semantically definining it as if the user had
1095 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1096 constructors as we now "emit" them at a higher level.
1098 (TypeContainer::DefineDefaultConstructor): Used to define the
1099 default constructors if none was provided.
1101 (ConstructorInitializer): Add methods Resolve and Emit.
1103 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1105 2001-09-17 Ravi Pratap <ravi@ximian.com>
1107 * class.cs (TypeContainer::EmitDefaultConstructor): Register
1108 the default constructor builder with our hashtable for methodbuilders
1111 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1112 and argument_count is 0 in which case we have a match.
1113 (Binary::ResolveOperator): More null checking and miscellaneous coding
1116 2001-09-17 Ravi Pratap <ravi@ximian.com>
1118 * rootcontext.cs (IsNameSpace): Compare against null.
1120 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1122 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1123 and Unary::Operator.
1125 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1128 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1129 we have overloaded operators.
1130 (Binary::ResolveOperator): Implement the part which does the operator overload
1133 * class.cs (Operator::Emit): Implement.
1134 (TypeContainer::Emit): Emit the operators we have too.
1136 * expression.cs (Binary::Emit): Update to emit the appropriate code for
1137 the case when we have a user-defined operator.
1139 2001-09-17 Miguel de Icaza <miguel@ximian.com>
1141 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1143 2001-09-16 Ravi Pratap <ravi@ximian.com>
1145 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1146 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1147 (Constructor::Emit): Implement.
1148 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1149 if we have no work to do.
1150 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
1153 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1154 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1156 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1159 2001-09-15 Ravi Pratap <ravi@ximian.com>
1161 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1163 (Tree::RecordNamespace): Method to do what the name says ;-)
1164 (Tree::Namespaces): Property to get at the namespaces hashtable.
1166 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
1169 * rootcontext.cs (IsNamespace): Fixed it :-)
1171 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1173 * class.cs (TypeContainer::FindMembers): Add support for
1175 (MethodCore): New class that encapsulates both the shared aspects
1176 of a Constructor and a Method.
1177 (Method, Constructor): Factored pieces into MethodCore.
1179 * driver.cs: Added --fatal which makes errors throw exceptions.
1180 Load System assembly as well as part of the standard library.
1182 * report.cs: Allow throwing exceptions on errors for debugging.
1184 * modifiers.cs: Do not use `parent', instead use the real type
1185 container to evaluate permission settings.
1187 * class.cs: Put Ravi's patch back in. He is right, and we will
1188 have to cope with the
1190 2001-09-14 Ravi Pratap <ravi@ximian.com>
1192 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1193 FamORAssem, not FamANDAssem.
1195 2001-09-14 Miguel de Icaza <miguel@ximian.com>
1197 * driver.cs: Added --parse option that only parses its input files
1200 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
1201 incorrect. IsTopLevel is not used to tell whether an object is
1202 root_types or not (that can be achieved by testing this ==
1203 root_types). But to see if this is a top-level *class* (not
1204 necessarly our "toplevel" container).
1206 2001-09-14 Ravi Pratap <ravi@ximian.com>
1208 * enum.cs (Enum::Define): Modify to call the Lookup method on the
1209 parent instead of a direct call to GetType.
1211 2001-09-14 Ravi Pratap <ravi@ximian.com>
1213 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1214 Modifiers.TypeAttr. This should just be a call to that method.
1216 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1217 object so that we can determine if we are top-level or not.
1219 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
1222 * enum.cs (Enum::Define): Ditto.
1224 * modifiers.cs (FieldAttr): Re-write.
1226 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1227 (TypeContainer::HaveStaticConstructor): New property to provide access
1228 to precisely that info.
1230 * modifiers.cs (MethodAttr): Re-write.
1231 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1233 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1234 of top-level types as claimed.
1236 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1238 * expression.cs (MemberLookup): Fruitless attempt to lookup
1239 constructors. Maybe I need to emit default constructors? That
1240 might be it (currently .NET emits this for me automatically).
1241 (Invocation::OverloadResolve): Cope with Arguments == null.
1242 (Invocation::EmitArguments): new function, shared by the new
1244 (Invocation::Emit): Handle static and instance methods. Emit
1245 proper call instruction for virtual or non-virtual invocations.
1246 (New::Emit): Implement.
1247 (New::Resolve): Implement.
1248 (MemberAccess:Resolve): Implement.
1249 (MethodGroupExpr::InstanceExpression): used conforming to the spec
1251 (FieldExpr::Resolve): Set type.
1253 * support.cs: Handle empty arguments.
1255 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
1256 SimpleLookup): Auxiliary routines to help parse a qualifier
1259 Update qualifier_identifier rule.
1261 * codegen.cs: Removed debugging messages.
1263 * class.cs: Make this a global thing, this acts just as a "key" to
1264 objects that we might have around.
1266 (Populate): Only initialize method_builders_to_methods once.
1268 * expression.cs (PropertyExpr): Initialize type from the
1271 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
1272 Resolve pattern. Attempt to implicitly convert value to boolean.
1275 * expression.cs: Set the type for the int32/int32 argument case.
1276 (Binary::ResolveOperator): Set the return type to boolean for
1277 comparission operators
1279 * typemanager.cs: Remove debugging print code.
1281 (Invocation::Resolve): resolve type.
1283 * class.cs: Allocate a MemberInfo of the correct size, as the code
1284 elsewhere depends on the test to reflect the correct contents.
1286 (Method::) Keep track of parameters, due to System.Reflection holes
1288 (TypeContainer::Populate): Keep track of MethodBuilders to Method
1291 (TypeContainer::FindMembers): Use ArrayList and then copy an array
1292 of the exact size and return that.
1294 (Class::LookupMethodByBuilder): New function that maps
1295 MethodBuilders to its methods. Required to locate the information
1296 on methods because System.Reflection bit us again.
1298 * support.cs: New file, contains an interface ParameterData and
1299 two implementations: ReflectionParameters and InternalParameters
1300 used to access Parameter information. We will need to grow this
1303 * expression.cs (Invocation::GetParameterData): implement a cache
1304 and a wrapper around the ParameterData creation for methods.
1305 (Invocation::OverloadResolve): Use new code.
1307 2001-09-13 Ravi Pratap <ravi@ximian.com>
1309 * class.cs (TypeContainer::EmitField): Remove and move into
1310 (Field::Define): here and modify accordingly.
1311 (Field.FieldBuilder): New member.
1312 (TypeContainer::Populate): Update accordingly.
1313 (TypeContainer::FindMembers): Implement.
1315 2001-09-13 Miguel de Icaza <miguel@ximian.com>
1317 * statement.cs: (VariableInfo::VariableType): New field to be
1318 initialized with the full type once it is resolved.
1320 2001-09-12 Miguel de Icaza <miguel@ximian.com>
1322 * parameter.cs (GetParameterInfo): Use a type cache to compute
1323 things only once, and to reuse this information
1325 * expression.cs (LocalVariableReference::Emit): Implement.
1326 (OpcodeCast::Emit): fix.
1328 (ParameterReference::Resolve): Implement.
1329 (ParameterReference::Emit): Implement.
1331 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
1332 that are expressions need to stay as Expressions.
1334 * typemanager.cs (CSharpName): Returns the C# name of a type if
1337 * expression.cs (Expression::ConvertImplicit): New function that
1338 implements implicit type conversions.
1340 (Expression::ImplicitReferenceConversion): Implements implicit
1341 reference conversions.
1343 (EmptyCast): New type for transparent casts.
1345 (OpcodeCast): New type for casts of types that are performed with
1346 a sequence of bytecodes.
1348 (BoxedCast): New type used for casting value types into reference
1349 types. Emits a box opcode.
1351 (Binary::DoNumericPromotions): Implements numeric promotions of
1352 and computation of the Binary::Type.
1354 (Binary::EmitBranchable): Optimization.
1356 (Binary::Emit): Implement code emission for expressions.
1358 * typemanager.cs (TypeManager): Added two new core types: sbyte
1361 2001-09-12 Ravi Pratap <ravi@ximian.com>
1363 * class.cs (TypeContainer::FindMembers): Method which does exactly
1364 what Type.FindMembers does, only we don't have to use reflection. No
1367 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
1368 typecontainer objects as we need to get at them.
1369 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
1371 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
1372 typecontainer object.
1374 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
1375 of just a Report object.
1377 2001-09-11 Ravi Pratap <ravi@ximian.com>
1379 * class.cs (Event::Define): Go back to using the prefixes "add_" and
1381 (TypeContainer::Populate): Now define the delegates of the type too.
1382 (TypeContainer.Delegates): Property to access the list of delegates defined
1385 * delegates.cs (Delegate::Define): Implement partially.
1387 * modifiers.cs (TypeAttr): Handle more flags.
1389 2001-09-11 Ravi Pratap <ravi@ximian.com>
1391 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
1393 (Operator::Define): Re-write logic to get types by using the LookupType method
1394 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
1395 (Indexer::Define): Ditto.
1396 (Event::Define): Ditto.
1397 (Property::Define): Ditto.
1399 2001-09-10 Ravi Pratap <ravi@ximian.com>
1401 * class.cs (TypeContainer::Populate): Now define operators too.
1402 (TypeContainer.Operators): New property to access the list of operators
1404 (Operator.OperatorMethodBuilder): New member to hold the method builder
1405 for the operator we are defining.
1406 (Operator::Define): Implement.
1408 2001-09-10 Ravi Pratap <ravi@ximian.com>
1410 * class.cs (Event::Define): Make the prefixes of the accessor methods
1411 addOn_ and removeOn_
1413 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
1414 of the location being passed in too. Ideally, this should go later since all
1415 error reporting should be done through the Report object.
1417 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
1418 (Populate): Iterate thru the indexers we have and define them too.
1419 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
1420 for the get and set accessors.
1421 (Indexer::Define): Implement.
1423 2001-09-09 Miguel de Icaza <miguel@ximian.com>
1425 * expression.cs (Binary::Resolve): Beginning of it. I scratched
1426 my previous implementation, did not work.
1428 * typemanager.cs: Add a couple of missing types (the longs).
1430 * literal.cs: Use TypeManager.bool_type instead of getting it.
1432 * expression.cs (EventExpr): New kind of expressions.
1433 (Expressio::ExprClassFromMemberInfo): finish
1435 2001-09-08 Miguel de Icaza <miguel@ximian.com>
1437 * assign.cs: Emit stores to static fields differently.
1439 2001-09-08 Ravi Pratap <ravi@ximian.com>
1441 * Merge in changes and adjust code to tackle conflicts. Backed out my
1442 code in Assign::Resolve ;-)
1444 2001-09-08 Ravi Pratap <ravi@ximian.com>
1446 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
1447 instead Report.Error and also pass in the location.
1448 (CSharpParser::Lexer): New readonly property to return the reference
1449 to the Tokenizer object.
1450 (declare_local_variables): Use Report.Error with location instead of plain
1454 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
1455 (Operator.CheckBinaryOperator): Ditto.
1457 * cs-parser.jay (operator_declarator): Update accordingly.
1459 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
1460 (CheckBinaryOperator): Same here.
1462 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
1463 on the name without any prefixes of namespace names etc. This is because we
1464 already might have something already fully qualified like
1465 'System.Console.WriteLine'
1467 * assign.cs (Resolve): Begin implementation. Stuck ;-)
1469 2001-09-07 Ravi Pratap <ravi@ximian.com>
1471 * cs-tokenizer.cs (location): Return a string which also contains
1474 * expression.cs (ElementAccess): New class for expressions of the
1475 type 'element access.'
1476 (BaseAccess): New class for expressions of the type 'base access.'
1477 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
1480 * cs-parser.jay (element_access): Implement action.
1481 (base_access): Implement actions.
1482 (checked_expression, unchecked_expression): Implement.
1484 * cs-parser.jay (local_variable_type): Correct and implement.
1485 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
1487 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
1489 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
1490 name and the specifiers.
1492 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
1494 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
1495 making them all public ;-)
1497 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
1500 2001-09-07 Miguel de Icaza <miguel@ximian.com>
1502 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
1504 (FieldExpr, PropertyExprs): New resolved expressions.
1505 (SimpleName::MemberStaticCheck): Perform static checks for access
1506 to non-static fields on static methods. Maybe this should be
1507 generalized for MemberAccesses.
1508 (SimpleName::ResolveSimpleName): More work on simple name
1511 * cs-parser.jay (primary_expression/qualified_identifier): track
1512 the parameter index.
1514 * codegen.cs (CodeGen::Save): Catch save exception, report error.
1515 (EmitContext::EmitBoolExpression): Chain to expression generation
1516 instead of temporary hack.
1517 (::EmitStatementExpression): Put generic expression code generation.
1519 * assign.cs (Assign::Emit): Implement variable assignments to
1520 local variables, parameters and fields.
1522 2001-09-06 Miguel de Icaza <miguel@ximian.com>
1524 * statement.cs (Block::GetVariableInfo): New method, returns the
1525 VariableInfo for a variable name in a block.
1526 (Block::GetVariableType): Implement in terms of GetVariableInfo
1528 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
1529 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
1531 2001-09-06 Ravi Pratap <ravi@ximian.com>
1533 * cs-parser.jay (operator_declaration): Continue on my quest : update
1534 to take attributes argument.
1535 (event_declaration): Ditto.
1536 (enum_declaration): Ditto.
1537 (indexer_declaration): Ditto.
1539 * class.cs (Operator::Operator): Update constructor accordingly.
1540 (Event::Event): Ditto.
1542 * delegate.cs (Delegate::Delegate): Same here.
1544 * enum.cs (Enum::Enum): Same here.
1546 2001-09-05 Ravi Pratap <ravi@ximian.com>
1548 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
1550 * ../tests/cs0658.cs : New file to demonstrate error 0658.
1552 * attribute.cs (Attributes): New class to encapsulate all attributes which were
1553 being passed around as an arraylist.
1554 (Attributes::AddAttribute): Method to add attribute sections.
1556 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
1557 (struct_declaration): Update accordingly.
1558 (constant_declaration): Update.
1559 (field_declaration): Update.
1560 (method_header): Update.
1561 (fixed_parameter): Update.
1562 (parameter_array): Ditto.
1563 (property_declaration): Ditto.
1564 (destructor_declaration): Ditto.
1566 * class.cs (Struct::Struct): Update constructors accordingly.
1567 (Class::Class): Ditto.
1568 (Field::Field): Ditto.
1569 (Method::Method): Ditto.
1570 (Property::Property): Ditto.
1571 (TypeContainer::OptAttribute): update property's return type.
1573 * interface.cs (Interface.opt_attributes): New member.
1574 (Interface::Interface): Update to take the extra Attributes argument.
1576 * parameter.cs (Parameter::Parameter): Ditto.
1578 * constant.cs (Constant::Constant): Ditto.
1580 * interface.cs (InterfaceMemberBase): New OptAttributes field.
1581 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
1582 the attributes as a parameter.
1583 (InterfaceProperty): Update constructor call.
1584 (InterfaceEvent): Ditto.
1585 (InterfaceMethod): Ditto.
1586 (InterfaceIndexer): Ditto.
1588 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
1589 pass the attributes too.
1590 (interface_event_declaration): Ditto.
1591 (interface_property_declaration): Ditto.
1592 (interface_method_declaration): Ditto.
1593 (interface_declaration): Ditto.
1595 2001-09-05 Miguel de Icaza <miguel@ximian.com>
1597 * class.cs (Method::Define): Track the "static Main" definition to
1598 create an entry point.
1600 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
1601 EntryPoint if we find it.
1603 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
1604 (EmitContext::ig): Make this variable public.
1606 * driver.cs: Make the default output file be the first file name
1607 with the .exe extension.
1609 Detect empty compilations
1611 Handle various kinds of output targets. Handle --target and
1612 rename -t to --dumper.
1614 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
1615 methods inherited from Expression return now an Expression. This
1616 will is used during the tree rewriting as we resolve them during
1619 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
1620 the spec. Missing entirely is the information about
1621 accessability of elements of it.
1623 (Expression::ExprClassFromMemberInfo): New constructor for
1624 Expressions that creates a fully initialized Expression based on
1625 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
1628 (Invocation::Resolve): Begin implementing resolution of invocations.
1630 * literal.cs (StringLiteral): Implement Emit.
1632 2001-09-05 Ravi Pratap <ravi@ximian.com>
1634 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
1637 2001-09-04 Ravi Pratap <ravi@ximian.com>
1639 * cs-parser.jay (attribute_arguments): Implement actions.
1640 (attribute): Fix bug in production. Implement action.
1641 (attribute_list): Implement.
1642 (attribute_target): Implement.
1643 (attribute_target_specifier, opt_target_specifier): Implement
1644 (CheckAttributeTarget): New method to check if the attribute target
1646 (attribute_section): Implement.
1647 (opt_attributes): Implement.
1649 * attribute.cs : New file to handle attributes.
1650 (Attribute): Class to hold attribute info.
1652 * cs-parser.jay (opt_attribute_target_specifier): Remove production
1653 (attribute_section): Modify production to use 2 different rules to
1654 achieve the same thing. 1 s/r conflict down !
1655 Clean out commented, useless, non-reducing dimension_separator rules.
1657 * class.cs (TypeContainer.attributes): New member to hold list
1658 of attributes for a type.
1659 (Struct::Struct): Modify to take one more argument, the attribute list.
1660 (Class::Class): Ditto.
1661 (Field::Field): Ditto.
1662 (Method::Method): Ditto.
1663 (Property::Property): Ditto.
1665 * cs-parser.jay (struct_declaration): Update constructor call to
1666 pass in the attributes too.
1667 (class_declaration): Ditto.
1668 (constant_declaration): Ditto.
1669 (field_declaration): Ditto.
1670 (method_header): Ditto.
1671 (fixed_parameter): Ditto.
1672 (parameter_array): Ditto.
1673 (property_declaration): Ditto.
1675 * constant.cs (Constant::Constant): Update constructor similarly.
1676 Use System.Collections.
1678 * parameter.cs (Parameter::Parameter): Update as above.
1680 2001-09-02 Ravi Pratap <ravi@ximian.com>
1682 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
1683 (TypeContainer.delegates): New member to hold list of delegates.
1685 * cs-parser.jay (delegate_declaration): Implement the action correctly
1686 this time as I seem to be on crack ;-)
1688 2001-09-02 Miguel de Icaza <miguel@ximian.com>
1690 * rootcontext.cs (RootContext::IsNamespace): new function, used to
1691 tell whether an identifier represents a namespace.
1693 * expression.cs (NamespaceExpr): A namespace expression, used only
1694 temporarly during expression resolution.
1695 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
1696 utility functions to resolve names on expressions.
1698 2001-09-01 Miguel de Icaza <miguel@ximian.com>
1700 * codegen.cs: Add hook for StatementExpressions.
1702 * class.cs: Fix inverted test for static flag in methods.
1704 2001-09-02 Ravi Pratap <ravi@ximian.com>
1706 * class.cs (Operator::CheckUnaryOperator): Correct error number used
1707 to make it coincide with MS' number.
1708 (Operator::CheckBinaryOperator): Ditto.
1710 * ../errors/errors.txt : Remove error numbers added earlier.
1712 * ../errors/cs1019.cs : Test case for error # 1019
1714 * ../errros/cs1020.cs : Test case for error # 1020
1716 * cs-parser.jay : Clean out commented cruft.
1717 (dimension_separators, dimension_separator): Comment out. Ostensibly not
1718 used anywhere - non-reducing rule.
1719 (namespace_declarations): Non-reducing rule - comment out.
1721 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
1722 with TypeContainer::AddEnum.
1724 * delegate.cs : New file for delegate handling classes.
1725 (Delegate): Class for declaring delegates.
1727 * makefile : Update.
1729 * cs-parser.jay (delegate_declaration): Implement.
1731 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
1733 * class.cs (Event::Define): Implement.
1734 (Event.EventBuilder): New member.
1736 * class.cs (TypeContainer::Populate): Update to define all enums and events
1738 (Events): New property for the events arraylist we hold. Shouldn't we move to using
1739 readonly fields for all these cases ?
1741 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1743 * class.cs (Property): Revamp to use the convention of making fields readonly.
1744 Accordingly modify code elsewhere.
1746 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
1747 the Define method of the Property class.
1749 * class.cs : Clean up applied patch and update references to variables etc. Fix
1751 (TypeContainer::Populate): Update to define all the properties we have. Also
1752 define all enumerations.
1754 * enum.cs (Define): Implement.
1756 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1758 * cs-parser.jay (overloadable_operator): The semantic value is an
1759 enum of the Operator class.
1760 (operator_declarator): Implement actions.
1761 (operator_declaration): Implement.
1763 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
1764 validity of definitions.
1765 (Operator::CheckBinaryOperator): Static method to check for binary operators
1766 (TypeContainer::AddOperator): New method to add an operator to a type.
1768 * cs-parser.jay (indexer_declaration): Added line to actually call the
1769 AddIndexer method so it gets added ;-)
1771 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
1772 already taken care of by the MS compiler ?
1774 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1776 * class.cs (Operator): New class for operator declarations.
1777 (Operator::OpType): Enum for the various operators.
1779 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1781 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
1782 ostensibly handle this in semantic analysis.
1784 * cs-parser.jay (general_catch_clause): Comment out
1785 (specific_catch_clauses, specific_catch_clause): Ditto.
1786 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
1787 (catch_args, opt_catch_args): New productions.
1788 (catch_clause): Rewrite to use the new productions above
1789 (catch_clauses): Modify accordingly.
1790 (opt_catch_clauses): New production to use in try_statement
1791 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
1792 and re-write the code in the actions to extract the specific and
1793 general catch clauses by being a little smart ;-)
1795 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
1796 Hooray, try and catch statements parse fine !
1798 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1800 * statement.cs (Block::GetVariableType): Fix logic to extract the type
1801 string from the hashtable of variables.
1803 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
1804 I end up making that mistake ;-)
1805 (catch_clauses): Fixed gross error which made Key and Value of the
1806 DictionaryEntry the same : $1 !!
1808 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1810 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
1812 * cs-parser.jay (event_declaration): Correct to remove the semicolon
1813 when the add and remove accessors are specified.
1815 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1817 * cs-parser.jay (IndexerDeclaration): New helper class to hold
1818 information about indexer_declarator.
1819 (indexer_declarator): Implement actions.
1820 (parsing_indexer): New local boolean used to keep track of whether
1821 we are parsing indexers or properties. This is necessary because
1822 implicit_parameters come into picture even for the get accessor in the
1824 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
1826 * class.cs (Indexer): New class for indexer declarations.
1827 (TypeContainer::AddIndexer): New method to add an indexer to a type.
1828 (TypeContainer::indexers): New member to hold list of indexers for the
1831 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
1833 * cs-parser.jay (add_accessor_declaration): Implement action.
1834 (remove_accessor_declaration): Implement action.
1835 (event_accessors_declaration): Implement
1836 (variable_declarators): swap statements for first rule - trivial.
1838 * class.cs (Event): New class to hold information about event
1840 (TypeContainer::AddEvent): New method to add an event to a type
1841 (TypeContainer::events): New member to hold list of events.
1843 * cs-parser.jay (event_declaration): Implement actions.
1845 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
1847 * cs-parser.jay (dim_separators): Implement. Make it a string
1848 concatenating all the commas together, just as they appear.
1849 (opt_dim_separators): Modify accordingly
1850 (rank_specifiers): Update accordingly. Basically do the same
1851 thing - instead, collect the brackets here.
1852 (opt_rank_sepcifiers): Modify accordingly.
1853 (array_type): Modify to actually return the complete type string
1854 instead of ignoring the rank_specifiers.
1855 (expression_list): Implement to collect the expressions
1856 (variable_initializer): Implement. We make it a list of expressions
1857 essentially so that we can handle the array_initializer case neatly too.
1858 (variable_initializer_list): Implement.
1859 (array_initializer): Make it a list of variable_initializers
1860 (opt_array_initializer): Modify accordingly.
1862 * expression.cs (New::NType): Add enumeration to help us
1863 keep track of whether we have an object/delegate creation
1864 or an array creation.
1865 (New:NewType, New::Rank, New::Indices, New::Initializers): New
1866 members to hold data about array creation.
1867 (New:New): Modify to update NewType
1868 (New:New): New Overloaded contructor for the array creation
1871 * cs-parser.jay (array_creation_expression): Implement to call
1872 the overloaded New constructor.
1874 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
1876 * class.cs (TypeContainer::Constructors): Return member
1877 constructors instead of returning null.
1879 2001-08-26 Miguel de Icaza <miguel@ximian.com>
1881 * typemanager.cs (InitCoreTypes): Initialize the various core
1882 types after we have populated the type manager with the user
1883 defined types (this distinction will be important later while
1884 compiling corlib.dll)
1886 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
1887 on Expression Classification. Now all expressions have a method
1888 `Resolve' and a method `Emit'.
1890 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
1891 generation from working. Also add some temporary debugging
1894 2001-08-24 Miguel de Icaza <miguel@ximian.com>
1896 * codegen.cs: Lots of code generation pieces. This is only the
1897 beginning, will continue tomorrow with more touches of polish. We
1898 handle the fundamentals of if, while, do, for, return. Others are
1899 trickier and I need to start working on invocations soon.
1901 * gen-treedump.cs: Bug fix, use s.Increment here instead of
1904 * codegen.cs (EmitContext): New struct, used during code
1905 emission to keep a context. Most of the code generation will be
1908 * cs-parser.jay: Add embedded blocks to the list of statements of
1909 this block. So code generation proceeds in a top down fashion.
1911 2001-08-23 Miguel de Icaza <miguel@ximian.com>
1913 * statement.cs: Add support for multiple child blocks.
1915 2001-08-22 Miguel de Icaza <miguel@ximian.com>
1917 * codegen.cs (EmitCode): New function, will emit the code for a
1918 Block of code given a TypeContainer and its ILGenerator.
1920 * statement.cs (Block): Standard public readonly optimization.
1921 (Block::Block constructors): Link children.
1922 (Block::Child): Child Linker.
1923 (Block::EmitVariables): Emits IL variable declarations.
1925 * class.cs: Drop support for MethodGroups here, delay until
1927 (Method::): Applied the same simplification that I did before, and
1928 move from Properties to public readonly fields.
1929 (Method::ParameterTypes): Returns the parameter types for the
1930 function, and implements a cache that will be useful later when I
1931 do error checking and the semantic analysis on the methods is
1933 (Constructor::GetCallingConvention): Renamed from CallingConvetion
1934 and made a method, optional argument tells whether this is a class
1935 or a structure to apply the `has-this' bit.
1936 (Method::GetCallingConvention): Implement, returns the calling
1938 (Method::Define): Defines the type, a second pass is performed
1939 later to populate the methods.
1941 (Constructor::ParameterTypes): implement a cache similar to the
1942 one on Method::ParameterTypes, useful later when we do semantic
1945 (TypeContainer::EmitMethod): New method. Emits methods.
1947 * expression.cs: Removed MethodGroup class from here.
1949 * parameter.cs (Parameters::GetCallingConvention): new method.
1951 2001-08-21 Miguel de Icaza <miguel@ximian.com>
1953 * class.cs (TypeContainer::Populate): Drop RootContext from the
1956 (Constructor::CallingConvention): Returns the calling convention.
1957 (Constructor::ParameterTypes): Returns the constructor parameter
1960 (TypeContainer::AddConstructor): Keep track of default constructor
1961 and the default static constructor.
1963 (Constructor::) Another class that starts using `public readonly'
1964 instead of properties.
1966 (Constructor::IsDefault): Whether this is a default constructor.
1968 (Field::) use readonly public fields instead of properties also.
1970 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
1971 track of static constructors; If none is used, turn on
1972 BeforeFieldInit in the TypeAttributes.
1974 * cs-parser.jay (opt_argument_list): now the return can be null
1975 for the cases where there are no arguments.
1977 (constructor_declarator): If there is no implicit `base' or
1978 `this', then invoke the default parent constructor.
1980 * modifiers.cs (MethodAttr): New static function maps a set of
1981 modifiers flags into a MethodAttributes enum
1982 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
1983 MethodAttr, TypeAttr to represent the various mappings where the
1985 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
1987 2001-08-19 Miguel de Icaza <miguel@ximian.com>
1989 * parameter.cs (GetParameterInfo): Fix bug where there would be no
1992 * interface.cs (PopulateIndexer): Implemented the code generator
1993 for interface indexers.
1995 2001-08-17 Miguel de Icaza <miguel@ximian.com>
1997 * interface.cs (InterfaceMemberBase): Now we track the new status
2000 (PopulateProperty): Implement property population. Woohoo! Got
2001 Methods and Properties going today.
2003 Removed all the properties for interfaces, and replaced them with
2004 `public readonly' fields.
2006 2001-08-16 Miguel de Icaza <miguel@ximian.com>
2008 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2009 initialize their hashtables/arraylists only when they are needed
2010 instead of doing this always.
2012 * parameter.cs: Handle refs and out parameters.
2014 * cs-parser.jay: Use an ArrayList to construct the arguments
2015 instead of the ParameterCollection, and then cast that to a
2018 * parameter.cs: Drop the use of ParameterCollection and use
2019 instead arrays of Parameters.
2021 (GetParameterInfo): Use the Type, not the Name when resolving
2024 2001-08-13 Miguel de Icaza <miguel@ximian.com>
2026 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2027 and instead use public readonly fields.
2029 * class.cs: Put back walking code for type containers.
2031 2001-08-11 Miguel de Icaza <miguel@ximian.com>
2033 * class.cs (MakeConstant): Code to define constants.
2035 * rootcontext.cs (LookupType): New function. Used to locate types
2038 2001-08-08 Miguel de Icaza <miguel@ximian.com>
2040 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
2041 this System.Reflection code is. Kudos to Microsoft
2043 * typemanager.cs: Implement a type cache and avoid loading all
2044 types at boot time. Wrap in LookupType the internals. This made
2045 the compiler so much faster. Wow. I rule!
2047 * driver.cs: Make sure we always load mscorlib first (for
2048 debugging purposes, nothing really important).
2050 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
2051 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
2053 * rootcontext.cs: Lookup types on their namespace; Lookup types
2054 on namespaces that have been imported using the `using' keyword.
2056 * class.cs (TypeContainer::TypeAttr): Virtualize.
2057 (Class::TypeAttr): Return attributes suitable for this bad boy.
2058 (Struct::TypeAttr): ditto.
2059 Handle nested classes.
2060 (TypeContainer::) Remove all the type visiting code, it is now
2061 replaced with the rootcontext.cs code
2063 * rootcontext.cs (GetClassBases): Added support for structs.
2065 2001-08-06 Miguel de Icaza <miguel@ximian.com>
2067 * interface.cs, statement.cs, class.cs, parameter.cs,
2068 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2069 Drop use of TypeRefs, and use strings instead.
2071 2001-08-04 Miguel de Icaza <miguel@ximian.com>
2075 * class.cs (Struct::Struct): set the SEALED flags after
2076 checking the modifiers.
2077 (TypeContainer::TypeAttr): new property, returns the
2078 TypeAttributes for a class.
2080 * cs-parser.jay (type_list): Oops, list production was creating a
2081 new list of base types.
2083 * rootcontext.cs (StdLib): New property.
2084 (GetInterfaceTypeByName): returns an interface by type name, and
2085 encapsulates error handling here.
2086 (GetInterfaces): simplified.
2087 (ResolveTree): Encapsulated all the tree resolution here.
2088 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2091 * driver.cs: Add support for --nostdlib, to avoid loading the
2093 (Main): Do not put tree resolution here.
2095 * rootcontext.cs: Beginning of the class resolution.
2097 2001-08-03 Miguel de Icaza <miguel@ximian.com>
2099 * rootcontext.cs: Provide better error reporting.
2101 * cs-parser.jay (interface_base): set our $$ to be interfaces.
2103 * rootcontext.cs (CreateInterface): Handle the case where there
2104 are no parent interfaces.
2106 (CloseTypes): Routine to flush types at the end.
2107 (CreateInterface): Track types.
2108 (GetInterfaces): Returns an array of Types from the list of
2111 * typemanager.c (AddUserType): Mechanism to track user types (puts
2112 the type on the global type hash, and allows us to close it at the
2115 2001-08-02 Miguel de Icaza <miguel@ximian.com>
2117 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2118 RecordInterface instead.
2120 * cs-parser.jay: Updated to reflect changes above.
2122 * decl.cs (Definition): Keep track of the TypeBuilder type that
2123 represents this type here. Not sure we will use it in the long
2124 run, but wont hurt for now.
2126 * driver.cs: Smaller changes to accomodate the new code.
2128 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2131 * rootcontext.cs (CreateInterface): New method, used to create
2132 the System.TypeBuilder type for interfaces.
2133 (ResolveInterfaces): new entry point to resolve the interface
2135 (CodeGen): Property, used to keep track of the code generator.
2137 2001-07-26 Miguel de Icaza <miguel@ximian.com>
2139 * cs-parser.jay: Add a second production for delegate_declaration
2142 (enum_body): Put an opt_comma here instead of putting it on
2143 enum_body or enum_member_declarations so we can handle trailing
2144 commas on enumeration members. Gets rid of a shift/reduce.
2146 (type_list): Need a COMMA in the middle.
2148 (indexer_declaration): Tell tokenizer to recognize get/set
2150 * Remove old targets.
2152 * Re-add the parser target.
2154 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2156 * cs-parser.jay: Add precendence rules for a number of operators
2157 ot reduce the number of shift/reduce conflicts in the grammar.
2159 2001-07-17 Miguel de Icaza <miguel@ximian.com>
2161 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2164 Get rid of old crufty code.
2166 * rootcontext.cs: Use this to keep track of the parsed
2167 representation and the defined types available to the program.
2169 * gen-treedump.cs: adjust for new convention.
2171 * type.cs: Split out the type manager, and the assembly builder
2174 * typemanager.cs: the type manager will live here now.
2176 * cil-codegen.cs: And the code generator here.
2178 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
2180 * makefile: Fixed up for easy making.
2182 2001-07-13 Simon Cozens <simon@simon-cozens.org>
2184 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2187 (unary_expression): Expand pre_increment_expression and
2188 post_decrement_expression to reduce a shift/reduce.
2190 2001-07-11 Simon Cozens
2192 * cs-tokenizer.cs: Hex numbers should begin with a 0.
2194 Improve allow_keyword_as_indent name.
2196 2001-06-19 Miguel de Icaza <miguel@ximian.com>
2198 * Adjustments for Beta2.
2200 2001-06-13 Miguel de Icaza <miguel@ximian.com>
2202 * decl.cs: Added `Define' abstract method.
2203 (InTransit): new property, used to catch recursive definitions.
2205 * interface.cs: Implement `Define'.
2207 * modifiers.cs: Map Modifiers.constants to
2208 System.Reflection.TypeAttribute flags.
2210 * class.cs: Keep track of types and user-defined types.
2211 (BuilderInit): New method for creating an assembly
2212 (ResolveType): New function to launch the resolution process, only
2213 used by interfaces for now.
2215 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2216 that are inserted into the name space.
2218 2001-06-08 Miguel de Icaza <miguel@ximian.com>
2220 * ARGH. I have screwed up my tree so many times due to the use of
2221 rsync rather than using CVS. Going to fix this at once.
2223 * driver.cs: Objetify driver. Load assemblies, use assemblies to
2226 2001-06-07 Miguel de Icaza <miguel@ximian.com>
2228 * Experiment successful: Use System.Type rather that our own
2231 2001-05-25 Miguel de Icaza <miguel@ximian.com>
2233 * cs-parser.jay: Removed nsAliases from here.
2235 Use new namespaces, handle `using XXX;'
2237 * namespace.cs: Reimplemented namespace handling, use a recursive
2238 definition of the class. Now we can keep track of using clauses
2239 and catch invalid using clauses.
2241 2001-05-24 Miguel de Icaza <miguel@ximian.com>
2243 * gen-treedump.cs: Adapted for all the renaming.
2245 * expression.cs (Expression): this class now has a Type property
2246 which returns an expression Type.
2248 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2249 `Type', as this has a different meaning now in the base
2251 2001-05-22 Miguel de Icaza <miguel@ximian.com>
2253 * interface.cs, class.cs: Removed from all the sources the
2254 references to signature computation, as we can not do method
2255 signature computation during the parsing time, as we are not
2256 trying to solve at that point distinguishing:
2260 void a (NS.Blah x) {}
2263 Which depending on the context might be valid or not, as we do not
2264 know if Blah is the same thing as NS.Blah at that point.
2266 * Redid everything so the code uses TypeRefs now instead of
2267 Types. TypeRefs are just temporary type placeholders, that need
2268 to be resolved. They initially have a pointer to a string and the
2269 current scope in which they are used. This is used later by the
2270 compiler to resolve the reference to an actual Type.
2272 * DeclSpace is no longer a CIR.Type, and neither are
2273 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
2274 are all DeclSpaces, but no Types.
2276 * type.cs (TypeRefManager): This implements the TypeRef manager,
2277 which keeps track of all the types that need to be resolved after
2278 the parsing has finished.
2280 2001-05-13 Miguel de Icaza <miguel@ximian.com>
2282 * ARGH. We are going to have to store `foreach' as a class rather
2283 than resolving it, as we need to verify error 1579 after name
2284 resolution. *OR* we could keep a flag that says `This request to
2285 IEnumerator comes from a foreach statement' which we can then use
2286 to generate the error.
2288 2001-05-10 Miguel de Icaza <miguel@ximian.com>
2290 * class.cs (TypeContainer.AddMethod): we now add methods to the
2291 MethodGroup instead of the method hashtable.
2293 * expression.cs: Add MethodGroup abstraction, which gets us one
2294 step closer to the specification in the way we handle method
2297 * cs-parser.jay (primary_expression): qualified_identifier now
2298 tried to match up an identifier to a local variable reference or
2299 to a parameter reference.
2301 current_local_parameters is now a parser global variable that
2302 points to the current parameters for the block, used during name
2305 (property_declaration): Now creates an implicit `value' argument to
2308 2001-05-09 Miguel de Icaza <miguel@ximian.com>
2310 * parameter.cs: Do not use `param' arguments as part of the
2311 signature, per the spec.
2313 2001-05-08 Miguel de Icaza <miguel@ximian.com>
2315 * decl.cs: Base class for classes, structs and interfaces. This
2316 is the "Declaration Space"
2318 * cs-parser.jay: Use CheckDef for checking declaration errors
2319 instead of having one on each function.
2321 * class.cs: Factor out some code for handling error handling in
2322 accordance to the "Declarations" section in the "Basic Concepts"
2323 chapter in the ECMA C# spec.
2325 * interface.cs: Make all interface member classes derive from
2326 InterfaceMemberBase.
2328 2001-05-07 Miguel de Icaza <miguel@ximian.com>
2330 * Many things: all interfaces are parsed and generated in
2331 gen-treedump. Support for member variables, constructors,
2332 destructors, properties, constants is there.
2334 Beginning of the IL backend, but very little done, just there for
2337 2001-04-29 Miguel de Icaza <miguel@ximian.com>
2339 * cs-parser.jay: Fix labeled statement.
2341 * cs-tokenizer.cs (escape): Escape " and ' always.
2342 ref_line, ref_name: keep track of the line/filename as instructed
2343 by #line by the compiler.
2346 2001-04-27 Miguel de Icaza <miguel@ximian.com>
2348 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
2349 to match the values in System.CodeDOM.
2351 Divid renamed to Divide.
2353 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
2355 (Statements.set): remove.
2357 * System.CodeDOM/CodeCatchClause.cs: always have a valid
2360 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
2361 falseStatements always have valid values.
2363 * cs-parser.jay: Use System.CodeDOM now.