1 2001-09-18 Ravi Pratap <ravi@ximian.com>
3 * class.cs (TypeContainer::AddConstructor): Fix the check to
4 compare against Name, not Basename.
5 (Operator::OpType): Change Plus and Minus to Add and Subtract.
7 * cs-parser.jay : Update accordingly.
9 * class.cs (TypeContainer::FindMembers): For the case where we are searching
10 for methods, don't forget to look into the operators too.
11 (RegisterMethodBuilder): Helper method to take care of this for
12 methods, constructors and operators.
13 (Operator::Define): Completely revamp.
14 (Operator.OperatorMethod, MethodName): New fields.
15 (TypeContainer::Populate): Move the registering of builders into
16 RegisterMethodBuilder.
17 (Operator::Emit): Re-write.
19 * expression.cs (Binary::Emit): Comment out code path to emit method
20 invocation stuff for the case when we have a user defined operator. I am
21 just not able to get it right !
23 2001-09-17 Miguel de Icaza <miguel@ximian.com>
25 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
28 (Expression::MemberLookup): Provide a version that allows to
29 specify the MemberTypes and BindingFlags.
31 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
32 so it was not fetching variable information from outer blocks.
34 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
35 Beforefieldinit as it was buggy.
37 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
40 * class.cs (Constructor::Emit): Only emit if block is not null.
41 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
42 deal with this by semantically definining it as if the user had
45 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
46 constructors as we now "emit" them at a higher level.
48 (TypeContainer::DefineDefaultConstructor): Used to define the
49 default constructors if none was provided.
51 (ConstructorInitializer): Add methods Resolve and Emit.
53 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
55 2001-09-17 Ravi Pratap <ravi@ximian.com>
57 * class.cs (TypeContainer::EmitDefaultConstructor): Register
58 the default constructor builder with our hashtable for methodbuilders
61 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
62 and argument_count is 0 in which case we have a match.
63 (Binary::ResolveOperator): More null checking and miscellaneous coding
66 2001-09-17 Ravi Pratap <ravi@ximian.com>
68 * rootcontext.cs (IsNameSpace): Compare against null.
70 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
72 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
75 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
78 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
79 we have overloaded operators.
80 (Binary::ResolveOperator): Implement the part which does the operator overload
83 * class.cs (Operator::Emit): Implement.
84 (TypeContainer::Emit): Emit the operators we have too.
86 * expression.cs (Binary::Emit): Update to emit the appropriate code for
87 the case when we have a user-defined operator.
89 2001-09-17 Miguel de Icaza <miguel@ximian.com>
91 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
93 2001-09-16 Ravi Pratap <ravi@ximian.com>
95 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
96 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
97 (Constructor::Emit): Implement.
98 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
99 if we have no work to do.
100 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
103 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
104 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
106 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
109 2001-09-15 Ravi Pratap <ravi@ximian.com>
111 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
113 (Tree::RecordNamespace): Method to do what the name says ;-)
114 (Tree::Namespaces): Property to get at the namespaces hashtable.
116 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
119 * rootcontext.cs (IsNamespace): Fixed it :-)
121 2001-09-14 Miguel de Icaza <miguel@ximian.com>
123 * class.cs (TypeContainer::FindMembers): Add support for
125 (MethodCore): New class that encapsulates both the shared aspects
126 of a Constructor and a Method.
127 (Method, Constructor): Factored pieces into MethodCore.
129 * driver.cs: Added --fatal which makes errors throw exceptions.
130 Load System assembly as well as part of the standard library.
132 * report.cs: Allow throwing exceptions on errors for debugging.
134 * modifiers.cs: Do not use `parent', instead use the real type
135 container to evaluate permission settings.
137 * class.cs: Put Ravi's patch back in. He is right, and we will
138 have to cope with the
140 2001-09-14 Ravi Pratap <ravi@ximian.com>
142 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
143 FamORAssem, not FamANDAssem.
145 2001-09-14 Miguel de Icaza <miguel@ximian.com>
147 * driver.cs: Added --parse option that only parses its input files
150 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
151 incorrect. IsTopLevel is not used to tell whether an object is
152 root_types or not (that can be achieved by testing this ==
153 root_types). But to see if this is a top-level *class* (not
154 necessarly our "toplevel" container).
156 2001-09-14 Ravi Pratap <ravi@ximian.com>
158 * enum.cs (Enum::Define): Modify to call the Lookup method on the
159 parent instead of a direct call to GetType.
161 2001-09-14 Ravi Pratap <ravi@ximian.com>
163 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
164 Modifiers.TypeAttr. This should just be a call to that method.
166 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
167 object so that we can determine if we are top-level or not.
169 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
172 * enum.cs (Enum::Define): Ditto.
174 * modifiers.cs (FieldAttr): Re-write.
176 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
177 (TypeContainer::HaveStaticConstructor): New property to provide access
178 to precisely that info.
180 * modifiers.cs (MethodAttr): Re-write.
181 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
183 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
184 of top-level types as claimed.
186 2001-09-13 Miguel de Icaza <miguel@ximian.com>
188 * expression.cs (MemberLookup): Fruitless attempt to lookup
189 constructors. Maybe I need to emit default constructors? That
190 might be it (currently .NET emits this for me automatically).
191 (Invocation::OverloadResolve): Cope with Arguments == null.
192 (Invocation::EmitArguments): new function, shared by the new
194 (Invocation::Emit): Handle static and instance methods. Emit
195 proper call instruction for virtual or non-virtual invocations.
196 (New::Emit): Implement.
197 (New::Resolve): Implement.
198 (MemberAccess:Resolve): Implement.
199 (MethodGroupExpr::InstanceExpression): used conforming to the spec
201 (FieldExpr::Resolve): Set type.
203 * support.cs: Handle empty arguments.
205 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
206 SimpleLookup): Auxiliary routines to help parse a qualifier
209 Update qualifier_identifier rule.
211 * codegen.cs: Removed debugging messages.
213 * class.cs: Make this a global thing, this acts just as a "key" to
214 objects that we might have around.
216 (Populate): Only initialize method_builders_to_methods once.
218 * expression.cs (PropertyExpr): Initialize type from the
221 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
222 Resolve pattern. Attempt to implicitly convert value to boolean.
225 * expression.cs: Set the type for the int32/int32 argument case.
226 (Binary::ResolveOperator): Set the return type to boolean for
227 comparission operators
229 * typemanager.cs: Remove debugging print code.
231 (Invocation::Resolve): resolve type.
233 * class.cs: Allocate a MemberInfo of the correct size, as the code
234 elsewhere depends on the test to reflect the correct contents.
236 (Method::) Keep track of parameters, due to System.Reflection holes
238 (TypeContainer::Populate): Keep track of MethodBuilders to Method
241 (TypeContainer::FindMembers): Use ArrayList and then copy an array
242 of the exact size and return that.
244 (Class::LookupMethodByBuilder): New function that maps
245 MethodBuilders to its methods. Required to locate the information
246 on methods because System.Reflection bit us again.
248 * support.cs: New file, contains an interface ParameterData and
249 two implementations: ReflectionParameters and InternalParameters
250 used to access Parameter information. We will need to grow this
253 * expression.cs (Invocation::GetParameterData): implement a cache
254 and a wrapper around the ParameterData creation for methods.
255 (Invocation::OverloadResolve): Use new code.
257 2001-09-13 Ravi Pratap <ravi@ximian.com>
259 * class.cs (TypeContainer::EmitField): Remove and move into
260 (Field::Define): here and modify accordingly.
261 (Field.FieldBuilder): New member.
262 (TypeContainer::Populate): Update accordingly.
263 (TypeContainer::FindMembers): Implement.
265 2001-09-13 Miguel de Icaza <miguel@ximian.com>
267 * statement.cs: (VariableInfo::VariableType): New field to be
268 initialized with the full type once it is resolved.
270 2001-09-12 Miguel de Icaza <miguel@ximian.com>
272 * parameter.cs (GetParameterInfo): Use a type cache to compute
273 things only once, and to reuse this information
275 * expression.cs (LocalVariableReference::Emit): Implement.
276 (OpcodeCast::Emit): fix.
278 (ParameterReference::Resolve): Implement.
279 (ParameterReference::Emit): Implement.
281 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
282 that are expressions need to stay as Expressions.
284 * typemanager.cs (CSharpName): Returns the C# name of a type if
287 * expression.cs (Expression::ConvertImplicit): New function that
288 implements implicit type conversions.
290 (Expression::ImplicitReferenceConversion): Implements implicit
291 reference conversions.
293 (EmptyCast): New type for transparent casts.
295 (OpcodeCast): New type for casts of types that are performed with
296 a sequence of bytecodes.
298 (BoxedCast): New type used for casting value types into reference
299 types. Emits a box opcode.
301 (Binary::DoNumericPromotions): Implements numeric promotions of
302 and computation of the Binary::Type.
304 (Binary::EmitBranchable): Optimization.
306 (Binary::Emit): Implement code emission for expressions.
308 * typemanager.cs (TypeManager): Added two new core types: sbyte
311 2001-09-12 Ravi Pratap <ravi@ximian.com>
313 * class.cs (TypeContainer::FindMembers): Method which does exactly
314 what Type.FindMembers does, only we don't have to use reflection. No
317 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
318 typecontainer objects as we need to get at them.
319 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
321 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
322 typecontainer object.
324 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
325 of just a Report object.
327 2001-09-11 Ravi Pratap <ravi@ximian.com>
329 * class.cs (Event::Define): Go back to using the prefixes "add_" and
331 (TypeContainer::Populate): Now define the delegates of the type too.
332 (TypeContainer.Delegates): Property to access the list of delegates defined
335 * delegates.cs (Delegate::Define): Implement partially.
337 * modifiers.cs (TypeAttr): Handle more flags.
339 2001-09-11 Ravi Pratap <ravi@ximian.com>
341 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
343 (Operator::Define): Re-write logic to get types by using the LookupType method
344 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
345 (Indexer::Define): Ditto.
346 (Event::Define): Ditto.
347 (Property::Define): Ditto.
349 2001-09-10 Ravi Pratap <ravi@ximian.com>
351 * class.cs (TypeContainer::Populate): Now define operators too.
352 (TypeContainer.Operators): New property to access the list of operators
354 (Operator.OperatorMethodBuilder): New member to hold the method builder
355 for the operator we are defining.
356 (Operator::Define): Implement.
358 2001-09-10 Ravi Pratap <ravi@ximian.com>
360 * class.cs (Event::Define): Make the prefixes of the accessor methods
363 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
364 of the location being passed in too. Ideally, this should go later since all
365 error reporting should be done through the Report object.
367 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
368 (Populate): Iterate thru the indexers we have and define them too.
369 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
370 for the get and set accessors.
371 (Indexer::Define): Implement.
373 2001-09-09 Miguel de Icaza <miguel@ximian.com>
375 * expression.cs (Binary::Resolve): Beginning of it. I scratched
376 my previous implementation, did not work.
378 * typemanager.cs: Add a couple of missing types (the longs).
380 * literal.cs: Use TypeManager.bool_type instead of getting it.
382 * expression.cs (EventExpr): New kind of expressions.
383 (Expressio::ExprClassFromMemberInfo): finish
385 2001-09-08 Miguel de Icaza <miguel@ximian.com>
387 * assign.cs: Emit stores to static fields differently.
389 2001-09-08 Ravi Pratap <ravi@ximian.com>
391 * Merge in changes and adjust code to tackle conflicts. Backed out my
392 code in Assign::Resolve ;-)
394 2001-09-08 Ravi Pratap <ravi@ximian.com>
396 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
397 instead Report.Error and also pass in the location.
398 (CSharpParser::Lexer): New readonly property to return the reference
399 to the Tokenizer object.
400 (declare_local_variables): Use Report.Error with location instead of plain
404 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
405 (Operator.CheckBinaryOperator): Ditto.
407 * cs-parser.jay (operator_declarator): Update accordingly.
409 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
410 (CheckBinaryOperator): Same here.
412 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
413 on the name without any prefixes of namespace names etc. This is because we
414 already might have something already fully qualified like
415 'System.Console.WriteLine'
417 * assign.cs (Resolve): Begin implementation. Stuck ;-)
419 2001-09-07 Ravi Pratap <ravi@ximian.com>
421 * cs-tokenizer.cs (location): Return a string which also contains
424 * expression.cs (ElementAccess): New class for expressions of the
425 type 'element access.'
426 (BaseAccess): New class for expressions of the type 'base access.'
427 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
430 * cs-parser.jay (element_access): Implement action.
431 (base_access): Implement actions.
432 (checked_expression, unchecked_expression): Implement.
434 * cs-parser.jay (local_variable_type): Correct and implement.
435 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
437 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
439 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
440 name and the specifiers.
442 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
444 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
445 making them all public ;-)
447 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
450 2001-09-07 Miguel de Icaza <miguel@ximian.com>
452 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
454 (FieldExpr, PropertyExprs): New resolved expressions.
455 (SimpleName::MemberStaticCheck): Perform static checks for access
456 to non-static fields on static methods. Maybe this should be
457 generalized for MemberAccesses.
458 (SimpleName::ResolveSimpleName): More work on simple name
461 * cs-parser.jay (primary_expression/qualified_identifier): track
464 * codegen.cs (CodeGen::Save): Catch save exception, report error.
465 (EmitContext::EmitBoolExpression): Chain to expression generation
466 instead of temporary hack.
467 (::EmitStatementExpression): Put generic expression code generation.
469 * assign.cs (Assign::Emit): Implement variable assignments to
470 local variables, parameters and fields.
472 2001-09-06 Miguel de Icaza <miguel@ximian.com>
474 * statement.cs (Block::GetVariableInfo): New method, returns the
475 VariableInfo for a variable name in a block.
476 (Block::GetVariableType): Implement in terms of GetVariableInfo
478 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
479 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
481 2001-09-06 Ravi Pratap <ravi@ximian.com>
483 * cs-parser.jay (operator_declaration): Continue on my quest : update
484 to take attributes argument.
485 (event_declaration): Ditto.
486 (enum_declaration): Ditto.
487 (indexer_declaration): Ditto.
489 * class.cs (Operator::Operator): Update constructor accordingly.
490 (Event::Event): Ditto.
492 * delegate.cs (Delegate::Delegate): Same here.
494 * enum.cs (Enum::Enum): Same here.
496 2001-09-05 Ravi Pratap <ravi@ximian.com>
498 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
500 * ../tests/cs0658.cs : New file to demonstrate error 0658.
502 * attribute.cs (Attributes): New class to encapsulate all attributes which were
503 being passed around as an arraylist.
504 (Attributes::AddAttribute): Method to add attribute sections.
506 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
507 (struct_declaration): Update accordingly.
508 (constant_declaration): Update.
509 (field_declaration): Update.
510 (method_header): Update.
511 (fixed_parameter): Update.
512 (parameter_array): Ditto.
513 (property_declaration): Ditto.
514 (destructor_declaration): Ditto.
516 * class.cs (Struct::Struct): Update constructors accordingly.
517 (Class::Class): Ditto.
518 (Field::Field): Ditto.
519 (Method::Method): Ditto.
520 (Property::Property): Ditto.
521 (TypeContainer::OptAttribute): update property's return type.
523 * interface.cs (Interface.opt_attributes): New member.
524 (Interface::Interface): Update to take the extra Attributes argument.
526 * parameter.cs (Parameter::Parameter): Ditto.
528 * constant.cs (Constant::Constant): Ditto.
530 * interface.cs (InterfaceMemberBase): New OptAttributes field.
531 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
532 the attributes as a parameter.
533 (InterfaceProperty): Update constructor call.
534 (InterfaceEvent): Ditto.
535 (InterfaceMethod): Ditto.
536 (InterfaceIndexer): Ditto.
538 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
539 pass the attributes too.
540 (interface_event_declaration): Ditto.
541 (interface_property_declaration): Ditto.
542 (interface_method_declaration): Ditto.
543 (interface_declaration): Ditto.
545 2001-09-05 Miguel de Icaza <miguel@ximian.com>
547 * class.cs (Method::Define): Track the "static Main" definition to
548 create an entry point.
550 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
551 EntryPoint if we find it.
553 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
554 (EmitContext::ig): Make this variable public.
556 * driver.cs: Make the default output file be the first file name
557 with the .exe extension.
559 Detect empty compilations
561 Handle various kinds of output targets. Handle --target and
562 rename -t to --dumper.
564 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
565 methods inherited from Expression return now an Expression. This
566 will is used during the tree rewriting as we resolve them during
569 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
570 the spec. Missing entirely is the information about
571 accessability of elements of it.
573 (Expression::ExprClassFromMemberInfo): New constructor for
574 Expressions that creates a fully initialized Expression based on
575 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
578 (Invocation::Resolve): Begin implementing resolution of invocations.
580 * literal.cs (StringLiteral): Implement Emit.
582 2001-09-05 Ravi Pratap <ravi@ximian.com>
584 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
587 2001-09-04 Ravi Pratap <ravi@ximian.com>
589 * cs-parser.jay (attribute_arguments): Implement actions.
590 (attribute): Fix bug in production. Implement action.
591 (attribute_list): Implement.
592 (attribute_target): Implement.
593 (attribute_target_specifier, opt_target_specifier): Implement
594 (CheckAttributeTarget): New method to check if the attribute target
596 (attribute_section): Implement.
597 (opt_attributes): Implement.
599 * attribute.cs : New file to handle attributes.
600 (Attribute): Class to hold attribute info.
602 * cs-parser.jay (opt_attribute_target_specifier): Remove production
603 (attribute_section): Modify production to use 2 different rules to
604 achieve the same thing. 1 s/r conflict down !
605 Clean out commented, useless, non-reducing dimension_separator rules.
607 * class.cs (TypeContainer.attributes): New member to hold list
608 of attributes for a type.
609 (Struct::Struct): Modify to take one more argument, the attribute list.
610 (Class::Class): Ditto.
611 (Field::Field): Ditto.
612 (Method::Method): Ditto.
613 (Property::Property): Ditto.
615 * cs-parser.jay (struct_declaration): Update constructor call to
616 pass in the attributes too.
617 (class_declaration): Ditto.
618 (constant_declaration): Ditto.
619 (field_declaration): Ditto.
620 (method_header): Ditto.
621 (fixed_parameter): Ditto.
622 (parameter_array): Ditto.
623 (property_declaration): Ditto.
625 * constant.cs (Constant::Constant): Update constructor similarly.
626 Use System.Collections.
628 * parameter.cs (Parameter::Parameter): Update as above.
630 2001-09-02 Ravi Pratap <ravi@ximian.com>
632 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
633 (TypeContainer.delegates): New member to hold list of delegates.
635 * cs-parser.jay (delegate_declaration): Implement the action correctly
636 this time as I seem to be on crack ;-)
638 2001-09-02 Miguel de Icaza <miguel@ximian.com>
640 * rootcontext.cs (RootContext::IsNamespace): new function, used to
641 tell whether an identifier represents a namespace.
643 * expression.cs (NamespaceExpr): A namespace expression, used only
644 temporarly during expression resolution.
645 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
646 utility functions to resolve names on expressions.
648 2001-09-01 Miguel de Icaza <miguel@ximian.com>
650 * codegen.cs: Add hook for StatementExpressions.
652 * class.cs: Fix inverted test for static flag in methods.
654 2001-09-02 Ravi Pratap <ravi@ximian.com>
656 * class.cs (Operator::CheckUnaryOperator): Correct error number used
657 to make it coincide with MS' number.
658 (Operator::CheckBinaryOperator): Ditto.
660 * ../errors/errors.txt : Remove error numbers added earlier.
662 * ../errors/cs1019.cs : Test case for error # 1019
664 * ../errros/cs1020.cs : Test case for error # 1020
666 * cs-parser.jay : Clean out commented cruft.
667 (dimension_separators, dimension_separator): Comment out. Ostensibly not
668 used anywhere - non-reducing rule.
669 (namespace_declarations): Non-reducing rule - comment out.
671 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
672 with TypeContainer::AddEnum.
674 * delegate.cs : New file for delegate handling classes.
675 (Delegate): Class for declaring delegates.
679 * cs-parser.jay (delegate_declaration): Implement.
681 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
683 * class.cs (Event::Define): Implement.
684 (Event.EventBuilder): New member.
686 * class.cs (TypeContainer::Populate): Update to define all enums and events
688 (Events): New property for the events arraylist we hold. Shouldn't we move to using
689 readonly fields for all these cases ?
691 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
693 * class.cs (Property): Revamp to use the convention of making fields readonly.
694 Accordingly modify code elsewhere.
696 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
697 the Define method of the Property class.
699 * class.cs : Clean up applied patch and update references to variables etc. Fix
701 (TypeContainer::Populate): Update to define all the properties we have. Also
702 define all enumerations.
704 * enum.cs (Define): Implement.
706 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
708 * cs-parser.jay (overloadable_operator): The semantic value is an
709 enum of the Operator class.
710 (operator_declarator): Implement actions.
711 (operator_declaration): Implement.
713 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
714 validity of definitions.
715 (Operator::CheckBinaryOperator): Static method to check for binary operators
716 (TypeContainer::AddOperator): New method to add an operator to a type.
718 * cs-parser.jay (indexer_declaration): Added line to actually call the
719 AddIndexer method so it gets added ;-)
721 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
722 already taken care of by the MS compiler ?
724 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
726 * class.cs (Operator): New class for operator declarations.
727 (Operator::OpType): Enum for the various operators.
729 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
731 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
732 ostensibly handle this in semantic analysis.
734 * cs-parser.jay (general_catch_clause): Comment out
735 (specific_catch_clauses, specific_catch_clause): Ditto.
736 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
737 (catch_args, opt_catch_args): New productions.
738 (catch_clause): Rewrite to use the new productions above
739 (catch_clauses): Modify accordingly.
740 (opt_catch_clauses): New production to use in try_statement
741 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
742 and re-write the code in the actions to extract the specific and
743 general catch clauses by being a little smart ;-)
745 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
746 Hooray, try and catch statements parse fine !
748 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
750 * statement.cs (Block::GetVariableType): Fix logic to extract the type
751 string from the hashtable of variables.
753 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
754 I end up making that mistake ;-)
755 (catch_clauses): Fixed gross error which made Key and Value of the
756 DictionaryEntry the same : $1 !!
758 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
760 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
762 * cs-parser.jay (event_declaration): Correct to remove the semicolon
763 when the add and remove accessors are specified.
765 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
767 * cs-parser.jay (IndexerDeclaration): New helper class to hold
768 information about indexer_declarator.
769 (indexer_declarator): Implement actions.
770 (parsing_indexer): New local boolean used to keep track of whether
771 we are parsing indexers or properties. This is necessary because
772 implicit_parameters come into picture even for the get accessor in the
774 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
776 * class.cs (Indexer): New class for indexer declarations.
777 (TypeContainer::AddIndexer): New method to add an indexer to a type.
778 (TypeContainer::indexers): New member to hold list of indexers for the
781 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
783 * cs-parser.jay (add_accessor_declaration): Implement action.
784 (remove_accessor_declaration): Implement action.
785 (event_accessors_declaration): Implement
786 (variable_declarators): swap statements for first rule - trivial.
788 * class.cs (Event): New class to hold information about event
790 (TypeContainer::AddEvent): New method to add an event to a type
791 (TypeContainer::events): New member to hold list of events.
793 * cs-parser.jay (event_declaration): Implement actions.
795 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
797 * cs-parser.jay (dim_separators): Implement. Make it a string
798 concatenating all the commas together, just as they appear.
799 (opt_dim_separators): Modify accordingly
800 (rank_specifiers): Update accordingly. Basically do the same
801 thing - instead, collect the brackets here.
802 (opt_rank_sepcifiers): Modify accordingly.
803 (array_type): Modify to actually return the complete type string
804 instead of ignoring the rank_specifiers.
805 (expression_list): Implement to collect the expressions
806 (variable_initializer): Implement. We make it a list of expressions
807 essentially so that we can handle the array_initializer case neatly too.
808 (variable_initializer_list): Implement.
809 (array_initializer): Make it a list of variable_initializers
810 (opt_array_initializer): Modify accordingly.
812 * expression.cs (New::NType): Add enumeration to help us
813 keep track of whether we have an object/delegate creation
814 or an array creation.
815 (New:NewType, New::Rank, New::Indices, New::Initializers): New
816 members to hold data about array creation.
817 (New:New): Modify to update NewType
818 (New:New): New Overloaded contructor for the array creation
821 * cs-parser.jay (array_creation_expression): Implement to call
822 the overloaded New constructor.
824 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
826 * class.cs (TypeContainer::Constructors): Return member
827 constructors instead of returning null.
829 2001-08-26 Miguel de Icaza <miguel@ximian.com>
831 * typemanager.cs (InitCoreTypes): Initialize the various core
832 types after we have populated the type manager with the user
833 defined types (this distinction will be important later while
834 compiling corlib.dll)
836 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
837 on Expression Classification. Now all expressions have a method
838 `Resolve' and a method `Emit'.
840 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
841 generation from working. Also add some temporary debugging
844 2001-08-24 Miguel de Icaza <miguel@ximian.com>
846 * codegen.cs: Lots of code generation pieces. This is only the
847 beginning, will continue tomorrow with more touches of polish. We
848 handle the fundamentals of if, while, do, for, return. Others are
849 trickier and I need to start working on invocations soon.
851 * gen-treedump.cs: Bug fix, use s.Increment here instead of
854 * codegen.cs (EmitContext): New struct, used during code
855 emission to keep a context. Most of the code generation will be
858 * cs-parser.jay: Add embedded blocks to the list of statements of
859 this block. So code generation proceeds in a top down fashion.
861 2001-08-23 Miguel de Icaza <miguel@ximian.com>
863 * statement.cs: Add support for multiple child blocks.
865 2001-08-22 Miguel de Icaza <miguel@ximian.com>
867 * codegen.cs (EmitCode): New function, will emit the code for a
868 Block of code given a TypeContainer and its ILGenerator.
870 * statement.cs (Block): Standard public readonly optimization.
871 (Block::Block constructors): Link children.
872 (Block::Child): Child Linker.
873 (Block::EmitVariables): Emits IL variable declarations.
875 * class.cs: Drop support for MethodGroups here, delay until
877 (Method::): Applied the same simplification that I did before, and
878 move from Properties to public readonly fields.
879 (Method::ParameterTypes): Returns the parameter types for the
880 function, and implements a cache that will be useful later when I
881 do error checking and the semantic analysis on the methods is
883 (Constructor::GetCallingConvention): Renamed from CallingConvetion
884 and made a method, optional argument tells whether this is a class
885 or a structure to apply the `has-this' bit.
886 (Method::GetCallingConvention): Implement, returns the calling
888 (Method::Define): Defines the type, a second pass is performed
889 later to populate the methods.
891 (Constructor::ParameterTypes): implement a cache similar to the
892 one on Method::ParameterTypes, useful later when we do semantic
895 (TypeContainer::EmitMethod): New method. Emits methods.
897 * expression.cs: Removed MethodGroup class from here.
899 * parameter.cs (Parameters::GetCallingConvention): new method.
901 2001-08-21 Miguel de Icaza <miguel@ximian.com>
903 * class.cs (TypeContainer::Populate): Drop RootContext from the
906 (Constructor::CallingConvention): Returns the calling convention.
907 (Constructor::ParameterTypes): Returns the constructor parameter
910 (TypeContainer::AddConstructor): Keep track of default constructor
911 and the default static constructor.
913 (Constructor::) Another class that starts using `public readonly'
914 instead of properties.
916 (Constructor::IsDefault): Whether this is a default constructor.
918 (Field::) use readonly public fields instead of properties also.
920 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
921 track of static constructors; If none is used, turn on
922 BeforeFieldInit in the TypeAttributes.
924 * cs-parser.jay (opt_argument_list): now the return can be null
925 for the cases where there are no arguments.
927 (constructor_declarator): If there is no implicit `base' or
928 `this', then invoke the default parent constructor.
930 * modifiers.cs (MethodAttr): New static function maps a set of
931 modifiers flags into a MethodAttributes enum
932 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
933 MethodAttr, TypeAttr to represent the various mappings where the
935 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
937 2001-08-19 Miguel de Icaza <miguel@ximian.com>
939 * parameter.cs (GetParameterInfo): Fix bug where there would be no
942 * interface.cs (PopulateIndexer): Implemented the code generator
943 for interface indexers.
945 2001-08-17 Miguel de Icaza <miguel@ximian.com>
947 * interface.cs (InterfaceMemberBase): Now we track the new status
950 (PopulateProperty): Implement property population. Woohoo! Got
951 Methods and Properties going today.
953 Removed all the properties for interfaces, and replaced them with
954 `public readonly' fields.
956 2001-08-16 Miguel de Icaza <miguel@ximian.com>
958 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
959 initialize their hashtables/arraylists only when they are needed
960 instead of doing this always.
962 * parameter.cs: Handle refs and out parameters.
964 * cs-parser.jay: Use an ArrayList to construct the arguments
965 instead of the ParameterCollection, and then cast that to a
968 * parameter.cs: Drop the use of ParameterCollection and use
969 instead arrays of Parameters.
971 (GetParameterInfo): Use the Type, not the Name when resolving
974 2001-08-13 Miguel de Icaza <miguel@ximian.com>
976 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
977 and instead use public readonly fields.
979 * class.cs: Put back walking code for type containers.
981 2001-08-11 Miguel de Icaza <miguel@ximian.com>
983 * class.cs (MakeConstant): Code to define constants.
985 * rootcontext.cs (LookupType): New function. Used to locate types
988 2001-08-08 Miguel de Icaza <miguel@ximian.com>
990 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
991 this System.Reflection code is. Kudos to Microsoft
993 * typemanager.cs: Implement a type cache and avoid loading all
994 types at boot time. Wrap in LookupType the internals. This made
995 the compiler so much faster. Wow. I rule!
997 * driver.cs: Make sure we always load mscorlib first (for
998 debugging purposes, nothing really important).
1000 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
1001 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
1003 * rootcontext.cs: Lookup types on their namespace; Lookup types
1004 on namespaces that have been imported using the `using' keyword.
1006 * class.cs (TypeContainer::TypeAttr): Virtualize.
1007 (Class::TypeAttr): Return attributes suitable for this bad boy.
1008 (Struct::TypeAttr): ditto.
1009 Handle nested classes.
1010 (TypeContainer::) Remove all the type visiting code, it is now
1011 replaced with the rootcontext.cs code
1013 * rootcontext.cs (GetClassBases): Added support for structs.
1015 2001-08-06 Miguel de Icaza <miguel@ximian.com>
1017 * interface.cs, statement.cs, class.cs, parameter.cs,
1018 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
1019 Drop use of TypeRefs, and use strings instead.
1021 2001-08-04 Miguel de Icaza <miguel@ximian.com>
1025 * class.cs (Struct::Struct): set the SEALED flags after
1026 checking the modifiers.
1027 (TypeContainer::TypeAttr): new property, returns the
1028 TypeAttributes for a class.
1030 * cs-parser.jay (type_list): Oops, list production was creating a
1031 new list of base types.
1033 * rootcontext.cs (StdLib): New property.
1034 (GetInterfaceTypeByName): returns an interface by type name, and
1035 encapsulates error handling here.
1036 (GetInterfaces): simplified.
1037 (ResolveTree): Encapsulated all the tree resolution here.
1038 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
1041 * driver.cs: Add support for --nostdlib, to avoid loading the
1043 (Main): Do not put tree resolution here.
1045 * rootcontext.cs: Beginning of the class resolution.
1047 2001-08-03 Miguel de Icaza <miguel@ximian.com>
1049 * rootcontext.cs: Provide better error reporting.
1051 * cs-parser.jay (interface_base): set our $$ to be interfaces.
1053 * rootcontext.cs (CreateInterface): Handle the case where there
1054 are no parent interfaces.
1056 (CloseTypes): Routine to flush types at the end.
1057 (CreateInterface): Track types.
1058 (GetInterfaces): Returns an array of Types from the list of
1061 * typemanager.c (AddUserType): Mechanism to track user types (puts
1062 the type on the global type hash, and allows us to close it at the
1065 2001-08-02 Miguel de Icaza <miguel@ximian.com>
1067 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
1068 RecordInterface instead.
1070 * cs-parser.jay: Updated to reflect changes above.
1072 * decl.cs (Definition): Keep track of the TypeBuilder type that
1073 represents this type here. Not sure we will use it in the long
1074 run, but wont hurt for now.
1076 * driver.cs: Smaller changes to accomodate the new code.
1078 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
1081 * rootcontext.cs (CreateInterface): New method, used to create
1082 the System.TypeBuilder type for interfaces.
1083 (ResolveInterfaces): new entry point to resolve the interface
1085 (CodeGen): Property, used to keep track of the code generator.
1087 2001-07-26 Miguel de Icaza <miguel@ximian.com>
1089 * cs-parser.jay: Add a second production for delegate_declaration
1092 (enum_body): Put an opt_comma here instead of putting it on
1093 enum_body or enum_member_declarations so we can handle trailing
1094 commas on enumeration members. Gets rid of a shift/reduce.
1096 (type_list): Need a COMMA in the middle.
1098 (indexer_declaration): Tell tokenizer to recognize get/set
1100 * Remove old targets.
1102 * Re-add the parser target.
1104 2001-07-13 Simon Cozens <simon@simon-cozens.org>
1106 * cs-parser.jay: Add precendence rules for a number of operators
1107 ot reduce the number of shift/reduce conflicts in the grammar.
1109 2001-07-17 Miguel de Icaza <miguel@ximian.com>
1111 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
1114 Get rid of old crufty code.
1116 * rootcontext.cs: Use this to keep track of the parsed
1117 representation and the defined types available to the program.
1119 * gen-treedump.cs: adjust for new convention.
1121 * type.cs: Split out the type manager, and the assembly builder
1124 * typemanager.cs: the type manager will live here now.
1126 * cil-codegen.cs: And the code generator here.
1128 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
1130 * makefile: Fixed up for easy making.
1132 2001-07-13 Simon Cozens <simon@simon-cozens.org>
1134 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
1137 (unary_expression): Expand pre_increment_expression and
1138 post_decrement_expression to reduce a shift/reduce.
1140 2001-07-11 Simon Cozens
1142 * cs-tokenizer.cs: Hex numbers should begin with a 0.
1144 Improve allow_keyword_as_indent name.
1146 2001-06-19 Miguel de Icaza <miguel@ximian.com>
1148 * Adjustments for Beta2.
1150 2001-06-13 Miguel de Icaza <miguel@ximian.com>
1152 * decl.cs: Added `Define' abstract method.
1153 (InTransit): new property, used to catch recursive definitions.
1155 * interface.cs: Implement `Define'.
1157 * modifiers.cs: Map Modifiers.constants to
1158 System.Reflection.TypeAttribute flags.
1160 * class.cs: Keep track of types and user-defined types.
1161 (BuilderInit): New method for creating an assembly
1162 (ResolveType): New function to launch the resolution process, only
1163 used by interfaces for now.
1165 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
1166 that are inserted into the name space.
1168 2001-06-08 Miguel de Icaza <miguel@ximian.com>
1170 * ARGH. I have screwed up my tree so many times due to the use of
1171 rsync rather than using CVS. Going to fix this at once.
1173 * driver.cs: Objetify driver. Load assemblies, use assemblies to
1176 2001-06-07 Miguel de Icaza <miguel@ximian.com>
1178 * Experiment successful: Use System.Type rather that our own
1181 2001-05-25 Miguel de Icaza <miguel@ximian.com>
1183 * cs-parser.jay: Removed nsAliases from here.
1185 Use new namespaces, handle `using XXX;'
1187 * namespace.cs: Reimplemented namespace handling, use a recursive
1188 definition of the class. Now we can keep track of using clauses
1189 and catch invalid using clauses.
1191 2001-05-24 Miguel de Icaza <miguel@ximian.com>
1193 * gen-treedump.cs: Adapted for all the renaming.
1195 * expression.cs (Expression): this class now has a Type property
1196 which returns an expression Type.
1198 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
1199 `Type', as this has a different meaning now in the base
1201 2001-05-22 Miguel de Icaza <miguel@ximian.com>
1203 * interface.cs, class.cs: Removed from all the sources the
1204 references to signature computation, as we can not do method
1205 signature computation during the parsing time, as we are not
1206 trying to solve at that point distinguishing:
1210 void a (NS.Blah x) {}
1213 Which depending on the context might be valid or not, as we do not
1214 know if Blah is the same thing as NS.Blah at that point.
1216 * Redid everything so the code uses TypeRefs now instead of
1217 Types. TypeRefs are just temporary type placeholders, that need
1218 to be resolved. They initially have a pointer to a string and the
1219 current scope in which they are used. This is used later by the
1220 compiler to resolve the reference to an actual Type.
1222 * DeclSpace is no longer a CIR.Type, and neither are
1223 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
1224 are all DeclSpaces, but no Types.
1226 * type.cs (TypeRefManager): This implements the TypeRef manager,
1227 which keeps track of all the types that need to be resolved after
1228 the parsing has finished.
1230 2001-05-13 Miguel de Icaza <miguel@ximian.com>
1232 * ARGH. We are going to have to store `foreach' as a class rather
1233 than resolving it, as we need to verify error 1579 after name
1234 resolution. *OR* we could keep a flag that says `This request to
1235 IEnumerator comes from a foreach statement' which we can then use
1236 to generate the error.
1238 2001-05-10 Miguel de Icaza <miguel@ximian.com>
1240 * class.cs (TypeContainer.AddMethod): we now add methods to the
1241 MethodGroup instead of the method hashtable.
1243 * expression.cs: Add MethodGroup abstraction, which gets us one
1244 step closer to the specification in the way we handle method
1247 * cs-parser.jay (primary_expression): qualified_identifier now
1248 tried to match up an identifier to a local variable reference or
1249 to a parameter reference.
1251 current_local_parameters is now a parser global variable that
1252 points to the current parameters for the block, used during name
1255 (property_declaration): Now creates an implicit `value' argument to
1258 2001-05-09 Miguel de Icaza <miguel@ximian.com>
1260 * parameter.cs: Do not use `param' arguments as part of the
1261 signature, per the spec.
1263 2001-05-08 Miguel de Icaza <miguel@ximian.com>
1265 * decl.cs: Base class for classes, structs and interfaces. This
1266 is the "Declaration Space"
1268 * cs-parser.jay: Use CheckDef for checking declaration errors
1269 instead of having one on each function.
1271 * class.cs: Factor out some code for handling error handling in
1272 accordance to the "Declarations" section in the "Basic Concepts"
1273 chapter in the ECMA C# spec.
1275 * interface.cs: Make all interface member classes derive from
1276 InterfaceMemberBase.
1278 2001-05-07 Miguel de Icaza <miguel@ximian.com>
1280 * Many things: all interfaces are parsed and generated in
1281 gen-treedump. Support for member variables, constructors,
1282 destructors, properties, constants is there.
1284 Beginning of the IL backend, but very little done, just there for
1287 2001-04-29 Miguel de Icaza <miguel@ximian.com>
1289 * cs-parser.jay: Fix labeled statement.
1291 * cs-tokenizer.cs (escape): Escape " and ' always.
1292 ref_line, ref_name: keep track of the line/filename as instructed
1293 by #line by the compiler.
1296 2001-04-27 Miguel de Icaza <miguel@ximian.com>
1298 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
1299 to match the values in System.CodeDOM.
1301 Divid renamed to Divide.
1303 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
1305 (Statements.set): remove.
1307 * System.CodeDOM/CodeCatchClause.cs: always have a valid
1310 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
1311 falseStatements always have valid values.
1313 * cs-parser.jay: Use System.CodeDOM now.