1 2001-09-28 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs (UserImplicitCast): Method should always be
5 (Invocation::BetterConversion): Simplified test for IntLiteral.
7 (Expression::ImplicitNumericConversion): Split this routine out.
8 Put the code that performs implicit constant integer conversions
11 (Expression::Resolve): Become a wrapper around DoResolve so we can
12 check eclass and type being set after resolve.
14 (Invocation::Badness): Remove this dead function
16 (Binary::ResolveOperator): Do not compute the expensive argumnets
17 unless we have a union for it.
19 (Probe::Emit): Is needs to do an isinst and then
22 (::CanConvert): Added Location argument. If the Location argument
23 is null (Location.Null), then we do not report errors. This is
24 used by the `probe' mechanism of the Explicit conversion. We do
25 not want to generate an error for something that the user
26 explicitly requested to be casted. But the pipeline for an
27 explicit cast first tests for potential implicit casts.
29 So for now, if the Location is null, it means `Probe only' to
30 avoid adding another argument. Might have to revise this
33 (ClassCast): New class used to type cast objects into arbitrary
34 classes (used in Explicit Reference Conversions).
36 Implement `as' as well.
38 Reverted all the patches from Ravi below: they were broken:
40 * The use of `level' as a mechanism to stop recursive
41 invocations is wrong. That was there just to catch the
42 bug with a strack trace but not as a way of addressing
45 To fix the problem we have to *understand* what is going
46 on and the interactions and come up with a plan, not
47 just get things going.
49 * The use of the type conversion cache that I proposed
50 last night had an open topic: How does this work across
51 protection domains. A user defined conversion might not
52 be public in the location where we are applying the
53 conversion, a different conversion might be selected
54 (ie, private A->B (better) but public B->A (worse),
55 inside A, A->B applies, but outside it, B->A will
58 * On top of that (ie, even if the above is solved),
59 conversions in a cache need to be abstract. Ie, `To
60 convert from an Int to a Short use an OpcodeCast', not
61 `To convert from an Int to a Short use the OpcodeCast on
62 the variable 5' (which is what this patch was doing).
64 2001-09-28 Ravi Pratap <ravi@ximian.com>
66 * expression.cs (Invocation::ConversionExists): Re-write to use
69 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
70 cache all conversions done, not just user-defined ones.
72 (Invocation::BetterConversion): The real culprit. Use ConversionExists
73 to determine if a conversion exists instead of acutually trying to
74 perform the conversion. It's faster too.
76 (Expression::ConvertExplicit): Modify to use ConversionExists to check
77 and only then attempt the implicit conversion.
79 2001-09-28 Ravi Pratap <ravi@ximian.com>
81 * expression.cs (ConvertImplicit): Use a cache for conversions
82 already found. Check level of recursion and bail out if necessary.
84 2001-09-28 Miguel de Icaza <miguel@ximian.com>
86 * typemanager.cs (string_concat_string_string, string_concat_object_object):
87 Export standard methods that we expect for string operations.
89 * statement.cs (Block::UsageWarning): Track usage of variables and
90 report the errors for not used variables.
92 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
95 2001-09-27 Miguel de Icaza <miguel@ximian.com>
97 * codegen.cs: remove unnneded code
99 * expression.cs: Removed BuiltinTypeAccess class
101 Fix the order in which implicit conversions are
104 The previous fixed dropped support for boxed conversions (adding a
105 test to the test suite now)
107 (UserImplicitCast::CanConvert): Remove test for source being null,
108 that code is broken. We should not feed a null to begin with, if
109 we do, then we should track the bug where the problem originates
110 and not try to cover it up here.
112 Return a resolved expression of type UserImplicitCast on success
113 rather than true/false. Ravi: this is what I was talking about,
114 the pattern is to use a static method as a "constructor" for
117 Also, do not create arguments until the very last minute,
118 otherwise we always create the arguments even for lookups that
119 will never be performed.
121 (UserImplicitCast::Resolve): Eliminate, objects of type
122 UserImplicitCast are born in a fully resolved state.
124 * typemanager.cs (InitCoreTypes): Init also value_type
127 * expression.cs (Cast::Resolve): First resolve the child expression.
129 (LValue): Add new method AddressOf to be used by
132 Change the argument of Store to take an EmitContext instead of an
133 ILGenerator, because things like FieldExpr need to be able to call
134 their children expression to generate the instance code.
136 (Expression::Error, Expression::Warning): Sugar functions for
139 (Expression::MemberLookup): Accept a TypeContainer instead of a
140 Report as the first argument.
142 (Expression::ResolvePrimary): Killed. I still want to improve
143 this as currently the code is just not right.
145 (Expression::ResolveMemberAccess): Simplify, but it is still
148 (Unary::Resolve): Catch errors in AddressOf operators.
150 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
151 index to a byte for the short-version, or the compiler will choose
152 the wrong Emit call, which generates the wrong data.
154 (ParameterReference::Emit, ::Store): same.
156 (FieldExpr::AddressOf): Implement.
158 * typemanager.cs: TypeManager: made public variable instead of
161 * driver.cs: document --fatal.
163 * report.cs (ErrorMessage, WarningMessage): new names for the old
164 Error and Warning classes.
166 * cs-parser.jay (member_access): Turn built-in access to types
167 into a normal simplename
169 2001-09-27 Ravi Pratap <ravi@ximian.com>
171 * expression.cs (Invocation::BetterConversion): Fix to cope
172 with q being null, since this was introducing a bug.
174 * expression.cs (ConvertImplicit): Do built-in conversions first.
176 2001-09-27 Ravi Pratap <ravi@ximian.com>
178 * expression.cs (UserImplicitCast::Resolve): Fix bug.
180 2001-09-27 Ravi Pratap <ravi@ximian.com>
182 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
183 I had introduced long ago (what's new ?).
185 * expression.cs (UserImplicitCast::CanConvert): Static method to do
186 the work of all the checking.
187 (ConvertImplicit): Call CanConvert and only then create object if necessary.
188 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
190 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
191 that is the right way.
193 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
194 overloading resolution. Use everywhere instead of cutting and pasting code.
196 (Binary::ResolveOperator): Use MakeUnionSet.
198 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
199 we have to convert to bool types. Not complete yet.
201 2001-09-27 Miguel de Icaza <miguel@ximian.com>
203 * typemanager.cs (TypeManager::CSharpName): support ushort.
205 * expression.cs (Expression::TryImplicitIntConversion): Attempts
206 to provide an expression that performsn an implicit constant int
207 conversion (section 6.1.6).
208 (Expression::ConvertImplicitRequired): Reworked to include
209 implicit constant expression conversions.
211 (Expression::ConvertNumericExplicit): Finished.
213 (Invocation::Emit): If InstanceExpression is null, then it means
214 that we perform a call on this.
216 2001-09-26 Miguel de Icaza <miguel@ximian.com>
218 * expression.cs (Unary::Emit): Remove some dead code.
219 (Probe): Implement Resolve and Emit for `is'.
220 (Expression::ConvertImplicitRequired): Attempt to do constant
221 expression conversions here. Maybe should be moved to
222 ConvertImplicit, but I am not sure.
223 (Expression::ImplicitLongConstantConversionPossible,
224 Expression::ImplicitIntConstantConversionPossible): New functions
225 that tell whether is it possible to apply an implicit constant
226 expression conversion.
228 (ConvertNumericExplicit): Started work on explicit numeric
231 * cs-parser.jay: Update operator constants.
233 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
234 (Parameters::GetSignature): Hook up VerifyArgs here.
235 (Parameters::VerifyArgs): Verifies that no two arguments have the
238 * class.cs (Operator): Update the operator names to reflect the
239 ones that the spec expects (as we are just stringizing the
242 * expression.cs (Unary::ResolveOperator): Fix bug: Use
243 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
244 previous usage did only work for our methods.
245 (Expression::ConvertImplicit): Handle decimal implicit numeric
247 (Expression::InternalTypeConstructor): Used to invoke constructors
248 on internal types for default promotions.
250 (Unary::Emit): Implement special handling for the pre/post
251 increment/decrement for overloaded operators, as they need to have
252 the same semantics as the other operators.
254 (Binary::ResolveOperator): ditto.
255 (Invocation::ConversionExists): ditto.
256 (UserImplicitCast::Resolve): ditto.
258 2001-09-26 Ravi Pratap <ravi@ximian.com>
260 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
261 operator, return after emitting body. Regression tests pass again !
263 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
264 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
265 (Invocation::OverloadResolve): Ditto.
266 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
268 * everywhere : update calls to the above methods accordingly.
270 2001-09-26 Miguel de Icaza <miguel@ximian.com>
272 * assign.cs (Assign): Make it inherit from ExpressionStatement.
274 * expression.cs (ExpressionStatement): New base class used for
275 expressions that can appear in statements, so that we can provide
276 an alternate path to generate expression that do not leave a value
279 (Expression::Emit, and all the derivatives): We no longer return
280 whether a value is left on the stack or not. Every expression
281 after being emitted leaves a single value on the stack.
283 * codegen.cs (EmitContext::EmitStatementExpression): Use the
284 facilties of ExpressionStatement if possible.
286 * cs-parser.jay: Update statement_expression.
288 2001-09-25 Miguel de Icaza <miguel@ximian.com>
290 * driver.cs: Change the wording of message
292 2001-09-25 Ravi Pratap <ravi@ximian.com>
294 * expression.cs (Binary::ResolveOperator): Had forgottten to set
295 the type of the expression to the return type of the method if
296 we have an overloaded operator match ! The regression tests pass again !
297 (Unary::ResolveOperator): Ditto.
299 * expression.cs (Invocation::ConversionExists): Correct the member lookup
300 to find "op_Implicit", not "implicit" ;-)
301 (UserImplicitCast): New class to take care of user-defined implicit conversions.
302 (ConvertImplicit, ForceConversion): Take TypeContainer argument
304 * everywhere : Correct calls to the above accordingly.
306 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
307 (ConvertImplicit): Do user-defined conversion if it exists.
309 2001-09-24 Miguel de Icaza <miguel@ximian.com>
311 * assign.cs: track location.
312 (Resolve): Use implicit conversions on assignment.
314 * literal.cs: Oops. Not good, Emit of short access values should
315 pass (Bytes) or the wrong argument will be selected.
317 * expression.cs (Unary::Emit): Emit code for -expr.
319 (Unary::ResolveOperator): Handle `Substract' for non-constants
320 (substract from zero from the non-constants).
321 Deal with Doubles as well.
323 (Expression::ConvertImplicitRequired): New routine that reports an
324 error if no implicit conversion exists.
326 (Invocation::OverloadResolve): Store the converted implicit
327 expressions if we make them
329 2001-09-24 Ravi Pratap <ravi@ximian.com>
331 * class.cs (ConstructorInitializer): Take a Location argument.
332 (ConstructorBaseInitializer): Same here.
333 (ConstructorThisInitializer): Same here.
335 * cs-parser.jay : Update all calls accordingly.
337 * expression.cs (Unary, Binary, New): Take location argument.
338 Update accordingly everywhere.
340 * cs-parser.jay : Update all calls to the above to take a location
345 2001-09-24 Ravi Pratap <ravi@ximian.com>
347 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
348 (Invocation::BetterConversion): Same here
349 (Invocation::ConversionExists): Ditto.
351 (Invocation::ConversionExists): Implement.
353 2001-09-22 Ravi Pratap <ravi@ximian.com>
355 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
356 Also take an additional TypeContainer argument.
358 * All over : Pass in TypeContainer as argument to OverloadResolve.
360 * typemanager.cs (CSharpName): Update to check for the string type and return
363 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
366 2001-09-21 Ravi Pratap <ravi@ximian.com>
368 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
369 (Invocation::BetterFunction): Implement.
370 (Invocation::BetterConversion): Implement.
371 (Invocation::ConversionExists): Skeleton, no implementation yet.
373 Okay, things work fine !
375 2001-09-21 Miguel de Icaza <miguel@ximian.com>
377 * typemanager.cs: declare and load enum_type, delegate_type and
380 * expression.cs (Expression::Emit): Now emit returns a value that
381 tells whether a value is left on the stack or not. This strategy
382 might be reveted tomorrow with a mechanism that would address
383 multiple assignments.
384 (Expression::report118): Utility routine to report mismatches on
387 (Unary::Report23): Report impossible type/operator combination
390 (Unary::IsIncrementableNumber): Whether the type can be
391 incremented or decremented with add.
392 (Unary::ResolveOperator): Also allow enumerations to be bitwise
394 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
396 (Invocation::Emit): Deal with new Emit convetion.
398 * All Expression derivatives: Updated their Emit method to return
399 whether they leave values on the stack or not.
401 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
402 stack for expressions that are statements.
404 2001-09-20 Miguel de Icaza <miguel@ximian.com>
406 * expression.cs (LValue): New interface. Must be implemented by
408 (LocalVariableReference, ParameterReference, FieldExpr): Implement
411 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
412 interface for generating code, simplifies the code.
414 2001-09-20 Ravi Pratap <ravi@ximian.com>
416 * expression.cs (everywhere): Comment out return statements in ::Resolve
417 methods to avoid the warnings.
419 2001-09-20 Miguel de Icaza <miguel@ximian.com>
421 * driver.cs (parse): Report error 2001 if we can not open the
424 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
427 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
430 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
431 otherwise nested blocks end up with the same index.
433 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
435 * expression.cs: Instead of having FIXMEs in the Resolve
436 functions, throw exceptions so it is obvious that we are facing a
439 * cs-parser.jay (invocation_expression): Pass Location information.
441 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
442 Use a basename for those routines because .NET does not like paths
445 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
448 2001-09-19 Miguel de Icaza <miguel@ximian.com>
450 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
451 are loading the correct data types (throws an exception if not).
452 (TypeManager::InitCoreTypes): Use CoreLookupType
454 * expression.cs (Unary::ResolveOperator): return the child
455 expression for expressions which are just +expr.
456 (Unary::ResolveOperator): Return negative literals for -LITERAL
457 expressions (otherwise they are Unary {Literal}).
458 (Invocation::Badness): Take into account `Implicit constant
459 expression conversions'.
461 * literal.cs (LongLiteral): Implement long literal class.
462 (IntLiteral): export the `Value' of the intliteral.
464 2001-09-19 Ravi Pratap <ravi@ximian.com>
466 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
468 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
469 instead of 'Operator'
471 * expression.cs (Binary::ResolveOperator): Update accordingly.
472 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
475 * cs-parser.jay (unary_expression): Update to use the new names.
477 * gen-treedump.cs (GetUnary): Same here.
479 * expression.cs (Unary::Resolve): Implement.
480 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
481 operators are found instead of making noise ;-)
482 (Unary::ResolveOperator): New method to do precisely the same thing which
483 Binary::ResolveOperator does for Binary expressions.
484 (Unary.method, .Arguments): Add.
485 (Unary::OperName): Implement.
486 (Unary::ForceConversion): Copy and Paste !
488 * class.cs (Operator::Define): Fix a small bug for the case when we have
491 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
492 for the inbuilt operators. Only overloading works for now ;-)
494 2001-09-18 Miguel de Icaza <miguel@ximian.com>
496 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
497 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
499 * expression.cs (This::Emit): Implement.
500 (This::Resolve): Implement.
501 (TypeOf:Resolve): Implement.
502 (Expression::ResolveSimpleName): Add an implicit this to instance
504 (MemberAccess::Resolve): Deal with Parameters and Fields.
505 Bind instance variable to Field expressions.
506 (FieldExpr::Instance): New field used to track the expression that
507 represents the object instance.
508 (FieldExpr::Resolve): Track potential errors from MemberLookup not
510 (FieldExpr::Emit): Implement.
512 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
513 the last instruction contains a return opcode to avoid generating
514 the last `ret' instruction (this generates correct code, and it is
515 nice to pass the peverify output).
517 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
518 initializer for static and instance variables.
519 (Constructor::Emit): Allow initializer to be null in the case of
520 static constructors. Only emit initializer for instance
523 (TypeContainer::FindMembers): Return a null array if there are no
526 Also fix the code for the MemberTypes.Method branch, as it was not
527 scanning that for operators (or tried to access null variables before).
529 * assign.cs (Assign::Emit): Handle instance and static fields.
533 * driver.cs: Stop compilation if there are parse errors.
535 * cs-parser.jay (constructor_declaration): Provide default base
536 initializer for non-static constructors.
537 (constructor_declarator): Do not provide a default base
538 initializers if none was specified.
539 Catch the fact that constructors should not have parameters.
541 * class.cs: Do not emit parent class initializers for static
542 constructors, that should be flagged as an error.
544 2001-09-18 Ravi Pratap <ravi@ximian.com>
546 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
547 Move back code into TypeContainer::Populate.
549 2001-09-18 Ravi Pratap <ravi@ximian.com>
551 * class.cs (TypeContainer::AddConstructor): Fix the check to
552 compare against Name, not Basename.
553 (Operator::OpType): Change Plus and Minus to Add and Subtract.
555 * cs-parser.jay : Update accordingly.
557 * class.cs (TypeContainer::FindMembers): For the case where we are searching
558 for methods, don't forget to look into the operators too.
559 (RegisterMethodBuilder): Helper method to take care of this for
560 methods, constructors and operators.
561 (Operator::Define): Completely revamp.
562 (Operator.OperatorMethod, MethodName): New fields.
563 (TypeContainer::Populate): Move the registering of builders into
564 RegisterMethodBuilder.
565 (Operator::Emit): Re-write.
567 * expression.cs (Binary::Emit): Comment out code path to emit method
568 invocation stuff for the case when we have a user defined operator. I am
569 just not able to get it right !
571 2001-09-17 Miguel de Icaza <miguel@ximian.com>
573 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
576 (Expression::MemberLookup): Provide a version that allows to
577 specify the MemberTypes and BindingFlags.
579 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
580 so it was not fetching variable information from outer blocks.
582 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
583 Beforefieldinit as it was buggy.
585 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
588 * class.cs (Constructor::Emit): Only emit if block is not null.
589 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
590 deal with this by semantically definining it as if the user had
593 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
594 constructors as we now "emit" them at a higher level.
596 (TypeContainer::DefineDefaultConstructor): Used to define the
597 default constructors if none was provided.
599 (ConstructorInitializer): Add methods Resolve and Emit.
601 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
603 2001-09-17 Ravi Pratap <ravi@ximian.com>
605 * class.cs (TypeContainer::EmitDefaultConstructor): Register
606 the default constructor builder with our hashtable for methodbuilders
609 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
610 and argument_count is 0 in which case we have a match.
611 (Binary::ResolveOperator): More null checking and miscellaneous coding
614 2001-09-17 Ravi Pratap <ravi@ximian.com>
616 * rootcontext.cs (IsNameSpace): Compare against null.
618 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
620 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
623 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
626 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
627 we have overloaded operators.
628 (Binary::ResolveOperator): Implement the part which does the operator overload
631 * class.cs (Operator::Emit): Implement.
632 (TypeContainer::Emit): Emit the operators we have too.
634 * expression.cs (Binary::Emit): Update to emit the appropriate code for
635 the case when we have a user-defined operator.
637 2001-09-17 Miguel de Icaza <miguel@ximian.com>
639 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
641 2001-09-16 Ravi Pratap <ravi@ximian.com>
643 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
644 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
645 (Constructor::Emit): Implement.
646 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
647 if we have no work to do.
648 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
651 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
652 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
654 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
657 2001-09-15 Ravi Pratap <ravi@ximian.com>
659 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
661 (Tree::RecordNamespace): Method to do what the name says ;-)
662 (Tree::Namespaces): Property to get at the namespaces hashtable.
664 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
667 * rootcontext.cs (IsNamespace): Fixed it :-)
669 2001-09-14 Miguel de Icaza <miguel@ximian.com>
671 * class.cs (TypeContainer::FindMembers): Add support for
673 (MethodCore): New class that encapsulates both the shared aspects
674 of a Constructor and a Method.
675 (Method, Constructor): Factored pieces into MethodCore.
677 * driver.cs: Added --fatal which makes errors throw exceptions.
678 Load System assembly as well as part of the standard library.
680 * report.cs: Allow throwing exceptions on errors for debugging.
682 * modifiers.cs: Do not use `parent', instead use the real type
683 container to evaluate permission settings.
685 * class.cs: Put Ravi's patch back in. He is right, and we will
686 have to cope with the
688 2001-09-14 Ravi Pratap <ravi@ximian.com>
690 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
691 FamORAssem, not FamANDAssem.
693 2001-09-14 Miguel de Icaza <miguel@ximian.com>
695 * driver.cs: Added --parse option that only parses its input files
698 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
699 incorrect. IsTopLevel is not used to tell whether an object is
700 root_types or not (that can be achieved by testing this ==
701 root_types). But to see if this is a top-level *class* (not
702 necessarly our "toplevel" container).
704 2001-09-14 Ravi Pratap <ravi@ximian.com>
706 * enum.cs (Enum::Define): Modify to call the Lookup method on the
707 parent instead of a direct call to GetType.
709 2001-09-14 Ravi Pratap <ravi@ximian.com>
711 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
712 Modifiers.TypeAttr. This should just be a call to that method.
714 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
715 object so that we can determine if we are top-level or not.
717 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
720 * enum.cs (Enum::Define): Ditto.
722 * modifiers.cs (FieldAttr): Re-write.
724 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
725 (TypeContainer::HaveStaticConstructor): New property to provide access
726 to precisely that info.
728 * modifiers.cs (MethodAttr): Re-write.
729 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
731 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
732 of top-level types as claimed.
734 2001-09-13 Miguel de Icaza <miguel@ximian.com>
736 * expression.cs (MemberLookup): Fruitless attempt to lookup
737 constructors. Maybe I need to emit default constructors? That
738 might be it (currently .NET emits this for me automatically).
739 (Invocation::OverloadResolve): Cope with Arguments == null.
740 (Invocation::EmitArguments): new function, shared by the new
742 (Invocation::Emit): Handle static and instance methods. Emit
743 proper call instruction for virtual or non-virtual invocations.
744 (New::Emit): Implement.
745 (New::Resolve): Implement.
746 (MemberAccess:Resolve): Implement.
747 (MethodGroupExpr::InstanceExpression): used conforming to the spec
749 (FieldExpr::Resolve): Set type.
751 * support.cs: Handle empty arguments.
753 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
754 SimpleLookup): Auxiliary routines to help parse a qualifier
757 Update qualifier_identifier rule.
759 * codegen.cs: Removed debugging messages.
761 * class.cs: Make this a global thing, this acts just as a "key" to
762 objects that we might have around.
764 (Populate): Only initialize method_builders_to_methods once.
766 * expression.cs (PropertyExpr): Initialize type from the
769 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
770 Resolve pattern. Attempt to implicitly convert value to boolean.
773 * expression.cs: Set the type for the int32/int32 argument case.
774 (Binary::ResolveOperator): Set the return type to boolean for
775 comparission operators
777 * typemanager.cs: Remove debugging print code.
779 (Invocation::Resolve): resolve type.
781 * class.cs: Allocate a MemberInfo of the correct size, as the code
782 elsewhere depends on the test to reflect the correct contents.
784 (Method::) Keep track of parameters, due to System.Reflection holes
786 (TypeContainer::Populate): Keep track of MethodBuilders to Method
789 (TypeContainer::FindMembers): Use ArrayList and then copy an array
790 of the exact size and return that.
792 (Class::LookupMethodByBuilder): New function that maps
793 MethodBuilders to its methods. Required to locate the information
794 on methods because System.Reflection bit us again.
796 * support.cs: New file, contains an interface ParameterData and
797 two implementations: ReflectionParameters and InternalParameters
798 used to access Parameter information. We will need to grow this
801 * expression.cs (Invocation::GetParameterData): implement a cache
802 and a wrapper around the ParameterData creation for methods.
803 (Invocation::OverloadResolve): Use new code.
805 2001-09-13 Ravi Pratap <ravi@ximian.com>
807 * class.cs (TypeContainer::EmitField): Remove and move into
808 (Field::Define): here and modify accordingly.
809 (Field.FieldBuilder): New member.
810 (TypeContainer::Populate): Update accordingly.
811 (TypeContainer::FindMembers): Implement.
813 2001-09-13 Miguel de Icaza <miguel@ximian.com>
815 * statement.cs: (VariableInfo::VariableType): New field to be
816 initialized with the full type once it is resolved.
818 2001-09-12 Miguel de Icaza <miguel@ximian.com>
820 * parameter.cs (GetParameterInfo): Use a type cache to compute
821 things only once, and to reuse this information
823 * expression.cs (LocalVariableReference::Emit): Implement.
824 (OpcodeCast::Emit): fix.
826 (ParameterReference::Resolve): Implement.
827 (ParameterReference::Emit): Implement.
829 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
830 that are expressions need to stay as Expressions.
832 * typemanager.cs (CSharpName): Returns the C# name of a type if
835 * expression.cs (Expression::ConvertImplicit): New function that
836 implements implicit type conversions.
838 (Expression::ImplicitReferenceConversion): Implements implicit
839 reference conversions.
841 (EmptyCast): New type for transparent casts.
843 (OpcodeCast): New type for casts of types that are performed with
844 a sequence of bytecodes.
846 (BoxedCast): New type used for casting value types into reference
847 types. Emits a box opcode.
849 (Binary::DoNumericPromotions): Implements numeric promotions of
850 and computation of the Binary::Type.
852 (Binary::EmitBranchable): Optimization.
854 (Binary::Emit): Implement code emission for expressions.
856 * typemanager.cs (TypeManager): Added two new core types: sbyte
859 2001-09-12 Ravi Pratap <ravi@ximian.com>
861 * class.cs (TypeContainer::FindMembers): Method which does exactly
862 what Type.FindMembers does, only we don't have to use reflection. No
865 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
866 typecontainer objects as we need to get at them.
867 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
869 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
870 typecontainer object.
872 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
873 of just a Report object.
875 2001-09-11 Ravi Pratap <ravi@ximian.com>
877 * class.cs (Event::Define): Go back to using the prefixes "add_" and
879 (TypeContainer::Populate): Now define the delegates of the type too.
880 (TypeContainer.Delegates): Property to access the list of delegates defined
883 * delegates.cs (Delegate::Define): Implement partially.
885 * modifiers.cs (TypeAttr): Handle more flags.
887 2001-09-11 Ravi Pratap <ravi@ximian.com>
889 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
891 (Operator::Define): Re-write logic to get types by using the LookupType method
892 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
893 (Indexer::Define): Ditto.
894 (Event::Define): Ditto.
895 (Property::Define): Ditto.
897 2001-09-10 Ravi Pratap <ravi@ximian.com>
899 * class.cs (TypeContainer::Populate): Now define operators too.
900 (TypeContainer.Operators): New property to access the list of operators
902 (Operator.OperatorMethodBuilder): New member to hold the method builder
903 for the operator we are defining.
904 (Operator::Define): Implement.
906 2001-09-10 Ravi Pratap <ravi@ximian.com>
908 * class.cs (Event::Define): Make the prefixes of the accessor methods
911 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
912 of the location being passed in too. Ideally, this should go later since all
913 error reporting should be done through the Report object.
915 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
916 (Populate): Iterate thru the indexers we have and define them too.
917 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
918 for the get and set accessors.
919 (Indexer::Define): Implement.
921 2001-09-09 Miguel de Icaza <miguel@ximian.com>
923 * expression.cs (Binary::Resolve): Beginning of it. I scratched
924 my previous implementation, did not work.
926 * typemanager.cs: Add a couple of missing types (the longs).
928 * literal.cs: Use TypeManager.bool_type instead of getting it.
930 * expression.cs (EventExpr): New kind of expressions.
931 (Expressio::ExprClassFromMemberInfo): finish
933 2001-09-08 Miguel de Icaza <miguel@ximian.com>
935 * assign.cs: Emit stores to static fields differently.
937 2001-09-08 Ravi Pratap <ravi@ximian.com>
939 * Merge in changes and adjust code to tackle conflicts. Backed out my
940 code in Assign::Resolve ;-)
942 2001-09-08 Ravi Pratap <ravi@ximian.com>
944 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
945 instead Report.Error and also pass in the location.
946 (CSharpParser::Lexer): New readonly property to return the reference
947 to the Tokenizer object.
948 (declare_local_variables): Use Report.Error with location instead of plain
952 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
953 (Operator.CheckBinaryOperator): Ditto.
955 * cs-parser.jay (operator_declarator): Update accordingly.
957 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
958 (CheckBinaryOperator): Same here.
960 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
961 on the name without any prefixes of namespace names etc. This is because we
962 already might have something already fully qualified like
963 'System.Console.WriteLine'
965 * assign.cs (Resolve): Begin implementation. Stuck ;-)
967 2001-09-07 Ravi Pratap <ravi@ximian.com>
969 * cs-tokenizer.cs (location): Return a string which also contains
972 * expression.cs (ElementAccess): New class for expressions of the
973 type 'element access.'
974 (BaseAccess): New class for expressions of the type 'base access.'
975 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
978 * cs-parser.jay (element_access): Implement action.
979 (base_access): Implement actions.
980 (checked_expression, unchecked_expression): Implement.
982 * cs-parser.jay (local_variable_type): Correct and implement.
983 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
985 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
987 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
988 name and the specifiers.
990 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
992 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
993 making them all public ;-)
995 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
998 2001-09-07 Miguel de Icaza <miguel@ximian.com>
1000 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
1002 (FieldExpr, PropertyExprs): New resolved expressions.
1003 (SimpleName::MemberStaticCheck): Perform static checks for access
1004 to non-static fields on static methods. Maybe this should be
1005 generalized for MemberAccesses.
1006 (SimpleName::ResolveSimpleName): More work on simple name
1009 * cs-parser.jay (primary_expression/qualified_identifier): track
1010 the parameter index.
1012 * codegen.cs (CodeGen::Save): Catch save exception, report error.
1013 (EmitContext::EmitBoolExpression): Chain to expression generation
1014 instead of temporary hack.
1015 (::EmitStatementExpression): Put generic expression code generation.
1017 * assign.cs (Assign::Emit): Implement variable assignments to
1018 local variables, parameters and fields.
1020 2001-09-06 Miguel de Icaza <miguel@ximian.com>
1022 * statement.cs (Block::GetVariableInfo): New method, returns the
1023 VariableInfo for a variable name in a block.
1024 (Block::GetVariableType): Implement in terms of GetVariableInfo
1026 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
1027 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
1029 2001-09-06 Ravi Pratap <ravi@ximian.com>
1031 * cs-parser.jay (operator_declaration): Continue on my quest : update
1032 to take attributes argument.
1033 (event_declaration): Ditto.
1034 (enum_declaration): Ditto.
1035 (indexer_declaration): Ditto.
1037 * class.cs (Operator::Operator): Update constructor accordingly.
1038 (Event::Event): Ditto.
1040 * delegate.cs (Delegate::Delegate): Same here.
1042 * enum.cs (Enum::Enum): Same here.
1044 2001-09-05 Ravi Pratap <ravi@ximian.com>
1046 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
1048 * ../tests/cs0658.cs : New file to demonstrate error 0658.
1050 * attribute.cs (Attributes): New class to encapsulate all attributes which were
1051 being passed around as an arraylist.
1052 (Attributes::AddAttribute): Method to add attribute sections.
1054 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
1055 (struct_declaration): Update accordingly.
1056 (constant_declaration): Update.
1057 (field_declaration): Update.
1058 (method_header): Update.
1059 (fixed_parameter): Update.
1060 (parameter_array): Ditto.
1061 (property_declaration): Ditto.
1062 (destructor_declaration): Ditto.
1064 * class.cs (Struct::Struct): Update constructors accordingly.
1065 (Class::Class): Ditto.
1066 (Field::Field): Ditto.
1067 (Method::Method): Ditto.
1068 (Property::Property): Ditto.
1069 (TypeContainer::OptAttribute): update property's return type.
1071 * interface.cs (Interface.opt_attributes): New member.
1072 (Interface::Interface): Update to take the extra Attributes argument.
1074 * parameter.cs (Parameter::Parameter): Ditto.
1076 * constant.cs (Constant::Constant): Ditto.
1078 * interface.cs (InterfaceMemberBase): New OptAttributes field.
1079 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
1080 the attributes as a parameter.
1081 (InterfaceProperty): Update constructor call.
1082 (InterfaceEvent): Ditto.
1083 (InterfaceMethod): Ditto.
1084 (InterfaceIndexer): Ditto.
1086 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
1087 pass the attributes too.
1088 (interface_event_declaration): Ditto.
1089 (interface_property_declaration): Ditto.
1090 (interface_method_declaration): Ditto.
1091 (interface_declaration): Ditto.
1093 2001-09-05 Miguel de Icaza <miguel@ximian.com>
1095 * class.cs (Method::Define): Track the "static Main" definition to
1096 create an entry point.
1098 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
1099 EntryPoint if we find it.
1101 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
1102 (EmitContext::ig): Make this variable public.
1104 * driver.cs: Make the default output file be the first file name
1105 with the .exe extension.
1107 Detect empty compilations
1109 Handle various kinds of output targets. Handle --target and
1110 rename -t to --dumper.
1112 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
1113 methods inherited from Expression return now an Expression. This
1114 will is used during the tree rewriting as we resolve them during
1117 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
1118 the spec. Missing entirely is the information about
1119 accessability of elements of it.
1121 (Expression::ExprClassFromMemberInfo): New constructor for
1122 Expressions that creates a fully initialized Expression based on
1123 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
1126 (Invocation::Resolve): Begin implementing resolution of invocations.
1128 * literal.cs (StringLiteral): Implement Emit.
1130 2001-09-05 Ravi Pratap <ravi@ximian.com>
1132 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
1135 2001-09-04 Ravi Pratap <ravi@ximian.com>
1137 * cs-parser.jay (attribute_arguments): Implement actions.
1138 (attribute): Fix bug in production. Implement action.
1139 (attribute_list): Implement.
1140 (attribute_target): Implement.
1141 (attribute_target_specifier, opt_target_specifier): Implement
1142 (CheckAttributeTarget): New method to check if the attribute target
1144 (attribute_section): Implement.
1145 (opt_attributes): Implement.
1147 * attribute.cs : New file to handle attributes.
1148 (Attribute): Class to hold attribute info.
1150 * cs-parser.jay (opt_attribute_target_specifier): Remove production
1151 (attribute_section): Modify production to use 2 different rules to
1152 achieve the same thing. 1 s/r conflict down !
1153 Clean out commented, useless, non-reducing dimension_separator rules.
1155 * class.cs (TypeContainer.attributes): New member to hold list
1156 of attributes for a type.
1157 (Struct::Struct): Modify to take one more argument, the attribute list.
1158 (Class::Class): Ditto.
1159 (Field::Field): Ditto.
1160 (Method::Method): Ditto.
1161 (Property::Property): Ditto.
1163 * cs-parser.jay (struct_declaration): Update constructor call to
1164 pass in the attributes too.
1165 (class_declaration): Ditto.
1166 (constant_declaration): Ditto.
1167 (field_declaration): Ditto.
1168 (method_header): Ditto.
1169 (fixed_parameter): Ditto.
1170 (parameter_array): Ditto.
1171 (property_declaration): Ditto.
1173 * constant.cs (Constant::Constant): Update constructor similarly.
1174 Use System.Collections.
1176 * parameter.cs (Parameter::Parameter): Update as above.
1178 2001-09-02 Ravi Pratap <ravi@ximian.com>
1180 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
1181 (TypeContainer.delegates): New member to hold list of delegates.
1183 * cs-parser.jay (delegate_declaration): Implement the action correctly
1184 this time as I seem to be on crack ;-)
1186 2001-09-02 Miguel de Icaza <miguel@ximian.com>
1188 * rootcontext.cs (RootContext::IsNamespace): new function, used to
1189 tell whether an identifier represents a namespace.
1191 * expression.cs (NamespaceExpr): A namespace expression, used only
1192 temporarly during expression resolution.
1193 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
1194 utility functions to resolve names on expressions.
1196 2001-09-01 Miguel de Icaza <miguel@ximian.com>
1198 * codegen.cs: Add hook for StatementExpressions.
1200 * class.cs: Fix inverted test for static flag in methods.
1202 2001-09-02 Ravi Pratap <ravi@ximian.com>
1204 * class.cs (Operator::CheckUnaryOperator): Correct error number used
1205 to make it coincide with MS' number.
1206 (Operator::CheckBinaryOperator): Ditto.
1208 * ../errors/errors.txt : Remove error numbers added earlier.
1210 * ../errors/cs1019.cs : Test case for error # 1019
1212 * ../errros/cs1020.cs : Test case for error # 1020
1214 * cs-parser.jay : Clean out commented cruft.
1215 (dimension_separators, dimension_separator): Comment out. Ostensibly not
1216 used anywhere - non-reducing rule.
1217 (namespace_declarations): Non-reducing rule - comment out.
1219 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
1220 with TypeContainer::AddEnum.
1222 * delegate.cs : New file for delegate handling classes.
1223 (Delegate): Class for declaring delegates.
1225 * makefile : Update.
1227 * cs-parser.jay (delegate_declaration): Implement.
1229 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
1231 * class.cs (Event::Define): Implement.
1232 (Event.EventBuilder): New member.
1234 * class.cs (TypeContainer::Populate): Update to define all enums and events
1236 (Events): New property for the events arraylist we hold. Shouldn't we move to using
1237 readonly fields for all these cases ?
1239 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1241 * class.cs (Property): Revamp to use the convention of making fields readonly.
1242 Accordingly modify code elsewhere.
1244 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
1245 the Define method of the Property class.
1247 * class.cs : Clean up applied patch and update references to variables etc. Fix
1249 (TypeContainer::Populate): Update to define all the properties we have. Also
1250 define all enumerations.
1252 * enum.cs (Define): Implement.
1254 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1256 * cs-parser.jay (overloadable_operator): The semantic value is an
1257 enum of the Operator class.
1258 (operator_declarator): Implement actions.
1259 (operator_declaration): Implement.
1261 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
1262 validity of definitions.
1263 (Operator::CheckBinaryOperator): Static method to check for binary operators
1264 (TypeContainer::AddOperator): New method to add an operator to a type.
1266 * cs-parser.jay (indexer_declaration): Added line to actually call the
1267 AddIndexer method so it gets added ;-)
1269 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
1270 already taken care of by the MS compiler ?
1272 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1274 * class.cs (Operator): New class for operator declarations.
1275 (Operator::OpType): Enum for the various operators.
1277 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1279 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
1280 ostensibly handle this in semantic analysis.
1282 * cs-parser.jay (general_catch_clause): Comment out
1283 (specific_catch_clauses, specific_catch_clause): Ditto.
1284 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
1285 (catch_args, opt_catch_args): New productions.
1286 (catch_clause): Rewrite to use the new productions above
1287 (catch_clauses): Modify accordingly.
1288 (opt_catch_clauses): New production to use in try_statement
1289 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
1290 and re-write the code in the actions to extract the specific and
1291 general catch clauses by being a little smart ;-)
1293 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
1294 Hooray, try and catch statements parse fine !
1296 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1298 * statement.cs (Block::GetVariableType): Fix logic to extract the type
1299 string from the hashtable of variables.
1301 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
1302 I end up making that mistake ;-)
1303 (catch_clauses): Fixed gross error which made Key and Value of the
1304 DictionaryEntry the same : $1 !!
1306 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1308 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
1310 * cs-parser.jay (event_declaration): Correct to remove the semicolon
1311 when the add and remove accessors are specified.
1313 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1315 * cs-parser.jay (IndexerDeclaration): New helper class to hold
1316 information about indexer_declarator.
1317 (indexer_declarator): Implement actions.
1318 (parsing_indexer): New local boolean used to keep track of whether
1319 we are parsing indexers or properties. This is necessary because
1320 implicit_parameters come into picture even for the get accessor in the
1322 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
1324 * class.cs (Indexer): New class for indexer declarations.
1325 (TypeContainer::AddIndexer): New method to add an indexer to a type.
1326 (TypeContainer::indexers): New member to hold list of indexers for the
1329 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
1331 * cs-parser.jay (add_accessor_declaration): Implement action.
1332 (remove_accessor_declaration): Implement action.
1333 (event_accessors_declaration): Implement
1334 (variable_declarators): swap statements for first rule - trivial.
1336 * class.cs (Event): New class to hold information about event
1338 (TypeContainer::AddEvent): New method to add an event to a type
1339 (TypeContainer::events): New member to hold list of events.
1341 * cs-parser.jay (event_declaration): Implement actions.
1343 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
1345 * cs-parser.jay (dim_separators): Implement. Make it a string
1346 concatenating all the commas together, just as they appear.
1347 (opt_dim_separators): Modify accordingly
1348 (rank_specifiers): Update accordingly. Basically do the same
1349 thing - instead, collect the brackets here.
1350 (opt_rank_sepcifiers): Modify accordingly.
1351 (array_type): Modify to actually return the complete type string
1352 instead of ignoring the rank_specifiers.
1353 (expression_list): Implement to collect the expressions
1354 (variable_initializer): Implement. We make it a list of expressions
1355 essentially so that we can handle the array_initializer case neatly too.
1356 (variable_initializer_list): Implement.
1357 (array_initializer): Make it a list of variable_initializers
1358 (opt_array_initializer): Modify accordingly.
1360 * expression.cs (New::NType): Add enumeration to help us
1361 keep track of whether we have an object/delegate creation
1362 or an array creation.
1363 (New:NewType, New::Rank, New::Indices, New::Initializers): New
1364 members to hold data about array creation.
1365 (New:New): Modify to update NewType
1366 (New:New): New Overloaded contructor for the array creation
1369 * cs-parser.jay (array_creation_expression): Implement to call
1370 the overloaded New constructor.
1372 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
1374 * class.cs (TypeContainer::Constructors): Return member
1375 constructors instead of returning null.
1377 2001-08-26 Miguel de Icaza <miguel@ximian.com>
1379 * typemanager.cs (InitCoreTypes): Initialize the various core
1380 types after we have populated the type manager with the user
1381 defined types (this distinction will be important later while
1382 compiling corlib.dll)
1384 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
1385 on Expression Classification. Now all expressions have a method
1386 `Resolve' and a method `Emit'.
1388 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
1389 generation from working. Also add some temporary debugging
1392 2001-08-24 Miguel de Icaza <miguel@ximian.com>
1394 * codegen.cs: Lots of code generation pieces. This is only the
1395 beginning, will continue tomorrow with more touches of polish. We
1396 handle the fundamentals of if, while, do, for, return. Others are
1397 trickier and I need to start working on invocations soon.
1399 * gen-treedump.cs: Bug fix, use s.Increment here instead of
1402 * codegen.cs (EmitContext): New struct, used during code
1403 emission to keep a context. Most of the code generation will be
1406 * cs-parser.jay: Add embedded blocks to the list of statements of
1407 this block. So code generation proceeds in a top down fashion.
1409 2001-08-23 Miguel de Icaza <miguel@ximian.com>
1411 * statement.cs: Add support for multiple child blocks.
1413 2001-08-22 Miguel de Icaza <miguel@ximian.com>
1415 * codegen.cs (EmitCode): New function, will emit the code for a
1416 Block of code given a TypeContainer and its ILGenerator.
1418 * statement.cs (Block): Standard public readonly optimization.
1419 (Block::Block constructors): Link children.
1420 (Block::Child): Child Linker.
1421 (Block::EmitVariables): Emits IL variable declarations.
1423 * class.cs: Drop support for MethodGroups here, delay until
1425 (Method::): Applied the same simplification that I did before, and
1426 move from Properties to public readonly fields.
1427 (Method::ParameterTypes): Returns the parameter types for the
1428 function, and implements a cache that will be useful later when I
1429 do error checking and the semantic analysis on the methods is
1431 (Constructor::GetCallingConvention): Renamed from CallingConvetion
1432 and made a method, optional argument tells whether this is a class
1433 or a structure to apply the `has-this' bit.
1434 (Method::GetCallingConvention): Implement, returns the calling
1436 (Method::Define): Defines the type, a second pass is performed
1437 later to populate the methods.
1439 (Constructor::ParameterTypes): implement a cache similar to the
1440 one on Method::ParameterTypes, useful later when we do semantic
1443 (TypeContainer::EmitMethod): New method. Emits methods.
1445 * expression.cs: Removed MethodGroup class from here.
1447 * parameter.cs (Parameters::GetCallingConvention): new method.
1449 2001-08-21 Miguel de Icaza <miguel@ximian.com>
1451 * class.cs (TypeContainer::Populate): Drop RootContext from the
1454 (Constructor::CallingConvention): Returns the calling convention.
1455 (Constructor::ParameterTypes): Returns the constructor parameter
1458 (TypeContainer::AddConstructor): Keep track of default constructor
1459 and the default static constructor.
1461 (Constructor::) Another class that starts using `public readonly'
1462 instead of properties.
1464 (Constructor::IsDefault): Whether this is a default constructor.
1466 (Field::) use readonly public fields instead of properties also.
1468 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
1469 track of static constructors; If none is used, turn on
1470 BeforeFieldInit in the TypeAttributes.
1472 * cs-parser.jay (opt_argument_list): now the return can be null
1473 for the cases where there are no arguments.
1475 (constructor_declarator): If there is no implicit `base' or
1476 `this', then invoke the default parent constructor.
1478 * modifiers.cs (MethodAttr): New static function maps a set of
1479 modifiers flags into a MethodAttributes enum
1480 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
1481 MethodAttr, TypeAttr to represent the various mappings where the
1483 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
1485 2001-08-19 Miguel de Icaza <miguel@ximian.com>
1487 * parameter.cs (GetParameterInfo): Fix bug where there would be no
1490 * interface.cs (PopulateIndexer): Implemented the code generator
1491 for interface indexers.
1493 2001-08-17 Miguel de Icaza <miguel@ximian.com>
1495 * interface.cs (InterfaceMemberBase): Now we track the new status
1498 (PopulateProperty): Implement property population. Woohoo! Got
1499 Methods and Properties going today.
1501 Removed all the properties for interfaces, and replaced them with
1502 `public readonly' fields.
1504 2001-08-16 Miguel de Icaza <miguel@ximian.com>
1506 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
1507 initialize their hashtables/arraylists only when they are needed
1508 instead of doing this always.
1510 * parameter.cs: Handle refs and out parameters.
1512 * cs-parser.jay: Use an ArrayList to construct the arguments
1513 instead of the ParameterCollection, and then cast that to a
1516 * parameter.cs: Drop the use of ParameterCollection and use
1517 instead arrays of Parameters.
1519 (GetParameterInfo): Use the Type, not the Name when resolving
1522 2001-08-13 Miguel de Icaza <miguel@ximian.com>
1524 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
1525 and instead use public readonly fields.
1527 * class.cs: Put back walking code for type containers.
1529 2001-08-11 Miguel de Icaza <miguel@ximian.com>
1531 * class.cs (MakeConstant): Code to define constants.
1533 * rootcontext.cs (LookupType): New function. Used to locate types
1536 2001-08-08 Miguel de Icaza <miguel@ximian.com>
1538 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
1539 this System.Reflection code is. Kudos to Microsoft
1541 * typemanager.cs: Implement a type cache and avoid loading all
1542 types at boot time. Wrap in LookupType the internals. This made
1543 the compiler so much faster. Wow. I rule!
1545 * driver.cs: Make sure we always load mscorlib first (for
1546 debugging purposes, nothing really important).
1548 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
1549 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
1551 * rootcontext.cs: Lookup types on their namespace; Lookup types
1552 on namespaces that have been imported using the `using' keyword.
1554 * class.cs (TypeContainer::TypeAttr): Virtualize.
1555 (Class::TypeAttr): Return attributes suitable for this bad boy.
1556 (Struct::TypeAttr): ditto.
1557 Handle nested classes.
1558 (TypeContainer::) Remove all the type visiting code, it is now
1559 replaced with the rootcontext.cs code
1561 * rootcontext.cs (GetClassBases): Added support for structs.
1563 2001-08-06 Miguel de Icaza <miguel@ximian.com>
1565 * interface.cs, statement.cs, class.cs, parameter.cs,
1566 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
1567 Drop use of TypeRefs, and use strings instead.
1569 2001-08-04 Miguel de Icaza <miguel@ximian.com>
1573 * class.cs (Struct::Struct): set the SEALED flags after
1574 checking the modifiers.
1575 (TypeContainer::TypeAttr): new property, returns the
1576 TypeAttributes for a class.
1578 * cs-parser.jay (type_list): Oops, list production was creating a
1579 new list of base types.
1581 * rootcontext.cs (StdLib): New property.
1582 (GetInterfaceTypeByName): returns an interface by type name, and
1583 encapsulates error handling here.
1584 (GetInterfaces): simplified.
1585 (ResolveTree): Encapsulated all the tree resolution here.
1586 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
1589 * driver.cs: Add support for --nostdlib, to avoid loading the
1591 (Main): Do not put tree resolution here.
1593 * rootcontext.cs: Beginning of the class resolution.
1595 2001-08-03 Miguel de Icaza <miguel@ximian.com>
1597 * rootcontext.cs: Provide better error reporting.
1599 * cs-parser.jay (interface_base): set our $$ to be interfaces.
1601 * rootcontext.cs (CreateInterface): Handle the case where there
1602 are no parent interfaces.
1604 (CloseTypes): Routine to flush types at the end.
1605 (CreateInterface): Track types.
1606 (GetInterfaces): Returns an array of Types from the list of
1609 * typemanager.c (AddUserType): Mechanism to track user types (puts
1610 the type on the global type hash, and allows us to close it at the
1613 2001-08-02 Miguel de Icaza <miguel@ximian.com>
1615 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
1616 RecordInterface instead.
1618 * cs-parser.jay: Updated to reflect changes above.
1620 * decl.cs (Definition): Keep track of the TypeBuilder type that
1621 represents this type here. Not sure we will use it in the long
1622 run, but wont hurt for now.
1624 * driver.cs: Smaller changes to accomodate the new code.
1626 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
1629 * rootcontext.cs (CreateInterface): New method, used to create
1630 the System.TypeBuilder type for interfaces.
1631 (ResolveInterfaces): new entry point to resolve the interface
1633 (CodeGen): Property, used to keep track of the code generator.
1635 2001-07-26 Miguel de Icaza <miguel@ximian.com>
1637 * cs-parser.jay: Add a second production for delegate_declaration
1640 (enum_body): Put an opt_comma here instead of putting it on
1641 enum_body or enum_member_declarations so we can handle trailing
1642 commas on enumeration members. Gets rid of a shift/reduce.
1644 (type_list): Need a COMMA in the middle.
1646 (indexer_declaration): Tell tokenizer to recognize get/set
1648 * Remove old targets.
1650 * Re-add the parser target.
1652 2001-07-13 Simon Cozens <simon@simon-cozens.org>
1654 * cs-parser.jay: Add precendence rules for a number of operators
1655 ot reduce the number of shift/reduce conflicts in the grammar.
1657 2001-07-17 Miguel de Icaza <miguel@ximian.com>
1659 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
1662 Get rid of old crufty code.
1664 * rootcontext.cs: Use this to keep track of the parsed
1665 representation and the defined types available to the program.
1667 * gen-treedump.cs: adjust for new convention.
1669 * type.cs: Split out the type manager, and the assembly builder
1672 * typemanager.cs: the type manager will live here now.
1674 * cil-codegen.cs: And the code generator here.
1676 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
1678 * makefile: Fixed up for easy making.
1680 2001-07-13 Simon Cozens <simon@simon-cozens.org>
1682 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
1685 (unary_expression): Expand pre_increment_expression and
1686 post_decrement_expression to reduce a shift/reduce.
1688 2001-07-11 Simon Cozens
1690 * cs-tokenizer.cs: Hex numbers should begin with a 0.
1692 Improve allow_keyword_as_indent name.
1694 2001-06-19 Miguel de Icaza <miguel@ximian.com>
1696 * Adjustments for Beta2.
1698 2001-06-13 Miguel de Icaza <miguel@ximian.com>
1700 * decl.cs: Added `Define' abstract method.
1701 (InTransit): new property, used to catch recursive definitions.
1703 * interface.cs: Implement `Define'.
1705 * modifiers.cs: Map Modifiers.constants to
1706 System.Reflection.TypeAttribute flags.
1708 * class.cs: Keep track of types and user-defined types.
1709 (BuilderInit): New method for creating an assembly
1710 (ResolveType): New function to launch the resolution process, only
1711 used by interfaces for now.
1713 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
1714 that are inserted into the name space.
1716 2001-06-08 Miguel de Icaza <miguel@ximian.com>
1718 * ARGH. I have screwed up my tree so many times due to the use of
1719 rsync rather than using CVS. Going to fix this at once.
1721 * driver.cs: Objetify driver. Load assemblies, use assemblies to
1724 2001-06-07 Miguel de Icaza <miguel@ximian.com>
1726 * Experiment successful: Use System.Type rather that our own
1729 2001-05-25 Miguel de Icaza <miguel@ximian.com>
1731 * cs-parser.jay: Removed nsAliases from here.
1733 Use new namespaces, handle `using XXX;'
1735 * namespace.cs: Reimplemented namespace handling, use a recursive
1736 definition of the class. Now we can keep track of using clauses
1737 and catch invalid using clauses.
1739 2001-05-24 Miguel de Icaza <miguel@ximian.com>
1741 * gen-treedump.cs: Adapted for all the renaming.
1743 * expression.cs (Expression): this class now has a Type property
1744 which returns an expression Type.
1746 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
1747 `Type', as this has a different meaning now in the base
1749 2001-05-22 Miguel de Icaza <miguel@ximian.com>
1751 * interface.cs, class.cs: Removed from all the sources the
1752 references to signature computation, as we can not do method
1753 signature computation during the parsing time, as we are not
1754 trying to solve at that point distinguishing:
1758 void a (NS.Blah x) {}
1761 Which depending on the context might be valid or not, as we do not
1762 know if Blah is the same thing as NS.Blah at that point.
1764 * Redid everything so the code uses TypeRefs now instead of
1765 Types. TypeRefs are just temporary type placeholders, that need
1766 to be resolved. They initially have a pointer to a string and the
1767 current scope in which they are used. This is used later by the
1768 compiler to resolve the reference to an actual Type.
1770 * DeclSpace is no longer a CIR.Type, and neither are
1771 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
1772 are all DeclSpaces, but no Types.
1774 * type.cs (TypeRefManager): This implements the TypeRef manager,
1775 which keeps track of all the types that need to be resolved after
1776 the parsing has finished.
1778 2001-05-13 Miguel de Icaza <miguel@ximian.com>
1780 * ARGH. We are going to have to store `foreach' as a class rather
1781 than resolving it, as we need to verify error 1579 after name
1782 resolution. *OR* we could keep a flag that says `This request to
1783 IEnumerator comes from a foreach statement' which we can then use
1784 to generate the error.
1786 2001-05-10 Miguel de Icaza <miguel@ximian.com>
1788 * class.cs (TypeContainer.AddMethod): we now add methods to the
1789 MethodGroup instead of the method hashtable.
1791 * expression.cs: Add MethodGroup abstraction, which gets us one
1792 step closer to the specification in the way we handle method
1795 * cs-parser.jay (primary_expression): qualified_identifier now
1796 tried to match up an identifier to a local variable reference or
1797 to a parameter reference.
1799 current_local_parameters is now a parser global variable that
1800 points to the current parameters for the block, used during name
1803 (property_declaration): Now creates an implicit `value' argument to
1806 2001-05-09 Miguel de Icaza <miguel@ximian.com>
1808 * parameter.cs: Do not use `param' arguments as part of the
1809 signature, per the spec.
1811 2001-05-08 Miguel de Icaza <miguel@ximian.com>
1813 * decl.cs: Base class for classes, structs and interfaces. This
1814 is the "Declaration Space"
1816 * cs-parser.jay: Use CheckDef for checking declaration errors
1817 instead of having one on each function.
1819 * class.cs: Factor out some code for handling error handling in
1820 accordance to the "Declarations" section in the "Basic Concepts"
1821 chapter in the ECMA C# spec.
1823 * interface.cs: Make all interface member classes derive from
1824 InterfaceMemberBase.
1826 2001-05-07 Miguel de Icaza <miguel@ximian.com>
1828 * Many things: all interfaces are parsed and generated in
1829 gen-treedump. Support for member variables, constructors,
1830 destructors, properties, constants is there.
1832 Beginning of the IL backend, but very little done, just there for
1835 2001-04-29 Miguel de Icaza <miguel@ximian.com>
1837 * cs-parser.jay: Fix labeled statement.
1839 * cs-tokenizer.cs (escape): Escape " and ' always.
1840 ref_line, ref_name: keep track of the line/filename as instructed
1841 by #line by the compiler.
1844 2001-04-27 Miguel de Icaza <miguel@ximian.com>
1846 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
1847 to match the values in System.CodeDOM.
1849 Divid renamed to Divide.
1851 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
1853 (Statements.set): remove.
1855 * System.CodeDOM/CodeCatchClause.cs: always have a valid
1858 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
1859 falseStatements always have valid values.
1861 * cs-parser.jay: Use System.CodeDOM now.