1 2001-09-27 Ravi Pratap <ravi@ximian.com>
3 * expression.cs (Invocation::BetterConversion): Fix to cope
4 with q being null, since this was introducing a bug.
6 * expression.cs (ConvertImplicit): Do built-in conversions first.
8 2001-09-27 Ravi Pratap <ravi@ximian.com>
10 * expression.cs (UserImplicitCast::Resolve): Fix bug.
12 2001-09-27 Ravi Pratap <ravi@ximian.com>
14 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
15 I had introduced long ago (what's new ?).
17 * expression.cs (UserImplicitCast::CanConvert): Static method to do
18 the work of all the checking.
19 (ConvertImplicit): Call CanConvert and only then create object if necessary.
20 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
22 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
23 that is the right way.
25 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
26 overloading resolution. Use everywhere instead of cutting and pasting code.
28 (Binary::ResolveOperator): Use MakeUnionSet.
30 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
31 we have to convert to bool types. Not complete yet.
33 2001-09-27 Miguel de Icaza <miguel@ximian.com>
35 * typemanager.cs (TypeManager::CSharpName): support ushort.
37 * expression.cs (Expression::TryImplicitIntConversion): Attempts
38 to provide an expression that performsn an implicit constant int
39 conversion (section 6.1.6).
40 (Expression::ConvertImplicitRequired): Reworked to include
41 implicit constant expression conversions.
43 (Expression::ConvertNumericExplicit): Finished.
45 (Invocation::Emit): If InstanceExpression is null, then it means
46 that we perform a call on this.
48 2001-09-26 Miguel de Icaza <miguel@ximian.com>
50 * expression.cs (Unary::Emit): Remove some dead code.
51 (Probe): Implement Resolve and Emit for `is'.
52 (Expression::ConvertImplicitRequired): Attempt to do constant
53 expression conversions here. Maybe should be moved to
54 ConvertImplicit, but I am not sure.
55 (Expression::ImplicitLongConstantConversionPossible,
56 Expression::ImplicitIntConstantConversionPossible): New functions
57 that tell whether is it possible to apply an implicit constant
58 expression conversion.
60 (ConvertNumericExplicit): Started work on explicit numeric
63 * cs-parser.jay: Update operator constants.
65 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
66 (Parameters::GetSignature): Hook up VerifyArgs here.
67 (Parameters::VerifyArgs): Verifies that no two arguments have the
70 * class.cs (Operator): Update the operator names to reflect the
71 ones that the spec expects (as we are just stringizing the
74 * expression.cs (Unary::ResolveOperator): Fix bug: Use
75 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
76 previous usage did only work for our methods.
77 (Expression::ConvertImplicit): Handle decimal implicit numeric
79 (Expression::InternalTypeConstructor): Used to invoke constructors
80 on internal types for default promotions.
82 (Unary::Emit): Implement special handling for the pre/post
83 increment/decrement for overloaded operators, as they need to have
84 the same semantics as the other operators.
86 (Binary::ResolveOperator): ditto.
87 (Invocation::ConversionExists): ditto.
88 (UserImplicitCast::Resolve): ditto.
90 2001-09-26 Ravi Pratap <ravi@ximian.com>
92 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
93 operator, return after emitting body. Regression tests pass again !
95 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
96 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
97 (Invocation::OverloadResolve): Ditto.
98 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
100 * everywhere : update calls to the above methods accordingly.
102 2001-09-26 Miguel de Icaza <miguel@ximian.com>
104 * assign.cs (Assign): Make it inherit from ExpressionStatement.
106 * expression.cs (ExpressionStatement): New base class used for
107 expressions that can appear in statements, so that we can provide
108 an alternate path to generate expression that do not leave a value
111 (Expression::Emit, and all the derivatives): We no longer return
112 whether a value is left on the stack or not. Every expression
113 after being emitted leaves a single value on the stack.
115 * codegen.cs (EmitContext::EmitStatementExpression): Use the
116 facilties of ExpressionStatement if possible.
118 * cs-parser.jay: Update statement_expression.
120 2001-09-25 Miguel de Icaza <miguel@ximian.com>
122 * driver.cs: Change the wording of message
124 2001-09-25 Ravi Pratap <ravi@ximian.com>
126 * expression.cs (Binary::ResolveOperator): Had forgottten to set
127 the type of the expression to the return type of the method if
128 we have an overloaded operator match ! The regression tests pass again !
129 (Unary::ResolveOperator): Ditto.
131 * expression.cs (Invocation::ConversionExists): Correct the member lookup
132 to find "op_Implicit", not "implicit" ;-)
133 (UserImplicitCast): New class to take care of user-defined implicit conversions.
134 (ConvertImplicit, ForceConversion): Take TypeContainer argument
136 * everywhere : Correct calls to the above accordingly.
138 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
139 (ConvertImplicit): Do user-defined conversion if it exists.
141 2001-09-24 Miguel de Icaza <miguel@ximian.com>
143 * assign.cs: track location.
144 (Resolve): Use implicit conversions on assignment.
146 * literal.cs: Oops. Not good, Emit of short access values should
147 pass (Bytes) or the wrong argument will be selected.
149 * expression.cs (Unary::Emit): Emit code for -expr.
151 (Unary::ResolveOperator): Handle `Substract' for non-constants
152 (substract from zero from the non-constants).
153 Deal with Doubles as well.
155 (Expression::ConvertImplicitRequired): New routine that reports an
156 error if no implicit conversion exists.
158 (Invocation::OverloadResolve): Store the converted implicit
159 expressions if we make them
161 2001-09-24 Ravi Pratap <ravi@ximian.com>
163 * class.cs (ConstructorInitializer): Take a Location argument.
164 (ConstructorBaseInitializer): Same here.
165 (ConstructorThisInitializer): Same here.
167 * cs-parser.jay : Update all calls accordingly.
169 * expression.cs (Unary, Binary, New): Take location argument.
170 Update accordingly everywhere.
172 * cs-parser.jay : Update all calls to the above to take a location
177 2001-09-24 Ravi Pratap <ravi@ximian.com>
179 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
180 (Invocation::BetterConversion): Same here
181 (Invocation::ConversionExists): Ditto.
183 (Invocation::ConversionExists): Implement.
185 2001-09-22 Ravi Pratap <ravi@ximian.com>
187 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
188 Also take an additional TypeContainer argument.
190 * All over : Pass in TypeContainer as argument to OverloadResolve.
192 * typemanager.cs (CSharpName): Update to check for the string type and return
195 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
198 2001-09-21 Ravi Pratap <ravi@ximian.com>
200 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
201 (Invocation::BetterFunction): Implement.
202 (Invocation::BetterConversion): Implement.
203 (Invocation::ConversionExists): Skeleton, no implementation yet.
205 Okay, things work fine !
207 2001-09-21 Miguel de Icaza <miguel@ximian.com>
209 * typemanager.cs: declare and load enum_type, delegate_type and
212 * expression.cs (Expression::Emit): Now emit returns a value that
213 tells whether a value is left on the stack or not. This strategy
214 might be reveted tomorrow with a mechanism that would address
215 multiple assignments.
216 (Expression::report118): Utility routine to report mismatches on
219 (Unary::Report23): Report impossible type/operator combination
222 (Unary::IsIncrementableNumber): Whether the type can be
223 incremented or decremented with add.
224 (Unary::ResolveOperator): Also allow enumerations to be bitwise
226 (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
228 (Invocation::Emit): Deal with new Emit convetion.
230 * All Expression derivatives: Updated their Emit method to return
231 whether they leave values on the stack or not.
233 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
234 stack for expressions that are statements.
236 2001-09-20 Miguel de Icaza <miguel@ximian.com>
238 * expression.cs (LValue): New interface. Must be implemented by
240 (LocalVariableReference, ParameterReference, FieldExpr): Implement
243 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
244 interface for generating code, simplifies the code.
246 2001-09-20 Ravi Pratap <ravi@ximian.com>
248 * expression.cs (everywhere): Comment out return statements in ::Resolve
249 methods to avoid the warnings.
251 2001-09-20 Miguel de Icaza <miguel@ximian.com>
253 * driver.cs (parse): Report error 2001 if we can not open the
256 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
259 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
262 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
263 otherwise nested blocks end up with the same index.
265 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
267 * expression.cs: Instead of having FIXMEs in the Resolve
268 functions, throw exceptions so it is obvious that we are facing a
271 * cs-parser.jay (invocation_expression): Pass Location information.
273 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
274 Use a basename for those routines because .NET does not like paths
277 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
280 2001-09-19 Miguel de Icaza <miguel@ximian.com>
282 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
283 are loading the correct data types (throws an exception if not).
284 (TypeManager::InitCoreTypes): Use CoreLookupType
286 * expression.cs (Unary::ResolveOperator): return the child
287 expression for expressions which are just +expr.
288 (Unary::ResolveOperator): Return negative literals for -LITERAL
289 expressions (otherwise they are Unary {Literal}).
290 (Invocation::Badness): Take into account `Implicit constant
291 expression conversions'.
293 * literal.cs (LongLiteral): Implement long literal class.
294 (IntLiteral): export the `Value' of the intliteral.
296 2001-09-19 Ravi Pratap <ravi@ximian.com>
298 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
300 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
301 instead of 'Operator'
303 * expression.cs (Binary::ResolveOperator): Update accordingly.
304 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
307 * cs-parser.jay (unary_expression): Update to use the new names.
309 * gen-treedump.cs (GetUnary): Same here.
311 * expression.cs (Unary::Resolve): Implement.
312 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
313 operators are found instead of making noise ;-)
314 (Unary::ResolveOperator): New method to do precisely the same thing which
315 Binary::ResolveOperator does for Binary expressions.
316 (Unary.method, .Arguments): Add.
317 (Unary::OperName): Implement.
318 (Unary::ForceConversion): Copy and Paste !
320 * class.cs (Operator::Define): Fix a small bug for the case when we have
323 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
324 for the inbuilt operators. Only overloading works for now ;-)
326 2001-09-18 Miguel de Icaza <miguel@ximian.com>
328 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
329 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
331 * expression.cs (This::Emit): Implement.
332 (This::Resolve): Implement.
333 (TypeOf:Resolve): Implement.
334 (Expression::ResolveSimpleName): Add an implicit this to instance
336 (MemberAccess::Resolve): Deal with Parameters and Fields.
337 Bind instance variable to Field expressions.
338 (FieldExpr::Instance): New field used to track the expression that
339 represents the object instance.
340 (FieldExpr::Resolve): Track potential errors from MemberLookup not
342 (FieldExpr::Emit): Implement.
344 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
345 the last instruction contains a return opcode to avoid generating
346 the last `ret' instruction (this generates correct code, and it is
347 nice to pass the peverify output).
349 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
350 initializer for static and instance variables.
351 (Constructor::Emit): Allow initializer to be null in the case of
352 static constructors. Only emit initializer for instance
355 (TypeContainer::FindMembers): Return a null array if there are no
358 Also fix the code for the MemberTypes.Method branch, as it was not
359 scanning that for operators (or tried to access null variables before).
361 * assign.cs (Assign::Emit): Handle instance and static fields.
365 * driver.cs: Stop compilation if there are parse errors.
367 * cs-parser.jay (constructor_declaration): Provide default base
368 initializer for non-static constructors.
369 (constructor_declarator): Do not provide a default base
370 initializers if none was specified.
371 Catch the fact that constructors should not have parameters.
373 * class.cs: Do not emit parent class initializers for static
374 constructors, that should be flagged as an error.
376 2001-09-18 Ravi Pratap <ravi@ximian.com>
378 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
379 Move back code into TypeContainer::Populate.
381 2001-09-18 Ravi Pratap <ravi@ximian.com>
383 * class.cs (TypeContainer::AddConstructor): Fix the check to
384 compare against Name, not Basename.
385 (Operator::OpType): Change Plus and Minus to Add and Subtract.
387 * cs-parser.jay : Update accordingly.
389 * class.cs (TypeContainer::FindMembers): For the case where we are searching
390 for methods, don't forget to look into the operators too.
391 (RegisterMethodBuilder): Helper method to take care of this for
392 methods, constructors and operators.
393 (Operator::Define): Completely revamp.
394 (Operator.OperatorMethod, MethodName): New fields.
395 (TypeContainer::Populate): Move the registering of builders into
396 RegisterMethodBuilder.
397 (Operator::Emit): Re-write.
399 * expression.cs (Binary::Emit): Comment out code path to emit method
400 invocation stuff for the case when we have a user defined operator. I am
401 just not able to get it right !
403 2001-09-17 Miguel de Icaza <miguel@ximian.com>
405 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
408 (Expression::MemberLookup): Provide a version that allows to
409 specify the MemberTypes and BindingFlags.
411 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
412 so it was not fetching variable information from outer blocks.
414 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
415 Beforefieldinit as it was buggy.
417 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
420 * class.cs (Constructor::Emit): Only emit if block is not null.
421 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
422 deal with this by semantically definining it as if the user had
425 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
426 constructors as we now "emit" them at a higher level.
428 (TypeContainer::DefineDefaultConstructor): Used to define the
429 default constructors if none was provided.
431 (ConstructorInitializer): Add methods Resolve and Emit.
433 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
435 2001-09-17 Ravi Pratap <ravi@ximian.com>
437 * class.cs (TypeContainer::EmitDefaultConstructor): Register
438 the default constructor builder with our hashtable for methodbuilders
441 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
442 and argument_count is 0 in which case we have a match.
443 (Binary::ResolveOperator): More null checking and miscellaneous coding
446 2001-09-17 Ravi Pratap <ravi@ximian.com>
448 * rootcontext.cs (IsNameSpace): Compare against null.
450 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
452 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
455 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
458 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
459 we have overloaded operators.
460 (Binary::ResolveOperator): Implement the part which does the operator overload
463 * class.cs (Operator::Emit): Implement.
464 (TypeContainer::Emit): Emit the operators we have too.
466 * expression.cs (Binary::Emit): Update to emit the appropriate code for
467 the case when we have a user-defined operator.
469 2001-09-17 Miguel de Icaza <miguel@ximian.com>
471 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
473 2001-09-16 Ravi Pratap <ravi@ximian.com>
475 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
476 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
477 (Constructor::Emit): Implement.
478 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
479 if we have no work to do.
480 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
483 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
484 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
486 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
489 2001-09-15 Ravi Pratap <ravi@ximian.com>
491 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
493 (Tree::RecordNamespace): Method to do what the name says ;-)
494 (Tree::Namespaces): Property to get at the namespaces hashtable.
496 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
499 * rootcontext.cs (IsNamespace): Fixed it :-)
501 2001-09-14 Miguel de Icaza <miguel@ximian.com>
503 * class.cs (TypeContainer::FindMembers): Add support for
505 (MethodCore): New class that encapsulates both the shared aspects
506 of a Constructor and a Method.
507 (Method, Constructor): Factored pieces into MethodCore.
509 * driver.cs: Added --fatal which makes errors throw exceptions.
510 Load System assembly as well as part of the standard library.
512 * report.cs: Allow throwing exceptions on errors for debugging.
514 * modifiers.cs: Do not use `parent', instead use the real type
515 container to evaluate permission settings.
517 * class.cs: Put Ravi's patch back in. He is right, and we will
518 have to cope with the
520 2001-09-14 Ravi Pratap <ravi@ximian.com>
522 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
523 FamORAssem, not FamANDAssem.
525 2001-09-14 Miguel de Icaza <miguel@ximian.com>
527 * driver.cs: Added --parse option that only parses its input files
530 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
531 incorrect. IsTopLevel is not used to tell whether an object is
532 root_types or not (that can be achieved by testing this ==
533 root_types). But to see if this is a top-level *class* (not
534 necessarly our "toplevel" container).
536 2001-09-14 Ravi Pratap <ravi@ximian.com>
538 * enum.cs (Enum::Define): Modify to call the Lookup method on the
539 parent instead of a direct call to GetType.
541 2001-09-14 Ravi Pratap <ravi@ximian.com>
543 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
544 Modifiers.TypeAttr. This should just be a call to that method.
546 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
547 object so that we can determine if we are top-level or not.
549 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
552 * enum.cs (Enum::Define): Ditto.
554 * modifiers.cs (FieldAttr): Re-write.
556 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
557 (TypeContainer::HaveStaticConstructor): New property to provide access
558 to precisely that info.
560 * modifiers.cs (MethodAttr): Re-write.
561 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
563 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
564 of top-level types as claimed.
566 2001-09-13 Miguel de Icaza <miguel@ximian.com>
568 * expression.cs (MemberLookup): Fruitless attempt to lookup
569 constructors. Maybe I need to emit default constructors? That
570 might be it (currently .NET emits this for me automatically).
571 (Invocation::OverloadResolve): Cope with Arguments == null.
572 (Invocation::EmitArguments): new function, shared by the new
574 (Invocation::Emit): Handle static and instance methods. Emit
575 proper call instruction for virtual or non-virtual invocations.
576 (New::Emit): Implement.
577 (New::Resolve): Implement.
578 (MemberAccess:Resolve): Implement.
579 (MethodGroupExpr::InstanceExpression): used conforming to the spec
581 (FieldExpr::Resolve): Set type.
583 * support.cs: Handle empty arguments.
585 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
586 SimpleLookup): Auxiliary routines to help parse a qualifier
589 Update qualifier_identifier rule.
591 * codegen.cs: Removed debugging messages.
593 * class.cs: Make this a global thing, this acts just as a "key" to
594 objects that we might have around.
596 (Populate): Only initialize method_builders_to_methods once.
598 * expression.cs (PropertyExpr): Initialize type from the
601 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
602 Resolve pattern. Attempt to implicitly convert value to boolean.
605 * expression.cs: Set the type for the int32/int32 argument case.
606 (Binary::ResolveOperator): Set the return type to boolean for
607 comparission operators
609 * typemanager.cs: Remove debugging print code.
611 (Invocation::Resolve): resolve type.
613 * class.cs: Allocate a MemberInfo of the correct size, as the code
614 elsewhere depends on the test to reflect the correct contents.
616 (Method::) Keep track of parameters, due to System.Reflection holes
618 (TypeContainer::Populate): Keep track of MethodBuilders to Method
621 (TypeContainer::FindMembers): Use ArrayList and then copy an array
622 of the exact size and return that.
624 (Class::LookupMethodByBuilder): New function that maps
625 MethodBuilders to its methods. Required to locate the information
626 on methods because System.Reflection bit us again.
628 * support.cs: New file, contains an interface ParameterData and
629 two implementations: ReflectionParameters and InternalParameters
630 used to access Parameter information. We will need to grow this
633 * expression.cs (Invocation::GetParameterData): implement a cache
634 and a wrapper around the ParameterData creation for methods.
635 (Invocation::OverloadResolve): Use new code.
637 2001-09-13 Ravi Pratap <ravi@ximian.com>
639 * class.cs (TypeContainer::EmitField): Remove and move into
640 (Field::Define): here and modify accordingly.
641 (Field.FieldBuilder): New member.
642 (TypeContainer::Populate): Update accordingly.
643 (TypeContainer::FindMembers): Implement.
645 2001-09-13 Miguel de Icaza <miguel@ximian.com>
647 * statement.cs: (VariableInfo::VariableType): New field to be
648 initialized with the full type once it is resolved.
650 2001-09-12 Miguel de Icaza <miguel@ximian.com>
652 * parameter.cs (GetParameterInfo): Use a type cache to compute
653 things only once, and to reuse this information
655 * expression.cs (LocalVariableReference::Emit): Implement.
656 (OpcodeCast::Emit): fix.
658 (ParameterReference::Resolve): Implement.
659 (ParameterReference::Emit): Implement.
661 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
662 that are expressions need to stay as Expressions.
664 * typemanager.cs (CSharpName): Returns the C# name of a type if
667 * expression.cs (Expression::ConvertImplicit): New function that
668 implements implicit type conversions.
670 (Expression::ImplicitReferenceConversion): Implements implicit
671 reference conversions.
673 (EmptyCast): New type for transparent casts.
675 (OpcodeCast): New type for casts of types that are performed with
676 a sequence of bytecodes.
678 (BoxedCast): New type used for casting value types into reference
679 types. Emits a box opcode.
681 (Binary::DoNumericPromotions): Implements numeric promotions of
682 and computation of the Binary::Type.
684 (Binary::EmitBranchable): Optimization.
686 (Binary::Emit): Implement code emission for expressions.
688 * typemanager.cs (TypeManager): Added two new core types: sbyte
691 2001-09-12 Ravi Pratap <ravi@ximian.com>
693 * class.cs (TypeContainer::FindMembers): Method which does exactly
694 what Type.FindMembers does, only we don't have to use reflection. No
697 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
698 typecontainer objects as we need to get at them.
699 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
701 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
702 typecontainer object.
704 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
705 of just a Report object.
707 2001-09-11 Ravi Pratap <ravi@ximian.com>
709 * class.cs (Event::Define): Go back to using the prefixes "add_" and
711 (TypeContainer::Populate): Now define the delegates of the type too.
712 (TypeContainer.Delegates): Property to access the list of delegates defined
715 * delegates.cs (Delegate::Define): Implement partially.
717 * modifiers.cs (TypeAttr): Handle more flags.
719 2001-09-11 Ravi Pratap <ravi@ximian.com>
721 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
723 (Operator::Define): Re-write logic to get types by using the LookupType method
724 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
725 (Indexer::Define): Ditto.
726 (Event::Define): Ditto.
727 (Property::Define): Ditto.
729 2001-09-10 Ravi Pratap <ravi@ximian.com>
731 * class.cs (TypeContainer::Populate): Now define operators too.
732 (TypeContainer.Operators): New property to access the list of operators
734 (Operator.OperatorMethodBuilder): New member to hold the method builder
735 for the operator we are defining.
736 (Operator::Define): Implement.
738 2001-09-10 Ravi Pratap <ravi@ximian.com>
740 * class.cs (Event::Define): Make the prefixes of the accessor methods
743 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
744 of the location being passed in too. Ideally, this should go later since all
745 error reporting should be done through the Report object.
747 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
748 (Populate): Iterate thru the indexers we have and define them too.
749 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
750 for the get and set accessors.
751 (Indexer::Define): Implement.
753 2001-09-09 Miguel de Icaza <miguel@ximian.com>
755 * expression.cs (Binary::Resolve): Beginning of it. I scratched
756 my previous implementation, did not work.
758 * typemanager.cs: Add a couple of missing types (the longs).
760 * literal.cs: Use TypeManager.bool_type instead of getting it.
762 * expression.cs (EventExpr): New kind of expressions.
763 (Expressio::ExprClassFromMemberInfo): finish
765 2001-09-08 Miguel de Icaza <miguel@ximian.com>
767 * assign.cs: Emit stores to static fields differently.
769 2001-09-08 Ravi Pratap <ravi@ximian.com>
771 * Merge in changes and adjust code to tackle conflicts. Backed out my
772 code in Assign::Resolve ;-)
774 2001-09-08 Ravi Pratap <ravi@ximian.com>
776 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
777 instead Report.Error and also pass in the location.
778 (CSharpParser::Lexer): New readonly property to return the reference
779 to the Tokenizer object.
780 (declare_local_variables): Use Report.Error with location instead of plain
784 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
785 (Operator.CheckBinaryOperator): Ditto.
787 * cs-parser.jay (operator_declarator): Update accordingly.
789 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
790 (CheckBinaryOperator): Same here.
792 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
793 on the name without any prefixes of namespace names etc. This is because we
794 already might have something already fully qualified like
795 'System.Console.WriteLine'
797 * assign.cs (Resolve): Begin implementation. Stuck ;-)
799 2001-09-07 Ravi Pratap <ravi@ximian.com>
801 * cs-tokenizer.cs (location): Return a string which also contains
804 * expression.cs (ElementAccess): New class for expressions of the
805 type 'element access.'
806 (BaseAccess): New class for expressions of the type 'base access.'
807 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
810 * cs-parser.jay (element_access): Implement action.
811 (base_access): Implement actions.
812 (checked_expression, unchecked_expression): Implement.
814 * cs-parser.jay (local_variable_type): Correct and implement.
815 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
817 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
819 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
820 name and the specifiers.
822 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
824 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
825 making them all public ;-)
827 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
830 2001-09-07 Miguel de Icaza <miguel@ximian.com>
832 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
834 (FieldExpr, PropertyExprs): New resolved expressions.
835 (SimpleName::MemberStaticCheck): Perform static checks for access
836 to non-static fields on static methods. Maybe this should be
837 generalized for MemberAccesses.
838 (SimpleName::ResolveSimpleName): More work on simple name
841 * cs-parser.jay (primary_expression/qualified_identifier): track
844 * codegen.cs (CodeGen::Save): Catch save exception, report error.
845 (EmitContext::EmitBoolExpression): Chain to expression generation
846 instead of temporary hack.
847 (::EmitStatementExpression): Put generic expression code generation.
849 * assign.cs (Assign::Emit): Implement variable assignments to
850 local variables, parameters and fields.
852 2001-09-06 Miguel de Icaza <miguel@ximian.com>
854 * statement.cs (Block::GetVariableInfo): New method, returns the
855 VariableInfo for a variable name in a block.
856 (Block::GetVariableType): Implement in terms of GetVariableInfo
858 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
859 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
861 2001-09-06 Ravi Pratap <ravi@ximian.com>
863 * cs-parser.jay (operator_declaration): Continue on my quest : update
864 to take attributes argument.
865 (event_declaration): Ditto.
866 (enum_declaration): Ditto.
867 (indexer_declaration): Ditto.
869 * class.cs (Operator::Operator): Update constructor accordingly.
870 (Event::Event): Ditto.
872 * delegate.cs (Delegate::Delegate): Same here.
874 * enum.cs (Enum::Enum): Same here.
876 2001-09-05 Ravi Pratap <ravi@ximian.com>
878 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
880 * ../tests/cs0658.cs : New file to demonstrate error 0658.
882 * attribute.cs (Attributes): New class to encapsulate all attributes which were
883 being passed around as an arraylist.
884 (Attributes::AddAttribute): Method to add attribute sections.
886 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
887 (struct_declaration): Update accordingly.
888 (constant_declaration): Update.
889 (field_declaration): Update.
890 (method_header): Update.
891 (fixed_parameter): Update.
892 (parameter_array): Ditto.
893 (property_declaration): Ditto.
894 (destructor_declaration): Ditto.
896 * class.cs (Struct::Struct): Update constructors accordingly.
897 (Class::Class): Ditto.
898 (Field::Field): Ditto.
899 (Method::Method): Ditto.
900 (Property::Property): Ditto.
901 (TypeContainer::OptAttribute): update property's return type.
903 * interface.cs (Interface.opt_attributes): New member.
904 (Interface::Interface): Update to take the extra Attributes argument.
906 * parameter.cs (Parameter::Parameter): Ditto.
908 * constant.cs (Constant::Constant): Ditto.
910 * interface.cs (InterfaceMemberBase): New OptAttributes field.
911 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
912 the attributes as a parameter.
913 (InterfaceProperty): Update constructor call.
914 (InterfaceEvent): Ditto.
915 (InterfaceMethod): Ditto.
916 (InterfaceIndexer): Ditto.
918 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
919 pass the attributes too.
920 (interface_event_declaration): Ditto.
921 (interface_property_declaration): Ditto.
922 (interface_method_declaration): Ditto.
923 (interface_declaration): Ditto.
925 2001-09-05 Miguel de Icaza <miguel@ximian.com>
927 * class.cs (Method::Define): Track the "static Main" definition to
928 create an entry point.
930 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
931 EntryPoint if we find it.
933 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
934 (EmitContext::ig): Make this variable public.
936 * driver.cs: Make the default output file be the first file name
937 with the .exe extension.
939 Detect empty compilations
941 Handle various kinds of output targets. Handle --target and
942 rename -t to --dumper.
944 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
945 methods inherited from Expression return now an Expression. This
946 will is used during the tree rewriting as we resolve them during
949 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
950 the spec. Missing entirely is the information about
951 accessability of elements of it.
953 (Expression::ExprClassFromMemberInfo): New constructor for
954 Expressions that creates a fully initialized Expression based on
955 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
958 (Invocation::Resolve): Begin implementing resolution of invocations.
960 * literal.cs (StringLiteral): Implement Emit.
962 2001-09-05 Ravi Pratap <ravi@ximian.com>
964 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
967 2001-09-04 Ravi Pratap <ravi@ximian.com>
969 * cs-parser.jay (attribute_arguments): Implement actions.
970 (attribute): Fix bug in production. Implement action.
971 (attribute_list): Implement.
972 (attribute_target): Implement.
973 (attribute_target_specifier, opt_target_specifier): Implement
974 (CheckAttributeTarget): New method to check if the attribute target
976 (attribute_section): Implement.
977 (opt_attributes): Implement.
979 * attribute.cs : New file to handle attributes.
980 (Attribute): Class to hold attribute info.
982 * cs-parser.jay (opt_attribute_target_specifier): Remove production
983 (attribute_section): Modify production to use 2 different rules to
984 achieve the same thing. 1 s/r conflict down !
985 Clean out commented, useless, non-reducing dimension_separator rules.
987 * class.cs (TypeContainer.attributes): New member to hold list
988 of attributes for a type.
989 (Struct::Struct): Modify to take one more argument, the attribute list.
990 (Class::Class): Ditto.
991 (Field::Field): Ditto.
992 (Method::Method): Ditto.
993 (Property::Property): Ditto.
995 * cs-parser.jay (struct_declaration): Update constructor call to
996 pass in the attributes too.
997 (class_declaration): Ditto.
998 (constant_declaration): Ditto.
999 (field_declaration): Ditto.
1000 (method_header): Ditto.
1001 (fixed_parameter): Ditto.
1002 (parameter_array): Ditto.
1003 (property_declaration): Ditto.
1005 * constant.cs (Constant::Constant): Update constructor similarly.
1006 Use System.Collections.
1008 * parameter.cs (Parameter::Parameter): Update as above.
1010 2001-09-02 Ravi Pratap <ravi@ximian.com>
1012 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
1013 (TypeContainer.delegates): New member to hold list of delegates.
1015 * cs-parser.jay (delegate_declaration): Implement the action correctly
1016 this time as I seem to be on crack ;-)
1018 2001-09-02 Miguel de Icaza <miguel@ximian.com>
1020 * rootcontext.cs (RootContext::IsNamespace): new function, used to
1021 tell whether an identifier represents a namespace.
1023 * expression.cs (NamespaceExpr): A namespace expression, used only
1024 temporarly during expression resolution.
1025 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
1026 utility functions to resolve names on expressions.
1028 2001-09-01 Miguel de Icaza <miguel@ximian.com>
1030 * codegen.cs: Add hook for StatementExpressions.
1032 * class.cs: Fix inverted test for static flag in methods.
1034 2001-09-02 Ravi Pratap <ravi@ximian.com>
1036 * class.cs (Operator::CheckUnaryOperator): Correct error number used
1037 to make it coincide with MS' number.
1038 (Operator::CheckBinaryOperator): Ditto.
1040 * ../errors/errors.txt : Remove error numbers added earlier.
1042 * ../errors/cs1019.cs : Test case for error # 1019
1044 * ../errros/cs1020.cs : Test case for error # 1020
1046 * cs-parser.jay : Clean out commented cruft.
1047 (dimension_separators, dimension_separator): Comment out. Ostensibly not
1048 used anywhere - non-reducing rule.
1049 (namespace_declarations): Non-reducing rule - comment out.
1051 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
1052 with TypeContainer::AddEnum.
1054 * delegate.cs : New file for delegate handling classes.
1055 (Delegate): Class for declaring delegates.
1057 * makefile : Update.
1059 * cs-parser.jay (delegate_declaration): Implement.
1061 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
1063 * class.cs (Event::Define): Implement.
1064 (Event.EventBuilder): New member.
1066 * class.cs (TypeContainer::Populate): Update to define all enums and events
1068 (Events): New property for the events arraylist we hold. Shouldn't we move to using
1069 readonly fields for all these cases ?
1071 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1073 * class.cs (Property): Revamp to use the convention of making fields readonly.
1074 Accordingly modify code elsewhere.
1076 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
1077 the Define method of the Property class.
1079 * class.cs : Clean up applied patch and update references to variables etc. Fix
1081 (TypeContainer::Populate): Update to define all the properties we have. Also
1082 define all enumerations.
1084 * enum.cs (Define): Implement.
1086 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
1088 * cs-parser.jay (overloadable_operator): The semantic value is an
1089 enum of the Operator class.
1090 (operator_declarator): Implement actions.
1091 (operator_declaration): Implement.
1093 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
1094 validity of definitions.
1095 (Operator::CheckBinaryOperator): Static method to check for binary operators
1096 (TypeContainer::AddOperator): New method to add an operator to a type.
1098 * cs-parser.jay (indexer_declaration): Added line to actually call the
1099 AddIndexer method so it gets added ;-)
1101 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
1102 already taken care of by the MS compiler ?
1104 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1106 * class.cs (Operator): New class for operator declarations.
1107 (Operator::OpType): Enum for the various operators.
1109 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
1111 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
1112 ostensibly handle this in semantic analysis.
1114 * cs-parser.jay (general_catch_clause): Comment out
1115 (specific_catch_clauses, specific_catch_clause): Ditto.
1116 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
1117 (catch_args, opt_catch_args): New productions.
1118 (catch_clause): Rewrite to use the new productions above
1119 (catch_clauses): Modify accordingly.
1120 (opt_catch_clauses): New production to use in try_statement
1121 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
1122 and re-write the code in the actions to extract the specific and
1123 general catch clauses by being a little smart ;-)
1125 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
1126 Hooray, try and catch statements parse fine !
1128 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1130 * statement.cs (Block::GetVariableType): Fix logic to extract the type
1131 string from the hashtable of variables.
1133 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
1134 I end up making that mistake ;-)
1135 (catch_clauses): Fixed gross error which made Key and Value of the
1136 DictionaryEntry the same : $1 !!
1138 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1140 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
1142 * cs-parser.jay (event_declaration): Correct to remove the semicolon
1143 when the add and remove accessors are specified.
1145 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
1147 * cs-parser.jay (IndexerDeclaration): New helper class to hold
1148 information about indexer_declarator.
1149 (indexer_declarator): Implement actions.
1150 (parsing_indexer): New local boolean used to keep track of whether
1151 we are parsing indexers or properties. This is necessary because
1152 implicit_parameters come into picture even for the get accessor in the
1154 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
1156 * class.cs (Indexer): New class for indexer declarations.
1157 (TypeContainer::AddIndexer): New method to add an indexer to a type.
1158 (TypeContainer::indexers): New member to hold list of indexers for the
1161 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
1163 * cs-parser.jay (add_accessor_declaration): Implement action.
1164 (remove_accessor_declaration): Implement action.
1165 (event_accessors_declaration): Implement
1166 (variable_declarators): swap statements for first rule - trivial.
1168 * class.cs (Event): New class to hold information about event
1170 (TypeContainer::AddEvent): New method to add an event to a type
1171 (TypeContainer::events): New member to hold list of events.
1173 * cs-parser.jay (event_declaration): Implement actions.
1175 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
1177 * cs-parser.jay (dim_separators): Implement. Make it a string
1178 concatenating all the commas together, just as they appear.
1179 (opt_dim_separators): Modify accordingly
1180 (rank_specifiers): Update accordingly. Basically do the same
1181 thing - instead, collect the brackets here.
1182 (opt_rank_sepcifiers): Modify accordingly.
1183 (array_type): Modify to actually return the complete type string
1184 instead of ignoring the rank_specifiers.
1185 (expression_list): Implement to collect the expressions
1186 (variable_initializer): Implement. We make it a list of expressions
1187 essentially so that we can handle the array_initializer case neatly too.
1188 (variable_initializer_list): Implement.
1189 (array_initializer): Make it a list of variable_initializers
1190 (opt_array_initializer): Modify accordingly.
1192 * expression.cs (New::NType): Add enumeration to help us
1193 keep track of whether we have an object/delegate creation
1194 or an array creation.
1195 (New:NewType, New::Rank, New::Indices, New::Initializers): New
1196 members to hold data about array creation.
1197 (New:New): Modify to update NewType
1198 (New:New): New Overloaded contructor for the array creation
1201 * cs-parser.jay (array_creation_expression): Implement to call
1202 the overloaded New constructor.
1204 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
1206 * class.cs (TypeContainer::Constructors): Return member
1207 constructors instead of returning null.
1209 2001-08-26 Miguel de Icaza <miguel@ximian.com>
1211 * typemanager.cs (InitCoreTypes): Initialize the various core
1212 types after we have populated the type manager with the user
1213 defined types (this distinction will be important later while
1214 compiling corlib.dll)
1216 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
1217 on Expression Classification. Now all expressions have a method
1218 `Resolve' and a method `Emit'.
1220 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
1221 generation from working. Also add some temporary debugging
1224 2001-08-24 Miguel de Icaza <miguel@ximian.com>
1226 * codegen.cs: Lots of code generation pieces. This is only the
1227 beginning, will continue tomorrow with more touches of polish. We
1228 handle the fundamentals of if, while, do, for, return. Others are
1229 trickier and I need to start working on invocations soon.
1231 * gen-treedump.cs: Bug fix, use s.Increment here instead of
1234 * codegen.cs (EmitContext): New struct, used during code
1235 emission to keep a context. Most of the code generation will be
1238 * cs-parser.jay: Add embedded blocks to the list of statements of
1239 this block. So code generation proceeds in a top down fashion.
1241 2001-08-23 Miguel de Icaza <miguel@ximian.com>
1243 * statement.cs: Add support for multiple child blocks.
1245 2001-08-22 Miguel de Icaza <miguel@ximian.com>
1247 * codegen.cs (EmitCode): New function, will emit the code for a
1248 Block of code given a TypeContainer and its ILGenerator.
1250 * statement.cs (Block): Standard public readonly optimization.
1251 (Block::Block constructors): Link children.
1252 (Block::Child): Child Linker.
1253 (Block::EmitVariables): Emits IL variable declarations.
1255 * class.cs: Drop support for MethodGroups here, delay until
1257 (Method::): Applied the same simplification that I did before, and
1258 move from Properties to public readonly fields.
1259 (Method::ParameterTypes): Returns the parameter types for the
1260 function, and implements a cache that will be useful later when I
1261 do error checking and the semantic analysis on the methods is
1263 (Constructor::GetCallingConvention): Renamed from CallingConvetion
1264 and made a method, optional argument tells whether this is a class
1265 or a structure to apply the `has-this' bit.
1266 (Method::GetCallingConvention): Implement, returns the calling
1268 (Method::Define): Defines the type, a second pass is performed
1269 later to populate the methods.
1271 (Constructor::ParameterTypes): implement a cache similar to the
1272 one on Method::ParameterTypes, useful later when we do semantic
1275 (TypeContainer::EmitMethod): New method. Emits methods.
1277 * expression.cs: Removed MethodGroup class from here.
1279 * parameter.cs (Parameters::GetCallingConvention): new method.
1281 2001-08-21 Miguel de Icaza <miguel@ximian.com>
1283 * class.cs (TypeContainer::Populate): Drop RootContext from the
1286 (Constructor::CallingConvention): Returns the calling convention.
1287 (Constructor::ParameterTypes): Returns the constructor parameter
1290 (TypeContainer::AddConstructor): Keep track of default constructor
1291 and the default static constructor.
1293 (Constructor::) Another class that starts using `public readonly'
1294 instead of properties.
1296 (Constructor::IsDefault): Whether this is a default constructor.
1298 (Field::) use readonly public fields instead of properties also.
1300 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
1301 track of static constructors; If none is used, turn on
1302 BeforeFieldInit in the TypeAttributes.
1304 * cs-parser.jay (opt_argument_list): now the return can be null
1305 for the cases where there are no arguments.
1307 (constructor_declarator): If there is no implicit `base' or
1308 `this', then invoke the default parent constructor.
1310 * modifiers.cs (MethodAttr): New static function maps a set of
1311 modifiers flags into a MethodAttributes enum
1312 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
1313 MethodAttr, TypeAttr to represent the various mappings where the
1315 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
1317 2001-08-19 Miguel de Icaza <miguel@ximian.com>
1319 * parameter.cs (GetParameterInfo): Fix bug where there would be no
1322 * interface.cs (PopulateIndexer): Implemented the code generator
1323 for interface indexers.
1325 2001-08-17 Miguel de Icaza <miguel@ximian.com>
1327 * interface.cs (InterfaceMemberBase): Now we track the new status
1330 (PopulateProperty): Implement property population. Woohoo! Got
1331 Methods and Properties going today.
1333 Removed all the properties for interfaces, and replaced them with
1334 `public readonly' fields.
1336 2001-08-16 Miguel de Icaza <miguel@ximian.com>
1338 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
1339 initialize their hashtables/arraylists only when they are needed
1340 instead of doing this always.
1342 * parameter.cs: Handle refs and out parameters.
1344 * cs-parser.jay: Use an ArrayList to construct the arguments
1345 instead of the ParameterCollection, and then cast that to a
1348 * parameter.cs: Drop the use of ParameterCollection and use
1349 instead arrays of Parameters.
1351 (GetParameterInfo): Use the Type, not the Name when resolving
1354 2001-08-13 Miguel de Icaza <miguel@ximian.com>
1356 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
1357 and instead use public readonly fields.
1359 * class.cs: Put back walking code for type containers.
1361 2001-08-11 Miguel de Icaza <miguel@ximian.com>
1363 * class.cs (MakeConstant): Code to define constants.
1365 * rootcontext.cs (LookupType): New function. Used to locate types
1368 2001-08-08 Miguel de Icaza <miguel@ximian.com>
1370 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
1371 this System.Reflection code is. Kudos to Microsoft
1373 * typemanager.cs: Implement a type cache and avoid loading all
1374 types at boot time. Wrap in LookupType the internals. This made
1375 the compiler so much faster. Wow. I rule!
1377 * driver.cs: Make sure we always load mscorlib first (for
1378 debugging purposes, nothing really important).
1380 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
1381 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
1383 * rootcontext.cs: Lookup types on their namespace; Lookup types
1384 on namespaces that have been imported using the `using' keyword.
1386 * class.cs (TypeContainer::TypeAttr): Virtualize.
1387 (Class::TypeAttr): Return attributes suitable for this bad boy.
1388 (Struct::TypeAttr): ditto.
1389 Handle nested classes.
1390 (TypeContainer::) Remove all the type visiting code, it is now
1391 replaced with the rootcontext.cs code
1393 * rootcontext.cs (GetClassBases): Added support for structs.
1395 2001-08-06 Miguel de Icaza <miguel@ximian.com>
1397 * interface.cs, statement.cs, class.cs, parameter.cs,
1398 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
1399 Drop use of TypeRefs, and use strings instead.
1401 2001-08-04 Miguel de Icaza <miguel@ximian.com>
1405 * class.cs (Struct::Struct): set the SEALED flags after
1406 checking the modifiers.
1407 (TypeContainer::TypeAttr): new property, returns the
1408 TypeAttributes for a class.
1410 * cs-parser.jay (type_list): Oops, list production was creating a
1411 new list of base types.
1413 * rootcontext.cs (StdLib): New property.
1414 (GetInterfaceTypeByName): returns an interface by type name, and
1415 encapsulates error handling here.
1416 (GetInterfaces): simplified.
1417 (ResolveTree): Encapsulated all the tree resolution here.
1418 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
1421 * driver.cs: Add support for --nostdlib, to avoid loading the
1423 (Main): Do not put tree resolution here.
1425 * rootcontext.cs: Beginning of the class resolution.
1427 2001-08-03 Miguel de Icaza <miguel@ximian.com>
1429 * rootcontext.cs: Provide better error reporting.
1431 * cs-parser.jay (interface_base): set our $$ to be interfaces.
1433 * rootcontext.cs (CreateInterface): Handle the case where there
1434 are no parent interfaces.
1436 (CloseTypes): Routine to flush types at the end.
1437 (CreateInterface): Track types.
1438 (GetInterfaces): Returns an array of Types from the list of
1441 * typemanager.c (AddUserType): Mechanism to track user types (puts
1442 the type on the global type hash, and allows us to close it at the
1445 2001-08-02 Miguel de Icaza <miguel@ximian.com>
1447 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
1448 RecordInterface instead.
1450 * cs-parser.jay: Updated to reflect changes above.
1452 * decl.cs (Definition): Keep track of the TypeBuilder type that
1453 represents this type here. Not sure we will use it in the long
1454 run, but wont hurt for now.
1456 * driver.cs: Smaller changes to accomodate the new code.
1458 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
1461 * rootcontext.cs (CreateInterface): New method, used to create
1462 the System.TypeBuilder type for interfaces.
1463 (ResolveInterfaces): new entry point to resolve the interface
1465 (CodeGen): Property, used to keep track of the code generator.
1467 2001-07-26 Miguel de Icaza <miguel@ximian.com>
1469 * cs-parser.jay: Add a second production for delegate_declaration
1472 (enum_body): Put an opt_comma here instead of putting it on
1473 enum_body or enum_member_declarations so we can handle trailing
1474 commas on enumeration members. Gets rid of a shift/reduce.
1476 (type_list): Need a COMMA in the middle.
1478 (indexer_declaration): Tell tokenizer to recognize get/set
1480 * Remove old targets.
1482 * Re-add the parser target.
1484 2001-07-13 Simon Cozens <simon@simon-cozens.org>
1486 * cs-parser.jay: Add precendence rules for a number of operators
1487 ot reduce the number of shift/reduce conflicts in the grammar.
1489 2001-07-17 Miguel de Icaza <miguel@ximian.com>
1491 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
1494 Get rid of old crufty code.
1496 * rootcontext.cs: Use this to keep track of the parsed
1497 representation and the defined types available to the program.
1499 * gen-treedump.cs: adjust for new convention.
1501 * type.cs: Split out the type manager, and the assembly builder
1504 * typemanager.cs: the type manager will live here now.
1506 * cil-codegen.cs: And the code generator here.
1508 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
1510 * makefile: Fixed up for easy making.
1512 2001-07-13 Simon Cozens <simon@simon-cozens.org>
1514 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
1517 (unary_expression): Expand pre_increment_expression and
1518 post_decrement_expression to reduce a shift/reduce.
1520 2001-07-11 Simon Cozens
1522 * cs-tokenizer.cs: Hex numbers should begin with a 0.
1524 Improve allow_keyword_as_indent name.
1526 2001-06-19 Miguel de Icaza <miguel@ximian.com>
1528 * Adjustments for Beta2.
1530 2001-06-13 Miguel de Icaza <miguel@ximian.com>
1532 * decl.cs: Added `Define' abstract method.
1533 (InTransit): new property, used to catch recursive definitions.
1535 * interface.cs: Implement `Define'.
1537 * modifiers.cs: Map Modifiers.constants to
1538 System.Reflection.TypeAttribute flags.
1540 * class.cs: Keep track of types and user-defined types.
1541 (BuilderInit): New method for creating an assembly
1542 (ResolveType): New function to launch the resolution process, only
1543 used by interfaces for now.
1545 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
1546 that are inserted into the name space.
1548 2001-06-08 Miguel de Icaza <miguel@ximian.com>
1550 * ARGH. I have screwed up my tree so many times due to the use of
1551 rsync rather than using CVS. Going to fix this at once.
1553 * driver.cs: Objetify driver. Load assemblies, use assemblies to
1556 2001-06-07 Miguel de Icaza <miguel@ximian.com>
1558 * Experiment successful: Use System.Type rather that our own
1561 2001-05-25 Miguel de Icaza <miguel@ximian.com>
1563 * cs-parser.jay: Removed nsAliases from here.
1565 Use new namespaces, handle `using XXX;'
1567 * namespace.cs: Reimplemented namespace handling, use a recursive
1568 definition of the class. Now we can keep track of using clauses
1569 and catch invalid using clauses.
1571 2001-05-24 Miguel de Icaza <miguel@ximian.com>
1573 * gen-treedump.cs: Adapted for all the renaming.
1575 * expression.cs (Expression): this class now has a Type property
1576 which returns an expression Type.
1578 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
1579 `Type', as this has a different meaning now in the base
1581 2001-05-22 Miguel de Icaza <miguel@ximian.com>
1583 * interface.cs, class.cs: Removed from all the sources the
1584 references to signature computation, as we can not do method
1585 signature computation during the parsing time, as we are not
1586 trying to solve at that point distinguishing:
1590 void a (NS.Blah x) {}
1593 Which depending on the context might be valid or not, as we do not
1594 know if Blah is the same thing as NS.Blah at that point.
1596 * Redid everything so the code uses TypeRefs now instead of
1597 Types. TypeRefs are just temporary type placeholders, that need
1598 to be resolved. They initially have a pointer to a string and the
1599 current scope in which they are used. This is used later by the
1600 compiler to resolve the reference to an actual Type.
1602 * DeclSpace is no longer a CIR.Type, and neither are
1603 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
1604 are all DeclSpaces, but no Types.
1606 * type.cs (TypeRefManager): This implements the TypeRef manager,
1607 which keeps track of all the types that need to be resolved after
1608 the parsing has finished.
1610 2001-05-13 Miguel de Icaza <miguel@ximian.com>
1612 * ARGH. We are going to have to store `foreach' as a class rather
1613 than resolving it, as we need to verify error 1579 after name
1614 resolution. *OR* we could keep a flag that says `This request to
1615 IEnumerator comes from a foreach statement' which we can then use
1616 to generate the error.
1618 2001-05-10 Miguel de Icaza <miguel@ximian.com>
1620 * class.cs (TypeContainer.AddMethod): we now add methods to the
1621 MethodGroup instead of the method hashtable.
1623 * expression.cs: Add MethodGroup abstraction, which gets us one
1624 step closer to the specification in the way we handle method
1627 * cs-parser.jay (primary_expression): qualified_identifier now
1628 tried to match up an identifier to a local variable reference or
1629 to a parameter reference.
1631 current_local_parameters is now a parser global variable that
1632 points to the current parameters for the block, used during name
1635 (property_declaration): Now creates an implicit `value' argument to
1638 2001-05-09 Miguel de Icaza <miguel@ximian.com>
1640 * parameter.cs: Do not use `param' arguments as part of the
1641 signature, per the spec.
1643 2001-05-08 Miguel de Icaza <miguel@ximian.com>
1645 * decl.cs: Base class for classes, structs and interfaces. This
1646 is the "Declaration Space"
1648 * cs-parser.jay: Use CheckDef for checking declaration errors
1649 instead of having one on each function.
1651 * class.cs: Factor out some code for handling error handling in
1652 accordance to the "Declarations" section in the "Basic Concepts"
1653 chapter in the ECMA C# spec.
1655 * interface.cs: Make all interface member classes derive from
1656 InterfaceMemberBase.
1658 2001-05-07 Miguel de Icaza <miguel@ximian.com>
1660 * Many things: all interfaces are parsed and generated in
1661 gen-treedump. Support for member variables, constructors,
1662 destructors, properties, constants is there.
1664 Beginning of the IL backend, but very little done, just there for
1667 2001-04-29 Miguel de Icaza <miguel@ximian.com>
1669 * cs-parser.jay: Fix labeled statement.
1671 * cs-tokenizer.cs (escape): Escape " and ' always.
1672 ref_line, ref_name: keep track of the line/filename as instructed
1673 by #line by the compiler.
1676 2001-04-27 Miguel de Icaza <miguel@ximian.com>
1678 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
1679 to match the values in System.CodeDOM.
1681 Divid renamed to Divide.
1683 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
1685 (Statements.set): remove.
1687 * System.CodeDOM/CodeCatchClause.cs: always have a valid
1690 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
1691 falseStatements always have valid values.
1693 * cs-parser.jay: Use System.CodeDOM now.