2001-09-20 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
index b8345c42a083bc62d185108b802445d97d9ea4e4..d3236b703288aa0aec08c7e025ce59735c847e92 100755 (executable)
@@ -1,3 +1,389 @@
+2001-09-20  Miguel de Icaza  <miguel@ximian.com>
+
+       * driver.cs (parse): Report error 2001 if we can not open the
+       source file.
+
+       * expression.cs (SimpleName::ResolveSimpleName): Error if we can
+       not resolve it.
+
+       * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
+       object. 
+
+       * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
+       otherwise nested blocks end up with the same index.
+
+       * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
+
+       * expression.cs:  Instead of having FIXMEs in the Resolve
+       functions, throw exceptions so it is obvious that we are facing a
+       bug. 
+
+       * cs-parser.jay (invocation_expression): Pass Location information.
+
+       * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
+       Use a basename for those routines because .NET does not like paths
+       on them. 
+
+       * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
+       already defined.
+
+2001-09-19  Miguel de Icaza  <miguel@ximian.com>
+
+       * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
+       are loading the correct data types (throws an exception if not).
+       (TypeManager::InitCoreTypes): Use CoreLookupType
+
+       * expression.cs (Unary::ResolveOperator): return the child
+       expression for expressions which are just +expr.
+       (Unary::ResolveOperator): Return negative literals for -LITERAL
+       expressions (otherwise they are Unary {Literal}).
+       (Invocation::Badness): Take into account `Implicit constant
+       expression conversions'.
+
+       * literal.cs (LongLiteral): Implement long literal class.
+       (IntLiteral): export the `Value' of the intliteral. 
+
+2001-09-19  Ravi Pratap  <ravi@ximian.com>
+
+       * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
+
+       * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
+       instead of 'Operator'
+
+       * expression.cs (Binary::ResolveOperator): Update accordingly.
+       (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
+       and 'Minus'
+
+       * cs-parser.jay (unary_expression): Update to use the new names.
+
+       * gen-treedump.cs (GetUnary): Same here.
+
+       * expression.cs (Unary::Resolve): Implement.
+       (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
+       operators are found instead of making noise ;-)
+       (Unary::ResolveOperator): New method to do precisely the same thing which
+       Binary::ResolveOperator does for Binary expressions.
+       (Unary.method, .Arguments): Add.
+       (Unary::OperName): Implement.   
+       (Unary::ForceConversion): Copy and Paste !
+
+       * class.cs (Operator::Define): Fix a small bug for the case when we have 
+       a unary operator.
+
+       * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
+       for the inbuilt operators. Only overloading works for now ;-)
+
+2001-09-18  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
+       UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
+
+       * expression.cs (This::Emit): Implement. 
+       (This::Resolve): Implement.
+       (TypeOf:Resolve): Implement.
+       (Expression::ResolveSimpleName): Add an implicit this to instance
+       field references. 
+       (MemberAccess::Resolve): Deal with Parameters and Fields. 
+       Bind instance variable to Field expressions.
+       (FieldExpr::Instance): New field used to track the expression that
+       represents the object instance.
+       (FieldExpr::Resolve): Track potential errors from MemberLookup not
+       binding 
+       (FieldExpr::Emit): Implement.
+
+       * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
+       the last instruction contains a return opcode to avoid generating
+       the last `ret' instruction (this generates correct code, and it is
+       nice to pass the peverify output).
+
+       * class.cs (TypeContainer::EmitFieldInitializers): Implement field
+       initializer for static and instance variables.
+       (Constructor::Emit): Allow initializer to be null in the case of
+       static constructors.  Only emit initializer for instance
+       constructors. 
+
+       (TypeContainer::FindMembers): Return a null array if there are no
+       matches.
+
+       Also fix the code for the MemberTypes.Method branch, as it was not
+       scanning that for operators (or tried to access null variables before).
+
+       * assign.cs (Assign::Emit): Handle instance and static fields. 
+
+       * TODO: Updated.
+
+       * driver.cs: Stop compilation if there are parse errors.
+
+       * cs-parser.jay (constructor_declaration): Provide default base
+       initializer for non-static constructors.
+       (constructor_declarator): Do not provide a default base
+       initializers if none was specified.
+       Catch the fact that constructors should not have parameters.
+
+       * class.cs: Do not emit parent class initializers for static
+       constructors, that should be flagged as an error.
+
+2001-09-18  Ravi Pratap  <ravi@ximian.com>
+
+       * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
+       Move back code into TypeContainer::Populate.
+
+2001-09-18  Ravi Pratap  <ravi@ximian.com>
+
+       * class.cs (TypeContainer::AddConstructor): Fix the check to
+       compare against Name, not Basename. 
+       (Operator::OpType): Change Plus and Minus to Add and Subtract.
+
+       * cs-parser.jay : Update accordingly.
+
+       * class.cs (TypeContainer::FindMembers): For the case where we are searching
+       for methods, don't forget to look into the operators too.
+       (RegisterMethodBuilder): Helper method to take care of this for
+       methods, constructors and operators.
+       (Operator::Define): Completely revamp.
+       (Operator.OperatorMethod, MethodName): New fields.
+       (TypeContainer::Populate): Move the registering of builders into
+       RegisterMethodBuilder.
+       (Operator::Emit): Re-write.
+
+       * expression.cs (Binary::Emit): Comment out code path to emit method
+       invocation stuff for the case when we have a user defined operator. I am
+       just not able to get it right !
+       
+2001-09-17  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (Expression::OverloadResolve): Drop TypeContainer
+       argument. 
+
+       (Expression::MemberLookup): Provide a version that allows to
+       specify the MemberTypes and BindingFlags. 
+
+       * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
+       so it was not fetching variable information from outer blocks.
+
+       * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
+       Beforefieldinit as it was buggy.
+
+       * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
+       that Ravi put here.  
+
+       * class.cs (Constructor::Emit): Only emit if block is not null.
+       (TypeContainer::EmitDefaultConstructor): Removed routine, now we
+       deal with this by semantically definining it as if the user had
+       done it.
+
+       (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
+       constructors as we now "emit" them at a higher level.
+
+       (TypeContainer::DefineDefaultConstructor): Used to define the
+       default constructors if none was provided.
+
+       (ConstructorInitializer): Add methods Resolve and Emit. 
+       
+       * expression.cs: Cast to ConstructorInfo instead of MethodInfo
+
+2001-09-17  Ravi Pratap  <ravi@ximian.com>
+
+       * class.cs (TypeContainer::EmitDefaultConstructor): Register
+       the default constructor builder with our hashtable for methodbuilders
+       to methodcores.
+
+       * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
+       and argument_count is 0 in which case we have a match.
+       (Binary::ResolveOperator): More null checking and miscellaneous coding
+       style cleanup.
+
+2001-09-17  Ravi Pratap  <ravi@ximian.com>
+
+       * rootcontext.cs (IsNameSpace): Compare against null.
+
+       * everywhere : Correct spelling to 'Greater' and to 'Subtract'
+
+       * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
+       and Unary::Operator.
+
+       * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
+       accordingly.
+
+       * expression.cs (Binary::method): New member to hold the MethodBase for the case when
+       we have overloaded operators.
+       (Binary::ResolveOperator): Implement the part which does the operator overload
+       resolution.
+
+       * class.cs (Operator::Emit): Implement.
+       (TypeContainer::Emit): Emit the operators we have too.
+
+       * expression.cs (Binary::Emit): Update to emit the appropriate code for
+       the case when we have a user-defined operator.
+       
+2001-09-17  Miguel de Icaza  <miguel@ximian.com>
+
+       * rootcontext.cs: Fix bug: tree.Namespaces might be null.
+
+2001-09-16  Ravi Pratap  <ravi@ximian.com>
+
+       * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
+       (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
+       (Constructor::Emit): Implement.
+       (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
+       if we have no work to do. 
+       (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
+       Emit method.
+
+       * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
+       (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
+
+       * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
+       of parent.parent.
+
+2001-09-15  Ravi Pratap  <ravi@ximian.com>
+
+       * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
+       in the source.
+       (Tree::RecordNamespace): Method to do what the name says ;-)
+       (Tree::Namespaces): Property to get at the namespaces hashtable.
+
+       * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
+       keep track.
+
+       * rootcontext.cs (IsNamespace): Fixed it :-)
+
+2001-09-14  Miguel de Icaza  <miguel@ximian.com>
+
+       * class.cs (TypeContainer::FindMembers): Add support for
+       constructors. 
+       (MethodCore): New class that encapsulates both the shared aspects
+       of a Constructor and a Method.  
+       (Method, Constructor): Factored pieces into MethodCore.
+
+       * driver.cs: Added --fatal which makes errors throw exceptions.
+       Load System assembly as well as part of the standard library.
+
+       * report.cs: Allow throwing exceptions on errors for debugging.
+
+       * modifiers.cs: Do not use `parent', instead use the real type
+       container to evaluate permission settings.
+
+       * class.cs: Put Ravi's patch back in.  He is right, and we will
+       have to cope with the
+
+2001-09-14  Ravi Pratap  <ravi@ximian.com>
+
+       * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
+       FamORAssem, not FamANDAssem.
+       
+2001-09-14  Miguel de Icaza  <miguel@ximian.com>
+
+       * driver.cs: Added --parse option that only parses its input files
+       and terminates.
+
+       * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
+       incorrect.  IsTopLevel is not used to tell whether an object is
+       root_types or not (that can be achieved by testing this ==
+       root_types).  But to see if this is a top-level *class* (not
+       necessarly our "toplevel" container). 
+
+2001-09-14  Ravi Pratap  <ravi@ximian.com>
+
+       * enum.cs (Enum::Define): Modify to call the Lookup method on the
+       parent instead of a direct call to GetType.
+
+2001-09-14  Ravi Pratap  <ravi@ximian.com>
+
+       * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
+       Modifiers.TypeAttr. This should just be a call to that method.
+
+       * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
+       object so that we can determine if we are top-level or not.
+
+       * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
+       TypeContainer too.
+
+       * enum.cs (Enum::Define): Ditto.
+
+       * modifiers.cs (FieldAttr): Re-write.
+
+       * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
+       (TypeContainer::HaveStaticConstructor): New property to provide access
+       to precisely that info.
+
+       * modifiers.cs (MethodAttr): Re-write.
+       (EventAttr): Remove altogether as there seems to be no ostensible use for it.
+
+       * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
+       of top-level types as claimed.
+       
+2001-09-13  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (MemberLookup): Fruitless attempt to lookup
+       constructors.  Maybe I need to emit default constructors?  That
+       might be it (currently .NET emits this for me automatically).
+       (Invocation::OverloadResolve): Cope with Arguments == null.
+       (Invocation::EmitArguments): new function, shared by the new
+       constructor and us.
+       (Invocation::Emit): Handle static and instance methods.  Emit
+       proper call instruction for virtual or non-virtual invocations.
+       (New::Emit): Implement.
+       (New::Resolve): Implement.
+       (MemberAccess:Resolve): Implement.
+       (MethodGroupExpr::InstanceExpression): used conforming to the spec
+       to track instances.
+       (FieldExpr::Resolve): Set type.
+
+       * support.cs: Handle empty arguments.
+               
+       * cs-parser.jay (CompositeLookup, QualifierIdentifier,
+       SimpleLookup): Auxiliary routines to help parse a qualifier
+       identifier.  
+
+       Update qualifier_identifier rule.
+
+       * codegen.cs: Removed debugging messages.
+
+       * class.cs: Make this a global thing, this acts just as a "key" to
+       objects that we might have around.
+
+       (Populate): Only initialize method_builders_to_methods once.
+
+       * expression.cs (PropertyExpr): Initialize type from the
+       PropertyType. 
+
+       * codegen.cs (EmitContext::EmitBoolExpression): Use propper
+       Resolve pattern.  Attempt to implicitly convert value to boolean.
+       Emit code.
+
+       * expression.cs: Set the type for the int32/int32 argument case.
+       (Binary::ResolveOperator): Set the return type to boolean for
+       comparission operators
+
+       * typemanager.cs: Remove debugging print code.
+
+       (Invocation::Resolve): resolve type.
+
+       * class.cs: Allocate a MemberInfo of the correct size, as the code
+       elsewhere depends on the test to reflect the correct contents.
+
+       (Method::) Keep track of parameters, due to System.Reflection holes
+
+       (TypeContainer::Populate): Keep track of MethodBuilders to Method
+       mapping here.
+
+       (TypeContainer::FindMembers): Use ArrayList and then copy an array
+       of the exact size and return that.
+
+       (Class::LookupMethodByBuilder): New function that maps
+       MethodBuilders to its methods.  Required to locate the information
+       on methods because System.Reflection bit us again.
+
+       * support.cs: New file, contains an interface ParameterData and
+       two implementations: ReflectionParameters and InternalParameters
+       used to access Parameter information.  We will need to grow this
+       as required.
+
+       * expression.cs (Invocation::GetParameterData): implement a cache
+       and a wrapper around the ParameterData creation for methods. 
+       (Invocation::OverloadResolve): Use new code.
+
 2001-09-13  Ravi Pratap  <ravi@ximian.com>
 
        * class.cs (TypeContainer::EmitField): Remove and move into