2010-05-11 Marek Safar A fix for bug #604748 * class.cs, typespec.cs: Search full imported attribute hierarchy for AttributeUsage. 2010-05-11 Marek Safar * namespace.cs: Ignore missing dependencies failure at initialization. 2010-05-11 Marek Safar A fix for bug #604640 * namespace.cs: Don't resolve using constraints too early. 2010-05-11 Marek Safar A fix for bug #604239 * generic.cs: Copy partial type constraints to partial container. 2010-05-10 Marek Safar A fix for bug #557210 * import.cs: Relax underlying enum field rules. 2010-05-10 Marek Safar A fix for bug #603476 * property.cs: Implement IParametersMember for indexer accessors. 2010-05-07 Marek Safar A fix for bug #601141 * class.cs: Update all partial modifiers. 2010-05-06 Marek Safar A fix for bug #601708 * method.cs, membercache.cs: Destructors cannot be hidden. 2010-05-06 Marek Safar A fix for bug #602551 * class.cs: Resursive reference of type definition is allowed. 2010-05-06 Marek Safar * anonymous.cs: Mutate cached storey instance types too. 2010-05-06 Marek Safar A fix for bug #602443 * convert.cs: Explicit enum conversion cannot involve user operators 2010-05-05 Miguel de Icaza * class.cs (TypeContainer.DefineBaseTypes) (TypeContainer.CheckRecursiveDefinition): check for the iface not being null, as we could have failed resolution and crashed; Fixes #442144 * cs-parser.jay: Productions to catch common mistakes when other punctuation operators are used instead of comma. Fixes 571702 2010-05-05 Marek Safar * anonymous.cs: Mutate correct set of constraints. 2010-05-05 Marek Safar A fix for bug #602842 * expression.cs: Resolve all array bound arguments. 2010-05-05 Marek Safar * import.cs: Don't import private fields. 2010-04-30 Marek Safar Partially based on patch by * eval.cs, ecore.cs: Fixed eval show methods. 2010-04-30 Marek Safar * generic.cs, delegate.cs: Implement output type inference of methodgroup now when the specification was cleared at least little bit. 2010-04-29 Marek Safar A fix for bug #575611 * class.cs: Fix recursive unmanaged recursice sruct check. 2010-04-29 Marek Safar A fix for bug #479776 * expression.cs: Implement typeof unbounded nested generic types. 2010-04-29 Marek Safar A fix for bug #474953 * class.cs: Fix valid recursive base type definition. 2010-04-29 Marek Safar A fix for bug #421737 * convert.cs, expression.cs: A boxing conversion exists from a nullable-type to a reference type, if a boxing conversion exists from the underlying non-nullable-value-type to the reference type. 2010-04-29 Marek Safar A fix for bug #376875 * import.cs: Import volatile modifier. 2010-04-29 Marek Safar A fix for bug #372412 * typespec.cs, expression.cs, codegen.cs: Emit readonly prefix for generic arrays. 2010-04-29 Marek Safar A fix for bug #568955 * statements.cs: Handle recursive scope initializers. 2010-04-28 Marek Safar A fix for bug #566511 * anonymous.cs: Always get inflated version of hoisted variable on generic type definition. 2010-04-28 Marek Safar * import.cs, membercache.cs: Relax rules for valid properties. 2010-04-28 Marek Safar * import.cs: Intern arrays used in generic arguments. 2010-04-28 Marek Safar A fix for bug #600398 * convert.cs: Actually use effective base type for the comparison. 2010-04-28 Marek Safar A fix for bug #600326 * ecore.cs: Pass arity to base member lookup. 2010-04-28 Marek Safar A fix for bug #573385 * expression.cs: MemberAccess is of generic type based on right arity length only. 2010-05-28 Marek Safar * cs-tokenizer.cs: Made tab size configurable. 2010-05-27 Marek Safar * attribute.cs: Ensure Obsolete members are defined before doing ctor look-up. 2010-05-27 Marek Safar * visit.cs: Add DOM visitor skeleton. * *.cs: Updated. 2010-05-27 Marek Safar * attribute.cs, codegen.cs: Drop COMPILER_ACCESS hack. 2010-05-27 Marek Safar * *.cs: Major rewrite of compiler internals to better work with unmodified System.Reflection.Emit. Some of the key changes are - TypeSpec replaces reflection specific System.Type. - All Type(TypeSpec) operations are now done in compiler therefore no dependency on SRE to inflate generic members and types or to query unclosed types. - MemberCache is now the only and full hierarchical topology. - Generic constraints are implemented properly. - And as a bonus compilation is on average 30% faster. 2010-04-15 Jb Evain * dmcs.exe.config: update the runtime version to .net 4.0 RTM. 2010-04-12 Marek Safar * expression.cs, attribute.cs, parameter.cs: More attribute type checks. 2010-04-12 Marek Safar A fix for bug #593342 * generic.cs, parameter.cs, argument.cs, field.cs, property.cs, decl.cs, roottypes.cs, constant.cs, nullable.cs, expression.cs, method.cs, ecore.cs, class.cs, delegate.cs, attribute.cs, codegen.cs: Add custom attribute encoder to deal with unfinished types and easier corlib bootstrap from its own types. 2010-03-26 Marek Safar * cs-parser.jay: Report invalid constraint types. 2010-03-16 Jb Evain * Makefile: rename the net_2_1 profile to moonlight. 2010-03-11 Marek Safar * statement.cs, cs-parser.jay: Use correct location for empty statements. 2010-03-11 Marek Safar * cs-parser.jay: Disable Location from expression. * generic.cs: Check constraints for overrides in the parser. 2010-03-09 Marek Safar * cs-parser.jay (GetLocation): Use an expression when available. 2010-03-04 Marek Safar A fix for bug #582579 * ecore.cs (FieldExpr): Don't optimize cross reference loads. 2010-03-04 Marek Safar A patch by kornelpal@gmail.com * dynamic.cs, anonymous.cs, rootcontext.cs, class.cs: Don't make compiler generated classes sealed by default. Emit and close top level compiler generated classes as well. * support.cs: Use RuntimeHelpers.GetHashCode. 2010-03-03 Rolf Bjarne Kvinge * Makefile: We need to use the internal bootstrapping gmcs for net_2_1_bootstrap too now. 2010-03-02 Raja R Harinath * expression.cs (IndexerAccess.ResolveAccessor): Add CS1540 check. 2010-03-02 Marek Safar * cs-tokenizer.cs: Missed few locations in previous fix. 2010-03-02 Marek Safar * cs-tokenizer.cs, argument.cs, dynamic.cs, assign.cs, anonymous.cs, nullable.cs, expression.cs, statement.cs, cs-parser.jay, cfold.cs: Report correct location for operator errors. 2010-03-02 Marek Safar * typemanager.cs (IsDynamicType): Don't check external types when the attribute is not external. 2010-02-24 Marek Safar A fix for bug #582579 * decl.cs (IsExposedFromAssembly): Use PartialContainer for parent modifiers. 2010-02-24 Marek Safar A fix for bug #581804 * ecore.cs: Fixed type comparison. 2010-02-08 Miguel de Icaza * namespace.cs (CompletionGetTypesStartingWith): Do not include private types in the completion results. * cs-parser.jay: Bubble completions after "from x in ?" and "from x ... let ?" 2010-02-17 Marek Safar * generic.cs, field.cs, decl.cs, cs-parser.jay: Simplify special constraint parsing. 2010-02-14 Miguel de Icaza * eval.cs: Do not do the report printer dance unless the user has set the DescribeTypes feature. 2010-02-10 Marek Safar * argument.cs, dynamic.cs, expression.cs: Track RC API changes. 2010-02-08 Marek Safar A fix for bug #577029 * anonymous.cs: Fixed TypeBuilder* check. 2010-02-06 Miguel de Icaza * eval.cs (CompileBlock): Also undo if there are problems during semantic analysis, fixes various cases where invalid C# code would be reported, but the internal changes would not be undone. 2010-02-03 Miguel de Icaza * driver.cs: Change the --fatal flag to allow a number to be passed, this ignores the first N fatal errors. Useful to debug errors that do not happen on the first hit. * cs-parser.jay (invocation_expression): accept both the CLOSE_PARENS and COMPLETE_COMPLETION, this allows completions inside an invocation. * driver.cs: Expose FatalErrors. * eval.cs: Initialize the printer's Fatal property from the Driver's FatalError flag, this allows csharp --fatal to work again. Add support for calling Describe (typeof (TYPE)) if the expression entered is a TYPE. 2010-02-02 Marek Safar A fix for bug #574991 * rootcontext.cs, class.cs, driver.cs: Hide enhanced warnings behind --lint. 2010-02-02 Marek Safar A fix for bug #575986 * expression.cs: Don't mutate typeof type definitions. 2010-01-28 Marek Safar * decl.cs: Use only one set of modifiers. 2010-01-26 Marek Safar A fix for bug #573329 * eval.cs: Don't disable error reporting completely on silent mode. 2010-01-25 Marek Safar A fix for bug #573312 * constant.cs, expression.cs, ecore.cs: Emit correct offset for pointer index of unknown size types greater than 2. 2010-01-15 Marek Safar * *.cs: Use only 1 member kind enum. 2010-01-15 Marek Safar * *.cs: Add event specification. 2010-01-14 Marek Safar * membercache.cs: Extracted from decl.cs. * *.cs: Put more infrastructure in place. 2010-01-13 Marek Safar * *.cs: Add property specification, unused yet. 2010-01-13 Marek Safar * property.cs: Move all property based declarations into a new file. 2010-01-13 Marek Safar * expression.cs (Conditional): Resolve reduced expression. 2010-01-13 Marek Safar * *.cs: Introduced non-generic method specification. 2010-01-07 Marek Safar * method.cs: Move all method based declarations into a new file. 2010-01-07 Marek Safar * *.cs: Extract field specification. 2009-12-17 Marek Safar * field.cs: Extracted from class.cs 2009-12-15 Marek Safar * attribute.cs (GetFixedBuffer): Work on field definition only. 2009-12-15 Marek Safar * *.cs: Clean up NET_4_0 conditional where possible. 2009-12-14 Rodrigo Kumpera support.cs (DynamicType): Assembly property returns the assembly builder. This is required due to how compiler context works in corlib. 2009-12-14 Marek Safar A fix for bug #564376 * assign.cs (LocalTemporary): Removed no longer needed special by-ref handling. 2009-12-11 Marek Safar * modifiers.cs, decl.cs, iterators.cs, const.cs, anonymous.cs, class.cs, delegate.cs, cs-parser.jay, enum.cs: Turn modifiers into enum for easier debugging. 2009-12-10 Marek Safar * decl.cs, anonymous.cs, class.cs: Sealed Define it's now main entry point. * parameter.cs, delegate.cs, dynamic.cs: Don't use builder methods directly. 2009-12-10 Marek Safar * cs-parser.jay, statement.cs: Handle parser error in code completition. 2009-12-10 Marek Safar * ecore.cs: Ignore base imported methods when they are already in method bag. * eval.cs: Handle non-existent keys. * report.cs, driver.cs: Make fatal work with console printer only. 2009-12-08 Rodrigo Kumpera * typemanager.cs (MakeGenericMethod): Fix stupid mistake. 2009-12-08 Rodrigo Kumpera * typemanager.cs: Add MakeGenericMethod that checks if the method is really the generic method definition. ecore.cs (MethodGroupExpr:IsApplicable): Use new TypeManager function to inflate generic methods. 2009-12-08 Marek Safar A fix for bug #561149 * anonymous.cs: Use actual type parameters when checking for generic method host. 2009-12-08 Marek Safar A fix for bug #561369 * expression.cs (DoNumericPromotion): Fixed typo. 2009-12-08 Marek Safar *.cs: Moving to generics world. cs-parser.jay: Removed current_array_type. 2009-12-07 Marek Safar *.cs: Moving to generics world. 2009-12-04 Marek Safar *.cs: Moving to generics world (day 2). 2009-12-03 Marek Safar *.cs: Moving to generics world. 2009-12-02 Marek Safar * typemanager.cs, parameter.cs, class.cs, delegate.cs, attribute.cs: Encode dynamic type attribute for elements where attributes cannot be used. 2009-12-01 Marek Safar argument.cs, assign.cs, expression.cs, cs-parser.jay: Named arguments by ref. 2009-12-01 Marek Safar A fix for bug #360455 * class.cs: Never report a unused warning for generic events to workaround wrong expression type. 2009-11-30 Marek Safar A fix for bug #558305 * decl.cs, class.cs: Check partial method definitions using correct flag. 2009-11-30 Marek Safar * argument.cs: Don't cache rarely used dynamic flag. 2009-11-27 Marek Safar * cs-parser.jay: Use jay global stacks (saves over 3MB for corlib). 2009-11-27 Marek Safar * ecore.cs (SimpleName): Removed no longer needed in_transit as Resolve is now non-reentrant (saves ~0.6MB for corlib). 2009-11-26 Marek Safar A fix for bug #545081 * decl.cs: Check private nested types of nested types recursively. 2009-11-26 Marek Safar A fix for bug #558305 * location.cs: Ignore self referencing #line directive 2009-11-26 Marek Safar A fix for bug #558292 * class.cs: Allow single unsafe fixed buffer fields. 2009-11-26 Marek Safar * expression: Optimize few more zero-based operations. 2009-11-26 Marek Safar * cs-tokenizer.cs, cs-parser.jay: Simplify literal parsing, also avoids boxing of literal values. 2009-11-26 Marek Safar * cs-tokenizer.cs, argument.cs, eval.cs, linq.cs, decl.cs, expression.cs, ecore.cs, location.cs, cs-parser.jay, attribute.cs, codegen.cs: LocatedToken redesing to avoid excessive allocation and boxing (saves ~7MB for corlib). Also fixes presise token location. 2009-11-25 Marek Safar * ecore.cs, cs-parser.jay: Keep parser structures local. Share common data buckers. 2009-11-24 Marek Safar * expression.cs: Lower static array initializer barrier. * support.cs, driver.cs: Share reader buffer. 2009-11-23 Marek Safar * cs-tokenizer.cs, support.cs: Some tokenizer optimizations. 2009-11-23 Marek Safar * cs-tokenizer.cs, support.cs: Use Dictionary instead of Hashtable, cleanup some obsolete code. 2009-11-20 Marek Safar * context.cs, expression.cs, ecore.cs, complete.cs: Cleaned up Expression.Resolve. 2009-11-20 Marek Safar * *.cs: Resolved expressions are never resolved again, this helps to uncover some not easy to find bugs and improve the performance. 2009-11-19 Marek Safar * *.cs: Made constant expressions fully compatible with any other expression. 2009-11-19 Marek Safar * *.cs: DoResolve is a worker method and has to be protected. 2009-11-18 Marek Safar * *.cs: More context specific handling. 2009-11-17 Marek Safar * *.cs: More context specific handling. 2009-11-16 Marek Safar * dynamic.cs, class.cs: Removed few fixed user types conversions. * symbolwriter.cs: Uses public ILOffset. 2009-11-13 Marek Safar A fix for bug #553650 * generic.cs: Another missing TypeToCoreType, still too many to fix. 2009-11-13 Marek Safar A fix for bug #555170 * class.cs, delegate.cs, enum.cs: Constants have to be available for parameters resolve. 2009-11-12 Marek Safar * typemanager.cs, argument.cs, support.cs, delegate.cs: Dynamic arrays. 2009-11-12 Marek Safar * argument.cs, context.cs, expression.cs, ecore.cs: Dynamic binding with a statically known candidate set. 2009-11-11 Scott Peterson * generic.cs: Made type inflation for generic constraint checks recursive. This fixes BGO #553655. 2009-11-11 Marek Safar * dynamic.cs, decl.cs, expression.cs, ecore.cs: More dynamic type checks. 2009-11-10 Marek Safar * typemanager.cs, generic.cs, parameter.cs, argument.cs, dynamic.cs, linq.cs, rootcontext.cs, ecore.cs, class.cs, delegate.cs, attribute.cs: Add some dynamic error checking. 2009-11-07 Marek Safar A fix for bug #553465 * expression.cs: Fixed mixed version of expression tree anonymous type. 2009-11-06 Marek Safar A fix for bug #553031 * linq.cs, expression.cs, class.cs, cs-parser.jay: Initialize expression tree version of anonymous type with members declaration. 2009-11-05 Marek Safar * parameter.cs: Handle nullable parameter default expression. * argument.cs, dynamic.cs, expression.cs, support.cs, ecore.cs, class.cs, attribute.cs: Check for wrong dynamic arguments. 2009-11-05 Marek Safar * statement.cs: Dynamic statements. 2009-11-04 Marek Safar * dynamic.cs, assign.cs, context.cs, expression.cs, ecore.cs: Compound assignments over dynamic type. 2009-11-03 Marek Safar * argument.cs, dynamic.cs, expression.cs, delegate.cs: Dynamic constructor arguments. 2009-10-30 Marek Safar * dynamic.cs, convert.cs, assign.cs, constant.cs, expression.cs, codegen.cs: Unary mutator on dynamic member access expression. 2009-10-29 Marek Safar A fix for bug #550580 * convert.cs: Don't eliminate explicit precission casts. 2009-10-28 Marek Safar A fix for bug #550404 * parameter.cs, iterators.cs, context.cs, anonymous.cs, expression.cs, statement.cs, ecore.cs: Quote any nested expression tree. 2009-10-27 Marek Safar * constant.cs, nullable.cs: Create nullable-null as LiftedNull constant. * class.cs: Allow nullable binary user operators. 2009-10-26 Marek Safar * expression.cs: Move binary expression optimization at the end of resolve. 2009-10-23 Marek Safar * constant.cs, nullable.cs, expression.cs, literal.cs, cfold.cs: Separate NullConstant from NullLiteral. 2009-10-23 Marek Safar * typemanager.cs, eval.cs, decl.cs, roottypes.cs, context.cs, anonymous.cs, expression.cs, rootcontext.cs, ecore.cs, class.cs, flowanalysis.cs, cs-parser.jay, driver.cs, codegen.cs: Split ModuleContainer. Add common unclosed member check routine. 2009-10-22 Marek Safar * argument.cs: Use literal flag for real literals only. * dynamic.cs: Use correct return type for custom delegates. 2009-10-22 Marek Safar * dynamic.cs, expression.cs: Pass logical binary flag to dynamic resolver. 2009-10-22 Marek Safar * dynamic.cs, ecore.cs: Dynamic invocation with void return type. 2009-10-21 Marek Safar * dynamic.cs, convert.cs, expression.cs, ecore.cs: Wrap array index conversion. 2009-10-21 Marek Safar * typemanager.cs, dynamic.cs, expression.cs: Don't resolve runtime binder flags. 2009-10-20 Marek Safar * argument.cs, dynamic.cs, expression.cs: Latest API update. 2009-10-19 Marek Safar * typemanager.cs, expression.cs: Dynamic array initializer. 2009-10-16 Marek Safar * typemanager.cs, rootcontext.cs: Clear -nostdlib flag when object is imported. 2009-10-16 Marek Safar A fix for bug #493523, #507067 * convert.cs, nullable.cs, expression.cs: Do implicit and explicit standard nullable conversion using underlying standard conversion and not full conversion. 2009-10-15 Marek Safar * dynamic.cs, expression.cs, ecore.cs, delegate.cs: Check return type in VerifyArgumentsCompat. 2009-10-15 Marek Safar * nullable.cs, expression.cs, statement.cs, namespace.cs, ecore.cs: Reject variable used with type arguments. 2009-10-14 Marek Safar * argument.cs, dynamic.cs, assign.cs, expression.cs, ecore.cs: Implement dynamic expressions assignment. 2009-10-14 Marek Safar * expression.cs: Build underlying expression when resolving unary mutators. 2009-10-14 Marek Safar * expression.cs: Emit enum array initializer using binary blob. 2009-10-08 Marek Safar * typemanager.cs, constant.cs: Optimize decimal constants which fit to long range. 2009-10-07 Marek Safar * typemanager.cs: Reset object_type. * assign: Made SimpleAssign public. 2009-10-06 Marek Safar * typemanager.cs, decl.cs, namespace.cs, ecore.cs, class.cs: Pass invocation assembly to IsThisOrFriendAssembly. 2009-10-05 Marek Safar * expression.cs: Equality comparison of generic parameter with class constraint. 2009-10-05 Marek Safar A fix for bug #543570 * generic.cs: Import predefined constraints correctly. 2009-10-02 Marek Safar * ecore.cs: Don't crash on overloads with optional paremeters where arguments count overflows. * parameter.cs: Import optional parameter constants using optional value type. 2009-10-01 Marek Safar * Makefile: Default is gmcs compiler. 2009-10-01 Marek Safar * cs-parser.jay: Fixed few NRE. 2009-10-01 Marek Safar * cs-parser.jay, driver.cs: Expose parser exception in verbose mode. 2009-09-30 Marek Safar * linq.cs, convert.cs, assign.cs, expression.cs, ecore.cs: Add ShimExpression, ImplicitCast. 2009-09-30 Marek Safar A fix for bug #542959 * delegate.cs: Emit correct delegate instance variable when there are static and non-static overloads. 2009-09-29 Marek Safar * dynamic.cs, linq.cs, anonymous.cs, expression.cs, statement.cs, ecore.cs, cs-parser.jay: Unary expression dynamic compiler. 2009-09-28 Marek Safar A fix for bug #542487 * ecore.cs: Resolve extension methods hidden by properties. 2009-09-25 Marek Safar * expression.cs, ecore.cs: More dynamic binary expressions. 2009-09-22 Marek Safar * nullable.cs, expression.cs: Fixed null lifted conversion for bitwise enum operations. 2009-09-22 Marek Safar * convert.cs, ecore.cs: Fixed explicit unsafe coversion of long values in checked context. 2009-09-22 Marek Safar * expression.cs, ecore.cs: Fixed array index constant conversion. 2009-09-20 Miguel de Icaza * expression.cs: Do not crash when MemberLookup returns something that is not a MemberExpr here. Report error 582 instead. Fixes #499988. 2009-09-18 Marek Safar * decl.cs, class.cs: Check protected property accessors. 2009-09-18 Marek Safar * dynamic.cs, assign.cs: Dynamic compound assignment. 2009-09-17 Marek Safar * expression.cs: Fixed compound assignment explicit conversion. 2009-09-17 Marek Safar * expression.cs, ecore.cs: Cannot infer variables from method group. 2009-09-16 Marek Safar * argument.cs, dynamic.cs, convert.cs, context.cs, anonymous.cs, constant.cs, nullable.cs, expression.cs, literal.cs, ecore.cs, codegen.cs: Dynamic binary operations scaffolding. 2009-09-15 Marek Safar * expression.cs: Fixes nullable promotion for enum type variables. 2009-09-11 Marek Safar * driver.cs, dynamic.cs: Reset more static variables. 2009-09-11 Marek Safar * dynamic.cs, expression.cs, rootcontext.cs, namespace.cs, ecore.cs, driver.cs: Introduced Expression::MakeExpression. 2009-09-11 Marek Safar * eval.cs: Exposed MessageOutput instead of cleaning up eval API. 2009-09-09 Marek Safar * eval.cs, report.cs: Use Console.Out for all eval error or warning output. 2009-09-09 Marek Safar A fix for bug #518707 * expression.cs (Is): Optimize only generic parameter type expression probing value type generic parameter. 2009-09-09 Marek Safar A fix for bug #532571 * ecore.cs: Check for simple name type arguments used with non-generic type. 2009-09-08 Marek Safar A fix for bug #497421 * generic.cs (CheckConstraint): Don't use buildin types to check for parameterless constructor. 2009-09-08 Marek Safar A fix for bug #537402 * generic.cs (CheckConstraint): Correctly inflate generic type arguments when checking generic method. 2009-09-08 Marek Safar A fix for bug #536463 * decl.cs (AddToContainer): Don't report collision between explicit and parameterless non-explicit members. 2009-09-08 Marek Safar * eval.cs: Reset more static stuff. 2009-09-07 Marek Safar A fix for bug #324625 * expression.cs, ecore.cs: Create nested generic type expression using declaring and not current type. 2009-09-07 Marek Safar * *.cs: Changed Report class to accept various output printers and be an instance class. An expression resolver can now use different message reporter for each call and Report.Error can safely throw an exception. Part of ongoing work to turn mcs into proper library. 2009-09-04 Marek Safar * statement.cs, ecore.cs: Removed error reporting from emit code. 2009-09-04 Marek Safar * cs-parser.jay, parameter.cs: Moved parser check out of constructor 2009-09-03 Marek Safar * anonymous.cs, expression.cs, statement.cs, cs-parser.jay: Moved parser checks out of constructors. 2009-09-02 Marek Safar * expression.cs, statement.cs, ecore.cs: Use common Report.Error. 2009-09-02 Marek Safar A fix for bug #535448 * anonymous.cs, class.cs: Copy return label between all contexts. 2009-09-02 Marek Safar A fix for bug #535395 * namespace.cs: Resolve context can be null. 2009-08-25 Marek Safar A fix for bug #533912 * generic.cs: Use correct context for constraints resolving. 2009-08-25 Marek Safar A fix for bug #532630 * driver.cs: Trim conditional symbols. 2009-08-25 Marek Safar * context.cs: New file. * *.exe.sources, *.csproj: Updated. 2009-08-25 Marek Safar * generic.cs, parameter.cs, decl.cs, statement.cs, namespace.cs, class.cs, generic-mcs.cs, codegen.cs: Add GetSignatureForError to IMembercontext, some small cleanups. 2009-08-24 Marek Safar * *.cs: Split ResolveContext and EmitContext. 2009-08-24 Marek Safar * *.cs: Only ResolveContext implements IMemberContext. 2009-08-21 Marek Safar * *.cs: Renamed IResolveContext to IMemberContext. 2009-08-21 Marek Safar * *.cs: Detached ResolveContext from EmitContext. 2009-08-21 Marek Safar * codegen.cs: Moved flow-analysis to BlockContext. 2009-08-21 Marek Safar * *.cs: Detached BlockContext from EmitContext. 2009-08-20 Gonzalo Paniagua Javier * statement.cs: avoid nullref when the return value of GetEnumerator() does not contain any MoveNext() method. 2009-08-19 Marek Safar * *.cs: Removed IResolveContext::GenericDeclContainer. 2009-08-19 Marek Safar * class.cs, delegate.cs: Changed Delegate to be TypeContainer based. 2009-08-19 Marek Safar * generic.cs, iterators.cs, expression.cs, statement.cs, ecore.cs, cs-parser.jay, attribute.cs, codegen.cs: Better error reports. 2009-08-18 Marek Safar * *.cs: Removed boolean fields from EmitContext. 2009-08-18 Marek Safar * *.cs: Add IResolveContext::IsStatic. 2009-08-18 Marek Safar * *.cs: Moved TopBlock's methods from EmitContext to TopBlock. 2009-08-17 Marek Safar * *.cs: Removed DeclContainer from EmitContext. 2009-08-17 Marek Safar * *.cs: Add IResolveContext::CurrentTypeParameters. 2009-08-14 Marek Safar * *.cs: Removed TypeContainer and ContainerType from EmitContext. 2009-08-14 Marek Safar * decl.cs, expression.cs, namespace.cs, ecore.cs, class.cs, codegen.cs: Add IResolveContext::LookupExtensionMethod. 2009-08-13 Marek Safar * decl.cs: Look in PartialContainer for parent type parameters. 2009-08-13 Marek Safar * decl.cs, namespace.cs, ecore.cs, class.cs, attribute.cs, codegen.cs: Add IResolveContext::LookupTypeParameter. 2009-08-13 Marek Safar * lambda.cs, expression.cs, statement.cs, namespace.cs, ecore.cs: Moved resolved logic from Emit to Resolve. 2009-08-13 Marek Safar * parameter.cs, decl.cs, roottypes.cs, class.cs, attribute.cs, codegen.cs: Reworked atttributes handling of ResolveContext. 2009-08-12 Marek Safar * decl.cs, ecore.cs, class.cs, attribute.cs, codegen.cs: Pushed LookupNamespaceOrType to ResolveContext. 2009-08-12 Marek Safar * typemanager.cs, decl.cs, expression.cs, namespace.cs, ecore.cs, class.cs: Removed unused parameters and methods. 2009-08-11 Marek Safar * generic.cs, lambda.cs, anonymous.cs, statement.cs, generic-mcs.cs, codegen.cs: Finding the best common type of a set of expressions for lambda statements. 2009-08-07 Marek Safar * dynamic.cs, expression.cs: More dynamic conversions. 2009-08-06 Miguel de Icaza * generic.cs: This loop was incorrect, it was increment ii, but checking for `i'. This was a change introduced to fix #327497, now we fix #424012. * class.cs: Catch another case for cs0533 error, fixes #324782. 2009-08-06 Rodrigo Kumpera * typemanager.cs (GetGenericArguments): SRE returns null for generic methods on type builder instances if they are not generic themselves. For example, for Foo::Bar() it returns null, but not for Foo::Bar<>() or Foo::Bar(). 2009-08-05 Marek Safar * argument.cs, dynamic.cs, expression.cs, ecore.cs, class.cs, delegate.cs: Work on dynamic binding. 2009-08-04 Marek Safar A second fix for bug #525342 * class.cs: Attach partial method attributes to method implementation. 2009-08-03 Marek Safar * typemanager.cs, parameter.cs, support.cs, class.cs: Dynamic type restrictions. * rootcontext.cs: Default to langversion v4. 2009-08-03 Marek Safar * pending.cs: Check return type before member info is set. 2009-08-03 Marek Safar * anonymous.cs: Fully initialize generic hoisted field expression. 2009-08-02 Miguel de Icaza * cs-parser.jay: Flag variables declared on the interactive shell as used to prevent the 168 warning about local variable not being used. 2009-07-31 Marek Safar * parameter.cs, dynamic.cs, support.cs, class.cs, delegate.cs, attribute.cs: Emit dynamic export attribute. 2009-07-30 Marek Safar * expression.cs: More verifier work. 2009-07-29 Marek Safar * nullable.cs: Fixed SRE crash during corlib compilation. 2009-07-29 Marek Safar * generic.cs, typemanager.cs, decl.cs, iterators.cs, convert.cs, nullable.cs, expression.cs, ecore.cs, class.cs, attribute.cs: More TypeManager.TypeToCoreType needed. 2009-07-29 Marek Safar * anonymous.cs: Update after recent SRE fixes. 2009-07-28 Marek Safar * typemanager.cs, expression.cs, ecore.cs, delegate.cs: Use correct version of GetFieldHandle for fields of generic types. 2009-07-27 Marek Safar * typemanager.cs, argument.cs, convert.cs, assign.cs, expression.cs, ecore.cs: Add TypeManager.IsDynamicType, PredefinedAttributes.Dynamic. 2009-07-27 Marek Safar A fix for bug #415375 * expression.cs: Fixed object and reference type parameter comparison. 2009-07-27 Marek Safar A fix for bug #525342 * class.cs: Attach partial method attributes to method implementation. 2009-07-24 Marek Safar * argument.cs, dynamic.cs, expression.cs, class.cs, attribute.cs: Dynamic arguments. 2009-07-24 Marek Safar * anonymous.cs (MutateField): Add imported types handling. 2009-07-23 Marek Safar * expression.cs, delegate.cs: Moved arguments resolve into their counterparts expressions. Removed argument resolve from CollectionElementInitializer. 2009-07-23 Marek Safar A fix for bug #523683 * convert.cs, delegate.cs: Use common overload mechanism for method group conversion check. 2009-07-22 Marek Safar A fix for bug #523899 * generics.cs: Exact type inference with other bound types. 2009-07-22 Raja R Harinath Don't complain when the same type is implemented by the output assembly as well as multiple referenced assemblies * namespace.cs (RootNamespace.LookupTypeReflection): Add 'must_be_unique' flag. (GlobalRootNamespace): Update to changes. (Namespace.LookupType): Pass 'must_be_unique' only when we don't already have a type in hand. 2009-07-22 Marek Safar * expression.cs: More verifier instrumentation. * statement.cs: Do proper throw expression conversion. 2009-07-22 Marek Safar A fix for bug #522789 * expression.cs: Mutate invocation return type. 2009-07-16 Marek Safar * anonymous.cs: Split assignable and readonly generated variable references. 2009-07-16 Marek Safar A fix for bug #521671 * statement.cs: Fixed crash when checking missing type. 2009-07-16 Marek Safar * typemanager.cs, generic.cs, argument.cs, linq.cs, convert.cs, assign.cs, expression.cs, statement.cs, support.cs, ecore.cs, class.cs, driver.cs: Work on dynamic binding. * dynamic.cs: New file. * *.sources, *.proj: Updated. 2009-07-15 Marek Safar * expression.cs (Conditional): Avoid double Resolve. 2009-07-13 Marcus Griep * ecore.cs: Fix obscure bug with resolving members of interfaces that hide parent interface members. Fixes bug #444388 and corrects bug #323096 2009-07-13 Marek Safar * expression.cs (LocalVariableReference): Bounce resolve. 2009-07-10 Marek Safar * typemanager.cs, lambda.cs, parameter.cs, convert.cs, anonymous.cs, expression.cs, literal.cs, ecore.cs, complete.cs: Moved internal types to new class. * support.cs: New dynamic type wrapper. 2009-07-08 Marek Safar * ecore.cs, cs-parser.jay: Better error reporting for implicitly typed local variable. 2009-07-06 Marek Safar A fix for bug #519005 * anonymous.cs: Use null_type as no return type placeholder. 2009-07-02 Marek Safar * generic.cs: Handle type inference of identical type parameters with different bounds. 2009-07-01 Marek Safar * expression.cs, class.cs: Events variance. * cs-parser.jay: Interface events error messages. 2009-07-01 Marek Safar * generic.cs, argument.cs: Updated type inference logic to C# 4.0. 2009-06-29 Marek Safar * parameter.cs, convert.cs, expression.cs, class.cs: Default parameter expression can be value-type New. * cs-parser.jay: Clean up too many parameter modifier boolean flags. 2009-06-26 Marek Safar * generic.cs, argument.cs, expression.cs, ecore.cs, cs-parser.jay: Implemented C# 4.0 named arguments. 2009-06-24 Marek Safar * typemanager.cs, parameter.cs, iterators.cs, convert.cs, expression.cs, ecore.cs, delegate.cs: Removed unnecessary ArgList parameter modifier. Also fixes bug #515497. 2009-06-24 Marek Safar * *.cs: Replaced ArrayList with Arguments in need of a nonsequential arguments expression to be implemented. *.sources: Add argument.cs 2009-06-23 Marek Safar * parameter.cs: Moved GetParameterIndexByName to base class. * expression.cs, statement.cs, ecore.cs, delegate.cs: Removed unused AType. Use argument's version of GetExpressionTree. 2009-06-22 Marek Safar * expression.cs, cs-parser.jay, attribute.cs, codegen.cs: Named arguments grammar. 2009-06-17 Marek Safar A fix for bug #514096 * class.cs: Allow IntPtr/UIntPtr fields to be volatile. 2009-06-17 Marek Safar * expression.cs: The first multi-dimensional array nested array initializers was not checked. * statement.cs (Switch): Fixed error message to reflect 2.0 changes. 2009-06-17 Marek Safar A fix for bug #513400 * nullable.cs (EmitEquality): Operands emit could be simplified for built-in types when we now emit user operators differently. 2009-06-16 Marek Safar * ecore.cs: Report inaccessible delegate methods correctly. 2009-06-16 Marek Safar * parameter.cs, expression.cs, ecore.cs, class.cs, delegate.cs, cs-parser.jay: Implemented C# 4.0 optional parameters. 2009-06-16 Marek Safar * driver.cs: Removed broken DefineManifestResource. 2009-06-16 Raja R Harinath * Makefile [net_2_0_bootstrap]: Don't explicitly mention net_1_1. Use $(BOOTSTRAP_PROFILE) instead. 2009-06-12 Jb Evain * rootcontext.cs: add a Platform field. * driver.cs: handle /platform. * codegen.cs: pass the proper flags according to the platform when saving the assembly. 2009-06-11 Marek Safar * parameter.cs, const.cs, report.cs, cs-parser.jay, attribute.cs: Add optional parameters grammar. 2009-06-10 Marek Safar * eval.cs, anonymous.cs, report.cs, rootcontext.cs, cs-parser.jay, driver.cs: Split lang version and metadata version. 2009-06-10 Marek Safar * decl.cs: Better overload ctor collision error message. 2009-06-05 Jb Evain * driver.cs (EmbededResource): avoid using an internal method in gmcs to embed manifest resources. 2009-06-04 Sebastien Pouliot * generic.cs, parameter.cs: Avoid using 'var' so we can bootstrap the compiler from older mono versions (like moon's bots) 2009-06-04 Marek Safar * namespace.cs (LookupTypeReflection): Ignore collisions between forwarded types. 2009-06-04 Marek Safar * codegen.cs: Enabled generic type forwarders. 2009-06-04 Marek Safar * dmcs.*: Add another version of SRE compiler. 2009-06-03 Marek Safar * generic.cs, typemanager.cs, parameter.cs, convert.cs, generic-mcs.cs: Fixed variant type conversions. 2009-06-02 Marek Safar A fix for bug #507863 * codegen.cs: Fixes a crash on invalid string value attribute. 2009-06-01 Marek Safar A fix for bug #508334 * typemanager.cs, parameter.cs, convert.cs, expression.cs, ecore.cs, cs-parser.jay: Fully import __arglist modifier. 2009-05-29 Marek Safar * generic.cs, typemanager.cs, parameter.cs, ecore.cs, class.cs, delegate.cs, generic-mcs.cs: Rewrote type variance checks to actually work with closed generic types. 2009-05-27 Alan McGovern * class.cs, decl.cs, delegate.cs, parameter.cs: Fix the build by replacing the use of 'var' with the actual type. 2009-05-27 Marek Safar * generic.cs, parameter.cs, decl.cs, ecore.cs, class.cs, delegate.cs cs-parser.jay, generic-mcs.cs: Report wrong variant types declarations. * driver.cs, rootcontext.cs, report.cs: Add 3.0 language version filter. 2009-05-26 Rodrigo Kumpera Marek Safar A fix for bug #377509 * parameter.cs: Use predefined and not empty name for implicit setters. 2009-05-21 Marek Safar * class.cs: Don't report wrong warnings for event fields. 2009-05-21 Marek Safar A fix for bug #504667 * class.cs: Check for static class using parent container instead of parent type. 2009-05-08 Marek Safar A fix for bug #496922 * expression.cs: Always use temporary variable when using object initializer. 2009-04-28 Marek Safar A fix for bug #495112 * class.cs (IsUnmanagedType): Handle recursive unmanaged types using local cache. 2009-04-27 Miguel de Icaza * driver.cs: Add a flag to work as a replacement for CSC in VS. 2009-04-24 Miguel de Icaza * complete.cs: No idea how gonzalo got a null in the list, but avoid crashing. 2009-04-24 Miguel de Icaza * complete.cs (CompletionElementInitializer): New completion class to support completing inside a C# 3 element initializer, so this allows completion for Silverlight situations where it is very common to do: new TextBlock () { Fo (CompletionSimpleName): Expose the prefix that was passed to the simple name. * cs-parser.jay (object_or_collection_initializer): Add support for element_initializers. * expression.cs (CollectionOrObjectInitializers.DoResolve): special case completion expressions as this method aggressively collects data before it operates, and errors were being thrown earlier than we were able to complete. 2009-04-23 Miguel de Icaza * eval.cs: Make getcompletions silent and enable debugging output if the -v option is passed. * namespace.cs (NamespaceEntry.CompletionGetTypesStartingWith): Consider looking up the namespace that matches the prefix being used. This is part of the support for allowing completions like: `System.Co' to complete to System.Console. * complete.cs (CompletionSimpleName.AppendResults): Make this routine reusable. 2009-04-21 Raja R Harinath * cs-parser.jay (GetTokenName): Mark GENERATE_COMPLETION and COMPLETE_COMPLETION as internal. 2009-04-17 Miguel de Icaza * complete.cs: Include namespace resolution in simple names as well as global types and types in the using scope in the resolution. * namespace.cs: Supporting infrastrcture to provide completions based on the current using scope. * eval.cs: Introduce an entry point that allows for initialization to return a list of the files passed on the command line. 2009-04-14 Marek Safar A fix for bug #494243 * report.cs (SymbolRelatedToPreviousError): Fixed NRE. 2009-04-13 Marek Safar A fix for bug #493887 * statement.cs: Don't skip string multi-section with default or null label when populating string hashtable. 2009-04-06 Marek Safar A fix for bug #492329 * expression.cs (New): Load variable when assigning type parameter to ref variable. 2009-04-06 Marek Safar A fix for bug #488960 * decl.cs: Compare MVAR types using non-null values. 2009-03-27 Marek Safar * typemanager.cs, expression.cs: Removed unused nullable checks. 2009-03-27 Marek Safar * *.cs: Removed some gmcs conditionals. 2009-03-26 Marek Safar * generic.cs, support.cs: Moved generics stuff out of support.cs 2009-03-24 Marek Safar * ecore.cs, expression.cs: Use queried type for MethodGroupExpr DeclaringType. 2009-03-23 Marek Safar * attribute.cs: Consider all members for error reporting when checking named arguments. 2009-03-23 Marek Safar A fix for bug #487625 * namespace.cs: Use a warning for all predefined type conflicts. 2009-03-23 Marek Safar A fix for bug #485706 * statement.cs: Explicitly type catch type argument to pass verifier check. 2009-03-22 Miguel de Icaza Initial support to provide code completion facilities to consumers of the evaluator API. * cs-tokenizer.cs (CompleteOnEOF): this new property is used to support the completion engine. When we reach the end of the input stream instead of returning EOF, when this flag is true the tokenizer instead produces: One GENERATE_COMPLETION token: this token then must be handled in the grammar at every point where the user would likely request a completion. As many COMPLETE_COMPLETION tokens as necessary. These tokens are generated to assist the parser in unwinding and producing a valid parse tree. The parser rules do not have to be perfect, the parser needs to be augmented with judicious use of GENERATE_COMPLETION tokens to improve the areas where we can provide completion and the parser needs to add support for COMPLETE_COMPLETION tokens in productions to make them work. It is common to not have enough support for COMPLETE_COMPLETION under certain rules and that even if we generated the GENERATE_COMPLETION token that the resulting tree will be invalid due to the missing rules that support COMPLETE_COMPLETION. The final EOF token is produced by having the parser notify the tokenizer when it reaches the root production that the next token should be EOF. * support.cs (CompletionResult): New Exception. This exception is thrown to return the completion results when one of the special completion expressions is reached. This exception is thrown by the completing ExpressionStatements classes that live in complete.cs * complete.cs (CompletingExpression): a new base class for completing expressions. This derives from the ExpressionStatement class and not from Expression as it allows completion to happen not only where expressions are expected in the grammar, but also where statements are expected. (CompletionSimpleName): A new class used to provide completions for SimpleNames. This currently only resolves to local variables from the evaluator context (GetVars call). (CompletionMemberAccess): Implements support for completing member access patterns. * cs-parser.jay: Add support for completion in a few places. * eval.cs (GetCompletions): New public API for the evaluator that returns a list of possible completions given the input. The return value is an array of completions * anonymous.cs (Compatible): If the exception thrown from the resolved expression is a CompletionResult exception let that one through instead of printing a diagnostic error in the try/catch. < 2009-03-22 Miguel de Icaza * * driver.cs (Main): Use Environment.Exit to quit quickly and prevent the compiler from doing the usual wait for helper thread to terminate. This is to prevent a slowdown that was reported by Gonzalo on ASP.NET 2009-03-19 Marek Safar * ecore.cs: Load build-in types directly instead of accessing an internal field. 2009-03-18 Marek Safar * ecore.cs: Always use unbox.any when available. 2009-03-18 Marek Safar * class.cs: Always set TypeAttributes.BeforeFieldInit conditionally. 2009-03-17 Marek Safar * generic.cs: Removed obsolete version of type inference. 2009-03-16 Marek Safar * typemanager.cs, decl.cs, roottypes.cs, anonymous.cs, nullable.cs, expression.cs, rootcontext.cs, namespace.cs, ecore.cs, class.cs, delegate.cs, flowanalysis.cs, cs-parser.jay, driver.cs, attribute.cs, codegen.cs: Changed RootTypes to be ModuleContainer. 2009-03-11 Marek Safar A fix for bug #482996 * anonymous.cs: Make sure we are not infering return type when checking type compatibility. 2009-03-11 Marek Safar * typemanager.cs, generic.cs, parameter.cs, decl.cs, const.cs, rootcontext.cs, namespace.cs, class.cs, delegate.cs, driver.cs, generic-mcs.cs, attribute.cs, codegen.cs: Maintain predefined attributes in their own structure. Needed when accessing their properties before they are resolved. 2009-03-09 Marek Safar * cs-tokenizer.cs: Optimized GetKeyword using an array instead of hashtable (~10x faster). * driver.cs: Removed wrong Reset. 2009-03-08 Marek Safar * class.cs: Use correct common base type for unmanaged delayed check. * rootcontext.cs: Wrap unhandled exception. 2009-03-06 Raja R Harinath Make SeekableStreamReader self-tuning and arbitrarily seekable * support.cs (SeekableStreamReader.ResetStream): New. Allocates the buffer. (SeekableStreamReader.Position.set): Use it. Simplify logic which, as a side-effect, makes it arbitrarily-seekable. Tune the buffer size when the stream needs to be re-read from the beginning. 2009-03-05 Marek Safar A fix for bug #480100 * parameter.cs: A parameter is not hoisted when used directly as ET. 2009-03-04 Marek Safar * statement.cs: Fixed an issue when using variable is of interface type. 2009-03-03 Marek Safar A fix for bug #480319 * report.cs, driver.cs: Support -warnaserror-: option. 2009-03-03 Marek Safar A fix for bug #480867 * typemanager.cs, expression.cs, ecore.cs: Changed method group expression to have no valid type. 2009-03-03 Marek Safar A fix for bug #481258 * class.cs: Set extension method flag in partial container. 2009-03-03 Marek Safar * statement.cs, typemanager.cs: Use expression for StringEmitter. * attribute.cs: Add sanity check. 2009-02-27 Marek Safar * class.cs: Add external constructor error. 2009-02-26 Marek Safar A fix for bug #475354 * convert.cs, nullable.cs, expression.cs, statement.cs: Emit correctly user defined nullable equality operators. 2009-02-25 Marek Safar A fix for bug #479532 * expression.cs: Implement NewInitialize::AddressOf. 2009-02-25 Marek Safar A fix for bug #413633 * expression.cs: Iterate all base class-constraint types. 2009-02-24 Marek Safar A fix for bug #479209 * literal.cs: Mutate null underlying type. 2009-02-24 Marek Safar A fix for bug #476295 * convert.cs: Avoid wrapping implicitly convertible reference type. 2009-02-23 Marek Safar * iterators.cs: Create MemberName correctly. 2009-02-23 Marek Safar A fix for bug #478655 * literal.cs: Check also underlying null type conversion. 2009-02-21 Marek Safar * generic.cs, ecore.cs, class.cs: Removed redundant AsAccessible. 2009-02-20 Marek Safar A fix for bug #477447 * statement.cs: Add reference to correct parent storey when this is accessible from deep children storey (more than 1 level). 2009-02-19 Marek Safar A fix for bug #475860 by David Mitchell * class.cs: Define base type members before setting up member cache. 2009-02-18 Marek Safar A fix for bug #477378 * nullable.cs, expression.cs, statement.cs: More precise null type sanity checks. 2009-02-18 Marek Safar A fix for bug #472805 * typemanager.cs, namespace.cs: Import only visible extension method types. 2009-02-18 Marek Safar A fix for bug #476895 * attribute.cs: Use correct resolve context for attribute type. 2009-02-18 Marek Safar A fix for bug #476266 * anonymous.cs: Mutate multi-dimensional arrays. 2009-02-18 Marek Safar A fix for bug #476400 * statement.cs, expression.cs: Removed wrong Dispose optimization. 2009-02-18 Marek Safar A fix for bug #476811 * generics.cs: Fixed null-literal check. 2009-02-17 Marek Safar * typemanager.cs, convert.cs, flowanalysis.cs, driver.cs, expression.cs, ecore.cs, rootcontext.cs, eval.cs, class.cs: More messing with static variables. 2009-02-16 Marek Safar A fix for bug #475965 * generics.cs: Check generic parameter type after extracting from Expression. 2009-02-16 Marek Safar A fix for bug #475823 * convert.cs, expression.cs, literal.cs, ecore.cs, cfold.cs: Add typed-null support. 2009-02-14 Marek Safar * modifiers.cs, decl.cs, ecore.cs, class.cs, flowanalysis.cs: Simplified event field definition using backing field and not field builder directly. * expression.cs (EmitLdArg): Optimize fast paths. 2009-02-13 Marek Safar A fix for bug #475327 * expression.cs (ArrayCreation): Don't mutate values optimized away. 2009-02-13 Marek Safar A fix for bug #475342 * cs-parser.jay: Using 'super' instead of 'base' to call base constructor crashes compiler. 2009-02-13 Marek Safar A fix for bug #475354 * expression.cs (Constantify): Add nullable types. * const.cs (EmitDecimalConstant): Avoid explicit cast. 2009-02-12 Marek Safar A fix for bug #475246 * expression.cs: More broken flowanalysis hacking needed. 2009-02-12 Marek Safar * attribute.cs: Compare only ref/out array modifiers. 2009-02-11 Marek Safar * statement.cs: Use member cache when looking for foreach members. 2009-02-11 Marek Safar * expression.cs: Don't expose internal initializer types. * statement.cs: Check also explicit conversions for goto case. 2009-02-11 Marek Safar * convert.cs, statement.cs: Removed usage of IsAssignableFrom. 2009-02-10 Marek Safar * *.cs: Replace null-type with NullLiteral where appropriate. 2009-02-09 Marek Safar * expression.cs: Initializer of reference argument use temporary variable to be verifiable. * parameter.cs: Share EmitLdArg. 2009-02-09 Marek Safar A fix for bug #473559 * class.cs: Fixed: Not reporting error about nested class with the same name. 2009-02-06 Scott Peterson Contributed under the MIT/X11 license. * generic.cs: Added VerifyVariantTypeParameters which performs new variance verification logic. The old logic, based on the spec, was wrong because the spec is full of LIES! * generic-mcs.cs: Stubbed out the VerifyVariantTypeParameters method. *typemanager.cs: Moved variance verification logic to GenericTypeExpr. * class.cs: * ecore.cs: Added calls to the new variance verification logic. * parameter.cs: * delegate.cs: Removed calls to the old variance verification logic. 2009-02-06 Marek Safar * delegate.cs: Use cached Invoke method directly. 2009-02-06 Marek Safar * expression.cs: Emit expression tree for hoisted variable access. 2009-02-04 Marek Safar * namespace.cs: Add better extension class check. 2009-02-05 Scott Peterson * generic.cs: Fixed typeo (TypeParameter.Variacne). 2009-02-04 Scott Peterson This patch adds initial generic variance support to the compiler. It is contributed under the MIT/X11 license. * typemanager.cs: Modified ImplementsInterface to check variance. Added VerifyVariantTypeParameters which checks the specified type to see if it uses a variant type parameter as a type argument (which is not allowed). Added IsVariantOf which determins if the first type is a variant of the second. NOTE: This only supports reference types at the moment to conform with the current level of VM support. When the VM supports value types, this will follow step. * generic.cs: Added the Variance enum. Added a Variance property to TypeParameter and added variance support to definition phase. Added a Variance property to TypeParameterName. Also check to make sure that no variant types appear in generic method parameters. * cs-tokenizer.cs: Modified parse_less_than to tokenize the variance keywords if the langversion supports it. * parameter.cs: Added Parameter.VerifyNoVariantTypeParameters to ensure that variant types are only used in legal positions. Also added ParametersCompiled.VerifyNoVariantTypeParameters to check all of its parameters. * decl.cs: Construct TypeParameter with the variance information. * convert.cs: Checks variance in ImplicitReferenceConversionExists and ImplicitConversionStandard. * rootcontext.cs: Added new "Future" language version. * class.cs: In TypeContainer.DoDefineMembers, ensure that contravariant type parameters are not used as type arguments in interface inheritance. In MemberBase.DoMemberDependentChecks, ensure that contravariant type parameters are not used as method return types. In MemberBase. ResolveMemberType, ensure that variant type parameters are not used as type arguments. Also call VerifyNoVariantTypeParameters on every set of parameters which are resolved. * delegate.cs: Modified Delegate.Define to ensure that variant parameters are not used as type arguments and that a contravariant parameter is not used as the return type. Also call VerifyNoVariantTypeParameters on the delegate parameters. * cs-parser.jay: Modified grammar to support "in" and "out" keywords to specify generic variance. * driver.cs: Added support for LanguageVersion.Future in the form of "-langversion:future". * generic-mcs.cs: Stubbed out new members in generic.cs. 2009-02-03 Marek Safar * class.cs, generic.cs: Emit type parameter constraints for nested types. 2009-02-02 Marek Safar A fix for bug #471213 * class.cs: Avoid emitting backing field for abstract event fields. 2009-02-01 Marek Safar A fix for bug #359731 * cs-tokenizer.cs, cs-parser.jay: Correctly parse nested query expressions. 2009-01-30 Marek Safar A fix for bug #470767 * statement.cs: Introduced BlockScopeExpression, needed when expression tree conversion has to emit scope variables. 2009-01-29 Marek Safar * class.cs: Remove duplicate CallingConvention. 2009-01-29 Marek Safar *.cs: Rename Parameters to ParametersCompiled and ParametersImported when I finally found the right naming convention. 2009-01-29 Marek Safar * cs-tokenizer.cs: Put back different open parens optimization. 2009-01-28 Marek Safar A fix for bug #470227 * cs-tokenizer.cs: Remove too agressive parser optimization. 2009-01-28 Marek Safar A fix for bug #324319 * class.cs: Remove too early base type resolve. 2009-01-27 Marek Safar A fix for bug #324319 * ecore.cs: Explicitly type null when assigning to type argument to make pass verifier check. 2009-01-27 Marek Safar * anonymous.cs: Fixed recent regression when initializing captured this. 2009-01-26 Marek Safar A fix for bug #469019 * anonymous.cs: Use all parent type parameters when instantiating nested generic storey. 2009-01-26 Marek Safar * expression.cs: Check for null instance methodgroup expression. 2009-01-26 Marek Safar A fix for bug #469244 * cs-tokenizer.cs, cs-parser.jay: Fixed parsing of nullable type instance inside a conditional expression. 2009-01-23 Marek Safar * typemanager.cs, generic.cs, parameter.cs, decl.cs, anonymous.cs, expression.cs, report.cs, ecore.cs, attribute.cs: Use common GetElementType and HasElementType. IsValueType clean up. 2009-01-23 Marek Safar * nullable.cs: Use common EmitCall. * expression.cs: Emit constraint. for virtual calls only. 2009-01-23 Marek Safar * typemanager.cs, generic.cs, eval.cs, convert.cs, const.cs, expression.cs, statement.cs, rootcontext.cs, ecore.cs, class.cs, driver.cs, attribute.cs, enum.cs: Split IsValueType and IsStruct checks. 2009-01-22 Jb Evain * anonymous.cs: make anonymous types' ToString implementation match what csc outputs. 2009-01-21 Marek Safar * typemanager.cs, ecore.cs, iterator.cs: TypeLookupExpression clean up. 2009-01-17 Marek Safar * convert.cs, ecore.cs: Explicitly casts type arguments to pass verifier checks. 2009-01-16 Marek Safar * nullable.cs (LiftedBinaryOperator): Check for all possible null expressions. 2009-01-15 Marek Safar A fix for bug #466634 * statement.cs: Add reference for nested storey when only this is captured. 2009-01-15 Marek Safar A fix for bug #466474 * codegen.cs: Emit SecurityPermissionAttribute when -unsafe option was specified. 2009-01-15 Marek Safar * iterators.cs, anonymous.cs, expression.cs, statement.cs, ecore.cs: Fixed nested stories parent referencing process. Also fixes #463985. 2009-01-06 Marek Safar * decl.cs, iterators.cs, expression.cs, statement.cs, doc.cs, class.cs, cs-parser.jay, codegen.cs: Clean up destructor implementation. Also fixes #463108. 2009-01-05 Marek Safar A fix for bug #416109 * decl.cs: Issue correct CLSAttribute warning location. 2009-01-05 Marek Safar A fix for bug #456775 * attribute.cs: Use attribute owner scope when resolving attribute arguments. 2009-01-05 Marek Safar A fix for bug #457257 * decl.cs: Fixed incorrect member declaring type comparison. 2009-01-05 Marek Safar A fix for bug #460896 * driver.cs: Handle /RES resources as embeddable. 2009-01-05 Marek Safar A fix for bug #462515 * ecore.cs: Report inacessible members upwards. 2009-01-05 Marek Safar A fix for bug #463190, #463192 * decl.cs, namespace.cs: Also import internal extension classes. 2009-01-04 Marek Safar A fix for bug #463415 * generic.cs: Use right index for RemoveDependentTypes. 2009-01-02 Marek Safar A fix for bug #463196 * expression.cs: Fixed enum to null comparison. 2009-01-02 Marek Safar A fix for bug #463121 * nullable.cs: Fixed nullable user equality operator comparison. 2009-01-02 Marek Safar A fix for bug #462950 * class.cs, decl.cs: Use full explicit name when defining automatic property backing field. 2009-01-02 Marek Safar A fix for bug #462592 * pending.cs: Emit type arguments for generic proxy method. 2008-12-30 Marek Safar * expression.cs (As): Mutate all type arguments. 2008-12-29 Marek Safar A fix for bug #462622 * anonymous.cs: Resolve anonymous type GetHashCode in unchecked context. 2008-12-29 Marek Safar A fix for bug #450782 * ecore.cs: Consider more variables of form V.I to be fixed. 2008-12-29 Marek Safar A fix for bug #460712 * typemanager.cs: Core types could be imported. 2008-12-28 Marek Safar A fix for bugs #460847, #460772, #458049, #457339, #447807 * generic.cs, parameter.cs, lambda.cs, linq.cs, anonymous.cs statement.cs, ecore.cs, class.cs, delegate.cs, flowanalysis.cs cs-parser.jay, driver.cs: LINQ implementation upgrade to deal with user lambdas used inside query clauses. 2008-12-18 Marek Safar A fix for bug #460229 * cs-tokenizer.cs: Ignore wrongly placed BOM markers. 2008-12-18 Marek Safar A fix for bug #459952 * decl.cs, namespace.cs: Use common CheckAccessLevel. 2008-12-18 Marek Safar A fix for bug #459630 * convert.cs: Enum to valuetype conversion is not allowed. 2008-12-18 Marek Safar A fix for bug #457087 * generic.cs: Don't crash when constraint comes from type declaration. 2008-12-16 Marek Safar A fix for bug #459221 * anonymous.cs, statement.cs: Delay only captured this initialization. 2008-12-12 Marek Safar A fix for bug #457489 * anonymous.cs, statement.cs: Split anonymous storey instantiation and initialization to capture scope initializers correctly. 2008-12-11 Marek Safar * generic.cs, parameter.cs, expression.cs, statement.cs, doc.cs: ParameterReference refactoring. 2008-12-03 Marek Safar * typemanager.cs, namespace.cs, driver.cs: Allow ExtensionAttribute to be imported from any assembly. 2008-12-03 Marek Safar * parameter.cs, lambda.cs, linq.cs, iterators.cs, anonymous.cs statement.cs, class.cs, cs-parser.jay: Removed duplicate parameters from anonymous method and lambda expression. 2008-12-01 Marek Safar A fix for bug #448560 * expression.cs (As): Box any generic type arguments to be verifiable. 2008-11-29 Raja R Harinath Add tripwire for implicit conversion bugs * ecore.cs (MethodGroupExpr.Error_ArgumentCountWrong): New helper for CS1501 error. (MethodGroupExpr.OverloadResolve): Add sanity check between IsApplicable and VerifyArgumentsCompat. (VerifyArgumentsCompat): Report CS1501 where appropriate. 2008-11-29 Raja R Harinath Fix build break in System.Data_test * convert.cs (ImplicitConversionExists): Move NullLiteral conversions ... (ImplicitStandardConversionExists): ... here. 2008-11-28 Marek Safar * literal.cs: Emit correctly explicit null to nullable cast. 2008-11-28 Marek Safar * ecore.cs, generics.cs: Fixed crash when type arguments fail to resolve. 2008-11-28 Marek Safar A fix for bug #449005 * convert.cs, nullable.cs: Use only one implicit nullable conversion. 2008-11-27 Marek Safar * convert.cs, literal.cs: More Convert cleanup is needed. 2008-11-27 Marek Safar * decl.cs, class.cs: Fixed misleading error message. 2008-11-26 Marek Safar A fix for bug #449005 * nullable.cs (EmitEquality): Disable optimization for user operator operands. 2008-11-25 Marek Safar A fix for bug #447027 * anonymous.cs (HoistedVariable): Cache also outer access to deal with context variables stored as expression instances. 2008-11-25 Marek Safar A fix for bug #447027 * delegate.cs: Fixed delegate VerifyMethod logic. 2008-11-24 Marek Safar * ecore.cs, delegate.cs: MethodGroup expressions can be applicable but not verifiable. 2008-11-21 Marek Safar * typemanager.cs, decl.cs, anonymous.cs, class.cs, enum.cs: Rewrote member type resolve to follow normal flow, instead of random property access. 2008-11-21 Marek Safar * iterators.cs (GetEnumeratorStatement): Re-use already resolved type. 2008-11-21 Marek Safar * const.cs: Emit decimal array constant as literal. 2008-11-20 Marek Safar * iterators.cs, ecore.cs: Removed CurrentBlock statement. 2008-11-19 Marek Safar * eval.cs, location.cs, driver.cs (Location.SourceFiles): Turned into real property (saves 8 MB for corlib compilation). 2008-11-19 Marek Safar * generic.cs, lambda.cs, linq.cs, iterators.cs, anonymous.cs, nullable.cs, expression.cs, statement.cs, ecore.cs, cs-parser.jay generic-mcs.cs: Small cleanup of TypeArguments. 2008-11-18 Marek Safar * generic.cs, iterators.cs, anonymous.cs, nullable.cs, ecore.cs, expression.cs, namespace.cs, generic-mcs.cs, class.cs: Small cleanup of ConstructedType expression, renamed to GenericTypeExpr. 2008-11-17 Marek Safar A fix for bug #445303 * location.cs (IsConditionalDefined): Handle undefined global defines. 2008-11-17 Marek Safar A fix for bug #444678 * expression.cs (TryReduceConstant): Always create new constant instance. 2008-11-17 Marek Safar A fix for bug #444673 * ecore.cs: Ignore open generic types when used as generic type instance fields. 2008-11-17 Marek Safar A fix for bug #445458 * expression.cs, cs-parser.jay: Don't crash when an expression statement is null. 2008-11-17 Marek Safar A fix for bug #445464 * expression.cs, cs-parser.jay: Fixed typeof of non-generic type inside unbound type. 2008-11-14 Jb Evain * driver.cs: ignore empty -nowarn argument such as the one in -nowarn:12,13,,. 2008-11-13 Marek Safar A fix for bug #444271 * anonymous.cs: Rescan parent storeys when best candidate was undone. 2008-11-13 Marek Safar * generic.cs, expression.cs, ecore.cs, cs-parser.jay: Removed useless UnboundTypeExpression. * attribute.cs: Do check obsolete attribute on generic types. 2008-11-12 Marek Safar A fix for bugs #425680, #400139 * ecore.cs, expression.cs: Trying to do some almost_matched_members refactoring. 2008-11-11 Marek Safar A fix for bug #435747 * assign.cs, expression.cs: Cleanup New assignment to emit correcly compound value types assignment. Few micro optimizations added. 2008-11-10 Marek Safar A fix for bug #442610 * anonymous.cs (MutateConstructor): More SRE hacking. 2008-11-10 Marek Safar A fix for bug #442579 * ecore.cs: Also initialize expanded form of a method with 1 params parameter. 2008-11-06 Marek Safar * expression.cs (UnaryMutator): Do early l-side check. 2008-11-05 Miguel de Icaza * codegen.cs (InitDynamic): also setup Assembly.Name like we do in Init, otherwise we would crash later on when checking for friend assemblies. * eval.cs: Do not hide errors from invalid calls to LoadAssembly. Otherwise we never get any meaningful information as to what failed. 2008-11-05 Marek Safar A fix for bug #436318 * driver.cs, report.cs: Add -warnaserror:Wn to command line options. 2008-11-05 Miguel de Icaza * namespace.cs: Turns out that it was a really bad idea to hide the errors for namespaces not found here in eval mode. * eval.cs: When we process using clauses, only enter those into the list of valid using clauses after they have been validated. The above change gives the proper semantics: it does not senselessly report the same errors with broken using statements by never storing them in the first place when they are invalid. 2008-11-05 Marek Safar A fix for bug #421839 * cs-parser.jay: Remove expression from coalesce rule to force lower priority than the assignment operator. 2008-11-05 Marek Safar A fix for bug #437875 * nullable.cs: Compile correctly method group operand used with null coalescing operator. 2008-11-04 Marek Safar A fix for bug #434589 * expression.cs (Binary): Ignore lifted conversions when at least one operand is of reference type. 2008-11-04 Marek Safar * cs-parser.jay: Better syntax error report. 2008-11-03 Marek Safar A fix for bug #436792 * cs-parser.jay: Use GetLocation to access location. 2008-11-03 Marek Safar A fix for bug #440774 * cs-parser.jay: Also set current_array_type when parsing local variables types. 2008-11-03 Marek Safar A fix for bug #440785 * expression.cs (As): Don't resolve self modifing expression multiple times. 2008-11-03 Marek Safar A fix for bug #439447 * cs-tokenizer.cs: Tokenize surrogates only where allowed. 2008-11-03 Marek Safar A fix for bug #437571 * cs-parser.jay: Fixes internal error for invalid expression statements. 2008-10-17 Marek Safar * ecore.cs: Resolve correctly ambiguous params delegate methods. 2008-10-17 Marek Safar * generic.cs, anonymous.cs: Simplified GetDeclarations. 2008-10-17 Marek Safar * cs-tokenizer.cs: More precise cast parsing. 2008-10-16 Martin Baulig * anonymous.cs (AnonymousMethodStorey): Put back the `hoisted_locals' hashtable and use it in EmitType(). 2008-10-15 Marek Safar * cs-tokenizer.cs, nullable.cs, expression.cs, statement.cs, cs-parser.jay: Tokenizer optimizations and memory reduction, saves ~5MB for corlib. 2008-10-14 Marek Safar * cs-tokenizer.cs: Add bool type to the list of valid cast tokens. 2008-10-14 Marek Safar * statement.cs: Mutate scope initializers. 2008-10-14 Marek Safar * expression.cs: Use typeless value for This constant. * ecore.cs: Access FieldInfo via GetConstructedFieldInfo. 2008-10-14 Marek Safar * cs-tokenizer.cs, cs-parser.jay: Unify context sensite keyword tokenizer. 2008-10-13 Marek Safar * cs-tokenizer.cs: Add missing alias qualifier and dotted generic type to type cast. 2008-10-13 Marek Safar * cs-tokenizer.cs, expression.cs, cs-parser.jay: Reworked parens parser and tokenizer. Fixes many ambiguities including #433258. 2008-10-10 Marek Safar * cs-parser.jay: Fixed missing accessor recovery. 2008-10-10 Marek Safar A fix for bug #433701 * expression.cs: Better error message. 2008-10-10 Marek Safar * cs-parser.jay, expression.cs: Start reporting real parser errors. * Makefile: Disabled unused debug symbols. Also fixes: #320556, #321097, #321656, #321876, #351316 2008-10-09 Miguel de Icaza * eval.cs: rename "" to "{interactive}", to work around a requirement in the compiler that this be a valid filename, and in Windows it is not (433886). 2008-10-09 Marek Safar * cs-tokenizer.cs, cs-parser.jay: Fixed more subtle parser problems 2008-10-08 Marek Safar * cs-tokenizer.cs, eval.cs, anonymous.cs, statement.cs, class.cs cs-parser.jay: Generic type declaration and type arguments cleanup. 2008-10-05 Marek Safar * cs-parser.jay: Allow parsing weird array creation construct. 2008-10-05 Marek Safar * cs-parser.jay: Conflicts reduction. 2008-10-04 Marek Safar * cs-parser.jay: Conflicts reduction. 2008-10-04 Raja R Harinath Fix #398325 * flowanalysis.cs (MyBitvector.MakeShared): Rename from 'Shared' property. Add a 'count' hint about the use of the shared vector. Ensure that we don't leak out dirty bits. (UsageVector.MergeChild): Throw away information about variables in child vectors. Based on patch and analysis by Moritz Kroll . 2008-10-03 Marek Safar A fix for bug #431746 * iterators.cs, anonymous.cs: Re-initialize hoisted iterator parameters when iterator is created. 2008-10-03 Marek Safar A fix for bug #431827 * expression.cs: Fixed right based pointer arithmetic operations emit. 2008-10-03 Marek Safar A fix for bug #353779 * assign.cs, expression.cs: Fixed compound assignment conversions. 2008-10-02 Marek Safar A fix for bug #375262 * statement.cs: Refactor ArrayForeach to be usable with string indexer. Optimized single dimentional arrays foreach. 2008-10-02 Marek Safar A fix for bug #431255 * anonymous.cs, expression.cs: Removed broken optimization. 2008-10-01 Marek Safar * anonymous.cs: Use full type parameters of parent generic containers. Removed unnecessary AddParentStoreyReference call. 2008-10-01 Marek Safar A fix for bug #324702 * class.cs: Use better shorter names for explicit interface member implementations. * ecore.cs, typemanager.cs: Convert only mscorlib predefined names. 2008-10-01 Marek Safar * expression.cs: Use new interface to check fixed expression. 2008-10-01 Marek Safar A fix for bug #421101 * expression.cs, statement.cs, ecore.cs: Use IFixedExpression interface to check for fixed fixed-buffers. 2008-10-01 Marek Safar A fix for bug #429264 * assign.cs, anonymous.cs, ecore.cs: More type mutators added. * delegate.cs: Removed unnecessary casts. 2008-09-30 Marek Safar A fix for bug #352151 * decl.cs, iterators.cs, anonymous.cs, report.cs, namespace.cs, class.cs: Fixed already defined explicit interface members check. 2008-09-29 Rodrigo Kumpera cs-tokenizer.cs: Fix typo. 2008-09-28 Miguel de Icaza * eval.cs (InteractiveBase): The quit command now just sets a flag, instead of calling Environment.Exit(), it is milder on embedded hosts. CompiledMethod is now in Mono.CSharp, not nested inside the Evaluator, it was inconvenient to use. 2008-09-27 Miguel de Icaza * eval.cs (Evaluator): Introduce Compile method, to allow compiled code to be invoked without having to reparse. 2008-09-27 Miguel de Icaza * ecore.cs: The recent changes to FieldExpr broke this as well. Fixes LINQ queries in the interactive shell. * Multiple files: indentation fixing for the Mono coding guidelines for the switch statement. * eval.cs: Make the Evaluator API thread safe. 2008-09-26 Marek Safar * anonymous.cs, statement.cs, class.cs, cs-parser.jay: Simplified constructor parsing. 2008-09-26 Marek Safar A fix for bug #325326 * statement.cs: Check possible mistaken empty statement using explicit blocks only. 2008-09-25 Miguel de Icaza * eval.cs (LoadAssembly, ReferenceAssembly): Call RootNamespace.ComputeNamespaces to update the internal list of namespaces, this is no longer done for us. (InteractiveBase): Use the Evaluator APIs instead of calling into Driver directly 2008-09-25 Marek Safar A fix for bug #429264 * expression.cs: Missing mutator for access to multidimensional arrays. 2008-09-25 Marek Safar * class.cs, statement: Emit DebuggerHidden attribute for iterator entry wrapper. * driver.cs: Missing input argument check. 2008-09-25 Marek Safar * typemanager.cs, generic.cs, eval.cs, decl.cs, anonymous.cs, expression.cs, statement.cs, rootcontext.cs, class.cs, cs-parser.jay, driver.cs, generic-mcs.cs, enum.cs: Removed obsolete DefineMembers. 2008-09-24 Miguel de Icaza * ecore.cs (FieldExpr): Only initialize eclass when we return a fully constructed FieldExpr, fixes the regression introduced in the last commit. * ecore.cs, expression.cs: Plug back the eclass initialization as otherwise it regresses `csharp'. 2008-09-24 Marek Safar * typemanager.cs, decl.cs, convert.cs, assign.cs, expression.cs, ecore.cs, attribute.cs: Moved obsolete method checks from emit phase to resolve phase. It resolves problems with expression trees and fixes bugs #323796, #325156. 2008-09-23 Marek Safar * codegen.cs: Report better error when symbol writer is missing. 2008-09-23 Marek Safar * codegen.cs: Set .NET symbol writer. * decl.cs: Guard against null generic arguments. * report.cs: Don't report exactly same additional details. 2008-09-22 Marek Safar A fix for bug #324917 * cs-parser.jay: Add missing multidimensional non-expression type ranks. 2008-09-22 Marek Safar A fix for bug #428191 * anonymous.cs: Create an outer generic fields also for non-storey anonymous methods. 2008-09-22 Marek Safar A fix for bug #378294 * class.cs: Make fixed size buffers gmcs feature only. 2008-09-22 Marek Safar A fix for bug #355622, #324993 * assign.cs, const.cs, class.cs: Create new EmitContext for each field initializer. 2008-09-19 Marek Safar * nullable.cs, expression.cs, namespace.cs, delegate.cs: Duplicate error reporting. 2008-09-19 Marek Safar A fix for bug #416110 * generic.cs: Struct constraint results in default ctor and ValueType base type constraint to be set. 2008-09-19 Marek Safar A fix for bug #423791 * generic.cs: Fixed params output type type-inference. 2008-09-19 Marek Safar * cs-parser.jay, expression.cs: Fixed few expression crashes. 2008-09-19 Marek Safar * cs-tokenizer.cs: Don't break on extra partial modifier. 2008-09-19 Marek Safar A fix for bug #427592 * generic.cs: Use common parameter resolve method. 2008-09-18 Marek Safar A fix for bug #414758 * expression.cs, ecore.cs: Fixed crash when accessing non-static property. 2008-09-18 Marek Safar * driver.cs, namespace.cs: Read types and namespaces after all requested assemblies are loaded, fixes issues with System.Core auto-reference, and #419888. 2008-09-18 Marek Safar A fix for bug #417705 * cs-parser.jay: Fixed as/is operator expression split. 2008-09-18 Marek Safar * const.cs, expression.cs, statement.cs, ecore.cs, cs-parser.jay: Fixed expression tree representation of empty new expression and new initializer expression. 2008-09-18 Miguel de Icaza * eval.cs: Remove warning, keep reference to driver around. * Hide fields that do not need to be public. 2008-09-17 Marek Safar A fix for bug #426385 * expression.cs (ImplicitlyTypedArrayCreation): Use full implicit conversion for array elements. 2008-09-17 Marek Safar * expression.cs, statement.cs, class.cs, cs-parser.jay: Fixed void parsing conflicts. 2008-09-15 Marek Safar A fix for bug #425601 * driver.cs, typemanager.cs, namespace.cs: Automatically reference System.Core only when there is no custom ExtensionAttribute implementation. 2008-09-15 Miguel de Icaza * namespace.cs: Do not report CS0246 (name 2008-09-12 Marek Safar A fix for bug #425669 * generic.cs: Don't cache generic static anonymous method containers. 2008-09-12 Marek Safar * generic.cs, class.cs, delegate.cs: Check recursive inherited conflicting constraints. 2008-09-12 Raja R Harinath * cs-tokenizer.cs (consume_identifier): Allow partial methods in mcs too. 2008-09-12 Marek Safar * literal.cs, convert.cs, expression.cs, statement.cs: More null to null pointer conversion fixes. 2008-09-11 Marek Safar * cs-parser.jay, expression.cs: An implicitly typed local variable declarator cannot use an array initializer. 2008-09-11 Marek Safar * cs-parser.jay: Reduced number of printed tokens, add sorting. 2008-09-11 Marek Safar * generic.cs (InflatedConstraints): Don't crash when constraints are different. * cs-parser.jay: const_declarator is a block. * constant.cs: Check for not allowed NaN conversions. 2008-09-10 Miguel de Icaza * driver.cs: Drop --shell argument, the compiler is no longer a REPL. * eval.cs: Move most of the code that deals with evaluation into this file and document the public API from repl.cs * repl.cs: Remove from here. 2008-09-10 Marek Safar A fix for bug #424684 * generic.cs: Generic class constraints must come first. 2008-09-09 Miguel de Icaza * cs-parser.jay: Improve error reporting for syntax errors in statements and expressions, we now report the expected tokens instead of reporting the useless "; expected". Drop the strings from the token declaration, it turns out that they did not do what I thought they did. Instead they were adding two sets of tokens to the tables. 2008-09-09 Marek Safar * typemanager.cs, generic.cs, parameter.cs, expression.cs, class.cs, delegate.cs: Share special type check. 2008-09-09 Marek Safar A fix for bug #423981 * expression.cs (EmitBranchable): Correctly emit inverted float conditions. 2008-09-09 Marek Safar * ecore.cs (ReducedConstantExpression): Implemented ConvertExplicitly and ConvertImplicitly. 2008-09-09 Marek Safar A fix for bugs: #324750, #335946 * cs-tokenizer.cs, cs-parser.jay, expression.cs: Use a custom lookup rule to determine ?-based tokens. 2008-09-08 Miguel de Icaza * repl.cs (OptionalAssign.EmitStatement): It is possible that some expressions (like event adding or removing) end up here, so we need to treat those as statements. Add LoadAssembly method. 2008-09-04 Miguel de Icaza * repl.cs: Add Time method. 2008-09-05 Marek Safar * cs-tokenizer.cs: Fixed swaped UTF-16 surrogates parsing. 2008-09-05 Miguel de Icaza * repl.cs: Add workaround for old compilers. 2008-09-04 Jb Evain * repl.cs (PrettyPrint): pretty print everything that implements IDictionary, as well as IEnumerables. Also, add a quit helper property. 2008-09-04 Marek Safar * constant.cs: Better error reporting for decimal literals. * class.cs, attribute.cs, typemanager.cs: Emit more fixed buffer field attributes. 2008-09-04 Marek Safar Miguel de Icaza A fix for bug #422951 * assign.cs (Assign.DoResolve): Perform the type conversions checks before we attempt to initialize `New' initializers. 2008-09-04 Marek Safar A fix for bug #422853 * delegate.cs (DelegateCreation): Add special handling for EmptyExpression.Null instance expression which is just another hack for undecided member instance exression. 2008-09-04 Marek Safar * expression.cs, ecore.cs: Emit full expression tree for reduced binary expressions. 2008-09-04 Marek Safar * expression.cs (This): Guard against multi-resolving. * ecore.cs, statement.cs (Throw): Simplified. * flowanalysis.cs: Also verify event fields. 2008-09-04 Miguel de Icaza * assign.cs (Assign.DoResolve): Perform the type conversions checks before we attempt to initialize `New' initializers. * repl.cs (PrettyPrint): Add Hashtable prettyprint * anonymous.cs (AnonymousTypeClass): On EvalMode make the class public. * repl.cs: Update help. 2008-09-03 Miguel de Icaza * driver.cs (ProcessDefaultConfig): Now it encapsulates all the handling of the default config handling, including the special treatment of System.Core assembly. Fixes the REPL processing for LINQ. 2008-09-03 Marek Safar A fix for bug #422507 * expression.cs (UnboxCast): Add missing child expression mutator. 2008-09-03 Marek Safar * driver.cs: Don't self reference System.Core assembly. 2008-09-03 Marek Safar A fix for bug #422507 * expression.cs (StringConcat): Add missing type mutator. 2008-09-03 Marek Safar * generic.cs (TypeInferenceContext): Follow equality rule for constructed type lower bound type inference. 2008-09-02 Miguel de Icaza * getline.cs (CmdRefresh): Apply patch from Douglas S. Blank which updates the cursor position on refresh. 2008-09-02 Marek Safar A fix for bug #367145 * driver.cs: Fixed import of extension methods when using -noconfig option. 2008-09-02 Marek Safar * iterator.cs: Don't emit GetEnumerator method twice but call a generic version from non-generic implementation instead. 2008-09-01 Marek Safar A fix for bug #418908 * class.cs: Use AddScopeStatement for field initializers. 2008-09-01 Marek Safar A fix for bug #415385 * ecore.cs, convert.cs: Do method group conversion for equal group types. 2008-09-01 Marek Safar A fix for bug #421736 * iterators.cs: Don't crash on unreachable iterators. 2008-09-01 Marek Safar A fix for bug #421628 * parameter.cs, attribute.cs: Clone also parameter attributes. 2008-08-30 Miguel de Icaza * namespace.cs (LookupType): In EvalMode, try to replace the TypeBuilder from our cache with a Type as Reflection.Emit does not like to mix code from older assemblies emitted and new assemblies emitted. This sounds like a serious Mono bug that prevents multiple assemblies to be generated and consumed at the same time. * cs-parser.jay (push_current_class): Do not make interactive classes internal or private, make them public as we currently generate each new class in a new assembly. 2008-08-29 Miguel de Icaza * decl.cs, roottypes.cs, class.cs:: Add an infrastructure to remove types that are entered into the global namespace during parsing so that we can remove them on failure. * cs-parser.jay: Parsing: we now keep track of types that are entered into global variables and queue those in case the parsing or resolution fail. This happens in a few situations: during partial-input, we invoke the parser repeatedly for example with the string "class X", this would cause X to be registed, and we need to remove this registration so that another parse attempt later with say "class X {" would actually work. Additionally, if there is an error in the resolution phase, for example: "class X : NonExistant {}" th * cs-parser.jay: Be more precise with the errors being raised, instead of flagging all exceptions during parsing to be attributed to the parsing process, distinguish those from errors happening in the actions and hint that using -v would produce the actual exception. * repl.cs: Do not load all compiler references on each reset, doing the partial reset takes care of this. 2008-08-28 Miguel de Icaza * repl.cs: Add support for loading all the files from ~/.config/csharp/*cs as startup scripts and ~/.config/csharp/*.dll as shell libraries. Introduce a micro-parser that is able to deambiguate on its input whether we are dealing with a compilation unit (namespace, class, interface, struct, delegate) declaration or a statement. This allows both declarations and statements to be entered. Set history size by default to 300 lines. Instead of distinguishing based on the parser.InteractiveResult, have only two cases: statements were parsed, or a compilation unit was. Always pull the Using statement additions from the compilation unit parse. * cs-tokenizer.cs: Rename tokens to better describe their intent (EvalStatementParserCharacter and EvalCompilationUnitParserCharacter). * rootcontext.cs: Split EvalMode into EvalMode and StatementMode. EvalMode is used to trigger the lookup of global variables while StatementMode is used turn variable declarations into static fields. * getline.cs: Allow history size to be set. 2008-08-29 Marek Safar A fix for bug #360755 * ecore.cs (SimpleName): Exclude indexers from simple name resolve. 2008-08-29 Marek Safar * generic.cs, iterators.cs, codegen.cs: Removed unused variable. * typemanager.cs, statement.cs, ecore.cs, enum.cs: Don't reconstruct enum member name, it is too confusing * decl.cs, class.cs: Don't report unused fields with attached attribute. * rootcontext.cs: Finally default to warning level 4. 2008-08-28 Marek Safar * class.cs (CheckBase): Ignore overloaded operators. 2008-08-28 Marek Safar A fix for bug #420830 * expression.cs, cs-parser.jay: Put back InvocationOrCast expression. 2008-08-28 Marek Safar A fix for bug #420832 * anonymous.cs, iterators.cs: Also clone hoisted this iterator variable. 2008-08-28 Marek Safar A fix for bug #420386 * nullables.cs: Fixed logic of nullable user comparison operators involving null values. 2008-08-28 Marek Safar * attribute (IsClsCompliant): Use FALSE value for pointer types. 2008-08-27 Miguel de Icaza * repl.cs: Add support for aborting the running code with C-c. 2008-08-27 Raja R Harinath * cs-parser.jay (CS1002): Dump 'yyToken' with Report.ExtraInformation. 2008-08-27 Miguel de Icaza * cs-parser.jay (interactive_statement_list): A new set of rules for hosting statements that uses the "interactive_" prefix. * repl.cs: Add support for parsing `using' as a statement or as a directive. Deambiguating before passing this to the parser. We need to distinguish statement_expressions that occur at the toplevel vs those that occur embedded into expressions. * getline.cs: Applied patch from Stuart Carnie that fixes the cursor key handling, and a history bug. 2008-08-26 Miguel de Icaza * Makefile: Drop BOOTSTRAP_COMPILER as that was masking the limitations in Console, instead the 2.0 bootstrap libraries now include the Console bits. Also, remove the use of Nullables from getline.cs ------------ Interactive support for the C# compiler. Use gmcs --shell to enter a read-eval-print loop shell. Docs: http://www.mono-project.com/CsharpRepl * sources: include repl.cs here and getline.cs for gmcs.exe, everything else is getline.cs impaired. * Makefile: when bootstrapping pass a special flag BOOTSTRAP_COMPILER which we use to prevent failures in compilation as we use NET_2_0 define to pull 2.0 APIs from System.Console. This distinguishes those two cases. * repl.cs: Support for a read-eval-print loop. Will be soon refactored into eval support and then REPL on top of it. * ecore.cs: If a simplename lookup fails, before erroring out, if we are in EvalMode to resolve the name to a declaration in the Eval-land. This means that variable declarations that happened in previous classes (as repl puts every statement in a separate class) are made visible in this way. * cs-parser.jay: UnexpectedEOF, a new flag that is set if we triggered an error due to the end of file being reached. This is used to do multi-line input, and notify the caller that the user needs to provide more text before a successful parse. Add new grammar rules after the INTERACTIVE_PARSER token is seen to drive the evaluation with a custom wrapper. * driver.cs: Add support for --shell, and refactor some code to be reused from repl.cs * namespace.cs: Add support for serializing the contents of the namespaces and reloading them. * getline.cs: A managed implementation of ReadLine under X11/Apache2 license terms. Easy to embed in other applications as well. * namespace.cs: Add some functions to save and restore the namespace state. * rootcontext.cs: New public field. * cs-tokenizer.cs: Add support for one of the possible characters we introduce into the token stream. This patch does not affect the regular tokenization process, the only performance hit would happen if there is an invalid character on the input string. * support.cs: Move isatty helper routine here. * codegen.cs: Small cleanup, and add a mechanism to initialize the code generator for in-memory assemblies. 2008-08-26 Marek Safar * generic.cs, ecore.cs, delegate.cs, cs-parser.jay, expression.cs: A type parameter cannot be always used as a type. 2008-08-21 Marek Safar * convert.cs, expression.cs: Use single ExplicitReferenceConversion routine. 2008-08-21 Marek Safar * convert.cs: Implement explicit array to IList conversion. 2008-08-20 Marek Safar A fix for bug #362740 * cs-tokenizer.cs: Handle UTF-16 surrogates. 2008-08-20 Marek Safar * generic.cs, support.cs, typemanager.cs, lambda.cs, parameter.cs, pending.cs, ecore.cs, linq.cs, class.cs, decl.cs, delegate.cs, flowanalysis.cs, iterators.cs, cs-parser.jay, convert.cs, anonymous.cs, expression.cs, attribute.cs, statement.cs, doc.cs: Refactored parameters handling to use just one type of infrastructure and deal with generics more effectivelly. 2008-07-23 Martin Baulig *** Merged this from trunk revision 108527 *** * statement.cs (ExplicitBlock.EmitSymbolInfo): Moved to `ToplevelBlock'. (ToplevelBlock.EmitSymbolInfo): Tell the symbol writer about the scope variable. 2008-08-15 Marek Safar * ecore.cs, linq.cs, const.cs, expression.cs, statement.cs: More robust error checks. 2008-08-15 Marek Safar * delegate.cs: Fixed compiler crash when creating delegate using partial method. * typemanager.cs: MulticastDelegate is not a delegate. 2008-08-14 Marek Safar * expression.cs, ecore.cs, anonymous.cs, class.cs: Fixed missing error checks. 2008-08-14 Raja R Harinath * cs-parser.jay (type): Allow 'var' in mcs too. (local_variable_type): Likewise. 2008-08-14 Marek Safar * driver.cs: Removed broken -noconfig variants. 2008-08-14 Marek Safar A fix for bug #417078 * expression.cs: Emit correctly left side pointer operators. 2008-08-13 Marek Safar * generic.cs, lambda.cs: Inflate method generic arguments only. 2008-08-12 Marek Safar * class.cs: Fixed struct layout check regression. 2008-08-12 Marek Safar * cs-parser.jay, enum.cs: Simplified enum parsing. * decl.cs: Check all type parameters conflicts. * expression.cs, statement.cs, attribute.cs: More expression checks. 2008-08-11 Marek Safar * generic.cs: Add type inference types restriction. * parameter.cs, class.cs, delegate.cs, iterators.cs, cs-parser.jay, anonymous.cs, expression.cs: Allocate less accessor parameters. 2008-08-08 Marek Safar * typemanager.cs, ecore.cs: Ambiguous operators can come from different classes. 2008-08-08 Marek Safar * convert.cs, delegate.cs: Fixed delegate compatibility conversion. 2008-08-07 Marek Safar * class.cs, decl.cs, iterator.cs, ecore.cs: Refactor base type resolving. Also fixes #362146 and #381592. 2008-08-07 Marek Safar * ecore.cs: Reduced constant cannot be used as an attribute value. * cs-parser.jay: Base expression has to be a type. * expression.cs (Conditional): Uses ReducedExpression. 2008-08-06 Marek Safar A fix for bug #376826 * parameter.cs, ecore.cs, anonymous.cs, expression.cs, statement.cs: An address of hoisted local variable or parameter cannot be taken. 2008-08-05 Marek Safar * ecore.cs, constant.cs, expression.cs, statement.cs: Resolve correctly anonymous method inside checked/unchecked expression. 2008-08-05 Marek Safar * typemanager.cs (IsEqual): Guard against null. * ecore.cs, class.cs, convert.cs, const.cs, constant.cs, expression.cs, attribute.cs, enum.cs, statement.cs: Pass EmitContext to constant conversion routine. Fixed few misleading conversion errors. 2008-08-04 Marek Safar * class.cs: Consider generics when checking cycles in struct layout. 2008-08-04 Raja R Harinath * cs-tokenizer.cs (get_cmd_arg): Simplify. Don't be too pedantic. 2008-08-04 Marek Safar A fix for bug #414165 * anonymous.cs: Use same anonymous implementation method for all anonymous method emits. 2008-08-04 Marek Safar * generic.cs, anonymous.cs, statement.cs: Emit inherited anonymous method constraints. 2008-08-04 Marek Safar * cs-parser.jay: Typeof argument has to be a type expression. * namespace.cs: Check alias and namespace definitions collisions. * class.cs, pending.cs: Moved explicit interface accessor implementation check. * delegate.cs, expression.cs: Verify special name invocations. 2008-08-01 Marek Safar * cs-parser.jay: Don't choke on empty generic type arguments. * cs-tokenizer.cs: Handle escaped preprocessor directives. * expression.cs, ecore.cs: Minor expressions bugs. 2008-08-01 Marek Safar * cs-parser.jay: Removed duplicate interface declaration (fixes 2 conflicts) and added more error handling. * class.cs, iterators.cs, anonymous.cs: Removed useless interface parameter. * modifiers.cs, enum.cs: Fixed. 2008-07-31 Jb Evain * driver.cs: remove -pkg ability of smcs. 2008-07-30 Marek Safar * statement.cs (Switch): Correctly set empty default target for single blocks. 2008-07-30 Marek Safar * typemanager.cs, assign.cs, driver.cs, expression.cs, statement.cs: Rewrote string switch statement implementation to use string dictionary which significantly (2-8x) improves performance of generated code. 2008-07-29 Marek Safar A fix for bug #412880 by Atsushi Enomoto * modifiers.cs (GetDescription): Fixed FamANDAssem case. 2008-07-29 Marek Safar A fix for bug #412595 * typemanager.cs, convert.cs, expression.cs: Some types are never convertible to each other. 2008-07-29 Marek Safar * nullable.cs (CreateNullConstant): An error messages update. 2008-07-29 Marek Safar A fix for bug #412595 * cfold.cs: Don't cast undefined bool constant. 2008-07-29 Martin Baulig * symbolwriter.cs (SymbolWriter.Reset): New public static method. * driver.cs (CompilerCallableEntryPoint.Reset): Call SymbolWriter.Reset(). 2008-07-28 Marek Safar * cs-tokenizer.cs (IsLambdaOpenParens): Optimized using more stop tokens. * expression.cs (ElementAccess): Exact size allocation. 2008-07-26 Marek Safar * driver.cs: Replaced outdated UnixParseOption with CSCParseOption. 2008-07-25 Marek Safar * flowanalysis.cs (StructInfo): Fixed detection of dynamic types. * class.cs: Removed $PRIVATE$ field hack which caused problems during flow analysis. 2008-07-25 Marek Safar A fix for bug #412217 * assign.cs: Mutate also assignment type. 2008-07-25 Marek Safar A fix for bug #323644 * typemanager.cs (IsValidProperty): Verify DefaultMemberName when checking indexers. 2008-07-25 Marek Safar A fix for bug #412134 * expression.cs (ResolveOperatorEnum): Do implicit conversion of non-enumerable operands when overloading equality or bitwise operators. 2008-07-25 Marek Safar * anonymous.cs: Cache closed generic anonymous method delegates. 2008-07-24 Marek Safar * lambda.cs, linq.cs, class.cs, iterators.cs, cs-parser.jay, assign.cs, anonymous.cs, statement.cs: Always emit anonymous method as static method when is instance free. Use nesting for nested anynomous methods blocks. 2008-07-23 Marek Safar * anonymous.cs (MutateGenericMethod): Added extra code path for imported types. 2008-07-23 Marek Safar * expression.cs: Removed MakeSimpleCall. 2008-07-23 Marek Safar A fix for bug #323012 * class.cs, pending.cs: Emit proxy for indexers when they differ in name. Base method implementing interface has to be public. 2008-07-23 Marek Safar * cs-parser.jay: Don't break on missing argument. 2008-07-22 Marek Safar A fix for bug #320993 * report.cs, parameter.cs, class.cs, decl.cs, delegate.cs, attribute.cs, enum.cs, codegen.cs: Report CLS compliance errors as warnings. 2008-07-22 Marek Safar A fix for bug #320748 * convert.cs: Implicit user operators cannot convert to interfaces 2008-07-22 Marek Safar A fix for bug #312686 * driver.cs: Ignore empty assembly references. 2008-07-22 Marek Safar A fix for bug #387040 * ecore.cs: Skip constrains check for an explicit implementation. 2008-07-21 Marek Safar A fix for bug #409045 * cs-tokenizer.cs, rootcontext.cs, class.cs, location.cs, delegate.cs, cs-parser.jay, driver.cs, expression.cs, attribute.cs: Conditional identifiers are file specific unless passed as input arguments. 2008-07-21 Marek Safar * typemanager.cs, parameter.cs, class.cs, attribute.cs: Use an attribute to emit UnmanagedMarshal data under 2.0 profile. 2008-07-21 Marek Safar A fix for bug #410369 * parameter.cs: Clone correctly ParamsParameter. 2008-07-21 Marek Safar * expression.cs (Argument): Always report type for type based expressions errors. 2008-07-18 Marek Safar A fix for bug #410666 * anonymous.cs: Correctly initialize generic storey reference. 2008-07-18 Marek Safar * convert.cs: Don't box same type arguments. 2008-07-18 Marek Safar * ecore.cs, linq.cs, delegate.cs, constant.cs, nullable.cs, expression.cs: Finished missing generic type mutators. 2008-07-18 Marek Safar * iterators.cs, statement.cs: Finished statements CloneTo. 2008-07-18 Marek Safar * anonymous.cs: ExpressionTreeProxy is of Value type expression. * expression.cs: Emit optimized default value expressions in expression tree array initializer. 2008-07-18 Marek Safar * ecore.cs, cs-parser.jay, statement.cs: Error reporting fixes. 2008-07-17 Marek Safar A fix for bug #367536 * cs-parser.jay: Check static constructor of generic types for an access modifier. 2008-07-17 Marek Safar A fix for bug #353800 * lambda.cs: Emit ret for contextual statements. * codegen.cs: Keep both resolved and unreachable flags, otherwise we end up emitting redundant ret for all anonymous methods with return. 2008-07-17 Marek Safar A fix for bug #365188 * ecore.cs, anonymous.cs, expression.cs, codegen.cs, statement.cs: Don't create anonymous method storey in unreachable block. 2008-07-17 Marek Safar * generic.cs, typemanager.cs, cs-tokenizer.cs, parameter.cs, namespace.cs, class.cs, delegate.cs, flowanalysis.cs, iterators.cs, anonymous.cs, driver.cs, nullable.cs, expression.cs, attribute.cs, codegen.cs, statement.cs: Fixed relevant defects found by Gendarme. 2008-07-17 Marek Safar A fix for bug #325291 * modifiers.cs, class.cs, cs-parser.jay, anonymous.cs, codegen.cs, statement.cs: Replaced IAnonymousHost with top level block flag. 2008-07-17 Marek Safar * cs-parser.jay: Clean up unused open_parens. 2008-07-17 Marek Safar * ecore.cs: Custom error message for a range variable assignment. 2008-07-16 Marek Safar * constant.cs, typemanager.cs: Emit empty string ("") as string.Empty field load. 2008-07-16 Marek Safar * literal.cs: Null literal is of object type. 2008-07-16 Marek Safar * nullable.cs (LiftedBinaryOperator): Always lift unwrapped nullable expression of nullable equality comparison. 2008-07-15 Marek Safar * expression.cs(PointerArithmetic): Removed redundant assignment. 2008-07-15 Marek Safar * decl.cs (GetSignatureForError): Report full namespace name for containers. 2008-07-14 Marek Safar A fix for bug #408361 * anonymous.cs (MutateGenericMethod): Store generic type arguments before they are replaced by GetMethod. 2008-07-14 Marek Safar A fix for bug #408721 by jeremie.laval@gmail.com * expression.cs (Indirection): Implemented CloneTo. 2008-07-14 Marek Safar * statement.cs (AssignableSlots): Temporary disabled variable initialization assert check. 2008-07-14 Marek Safar * report.cs (EnableReporting): Don't reinitialize 0-based values. 2008-07-11 Marek Safar * linq.cs: Reset tranparent parameter counter in probing mode. 2008-07-11 Marek Safar * anonymous.cs: Mutate anonymous method type. 2008-07-11 Marek Safar * ecore.cs, anonymous.cs: Mutate field expressions. 2008-07-10 Marek Safar A fix for bug #369670 * linq.cs, statement.cs: Use explicit block for query expressions variables. 2008-07-10 Marek Safar * report.cs, ecore.cs: Flush recorder only when silent mode is off. 2008-07-10 Raja R Harinath Fix bug #314902 * cs-tokenizer.cs (is_punct): If a generic lookahead is looking only one '>', and finds a '>>', abort the generic lookahead. 2008-07-10 Marek Safar A fix for bug #319902 * cs-tokenizer.cs: Always look-ahed for `>=' when tokenizing `>'. 2008-07-10 Marek Safar A fix for bug #406371 * statement.cs: Moved EmitSymbolInfo to Block. 2008-07-09 Marek Safar * ecore.cs: Report better error for extension method overload failures. 2008-07-09 Marek Safar * expression.cs (Is): No need to box reference values. 2008-07-09 Marek Safar * class.cs: Use event resolve context when initializing CreateEmitContext. 2008-07-09 Marek Safar A fix for bug #394436 * anonymous.cs, class.cs, expression.cs, lambda.cs: Emit correctly extension method used inside expression trees. Added more LINQ to expression tree conversions. 2008-07-08 Marek Safar A fix for bug #378189, #370577 * lambda.cs, ecore.cs: Implemented 3.0 enhancement to better conversion from expression. 2008-07-08 Marek Safar * anonymous.cs, class.cs, decl.cs: Emit CompilerGenerated attribute hierarchically. 2008-07-08 Marek Safar A fix for bug #406702 * anonymous.cs: Always park anonymous method in the nearest parent storey. 2008-07-07 Marek Safar A fix for bug #406648 * cs-parser.jay: Report nullable use in mcs for some cases. 2008-07-07 Marek Safar * ecore.cs: Improved argument mismatch error messages. 2008-07-07 Marek Safar * anonymous.cs: Don't cache generic delegates when reference MVAR argument. 2008-07-07 Marek Safar * expression.cs (TypeOf): Mutate type argument. 2008-07-04 Marek Safar * class.cs: Report missing partial modifier for correct type. 2008-07-04 Marek Safar * ecore.cs, expression.cs (VariableReference): Variable property is protected. 2008-07-04 Marek Safar * ecore.cs, convert.cs: Made OpcodeCast more memory efficient. 2008-07-04 Marek Safar * anonymous.cs, class.cs, lambda.cs, iterator.cs: Cache static anonymous method delegates. 2008-07-04 Marek Safar * anonymous.cs, class.cs, expression.cs, iterator.cs, statement.cs: Reduce anonymous method storey to an instance method when only "this" is hoisted. 2008-07-03 Marek Safar A fix for bug #321615 * expression.cs: Pointer comparisons use unsigned operator. 2008-07-03 Marek Safar * expression.cs: Fixed native pointer conversions. Also fixes #321615. 2008-07-02 Marek Safar A fix for bug #404905 * class.cs: Always initialize local unsafe variables. 2008-06-30 Marek Safar A fix for bug #396987 * expression.cs (NewInitialize): Clear local temporary variable for next run 2008-06-27 Marek Safar A fix for bug #401020 * ecore.cs: Both types and modifiers have to match for ref and out arguments 2008-06-27 Marek Safar A fix for bug #398319 * cs-parser.jay: Implemented undocumented base access expression inside anonymous types. 2008-06-26 Marek Safar A fix for bug #404227 * cs-parser.jay: Parse namespace declaration using qualified identifier. 2008-06-26 Marek Safar A fix for bug #404227 * convert.cs: Fixed explicit array to interface cast. 2008-06-26 Marek Safar A fix for bug #403894 * delegate.cs: Mutate DelegateInvocation type. 2008-06-26 Marek Safar A fix for bug #379348 * delegate.cs: Box a load of generic parameters. 2008-06-26 Marek Safar * expression.cs: Add an array creation arguments mutate. 2008-06-26 Marek Safar A fix for bug #386068 * anonymous.cs, expression.cs: Emit correctly hoisted expression tree parameter. 2008-06-25 Marek Safar * ecore.cs, expression.cs: Fixed broken TypeCast clone, implemented few more CloneTo. 2008-06-25 Marek Safar A fix for bug #403518 * delegate.cs: Type correctly anonymous method new invocation. 2008-06-24 Marek Safar A fix for bug #394826 * anonymous.cs: Fully qualify members when resolving anonymous type internal calls. 2008-06-24 Marek Safar A fix for bug #394826 * anonymous.cs, iterators.cs: Construct generic storey only when is really needed. 2008-06-24 Marek Safar * class.cs: Clone indexer parameters for localized capturing. 2008-06-24 Marek Safar A fix for bug #402379 * expression.cs: Don't crash when an object initializer resolve fails. 2008-06-24 Marek Safar A fix for bug #402888 * expression.cs: Mutate conditional expression. 2008-06-24 Marek Safar A fix for bug #401012 * class.cs: Keep StructLayout in shared container. 2008-06-24 Marek Safar A fix for bug #400438 * decl.cs, class.cs: Only properties can be automatically implemented. 2008-06-24 Marek Safar * statement.cs (ChangeToIterator): Copy also labels. 2008-06-23 Marek Safar * ecore.cs: Pass type argument details to parent extension method. 2008-06-23 Marek Safar A fix for bug #375966 * delegate.cs: Fixed IsTypeCovariant generic type conversions. 2008-06-23 Raja R Harinath * Makefile (bootstrap-libs): Pass NO_DIR_CHECK to sub-make. 2008-06-22 Marek Safar A fix for bug #394347 * anonymous.cs: Cache compatible delegates as compatibility check produces a new method every time. 2008-06-20 Marek Safar * anonymous.cs: Propagate storey reference for single references. 2008-06-20 Marek Safar A fix for bug #387615 * assign.cs, expression.cs: Correctly clone compound assignment. 2008-06-19 Marek Safar A fix for bug #359611, #359604 * anonymous.cs: Mutate all types of hoisted parameters. 2008-06-19 Marek Safar * typemanager.cs, lambda.cs, parameter.cs, ecore.cs, linq.cs, class.cs delegate.cs, iterators.cs, cs-parser.jay, assign.cs, anonymous.cs, driver.cs expression.cs, codegen.cs, statement.cs Fixes bugs: #318652, #323223, #234779, #325069, #325476, #332532, #334465, #345907, #349190, #353276, #355256, #359617, #378542, #384584, #396530 ** Anonymous methods, lambda expressions rewrite ** Anonymous expressions are now resolved when an explicit block is resolved and they don't require any registration procedure anymore. Further, anonymous methods are defined when explicit block is emitted which allows better control of whole process and opens possibilities for more optimizations as well as alternative to reverse whole process. A concept of `MutateHoistedGenericType' was introduced to keep the resolve process consistent and to correctly emit hoisted generic methods when they have at least 1 hoisted variable. 2008-06-17 Martin Baulig * class.cs: Also emit the `[DebuggerHidden]' attribute on the main iterator method. (AbstractPropertyEventMethod.IsDebuggerHidden): New protected virtual property; check it in Emit(). (PropertyMethod.IsDebuggerHidden): Override, check whether we're an iterator. (MethodOrOperator.ResolveMethods): Set `DEBUGGER_HIDDEN' if we're an iterator. (Indexer.Define): Likewise. 2008-06-17 Marek Safar * convert.cs: Don't use IsInterface on type arguments. * delegate.cs: DelegateInvocation uses MethodInfo. * parameter.cs: Removed IsTypeParameter. * generic-mcs.cs: More missing stuff. 2008-06-16 Martin Baulig * modifiers.cs (Modifiers.DEBUGGER_HIDDEN): New public const. * typemanager.cs (TypeManager.GetDebuggerHiddenAttribute): New public static method. * class.cs (MethodOrOperator.Emit): Check `Modifiers.DEBUGGER_HIDDEN'. (AbstractPropertyEventMethod): Likewise. (Constructor.Emit): Likewise. (SourceMethod.SetCompilerGenerated): Removed. * iterator.cs: Set `Modifiers.DEBUGGER_HIDDEN' everywhere except on MoveNext(). * anonymous.cs (RootScopeInfo.DoDefineMembers): Set `Modifiers.DEBUGGER_HIDDEN' if we're an `IteratorHost'. (AnonymousMethodMethod..ctor): Don't set `Modifiers.COMPILER_GENERATED'; csc only sets this on the class, not on the method. 2008-06-16 Marek Safar * statement.cs: Clean-up foreach statements. 2008-06-12 Marek Safar * class.cs: Stop using public method which should not exist (MethodBuilder.SetGenericMethodSignature). 2008-06-11 Martin Baulig * location.cs (Location.LookupFile): Add `CompilationUnit' argument; when given a relative file name, make it relative to the directory the .cs file is located in instead of using the current directory. 2008-06-11 Martin Baulig * class.cs (IMethodData.EmitExtraSymbolInfo): Added `SourceMethod' argument. (MethodOrOperator.EmitExtraSymbolInfo): Likewise. (SourceMethod.SetRealMethodName): Moved here from the symbol writer. (SourceMethod.SetCompilerGenerated): Likewise. 2008-06-11 Marek Safar * codegen.cs, driver: Only write symbol file when it's asked for. 2008-06-11 Marek Safar * codegen.cs: Don't use assembly writer error handling for symbol writer. 2008-06-10 Martin Baulig * symbolwriter.cs: Reflect latest MarkSequencePoint() API changes. 2008-06-09 Marek Safar A fix for bug #316290 * expression.cs: Include decimal operators in predefined table. * parameters.cs: More readonlyness. 2008-06-09 Marek Safar A fix for bug #397213 * cs-parser.jay: One more missing current_local_parameters reset. 2008-06-09 Marek Safar A fix for bug #396633 * class.cs: Host backing field in partial container. 2008-06-09 Marek Safar A fix for bug #397068 * expression.cs: Check both operand types when predefined operator is used. 2008-06-05 Martin Baulig Merged the `debugger-kahalo' branch. * class.cs (MethodData.Emit): Call SymbolWriter.SetCompilerGenerated() if we're an iterator method. (SourceMethod): Reflect latest symbol writer changes; SymbolWriter.OpenMethod() now takes a `ICompileUnit' argument and now `start_row' and `end_row'. (Constructor.Emit): Fix the logic whether to emit symbol information. * iterator.cs: Call SymbolWriter.SetCompilerGenerated() on all the generated methods. * location.cs (CompilationUnit): New public class; derives from `SourceFile'. (SourceFileEntry.DefineSymbolInfo): New public method. (SourceFileEntry.SetChecksum): New public method. (Location): Encode hidden line numbers by using `column == 255'; the .ctor now accepts `column == -1' to mark a hidden line number. (Location.Hidden): New public property. (Location.CheckPoint): Add `CompilationUnit'. (Location.SourceFiles): Change return type to `CompilationUnit[]'. (Location.Push): Add `CompilationUnit compile_unit' argument. (Location.CompilationUnit): New public property. * statement.cs (ToplevelBlock.Emit): Add `ec.Mark (EndLocation)'. * cs-parser.jay: `SourceFile' -> `CompilationUnit'. * driver.cs: `SourceFile' -> `CompilationUnit'. * cs-tokenizer.cs: `SourceFile' -> `CompilationUnit'. * namespace.cs: `SourceFile' -> `CompilationUnit'. * cs-tokenizer.cs: Add support for `#pragma checksum' and `#line hidden'. * symbolwriter.cs (SymbolWriter.MarkSequencePoint): Take a `Location' and use the new symbol writer API to also pass the file. 2008-06-05 Marek Safar * statement.cs: Emit catch variable assignment using variable expression. 2008-06-05 Marek Safar * ecore.cs, expression.cs, statement.cs: Make TemporaryVariable compatible with other variable types. 2008-06-04 Marek Safar * ecore.cs, expression.cs, statement.cs, typemanager.cs: Removed custom GetLength method emit, it breaks resolve rules. 2008-06-02 Atsushi Enomoto Marek Safar A fix for bug #395542 * cs-parser.jay: The trailing comma is allowed in anonymous type member declaration. 2008-06-02 Marek Safar A fix for bug #395287 * class.cs, modifiers.cs: Automatic properties method base modifiers checks. 2008-05-31 Marek Safar A fix for bug #395845 * class.cs, nullable.cs: User unary operator is allowed to have nullable and non-nullable parameter type. 2008-05-31 Marek Safar * class.cs: Handle contructor initializer as a statement in top-level block. 2008-05-30 Marek Safar * attribute.cs: Don't mix old and new corlib types when emitting corlib security attributes. 2008-05-24 Marek Safar * ecore.cs, expression.cs: Small IVariable refactoring. 2008-05-22 Marek Safar * assign.cs (LocalTemporary): Implemented CreateExpressionTree. 2008-05-21 Marek Safar * cs-parser.jay: Removed redundant catch type check. 2008-05-21 Marek Safar A fix for bug #390372 * nullable.cs: Set correct return type. 2008-05-21 Marek Safar A fix for bug #391062 * typemanager.cs: Fixed crash when comparing null types. 2008-05-21 Marek Safar A fix for bug #391871 * cs-parser.jay: Better error handling for invalid catch type. 2008-05-20 Marek Safar A fix for bug #392155 * cs-tokenizer.cs: Fixed casting of byte and decimal expression. 2008-05-15 Marek Safar A fix for bug #390666 * ecore.cs (BetterExpressionConversion): Unwrap each Expression expressions. 2008-05-15 Marek Safar * class.cs, expression.cs, statement.cs: Removed a hack, setting block flag in getter. 2008-05-13 Marek Safar A fix for bug #389625 * delegate.cs, generic.cs: Some progress on method group return type inference. 2008-05-13 Marek Safar A fix for bug #378419 * namespace.cs: Inspect also parent namespaces not only namespace entries. 2008-05-12 Marek Safar * class.cs (Constructor): Added IsCompilerGenerated. 2008-05-12 Marek Safar * expression.cs: Enum binary operators can accept non-enum operand only when is implicitly convertible to underlying type. 2008-05-12 Marek Safar A fix for bug #389272 * support.cs: Workaround System.InvalidOperationException for enums. 2008-05-12 Marek Safar A fix for bug #389073 * convert.cs: More undocumented explicit IntPtr/UIntPtr conversions. 2008-05-10 Marek Safar * driver.cs: Split Parse. * location.cs (LookupFile): Uses string.Empty. 2008-05-07 Marek Safar * expression.cs, parameter.cs: Small ParameterReference clean up. 2008-05-07 Marek Safar * anonymous.cs, codegen.cs, convert.cs, ecore.cs: Removed uber ugly TempEc hack. Fixes #387502. 2008-05-06 Martin Baulig * class.cs (Constructor.Emit): Fix the logic whether to emit symbol information. 2008-05-06 Raja R Harinath Fix #385503 * iterators.cs (Iterator.CurrentBlock.DoEmit): Don't emit InvalidOperationException when the iterator is before the start or after the end. 2008-05-06 Marek Safar * nullable.cs (NullCoalescingOperator): Result is underlying type of left, when left is nullable type. 2008-05-06 Marek Safar A fix for bug #386628 * expression.cs (LocalVariableReference): Continue in resolving when variable is not assigned. 2008-05-05 Marek Safar * nullable.cs, statement.cs (Unwrap): Store non-variable expression in all nullable operations. 2008-05-04 Marek Safar * nullable.cs, statement.cs (Unwrap): Don't duplicate variable expressions, it saves many redundant temporary variables for nullable operations. 2008-05-03 Marek Safar * assign.cs: EventAddOrRemove is a statement and cannot have a type. * cfold.cs, constant.cs, expression.cs: Share Error_OperatorCannotBeApplied method. * nullable.cs: Constant coalescing operator optimizations. 2008-05-03 Marek Safar * constant.cs: Use unsigned conversion for values which are unsigned only. 2008-05-03 Marek Safar * convert.cs, literal.cs, nullabel.cs, typemanager.cs: Implemeted null coalescing operator as it should be. 2008-05-02 Marek Safar A fix for bug #371016 * expression.cs: All predefined delegate operators require implicit method group conversion. 2008-05-02 Marek Safar * constant.cs: Emit long constant as uint when fits the range. * convert.cs, expression.cs: Fixed few unsafe conversions. 2008-05-02 Marek Safar * convert.cs, literal.cs: Don't wrap implicit reference conversion to object 2008-05-02 Raja R Harinath Fix #385758 * convert.cs (ImplicitNumericConversion): Don't modify the type of 'expr'. * ecore.cs (EmptyCast.Create): Flatten nested EmptyCasts. 2008-05-01 Marek Safar * constant.cs, literal.cs: IsLiteral property for error reporting. * ecore.cs, expression.cs: Implemented Property expression. 2008-05-01 Marek Safar * class.cs, modifiers.cs, flowanalysis.cs: New BACKING_FIELD flag. * nullable.cs: Implemented nullable coalescing null operator. * ecore.cs, expression.cs: Expression trees work. 2008-05-01 Marek Safar * ecore.cs: CreateExpressionTree is finally abstract. * expression.cs, linq.cs: Updated. 2008-05-01 Marek Safar * expression.cs, ecore.cs: Block base access expression inside expression tree. 2008-05-01 Marek Safar A fix for bug #385058 * expression.cs: User-defined operator implementations always take precedence over predefined operator implementations. 2008-04-30 Marek Safar * assign.cs, anonymous.cs, lambda.cs, nullable.cs, ecore.cs, linq.cs, class.cs, iterators.cs, expression.cs, attribute.cs: Filled a few more expression tree conversions. 2008-04-30 Marek Safar * typemanager.cs, ecore.cs, class.cs, expression.cs, doc.cs: Merged all operators method details to Operator class. 2008-04-30 Marek Safar * anonymous.cs: Pass unsafe flags to anonymous container. * ecore.cs, expression.cs, statement.cs: Block unsafe pointer operations inside expression tree. 2008-04-29 Martin Baulig * cs-tokenizer.cs (Tokenizer.Position): Added `line'. (Tokenizer.PopPosition): Also restore the `line'. 2008-04-29 Marek Safar * delegate.cs: Implemented Invoke expression. 2008-04-29 Marek Safar * expression.cs: Fixed equality reference comparison regression. 2008-04-29 Marek Safar * ecore.cs: Clean up EmptyCast hack. * expression.cs, nullable.cs: Implemented enum binary and unary operations using correct conversion rules. Also fixes #383993. 2008-04-28 Martin Baulig * class.cs (Constructor.Emit): Don't emit debugging information for generated default .ctor's. 2008-04-28 Marek Safar * convert.cs: Empty-cast ushort to int conversion. 2008-04-28 Marek Safar A fix for bug #384191 * ecore.cs, expression.cs: Fixed expression cloning. 2008-04-28 Marek Safar * ecore.cs, delegate.cs, assign.cs: Few tweaks for recent changes. 2008-04-28 Raja R Harinath Fix #381559, test-638.cs, test-639.cs * assign.cs (CompoundAssign.Helper): New wrapper. (CompoundAssign.DoResolve): Use it to wrap the nested 'target' access. * ecore.cs (MethodGroupExpr.VerifyArgumentsCompat) : Pass unconverted expressions to the params array creation expression. (FieldExpr.EmitAssign): Don't special-case StringConcat. (PropertyExpr.EmitAssign): Likewise. * expression.cs (ArrayCreation.ResolveArrayElement): Keep track of the element if it is of kind CompoundAssign.Helper. (ArrayCreation.Emit): If we saw a CompoundAssign.Helper, emit it first before anything else. (ArrayAccess.EmitAssign): Don't special-case StringConcat. (ArrayAccess.LoadArrayAndArguments): Simplify. 2008-04-27 Marek Safar * expression.cs: Fixed cloning of typeof(void). 2008-04-27 Raja R Harinath * assign.cs (Assign.DoResolve): Remove support for EventExprs. (Assign.Emit): Likewise. Move it to ... (CompoundAssign.DoResolve): ... here and ... (CompoundAssign.Emit): ... here. (EventAddOrRemove): New helper to handle += and -= on events, and avoid the use of BinaryDelegates. * ecore.cs (EventExpr.DoResolveLValue): Emit CS0070 unconditionally. (EventExpr.EmitAddOrRemove): Improve. * delegate.cs (DelegateInvocation.DoResolve): Simplify slightly. * cs-parser.jay (type) : Don't create VarExprs for 'foo.bar.var'. * ecore.cs (VarExpr.InferType): Rename from DoResolveLValue, which is a highly inappropriate name for its functionality. 2008-04-26 Raja R Harinath Simplify handling of multiple assignments * assign.cs (Assign): Clear out all 'embedded assign' gunk. Make inheritable-only. (SimpleAssign): New. Class to be used for normal assignments. * anonymous.cs, class.cs, cs-parser.jay: Update to changes. * expression.cs, parameter.cs, statement.cs: Likewise. 2008-04-25 Marek Safar * ecore.cs, expression.cs, nullable.cs: Implemeted enum binary add operation for incompatible underlying types, more to come, uff. 2008-04-26 Raja R Harinath Fix gtest-388.cs * expression.cs (VariableReference.EmitAssign) : Handle 'leave_copy'. 2008-04-25 Marek Safar * expression.cs, nullable.cs: Implemented UnaryPlus expression. 2008-04-24 Raja R Harinath Fix test-636.cs. Sprinkle a few more 'EmitSideEffect's around * expression.cs (Unary.TryReduceConstant): Unwrap SideEffectConstant. * statement.cs (While, Do, For): Allow test to have side effects. (For.DoEmit): Always emit InitStatement. Fix test-635.cs * expression.cs (Binary.DoResolve) : Always create SideEffectConstant. (Binary.EnumLiftUp): Don't assume that the enumeration constant is of type EnumConstant. * expression.cs (Binary.EmitBranchable) : Handle 'right' being SideEffectConstant of type 'bool'. * expression.cs (Binary.EmitBranchable) : Use left.EmitBranchable instead of open coding it, so as to improve optimization opportunities. * constant.cs (SideEffectConstant.EmitSideEffect): Simplify slightly. * ecore.cs (Expression.EmitBranchable): Document some non-obvious assumptions. (Expression.EmitSideEffect): Document. 2008-04-23 Marek Safar * expression.cs: Implemented NewArrayBounds, TypeIs, and TypeAs expressions. 2008-04-23 Marek Safar * constant.cs, statement.cs: Use EmitSideEffect for constant if statement. 2008-04-23 Marek Safar * ecore.cs, expression.cs, delegate.cs: Implemeted delegate instantiation conversion to expression tree. 2008-04-23 Marek Safar * ecore.cs: Removed unused expression. 2008-04-22 Marek Safar * expression.cs: Implemented NegateChecked and New expressions. 2008-04-22 Marek Safar * convert.cs, nullable.cs, expression.cs: Implemented Negate expression. 2008-04-22 Raja R Harinath Fix #351102 * anonymous.cs (AnonymousMethodExpression.DoResolve): Mark as needing final 'ret' instruction. 2008-04-22 Marek Safar * expression.cs: Disabled lifted binary conversion on ISO-1 profiles. 2008-04-21 Marek Safar * expression.cs: Emit ldnull and not null expression as an instance argument of static method expression calls. 2008-04-21 Marek Safar A fix for bug #378200 * expression.cs: Fixed crash when creating parameterless expression tree method call. 2008-04-21 Marek Safar A fix for bug #375297 * anonymous.cs: Fixed crash when inferring from null argument anonymous method. 2008-04-21 Marek Safar A fix for bug #377596 * decl.cs, class.cs: Emit delegate type argument attributes. 2008-04-21 Marek Safar A fix for bug #365314 * generic.cs, ecore.cs: Type parameter declaration cannot be of generic type 2008-04-21 Marek Safar * cs-parser.jay, expression.cs: ComposedCast can work with type expressions only. 2008-04-21 Marek Safar * generic.cs (TypeParameter): Removed redundant location. 2008-04-19 Marek Safar * generic.cs, parameter.cs, namespace.cs, ecore.cs, class.cs, decl.cs, delegate.cs, iterators.cs, cs-parser.jay, const.cs, enum.cs: Use FullNamedExpression in all declaration type expression, statements will come later. 2008-04-18 Marek Safar * generic.cs, namespace.cs, ecore.cs, class.cs, decl.cs, generic-mcs.cs, nullable.cs, expression.cs, enum.cs, doc.cs: Cleaning up type expressions. 2008-04-18 Marek Safar * parameter.cs, delegate.cs, cs-parser.jay, expression.cs: Removed unused code. 2008-04-17 Marek Safar * decl.cs, class.cs, generic.cs: Verify partial parts type parameters and constraints. 2008-04-17 Marek Safar * decl.cs, class.cs, cs-parser.jay, ecore.cs, expression.cs: Unify all type name expressions. Also fixes #340463. 2008-04-17 Raja R Harinath Hook up 'EmitSideEffect' * constant.cs (Constant.EmitSideEffect): New. (SideEffectConstant.Emit): Simplify. Use EmitSideEffect. (SideEffectConstant.EmitSideEffect): New. * ecore.cs (BoxedCast.EmitBranchable): Remove. We can't use an unconditional branch in EmitBranchable. (FieldExpr.EmitBranchable): New. * expression.cs (Unary.EmitSideEffect): New. (Binary.EmitSideEffect): New. (VariableReference.EmitSideEffect): New. Do nothing. 2008-04-16 Raja R Harinath Introduce 'EmitSideEffect' * ecore.cs (Expression.EmitSideEffect): New. (TypeCast): Rename from EmptyCast. (EmptyCast): New. (EmptyCast.EmitBranchable, EmptyCast.EmitSideEffect): Implement. (BoxedCast.EmitBranchable, BoxedCast.EmitSideEffect): Implement. * convert.cs, nullable.cs: Update to changes. 2008-04-16 Marek Safar * class.cs, cs-parser.jay: Early check for base types expression. 2008-04-16 Marek Safar * decl.cs (MemberName): Declare PrettyName as obsolete. 2008-04-16 Marek Safar * namespace.cs: Use MemberName comparison. 2008-04-16 Raja R Harinath Fix build break * decl.cs (MemberName.PrettyName): New. Replaces the misnamed FullName. (MemberName.MethodName, MemberName.GetSignatureForError): Improve. (MemberName.FullyQualifiedName): New. Provides the functionality that users assume FullName would have. * ecore.cs, namespace.cs: Update to changes. * statement.cs (Using.assign): Make into ExpressionStatement. (Using.EmitPreTryBody): Simplify. 2008-04-16 Marek Safar * report.cs: ColorFormat is protected. * rootcontext.cs: Unused fields clean-up. * namespace.cs: Made UsingEntry name private. 2008-04-16 Marek Safar * cs-tokenizer.cs, location.cs: Removed unused field. 2008-04-16 Jan Oravec Raja R Harinath Fix #379822 * constant.cs (SideEffectConstant.value): Rename from 'left'. (SideEffectConstant.side_effect): Rename from 'right'. (SideEffectConstant..ctor): Normalize 'side_effect'. (SideEffectConstant.Emit): Emit 'value', not 'side_effect' as the value of this constant. * cfold.cs: Update to changes. 2008-04-15 Marek Safar * cs-paser.jay: Removed unused variable. * driver.cs: Made Compile instance method. 2008-04-15 Raja R Harinath * flowanalysis.cs (FlowBranching.MergeChild): Simplify. 2008-04-15 Marek Safar * cs-paser.jay, namespace.cs: Simplified handling of namespace imports. 2008-04-13 Jb Evain * namespace.cs: update the System.Core fullname for 2.1 * driver.cs: update the list of required assemblies for 2.1. Merged from the Moonlight 2 branch. 2008-04-11 Marek Safar * assign.cs, ecore.cs, expression.cs, nullable.cs: More work on nullable types and user defined operators. User operators arguments has to be checked for null value before invocation, which also means no operator is called when any argument is not convertible to unwrapped nullable type. 2008-04-09 Marek Safar * convert.cs, ecore.cs, expression.cs, nullable.cs: Initial refactoring of Unary expressions to follow operator overloading rules precisely. Also fixes #321794, #323794 2008-04-08 Marek Safar * cs-parser.jay, expression.cs: Don't wrap Indirection expression in Unary expression. 2008-04-08 Marek Safar * expression.cs, ecore.cs: Implemented MemberInit expression. 2008-04-08 Raja R Harinath Fix mono/tests/exception4.cs * statement.cs (ExceptionStatement, TryCatch): Revert to using ec.NeedReturnLabel () rather emitting a 'nop'. * statement.cs (ExceptionStatement.SomeCodeFollows): A hook for a simple heuristic. (TryCatch.SomeCodeFollows): Likewise. * flowanalysis.cs (FlowBranchingException): Call 'SomeCodeFollows' for 'break', 'continue' and 'return' statements inside a try. We're fairly sure that the generated IL stream will have more instructions textually following the try. (FlowBranchingTryCatch): Likewise. * statement.cs (Throw.Resolve): Move CS0156 and CS0724 testing ... * flowanalysis.cs (FlowBranching.CheckRethrow): ... here and to its overrides. * statement.cs (CollectionForeach.DisposableWrapper): Make a true wrapper -- forward everything to CollectionForeach. (CollectionForeach.NonDisposableWrapper): New. (CollectionForeach.EmitFinallyBody): Use 'endfinally' instruction instead of a pop + branch to end. 2008-04-07 Marek Safar A fix for bug #377485 * assign.cs, expression.cs, decl.cs, class.cs, ecore.cs, namespace.cs: Propagate location for extension method groups. Report conversion failure at right place. 2008-04-07 Marek Safar * anonymous.cs, expression.cs, ecore.cs, typemanager.cs: Implemented ListInit and Field expressions. 2008-04-06 Raja R Harinath * iterators.cs (Iterator.EmitMoveNext): Remove try/fault wrapper. Since $PC is always -1 inside the body of MoveNext, the fault handler is a no-op. * flowanalysis.cs (FlowBranchingException.EmitFinally): Kill. * statement.cs (ExceptionStatement.emit_finally): Likewise. (ExceptionStatement.ResolveFinally): Drop 'branching' argument. The denouement! Fix #324708 * iterators.cs (Iterator.EmitMoveNext): Reset $PC to -1 on entry. (Iterator.EmitYieldBreak): We no longer need to reset $PC. * statement.cs (ExceptionStatement.DoEmit): Actually emit the 'finally' inside the finally clause. * statement.cs (ExceptionStatement.DoEmit): Emit try/finally block inside an iterator. Don't emit the body of the 'finally' inside the finally clause yet. Use the ResumableStatement infrastructure for MoveNext () * iterators.cs (Iterator.EmitMoveNext_NoResumePoints): New. (Iterator.EmitMoveNext): Use 'resume_points'. Get rid of 'old_resume_points'. Move dispatcher upfront. (Iterator.MarkYield): Mark the 'resume_point' of a Yield. * statement.cs (ExceptionStatement.DoEmit): Emit a dispatcher if in an enumerator. This encodes the main fix in this patch series -- we can only jump into the first instruction of a try from the outside, but we want to emit try/finally regions in iterators and resume in the middle of them. 2008-04-05 Raja R Harinath * statement.cs (ExceptionStatement.ResolveFinally): Move setting of NeedReturnLabel here. Introduce a common point for emitting try/finally to IL * statement.cs (ExceptionStatement.DoEmit): New. Combines all the features of the various subclasses, which are now driven by ... (ExceptionStatement.EmitPreTryBody): ... this and ... (ExceptionStatement.EmitTryBody): ... this and the original EmitFinallyBody. (TryFinally, Lock, Using, UsingTemporary, DisposableWrapper): Remove DoEmit and update to follow above protocol. * statement.cs (ExceptionStatement.EmitForDispose): If all labels of the dispatcher are the same, skip emitting the 'switch'. * iterator.cs (Iterator.EmitDispose): Update to changes. Clean up handling of 'using' statement * statement.cs (UsingTemporary): New. Carved out of ... (Using): ... this. Simplify drastically. Handle exactly one variable. * cs-parser.jay (using_statement): Split. Create UsingTemporary or Using as appropriate. If there are multiple variable declared, create nested Using statements. (resource_acquisition): Kill. * statement.cs (ExceptionStatement.EmitForDispose): Use EmitFinallyBody, not EmitFinally. * flowanalysis.cs (FlowBranching.StealFinallyClauses): Remove. * iterator.cs: Update to changes. Start using the ResumableStatement infrastructure * statement.cs (ResumeableStatement.PrepareForDispose): New. (ResumableStatement.EmitForDispose): New. (ExceptionStatement): Override them. * iterators.cs (Iterator.EmitDispose): Use PrepareForDispose and EmitForDispose to create the body of the Dispose method. Don't use OldResumePoint. * iterator.cs (Iterator.AddResumePoint): Move here from ... * statement.cs (Toplevel.AddResumePoint): ... here. (Toplevel.MoveNextStatement.Resolve): Create FlowBranchingIterator. * flowanalysis.cs (FlowBranchingIterator): New. * codegen.cs (EmitContext): Update to changes. * iterators.cs (Iterator.OldResumePoint): Rename from ResumePoint. (Iterator.old_resume_points): Rename from 'resume_points'. (Iterator.MoveNextStatement): Remove unused class. New infrastructure for try/finally in iterators (still unused) * flowanalysis.cs (FlowBranching.AddResumePoint): New. (FlowBranchingToplevel.AddResumePoint): Hook into ToplevelBlock.AddResumePoint. (FlowBranchingTryCatch): Move CS01626 and CS01631 checks here. (FlowBranchingException): Hook into ExceptionBlock.AddResumePoint. * statement.cs (ToplevelBlock.AddResumePoint): New. Collect resume points and assign program-counter values. (ExceptionBlock.AddResumePoint): Collect resume points for de-muxer at the top of try block. * iterators.cs (Yield.CheckContext): Simplify. (Yield.Resolve): Use FlowBranching.AddResumePoint. 2008-04-04 Raja R Harinath * flowanalysis.cs (FlowBranching.AddReturnOrigin): Change Location argument to an ExitStatement. (FlowBranchingException): Refactor saved origins code. * statement.cs (ExitStatement): Update to cahges. * iterator.cs (YieldBreak): Likewise. * statement.cs (ResumableStatement): New. Common base class for YieldReturn and ExceptionStatement. (ExitStatement): New. Common base class for Return and YieldBreak. (Return): Update to changes. * iterator.cs (YieldBreak): Likewise. * lambda.cs (ContextualReturn): Likewise. Fix #377028 * ecore.cs (Expression.ResolveAsTypeStep): If '!silent' attempt to emit a meaningful error message. Fix #324765, #319508 * flowanalysis.cs (VariableInfo.IsEverAssigned): New. (VariableInfo.SetAssigned): Set it. * statement.cs (Block.UsageWarning): Use 'IsEverAssigned' to determine if CS0219 or CS0168 is appropriate. Don't use flow-analysis information. (Block.Resolve): Use ec.EndFlowBranching, not ec.DoEndFlowBranching. * codegen.cs (EmitContext.DoEndFlowBranching): Kill. Inline into ... (EmitContext.EndFlowBranching): ... this. 2008-04-03 Marek Safar * class.cs, typemanager.cs: Emit volatile field with IsVolatile modifier. 2008-04-03 Marek Safar A fix for bug #376508 * convert.cs, expression.cs: Fixed difference between ImplicitConversion and ImplicitConversionExists. 2008-04-03 Marek Safar * expression.cs (Binary): Added remaining binary operators to expression tree builder. * nullable.cs: Optimize shift with null argument. 2008-04-03 Raja R Harinath Fix minor IL regression * statement.cs (TryCatch..ctor): Add 'inside_try_finally' argument. (TryCatch.DoEmit): Use it to avoid creating another ExceptionBlock. * cs-parser.jay (try_statement): Update to changes. * statement.cs (TryFinally.need_exc_block): Delete. (TryFinally): Update to changes. Now all ExceptionStatements are unconditional * statement.cs (CollectionForeach.DisposableWrapper): New. Extract out the try/finally code into a new wrapper. (CollectionForeach.Resolve): Use it to simplify the code. 2008-04-02 Raja R Harinath Start at simplifying ExceptionStatement semantics a bit * statement.cs (TryCatch, TryFinally): Split 'Try' into two pieces. * cs-parser.jay (try_statement): Update to changes. (opt_catch_clauses): Remove. * flowanalysis.cs: Update to changes. (FlowBranching.BranchingType.TryCatch): New. (FlowBranchingTryCatch): New. * flowanalysis.cs (FlowBranching.BranchingType.SwitchSection): Kill. (FlowBranching.CreateBranching): Update to changes. (FlowBranchingBlock.AddSibling): Add sanity check. * codegen.cs (EmitContext.StartFlowBranching) : Update to changes. * iterators.cs (Iterator.MarkFinally): Remove. * statement.cs (ExceptionStatement): Update to changes. Add support for skipping over finally blocks at runtime. First in a series to fix #324708 * iterators.cs (Iterator.SkipFinally): New LocalBuilder. (Iterator.EmitMoveNext): Initialize it. * statement.cs (ExceptionStatement.EmitFinally): Use it to emit a branch over the body of the 'finally' clause. 2008-03-31 Raja R Harinath Avoid lopsided use of Foo/DoFoo names * statement.cs (ExpressionStatement.EmitFinallyBody): Rename from EmitFinally. (ExpressionStatement.EmitFinally): Rename from DoEmitFinally. * iterator.cs: Update to changes. 2008-04-02 Marek Safar * ecore.cs, expression.cs, nullable.cs: ConditionalLogicalOperator is now based on UserOperatorCall. More binary nullable operators clean up. 2008-04-02 Martin Baulig * symbolwriter.cs: Remove the `#if !DISABLE_TERRANIA_CHANGES' conditionals. 2008-04-02 Marek Safar * nullable.cs: Merge user and empty conversions when lifting expression trees. * expression.cs (StringConcat): Implemented expression tree representation. 2008-04-01 Marek Safar * nullable.cs: When lifting null literal and a user operator exists, no call is made. 2008-04-01 Marek Safar * nullable.cs, ecore.cs, expression.cs: Convert null arithmetic to lifted null. 2008-04-01 Marek Safar * nullable.cs, expression.cs: Use namespace instead heavily nested monster abstract class. 2008-04-01 Marek Safar * ecore.cs, convert.cs, constant.cs, nullable.cs, expression.cs: Implemented lifting of null literal and user operators. Clean up of some temporary nullable hacks. 2008-03-30 Raja R Harinath Fix #368224, test-629.cs * flowanalysis.cs (FlowBranching.StealFinallyClauses): Return true if it crossed an unwind-protect boundary. * iterators.cs (Yield.CheckContext): Relax check for 'yield break'. (Yield.Resolve, Yield.DoEmit): Track whether the yield occurs inside an unwind-protected region. (YieldBreak.Resolve, YieldBreak.DoEmit): Likewise. (Iterator.MarkYield): Add 'unwind_protect' parameter. Emit a 'leave' instead of a 'br' if unwind-protected. (Iterator.EmitYieldBreak): Likewise. 2008-03-29 Gert Driesen * driver.cs: Only define versioninfo resources if no win32 resource file was specified. 2008-03-28 Marek Safar A fix for bug #372375 * convert.cs: Fixed boxing of nullable types. 2008-03-28 Marek Safar * typemanager.cs: Initialize InternalsVisibleTo as the very first optional type. 2008-03-28 Marek Safar A fix for bug #374619 * nullable.cs: Fixed guarding of EmitBitwiseBoolean. 2008-03-27 Marek Safar * lambda.cs: Check return type only for invocation. 2008-03-27 Marek Safar A fix for bug #374214 * ecore.cs: Correctly report argument type mismatch. 2008-03-27 Marek Safar * convert.cs (ImplicitReferenceConversionCore): Correctly compare enum type and not rely on broken IsEnum. 2008-03-27 Marek Safar * nullable.cs: New file, extracted from generic.cs. * generic.cs, generic-mcs.cs, *.csproj, *.sources: Updated. 2008-03-27 Marek Safar * generic.cs, convert.cs, generic-mcs.cs, expression.cs: Added lifting of predefined comparison operators and null literals. * report.cs: New warning ID. 2008-03-25 Marek Safar A fix for bug #370577 * lambda.cs: Check return type too. 2008-03-25 Marek Safar A fix for bug #372846 * class.cs: Automatic properties can be declared as unsafe. 2008-03-20 Marek Safar * location.cs: Use string based concatenation. * expression.cs: LiftedBinaryOperator is gmcs only. 2008-03-20 Marek Safar * generic.cs, literal.cs, ecore.cs, expression.cs: Ongoing work on nullable conversions rules and expression trees. 2008-03-19 Marek Safar * delegate.cs: Use extension method source as delegate target. 2008-03-19 Marek Safar * generic.cs, generic-mcs.cs, expression.cs, ecore.cs: Rewrote nullable binary operations to be purely based on binary operations and optimized emitted code (30% less in some cases). Introduced ReducedExpression for ETs and other ET refactoring. * typemanager.cs: Fixed warning. 2008-03-17 Marek Safar * class.cs, decl.cs, delegate.cs: Do protected modifier check on each member * symbolwriter.cs: Fixed. 2008-03-17 Marek Safar * anonymous.cs, driver.cs: Reset anonymous types counters. 2008-03-17 Marek Safar * ecore.cs (MethodGroupExpr): Skip first candidate, it's already the best. * class.cs: Use fullname for all type member definitions. 2008-02-19 Martin Baulig * class.cs (IMethodData.EmitExtraSymbolInfo): New interface method. (MethodData.Emit): Call method.EmitExtraSymbolInfo(). (MethodOrOperator.EmitExtraSymbolInfo): Implement this new interface method here as an empty public virtual method. * anonymous.cs (AnonymousMethodMethod.ctor): Added `string real_name' argument. (AnonymousMethodMethod.EmitExtraSymbolInfo): Override and call CodeGen.SymbolWriter.SetRealMethodName(). 2008-02-18 Martin Baulig * anonymous.cs (ScopeInfo.EmitType): Override this and emit debugging information for captured variables. (RootScopeInfo.EmitType): Override this and emit symbol information for a captured `this'. 2008-02-15 Martin Baulig * iterators.cs: Emit debugging info. * codegen.cs (EmitContext.Flags): Add `OmitDebuggingInfo'. (EmitContext.OmitDebuggingInfo): New public property. * statement.cs (While): Override Emit() and don't emit symbol info there; do it inside DoEmit() instead. (Block.Emit): Omit symbol information while emitting the scope initializers; don't ec.Mark() the `EndLocation'. Fix the lexical block logic. (ExplicitBlock.IsIterator): Moved here from `ToplevelBlock'. (ToplevelBlock.MakeIterator): Pass the `flags' to `ExplicitBlock's .ctor to make `IsIterator' work. 2008-03-14 Martin Baulig * symbolwriter.cs: Added the new symbol writer function from the debugger's `terrania' branch; temporarily enclose them inside `#if !DISABLE_TERRANIA_CHANGES' conditionals until I'm back from my vacations. 2008-03-14 Martin Baulig * symbolwriter.cs (SymbolWriter): Make this a public static class. * codegen.cs (CodeGen.SymbolWriter): Removed; use the new static `SymbolWriter' class instead of using `if (CodeGen.SymbolWriter != null)' everywhere. 2008-03-14 Marek Safar A fix for bug #370577 * statement.cs, lambda.cs: Added extra limitations when dealing with void return type. 2008-03-14 Marek Safar * typemanager.cs (CSharpName): Made 250 times faster. 2008-03-13 Marek Safar * ecore.cs, expression.cs: Emit conversion for ET shift argument. 2008-03-12 Marek Safar * generic.cs, typemanager.cs, enum.cs, codegen.cs, statement.cs: Try not to crash when predefined field does not exist. 2008-03-12 Marek Safar * ecore.cs (PropertyExpr): Fixed IsSingleDimensionalArrayLength regression. 2008-03-12 Marek Safar * class.cs (FixedField): Don't crash when contructors are missing. 2008-03-11 Marek Safar * typemanager.cs, namespace.cs, literal.cs, ecore.cs, class.cs, decl.cs, convert.cs, constant.cs, expression.cs, statement.cs: Use same method to check internal types accessibility for internal and external types. Replaced EnumToUnderlying by GetEnumUnderlyingType. 2008-03-11 Marek Safar * support.cs, typemanager.cs, pending.cs, ecore.cs, class.cs, delegate.cs convert.cs, const.cs, anonymous.cs, constant.cs, expression.cs, attribute.cs, statement: Use corect instance of predefined types (work related to #364674). 2008-03-07 Marek Safar * expression.cs (TypeOfVoid): Fixed predefined method initialization. 2008-03-07 Marek Safar * generic.cs, typemanager.cs, parameter.cs, rootcontext.cs, ecore.cs, class.cs, delegate.cs, iterators.cs, const.cs, constant.cs, driver.cs, expression.cs, attribute.cs, codegen.cs, statement.cs: TypeManager optional predefined types clean up, delayed predefined types members initialization (work related to #364674). 2008-03-05 Marek Safar * typemanager.cs (IsFriendAssembly): InternalsVisibleTo is not mandatory. 2008-03-05 Marek Safar * typemanager.cs, parameter.cs, rootcontext.cs, ecore.cs, class.cs, decl.cs, delegate.cs, convert.cs, driver.cs, attribute.cs, codegen.cs: TypeManager predefined types clean up (work related to #364674). 2008-03-04 Marek Safar * ecore.cs: Print an error message instead of throwing exception. 2008-03-04 Marek Safar * generic.cs, typemanager.cs, literal.cs, convert.cs, cfold.cs, constant.cs, expression.cs, statement.cs: Unififed null literal representation. 2008-03-03 Marek Safar * anonymous.cs, cfold.cs, convert.cs, delegate.cs, doc.cs, ecore.cs, expression.cs: Refactored binary operators resolve phase and improved speed. The nullable code is still missing and won't work correctly, more fixes required. It also fixes #323726, #324312, #324248, and many other unreported issues. 2008-02-29 Zoltan Varga * report.cs (FeatureIsNotAvailable): Use 'mcs1' instead of 'mcs', and 'mcs' instead of 'gmcs'. 2008-02-27 Marek Safar * ecore.cs: Clean-up and split BetterConversion. 2008-02-25 Raja R Harinath Fix #363791 * enum.cs (EnumMember.Value): Only access 'value' if ResolveValue says it's ok. (EnumMember.DoResolveValue): Don't set prev_member.value. (Enum.GetDefinition): Reverse arguments of Equals -- EnumMember.Value can return 'null'. * statement.cs (Switch.Error_AlreadyOccurs): Fix typo in name. 2008-02-22 Marek Safar * generic.cs, expression.cs: More ongoing work on expression trees. 2008-02-21 Marek Safar * class.cs, typemanager.cs: Rewrote operator matching logic to correctly handle missing matches when mutiple operators exist. 2008-02-20 Marek Safar A fix for bug #363218 * expression.cs (ArrayCreation.Clone): Deal with multi-dimensional initializers. 2008-02-20 Marek Safar * expression.cs, constant.cs, cfold.cs: Yet another side-effect constant update. This time to deal correctly with SideEffectConstant expression used as an argument for another constant folding. 2008-02-20 Raja R Harinath * typemanager.cs (DropGenericMethodArguments): Ensure we get an underlying MethodBuilder. 2008-02-19 Marek Safar * constant.cs, cfold.cs: SideEffectConstant results can apply for folding. 2008-02-19 Marek Safar A fix for bug #328136 * expression.cs: Do not fold immediately LogicalAnd operators when the left side is a false constant, because we still need to evaluate the right-hand side. * statement.cs (If): Emit two types of boolean constants (simple constant, side-effect constant). 2008-02-19 Marek Safar * constant.cs (SideEffectConstant): Don't emit boolean constant. * expression.cs: Fold immediately LogicalAnd operators when both sides are constants. 2008-02-18 Marek Safar A fix for bug #361457 * ecore.cs (IsApplicable): Params methods have lower priority. * support.cs: Return correct parameter modifier for params types. 2008-02-18 Marek Safar * generic.cs (TypeParameter): Cache attribute target name. * support.cs: Removed unused variable. * typemanager.cs: Removed debugging leftover. * ecore.cs: Use local type instead of a property; * class.cs (VerifyMembers): Consider also parent to test whether type member is local or public. * expression.cs (FullMethodDesc): Removed. * attribute.cs (IsValidArgumentType): Made static. 2008-02-17 Raja R Harinath Cleanup to be more readable. * Makefile (GMCS_PROFILE): Remove. (COMPILER_NAME): New helper. 2008-02-15 Miguel de Icaza * cs-tokenizer.cs: if a conditional expression happens inside a (...) this also means that we do not need to de-ambiguate between an parenthesized expression and a cast. Fixes 346484. * constant.cs (SideEffectConstant): a constant value that happens to have a side effect. Fixes the build regressions introduced by the fix for #359789 2008-02-14 Rodrigo Kumpera * expression.cs (Conditional.Emit): when emitting the ternary operator, use local variables to generate code verifiable code. The verifier cannot infer that the type on stack before the stloc.0 is executed is of type ParentB. This happens because the stack merge algorithm uses only parent types when deciding which is the common type. This is described in Part III 1.8.1.3 of ECMA 335. This code compiled with mcs is not verifiable under MS. The MS verifier picks the first common interface of Foo and Bar, which is wrong, but doesn't use a full join type of the 2 interfaces. CSC uses a clever hack to compile such code in a verifiable way. It stores the intermediate values in a local variable with the expected type. Fixes: #358102 2008-02-14 Miguel de Icaza * expression.cs: Do not fold BitwiseAnd operators when the left side is a false constant, because we still need to evaluate the right-hand side. Fixes #359789 * support.cs: Instead of throwing an InternalErrorException when the position of the stream is outside the boundary of our buffer, reset the state of the reader, and restart the reading from the beginning of the file. 2008-02-14 Marek Safar * generic.cs (TypeParameter.GetMembers): Is not supported operation. 2008-02-14 Marek Safar A fix for bug #361686 * decl.cs: A protected types used inside a private class which parents derives from the protected class are accessible. 2008-02-13 Marek Safar * generic.cs (ConstraintChecker): Use cached member lookup when looking for the parameterless constructor. 2008-02-13 Marek Safar * generic.cs, typemanager.cs, iterators.cs, codegen.cs: Refactored core lookup methods to use standard member cache when doing member lookup. 2008-02-12 Marek Safar * driver.cs: Don't report full path for referenced module as assembly error. 2008-02-12 Marek Safar * Makefile: Fixed `qh' target to work on all machines. * report.cs, typemanager.cs, parameter.cs, ecore.cs, class.cs, anonymous.cs, expression.cs, codegen.cs, statement.cs, doc.cs: Replaced type IsSubclassOf and HasElementType with TypeManager implementation. 2008-02-08 Marek Safar A fix for bugs #325134, #359749 * expression.cs, ecore.cs: Try to resolve an extension method even if the first binds point to non-method member expression. 2008-02-08 Marek Safar * cs-parser.jay: Null coalescing operator is not part of ISO-1. 2008-02-08 Marek Safar A fix for bugs #321394, #323028 * generic.cs, parameter.cs, ecore.cs, class.cs, decl.cs, delegate.cs: Reworked naive IsAccessibleAs implementation to handle nested types. 2008-02-05 Jb Evain * class.cs: use generic type comparison for parameters as well. 2008-02-05 Marek Safar A fix for bug #325372 * class.cs: Use generic type comparison when testing method signatures. 2008-02-05 Marek Safar A fix for bug #357047 * ecore.cs: Applied C# 3.0 changes to better conversion. 2008-02-05 Marek Safar A fix for bug #358374 * cs-parser.jay: Correctly set modifiers for all constructor types. 2008-02-04 Marek Safar A fix for bug #355251 * generic.cs: Added base class constraint based type inference. 2008-02-01 Marek Safar A fix for bug #357255 * decl.cs: One more missing visibility check. 2008-02-01 Marek Safar * support.cs: Fixed broken return. 2008-01-25 Marek Safar * report.cs: Correctly reset warnings count after probing. 2008-01-25 Martin Baulig * namespace.cs (NamespaceEntry.SymbolFileID): Make this work again after MemberName.ToString() is gone. 2008-01-25 Marek Safar * expression.cs: Implemented Divide, Equal, ExclusiveOr, GreaterThanOrEqual expressions. 2008-01-25 Marek Safar * generic.cs: Use full implicit conversion for type inference fixing. 2008-01-24 Marek Safar * ecore.cs, expression.cs, generic.cs: Implemented Convert, ConvertChecked. Fixed user operator conversions. 2008-01-24 Marek Safar * generic.cs: Do nullable type to null comparison optimization during resolve phase. 2008-01-24 Marek Safar A fix for bug #355163 * generic.cs: Enabled l-value resolve on nullable expressions. 2008-01-24 Marek Safar A fix for bug #353986 * class.cs: Ingore static ctors with parameters for any further checks. 2008-01-24 Marek Safar A fix for bug #354310 * namespace.cs: Removed redundant check. 2008-01-24 Marek Safar A fix for bug #354928 * expression.cs: ElementInitializers can be resolved only once. 2008-01-24 Marek Safar * convert.cs, ecore.cs, expression.cs, generic.cs: Implemented Coalesce and Condition expressions. 2008-01-23 Marek Safar * codegen.cs: Fixed AssemblyBuilder initialization on other platforms. 2008-01-22 Marek Safar * ecore.cs, expression.cs, generic.cs: Implicit bool? to bool conversion is not allowed. * generic.cs: Implemented coalesce expression. 2008-01-22 Marek Safar A fix for bug #355145 * anonymous.cs, convert.cs, ecore.cs, generic.cs, lambda.cs: Implemented expression tree type inference. 2008-01-22 Raja R Harinath Fix #354663 * expression.cs (Binary.IsUnsignedType): Fix typo. 2008-01-22 Marek Safar * ecore.cs, expression.cs, generic.cs: Implemented NewArrayInit expression. 2008-01-22 Marek Safar A fix for bug #355161 * ecore.cs, expression.cs: Wider range of extension method supported expressions. 2008-01-22 Gert Driesen * codegen.cs: Use magic value for AssemblyBuilderAccess to instruct AssemblyBuilder to operate in compiler context. Fixes mcs part of bug #354970. 2008-01-22 Marek Safar A fix for bug #355148 * ecore.cs, expression.cs: Correctly report misused ref and out modifiers. 2008-01-22 Miguel de Icaza * expression.cs (CreateExpressionTree): Add support for or and logical or, and indent following the coding conventions. * typemanager.cs (LinqExpression): renamed from ExpressionTreeManager, for a shorter name. Use TypeManager.CoreLookupType to lookup types from our core assemblies and turn those into "Type" variables. Consumers that previously used "Namespace" and "Type" from this class should instead use the TypeExpression which is a type that is fully resolved (without involving the regular C# resolution rules). This typically looks like this: TypeExpression texpr = new TypeExpression (LinqExpression.expression_type, loc); new MemberAccess (texpr, name, type_arguments, loc) This avoids the problem in: #355178 2008-01-21 Marek Safar * cs-parser.jay, expression.cs: Check `namespace alias qualifier' language feature in parser only as we do in other cases. 2008-01-21 Marek Safar * attribute.cs, ecore.cs, class.cs, delegate.cs, expression.cs, linq.cs, typemanager.cs: A refactoring of params arguments to reuse existing expressions (params -> array initializer) to emit params argument instead of specialized handling. It was required by expression tree implementation and it has other benefits as well, we now apply same optimization for params arguments as we do for array initializers. 2008-01-18 Marek Safar A fix for bug #353526 * generic.cs: A type inference of params arguments may not required any temporary array creation. 2008-01-18 Marek Safar A fix for bug #353534 * generic.cs, ecore.cs, expression.cs: A method group type inference is supported for delegates only. 2008-01-18 Marek Safar * generic.cs: Fixed 3.0 type inference fixing phase to determine a unique type for more than 1 candidates. 2008-01-18 Marek Safar * typemanager.cs, ecore.cs, expression.cs: Implemented ArrayLength and Call expressions. 2008-01-16 Marek Safar * generic.cs, typemanager.cs, lambda.cs, parameter.cs, ecore.cs, constant.cs, expression.cs: Implemented Add, And, AndAlso, and ArrayIndex (without unary operator) expressions. 2008-01-16 Zoltan Varga * statement.cs: Avoid declaring an IL variable for this_variable since it is not accessed from the generated IL. 2008-01-14 Marek Safar * typemanager.cs, lambda.cs, parameter.cs, ecore.cs, class.cs, delegate.cs, iterators.cs, convert.cs, assign.cs, anonymous.cs, expression.cs, statement.cs: The first expression tree implementation drop, mostly infrastructure work. 2008-01-14 Marek Safar * ecore.cs (IsNestedChild): Refactored. 2008-01-11 Marek Safar * lambda.cs: Don't use a cast on unknown expression statement. 2008-01-10 Geoff Norton * cs-tokenizer.cs: One more token to distinguish between method and lambda arguments 2008-01-09 Marek Safar * doc.cs: Report better /doc crash details. 2008-01-09 Marek Safar A fix for bug #352536 * ecore.cs, assign.cs, codegen.cs: Check event assignments. 2008-01-08 Marek Safar A fix for bug #352287 * ecore.cs, expression.cs: Do `this' access checking in all member access expressions. 2008-01-08 Marek Safar * rootcontext.cs, driver.cs: Switch to linq mode by default. * report.cs: Reset message stacks. 2008-01-08 Marek Safar * generic.cs (InferInPhases): Correctly calculate params position. 2008-01-08 Marek Safar * cs-tokenizer.cs: No need to parse full string when parsing lambda arguments. 2008-01-07 Marek Safar * cs-tokenizer.cs: Enabled lambda arguments micro-parser for all profiles. * decl.cs (LookupNamespaceOrType): Don't cache names which caused an error. * driver.cs: Updated --help option. 2008-01-07 Marek Safar * generic.cs (InferParamsTypeArguments): Removed. (InferInPhases): Add params type inference. (LowerBoundInference): Fixed scoring mechanism. * cs-tokenizer.cs (PreProcessPragma): Use Location instead of line. 2008-01-06 Gert Driesen * typemanager.cs: On 2.0 profile, GetPublicKeyToken returns an empty byte array for unsigned "baked" assemblies. 2008-01-05 Gert Driesen * codegen.cs: AssemblyName.GetPublicKey returns a zero-length byte array for assemblies that are not strongnamed. 2008-01-04 Marek Safar A fix for bug #351481 * expression.cs (MemberAccess.ResolveNamespaceOrType): Use correct declaring type for nested generic types. 2008-01-04 Marek Safar * namespace.cs, class.cs, decl.cs, cs-parser.jay: Use GetSignatureForError instead of ToString. 2008-01-03 Marek Safar A fix for bug #351047 * expression.cs (Binary.ResolveOperator): Allow equality operators between null and structs only when equality and inequality operators are defined either as an user-operators or predefined operators. 2008-01-03 Marek Safar A fix for bug #351047 * generic.cs, typemanager.cs, class.cs: New IsReferenceType helper method. 2008-01-03 Marek Safar A fix for bug #351257 * cs-tokenizer.cs: Advance line number for '\r' correctly. 2008-01-03 Marek Safar A fix for bug #351157 * class.cs (Using): Fixed yet another broken cloning. (Block): Put back more sensible default value for statements. 2008-01-01 Gert Driesen * codegen.cs: Allow AssemblyVersion with only major version component. Fixes bug #351055. 2007-12-29 Marek Safar A fix for bug #324654 * class.cs: Use FullName property as member name. 2007-12-28 Marek Safar A fix for bug #342117 * generic.cs (ConstraintChecker): Struct constraint also satisfies default constructor constraint. 2007-12-28 Marek Safar A fix for bug #338273 * class.cs (ProbertyBase): Access modifier checks are required for overrides only. 2007-12-28 Marek Safar A fix for bug #350839 * ecore.cs (MethodroupExpr): Probing hacks are no longer required. 2007-12-27 AdTsai (http://code.google.com/u/AdTsai/) Reviewed by Ben Maurer, Miguel de Icaza, patches from Google's GHOP: http://code.google.com/p/google-highly-open-participation-mono/issues/detail?id=4 * statement.cs: Changed some Hashtables to use HybridDictionaries instead. It was observed that some HashTables only contained a few items in the vast majority of cases. Since HybridDictionary is more efficient on small sets (<10 elements), "known_variables" from class ExplicitBlock as well as "labels" and "constants " from class Block were changed to HybridDictionaries. Atsai results: (56216kb->54987kb) Miguel results (bootstrap of mcs): 59819kb -> 59290kb 2007-12-27 AdTsai (http://code.google.com/u/AdTsai/) Reviewed by Ben Maurer, Miguel de Icaza, patches from Google's GHOP: http://code.google.com/p/google-highly-open-participation-mono/issues/detail?id=4 * expression.cs: foreach loop to for loop, saved on allocation of enumerator (59333kb->59141kb) * statement.cs. Changed foreach loops to for loops, saved on allocation of enumerator (59141kb->59006kb) * decl.cs: ArrayLists in .NET 1.1 allocate 16 elements by default when constructed with no specified capacity. This was causing a few ArrayLists to allocate more memory than they would potentially need in the Block class and MemberCache class. Setting the ArrayLists to construct with a capacity of 1 saves some memory. (56216kb->55585kb) 2007-12-27 Marek Safar A fix for bug #347189 (2nd issue) * expression.cs (MemberAccess): Nested type can be found in base non-generic type. 2007-12-27 Miguel de Icaza * report.cs: Do not use colors if stdout and stderr are not a terminal. 2007-12-27 Marek Safar A fix for bug #346998 * ecore.cs (MethodGroupExpr): Implemented override filter for generic overloads. 2007-12-27 Marek Safar A fix for bug #343465 * class.cs: Explicit method name for nested types uses dots only. 2007-12-27 Marek Safar A fix for bug #343707 * cs-tokenizer.cs: Advance line number for mixed CR/LF files correctly. 2007-12-27 Marek Safar * ecore.cs: Report type inference errors only when arguments count matches parameter count. * generic.cs (NullCoalescingOperator): Cannot be applied to null. * expression.cs, report.cs: New warning. * typemanager.cs: Catch anonymous method type too. 2007-12-23 Marek Safar A fix for bug #346379 * expression.cs (UnaryMutator): Emit size of type for pointer mutator. 2007-12-23 Marek Safar A fix for bug #347359 * expression.cs (Invocation): Don't resolve already resolved expression. 2007-12-23 Marek Safar A fix for bug #347189 * class.cs (FixedField): Use non-dependent code only in the define phase. 2007-12-23 Marek Safar A fix for bug #348076 * ecore.cs (FieldExpr.DoResolve): Allow any variable based expression. 2007-12-22 Marek Safar * ecore.cs (MethodGroupExpr.OverloadResolve): Set type arguments for discovered extension methods. 2007-12-22 Marek Safar * ecore.cs, namespace.cs, expression.cs: Removed broken ResolveGeneric method. 2007-12-21 Miguel de Icaza * report.cs (ErrorMessage): Add support for using colors on terminals that support it. 2007-12-21 Marek Safar * ecore.cs: Use information about expanded params for error reporting. 2007-12-21 Marek Safar * ecore.cs, generic.cs, delegate.cs: Refactoring of method overloading code and logic for params overloads. 2007-12-15 Miguel de Icaza * generic.cs (NullCoalescingOperator.CloneTo): implement this one, as this is also created from the parser. Fixes #349034 2007-12-12 Miguel de Icaza * statement.cs (Throw.CloneTo): it is valid to have empty expressions for throw. 2007-12-03 Marek Safar * cs-parser.jay: Set delegate constraint parsing region correctly. 2007-12-03 Marek Safar A fix for bug #345467 * typemanager.cs (IsEqual): Compare generic parameters position only. 2007-11-28 Marek Safar * expression.cs (BaseAccess): Type arguments can be null. 2007-11-27 Raja R Harinath * statement.cs (Block.Resolve): Ensure flow-branching tree is consistent even when an error has occured. (Switch.Resolve): Likewise. 2007-11-22 Marek Safar A fix for bug #334505 * class.cs: Don't ignore InternalsVisibleTo attribute for internal overrides. 2007-11-22 Marek Safar * ecore.cs, typemanager.cs, delegate.cs, expression.cs: The first of refactorings required to resolve extension methods correctly when mixing generics and non-generics members. 2007-11-20 Marek Safar A fix for bug #342584 * convert.cs: Added not documented explicit IntPtr/UIntPtr to enum conversion. 2007-11-19 Marek Safar A fix for bug #342512 * delegate.cs: Use delegate argument expression when is available. Don't emit virtual call when class is sealed. 2007-11-16 Marek Safar A fix for bug #325423 * assign.cs (FieldInitializer): Use resolved expression for emit. * class.cs: Print less confusing error message. 2007-11-16 Marek Safar * cs-tokenizer.cs: Removed GMCS ifdefs. * rootcontext.cs, report.cs: Report unavailable gmcs features used by mcs. * cs-parser.jay: Disabled nullable check. * generic-mcs: Copied more generic stuff. 2007-11-16 Marek Safar * gcs-parser.jay: Merged to cs-parser.jay. * generic.cs, typemanager.cs, cs-tokenizer.cs, linq.cs, Makefile * *.csproj, *.sources: Updated to use only jay parser file. 2007-11-16 Marek Safar * gcs-parser.jay: Added nullable and default expression feature checks. 2007-11-16 Marek Safar * gcs-parser.jay, cs-parser.jay, class.cs: Unified parameters parsing, it fixes many TODOs and hidden bugs. * expression: Removed duplicate error check. 2007-11-15 Marek Safar * gcs-parser.jay, statement.cs, decl.cs, ecore.cs: Try to resolve an implicitly type local variable only when it is used in a declaration. 2007-11-15 Marek Safar * attribute.cs: Use CS0612 for empty strings. 2007-11-14 Marek Safar * lambda.cs, statement.cs: Contextual return may act as a statement. 2007-11-14 Marek Safar A fix for a regression cause by #324222 * class.cs: Don't report unused even when it implements an interface. 2007-11-13 Marek Safar A fix for bug #341205 * ecore.cs, expression.cs: Method group expression cannot do static method access with an instance reference check before overloading takes a place. 2007-11-13 Marek Safar A fix for bug #325359 * class.cs: Use predictable name for automatically generated property. 2007-11-12 Marek Safar A fix for bug #324996 * expression.cs (Is): Handle case where D is nullable and T is not correctly. * generics.cs (Nullable.HasValue): Nullable HasValue expression. 2007-11-12 Marek Safar * generic.cs, literal.cs, ecore.cs, class.cs, delegate.cs, const.cs, anonymous.cs, expression.cs, attribute.cs, codegen.cs, statement.cs: Flush small error reporting changes. 2007-11-09 Marek Safar A fix for bug #324996 * expression.cs: Rewrote Is expression implementation to work with generics, nullable types, anonymous method. A const result expression uses existing infrastructure instead of custom not fully-featured one. 2007-11-08 Marek Safar A fix for bug #340202 * class.cs: Consider generics for volatile field. 2007-11-08 Marek Safar A fix for bug #335594 * expression.cs: Use conversion rules when handling string addition. 2007-11-07 Marek Safar A fix for bug #336651 * expression.cs: Fixed a crash when probing is on. 2007-11-07 Marek Safar A fix for bug #324242 * covert.cs: Added a conversion from any nullable-type with an underlying enum-type to the type System.Enum. 2007-11-07 Marek Safar A fix for bug #324222 * class.cs: Report all non-used event fields. 2007-11-07 Marek Safar A fix for bug #325161 * cs-parser.jay, gcs-parser.jay, decl.cs: Implemented namespace alias qualifier for generic types. 2007-11-07 Marek Safar A fix for bug #322971 * expression.cs, ecore.cs: Added intermediate result value check for indexers. 2007-11-07 Marek Safar A fix for bug #324754 * cs-parser.jay, gcs-parser.jay, class.cs: Try to create an interator when it was requested. 2007-11-07 Marek Safar A fix for bug #325101 * expression.cs: Do type not value comparison for `is' expression. 2007-11-07 Marek Safar A fix for bug #320236 * convert.cs: Don't apply user conversion on underlying target type. 2007-11-06 Marek Safar * expression.cs: Don't use unresolved expression for error reporting. 2007-11-06 Marek Safar A fix for bugs #337712, #324490 * ecore.cs (MethodGroupExpr): Refactored to handle delegate method overloading resolution too. * delegate.cs: Uses MethodGroupExpr for overloading resolution. It makes the process consistent and more robust. * expression.cs, linq.cs, report.cs: Update. 2007-11-02 Marek Safar A fix for bug #332909 * attribute.cs: Resolve attributes in correct context using error handling procedure. * rootcontext.cs: Define Obsolete attribute members as core members. 2007-11-02 Marek Safar * statement.cs: Removed unused methods. 2007-10-31 Wade Berrier * Makefile: reenable copy of gmcs.exe.config, but include it in EXTRA DIST (it doesn't get included because PROGRAM isn't defined to be gmcs during 'make dist') 2007-10-31 Marek Safar A fix for bug #338102 * decl.cs (CheckExistingMembersOverloads): Workaround issue with generic methods registered as non-generics. 2007-10-31 Marek Safar A fix for bugs #337712, #324490 * delegate.cs: Delegate covariance and contravariance is not allowed for value types. 2007-10-31 Marek Safar A fix for bug #337719 * cs-tokenizer.cs: Restore identifier buffer when parsing contextual `from' keyword. 2007-10-30 Marek Safar * Makefile (net_2_0_bootstrap/mcs.exe.config): Reverted copy gmcs.exe.config. 2007-10-29 Marek Safar * cs-tokenizer.cs, gcs-parser.jay, driver.cs: Fixed parsing of nested query expressions. 2007-10-29 Raja R Harinath * Makefile (net_2_0_bootstrap/mcs.exe.config): Copy gmcs.exe.config. 2007-10-29 Marek Safar A fix for bug #334652 * ecore.cs (MethodGroupExpr.OverloadResolve): Do also lookup for extension methods when we have not found the best candidate in normal container. 2007-10-27 Marek Safar * AssemblyInfo.cs: Keep up-to-date. 2007-10-27 Marek Safar * Makefile: Fixed generics compiler name. 2007-10-27 Marek Safar * lambda.test: removed, lambda parsing is done differently. * gen-il.cs, gen-treedump.cs, old-code.cs : Obsolete. 2007-10-27 Gert Driesen * Makefile: Removed dependency on gmcs.exe.config. Fixes build. 2007-10-27 Marek Safar * Makefile, *.sources : All C# compilers are in mcs folder. * *.cs: Use existing 2_1 define for smcs. 2007-10-26 Marek Safar A fix for bug #335847 * assign.cs, expression.cs: Couple of changes to avoid creating a temporary variable for each object initializer assignment statement. It simplifies struct initialization too, otherwise two temporary variables would be required. Implemented optimization of redundant default element initializers. 2007-10-25 Marek Safar A fix for bug #336766 * expression.cs (Class.CheckBase): Use generic name when method is generic. 2007-10-25 Marek Safar A fix for bug #334737 * expression.cs (IndexerAccess.EmitAssign): Emit local temporary variable and not variable argument for prepared copies. 2007-10-24 Marek Safar A fix for bug #325110 * class.cs, expression.cs, attribute.cs: Use open generic method when checking conditional attribute. 2007-10-24 Marek Safar * report.cs, cs-tokenizer.cs, class.cs, cs-parser.jay, anonymous.cs, expression.cs, statement.cs: Renamed method FeatureIsNotISO to FeatureIsNotAvailable. 2007-10-24 Marek Safar ** C# 3.0 Partial methods * cs-tokenizer.cs, support.cs, class.cs, decl.cs: Implemented partial methods support. Because of member cache issue with generics only non-generics partial methods are fully supported. 2007-10-23 Marek Safar * class.cs, decl.cs: Rewrote member overloads check to cope with generics and to use member cache for member checking. It also improves performance and fixes remaining overloads issues. 2007-10-20 Marek Safar * class.cs, const.cs, decl.cs, delegate.cs, enum.cs, generic.cs, roottypes.cs, typemanager.cs: A member cache creation logic changed to add members immediately and not rely on fallback. The member cache is now only prefered way how to access and find type declaration members. It saves 5 MB of memory during MWF compilation and makes code ready for more optimizations and clean-ups, it's also a pre-requirement for partial methods. 2007-10-18 Raja R Harinath * ecore.cs (Expression.Error_ValueCannotBeConverted): Add special handling for generic parameters. 2007-10-15 Marek Safar * class.cs (FixedField): Removed redundant volatile check. 2007-10-15 Marek Safar * class.cs, decl.cs: Fixed overload members verification to do only one check per possible collision. 2007-10-13 Marek Safar A fix for bug #325478 * anonymous.cs (AnonymousContainer.Compatible): Merge are flags together and create only one disposable flags container. 2007-10-12 Marek Safar A fix for bug #332442 by Alexandre Gomes * statement.cs (Fixed): Fixed variables cloning. 2007-10-12 Marek Safar A fix for bug #333342 * class.cs (EventField): Don't mark value type event as synchronized. 2007-10-12 Marek Safar * ecore.cs, anonymous.cs (MethodGroupExpr): Use score from type inference to identify best candidate method correctly. (ProperyExpr): A range variable is read only and cannot be modified. 2007-10-11 Marek Safar * ecore.cs, delegate.cs (MethodGroupExpr): Refactored best candidate logic to identify best candidate method correctly. 2007-10-11 Marek Safar * location.cs (Equals, GetHashCode): Removed. 2007-10-11 Marek Safar * report.cs: Implemented message recorder. It is used mainly for lambda expressions to capture otherwise swallowed error messages. * anonymous.cs, lambda.cs.cs: Do full parameters check. * ecore.cs (ExtensionMethodGroup): Report binding failure at the botton and not at the top. (MethodGroupExpr.DoResolve): Use message recorder for error handling. * expression.cs (MemberAccess): Always report lookup failure. * location.cs: Implemented Equals, GetHashCode. * statement.cs (Return.DoResolve): Fixed hardcoded error argument. 2007-10-10 Jb Evain * codegen.cs: re-enable assembly version check. 2007-10-09 Marek Safar * report.cs, anonymous.cs, driver.cs, expression.cs: Added few ISO-2 checks. * namespace.cs (UsingAlias): Do correct version check. 2007-10-08 Marek Safar * expresison.cs, ecore.cs: Issue extension method error message when appropriate. * rootcontext.cs: Added ISO_2 compiler mode option. 2007-10-08 Marek Safar * expresison.cs (UnaryMutator.ResolveOperator): Print more useful error message. 2007-10-08 Marek Safar * attribute.cs (GetString, GetBoolean): Work with both literal and constant. * ecore.cs, expresison.cs, delegate.cs (Invocation, MethodGroupExpr): Moved method overload specific methods to MethodGroupExpr. (IndexerAccess): Re-wrote resolving mechanism, fixed many issues and it should be less memory consuming. Mon Oct 8 09:29:15 CEST 2007 Paolo Molaro * codegen.cs: remove the assembly version check until the buildbot is fixed. 2007-10-07 Jb Evain * attribute.cs (Attribute.GetString): if the value expression is a StringConstant, return its string value. 2007-10-07 Jb Evain * typemanager.cs: add `assembly_version_attribute_type`. * codegen.cs: on attribute emission, check that the AssemblyVersionAttribute doesn't overflow. 2007-10-05 Marek Safar A fix for bug #324677 * anonymous.cs, decl.cs: Yes another anonymous container hack. Overwrite parent container of a scope container with currently resolved one. 2007-10-05 Marek Safar A fix for bug #325534 * class.cs (Invocation.DoResolve): Check invocation of object finalizer only. 2007-10-05 Marek Safar A fix for bug #327504 * class.cs (Operator.Define): Refactored implicit and explicit user operator conversion rules. 2007-10-05 Marek Safar A fix for bug #327520 * ecore.cs (ExtensionMethodGroupExpr): Emit resolved extension argument. 2007-10-04 Marek Safar A fix for bug #328022 * class.cs (MethodData.Define): Use correct method to check whether a method implementents an accessor. 2007-10-04 Marek Safar A fix for bug #330069 * statement.cs (Fixed.Resolve): Read the first array element only when an array is instantiated. 2007-10-04 Marek Safar * expression.cs, assign.cs, generics.cs: Print correct operator when compound assignment is used. 2007-10-04 Marek Safar A fix for bug #325841 * expression.cs (ArrayAccess): Use full argument cloning only for string compound concatenation. 2007-10-03 Marek Safar A fix for bug #328774 * ecore.cs (FieldExpr.EmitAssign): Fixed string concatenation compound assignment. (PropertyExpr.EmitAssign): Fixed string concatenation compound assignment. 2007-10-03 Raja R Harinath Fix #328490 * ecore.cs (SimpleName.DoSimpleNameResolve): Handle Property and Event accessibility checks here. Remove some bogus code that accidently made GenericMethods work. (PropertyExpr.IsAccessibleFrom, EventExpr.IsAccessibleFrom): New. 2007-09-25 Marek Safar * expression.cs (ArrayCreation): Fixed cloning of an implicit types. * statement.cs (Block): Refactored AddVariable to allow error handling customization. * generic.cs: New stub. 2007-09-23 Marek Safar * anonymous.cs, codegen.cs: Changed InferReturnType to be EmitContext flag. 2007-09-17 Marek Safar * class.cs: Use partial container to record whether any partial part contains static field initializer and therefore default contructor has to be defined. 2007-09-14 Marek Safar * class.cs (TypeContainer.AddPartial): Fixed an issue reported on mono-list when only one of two partial parts has defined accessibility modifier. 2007-09-14 Marek Safar A fix for bug #82845 * class.cs (TypeContainer): Set correct resolve context for all field initializers. 2007-09-13 Marek Safar * assign.cs: Fixed a crash when field is resolved twice with an error. * codegen.cs: Changed InFieldInitializer to be flag. * anonymous.cs, ecore.cs, expression.cs: Update after IsInFieldInitializer rename. * const.cs: Removed unused parameter. * class.cs: Changed the way how we resolve and emit field initializers. The field initilizers have to have access to contructor block to emit compiler generated code. 2007-09-13 Marek Safar * expression.cs (MemberAccess.DoResolve): DeclSpace is broken by generics use TypeContainer instead. 2007-09-12 Marek Safar * generic.cs (TypeInferenceContext.InflateGenericArgument): Stub. * lambda.cs (ResolveParameters): Use more powerful InflateGenericArgument. * parameters.cs: Better exception message. 2007-09-10 Marek Safar * anonymous.cs (AnonymousMethodExpression.CompatibleChecks): Report correct expression block type. * ecore.cs (Expression.Error_MemberLookupFailed): Made virtual. * expression.cs (Invocation): Extracted method group resolve to DoResolveOverload. 2007-09-07 Marek Safar * ecore.cs (Expression.MemberLookupFinal): Removed unused loc parameter. (MethodGroupExpr.ResolveGeneric): Use existing method group instance. * expression.cs (MemberAccess.DoResolve): Uses generic resolver for generic extension methods. 2007-09-06 Marek Safar A fix for bug #82676 (Do I get it right now?) * convert.cs (Binary.ResolveOperator): An interface is converted to the object before a standard conversion is applied. 2007-09-06 Marek Safar * convert.cs (ImplicitReferenceConversionCore): Reverted wrong fix of #82676. 2007-09-05 Marek Safar A fix for bug #82676 * convert.cs (ImplicitReferenceConversionCore): Check both sides for non-generic interface types. 2007-09-05 Marek Safar A fix for bug #82690 * ecore.cs (PropertyExpr.EmitAssign): Leave a copy does just that. 2007-09-05 Marek Safar A fix for bug #82571 * anonymous.cs (AnonymousMethod.DoCreateMethodHost): Use internal modifier for container based methods. 2007-09-05 Marek Safar A fix for bug #82676 * convert.cs (ImplicitReferenceConversionCore): From any class-type S to any interface-type T means to any of interface type T. 2007-09-04 Marek Safar * namespace.cs: We have 2 versions of System.Core assembly. 2007-09-04 Marek Safar A fix for bug #82652 * class.cs (Class.GetClassBases): Compare types and not expressions. 2007-09-04 Marek Safar A fix for bug #82620 * expression.cs (Invocation.EmitArguments): Duplicate params arguments actually never worked before. (IndexerAccess): Emit prepared arguments before they are modified. 2007-09-04 Marek Safar A fix for bug #82563 * assign.cs: Revert wrong fix. * expression.cs (VariableReference.EmitAssign): Handle ref reference correctly. (ArrayAccess): Changed the way we emit compound (prepared) assignments. Instead of ldelema/stdind we have to use temporary variables to handle cases like String.Concat (params string[]). 2007-08-31 Marek Safar * class.cs: EmitAttributes to Emit rename. * decl.cs (MemberCore.GetClsCompliantAttributeValue): Parent can be null. (MemberCore.HasClsCompliantAttribute): Don't depend on GetClsCompliantAttributeValue execution. 2007-08-31 Marek Safar * anonymous.cs: Use shorter type prefix. * ecore.cs (SimpleName.DoSimpleNameResolve): Use transparent identifiers when exist. * expression.cs (LocalVariableReference.DoResolveBase): Don't capture variables when probing is on. * statement.cs (LocaLInfo.Clone): Clone correctly resolved and unresolved variables. (TopLevelBlock.GetTransparentIdentifier): Default implementation doesn't handle transparent identifiers. 2007-08-26 Marek Safar * attribute.cs (IsClsCompliant): Add nullable types test. 2007-08-24 Atsushi Enomoto * doc.cs : catch other types of exception than XmlException to report CS1570. Fixed bug #82565. 2007-08-23 Marek Safar * anonymous.cs (AnonymousMethodExpressin.ExplicitTypeInference): The number of delegate parameters has to match. (AnonymousMethodExpressin.VerifyParameterCompatibility): Handles generic arrays. 2007-08-21 Marek Safar * anonymous.cs (AnonymousMethod): Generate private anonymous method to fix problem with private arguments. 2007-08-20 Marek Safar * anonymous.cs (AnonymousTypeClass): An anonymous type can be empty. * decl.cs (MemberName): Ignore generic type with no generic arguments. * expression.cs (AnonymousTypeDeclaration): An anonymous type can be empty. Add cloning suport. * roottypes.cs (GetAnonymousType): Fixed argument comparison logic. 2007-08-20 Marek Safar * convert.cs, ecore.cs, expression.cs, literal.cs: Use factory method to create EmptyCast. It handles EmptyConstantCast specialization for constants. 2007-08-18 Marek Safar * expression.cs (Binary.is_unsigned): Handle unsafe types too. (EmitArrayArgument): One routine for array arguments. (ArrayCreation.MakeByteBlob): Fixed an array alignment. 2007-08-17 Marek Safar * cs-tokenizer.cs (GetKeyword): Handle from keyword in a different way. 2007-08-17 Marek Safar * anonymous.cs: MemberLookupFinal update. * class.cs (ConstructorInitializer): Is expression based. * delegate.cs: MethodGroupExpr update. * ecore.cs (Error_MemberLookupFailed): Improved to report better error messages. (Error_MemberLookupFailed): Customizable error override. (MethodGroupExpr): Keep queried type for later usage. (MethodGroupExpr.OverloadResolve): Catch errors related to overload resolve. * expression.cs: Error_MemberLookupFailed refactoring. (New.DoResolve): Resolve as much as possible. (ElementInitializer.Error_MemberLookupFailed): Object initializer customization for invalid member types. * statement.cs: MethodGroupExpr update. 2007-08-16 Marek Safar * modifier.cs (Check): Check all modifiers and not only accessibility ones. 2007-08-16 Marek Safar * ecore.cs (Expression.Error_ValueCannotBeConverted): Report always a type and not an expression. 2007-08-16 Marek Safar * statement.cs (Catch.Clone): Type and variable can be null. 2007-08-16 Marek Safar A fix for bug #81979 * assign.cs (Assign.Emit): Prepare arguments for string concatenation. I am really not sure whether this is the best fix. * expression.cs (VariableReference.EmitAssign): Do prepare_load test only once. 2007-08-14 Marek Safar ** C# 3.0 Object and collection initializers (major re-write) * assign.cs (DoResolve): Initializers are not assign related. * codegen.cs (EmitContext.CurrentInitializerVariable): Holds a varible used during collection or object initialization. * expression.cs (Error_InvalidArguments): Add initializers specific messages. More will come later because it requires some general refactoring. (New.DoResolve): Better error handling for unsafe types. (EmptyExpressionStatement): New class. (ElementInitializer): An object initializer expression. (CollectionElementInitializer): A collection initializer expression. (CollectionOrObjectInitializers): A block of object or collection initializers. (NewInitialize): New expression with element/object initializers. * statement.cs: Reverted object/collection initializer hacks. * typemanager.cs (CSharpName): Filter __arglist type. 2007-08-09 Marek Safar ** C# 3.0 Anonymous Types (update to the latest standard) * expression.cs (Binary.ResolveOperator): Threat all null based types same. (AnonymousTypeDeclaration): Renamed from AnonymousType and simplified. (AnonymousTypeParameter): Updated. * anonymous.cs (CompilerGeneratedClass): Add custom name overload. (AnonymousTypeClass): New anonymous type container. * class.cs (AddField): Return operation result. * generic.cs: Another empty TypeArguments overload. * roottypes.cs (AddAnonymousType, GetAnonymousType): Anonymous types are stored at top of normal hierarchy. * typemanager.cs (CSharpName): Filter anonymous types. 2007-08-09 Marek Safar * expression.cs (StringConcat.Append): Handle 3 and more concatenation as single Concat call. How could we miss that :-( 2007-08-08 Marek Safar * expression.cs (ArrayCreation.CloneTo): Allocate exact size. 2007-08-07 Miguel de Icaza * expression.cs: Fix the previous commit, the creation of the arguments array list needs also to be conditional on the arguments not being null. * class.cs: Add a little bit of help to help narrow down problems. * expression.cs (ArrayCreation.CloneTo): Argument can be null, do not try to copy in that case. * driver.cs: When building SMCS, include a new different set of default assemblies here. Do this here so we can control whether to include the default assemblies with /noconfig. 2007-08-03 Marek Safar A fix for bug #81979 * expression.cs (TypeOf.GetAttributableValue): Check for type arguments only. 2007-08-03 Marek Safar A fix for bug #82300 * anonymous.cs (AnonymousContainer.Define): Don't define anything when we are in probing scope. 2007-08-03 Marek Safar A fix for bug #82301 * statement.cs (Catch.CloneTo): Clone blocks in the right order. (Statement.CloneTo): Clone and not map children blocks. 2007-08-03 Marek Safar A fix for bug #82299 * expression.cs (LocalVariableReference.CloneTo): Remap local info variable too. * statement.cs (Statement.CloneTo): Clone variables before statements to allow remaping of local variables. 2007-08-03 Marek Safar A fix for bug #82296 * anonymous.cs, * report.cs: Log crash details for future clone problems. * statement.cs (Return.Clone): Don't clone non-existent expression. 2007-08-03 Raja R Harinath * class.cs (TypeContainer.AddBasesForPart): Make virtual. (Class.AddBasesForPart): Move CS0537 check here from ... * cs-parser.jay (class_declaration): ... here. Move calling of 'AddBasesForPart' to ... (class_bases): ... here. (struct_declaration, interface_declaration): Update to changes. 2007-08-02 Marek Safar A fix for bug #81923 * statement.cs (Using.ResolveLocalVariableDecls): Only non-user implicit conversion is allowed. 2007-08-02 Marek Safar A fix for bug #81564 * ecore.cs (EventExpr): Add IsBase handling. * expression.cs (BaseAccess.CommonResolve): Events can use base accessor too. 2007-08-02 Raja R Harinath Reduce some differences between cs-parser.jay in mcs/ and gmcs/. * cs-parser.jay: Some whitespace cleanups. (current_delegate): New. (type_name): New. (struct_declaration): Make similar to gmcs/cs-parser.jay -- add a dummy code block, and use 'type_name' instead of 'member_name'. (interface_declaration, class_declaration): Likewise. (delegate_declaration): Likewise. Rearrange slightly and use 'current_delegate'. * cs-tokenizer.cs (handle_where): Rename from handle_constraints. (GetKeyword): Update to change. Use '!foo' instead of 'foo == false'. 2007-08-02 Marek Safar A fix for bug #82039 * ecore.cs (TypeLookup.GetSignatureForError): Use name when type is not available. * typemanager.cs (CSharpName): Split to string overload. 2007-08-02 Marek Safar * expression.cs, * report.cs: Updated warning CS0472. 2007-08-01 Marek Safar A fix for bug #82181 * cs-parser.jay, * cs-tokenizer.cs: Ignore partial keyword inside block expression. 2007-08-01 Marek Safar A fix for bug #82277 * statememnt.cs (Block.Clone): Don't clone explicit blocks twice. 2007-08-01 Marek Safar ** C# 3.0 Type Inference (major bits are working) * anonymous.cs (AnonymousMethodExpression): Removed refactored fields. (.ImplicitStandardConversionExists): Uses compatible. (.ExplicitTypeInference): Infers type arguments based on explicit arguments (.InferReturnType): New method. (.Compatible): Refactored. (.ResolveParameters): Uses factory to create resolved parameters. (.CompatibleMethod): Add probing mode support. (AnonymousContainer): Removed unused fields. Split Define and Resolve to clearly distinguish between 2 different operations. (LambdaMethod): Moved to lambda.cs. (AnonymousMethod): Removed unused fields and methods. (AnonymousDelegate): Simplified. * codegen.cs (ResolveTopBlock): Updated renamed Resolve to Define. * convert. cs (ImplicitConversionStandard): Compatible works differently. * delegate.cs (Delegate): New mehods to reduce code duplication. (.GetConstructor): New method. (.GetInvokeMethod): New method. (DelegateCreation): Updated. * ecore.cs (ResolveOverloadExtensions): Don't crash when extension method does not exist. (OverloadResolve): Made probing little bit faster. * expression.cs (ParameterReference.DoResolveLValue): Reference can be null when probing is on. * generic.cs (TypeInferenceContext): Dummy implementation. * iterators.cs: Updated after Resolve/Define rename. * lambda.cs (LambdaExpression) (.ResolveParameters): Handles both type of arguments and type inference too. * parameter.cs (ImplicitLambdaParameter.Resolve): Sanity check. (InflateTypes): Updated. * support.cs (InflateTypes): Changed signature and updated. * typemanager.cs (LookupMemberCache): Better dynamic type check. (MemberLookup_FindMembers): More MS tricks. (GetParameterData): Ditto. (GetDelegateParameters): Uses quick path for dynamic types. 2007-08-01 Marek Safar * class.cs (MethodData.Define): EmitContext is required for generic stuff only. 2007-07-31 Marek Safar * statement.cs (ProcessParameters): Don't crash when parameters have wrong syntax. 2007-07-26 Jb Evain * typemanager.cs (TypeManager.GetConstructor): Add a method overload which takes a boolean 'report_errors', similar to the GetMethod. (InitCodeHelpers): StructLayoutAttribute.ctor(int16) is not visible in .net 2.1, do not report errors here. * typemanager.cs (TypeManager.InitCoreTypes): System.ArgIterator, System.Runtime.CompilerServices.RequiredAttributeAttribute and System.Runtime.CompilerServices.TypeForwardedToAttribute are internal in .net 2.1. * typemanager.cs (TypeManager.InitCoreTypes): Move the resolution of the type InternalsVisibleToAttribute before the first call to CoreLookupType which is allowed to fail (third boolean parameter to true). Because, during the resolution for a type that is not immediately found, we try to check if the type is not defined in a friend assembly, and to do so, we need the InternalVisibleToAttribute. 2007-07-23 Miguel de Icaza * expression.cs (Binary): Add support for the brain-dead CSC 2.x feature that allows structs to be compared against null and inline the result as true or false. Notice that the same code is not permitted inside a generic block of code that would do: class Foo where T : struct { bool Eval (T x) { return x == null; } } It is only allowed if the type of T is not bound (no where clause). In my opinion, this CSC 2 behavior is broken but people seem to be using it (IronRuby does, a few bug reports on bugzilla have it and some people have complained about it). All of the users that depend on this behavior have code that is very likely broken. * report.cs (Warning, Error): make these take object arguments, not strings, as that allows us to take advantage of Format. 2007-07-20 William Holmes * decl.cs: Changed MemberName.CountTypeArguments to also check the Left member variable for the Count. * doc.cs: Changed DocUtil.GetMethodDocCommentName to call MemberName.CountTypeArguments to avoid a NRE. This code is contributed under the MIT X11 license 2007-07-18 Marek Safar * cs-tokenizer.cs: Improved lambda parsing and removed old code. 2007-07-18 Atsushi Enomoto * doc.cs : generic method arguments are written as ``x while generic type arguments are `x. Combined with the previous change, fixed bug #79706. 2007-07-18 Raja R Harinath Fix #82120 * expression.cs (Binary.ResolveOperator): When converting 'a + (- b)' to 'a - b', ensure that the unary '-' is discarded. 2007-07-18 Atsushi Enomoto * doc.cs : when T: or whatever x: is specified, it does not really check the doc comment's syntax correctness. Fixed bug #82006. 2007-07-18 Marek Safar * anonymous.cs (AnonymouseMethodExpression): Refactored to work with LambdaExpression better. * cs-tokenizer.cs: Changed a way how we detect lambda parameters. * driver.cs (LambdaTypeParseTest): Removed, tested method is gone. * ecore.cs (Expression.MemberLookupFailed): Don't show currect context as it can be generated. * expression.cs (Invocation.Error_InvalidArguments): Show correct modifiers. * lambda.cs (LambdaExpression): Refactored to share same code with AnonymousMethodExpression. 2007-07-17 Marek Safar * anonymous.cs (MakeName): Include host name for easier debugging. (LambdaMethod): New class for lambda spcecific stuff. * attribute.cs: Set EmitContext return type. * class.cs: Set EmitContext return type. * codegen.cs (EmitContext): Return type cannot be null to stop messing with null/void meaning. * iterators.cs (ContainerType): Implemented. * rootcontext.cs: Set value of TypeManager.bool_type at early stage. * statement.cs (Return): Updated to lambda expressions. (Block.CloneTo): Parent can be null. 2007-07-13 Marek Safar A fix for bug #81917 * attribute.cs (AttributeTester.GetFixedBuffer): More robust testing. * class.cs (FixedField): Check whether field is in unsafe scope. * ecore.cs (FieldExpr.DoResolve): Create fixed buffer expression here. (FieldExpr.Emit): Fixed buffers cannot be volatile. * expression.cs (ElementAccess.Resolve): Move fixed buffers resolve to FieldExpr. * statement.cs (Fixed.Resolve): Simplified fixed buffers. 2007-07-13 Marek Safar * cs-tokenizer.cs, class.cs, decl.cs, driver.cs, namespace.cs, rootcontext.cs, expression.cs, statement.cs: Updated to use WarningLevel from Report class. 2007-07-13 Marek Safar * ecore.cs (FieldExpr.AddressOf): Less confusing warning message. 2007-07-13 Marek Safar * anonymous.cs (AnonymousMethodExpression): Parameters are r/o. (AnonymousContainer.ResolveNoDefine): Another ec to aec flag conversion. * codegen.cs(EmitContext): Add ProbingMode flag. * delegate.cs (DelegateInvocation): Set few instance variables as r/o. * driver.cs: For now set both warning values. * ecore.cs (SimpleName): Name is readonly. (MethodGroup.OverloadResolve): One quick path for probing. * expression.cs (Unary): Set Oper r/o. (Binary): Set Oper r/o. (ParameterReference): Set few instance variables as r/o. (ParameterReference.DoResolveBase): Don't capture aruments when the probing is on. (Invocation.CloneTo): Fixed typo, looks easy, yeah. (Arglist): arguments are private. (SizeOf): type is private and r/o. (MemberAccess): arguments are private. * report.cs: Enhanced reporting on/off capabilities. * lambda.cs: Uses ec.IsInProbingMode. (ContextualReturn): Derives from return. * rootcontext.cs: For now set both warning values. * statement.cs (CloneContext.RemapBlockCopy): Remaps block to cloned copy if one exists. (Return.Resolve): Don't die immediately. (Block.Resolve): Speed-up probing. (Block.CloneTo): Clone only child blocks. Fri Jul 13 11:19:28 CEST 2007 Paolo Molaro * iterators.cs: reverted Miguel's latest change (r81925) as it breaks the build in System. 2007-07-13 Miguel de Icaza * iterators.cs (Yield.CheckContext): Check for the iterator type also here as we can call into Yield even in codepaths that are not directly checked by (MethodOrOperator is the only path that was checked). In addition to the standard check, use a more specific check for constructors to report a more verbose error. 2007-07-12 Miguel de Icaza * ecore.cs (FieldExpr.AddressOf): Do not stop processing here, report the warning and continue * statement.cs (Using.EmitLocalVariableDecls): We were leaving values on the stack on the call to Emit. Use EmitStatement if possible, or using Emit + Pop if not possible. Fixes #82064 2007-07-12 Raja R Harinath * expression.cs (Invocation.IsApplicable): Reorganize slightly to avoid try...finally in some cases. 2007-07-10 Marek Safar * attribute.cs (Attribute.ResolveConstructor): Uses method group. * class.cs (ConstructorInitializer.Resolve): Use and keep method group instead of method. Re-use standard error handling. (ConstructorInitializer.Emit): Simplified. * delegate.cs: Updated after Invocation.EmitCall change. * ecore.cs (GetOperatorTrueOrFalse): Uses MethodGroupExpr only. (SimpleName.SimpleNameResolve): Set and reset in_transit flag correctly. (ExtensionMethodGroupExpr): Refactored to use same OverloadResolve method and don't permanently changing input arguments. (MethodGroupExpr): Introduced resolved best_candidate, when method group is resolved it has one of the candidates is the best one which is later used to emit. Removed a few unused method. (MethodGroupExpr.MakeUnionSet): Moved from Invocation, it belongs here. * expression.cs (StaticCallExpr.MakeSimpleCall): Uses method group. (Binary.ResolveOperator): Ditto. (ConditionalLogicalOperator.DoResolve): Ditto. (Invocation): Uses method group. (Invocation.DoResolve): Simplified. (Invocation.EmitCall): Removed useless is_static. (Invocation.Emit): Delegate to method group. (Invocation.EmitStatement): Simplified. (New): Uses method group. (MemberAccess.DoResolve): Don't destroy original expression. * statement.cs (ForEach.Resolve): Use null for no method arguments. 2007-07-04 Marek Safar * ecore.cs (VarExpr.DoResolveLValue): More restriction checks. * anonymous.cs, * lambda.cs: Add custom error message type. 2007-07-03 Marek Safar * lambda.cs: Simplified little bit. * parameter.cs: Introduced ImplicitLambdaParameter. (Parameters.CreateFullyResolved): New factory instead of ctor. * anonymous.cs, * class.cs, * delegate.cs: Updated parameter creation. 2007-07-03 Marek Safar * ecore.cs (SimpleName.GetSignatureForError): Display correctly generic arguments. * generic.cs: Synchronized with gmcs. 2007-07-03 Marek Safar * class.cs (Indexer): Check return type as soon as possible. * cs-parser.jay: Initialize implicit_value_parameter_type for interface members too. * ecore.cs (VarExpr.DoResolveLValue): Set eclass value. * expression.cs (Invocation.Error_InvalidArguments): Show type only. * parameter.cs (Parameter): Use expression type when it is available. * support.cs (ReflectionParameters.ParameterDesc): Show an extension method modifier for the first parameter only. 2007-06-24 Marek Safar A fix for bug #81938 * typemanager.cs (ChangeType): Fixed couple of char conversions. * constant.cs: Tide up an exception message. 2007-06-22 Marek Safar * ecore.cs (SimpleName.DoSimpleNameResolve): Better error reporting when an uninitialized variable is used. * expression.cs (LocalVariableReference.DoResolve): Ditto. 2007-06-22 Marek Safar * ecore.cs (SimpleName.TypeOrNamespaceNotFound): Allow to override type not found error handling. * expression.cs (ArrayCreation): Removed redundant fields and little bit simplified. (ArrayCreation.ResolveArrayElement): To be ready to customization. (ArrayCreation.DoResolve): Simplified. (ImplicitlyTypedArrayCreation.DoResolve): Implicitly typed arrays have its own resolve process. (ImplicitlyTypedArrayCreation.ResolveArrayElement): Conversion magic. 2007-06-20 Marek Safar * namespace.cs (NamespaceEntry.Error_AmbiguousTypeReference): Print more error details. 2007-06-20 Marek Safar * cs-tokenizer.cs: Removed var related stuff. * ecore.cs (Expression.ResolveAsContextualType): Introduced new method. (VarExpr): Changed to derive from SimpleName. VarExpr now behaves as a type and a keyword at same time. * decl.cs (MembeName.GetTypeExpression): Create VarExpr when type name matches to "var". * expression.cs (ImplicitlyTypedArrayCreation): New empty class for implicitly typed arrays, more changes will follow. * statement.cs (LocalInfo.Resolve): Resolve type as contextual type. 2007-06-19 Marek Safar * ecore.cs (VarExpr): Removed Handled field. * statement.cs (Using.ResolveLocalVariableDecls): Refactored to use build-in assign functionality. (ForEach.Resolve): Removed all implicitly typed local variable code and simplified. (ArrayForeach.Resolve): Infer implicitly typed local variable here. (CollectionForeach.Resolve): Infer implicitly typed local variable here. 2007-06-18 Marek Safar * assign.cs: Removed implicitly typed local variable check. * expression.cs (LocalVariableReference.DoResolve): Add check for self referencing implicitly typed local variable. (LocalVariableReference.DoResolveLValue): Infer implicitly typed local variable here. * statement.cs (Fixed): Removed unsupported implicitly typed local variable code. 2007-06-15 Marek Safar * decl.cs (MemberName): Moved all Unbound stuff to parser. 2007-06-14 Marek Safar A fix for bugs #81855 and #76274 * attribute.cs (AttachTo): Always set owner for global attributes to prefined owner. * ecore.cs (Error_TypeDoesNotContainDefinition): A type location can be usefull too. * cs-parser.jay: Assembly and module attributes must precede all other elements except using clauses and extern alias declarations. 2007-06-13 Marek Safar A fix for bug #81748 * cs-tokenizer.cs, * expression.cs: More checks for non ISO-1 features. 2007-06-12 Marek Safar A fix for bug #81807 * statement.cs(Switch.TableSwitchEmit): Define null label when it's not present inside switch statement and it is required by nullable check. 2007-06-12 Marek Safar A fix for bug #81840 * ecore.cs (SimpleName.ResolveAsTypeStep): Look for non-generic type when type matching fails. * namespace.cs: Tiny error message change. 2007-06-12 Marek Safar * decl.cs (CheckAbstractAndExtern): Moved to MemberCore for easier error reporting. Added automatic property check. * class.cs: Updated after CheckAbstractAndExtern relocation. (AEventPropertyAccessor.GetSignatureForError): Customized. 2007-06-11 Marek Safar * class.cs (DefineBaseTypes): Base type can be undefined. * ecore.cs (TypeLookup): Minor refactoring. (DoResolveAsTypeStep): Removed redundant check. * namespace.cs (Lookup): Removed redundant check. * rootcontext.cs (BootstrapCorlib_ResolveType): Uses normal ResolveAsTypeTerminal step. (BootstrapCorlib_*): Simplified. (PopulateCoreType): Core types can be now external. 2007-06-07 Marek Safar * anonymous.cs (VerifyExplicitParameterCompatibility): Add flag to do verification only. (InferTypeArguments): Infers anonymous expression type arguments. (Compatible): Split to Compatible and InferTypeArguments. * lambda.cs: Updated. 2007-06-08 Marek Safar * anonymous.cs (AnonymousContainer): Marked as compiler generated. 2007-06-07 Raja R Harinath Fix #80477, cs0135-2.cs, cs0135-3.cs * statement.cs (ToplevelBlock.ProcessParameters): Add parameter names to the "known" variables list. (Block.CheckInvariantMeaningInBlock): Handle the fact the parameter names are also "known". (Block.CheckError136): Remove. (ExplicitBlock.CloneTo): New. Set 'known_variables' in target to null. 2007-06-07 Marek Safar * ecore.cs (MethodGroupExpr.OverloadResolve): Print full method definition. 2007-06-06 Marek Safar * ecore.cs (SimpleName.Emit): Emitting unresolved simple name is internal error not an user error. * expression.cs (IsApplicable): Refactored to make debugging easier. * support.cs: More tricks for non-mono runtimes. * typemanager.cs (CoreLookupType): Made public. (InitSystemCore): All linq specific stuff moved to linq.cs 2007-06-05 Marek Safar * typemanager.cs (CSharpSignature): One more missing build-in types replacement. More tricks for non-mono runtime. 2007-06-05 Raja R Harinath * statement.cs (Block.CheckError136_InParents): Remove. (Block.AddVariable): Use GetParameterInfo instead. (ToplevelBlock.ProcessArguments): Likewise. 2007-06-04 Raja R Harinath * statement.cs (ToplevelBlock.CloneTo): New. Copy over parameter information too. (ToplevelBlock.GetParameterInfo): Split out of ... (ToplevelBlock.GetParameterRefernce): ... this. (ToplevelBlock.ParameterMap): Remove. * expression.cs (ParameterReference): Update to use ToplevelParameterInfo. * statement.cs (ToplevelBlock.ProcessParameters): Workaround some regression. * flowanalysis.cs (FlowBranching.CheckOutParameters): Move ... * statement.cs (ToplevelBlock.CheckOutParameters): ... here. * statement.cs (ToplevelBlock.ResolveMeta): Move CS0136 checks ... (ToplevelBlock.ProcessParameters) ... here. (ToplevelBlock..ctor): Invoke it. * statement.cs (ToplevelBlock.ResolveMeta): Add sanity checks for new parameters. * statement.cs (IKnownVariable): New interface. (LocalInfo): Implement it. (ToplevelParameterInfo): New class. (ExplicitBlock.AddKnownVariable): Use IKnownVariable. (ExplicitBlock.GetKnownVariable): Likewise. Rename from GetKnownVariableInfo. 2007-06-03 Raja R Harinath Partly speed up CS0136 error checks. * statement.cs (ExplicitBlock.GetKnownVariableInfo): Remove 'recurse' parameter. (Block.DoCheckError136): Only check errors in parameters. Move local variable checks ... (Block.AddVariable): ... here, and ... (ToplevelBlock.ResolveMeta): ... here. 2007-06-02 Raja R Harinath * statement.cs (Block.IsChildOf): Remove. * statement.cs (Statement.Clone): Move special case code ... (Block.CloneTo): ... here. 2007-05-29 Raja R Harinath * statement.cs (ToplevelBlock.container): Remove field. It's redundant with 'Parent'. (ToplevelBlock.ContainerBlock): Remove accessor. (ToplevelBlock..ctor): Update to changes. Register anonymous child with parent here, ... * cs-parser.jay (end_anonymous): ... not here. Don't modify current_block. (start_anonymous): Don't save current_block. (top_current_block): Remove. * statement.cs (Block.Flags): Remove IsExplicit and IsToplevel flags. (Block.Resolve): Update to changes. (Block..ctor): Move setting of "correct" 'Toplevel' and 'Explicit' fields to ... (ExplicitBlock..ctor, ToplevelBlock..ctor): ... here. 2007-05-27 Raja R Harinath Kill Block.Implicit * statement.cs (Block.Implicit): Remove. (Block): Update to changes. * flowanalysis.cs: Likewise. Mildly speed up CheckInvariantMeaningInBlock * statement.cs (ExplicitBlock.AddKnownVariable): Move here from Block. Recursively call AddKnownVariable to all enclosing blocks. (ExplicitBlock.GetKnownVariableInfo): Move here from Block. Remove recursive calls. (Block): Update to changes. New ExplicitBlock invariants * statement.cs (Block.Explicit): New field. It points to the immediately enclosing non-implicit block. (Block..ctor): Maintain the invariant. * cs-parser.jay: Take advantage of invariant. Introduce ExplicitBlock * statement.cs (ExplicitBlock): New. (ToplevelBlock): Derive from it. (Block.Flags.IsExplicit): Rename from '...Implicit' and invert sense of flag. (Block.Implicit): Update to changes. * cs-parser.jay: Update to changes. Remove unused field * codegen.cs (EmitContext.IsLastStatement): Remove. * statement.cs (Block.DoEmit): Update to changes. 2007-05-25 Raja R Harinath * cs-parser.jay: Use 'start_block' and 'end_block' rather than modifying current_block directly. 2007-05-23 Scott Peterson * class.cs: Implemented automatic properties (C# 3.0) Thanks to Marek for the help. 2007-05-23 Raja R Harinath * flowanalysis.cs (VariableInfo.SetAssigned): When noting a variable as assigned, note also that all its components are assigned too. (MyBitVector.SetRange): New. Function to set multiple bits to true. 2007-05-19 Marek Safar * anonymous.cs, class.cs: Emit Compiler generated attribute when member is marked as compiler generated. * decl.cs (MemberCore): Refactored ModFlags into property. * modifiers.cs: Add new modifier (COMPILER_GENERATED). (Check): Check only accessibility modifiers. 2007-05-18 Raja R Harinath Track all assignable slots in one bit array * statement.cs (ToplevelBlock.ParameterMap): Convert into array. (ToplevelBlock.ResolveMeta): Don't create a VariableMap. Move logic from VariableMap constructor here. Use the same 'offset' variable that's later used for computing offsets of local variables. * flowanalysis.cs (UsageVector.parameters): Remove. (UsageVector): Update to changes. (VariableMap): Remove. Avoid creating ParameterMap in every block * statement.cs (Block.ParameterMap): Move ... (ToplevelBlock.ParameterMap): ... here. (ToplevelBlock.ResolveMeta): Create VariableMap for parameters only once. * flowanalysis.cs (FlowBranching.param_map): Remove. (FlowBranching.UsageVector): Update to changes. (FlowBranchingToplevel.CheckOutParameters): Likewise. * statement.cs (Block.CloneTo): Clone Toplevel field too. * expression.cs (ParameterReference): Distinguish between block where parameter was referenced and declared. 2007-05-18 Marek Safar * flowanalysis.cs, statement.cs: Put back improved error handling. 2007-05-15 Scott Peterson * assign.cs: * expression.cs: Imporved object and collection initialization (C# 3.0). 2007-05-15 Marek Safar A fix for bug #81380 * expression.cs (Is.DoResolve): Only value types have constant `is' behaviour. 2007-05-15 Raja R Harinath * statement.cs (ToplevelBlock.child): Remove. 2007-05-15 Raja R Harinath Rationalize ResolveMeta: refactoring (Block.ResolveMeta): Remove wrong or superfluous comments. Carve out constant handling code into ... (Block.DoResolveConstants): ... this. Rationalize ResolveMeta: kill local_map * statement.cs (Block.local_map, Block.LocalMap): Remove. (Block.AssignableSlots): New. (Block.ResolveMeta): Make protected. Don't create a VariableMap for locals -- move code from VariableMap here. Avoid unnecessary allocations. * flowanalysis.cs (FlowBranching.local_map): Remove. (FlowBranching..ctor): Use Block.AssignableSlots. (VariableMap): Remove unused constructors. 2007-05-11 Raja R Harinath * Makefile [PROFILE=net_2_0_bootstrap]: Add special-case rules. 2007-05-11 Marek Safar * typemanager.cs (IsFriendAssembly): Should not be called for building assembly. 2007-05-09 Marek Safar * literal.cs (NullConstant): Print null in all cases. * expression.cs (Binary.ResolveOperator): Implemented delegate comparison based on C# 2.0 changes. 2007-04-28 Scott Peterson This code is contributed under the MIT X11 license The following enables support for several C# 3.0 language features: * cs-tokenizer.cs: Added support for the "var" keyword. * ecore.cs: Refactored TypeLookupExpression.DoResolveAsTypeStep(). Added VarExpr class to facilitate type inferencing. * class.cs: Added IDictionary field AnonymousTypes to TypeContainer to support anonymous types. * assign.cs: Added support for type inferencing and initialization. * anonymous.cs: Added AnonymousClass class to enable anonymous types. * expression.cs: Added implicit array support to ArrayCreation. Added 5 types and 1 interface: IInitializable Implementing classes can inject initializing statements after object instantiation. Initializer Stores data for object initialization. AnonymousType An expression for anonymous types. AnonymousTypeParameter Stores data about an anonymous type's field. NewInitialize An expression for object initialization. CollectionInitialize An expression for collection initialization. * statement.cs: Added "var" keyword support to the foreach, using, and fixed statements. 2007-05-06 Marek Safar A fix for bug #81500 * cs-tokenizer.cs: Add special handling for coalescing operator. 2007-05-06 Marek Safar A fix for bug #81529 * attribute.cs (GetAttributeUsage): AttributeUsage attribute inherits its value from base class until it is redefined. 2007-05-02 Raja R Harinath Fix regression in cs0631-3.cs * cs-parser.jay (operator_declarator): Add opt_attributes to error fallback. Make error fallback catch more cases. 2007-05-01 Miguel de Icaza * cs-parser.jay: Allow parameters in operator declarations to have attributes. 2007-04-27 Miguel de Icaza * statement.cs (If.CloneTo): Only clone the FalseStatement if it exists. * lambda.cs (ContextualReturn.Resolve): An expression is valid inside the ContextualReturn, it does not have to be an ExpressionStatement. 2007-04-24 Miguel de Icaza * lambda.cs (ContextualReturn.Resolve): if the return type is not set, set it. 2007-04-23 Miguel de Icaza * anonymous.cs (AnonymousContainer): split the virtual Resolve method in two methods: ResolveNoDefine and Resolve. ResolveNoDefine will stop just after ResolveTopBlock has been called. Resolve will then continue by creating a method and issuing the call to method.Define (). (AnonymousMethod): Split and implement the new Resolve and ResolveNoDefine as well. * lambda.cs (LambdaExpression): Split the anonymous method resolution code into a separate routine (CoreCompatibilityTest) from DoCompatibleTest. (LambdaExpression.TryBuild): New method, this method tries to build the LambdaExpression with the given set of types to be used as the types for the various parameters of the lambda expression. If the compilation succeed with the given types, the infered type of the Anonymous method is returned, otherwise null is returned. 2007-04-23 Marek Safar A fix for bug #81414 * delegate.cs: Better fix, moved ApplyAttributes from Define to Emit. 2007-04-22 Miguel de Icaza * cs-tokenizer.cs: Change various identifiers here from the camelCasing to the recommended Linux-like style for instance variables from the Coding Guidelines. 2007-04-19 Martin Baulig * convert.cs (Convert.ImplicitReferenceConversionCore): Allow conversions from System.Enum to System.ValueType. 2007-04-13 Martin Baulig Rewrote implicit reference conversions. We need to distinguish between implicit reference conversions (13.1.4) and implicit boxing conversions (13.1.5). According to the spec, there's an an implicit conversion "From a one-dimensional array-type S[] to IList and base interfaces of this interface, provided there is an implicit reference conversion from S to T." Note that this does not include boxing conversions. * convert.cs (Convert.ImplicitTypeParameterBoxingConversion): New method. (Convert.ImplicitReferenceConversion): Split into ImplicitReferenceConversionCore() and ImplicitBoxingConversionExist(). (Convert.ImplicitReferenceConversionExists): Use the new ImplicitReferenceConversionCore() and ImplicitBoxingConversionExists(). 2007-04-12 Martin Baulig * convert.cs (Convert.ImplicitReferenceConversion): Move the `TypeManager.null_type' checks up to the top of the method. 2007-04-11 Marek Safar A fix for bug #81350 * class.cs, decl.cs, ecore.cs, namespace.cs: The optimization for private extension methods. 2007-04-11 Martin Baulig * statement.cs (Foreach.CollectionForeach.ProbeCollectionType): Use `TypeManager.GetInterfaces(t)' rather than `t.GetInterfaces()' to make this work for generic classes; fixes #79561. 2007-04-11 Martin Baulig * expression.cs (As): Add support for nullable types; fixes #79371. 2007-04-11 Martin Baulig * doc.cs (DocUtil.GetSignatureForDoc): Don't crash if `type.FullName' is null; fixes #80243. 2007-04-11 Martin Baulig * expression.cs (Invocation.IsApplicable): Don't modify the method if type inference succeeded, but the method was not applicable. Fixes #81250. 2007-04-10 Marek Safar A fix for bug #81324 * namespace.cs (Namespace.LookupExtensionMethod): Always inspect both internal and external namespaces containers. 2007-04-10 Martin Baulig * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Use TypeManager.DropGenericMethodArguments() so we also call IMethodData.SetMemberIsUsed() for generic methods. Fixes #80357. 2007-04-10 Martin Baulig * iterators.cs (Iterator.CreateIterator): Don't crash if `method.ReturnType' is null. This happens if something went wrong while resolving that typ (we already reported an error in this case). 2007-04-10 Martin Baulig * expression.cs (New.DoResolve): Don't call CheckComImport() on generic interfaces; report the CS0144 directly. 2007-04-10 Martin Baulig * ecore.cs (MemberExpr.ResolveMemberExpr): If `left' is a `TypeExpr', call ResolveAsTypeTerminal() on it; fixes #81180. 2007-04-10 Martin Baulig * expression.cs (New.DoEmitTypeParameter): Fix #81109. 2007-04-09 Raja R Harinath A better fix * flowanalysis.cs (UsageVector.MergeChild): Handle child.Block == null. * statement.cs: Use KillFlowBranching only in ResolveUnreachable. Fix #81338 * statement.cs (For.Resolve): If resolution fails, use KillFlowBranching. 2007-04-08 Marek Safar * anonymous.cs (MakeName): Make faster and zero-based. (VerifyExplicitParameterCompatibility): Back to mode where generic parameter is ignored. (AnonymousMethodMethod.Emit): Decorate method as compiler generated. * class.cs (EmitType): Method can emit another new method. * cs-tokenizer.cs (IsLinqEnabled): Fixes static cctor race. * driver.cs: Updated. * lambda.cs: Reuse predefined empty parameters. * parameter.cs: Updated * support.cs: Implemented InflateTypes. * typemanager.cs (GetFullName): Don't use FullName as it can be null. (InitSystemCore): Introduced to isolate 3.0 dependencies. 2007-04-03 Martin Baulig Fix #80632. * statement.cs (Foreach.CollectionForeach.TryType): Use a custom version of TypeManager.IsOverride() which also works with generic types. 2007-04-03 Martin Baulig Fix #81044. * convert.cs (Convert.ExplicitReferenceConversion): We need to cast when converting from IList to S[]. 2007-04-01 Marek Safar * decl.cs (FindExtensionMethods): Consider all candidates with same name at this level. * expression.cs (MemberAccess.DoResolve): Cache resolved expression. 2007-03-31 Marek Safar * anonymous.cs (AnonymousMethodExpression.Compatible): Handles both argument and return type inferring. * codegen.cs (InferReturnType): Flag whether return can be inferred. (ReturnType): Turned to property. * statement.cs (Return): Implemented return type inferring. * support.cs (ReflectionParameters): Use local types if possible. 2007-03-30 Raja R Harinath * flowanalysis.cs (FlowBranching.Reachability): Remove. (FlowBranching.UsageVector): Update to changes. Prepare to kill 'Reachability' * flowanalysis.cs (UsageVector): Remove 'Reachability' from argument of constructor. 2007-03-29 Raja R Harinath Prepare to kill 'Reachability' * flowanalysis.cs (UsageVector.is_unreachable): New. (UsageVector): Update to maintain 'is_unreachable' in parallel to 'reachability', and verify they're consistent. Fix #81121 * expression.cs (New.EmitStatement): Handle type parameters here too. 2007-03-29 Martin Baulig Fix #79148. * anonymous.cs (ScopeInfo.ctor): Use `Modifiers.PUBLIC' if we're a nested CompilerGeneratedClass. (ScopeInfo.EmitScopeInstance): Make this protected. (CapturedVariable.EmitInstance): Use `Ldarg_0' if `ec.CurrentAnonymousMethod.Scope == Scope'. * statement.cs (Block.ScopeInfo): Make this a property. 2007-03-27 Raja R Harinath Prepare to kill 'Reachability' * flowanalysis.cs (FlowBranching.Reachability): Make class private. (FlowBranching.UsageVector.Reachability): Remove property. (FlowBranching.UsageVector.IsUnreachable): New property. (FlowBranching.UsageVector.ResetBarrier): New. (FlowBranching.UsageVector, FlowBranchingLabeled): Update to changes. * codegen.cs, statement.cs: Update to changes. 2007-03-27 Martin Baulig Fix #81209. * decl.cs (DeclSpace.LookupNestedTypeInHierarchy): Correctly handle nested generic types. 2007-03-26 Raja R Harinath * flowanalysis.cs (FlowBranching.Reachability): Use a boolean instead of TriState. Remove all mention of TriState. * flowanalysis.cs (FlowBranching.Reachability): Prepare to be replaced by a boolean. Add boolean 'is_unreachable' field, check and maintain invariants. 2007-03-25 Marek Safar * anonymous.cs: Restored checks disabled for uninflated anonymous methods. 2007-03-25 Marek Safar * expression.cs: Stop using obsolete 2.0 opcodes. 2007-03-25 Marek Safar * enum.cs (EnumMember.Define): Fixed regression and slowdown caused by one of the latests Martin's fixes. 2007-03-23 Miguel de Icaza * expression.cs: On BigEndian systems, swap the bytes, temporary solution until we get a new bitconverter class. 2007-03-23 Martin Baulig Fix #81158. * decl.cs (MemberCache.AddMembers): Add generic methods both as "Method" and "Method`1". Normally, a cache lookup is done on the "Method" form (ie. without the generic arity), but this one makes lookups on the full form work as well. 2007-03-22 Raja R Harinath * flowanalysis.cs (Reachability): Reorganize slightly, and remove unused properties. 2007-03-20 Bill Holmes * class.cs: Added 2 MemberCoreArrayList objects, ordered_explicit_member_list and ordered_member_list, to TypeBuilder to store members to be defined in the order they were parsed in. - ordered_explicit_member_list contains all properties indexers and methods that are defined as explicit implementation of an interface or base class. - ordered_member_list contains all properties indexers and methods that are not defined as explicit implementation of an interface or base class. Removed MethodArrayList and IndexerArrayList from TypeBuilder. The functionality in these removed classes has been replaced with ComputeIndexerName, EmitIndexerName, HasEqualss, HasGetHashCode, and CheckEqualsAndGetHashCode members defined and called in the TypeBuilderClass. Adding CheckForDuplications to PropertyBase.PropertyMethod and calls to CheckForDuplications inside GetMethod and SetMethod Define Method to handle method property and indexer name conflicts. Fixes #79434 All code is contributed under the MIT/X11 license. 2007-03-20 Martin Baulig * class.cs (TypeContainer.Interfaces): Removed; they're now included in `TypeContainer.Types'. 2007-03-20 Martin Baulig Fix #77963, #80314 and #81019. Added gtest-317, ..., gtest-320. * class.cs (TypeContainer.CreateType): New public method. This is now called before DefineType() to create the TypeBuilders. (TypeContainer.DefineType): Don't create the TypeBuilder here; it has already been created by CreateType(). (TypeContainer.DefineTypeBuilder): Renamed into CreateTypeBuilder(); don't resolve our base classes here; this has been moved into DefineBaseTypes(). We're now called from CreateType(). (TypeContainer.DefineBaseTypes): New private method; resolve our base classes here. We're now called from DefineType(). * rootcontext.cs (RootContext.ResolveTree): Call TypeContainer.CreateType() on all our types first to create all the TypeBuilders. After that, call TypeContainer.DefineType() on all the types which'll resolve their base classes and setup the resolve order. 2007-03-20 Martin Baulig * class.cs (TypeContainer.Enums): Removed; they're now included in `TypeContainer.Types'. 2007-03-20 Martin Baulig * class.cs (TypeContainer.DefineType): Don't call ResolveMembers() here. (TypeContainer.DoResolveMembers): Call DefineType() on our `compiler_generated' classes; moved here from DefineNestedTypes(). * rootcontext.cs (RootContext.ResolveTree): Call ResolveMembers() on all TypeContainer's in the `type_container_resolve_order'. 2007-03-19 Marek Safar * class.cs: Use corlib to handle InternalMethodImplAttribute. 2007-03-17 Marek Safar * class.cs (EventFieldAccessor.EmitMethod): Don't override existing implementation flags. 2007-03-17 Marek Safar * class.cs: More optimizations for type parameters. 2007-03-15 Marek Safar * anonymous.cs (AnomymousMethod): Can be now hosted in generic container. * ecore.cs, parameter.cs: More common code for both corlibs. * typemanager.cs (IsGenericMethod): Simplified. 2007-03-15 Raja R Harinath * flowanalysis.cs (FlowBranching.Reachability): Remove handling of 'returns'. * statement.cs, iterators.cs, lambda.cs: Update to changes. * statement.cs (Lock.Resolve): Invoke 'ec.NeedReturnLabel' unconditionally. Simplify explanation. (Try.Resolve, Using.Resolve): Likewise. 2007-03-15 Martin Baulig Fix #80731. * decl.cs (DeclSpace): If we're a partial class, use our `PartialContainer's `TypeParameters' and `CurrentTypeParameters'. 2007-03-15 Raja R Harinath * flowanalysis.cs (FlowBranching.Reachability): Remove handling of 'throws'. (FlowBranching.UsageVector): Update to changes. (FlowBranching.MergeSiblings): Likewise. * statement.cs: Likewise. 2007-03-15 Martin Baulig Fix #79302. * decl.cs (MemberCache): Added a special .ctor for type parameters. * typemanager.cs (TypeManager.MemberLookup_FindMembers): `TypeParameter' now has a `MemberCache'. 2007-03-09 Martin Baulig * enum.cs (Enum): Make this a TypeContainer. (EnumMember): Derive from `Const'. * const.cs (Const.DoResolveValue): New protected virtual method; move most of the functionality of ResolveValue() here so we can override it in `EnumMember'. (Const.CreateConstantReference): Make this virtual. * class.cs (Kind): Add `Kind.Enum'. (TypeContainer.Emit): Don't emit the enums here; they're already in the `RootContext.typecontainer_resolve_order'. * rootcontext.cs (RootContext.EmitCode): Don't emit the enums here; they're already in the `typecontainer_resolve_order'. * ecore.cs (EnumConstant.ConvertImplicitly): Add TypeManager.DropGenericTypeArguments(). * typemanager.cs (TypeManager.CSharpEnumValue): Add DropGenericTypeArguments(). (TypeManager.IsEnumType): Likewise. (TypeManager.EnumToUnderlying): Likewise. (TypeManager.IsEqual): Add support for enums. 2007-03-12 Raja R Harinath * typemanager.cs (InitCoreTypes) [NET_2_0]: Allow DefaultParameterValueAttribute to be undefined, say if System.dll is not referenced. 2007-03-11 Marek Safar * ecore.cs, parameter.cs, typemanager.cs: Another gmcs fix to work with any mscorlib. 2007-03-10 Marek Safar * class.cs, parameter.cs: Unified parameters verification. 2007-03-08 Martin Baulig * cs-parser.jay (constructor_header): Pass the location to the newly created TopLevelBlock. 2007-03-07 Martin Baulig * statement.cs (Block.Resolve): Don't crash on error; bug #80715. 2007-03-06 Miguel de Icaza * convert.cs (ExplicitReferenceConversionExists): Sync this method with the changes from David, fixes the build. 2007-03-05 David Mitchell * convert.cs: Implement From System.Collecitons.Generic.IList and its base interfaces to a one-dimensional array type S[], provided there is an implicit or explicit reference conversion from S to T. 2007-03-03 Marek Safar * cs-tokenizer.cs: Implemented basic linq grammar. * driver.cs: Set linq lang version on demand. 2007-02-26 Marek Safar * cs-parser.jay, expression.cs: Compile empty __arglist correctly. 2007-02-25 Marek Safar * attribute.cs: Replaced DefinePInvoke in favor of S.R.E implementation (Fixes #80455) * class.cs (InterfaceMemberBase): Share common `extern' modifier checks here. Check property and event extern attributes. * codegen.cs (ModuleClass): HasDefaultCharSet when module defined global charset. 2007-02-24 Marek Safar A fix for bug #80407 * ecore.cs: Don't report ambiguity error when methods have same parent. 2007-02-23 Marek Safar A fix for bug #80878 * class.cs, cs-parser.jay: Event property can host anonymous methods. 2007-02-22 Marek Safar * attribute.cs: Enable ExtensionAttribute presence test. 2007-02-22 Marek Safar * class.cs: Warn about missing GetHashCode only when Equals is override. * decl.cs: Check accessibility of type arguments. * typemanager.cs: Correctly report nullable array. 2007-02-20 Marek Safar * class.cs, report.cs: Capture more details when things go wrong. 2007-02-20 Marek Safar A fix for bug #80650 * cs-parser.jay: Anonymous container starts at constructor declaration and not at block beginning because it has to be usable in constructor initializer. * statement.cs: Use context location and not block one for error reporting. 2007-02-18 Marek Safar A fix for bug #78712 * class.cs.cs, decl.cs, ecore.cs: LookupAnyGeneric inspects nested types too. 2007-02-18 Marek Safar A fix for bug #80493 by Atsushi Enomoto * cs-parser.jay: Ignore invalid attribute target. 2007-02-18 Marek Safar * cs-tokenizer.cs: Ignore '\0' as white space character. 2007-02-17 Miguel de Icaza * cs-parser.jay: Add support for lambda expressions to the mcs compiler as well. * lambda.cs: Only clone when we are probing, not on the final call (Compatible is the final call). * statement.cs (CloneContext): Introduce class to provide block remapping during clone. All statements Clone themselves now. (Clone): special handling for blocks, when we clone a block, we register the block inside this routine, as children of the block might trigger a lookup. * expression.cs: Add support for CloneContext in all expressions. 2007-02-17 Marek Safar A fix for bug #80493 * statement.cs: Report ambiguous warning when interfaces are not related. 2007-02-15 Marek Safar C# 3.0 extension methods. * attribute.cs (Error_MisusedExtensionAttribute): Extension attribute cannot be used directly. * class.cs (Class.Emit): Emit extension attribute if any class method is extension method. (Method.Define): Add basic extension method validation conditions. (Method.Emit): Emit extension attribute for method. * codegen.cs (AssemblyClass): Emit extension attribute if at least one extension method exists. Currently we follow same approach as Microsoft does, emit even if a method or a class are private but this can change later. * cs-parser.jay: Add handling of `this' keyword in method parameters context. * decl.cs (DeclSpace.IsStaticClass): New property. (MemberCache.FindExtensionMethods): Looks for extension methods with defined name and extension type. * doc.cs: Updated after OverloadResolve changes. * driver.cs: Add new soft reference to System.Core.dll. * ecore.cs (MethodLookup): Can return only MethodGroupExpr. (ExtensionMethodGroupExpr): Represents group of extension methods. * expression.cs (Invocation): Moved methods BetterConversion, MoreSpecific, BetterFunction, IsOverride, IsAncestralType, OverloadResolve to MethodGroupExpr and made non-static for easier customization. (Invocation.DoResolve): Add extension method lookup when no standard method was found. (MemberAccess.DoResolve): Try extension methods if no member exists. * modifiers.cs: Add METHOD_EXTENSION modifier. * namespace.cs (RegisterExtensionMethodClass): Register class namespace as well as candidate extension type. (ComputeNamespaces): When assembly constains extension methods registers them. (Namespace.RegisterExternalExtensionMethodClass): Register type for later extension method lookup. (Namespace.LookupExtensionMethod): Looks for extension method in this namespace. (NamespaceEntry.LookupExtensionMethod): Does extension methods lookup to find a method which matches name and extensionType. * parameter.cs (Parameter): Add This modifer. (HasExtensionMethodModifier): New property. (Resolve): Add extension parameter check. (ModFlags): turned to property to exclude this modifier as it is not real parameter modifier. (Parameters): Implemented ExtensionMethodType and HasExtensionMethodType. * support.cs (ParameterData): Add ExtensionMethodType. (ReflectionParameters): Implemented ExtensionMethodType interface property. * typemanager.cs: Add type and ctor extension attribute type. 2007-02-15 Miguel de Icaza * report.cs (DisableErrors, EnableErrors): used to prevent error output when we are "trying" to compile various methods with different types. * ecore.cs (Expression): Add Clone method that calls the virtual CloneTo method. The current CloneTo method in Expression throws an exception so we can track down all the places where this must be implemented (not using abstract, because that would be a lot of up-front-work before we can start testing the implementation idea). Important: we only need Clone capabilities for expressions created by the parser, as the expressions we will be cloning are expressions in the pre-resolved state. This vastly simplifies the work required. (SimpleName): Add CloneTo that does nothing. (EmptyCast): Add CloneTo. * expression.cs (Binary): Implement CloneTo. (Invocation.IsApplicable): Store the current ec in EmitContext.TempEc and restore it on return. This is used so we do not have to sprinkle hundres of methods with an extra EmitContext, we know that the only user is the lambda expression ImplicitConversionExists code. (Argument): Add Cloning capabilities. (LocalVariableReference, ParenthesizedExpression, Unary, Probe, Cast, Conditional, ArrayCreation, InvocationOrCast, Invocation, ArglistAccess, ArgList, TypeOf, SizeOf, CheckedExpr, UnCheckedExpr, ElementAccess, BaseAccess, BaseIndexerAccess, IndexerAccess): Add Clone capability. (LocalVariableReference, This): TODO: needs cloned Block mapping. (Argument): Add cloning capability. * assign.cs (Assign): Implement CloneTo. * anonymous.cs (ImplicitStandardConversionExists): Make virtual. * lambda.cs (ImplicitStandardConversionExists): Implement lambda version by calling Convert with the EmitContext (that we are currently storing in ec, this is not great, but will do for now, to avoid passing EmitContext parameters to hundreds of functions that do not need them now). (SetExpression): Remove, it is not needed. (ContextualReturn): Implement CloneTo. * statement.cs (Statement): Implement cloning infrastructure, similar to expressions. (Block): Partial implementation of Clone for statements. (Return): Implement clone. * constant.cs (Constant.CloneTo): New method, does nothing. * codegen.cs (TempEc): Add a static EmitContext as a temporary solution, until we decide how to exactly do this. 2007-02-14 Marek Safar A fix for bug #80493 * class.cs (FindOutBaseMethod): When the base accessor does not exist and a property is override we need to use second accessor. 2007-02-13 Marek Safar A fix for bug #80418 * attribute.cs, class.cs: Use correct calling conventions for pinvoke methods. 2007-02-13 Marek Safar Another fix for bug #80749 * pending.cs: Abstract class has priority over interfaces. 2007-02-13 Marek Safar Another fix for bug #80749 * pending.cs: Abstract class has priority over interfaces. 2007-02-13 Marek Safar Another fix for bug #80749 * pending.cs: Abstract class has priority over interfaces. 2007-02-13 Marek Safar Another fix for bug #80749 * pending.cs: Abstract class has priority over interfaces. 2007-02-13 Marek Safar * class.cs Better error message. * driver.cs: Add shorter versions of -optimize option. 2007-02-13 Martin Baulig * class.cs (Constructor.Emit): Check the return value of ec.ResolveTopBlock() and return on error. 2007-02-13 Raja R Harinath * ecore.cs (Error_InvalidExpressionStatement): Add a comma to error message to fix error message regression. 2007-02-12 Marek Safar * delegate.cs: Delegate creation expression cannot be of Nullable type. 2007-02-12 Marek Safar A fix for bug #80749 * assign.cs (FieldInitializer): FieldInitializer has to keep track of its parent container. * class.cs (DefineFieldInitializers): Each initializer can has different resolve context. * const.cs: Updated. 2007-02-11 Miguel de Icaza * lambda.cs (LambdaExpression.Compatible): Remove some early code, now all the heavy lifting to check that embedded statements or expressions have the right form is done in the ContextualReturn. (ContextualReturn): New class. * ecore.cs (Error_InvalidExpressionStatement): Make a helper method that can be invoked to report 201, so we do not replicate this everywhere. * cs-parser.jay: Reuse Error_InvalidExpressionStatement. * cs-tokenizer.cs (xtoken): Correctly compute the column, it was treating tabs as spaces. 2007-02-09 Marek Safar A fix for bug #80315 by martin.voelkle@gmail.com (Martin Voelkle) * assign.cs: Use full implicit conversion for right side check. 2007-02-09 Marek Safar * statement.cs (Switch): Switch over boolean type is not standardized. 2007-02-08 Marek Safar A fix for bug #80755 * decl.cs (FindBaseEvent): Don't use method cache for events. 2007-02-07 Marek Safar * cs-parser.jay: Better syntax error handling. * ecore.cs, enum.cs, statement.cs, typemanager.cs: Print enum member name instead of underlying type value. 2007-02-06 Marek Safar * driver.cs: Check define identifier before is registered. * namespace.cs: Use existing error message. * report.cs: New warning. 2007-02-06 Marek Safar A fix for bug #80742 * expression.cs: Delegate Invoke method can be called directly. 2007-02-06 Marek Safar A fix for bug #80676 * class.cs (IsEntryPoint): The Main method can have params modifier. 2007-02-04 Miguel de Icaza * parameter.cs (Parameter, Parameters): Add Clone method. * anonymous.cs (Compatible): Turn method into virtual method, so LambdaExpression can implement a different behavior. (CompatibleChecks, VerifyExplicitParameterCompatibility): Factor out the basic checking here, so it can be used by LambdaExpressions. * lambda.cs: Introduce "Compatible" function that will do the heavy lifting. 2007-02-02 Marek Safar * attribute.cs: Unified one error message. * class.cs (Class): Use type attributes and not properties to test static class. (IsEntryPoint): Don's pass local variable. * convert.cs: Removed duplicate check. * decl.cs, doc.cs, ecore.cs (LookupType): Renamed to LookupNamespaceOrType. * driver.cs: Don't crash when soft reference does not exist. * namespace.cs (EnsureNamespace): Renamed to RegisterNamespace. (UsingEntry): Removed redundant allocation. * parameter.cs: Add fast path for type parameters. * support.cs: Don't allocate attribute when it's not used. 2007-01-30 Miguel de Icaza * anonymous.cs (AnonymousMethodExpression.ImplicitStandardConversionExists): turn this into a virtual method, so we can override it in LambdaExpression. * driver.cs: Improve diagnostics in case of failure. * cs-tokenizer.cs: Instead of trying to parse a type and a name, write a function that is slightly more complex and that parses: type identifier [, type identifier]* ) The old function would return incorrectly a OPEN_PARENS_LAMBDA for this expression: (canEmpty ? i >= 0 : i > 0) 2007-01-30 Raja R Harinath * cs-tokenizer.cs (parse_namespace_or_typename): Don't throw an exception on possibly valid code. 2007-01-29 Raja R Harinath * cs-tokenizer.cs (is_punct) ['<']: Update to changes in Push/PopPosition. (parse_opt_type_arguments): Remove. It's almost the same as parse_less_than. (parse_namespace_or_typename): Use parse_less_than. 2007-01-28 Miguel de Icaza * cs-tokenizer.cs: Typo fix, its not GMCS_SOURCES but GMCS_SOURCE, this bug took a few hours to find, because the state saved and restored by PushPosition and PopPosition was ignoring the state of parse_generic_less_than. I can also now remove the handling of OP_LT and OP_GT, this solves the big mistery. * cs-tokenizer.cs: store the location for the ARROW token, we use that in the parser. (PushPosition, PopPosition): save/restore also `current_token', restore `parse_generic_less_than' (was missing). (parse_opt_type_arguments): use parse_type, not parse_namespace_or_typename to parse types. * lambda.cs: Empty new file, will eventually have the lambda expression implementation. * lambda.test: used to test the internal tokenizer. * report.cs (FeatureIsNotISO1): Rename from FeatureIsNotStandardized, because it was about the language level (1 vs 2) it was not about standarization. (FeatureRequiresLINQ): New. * support.cs (SeekableStreamReader): Only require that the reader is a TextReader, not a StreamReader, so we can plug StringReader. * cs-tokenizer.cs (parse_type_and_parameter): Returns true if at a given position in the input stream the following tokens can be parsed as a type followed by an identifier. (is_punct): after a '(' if parse_type_and_parameter returns true, then return a special token OPEN_PARENS_LAMBDA which is used to avoid reduce/reduce errors in the grammar for the lambda_expression rules. (parse_type): implement a type parser inside the tokenizer, the parser only returns true or false depending on whether the input at a given position can be parsed as a type. (peek_token): new method used during type parsing. 2007-01-28 Raja R Harinath Fix #80531 * anonymous.cs (ScopeInfo.InflateParameters): New. (AnonymousContainer.Resolve): Use it to redirect types of delegate parameters. 2007-01-27 Raja R Harinath Fix #80530 * expression.cs (Error_InvalidArguments): Don't use two different messages for CS1503. Use ExtraInformation and SymbolRelatedToPreviousError instead. Fix #80358 * decl.cs (DeclSpace.initialize_type_params): Don't access 'type_params' of a partial class directly. 2007-01-26 Miguel de Icaza * constant.cs: Removed a handful of out-of-range checks that were not necessary. 2007-01-25 Marek Safar * expression.cs (CheckUselessComparison): Add additional check for char constants. * namespace.cs: Fixed typo. 2007-01-23 Miguel de Icaza * constant.cs: Bloat removal, CheckRange and CheckUnsigned are gone, instead we inline the test, preventing the needless casts to longs, ulongs and doubles for the parameters, avoiding calls to methods that overchecked stuff, and instead inlined things nicely. 2007-01-20 Marek Safar * cs-parser.jay: Better parameter error handling. 2007-01-17 Marek Safar A fix for bug #80368, #80522 * expression.cs (ArrayCreation.only_constant_initializers): Indicates whether array initializer contains constants only. (ArrayCreation.Emit): Use better formula to decide when are array initializers for static initialization. (ArrayCreation.EmitDynamicInitializers): When the array is small enough we have to emit even constants otherwise they are pre-initialized. 2007-01-17 Bill Holmes Raja R Harinath Fix emit order of 'get' vs. 'set'. * support.cs (Accessors): New. * cs-parser.jay (accessor_declarations): Use it instead of 'Pair'. Note the order in which accessors are declared in the source. * class.cs (PropertyBase.DefineGet, PropertyBase.DefineSet): New. Refactored from Property.Define and Indexer.Define. (PropertyBase.DefineAccessors): New helper that calls the above in appropriate order as noted by the parser. (Property.Define, Indexer.Define): Update to changes. (PropertyBase.SetMethod.PropertyInfo): Don't return a null. 2007-01-17 Raja R Harinath Fix cs0029-6.cs and gcs0029-2.cs (regression) * ecore.cs (EmptyConstantCast.ConvertImplicitly): Check that there's an implicit conversion from the current type to the target type before converting the underlying constant. 2007-01-16 Marek Safar * const.cs (ResolveValue): Updated after constant conversion was made more generic. * constant.cs (GetAttributableValue): constant to object conversion is used for attributes only. (IntConstant.ConvertImplicitly): Moved from convert to be used in all constant conversions. (LongConstant.ConvertImplicitly): Ditto. * convert.cs (ImplicitNumericConversion): Extracted constant bussiness. (ImplicitConversionStandard): Handle constant conversion as extra step. It solves the issue when constant conversion was called indirectly like inside array initializer and constant folding was skipped. * literal.cs (NullLiteral.ConvertImplicitly): Fixed an issue exposed by this change. * statement.cs(ImplicitConversionStandard): Updated after constant conversion was made more generic. 2007-01-16 Sergey P. Kondratyev * expression.cs (As.DoResolve): Use GenericConstraints instead of Constraints, solves the problem where the compiler incorrectly reported that a type parameter was not constrained to a class (Bug 80518) 2007-01-14 Marek Habersack * doc-bootstrap.cs: Fix a compilation problem in the bootstrap phase. 2007-01-14 Marek Safar A fix for bug #80368 * assign.cs (FieldInitializer): New class implements field initializer statement. * attribute.cs: Update after FieldMember rename. * class.cs (PropertyBasedMember): New common class for property based types. (InterfaceMemberBase): New base class for all members which can be used as an interface members. (MethodCore): Moved really common code to InterfaceMemberBase. (Method.Define): Equal and GetHasCode detection is relevant for methods only. (MethodData.Define): Don't assume that public event implements an interface automatically. (MethodData.DefineMethodBuilder): Issue an error even if only extern modifier is used. (MemberBase): Moved all interface speficic code to InterfaceMemberBase. (FieldMember): Merged with FieldBase. (EventProperty.AEventPropertyAccessor): New specialization to check whether event extern modifier can be used. (EventField.EventFieldAccessor): Moved event field specific code here. (Event.AllowedModifiers): Even event can be extern. (Event.FindOutBaseMethod): New override specific to events. (Indexer.parameters): Reintroduce parameters because base class holds only properties common data. (Indexer.CheckForDuplications): Indexers are threated as methods so we need do extra parameters check. * const.cs: Update after FieldMember rename. * decl.cs (MemberCache.FindBaseEvent): New method. * doc.cs (GetMethodDocCommentName): Accept parameters as extra argument to reflect that indexer is now derived from PropertyBased. * ecore.cs (GetMemberType): Made public. (EventExpr.ResolveMemberAccess): Use right event cache and checks for obsolete event. * flowanalysis.cs, statement.cs: Update after FieldMember rename. * typemanager.cs (CSharpSignature): Correctly print event accessors. (RegisterEvent): Removed. (RegisterPrivateFieldOfEvent): Renamed to RegisterEventField. (GetPrivateFieldOfEvent): Renamed to GetEventField. 2007-01-11 Raja R Harinath Fix #80249 * statement.cs (CollectionForeach.TryType): Prefer generic GetEnumerator over non-generic variant. Fix code to follow comments. 2007-01-09 Raja R Harinath Fix #80446 * support.cs (ReflectionParameter): Don't use an invalid index on the generic parameter data. 2007-01-08 Miguel de Icaza * driver.cs: Just add a tiny bit of infrastructure. 2007-01-02 Marek Safar * class.cs (VerifyMembers): Fixed an crash reported on mono mailing list where field type is struct from current assembly. * ecore.cs (EnumConstant.AsString): Report an enum member name whenever it is possible. 2007-01-02 Marek Safar A fix for bug #80381 * attribute.cs (AttributeTester.RegisterNonObsoleteType): Registers the core types. * namespace.cs (GlobalRootNamespace.LookupTypeReflection): Better error messages. (Namespace.LookupType): Always use core types from corlib when speficied. * report.cs: A new warning. * rootcontext.cs (BootstrapCorlib_ResolveInterface, BootstrapCorlib_ResolveClass): Register type as non-obsolete type. (ResolveCore): Add missing System.Runtime.InteropServices._Attribute. * typemanager.cs (CoreLookupType): Register type as non-obsolete type. (InitCoreTypes): Set expression type of object_type and value_type immediately after lookup. 2007-01-01 Miguel de Icaza * cs-tokenizer.cs: Accept Pc class characters (Connector Punctuation) as valid identifiers. Fixes #78259 * expression.cs (Invocation.DoResolve): Moved the check for the use of `this' for doing method calls to the Invocation resolution step, after overload resolution has taken place instead of doing the check at the low-level `This.DoResolve' level. The `This.DoResolve'(appens before overload resolution, so it has no way of knowing if the method that will be called will be instace or static, triggering an erroneous report for cs0188 (Bug 78113). We now do the check for instance method invocations after we know what method will be called. (This.CheckThisUsage): Move the actual use of this structure checking into its own method and expose it. * Everywhere that called Error_ValueCannotBeConverted: pass a new EmitContext. Exceptions: Null.ConvertImplicitly, Constant.ImplicitConversionRequired as there are too many call sites for passing the ec. * ecore.cs (Expression.Error_ValueCannotBeConverted): Take an EmitContext, if the value is null, then we do not try to provide the extra information from the error (If a userdefined conversion exists, as UserDefinedConversion requires a non null-EmitContext). Fixes: #80347 2006-12-30 Raja R Harinath * flowanalysis.cs (MyBitVector): Document some invariants. (MyBitVector.Or, MyBitVector.And): Reimplement the optimizations introduced below, and add a couple of others, 2006-12-30 Marek Safar * attribute.cs (GetMethodObsoleteAttribute): Uses new GetPropertyFromAccessor and GetEventFromAccessor. * class.cs (MethodCore.CheckBase): A new warning when obsolete member overrides non-obsolete one. (Indexer.Define): Error message has been moved to the parser. * cs-parser.jay: Better syntax errors handling. * delegate.cs (NewDelegate.DoResolve): Issue less confusing error message when an invocation has no arguments. * ecore.cs: Removed not used caching. * expression.cs (IsSpecialMethodInvocation): Reuses TypeManager implementation. * report.cs: Add a new warning. * support.cs (ReflectionParameters): Implements Equals, GetHashCode. * typemanager.cs (enumeration_type): Removed. (CSharpSignature): Reuses IsSpecialMethod. (IsEqual): Hack for MS BCL. (GetPropertyFromAccessor): New method. (GetEventFromAccessor): New method. (IsSpecialMethod): Fixed to handle more cases. 2006-12-30 Marek Safar * cs-tokenizer.cs (PreProcessDefinition, handle_preprocessing_directive): Made white spaces array static. * ecore.cs (RemoveGenericArity): Optimized. * flowanalysis.cs (MyBitVector.Or, MyBitVector.And): Optimized (up to 10 times faster). (MyBitVector.initialize_vector): Simplified. 2006-12-22 Miguel de Icaza * ecore.cs: Am not entirely happy with this hack, but it seems to address the issue in 80257 (a small test case for CreativeDocs.NET). I set the MethodGroupExpr.Type to an internal compiler type (itself in this case) to force the resolution to take place. Why it does not take place with a null is beyond me. 2006-12-20 Marek Safar A fix for bug #80288 * expression.cs (ResolveOperator): Consider user defined conversion for logical and operator too. (EmitBranchable): Optimization for logical and when full constant folding could not be applied but one operand is constant. 2006-12-19 Marek Safar * class.cs (GetClassBases): Write 5 times every day, will never use FullName for error reporting. * decl.cs (AsAccessible, CheckAccessLevel): Always unpack arrays first. 2006-12-19 Martin Baulig * statement.cs (LocalInfo.EmitSymbolInfo): New public method; emit the symbol file info here. 2006-12-18 Marek Safar * cs-tokenizer.cs (handle_preprocessing_directive): When previous section of `elseif' is taking then following sections are not taking. Fixes an issue reported on mono mailing list. 2006-12-18 Marek Safar A fix for bug #80300 * cs-tokenizer.cs (PreProcessDefinition): Do no define/undefine when a caller is not taking. 2006-12-18 Raja R Harinath * anonymous.cs: Change several TypeContainer declarations to DeclSpace. (CompilerGeneratedClass): Use parent.PartialContainer unconditionally. (RootScopeInfo, AnonymousMethodMethod): Update to changes. * iterator.cs: Change several TypeContainer declarations to DeclSpace. * class.cs: Update to changes. 2006-12-17 Marek Safar A fix for bug #79934 * anonymous.cs (CompilerGeneratedClass): Register class in a shared partial container. * class.cs (ResolveMembers): Register an iterator in current container and not in shared one. 2006-12-16 Raja R Harinath Fix test-543.cs * expression.cs (VerifyArgumentsCompat): Allow zero arguments to satisfy a params annotated parameter. 2006-12-16 Marek Safar A fix for bug #77014 * expression.cs (Invocation.BetterFunction): Fixed to cope with dynamic paramters correctly and not rely on hacks in Parameters class. (Invocation.IsParamsMethodApplicable): Changed to accept params parameter at any possition. (Invocation.VerifyArgumentsCompat): Ditto. (Invocation.EmitArguments): Changed to correctly emit params arguments at any possition. * parameter.cs (HasParams): Don't assume that params is the last one. * support.cs (ReflectionParameters.ctor): Look for params attribute correctly. (ReflectionParameters.ParameterType): Removed hack when we returned last parameter for out of range parameters. (ParameterName, ParameterModifier): Ditto. 2006-12-14 Marek Safar A fix for bug #79987 * decl.cs (DeclSpace.VerifyClsCompliance): External names cache is null when assembly is not CLS compliant but type is. I have no idea why is this allowed. * typemanager.cs (Reset): Invalidate AllClsTopLevelTypes cache. 2006-12-13 Miguel de Icaza * class.cs (ConstructorInitializer.Resolve): Allow for ":this()" in struct constructors, they are basically no-ops. 2006-12-12 Marek Safar * cs-tokenizer.cs (Position): Save preprocessor status too. 2006-12-12 Marek Safar A fix for bug #77794 * cs-tokenizer.cs (consume_identifier): Check for correct partial context. 2006-12-12 Marek Safar * cs-tokenizer.cs (get_cmd_arg): Support CR as the line terminator. Fixes #69299. (pp_expr): Report error for an invalid expression. (handle_preprocessing_directive): Simplified; add more error checking. 2006-12-11 Marek Safar A fix for bug #74939 * cs-tokenizer.cs (is_punct): We cannot simply disable preprocessor directives handling. 2006-12-10 Marek Safar A fix for bugs #80093, and #75984 * cs-tokenizer.cs (handle_preprocessing_directive): Fixed #if/#else/#endif logic, it seems to me as it worked before "by coincidence". (xtoken): Simplified to use reworked handle_preprocessing_directive. (cleanup): Enabled endif check. 2006-12-09 Marek Safar A fix for bug #80162 * statement.cs (CollectionForeach.TryType): Generics and non-generics enumerators are never ambiguous. 2006-12-08 Raja R Harinath Fix #80060 * cs-tokenizer.cs (parse_less_than): Recognize double-colons too. 2006-12-06 Marek Safar A fix for bug #80144 * class.cs (EventProperty.Define): Explicit implementation means that an even is used. 2006-12-06 Marek Safar Fixes the operators implementation (part II) * cfold.cs (DoConstantNumericPromotions): Renamed to DoBinaryNumericPromotions and simplified. (BinaryFold): Couple of conversion fixes; simplified. * constant.cs, ecore.cs, literal.cs (ToType): Renamed to ConvertImplicitly. (Reduce): Renamed to ConvertExplicitly. * class.cs, convert.cs: Updated. * expression.cs: TryReduce doesn't throw an exception. 2006-12-01 Marek Safar A fix for bug #80108 * ecore.cs (EventExpr.EmitAddOrRemove): Don't crash when right side is not compatible. 2006-11-30 Marek Safar Fixes unary operators implementation (part I) Also fixes #80026 * cfold.cs (Error_CompileTimeOverflow): Made internal * const.cs (IConstant): Changed to use reference to constant and not constant itself. Updated IConstant implementations. * constant.cs (CreateConstant): New factory method. Updated IConstant implementation. * convert.cs (ImplicitStandardConversionExists): Uses compiler Equals. * ecore.cs: Updated to use CreateConstantReference. * enum.cs: Reflects IConstant changes. * expression.cs (Unary): Reimplemented +,-,~ to conform C# standard. * literal.cs (NullConstant): Change to be independently usable. 2006-11-29 Martin Baulig * class.cs (Constructor.Emit): Correctly handle anonymous methods; we need to emit the scope initializer before calling the base .ctor. * anonymous.cs: Merged back from the new anonymous methods branch. (AnonymousMethodHost): Renamed to `RootScopeInfo'. * expression.cs (ParameterReference.DoResolveBase): Create a "normal" ScopeInfo when capturing parameters rather than using the root scope; this makes things work with anonymous methods having parameters. * statement.cs (ToplevelBlock.AnonymousMethodHost): Renamed into `RootScope'. 2006-11-22 Marek Safar A fix for bug #79987 * class.cs (VerifyClsCompliance): Move redundant CLS compliance attribute check to a base class. * decl.cs (VerifyClsCompliance): Warn that CLS compliance cannot be tested only when assembly has missing attribute. * report.cs: Update. 2006-11-21 Marek Safar * cs-tokenizer.cs: Merged with gmcs version. 2006-11-20 Marek Safar * cs-tokenizer.cs, * cs-parser.jay: Better error message when partial keyword is misplaced. 2006-11-19 Gert Driesen A fix for bug #79810 report.cs: CS1058 only applies to 2.0 profile (gmcs). codegen.cs: on 2.0 profile, non-exception throwables are wrapped in a RuntimeWrappedException by default. 2006-11-18 Marek Safar A fix for bug #79843 * delegate.cs (Delegate.VerifyMethod): Fixed covariance and contravariance implementation. (DelegateCreation.Error_NoMatchingMethodForDelegate): Ditto. 2006-11-18 Marek Safar * driver.cs, namespace.cs: Uses faster IndexOf version. 2006-11-17 Marek Safar A fix for bug #79941 * class.cs (MemberCore.IsDuplicateImplementation): Add more tricks for operators. (Operator.Define): Implicit/Explicit operator of same type is duplicate even if internal name is different. * convert.cs (GetConversionOperator): Replaced EmitContext with parentType. (UserDefinedConversion): Simplified as the operators cannot be internal. * ecore.cs (Error_ValueCannotBeConverted): Take account of user conversions. (MethodLookup): Replaced EmitContext with parentType. * expression.cs: Updated. 2006-11-09 Raja R Harinath * driver.cs (BadAssembly): Handle all the ugliness of DefineDynamicAssembly. 2006-11-08 Raja R Harinath Address parts of #58244 -- most of what's left is in the runtime * driver.cs (LoadAssembly): Simplify slightly. Add CS0009 and CS1509 error checks, and handle them for all assembly loads, not just the first invocation. (LoadModule): Likewise. Move handling of 'adder_method' ... * codegen.cs (AssemblyClass.AddModule): ... here. 2006-11-02 Marek Safar * statement.cs.cs (CollectionForeach.TryType): Issue a error when IEnumerable is ambiguous. 2006-10-31 Marek Safar A fix for bug #67689 * statement.cs.cs (CollectionForeach.TryType): Issue a warning when GetEnumerator is ambiguous. * report.cs: Add new warning. 2006-10-29 Marek Safar A fix for bug #78602 ecore.cs (PropertyExpr.InstanceResolve): The qualifier for access to protected member can be nested type. 2006-10-28 Marek Safar A fix for bug #78965 ecore.cs (PropertyExpr.InstanceResolve): The qualifier for access to protected member must derive from current type. 2006-10-27 Marek Safar assign.cs: Reuses error method. ecore.cs (Expression.Error_ValueCannotBeConverted): Report a value instead of type for constants. (Expression.Error_ValueAssignment): Common error method. * expression.cs (UnaryMutator.ResolveOperator): Value cannot be used for any assignment. 2006-10-27 Marek Safar A fix for bug #79081 * expression.cs (MemberAccess.DoResolve): Check nested type accessibility. 2006-10-27 Atsushi Enomoto * doc.cs : nested delegates were not handled. Fixed bug #79754. 2006-10-26 Marek Safar A fix for bug #76591 * cs-tokenizer.cs (IsCastToken): Enable a cast of anonymous method. 2006-10-26 Marek Safar * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Don't allow to have type forwarder of the same type multiple times. 2006-10-26 Raja R Harinath Fix #78820 * ecore.cs (PropertyExpr.InstanceResolve): Always resolve the instance as an rvalue, even when we later resolve as an lvalue. 2006-10-25 Martin Baulig * anonymous.cs: Fix #79673. 2006-10-24 Marek Safar A fix for bug #79666 expression.cs (ArrayCreation.GetAttributableValue): An initializer can be ignored when is optimized (= default value) as its value is already set. 2006-10-23 Marek Safar A fix for bug #79724 * report.cs (SymbolRelatedToPreviousError): Uses DeclSpace instead of TypeContainer for type lookup. 2006-10-23 Marek Safar A fix for bug #79231 * ecore.cs (ResolveAsBaseTerminal): Removed redundant error test. * expression.cs (OverloadResolve): Always convert type name for an error message. (ResolveNamespaceOrType): Don't confuse a nested type with any other member. 2006-10-18 Martin Baulig * anonymous.cs: Propagate the IsStatic state, fixes the crasher in banshee. 2006-10-17 Miguel de Icaza * convert.cs: Fix typo, fixes the test-535.cs, we were casting to an int32, but requesting an int64 from the conversion 2006-10-12 Martin Baulig * anonymous.cs (AnonymousContainer.Resolve): Inflate the `ReturnType'. Fixes #79592. 2006-10-12 Martin Baulig * statement.cs (Using.EmitLocalVariableDeclFinally): Small fix for iterators. 2006-10-11 Miguel de Icaza * convert.cs: Remove broken code: I was doing the "Existance" tests for Implicit conversions. 2006-10-10 Miguel de Icaza * convert.cs: Added one missing case in ImplicitStandardConversionExists uint64 to intptr. Fixes #59800 * typemanager.cs (uintptr_type): another core known type. * ecore.cs (OperatorCast): routine used to do cast operations that depend on op_Explicit. We could change some of the Decimal conversions to use this. This one has a probe mechanism that checks both types for an op_ which it coudl be used to eliminate two classes: CastToDecimal and CastFromDecimal. * convert.cs: Implement the conversions documented in #59800 2006-10-10 Martin Baulig * iterators.cs (Iterator.Resolve): Call RootScope.ResolveType() before RootScope.ResolveMembers(). * anonymous.cs (ScopeInfo.CapturedScope.ctor): Use the child's `CurrentType' if appropriate. 2006-10-09 Marek Safar A fix for bug #78568 * cs-tokenizer.cs (Deambiguate_CloseParens): Expression cannot be cast when contains binary operators. * cs-parser.jay: Updated. 2006-10-09 Martin Baulig * delegate.cs (Delegate.DefineType): Don't call TypeParameter.Resolve() here; moved that into Define() and also do the other type parameter checks there. Fixes #79094. Added gtest-292.cs. * expression.cs (ArrayCreation.EmitDynamicInitializers): Use `etype.IsValueType' since that doesn't include type parameters; don't use `Ldelema' for type parameters. Fixes #78980. Added gtest-293.cs. 2006-10-08 Marek Safar A fix for #77796 * convert.cs (ExplicitReferenceConversion): Only enum to enum value conversion is allowed. 2006-10-06 Marek Safar * ecore.cs (Expression.MemberLookup): Don't register any symbol for error reporting when no error occurs. 2006-10-06 Marek Safar * cfold.cs (ConstantFold.BinaryFold): Report an error when the conversion does not exist. 2006-10-06 Raja R Harinath Fix #79584 * class.cs (DefineTypeBuilder): Check circular dependencies before setting the parent of the TypeBuilder. (CheckRecursiveDefinition): Don't use 'BaseType', since it may not be valid until after DefineTypeBuilder. Use 'base_type' instead. 2006-10-04 Martin Baulig Merged the Anonymous Methods patch. * anonymous.cs, iterators.cs: The new anonymous methods code. * statement.cs (Variable): New public abstract class. (LocalInfo.Variable): New public property. (LocalInfo.ResolveVariable): New public method. (Block.Flags): Add `IsIterator'. (Block.AddVariable): Improved the CS0136 check. (Block.AnonymousChildren): New public property. (Block.AddAnonymousChild): New public method. (ToplevelBlock): Update to use the new anonymous method framework. (ToplevelBlock.ctor): `container' is now a `Block' and not a `ToplevelBlock'; this is required to correctly implement the CS0136 check. (Fixed, Using): Use `TemporaryVariable' instead of directly creating the `LocalBuilder'. * parameter.cs (Parameter.ResolveVariable): New public method. (Parameters.ResolveVariable): Likewise. * ecore.cs (TemporaryVariable): Use the new `Variable' framework. * class.cs (TypeContainer): Replaced the `iterators' list and corresponding methods with a list of `CompilerGeneratedClass'es. (TypeContainer.ResolveMembers): New public method. (Method): `IIteratorContainer' has been replaced by `IAnonymousHost'. * expression.cs (VariableReference): New public abstract base class for `LocalVariableReference', `ParameterReference' and `This'. * codegen.cs (EmitContext): Removed `capture_context', `HaveCaptureInfo', `EmitScopeInitFromBlock()' and `Capture*()'. (EmitContext.EmitThis): Removed. * cs-parser.jay: Replace `iterator_container' with `anonymous_host'. 2006-10-04 Martin Baulig * generic.cs (GenericMethod): Don't make this abstract. (Constraints.Clone): Added dummy implementation. 2006-10-04 Raja R Harinath Fix #79577 * namespace.cs (LookForAnyGenericType): Avoid nullref on 'declspaces'. Avoid allocating arrays willy-nilly. Fix #79553 * cfold.cs (BinaryFold): Move boolean Equality and Inequality cases out of the switch. 2006-09-28 Marek Safar * namespace.cs (Namespace.Error_NamespaceDoesNotExist): Better error message when non-generic type is used with the type arguments. * expression.cs: Updated. 2006-09-28 Raja R Harinath Fix #79013 * convert.cs (Convert.ImplicitStandardConversionExists): Avoid infloop. * expression.cs (EmptyExpression.Grab, EmptyExpression.Release): Change semantics slightly. Don't insist on having only one temporary EmptyExpression -- just throttle the creation of new ones. Fix #79451 * ecore.cs (Expression.MemberLookup): Enable CS0229 errors for non-interfaces too. If no methods are found, don't try to create a MethodGroupExpr. 2006-09-28 Marek Safar * ecore.cs (ResolveAsTypeStep): Print better error when type can be generic type. * namespace.cs (Namespace.LookForAnyGenericType): New method to help us produce better error message. 2006-09-27 Marek Safar * expression.cs (Binary.ResolveOperator): Warn about a side effect of the `|' operator. * report.cs: A new warning added. 2006-09-27 Martin Baulig * generic.cs (GenericMethod): Don't make this abstract. 2006-09-27 Martin Baulig * report.cs (InternalErrorException): Added overloaded ctor taking a params array. 2006-09-26 Marek Safar * class.cs, codegen.cs, const.cs, cs-tokenizer.cs, driver.cs, ecore.cs: Fixed the cases when same error was reported twice. * report.cs (SymbolRelatedToPreviousError): Simplified as all our messages now report symbol information. 2006-09-25 Martin Baulig * class.cs: Completely unified with the gmcs version. 2006-09-25 Martin Baulig * typemanager.cs (TypeManager.IsNullableType): New public function. (TypeManager.IsNullableTypeOf): Likewise. (TypeManager.IsNullableValueType): Likewise. * class.cs (MethodCore): Added the `GenericMethod' argument from gmcs and also unified all classes derived from `MethodCore' with gmcs. 2006-09-24 Raja R Harinath * convert.cs: Unify with gmcs version. 2006-09-24 Marek Safar * decl.cs (DeclSpace.VerifyClsCompliance): When type has type parameters verify them as well. * report.cs: New warning. 2006-09-24 Marek Safar * anonymous.cs (AnonymousMethod.Compatible): Cannot generate arguments for anonymous block with out argument. 2006-09-24 Marek Safar * class.cs (ClassOrStruct.VerifyMembers): Fixed to report correctly not used private events only. 2006-09-23 Marek Safar * cfold.cs (BinaryFold): On the guest to unify empty constant cast. * const.cs (Const.Define): Check for constant type. (Const.IsConstantTypeValid): Looks for valid constant types. * convert.cs (ImplicitReferenceConversion): NullCast to EmptyConstantCast. * ecore.cs (EmptyConstantCast): New common class for all constant based EmptyCast(s). * expression.cs (Is.DoResolve): Handle null constant especially. (New.DoResolve): Check for new void(). (MemberAccess.DoResolve): Cope with all kind of nulls. * literal.cs (NullConstant): Uses EmptyConstantCast. (NullDefault): Based on EmptyConstantCast. (NullLiteral): Uses EmptyConstantCast. * statement.cs (Block.ResolveMeta): Check for constant type. 2006-09-22 Martin Baulig * delegate.cs, attribute.cs: Merged with the gmcs versions. 2006-09-22 Raja R Harinath * literal.cs (NullDefault): The type of default(IFoo) is 'IFoo', not the null type. Fix part of #79451 * typemanager.cs (Closure.Filter): Consider PrivateScope attributes. * decl.cs (DeclSpace.FindMemberToOverride): Likewise. Reorganize code slightly. 2006-09-22 Martin Baulig * ecore.cs: Merged with the gmcs version. * generic.cs (ConstructedType): New dummy class. (TypeArguments): Don't make this abstract. * typemanager.cs (TypeManager.IsGenericTypeDefinition): New method. (TypeManager.GetGenericFieldDefinition): Moved here from gmcs. 2006-09-22 Raja R Harinath * expression.cs (ComposedCast): Check for arrays of TypedReference before creating the type, not after. 2006-09-21 Marek Safar * cfold.cs, const.cs, enum.cs, statement.cs: Updated after ToType change. * constant.cs (Constant.ImplicitConversionRequired): Designed to used when constant must be implicitly convertible. * convert.cs (ImplicitReferenceConversion): Reuse ToType. * ecore.cs (NullCast): Derives from NullConstant. * expression.cs (Is.DoResolve): Removed useless variables. (Conditional.DoResolve): Quick hack for `Foo () ? null : null'. (New.Constantify): Add enum support. (MemberAccess.DoResolve): Add warning when accessing null constant or variable. * generic.cs (GenericConstraints.IsReferenceType): Another dummy property. * literal.cs (NullConstant): New abstract class with common functionality for all null specializations. (NullDefault): Represents default(X) when result can be reduced to null. (NullLiteral): Updated. * report.cs: Add new warning. 2006-09-21 Martin Baulig * generic.cs (GenericTypeParameterBuilder): Removed this ugly hack. 2006-09-21 Martin Baulig * generic.cs (GenericConstraints): New dummy class. (Constraints): Likewise. (TypeParameter): Likewise. (TypeParameterName): Likewise. (GenericMethod): Likewise. * typemanager.cs (TypeManager.GetGenericArguments): New method. * decl.cs: Merged with the gmcs version. 2006-09-21 Raja R Harinath * generic.cs (TypeParameter): Implement IMemberContainer. (GenericTypeParameterBuilder): New. An abominable repugnant hack. * rootcontext.cs: Unify with gmcs version. * report.cs: Unify with gmcs version. * typemanager.cs (AddTypeParameter, LookupTypeParameter): Move from gmcs/generics.cs. * generics.cs (TypeParameter): New dummy class. * support.cs: Unify with gmcs version. 2006-09-20 Raja R Harinath * ecore.cs (MethodGroupExpr.ResolveGeneric): New dummy method. * expression.cs (MemberAccess, BaseAccess): Remove GMCS_SOURCE #ifdef. * decl.cs (MemberName): Unify with gmcs, except for GetTypeExpression. * generic.cs (TypeArguments): New dummy class to help avoid #ifdefs. * mcs.exe.sources: Add generic.cs. * codegen.cs: Unify with gmcs version. * codegen.cs (IResolveContent.GenericDeclContainer): Copy from gmcs. (EmitContext): Add GenericDeclContainer implementation. * decl.cs (MemberCore, DeclSpace): Likewise. * namespace.cs: Remove #ifdef GMCS_SOURCE. * namespace.cs (GetTypeInAssembly): Remove #ifdef GMCS_SOURCE. MCS TypeManager has a corresponding dummy method. 2006-09-19 Martin Baulig * expression.cs: Completely merged with the gmcs version. 2006-09-19 Martin Baulig * expression.cs (Invocation): Merged with the gmcs version. (ArrayAccess.GetStoreOpcode): Likewise. 2006-09-19 Martin Baulig * typemanager.cs (TypeManager.IsGenericMethod): Moved here from ../gmcs/generic.cs. (TypeManager.IsGenericMethodDefinition): Likewise. 2006-09-19 Martin Baulig * typemanager.cs (TypeManager.IsEqual): Moved the gmcs implementation here. (TypeManager.DropGenericTypeArguments): Likewise. (TypeManager.DropGenericMethodArguments): Likewise. (TypeManager.GetTypeArguments): Moved here from gmcs. (TypeManager.HasGenericArguments): Likewise. 2006-09-19 Martin Baulig * expression.cs (Binary): Merged with the gmcs version. 2006-09-19 Martin Baulig * expression.cs (Probe, As, Is): Merged with the gmcs version. 2006-09-19 Martin Baulig * typemanager.cs: Merged with the gmcs version. 2006-09-16 Raja R Harinath * AssemblyInfo.cs [GMCS_SOURCE]: Unify with gmcs source. * driver.cs: Likewise. 2006-09-16 Marek Safar A fix for #79401 * class.cs (MethodCore.VerifyClsCompliance): Do check for abstract members only if parent type is class. * decl.cs (MemberCore.GetClsCompliantAttributeValue): Fixed missing cache update. 2006-09-15 Marek Safar * cs-parser.jay, * expression.cs(MemberAccess.DoResolve): Don't crash when not allowed keywords are used. * typemanager.cs(CSharpName): Converts NullType to null. 2006-09-15 Martin Baulig * typemanager.cs (TypeManager.GetMethodName): Added mcs implementation. (TypeManager.IsEqual): Likewise. * ecore.cs (SimpleName.RemoveGenericArity): Added dummy implementation. * pending.cs: Merged with the gmcs version. 2006-09-15 Martin Baulig * statement.cs: Merge with the gmcs version. 2006-09-15 Martin Baulig * statement.cs (Switch): Merge with the gmcs implementation (without nullables), which is newer. 2006-09-15 Martin Baulig * statement.cs (Block.Variables): Make this public. (ToplevelBlock.Parameters): Make this a property. (Throw.Resolve): Use `TypeManager.IsSubclassOf ()'. 2006-09-15 Martin Baulig * namespace.cs: Merge with the gmcs version. 2006-09-15 Martin Baulig * decl.cs (MemberName): Minor code cleanups. 2006-09-15 Martin Baulig * parameter.cs: Merge with the gmcs version. 2006-09-15 Martin Baulig * enum.cs: Merge with the gmcs version: 3005 is a warning in gmcs and an error in mcs. 2006-09-15 Martin Baulig * flowanalysis.cs: Merged from GMCS; added the generics code into a `GMCS_SOURCE' conditional so we can share this file. 2006-09-08 Martin Baulig * typemanager.cs (TypeManager.interlocked_type): New public field. (TypeManager.int_interlocked_compare-exchange): New public field. (TypeManager.InitEnumUnderlyingTypes): Also initialize the enumerator types here and call InitGenericCoreTypes(). (TypeManager.InitCoreTypes): Call InitEnumeratorTypes() right after calling InitEnumUnderlyingTypes(). * rootcontext.cs (RootContext.ResolveCore): Added `System.Threading.Interlocked' to `classes_second_stage'. 2006-09-14 Marek Safar * assign.cs, ecore.cs, expression.cs: Share error message text. * class.cs (FieldMember.Define): Check for varible of static type. * driver.cs (LoadAssembly): Uses error output for errors. * statement.cs: Updated. 2006-09-08 Marek Safar * expression.cs (Error_OperatorCannotBeApplied): Report type instead of type instance. 2006-09-07 Martin Baulig * driver.cs (MainDriver): Revert r62663 from Marek; see #70506 for details. 2006-08-29 Miguel de Icaza * cs-parser.jay: Turn 1522 into a warning, instead of an error #79210 2006-08-17 Miguel de Icaza * cs-tokenizer.cs: Apply patch from Atsushi Enomoto that fixes #52019 and #79064, the use of the \uXXXX sequence in source code to represent unicode characters. 2006-08-15 Marek Safar * expression.cs (SizeOf.DoResolve): Check for void type. Fixed enum types support. * class.cs, ecore.cs, statement.cs: Merged to one error message. 2006-08-13 Miguel de Icaza * assign.cs: Catch attempts to assign to a method groups in += and report as 1656 2006-08-13 Marek Safar A fix for #79056 * cs-parser.jay: Don't destroy current array type by typeof of array's. 2006-08-12 Marek Safar * class.cs (Method.Define): Issue a warning when generic method looks like an entry point. * decl.cs (MemberCore.GetSignatureForError): Print member type arguments as well. 2006-08-09 Marek Safar * anonymous.cs(AnonymousDelegate.Emit): Uses Constructor filter when looking for ctor. * decl.cs (MemberCache.FindMembers): When container is interface we need to search all base interfaces as a member can be ambiguous. * delegate.cs (Delegate.FindMembers): Fixed to return valid data for Constructor member type filter. (Delegate.ResolveConstructorMethod) Uses Constructor filter. * ecore.cs: (Expression.MemberLookup): Implemented ambiguity error/warning reporting for returned memberinfos. * report.cs: Updated. * typemanager.cs (TypeManager.LookupBaseInterfacesCache): Uses TypeManager version to work on all runtimes. (TypeManager.RealMemberLookup): Removed members filtering. 2006-08-08 Raja R Harinath * ecore.cs (FieldExpr.EmitAssign): Release temporary. (PropertyExpr.EmitAssign): Likewise. * expression.cs (Indirection.EmitAssign): Likewise. (LocalVariableReference.EmitAssign): Likewise. (ParameterReference.EmitAssign): Likewise. (Invocation.EmitArguments): Likewise. (ArrayAccess.EmitAssign): Likewise. (IndexerAccess.EmitAssign): Likewise. (This.EmitAssign): Likewise. (ConditionalLogicalOperator.Emit): Likewise. Fix #79026 * codegen.cs (EmitContext.GetTemporaryLocal): Simplify. Use Stack instead of ArrayList. If the hashtable has a LocalBuilder, don't leave it in after returning it. (EmitContext.FreeTemporaryLocal): Simplify. Update to changes. 2006-08-06 Marek Safar * expresssion.cs (IndexerAccess.DoResolve): Fixed to report correct error message. 2006-08-03 Raja R Harinath Fix cs0146-3.cs and cs0146-4.cs. * class.cs (TypeManager.CheckRecursiveDefinition): Check that enclosing types don't depend on the current type. 2006-08-02 Raja R Harinath Fix #77963 * class.cs (TypeContainer.DoDefineMembers): Use FindBaseMemberWithSameName on Parent, since we're interested in whether we hide inherited members or not. (FindBaseMemberWithSameName): Make slightly more robust. Fix the non-generic testcase from #77396 * decl.cs (DeclSpace.DeclContainer): Remove override. * namespace.cs (NamespaceEntry.Doppelganger): Create slave declspaces for doppelgangers too. (UsingEntry): Implement IResolveContext. (UsingEntry.Resolve): Don't set ToplevelTypes.Namespace. Use 'this' as the resolve context. (LocalAliasEntry): Likewise. Implement parts of #77403 * roottypes.cs (RootDeclSpace): New. Used to represent the toplevel declaration space. Each namespace declaration introduces a "partial" root declaretion space. * namespace.cs (NamespaceEntry.SlaveDeclSpace): New. (NamespaceEntry.ctor): Create a SlaveDeclSpace if necessary. * cs-parser.jay (CSharpParser.ctor): Initialize 'current_class' from 'current_namespace.SlaveDeclSpace'. (namespace_declaration): Likewise. * class.cs (TypeContainer.ctor): Remove parent==ToplevelTypes check. It can't happen now. * decl.cs (DeclSpace.LookupType): Likewise. * driver.cs (MainDriver): Sanity check. 2006-08-01 Raja R Harinath * decl.cs (DeclSpace.FindNestedType): Remove. (DeclSpace.LookupNestedTypeINHierarchy): Use PartialContainer and LookupTypeContainer to get the container of the nested type. * class.cs (TypeContainer.FindNestedType): Make non-override. 2006-07-31 Raja R Harinath * decl.cs (DeclSpace.PartialContainer): Move field from ... * class.cs (TypeContainer.PartialContainer): ... here. (TypeContainer.AddBasesForPart): New helper. (MemberBase.ParentContainer): Remove. Use Parent.PartialContainer instead. * cs-parser.jay (current_class): Convert to DeclSpace. (struct_declaration, interface_declaration, class_declaration): Use AddBasesForPart instead of .Bases directly. * const.cs, iterators.cs: Update to changes. 2006-07-28 Raja R Harinath * class.cs (TypeContainer.AddMemberType): Rename from AddToTypeContainer. (TypeContainer.AddMember): Rename from AddToMemberContainer. (AddTypeContainer): New. Combine AddClassOrStruct and AddInterface. (AddPartial): Update. Add 'is_partial' argument. * roottypes.cs: Update to changes. * cs-parser.jay (push_current_class): New helper for handling current_container and current_class. (struct_declaration, interface_declaration, class_declaration): Use it. 2006-07-26 Raja R Harinath * roottypes.cs: Rename from tree.cs. Rename RootContext.Tree.Types to RootContext.ToplevelTypes. * tree.cs (Tree, ITreeDump): Remove types. * rootcontext.cs (tree, Tree): Remove fields. (root, ToplevelTypes): New. * *.cs: Update to rename. * tree.cs (Tree.RecordDecl): Remove. (RootTypes.AddToTypeContainer): Record the toplevel type in its namespace here. * class.cs, cs-parser.jay: Remove mention of RecordDecl. 2006-07-23 Raja R Harinath * codegen.cs (EmitContext.Flags): Move InCatch, InFinally, DoFlowAnalysis and OmitStructFlowAnalysis here. (ec.With): Rename from WithUnsafe and generalize. (ec.WithCheckState): Remove. All users can be handled by 'With'. (ec.WithFlowAnalyis): New. * ecore.cs, expression.cs, statement.cs: Update. 2006-07-22 Raja R Harinath * statement.cs (Block.ResolveMeta): Simplify slightly. * codegen.cs (EmitContext.Flags): New enum. Used to represent the multiple boolean fields. Convert InUnsafe, constant_check_state, check_state to flags. (CheckState, ConstantCheckState): Update. (InUnsafe): New read-only property. (FlagsHandle): Rename from CheckStateHandle and convert to handle arbitrary flags. (WithUnsafe): New helper similar to WithCheckState. * statement.cs (Block.ResolveMeta): Use WithUnsafe. (Unsafe.Resolve, Unsafe.DoEmit): Likewise. 2006-07-21 Raja R Harinath Make comparisons use the same IL irrespective of whether they're in a 'checked' or 'unchecked' context: one of the issues in #78899 * codegen.cs (EmitContext.CheckState): Make read-only property. (EmitContext.ConstantCheckState): Likewise. (EmitContext.CheckStateHandle, EmitContext.WithCheckState): New helper that implement a save/restore stack for CheckState values. This is the only way to change check-state. * ecore.cs (Expression.ExpressionToArrayArgument): Use WithCheckState. * expression.cs (CheckedExpr.DoResolve, CheckedExpr.Emit): Likewise. (CheckedExpr.EmitBranchable): New forwarding method. (UnCheckedExpr): Likewise. * statement.cs (Block.ResolveMeta): Use WithCheckState. (Unchecked.Resolve, Unchecked.DoEmit): Likewise. (Checked.Resolve, checked.DoEmit): Likewise. 2006-07-20 Miguel de Icaza * anonymous.cs: Cache the resolved anonymous delegate, and return this so that the ResolveTopBlock is only triggered once, not twice. Currently we trigger ResolvetopBlock twice due to a first pass of argument check compatibility, and a second pass that does the actual resolution. 2006-07-15 Marek Safar * annonymous.cs (AnonymousMethod.CreateScopeType): Fixed nested type modifiers. * rootcontext.cs (Reset): Add helper_classes. 2006-07-15 Marek Safar A fix for #78860 * statement.cs (Switch.SimpleSwitchEmit): Handle case null at any position correctly. 2006-07-13 Miguel de Icaza * statement.cs (Lock): Handle expressions of type TypeManager.null_type specially. Fixes #78770 2006-07-08 Marek Safar * expression.cs (Binary.ResolveOperator): Don't crash when null is assigned to an event. 2006-07-08 Marek Safar * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Fixed to look for accessors as well. * ecore.cs (EventExpr): Add AccessorTable. 2006-07-01 Marek Safar A fix for #78738 * attribute.cs, class.cs, ecore.cs : Add missing location of related symbol for CS0122 where appropriate. * typemanager.cs (IsNestedChildOf): Type can be null in the case of top level attributes. (Filter): Assembly can be null in the case of top level attributes. 2006-06-25 Marek Safar A fix for #78690 * ecore.cs (Expression.MemberLookupFailed): Don't crash when failed lookup is done at global level. 2006-06-24 Marek Safar A fix for #77002, Implemented TypeForwarder support. * attribute.cs (Attribute.GetArgumentType): Reads type argument. * expression.cs (TypeOf.TypeArgument): Exposes typeof type. * typemanager.cs (): Add type_forwarder_attr_type. 2006-06-24 Marek Safar * report.cs: Add CS0469 warning. 2006-06-21 Martin Baulig * codegen.cs (CodeGen.Save): Moved the symbol file generation into the `try'-block, so we also report CS0016 etc. there. 2006-06-21 Martin Baulig * delegate.cs (Delegate.VerifyMethod): Allow `params' methods; fixes #78678. 2006-06-21 Martin Baulig * expression.cs (Unary.ResolveOperator): In `Operator.AddressOf', also report CS1686 for parameters. 2006-06-21 Martin Baulig * statement.cs (GotoCase.Resolve): Report a warning (CS0469) instead of an error if the value is not implicitly convertible to the switch types; fixes #77964. 2006-06-21 Raja R Harinath Fix #78673 * class.cs (FieldBase.ResolveInitializer): Stop resolution if FieldBuilder is null. Fix #78662 * expression.cs (Binary.CheckShiftArguments): Don't overwrite original 'left' and 'right' before error-checking. 2006-06-16 Juraj Skripsky * ecore.cs (SimpleName.Error_ObjectRefRequired): Do not truncate the name. Fixed bug #78601. (MemberExpr.EmitInstance): Use GetSignatureForError () to get full name. (FieldExpr.DoResolve): likewise. (PropertyExpr.InstanceResolve): likewise. (EventExpr.InstanceResolve): likewise. 2006-06-04 Marek Safar * parameter.cs (Parameter.ApplyAttributeBuilder): More DefaultValue attribute applicable tests for attribute argument. 2006-06-02 Raja R Harinath Fix #78079 * expression.cs (Binary.DoNumericPromotions): Remove and rewrite. (Binary.OverloadResolve_PredefinedIntegral): New. (Binary.OverloadResolve_PredefinedFloating): New. (Binary.OverloadResolve_PredefinedString): New. (Binary.ResolveOperator): Use those instead of DoNumericPromotions. Follow the standard more closely, and treat numeric promotions in terms of overload resolution. (Binary.CheckShiftArguments): Simplify. 2006-06-01 Raja R Harinath * flowanalysis.cs (MyBitVector): Simplify representation. (MyBitVector.Clone): Avoid allocating BitArray. (MyBitVector.operator&): Rename from MyBitVector.And and make symmetric. (MyBitVector.operator|): Likewise, with MyBitVector.Or. (*): Update. Change all references to MyBitVector.And and MyBitVector.Or to &= and |=. 2006-05-29 Raja R Harinath Fix cs0231-[34].cs. * cs-parser.jay (formal_parameter_list): Extend the pattern below to param arguments too. 2006-05-26 Miguel de Icaza * cs-parser.jay: Catch another parsing form for arglist being followed by other arguments. Fixes #78313. 2006-05-24 Raja R Harinath * flowanalysis.cs (FlowBranchingToplevel.AddReturnOrigin): Move checking of out parameters to ... (FlowBranchingToplevel.Merge): ... here. (FlowBranchingException.AddBreakOrigin): If 'finally_vector' is set, propagate the origin upward, and only complain if there was no other error. (FlowBranchingException.AddContinueOrigin): Likewise. (FlowBranchingException.AddReturnOrigin): Likewise. (FlowBranchingException.AddGotoOrigin): Likewise. 2006-05-23 Raja R Harinath * flowanalysis.cs (UsageVector.MergeOrigins): If an origin is unreachable, skip it. (FlowBranchingException.Merge): Always propagate jumps, even if the finally block renders subsequent code unreachable. 2006-05-18 Raja R Harinath Fix #77601 * statement.cs (Goto.Resolve): Move responsibility for resolving 'goto' to FlowBranching.AddGotoOrigin. (Goto.SetResolvedTarget): New. Callback to set the LabeledStatement that's the target of the goto. (Goto.DoEmit): Use Leave instead of Br when crossing an unwind-protect boundary. * flowanalysis.cs (FlowBranching.AddGotoOrigin): Rename from LookupLabel and adjust to new semantics. (FlowBranchingToplevel.AddGotoOrigin): Likewise. (FlowBranchingBlock.AddGotoOrigin): Likewise. Use Goto.SetResolvedTarget to update target. (FlowBranchingLabeled.AddGotoOrigin): Likewise. (FlowBranchingException.AddGotoOrigin): Rewrite to be similar to AddBreakOrigin & co. Delay propagation until ... (FlowBranchingException.Merge): ... this. * statement.cs (Block.Resolve): Always depend on flow-branching to determine unreachability. Kill workaround that originally emitted only one statement after an "unreachable" label (see infloop in test-515.cs). Fix #77869, #76148, #77755, #75255 and a host of other bugs. This is still "wrong", but anything better would probably need a multi-pass algorithm. * flowanalysis.cs (FlowBranchingLabeled): Salt away a copy of the usage vector. Force current usage vector to be reachable, to optimistically signify backward jumps. (FlowBranchingLabeled.LookupLabel): Note if a backward jump is detected. (FlowBranchingLabeled.Merge): New. If no backward jump was detected, return the original salted-away usage vector instead, updated with appropriate changes. Print unreachable warning if necessary. * statement.cs (Block.Resolve): Don't print unreachable warning on a labeled statement. 2006-05-17 Gert Driesen * driver.cs: Pass filename without path to AssemblyBuilder's AddResourceFile. Fixes bug #78407. 2006-05-17 Raja R Harinath * statement.cs (LabeledStatement.Resolve): Move merging of origins ... * flowanalysis.cs (FlowBranchingLabeled): ... here. (FlowBranching.MergeChild): Overwrite reachability information from Labeled branchings too. 2006-05-16 Raja R Harinath * statement.cs (Goto.Resolve): Merge jump origins here ... * flowanalysis.cs (FlowBranching.Label): ... rather than here. * flowanalysis.cs (FlowBranching.LookupLabel): Move CS0159 check ... (FlowBranchingToplevel.LookupLabel): ... here. Add CS1632 check. (FlowBranchingGoto.LookupLabel): New. Handle back jumps. (FlowBranchingBlock.LookupLabel): Call LabeledStatement.AddReference here, ... * statement.cs (Goto.Resolve): ... not here. (Goto.Emit): Remove CS1632 check. 2006-05-14 Marek Safar * ecore.cs (Expression.ResolveAsTypeTerminal): Fixed type in the obsolete error message. 2006-05-11 Raja R Harinath * flowanalysis.cs (UsageVector.MergeJumpOrigins): Kill. (FlowBranchingBlock.Label): Use UsageVector.MergeOrigins. (FlowBranchingException.Label): Likewise. * flowanalysis.cs (MyBitVector.SetAll): New. Sets all bits to the given value. (MyBitVector.Or): Use it to avoid losing information (Count). (FlowBranching.MergeOrigins): Likewise. * flowanalysis.cs (UsageVector.IsDirty): Remove. (UsageVector.Parameters, UsageVector.ParameterVector): Likewise. (UsageVector.Locals, UsageVector.LocalVector): Likewise. (UsageVector.ToString): Simplify. (UsageVector.MergeSiblings): Move here from ... (FlowBranching.Merge): ... here. (FlowBranchingToplevel.CheckOutParameters): Take an UsageVector, not a MyBitVector. 2006-05-10 Raja R Harinath * flowanalysis.cs (UsageVector.MergeOrigins): Simplify, now that a null bitvector is treated as all-true. * flowanalysis.cs (MyBitVector.And, MyBitVector.Or): Make lazier. (MyBitVector): Rationalize invariants. 'vector != null' implies that we have our own copy of the bitvector. Otherwise, 'InheritsFrom == null' implies all inherited bits are true. 2006-05-09 Marek Safar * statement.cs (LocalInfo): Add IsConstant. (LocalInfo.DeclareLocal): Moved from EmitMeta and changed to don't emit local variable for constants. 2006-05-09 Raja R Harinath * flowanalysis.cs (MyBitVector.Empty): New. (MyBitVector): Don't allow InheritedFrom to be null. (MyBitVector.And, MyBitVector.Or): Treat 'null' as all-ones. (UsageVector, FlowBranching): Update to changes. * flowanalysis.cs (FlowBranching.InTryWithCatch): Don't terminate recursion. The 'Parent == null' condition isn't sufficient for anonymous methods. (FlowBranching.AddBreakOrigin): Likewise. (FlowBranching.AddContinueOrigin): Likewise. (FlowBranching.AddReturnOrigin): Likewise. (FlowBranching.StealFinallyClauses): Likewise. (FlowBranching.MergeTopBlock): Move to FlowBranchingToplevel. (FlowBranching.CheckOutParameters): Likewise. (FlowBranchingToplevel): Terminate all the above recursions here. (FlowBranchingToplevel.End): Rename from MergeTopBlock. * codegen.cs (EmitContext.ResolveTopBlock): Update to changes. * flowanalysis.cs (BranchingType.Toplevel): New. Represents a toplevel block. (FlowBranchingToplevel): New. Empty for now. (FlowBranching.MergeTopBlock): Update. * codegen.cs (EmitContext.ResolveTopBlock): Create a Toplevel branching for the anonymous delegate. (EmitContext.StartFlowBranching): Add ToplevelBlock variant. * flowanalysis.cs (UsageVector.MergeOrigins): Reorganize. (UsageVector.MergeJumpOrigins): Don't ignore current reachability information at the start of the merge. Reorganize. 2006-05-07 Marek Safar * class.cs (MethodData.Define): Method cannot implement interface accessor. 2006-05-07 Marek Safar * expression.cs (QualifiedAliasMember.ResolveAsTypeStep): Pass location to newly introduced ctor. * namespace.cs (Namespace.Error_NamespaceDoesNotExist): Moved an error message to one place. (GlobalRootNamespace.Error_NamespaceDoesNotExist): Custom message for global namespace. 2006-05-07 Marek Safar * const.cs (Const.Error_ExpressionMustBeConstant): Better error message. * ecore.cs (Expression.ResolveAsConstant): Updated. * statement.cs (ResolveMeta): Updated. 2006-05-06 Marek Safar * cs-parser.jay: __arglist cannot be used in initializer. 2006-05-06 Marek Safar A fix for #77879 * namespace.cs (LocalAliasEntry.DoResolve): Don't allow to access nested private types. 2006-05-05 Raja R Harinath * statement.cs (EmptyStatement.ResolveUnreachable): Override. (LabeledStatement): Add 'name' parameter. (LabeledStatement.Name, LabeledStatement.JumpOrigins): New. (Block.AddLabel): Update to changes. * cs-parser.jay (labeled_statement): Likewise. * flowanalysis.cs (BranchingType.Labeled): New. (UsageVector.MergeOrigins): Remove unused 'branching' argument. (FlowBranchingLabeled): New. Does nothing for now, but will eventually handle 'goto' flows. * codegen.cs (StartFlowBranching): Add new LabeledStatement variant. * statement.cs (LabeledStatement.Resolve): Create a FlowBranching that's terminated ... (Block.Resolve): ... here. * flowanalysis.cs (UsageVector.MergeFinally): Remove. (UsageVector.MergeFinallyOrigins): Likewise. (FlowBranching.InTryOrCatch): Likewise. (FlowBranching.AddFinallyVector): Likewise. (FlowBranchingException): Update to changes. Fix #78290 * statement.cs (Return.Resolve): Move error checking to ... * flowbranching.cs (FlowBranching.AddReturnOrigin): ... this. (FlowBranchingException): Handle return origins like break and continue origins. (FlowBranching.UsageVector.CheckOutParameters): Remove. 2006-05-04 Marek Safar A fix for #76122 * class.cs (TypeContainer.FindMembers): Includes event method in the methods filter. 2006-05-04 Marek Safar A fix for #77543 * class.cs (MethodData.Define): Do public accessor check only when method implements an interface. 2006-05-04 Raja R Harinath Remove special handling of 'break' * flowanalysis.cs (Reachability): Remove all mention of 'breaks'. (Reachability.Meet): Simplify. Remove 'do_breaks' argument. (UsageVector.Break): Remove. (FlowBranching.Merge): Use 'Reachable.IsUnreachable' to determine reachability. (FlowBranchingBreakable.Merge): Don't ResetBreaks. * statement.cs (Break.Resolve): Call UsageVector.Goto (), not UsageVector.Breaks (). Don't set NeedsReturnLabel. 2006-05-03 Marek Safar A fix for #75726 * pending.cs (PendingImplementation.BaseImplements): A found member cannot be the interface member. 2006-05-03 Marek Safar A fix for #60069 * constant.cs (LongConstant.EmitLong): Fixed to catch also negative values for emitting small (int) values. 2006-05-03 Raja R Harinath Fix #59427 * flowanalysis.cs (FlowBranchingException.Merge): Ensure control-flow passes through the 'finally' after merging-in all the control-flows from 'try' and the 'catch' clauses. * flowanalysis.cs (FlowBranching.IsLoop): Remove. (FlowBranching.IsTryOrCatch): Remove 'is_return' parameter. It's always true at the only non-recursive entry point. (FlowBranching.CreateBranching) [BranchingType.Loop]: Return a FlowBranchingBreakable. (FlowBranchingLoop): Remove. * statement.cs (Return.DoResolve): Update to changes. Fix #76471, #76665 * flowanalysis.cs (FlowBranching.BranchingType.Embedded): New. (FlowBranching.CreateBranching): Handle it: create a FlowBranchingContinuable. (FlowBranching.BreakCrossesExceptionBoundary): Remove. (FlowBranching.AddContinueOrigin): Similar to AddBreakOrigin, except that it handles the 'continue' command. (FlowBranching.UsageVector.MergeOrigins): Rename from MergeBreakOrigins. (FlowBranchingContinuable): Similar to FlowBranchingBreakable, except that it overrides AddContinueOrigin. (FlowBranchingException): Override AddContinueOrigin, similar to AddBreakOrigin. * statement.cs (While.Resolve, Foreach.ArrayForeach.Resolve): Create a new branching around the embedded statement. (Do.Resolve, For.Resolve): Likewise. Do reachability analysis for control flow after the embedded statement. (Continue.Resolve): Move all error checking to AddContinueOrigin. * flowanalysis.cs (FlowBranching.IsSwitch): Remove. (FlowBranching.CreateBranching) [BranchingType.Switch]: Create a FlowBranchingBreakable. (FlowBranchingSwitch): Remove. Fix test-503.cs * statement.cs (Break.Resolve): Simplify. Move responsibility for error reporting to ... * flowanalysis.cs (FlowBranching.AddBreakOrigin) ... this. Rename from 'AddBreakVector'. Add new location argument. Return a bool indicating whether the 'break' crosses an unwind-protect. (FlowBranchingException.AddBreakOrigin): Add. (FlowBranchingException.Merge): Propagate 'break's to surrounding flowbranching after updating with the effects of the 'finally' clause. (FlowBranchingBreakable): New common base class for FlowBranchingLoop and FlowBranchingSwitch. * statement.cs (Foreach.ArrayForeach.Resolve): Set barrier after embedded statement. (Foreach.CollectionForeach.Resolve): Remove extraneous flowbranching. 2006-05-02 Raja R Harinath * statement.cs (Do.Resolve): If the loop is infinite, set the barrier. (While.Resolve, For.Resolve): Set a barrier after the embedded statement. There's no direct control flow that goes from the end of the embedded statement to the end of the loop. * flowanalysis.cs (FlowBranching.Infinite): Remove. (FlowBranchingLoop.Merge): Don't look at 'Infinite'. The changes above ensure that the reachability is correctly computed. * flowanalysis.cs (Reachability.ResetBarrier): Remove. (UsageVector.MergeBreakOrigins): If the current path is unreachable, treat it as if all parameters/locals are initialized. (FlowBranchingLoop.Merge): Don't clear any barriers. Handle infinite loops before merging-in break origins. * flowanalysis.cs (Reachability.Meet): Simplify code handling 'returns'. (Reachability.Reachable): Split part into ... (Reachability.Unreachable): ... this. Simplify. (Reachability.IsUnreachable): Use 'Unreachable' instead. * flowanalysis.cs (Reachability.SetReturnsSometimes): Remove. (Reachability.SetThrowsSometimes): Likewise. (FlowBranchingBlock.MergeTopBlock): Don't compare against TriState.Always, use corresponding property. * statement.cs (Lock.Resolve, Try.Resolve, Using.Resolve): Likewise. (Block.Resolve): Likewise. Remove some redundant checks. 2006-05-02 Raja R Harinath * flowanalysis.cs (UsageVector.Throw): Set barrier too. (Reachability.Meet): Don't bother checking AlwaysThrows -- barrier is always set. (FlowBranchingBlock.Merge): Likewise. 2006-05-01 Raja R Harinath * codegen.cs (EmitContext.ResolveTopBlock): Remove redundant checks for unreachable. 2006-05-01 Marek Safar A fix for #77980 * flowanalysis.cs (UsageVector.IsAssigned): Add flag to ignore short path. * statement.cs (Block.UsageWarning): Uses newly introduced flag to detect whether field is really assigned. 2006-04-30 Raja R Harinath * flowanalysis.cs (Reachability): Make 4-argument constructor private. (Reachability.Meet): Rename from 'And'. Remove static variant. (Reachability.Always): Rename from the highly misleading 'Reachability.Never'. (FlowBranching.Merge): Update to changes. Mark an impossible situation with a 'throw'. (*): Update to changes. 2006-04-29 Raja R Harinath * flowanalysis.cs (TriState): Rename from FlowBranching.FlowReturns. Remove 'Undefined'. (FlowBranching.TriState_Meet): Rename from AndFlowReturns. Simplify. (FlowBranching.TriState_Max): Rename from OrFlowReturns. Simplify. (*): Update to changes. * statement.cs: Update to changes. 2006-04-28 Marek Safar A fix for #78049 *class.cs (Method.FindOutBaseMethod): Base method cannot be property method. 2006-04-28 Raja R Harinath * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't create a dummy UsageVector. * flowanalysis.cs (UsageVector.MergeChild): Change FlowBranching argument to two arguments: an usage-vector and a bool. Move call to FlowBranching.Merge () ... (FlowBranching.MergeChild, FlowBranching.MergeTopBlock): ... here. * flowanalysis.cs (UsageVector.MergeChild): Move special-case handling of loop and switch reachability to ... (FlowBranchingLoop.Merge, FlowBranchingSwitch.Merge): ... these. 2006-04-27 Raja R Harinath * flowanalysis.cs (FlowBranching.InLoop): Move special-case handling to FlowBranchingLoop.InLoop. (FlowBranching.InSwitch): Likewise, to FlowBranchingSwitch. 2006-04-26 Marek Safar A fix for #78115 * anonymous.cs (AnonymousMethod.DoResolve): Moved the check whether anonymous method is allowed from AnonymousContainer here. * attribute.cs, codegen.cs (EmitContext): Add IsAnonymousMethodAllowed. 2006-04-24 Raja R Harinath Fix #78156 * flowanalysis.cs (MyBitVector.Or): Add null check on argument. 2006-04-23 Marek Safar A fix for #49011. * constant.cs (FloatConstant.Reduce): Add range checking for checked context. (DoubleConstant.Reduce): Ditto. 2006-04-23 Raja R Harinath * expression.cs (LocalVariableReference.DoResolveBase): Simplify. Remove 'lvalue_right_side' argument. Move parts to ... (LocalVariableReference.ResolveLocalInfo, LocalVariable.DoResolve) (LocalVariable.DoResolveLValue): ... these. 2006-04-21 Raja R Harinath Fix cs1655.cs * codegen.cs (EmitContext.InRefOutArgumentResolving): Remove. * expression.cs (EmptyExpression.LValueMemberOutAccess): New. (LocalVariableReference.DoResolveBase): Use it to implement new CS1655 check. (IndexerAccess.DoResolveLValue): Handle LValueMemberOutAccess. (Argument.Resolve): Simplify. Move CS1510 check ... * ecore.cs (Expression.ResolveLValue): ... here. (UnboxCast.DoResolveLValue): Handle LValueMemberOutAccess. (PropertyExpr.DoResolveLValue): Likewise. (FieldExpr.Report_AssignToReadonly): Likewise. (FieldExpr.DoResolve): Add 'out_access' argument. Use LValueMemberAccess or LValueMemberOutAccess on instance depending on it. (FieldExpr.DoResolveLValue): Pass 'out_access' argument to DoResolve as appropriate. 2006-04-20 Raja R Harinath Fix #75800 * expression.cs (Invocation.VerifyArgumentsCompat): Don't try implicit conversions on 'out' and 'ref' arguments. * expression.cs (Invocation.VerifyArgumentsCompat): Reorganize to improve clarity. Remove dead code. Fix #66031 * statement.cs (Block.UsageWarning): Allow VariableInfo to be null. (Catch.Resolve): Resolve VarBlock if it exists. 2006-04-19 Miguel de Icaza * statement.cs (Foreach.EmitFinally): Do not emit the enumerator twice, this was some residual code, the enumerator was emitted properly in the two branche of if later. 2006-04-19 Raja R Harinath * expression.cs (Cast.ResolveLValue): Remove. The result of a cast is never an lvalue. (Cast.DoResolve, Cast.ResolveRest): Combine. (Argument.Emit): Simplify slightly. Move 'Expr is IMemoryLocation' check ... (Argument.Resolve): ... here. (Argument.Error_LValueRequired): Remove. Inline into only user. Simplifications. Fix cs0191-2.cs * ecore.cs (FieldExpr.DoResolve): Move handling of CS0192, CS0198, CS1649 and CS1651 to ... (FieldExpr.Report_AssignToReadonly): ... this. Simplify by moving the actual selection of the error code and message to a lookup table. Add a dummy return value to simplify callsites. (FieldExpr.ResolveLValue): Don't allow a constructor to write to readonly fields of other instances of the same type. Move CS0197 warning from ... * expression.cs (Argument.Resolve): ... here. Simplify code. Ensure that ec.InRefOutArgumentResolving is only set during LValue resolution of an out or ref argument. The code simplification above uses this invariant. 2006-04-18 Raja R Harinath Possibly fix #77752. Fix cs1690-[4-7].cs. * ecore.cs (Expression.CheckMarshalByRefAccess): Renamed from CheckMarshallByRefAccess. Drop parameter. (FieldExpr.CheckMarshalByRefAccess): Update. Change CS1690 to a warning. (FieldExpr.DoResolve): Call CheckMarshalByRefAccess on InstanceExpression. * report.cs (AllWarnings): Add CS1690. * expression.cs (Argument.Resolve): Use EmptyExpression.OutAccess for ref access too. (LocalVariableReference.DoResolveBase): Update. 2006-04-09 Marek Safar * class.cs (MethodOrOperator): Moved common parts from method class. detect obsolete attributes. (Method.Define): Simplified as it reuses code from base. (Constructor.ValidAttributeTargets): Fixed issue found during refactoring. (Destructor.ValidAttributeTargets): Fixed issue found during refactoring. (Operator): Finished refactoring set off by #78020. Operator class is now ordinary method class. * anonymous.cs: Updated. * decl.cs (DeclSpace): Add IsGeneric 2006-04-09 Marek Safar * class.cs (Constructor.Emit): Don't emit the attributes twice. 2006-04-09 Marek Safar * class.cs (Operator.Emit): Extracted code from MethodData to correctly detect obsolete attributes. (Method.CreateEmitContext): Moved to MethodOrOperator. 2006-04-09 Marek Safar A fix for #78048. * class.cs (TypeContainer.MemberCoreArrayList.DefineContainerMembers): Throw customized exception to make crash detection easier. (MethodOrOperator): Started to work on new base class for methods and operators. (Method): Derives from MethodOrOperator. (Constructor.Emit): Emits its own attributes. (AbstractPropertyEventMethod.Emit): Ditto. (Operator): Derives from MethodOrOperator, will refactor fully in extra patch. (Operator.Emit): It's temporary more tricky than should be. * doc.cs (GetMethodDocCommentName): Updated after operator changes. * report.cs (InternalErrorException): Add ctor with inner exception. 2006-04-08 Marek Safar A fix for #76744. * ecore.cs (SimpleName.ResolveAsTypeStep): Report better error when type is only not visible. 2006-04-07 Marek Safar A fix for #77916. * expression.cs (ArrayCreation.GetAttributableValue): Creates correctly typed array. 2006-04-06 Marek Safar * class.cs (Class.ApplyAttributeBuilder): Report an error when ComImport attribute is present and Guid not. (Interface.ApplyAttributeBuilder): Ditto. * attribute.cs: Add error message. 2006-04-06 Marek Safar A fix for #78020. * attribute.cs (Attribute.AttachTo): The attribute can have multiple sources (it's composite) so hold them in extra array as they are used in Emit phase only. It worked in the previous versions by mistake. (Attribute.Emit): Emit attribute for more owners when exist. * codegen.cs, class.cs: Updated to don't re-attach attribute twice as now it has now different behaviour. 2006-04-04 Marek Safar * constant.cs (Constant.IsDefaultInitializer): New method. * class.cs: Updated. * expression.cs (ArrayCreation.CheckIndices): Add an optimization to don't re-initialize default values. It saves KBs almost for every assembly. Thanks Zoltan for the idea. (ArrayCreation.ResolveInitializers): Renamed from ValidateInitializers. (ArrayCreation.DoResolve): Resolve only once. (ArrayCreation.Emit): Emit static initializer only when it is faster. (ArrayCreation.GetAttributableValue): Cope with optimized values. 2006-04-03 Zoltan Varga * report.cs (Warning, Error): Add 0-, 1-, and 2- argument specializations. From #77961. 2006-04-01 Marek Safar * assign.cs (Assign.DoResolve): Assignment to same variable can occur in an embedded statement too. 2006-04-01 Raja R Harinath Fix #77958 * statement.cs (Switch.EmitObjectInteger) [ulong]: Remove bad cast. 2006-04-01 Marek Safar A fix for #77966. * class.cs (TypeContainer.AddPartial): Don't report an error when modifier was not specified. * modifiers.cs: Add DEFAULT_ACCESS_MODIFER. 2006-03-31 Marek Safar * assign.cs (LocalTemporary): Don't require ILGenerator in the resolve phase. * anonymous.cs, assign.cs, ecore.cs, expression.cs: Updated after LocalTemporary change. * class.cs (ClassOrStruct.DefineDefaultConstructor): Moved from TypeContainer. (ClassOrStruct.DefineFieldInitializers): Implemented static field initializers optimization. (ClassOrStruct.TypeAttr): Moved from modifiers. (Constructor.CheckBase): Don't crash when static ctor has parameters. (FieldBase.ResolveInitializer): Resolves initializer. (FieldBase.HasDefaultInitializer): New property. * cs-parser.jay: Removed message. * expression.cs (CompilerGeneratedThis): New specialization. * modifiers.cs (TypeAttr): Moved to ClassOrStruct.TypeAttr 2006-03-28 Marek Safar * cs-parser.jay, cs-tokenizer.cs: On demand Stack allocation. 2006-03-27 Marek Safar * ecore.cs (Expression.ResolveAsConstant): Clean up, enum constants should be now EnumConstants only. 2006-03-27 Marek Safar * attribute.cs, driver.cs: Reset more caches. 2006-03-26 Marek Safar * cs-tokenizer.cs (adjust_real): Uses float.Parse for float literals. 2006-03-26 Marek Safar * constant.cs (Constant.Reduce): Replaced EmitContext with single bool for easier reuse. Updated all overrides. (IntegralConstant): New base class for all integral constants. (IntegralConstant.Error_ValueCannotBeConverted): When assigned value if out of the constant range, report custom error. (UIntConstant.Reduce): Fixed uint conversion. * ecore.cs, literal.cs: Reduce updates. 2006-03-26 Marek Safar A fix for #75813. * class.cs (Constructor.Define): Removed extra if for default ctors. A patch from Atsushi Enomoto. 2006-03-26 Marek Safar * attribute.cs (Attribute.ResolveConstructor): Conversion was moved to GetAttributableValue. * constant.cs (Constant.GetAttributableValue): Does implicit conversion when required. * convert.cs (ImplicitConversionRequired): Error message moved to DoubleLiteral. * ecore.cs (Expression.GetAttributableValue): Add type parameter for automatic implicit conversion of an output value. (EnumConstant.GetAttributableValue): Don't reduce the enum constants. * expression.cs (ArrayCreation.GetAttributableValue): Add element type conversion. (TypeOf.GetAttributableValue): Add extra handling for object type. * literal.cs (DoubleLiteral.Error_ValueCannotBeConverted): Doubles can have special error message. 2006-03-25 Marek Safar * class.cs (Constructor.Emit): Don't crash when struct ctor is InternalCall. (Constructor.ApplyAttributeBuilder): Transform MethodImplAttribute to be compatible with MS runtime. 2006-03-23 Marek Safar * attribute.cs (Attribute.ResolveConstructor): Check for an invalid attribute arguments here. * class.cs (Indexer.Define): The check was moved to attribute class. 2006-03-22 Marek Safar * assign.cs, class.cs, codegen.cs, convert.cs, decl.cs, ecore.cs, expression.cs, typemanager.cs: Minor changes from gmcs to make merging easier. 2006-03-22 Raja R Harinath Support ParameterDefaultValueAttribute in gmcs. Also applied to mcs to keep code differences small. * attribute.cs (Attribute.GetParameterDefaultValue): New. * typemanager.cs (parameter_default_value_attribute_type): New. * parameter.cs (Parameter.ApplyAttributeBuilder): Use them. Add CS1908 check. 2006-03-21 Marek Safar * expression.cs (StringConcat.Append): Reverted back to no warning state. 2006-03-21 Marek Safar * const.cs (Error_ConstantCanBeInitializedWithNullOnly): Share a message. * statement.cs (Block.ResolveMeta): Look for wrong object constants in the blocks too. 2006-03-21 Atsushi Enomoto * doc-bootstrap.cs : fix build. 2006-03-20 Marek Safar * expression.cs (StringConcat.Append): Issue a warning when empty string is going to append. 2006-03-20 Marek Safar * assign.cs (CompoundAssign.ResolveSource): Removed. * attribute.cs (ResolvePossibleAttributeType): Updated after MemberAccess clean up. * class.cs (TypeContainer.FindMethods): Removed. (TypeContainer.CheckMemberUsage): Made static. * codegen.cs (GetAssemblyName): Uses Length for empty string test. * constant.cs (CheckRange): Removed unused type argument. (CheckUnsigned): Removed unused type argument. * cs-parser.jay: Updated after MemberAccess clean up. Uses Length for empty string test. * cs-tokenizer.cs: Uses Length for empty string test. (IsCastToken): Made static. (is_hex): Made static. (real_type_suffix): Made static. * decl.cs (SetupCache): Made static. (OnGenerateDocComment): Removed unused ds argument. * delegate.cs (VerifyDelegate): Removed unused argument. * doc.cs: Uses Length for empty string test. * driver.cs: Uses Length for empty string test. * enum.cs (IsValidEnumType): Made static * expression.cs (EnumLiftUp): Removed unused argument. (ResolveMethodGroup): Ditto. (BetterConversion): Ditto. (GetVarargsTypes): Ditto. (UpdateIndices): Ditto. (ValidateInitializers): Ditto. (MemberAccess.ctor): Ditto. (GetIndexersForType): Ditto. * flowanalysis.cs: (MergeFinally): Removed unused argument. * iterators.cs: Updated after MemberAccess clean up. * location.cs: Uses Length for empty string test. * namespace.cs: Uses Length for empty string test. * report.cs (CheckWarningCode): Made static. * statement.cs (LabeledStatement): Removed unused argument. * typemanager.cs (FilterNone): Removed. 2006-03-18 Marek Safar * codegen.cs (EmitContext.TestObsoleteMethodUsage): Removed as it become obsolete. * class.cs: Updated. 2006-03-18 Marek Safar * cs-parser.jay.cs: __arglist is not allowed for delegates. 2006-03-18 Marek Safar A fix for #77822. * expression.cs (VerifyArgumentsCompat): Reverted to double error reporting, it's more tricky than I thought. 2006-03-18 Marek Safar A fix for #77816. * anonymous.cs.cs (AnonymousMethod): Add host to allow access to host container. (AnonymousMethod.ImplicitStandardConversionExists): New method. (AnonymousMethod.Compatible): Moved parameter resolving to DoResolve. Add more error reporting; Fixed issue with params. * convert.cs (ImplicitStandardConversionExists): Returned conversion check. * cs-parser.jay: AnonymousMethod requires host container. * delegate.cs (NewDelegate.DoResolve): Updated after Compatible changes. 2006-03-18 Raja R Harinath * class.cs: Change 'TypeContainer ds' constructor argument to 'DeclSpace parent'. Some classes were missed below due to different naming convention. * class.cs (MemberCore.Parent): Delete. This makes the ParentContainer changes below enforceable by the compiler. Treat pointers to enclosing declaration space as 'DeclSpace', not 'TypeContainer'. * class.cs, const.cs, delegate.cs, enum.cs, iterator.cs: Change 'TypeContainer parent' constructor argument to 'DeclSpace parent'. * statement.cs (LocalInfo..ctor): Use DeclSpace argument instead of TypeContainer. (Block.AddThisVariable): Likewise. * class.cs (MethodData.Define, MethodData.Emit): Likewise. (AbstractPropertyEventMethod.Emit): Likewise. (AbstractPropertyEventMethod.EmitMethod): Likewise. (GetMethod.Define, SetMethod.Define): Likewise. (PropertyMethod.Define, DelegateMethod.Define): Likewise. (DelegateMethod.EmitMethod): Likewise. Fix regression test-partial-13.cs. Rationalize use of PartialContainer. Ensure that the partial class semantics can be tied to type-correctness, i.e., any violation will cause a compile error. * class.cs, const.cs: Access all fields that belong to class TypeContainer via ParentContainer. Arguments of EmitContexts and Resolve()-like functions still use 'Parent'. * class.cs (SourceMethod): Use DeclSpace, not TypeContainer. (*.CreateEmitContext): Change TypeContainer argument to DeclSpace. (PropertyMethod.CheckModifiers): Remove unused argument. * codegen.cs (EmitContext..ctor): Change TypeContainer argument to DeclSpace. 2006-03-17 Raja R Harinath Make semantics of PartialContainer simpler. * decl.cs (DeclSpace.IsPartial): Remove. * class.cs (TypeContainer.IsPartial): Likewise. (TypeContainer..ctor): Set PartialContainer to point to self. (TypeContainer.GetClsCompliantAttributeValue): Don't use IsPartial. (TypeContainer.FindNestedType): Likewise. (MemberCore.ParentContainer): Simplify. Remove deprecation. 2006-03-17 Marek Safar * typemanager.cs.cs (GetInterfaces): Don't recreate 0-sized arrays. 2006-03-15 Marek Safar * class.cs (FieldMember.Emit): ParentContainer is real parent for partial classes. 2006-03-15 Marek Safar * class.cs (Operator.Define): An error for base conversion was not reported correctly. 2006-03-14 Atsushi Enomoto * iterator.cs : yield break is allowed in try statement which has catch clauses. Fixed bug #77767. 2006-03-13 Marek Safar A fix for #77593, #77574. * class.cs (MethodCore.CheckBase): Another if for operator. 2006-03-09 Marek Safar * anonymous.cs (AnonymousMethod.Compatible): Don't crash when parameters were not resolved * delegate.cs (Delegate.GetInvokeMethod): Use emitcontext free MemberLookup. (DelegateCreation.ImplicitStandardConversionExists): New method for just conversion test. *ecore.cs (Expression.MemberLookup): Don't ask for emitcontext when it's not needed. * assign.cs, constant.cs, convert.cs, delegate.cs, expression.cs: Updated after another emitcontext usage was clean up. It should help us to synchronize with gmcs easier. 2006-03-04 Marek Safar A fix for #77353. * class.cs (SetMethod.DefineParameters): Uses new parameters type ctor. (Event.Define): ditto (SetIndexerMethod.DefineParameters): Uses Parameters.MergeGenerated. * delegate.cs (Delegate.Define): Uses Parameters.MergeGenerated. Removed redundant code and set NewSlot for Invoke method too. * parameter.cs (Parameters.ctor): Add custom, type ctor. (Parameters.MergeGenerated): New method. Use this method when you merge compiler generated argument with user arguments. 2006-03-03 Marek Safar * attribute.cs (ResolveAsTypeTerminal): Removed. * ecore.cs (Expression.ResolveAsTypeTerminal): Make virtual to allow specialization for predefined types; 30% speed up. Finally placed obsolete check to right place. (Expression.ResolveType): Removed. * enum.cs, expression.cs, parameter.cs, statement.cs, typemanager.cs: Updated after ResolveType was removed. * expression.cs (Cast.ctor): Check void cast. (Binary.ResolveAsTypeTerminal): Is never type. (Conditional.ResolveAsTypeTerminal): Is never type. * rootcontext.cs (ResolveCore): Set base type to simplify some code later. 2006-03-01 Raja R Harinath Fix #77679. * expression.cs (ParameterReference.DoResolveBase): Change return type to bool. (ParameterReference.DoResolve, ParameterReference.DoResolveLValue): Update. Fix #77628. * ecore.cs (PropertyExpr.InstanceResolve): Fix CS1540 check. Fix #77642. * typemanager.cs (GetFullNameSignature): Don't nullref on protected accessors. 2006-02-27 Marek Safar * attribute.cs (Attribute.PosArguments, Attribute.NamedArguments): Use these two separated members to simplify the code. (Attribute.Resolve): Refactored to use new fields and methods. (Attribute.ResolveConstructor): Extracted from ResolveArguments and implemented obsolete attribute checking. (Attribute.ResolveNamedArguments): Extracted from ResolveArguments and implemented obsolete checking again. It look line never ending quest ;-) (GlobalAttribute.ResolveConstructor): Need to override as the rest. * cfold.cs (BinaryFold): TryReduce throws an exception to indicate error. * constanct.cs (TryReduce): Throws OverflowException to indicate error. *class.cs (Property.Define): Add RegisterProperty call. * cs-parser.jay: Replaced ArrayList with fixed array for attribute argument groups (only 2). * ecore.cs (Expression.GetAttributableValue): New virtual method used for encoding expression to arguments. (Expression.ExprClassToResolveFlags): Just turned to property. * expression.cs (ArrayCreation.ValidateInitializers): Slightly optimized. (ArrayCreation.GetAttributableValue): Renamed from EncodeAsAttribute and optimized as well as implemented support for zero-length attributes. * typemanager.cs (TypeManager.RegisterProperty, TypeManager.GetProperty): Add caching of PropertyInfo's. 2006-02-25 Marek Safar * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Don't report error multiple times. 2006-02-25 Marek Safar New partial class implementation. A fix for #77027, #77029, #77403 * attribute.cs (Attributable): Made attributes protected. * class.cs (TypeContainer): Add PartialContainer and partial_parts as the replacements of ClassPart and PartialContainer. (TypeContainer.AddClassOrStruct): Call RecordDecl here. (TypeContainer.AddInterface): Ditto. (TypeContainer.AddPartial): The main method for partial classes. It checks for errors and merges ModFlags and attributes. At the end class is added to partial_parts list. (TYpeContainer.DefineDefaultConstructor): Checks whether default ctor is required here. (TypeContainer.GetClsCompliantAttributeValue): Cope with partial class too. (TypeContainer.GetNormalPartialBases): Resolves base classes and interfaces from the rest of partial classes. (TypeContainer.GetClassBases): Simplified. (TypeContainer.DefineTypeBuilder): New method, mostly extracted from DefineType. (TypeContainer.DefineDefaultConstructor): Is used by derived classes. (TypeContainer.HasExplicitLayout): Uses Flags now. (PartialContainer): Removed. (ClassOrStruct.AddToContainer): Moved enclosing member name check here. (StaticClass): Was merged with Class. (Class.GetClassBases): class and static class bases are verified here. (Class.TypeAttr): Added static attributes when class is static. (Struct.RegisterFieldForInitialization): Moved from TypeContainer. (MemberBase): In some cases we need to call parent container for partial class. It should be eliminated but it's not easy now. * cs-parser.jay: Replaced all PartialContainer with AddPartial. * decls.cs (MemberCore.DocComment): Introduced new property as is used by partial classed to accumulate class comments. (MemberCore.GetClsCompliantAttributeValue): Moved from TypeContainer. * doc.cs (GenerateTypeDocComment): Partial classes clean up. * driver.cs (MainDriver): Tree.GetDecl was removed. * modifiers.cs (Modifiers): Add partial modifier. * tree.cs (Tree.decl): Removed. (RootTypes): Started to use this class more often for root types specializations. 2006-02-22 Marek Safar A fix for #77615 * attribute.cs (AttributeTester.GetCoClassAttribute): Don't crash when external interface does not have an attribute. 2006-02-22 Marek Safar Another prerequisites for new partial classs implementation. * attribute.cs (Attribute.Equal): Implemented. (Attribute.Emit): Changed as attributes can be applied more than twice. (Attributes.Emit): Check for duplicate attributes here. * class.cs, decl.cs, delegate.cs, doc.cs, enum.cs: Don't pass DeclSpace as a parameter, clean-up. 2006-02-11 Marek Safar A fix for #77485 * class.cs (TypeContainer.DefineType): Cannot use ResolveType because it contains obsolete attribute check which can in some cases look for base type of current class which is not initialized yet. (TypeContainer.BaseType): Replacement of ptype. * decl.cs (MemberCore.CheckObsoleteType): Reuse existing code. 2006-02-11 Marek Safar First of prerequisites for new partial classs implemention. * attribute.cs (Attributable): Extended by ResolveContext; Attributes finally have correct context for resolving in all cases. (AttachTo): Attribute owner is assigned here. * codegen.cs (IResolveContext): Introduce new interface to hold all information needed in resolving phase. (EmitContext): Implements IResolveContext; more clean-up needed here. * decl.cs (MemberCore): Implemented IResolveContext. * anonymous.cs, attribute.cs, class.cs, codegen.cs, const.cs, decl.cs, ecore.cs, enum.cs, expression.cs, iterators.cs, namespace.cs, parameter.cs, statement.cs, tree.cs, typemanager.cs: Refactored to use new IResolveContext instead of EmitContext; cleanup 2006-02-06 Miguel de Icaza * codegen.cs (EmitScopeInitFromBlock): check here the capture_context, there is no need to make two calls to the EmitContext. * anonymous.cs: Add some debugging messages that might help me track other instances of this problem in the future (the regression of test 467). * cs-parser.jay: track the variable block, as we need to initalize any captured variables declared in this block for the "catch" portion of the "Try" statement. * statement.cs (Try.Emit): If the "Catch" has a VarBlock, emit any scope initialization for captured variables. Also, move the emit for the variables after the block location has been marked. 2006-02-06 Marek Safar * ecore.cs (PropertyExpr.FindAccessors): Just made flags const. 2006-02-02 Miguel de Icaza * anonymous.cs (CaptureContext.EmitInitScope): I was wrong in the commit yesterday, the initialization for the roots is necessary. What is not necessary is the scope activation. 2006-02-02 Raja R Harinath * ecore.cs (PropertyExpr.DoResolveLValue): Add CS0206 check. * expression.cs (IndexerAccess.DoResolveLValue): Add CS1612 and CS0206 checks. (Argument.Resolve): Remove CS0206 checks. 2006-02-01 Miguel de Icaza * anonymous.cs (CaptureContext.EmitInitScope): Do not emit the scopes for all the roots, the scopes will now be emitted when the Blocks are entered. [This change was wrong, fixed on 2006-02-02] (CaptureContext.EmitScopeInitFromBlock): Simply emit the ScopeInfo code. This reduces a lot of existing cruft. * statement.cs (Block.Emit): Call EmitScopeInitFromBlock here, so that the ScopeInfo is generated as we enter the scope, not at the time of use, which is what we used to do before. * codegen.cs (EmitScopeInitFromBlock): New routine, this is called every time a Block is about to be emitted if we have a CaptureContext. 2006-02-01 Raja R Harinath * typemanager.cs (NoTypes, NoTypeExprs): Remove. (Reset): Update. * *.cs: Use Type.EmptyTypes instead of TypeManager.NoTypes. * typemanager.cs (cons_param_array_attribute): Make private. (Reset): Set it to null. (InitCoreHelpers): Don't initialize it. (ConsParamArrayAttribute): New. Initialize it as needed. * parameter.cs (ParamsParameter.ApplyAttribute): Update to change. 2006-01-31 Miguel de Icaza * expression.cs: There might be errors reported during the selection of applicable methods. If there are errors, do not continue execution as it will lead the compiler to crash. 2006-01-30 Miguel de Icaza * expression.cs: Member access is not allowed on anonymous methods. Fixes #77402. 2006-01-30 Raja R Harinath Fix #77401 * cs-parser.jay (VariableDeclaration): Don't set current_array_type to null. (field_declaration, event_declaration, declaration_statement): Set it to null here. 2006-01-28 Raja R Harinath * typemanager.cs (GenericParameterPosition): New. * doc.cs: Use it. 2006-01-28 Atsushi Enomoto * doc.cs : To process "include" elements, first we should create another list than XmlNodeList, because it could result in node removal, which could result in that the XmlNodeList gives up yielding next node. (Also made code identical to gmcs again.) 2006-01-25 Miguel de Icaza * ecore.cs: Introduce an error report that we were not catching before, if not silent, we must report the error. Gonzalo ran into it. 2006-01-23 Miguel de Icaza A fix for bug: #76957 * iterators.cs (MoveNextMethod.CreateMethodHost): call ComputeMethodHost before creating the method, this is a new requirement. * anonymous.cs (AnonymousContainer): Now we track all the scopes that this method references (RegisterScope). The actual scope where the method is hosted is computed with the ComputeMethodHost before we create the method. Moved the Deepest routine here. (AnonymousContainer.ComputeMethodHost): New routine used to compute the proper ScopeInfo that will host the anonymous method. (ScopeInfo): Deal with multiple roots. The problem was that we did not have a unique root where all ScopeInfos could be hanged from. Remove `topmost' ScopeInfo, and instead keep an arraylist of roots. Remove AdjustMethodScope which is now computed at the end. Remove LinkScope which did a partial link, instead link all ScopeInfos before code generation from the new "LinkScopes" routine. Simplify all the Add* routines as they no longer need to maintain the tree, they just need to record that they are using variables from a ScopeInfo. (IsAncestor, GetAncestorScopes, GetParentScope, LinkScope): New routines to produce the forest of ScopeInfo trees. * class.cs (TypeContainer.AppendMethod): This is just like AddMethod, but ensures that an interface implementation method (IEnumerable.XXX) is not inserted at the beginning of the queue of methods, but at the end. We use this functionality to ensure that the generated MoveNext method in the iterator class is resolved/emitted before the enumerator methods created. This is required because the MoveNext method computes the right ScopeInfo for the method. And the other methods will eventually need to resolve and fetch information computed from the anonymous method. 2006-01-21 Raja R Harinath Carlos Alberto Cortez Fix rest of #76995. * namespace.cs (NamespaceEntry.UsingExternalAliases): Don't add to the 'aliases' hash. (NamespaceEntry.LookupAlias): Lookup 'extern_aliases' hash too. (NamespaceEntry.VerifyUsing): Resolve external aliases too. 2006-01-18 Raja R Harinath Fix #76656, cs0231-2.cs. * cs-parser.jay (formal_parameter_list): Make error case catch more issues. (parenthesized_expression_0): Add CS1026 check. (invocation_expression): Remove unused { $$ = lexer.Location }. 2006-01-17 Raja R Harinath Fix #76824. * cs-parser.jay (statement_expression): Don't list out the individual statement-expressions. Convert syntax error into CS0201 check. 2006-01-16 Raja R Harinath Fix #76874. * ecore.cs (MemberAccess.CheckIntermediateModification): Remove. (UnboxCast.DoResolveLValue): New. Move CS0445 check from CheckIntermediateModification. (FieldExpr.DoResolve): Add new two-argument version that allows us to resolve the InstanceExpression as an lvalue. The one-argument variant is now just a wrapper. (FieldExpr.DoResolveLValue): Use two-argument DoResolve. Resolve the lhs as an lvalue if the it has a value type. (FieldExpr.AssignToReadonly): Move CS1648 and CS1650 checks from Assign.DoResolve. (PropertyExpr.InstanceResolve): Allow InstanceExpression to be resolved as an lvalue. (PropertyExpr.DoResolve): Update. (PropertyExpr.DoResolveLValue): Resolve the lhs as an lvalue if it has a value type. Move CS1612 check here from CheckIntermediateModification. * assign.cs (Assign.DoResolve): Remove CS1648 and CS1650 checks. * expression.cs (EmptyExpression.OutAccess): New. Used as the 'right_side' of a ResolveLValue on an 'out' argument. (EmptyExpression.LValueMemberAccess): New. Used as the 'right_side' of a propagated ResolveLValue on a value type. (LocalVariableReference.DoResolveBase): Recognize EmptyExpression.OutAccess and EmptyExpression.LValueMemberAccess. Add CS1654 check. (Argument.Resolve): Use EmptyExpression.OutAccess rather than EmptyExpression.Null. 2006-01-16 Atsushi Enomoto * typemanager.cs : added IsGenericParameter(). In mcs it always return false. * doc.cs : for generic parameters, use GenericParameterPosition, not FullName. 2006-01-12 Ben Maurer * expression.cs: Fix Console.WriteLine ((this = x).foo); 2006-01-12 Miguel de Icaza This fixes the problem where we used ldfld instead of ldflda to load the "THIS" pointer on captured parameters, when THIS is a value type. See bug #77205. * iterators.cs (CapturedThisReference.Emit): Pass false to EmitThis (we do not need the address). * codegen.cs (EmitThis): it needs to know whether we need the address of `this' or not. This is used by value types. * expression.cs (This.AddressOf): Pass true to the EmitThis call, every other call passes false. 2006-01-12 Raja R Harinath Fix #77221. * typemanager.cs (TryGetBaseDefinition): Rename from the mis-named GetOverride. * expression.cs (Invocation.OverloadResolve): Update. (Invocation.DoResolve): Avoid double resolution of invocation. 2006-01-11 Raja R Harinath Fix #77180. * expression.cs (Unary.Emit): When in /checked+ mode, don't emit unary negation of floating point types as 0-expr; negation cannot overflow in floating point types. Fix #77204. * expression.cs (MemberAccess.DoResolve): Disallow the use of '.' on operands of 'void' type. Fix #77200. * cfold.cs (BinaryFold): Implement folding of BinaryOr, BinaryAnd and ExclusiveOr for boolean constants too. 2006-01-09 Raja R Harinath Fix #75636. * expression.cs (Invocation.OverloadResolve): Replace reflected override methods with their base virtual methods, rather than skipping over them. * typemanager.cs (TypeManager.GetOverride): New. 2006-01-05 Jb Evain * class.cs (Property.Define, Indexer.Define): do not tag the properties as SpecialName | RTSpecialName. 2006-01-04 Miguel de Icaza * class.cs (MethodCore.IsDuplicateImplementation): This method was doing a low-level comparission of parameter types. It was lacking a check for __argslist. 2005-12-30 Miguel de Icaza * expression.cs (ParameterReference.DoResolveBase): Allow reference parameters if they are local to this block. This allows the ref and out parameters of a delegate to be used in an anonymous method, for example: delegate void set (out int x); set s = delegate (out int x){ x = 0; }; This is used by functionality introduced late in the C# language. * anonymous.cs (AnonymousMethod.Compatible): Allow anonymous method that take ref and out parameters. Fixes #77119 which was a late change in the spec. 2005-12-23 Miguel de Icaza * anonymous.cs (ScopeInfo.LinkScope): Do not link the scope to its parent if its the same scope. Fixes #77060. 2005-12-21 Miguel de Icaza * driver.cs: Report the case of no source files and no -out: argument provided. 2005-12-20 Raja R Harinath Fix #77035. * expression.cs (ComposedCast.GetSignatureForError): Define. 2005-12-18 Carlos Alberto Cortez Fix #76995 * namespace.cs (NamespaceEntry): Add extern_aliases as a ListDictionary, to contain the ExternAliasEntry entries (in addition to the NamespaceEntry.aliases hashtable). This field is shared between the original entry and its doppelganger (bodyless copy of it). (NamespaceEntry.UsingExternalAlias): Add the extern alias entry to extern_aliases field. (NamespaceEntry.Lookup): Move the IsImplicit check after the lookup in extern_aliases. 2005-12-16 Raja R Harinath Fix #77006. * class.cs (TypeContainer.Mark_HasEquals): New. (TypeContainer.Mark_HasGetHashCode): New. (ClassPart): Override them. (MethodCore.CheckBase): Use them instead of referring to Parent.Methods. Fix #77008. * enum.cs (EnumMember.EnumMember): Pass the parent_enum as the 'parent' argument to the base constructor. Remove all mention of TypeContainer from decl.cs. * decl.cs (MemberCore.Parent): Change into a DeclSpace. (MemberCore.MemberCore): Change type of 'parent' argument to DeclSpace. (DeclSpace.DeclSpace): Likewise. (DeclSpace.DefineMembers): Remove unused argument. * cs-parser.jay (pop_current_class): Update to changes. Simplify debugging check -- we don't care if the debug code throws an InvalidCastException instead of an InternalErrorException. * class.cs (TypeContainer.DefineMembers): Update to changes. (TypeContainer.DoDefineMembers): Likewise. (TypeContainer.GetMethods): Likewise. (PropertyMember.Define): Likewise. (MemberBase.Parent): New property that forwards to MemberCore.Parent, but ensures that we get a TypeContainer. * rootcontext.cs (RootContext.PopulateCoreType): Update to changes. (RootContext.PopulateTypes): Likewise. Remove special case code for !RootContext.StdLib: DefineMembers is idempotent. 2005-12-14 Miguel de Icaza * convert.cs (ExplicitConversionCore): Check the return value from ExplicitConversionCore which can return null on failure. Fixes #76914 2005-12-13 Marek Safar * class.cs (Method.ApplyAttributeBuilder): Test out modifier properly. 2005-12-11 Atsushi Enomoto * doc.cs : The search for referenced namespace was insufficient to get global one as it used to do. Fixed bug #76965. 2005-12-10 Atsushi Enomoto * doc.cs : check name in cref in the last phase that whether it is namespace or not. 2005-12-09 Atsushi Enomoto * cs-tokenizer.cs : reverted the latest change: it somehow broke Mono.C5. 2005-12-09 Atsushi Enomoto * doc.cs : so it turned out that we cannot skip override check for interface members. Fixed bug #76954. 2005-12-09 Atsushi Enomoto * cs-tokenizer.cs : fixed bug #75984: - #warning and #error should not be handled when the source line is disabled. - #line is not checked strictly when the source line is disabled. - #define and #undef is on the other hand checked strictly at any state. 2005-12-08 Atsushi Enomoto * cs-tokenizer.cs : missing Location (actually, filename) in one of CS1027 report. 2005-12-05 Marek Safar * attribute.cs (GlobalAttribute.ctor): Pass NamespaceEntry only. * class.cs (EmitFieldInitializers): Simplified and fixed to work with event initializers. (FieldBase.EmitInitializer): Moved from TypeContainer and simplified. (FieldBase.Initializer): Initializer is now optional. (EventField.Define): Only event field can have initializer. * codegen.cs (EmitContext): DeclSpace is not readonly (small hack). * const.cs (Const): Reuse initializer. * cs-parser.jay: Updated after FieldBase changes. Added current_array_type to simplify array initializers. * ecore.cs (NullCast.IsDefaultValue): Implemented. * expression.cs, iterators.cs: Updated. * namespace.cs (NamespaceEntry): Made UsingFound private. 2005-12-05 Marek Safar * parameterCollection.cs: Obsolete, removed. * parser.cs: Obsolete, removed. 2005-12-05 Marek Safar Fix #76849. * class.cs (Constructor.Emit): Set obsolete checking for whole context. * enum.cs (Enum.Define): Set obsolete context here. 2005-12-05 Atsushi Enomoto * doc.cs : - FindDocumentedMember() now expects 1) paramList as null when "we don't have to check the number of parameters" and 2) Type.EmptyTypes when "there is no arguments". - Introduced FoundMember struct to hold the exact type which was used to find the documented member (the above change broke test-xml-044; it might be better just to use DeclaringType than what MS does, like this change does, but it depends on usage.) 2005-12-05 Atsushi Enomoto * doc.cs : documented member might be from DeclaringType for nested types. Fixed bug #76782. 2005-12-03 Ben Maurer * anonymous.cs: Have the param code handle leaving copies on the stack etc. Allows anonymous params to take part in the assignment code (++, +=, etc). Fixes bug #76550 * expression.cs: Handle the prepare_for_load/leave_copy by passing it down to the anon code. * iterators.cs: Use dummy var here * codegen.cs: Handle new vars 2005-12-01 Marek Safar Fix #76849. * class.cs (MethodData.Define): Set proper Obsolete context. * ecore.cs (FieldExpr.ResolveMemberAccess): Don't check [Obsolete] in obsolete context. (FieldExpr.DoResolve): Ditto. 2005-12-01 Marek Safar Fix #76849. * class.cs (MethodCore.DoDefineParameters): Test [Obsolete] only when parent is not obsolete. 2005-12-01 Atsushi Enomoto * doc.cs : (FindDocumentedMember) find parameterless members first and get CS0419 in the early stage. Fixed first case of bug #76727. 2005-11-30 Marek Safar Fix #76859. * ecore.cs (Expression.ResolveAsConstant): Report constant error only when no error was reported. *expression.cs (Binary.DoResolve): left can be null. 2005-11-22 Marek Safar Fix #76783. * class.cs (MethodData.Emit): Parameters should be labeled first. 2005-11-21 Marek Safar Fix #76761. * parameter.cs (Parameter.ApplyAttributeBuilder): Fixed `ref' detection. 2005-11-18 Marek Safar * attribute.cs (AreParametersCompliant): Moved to Parameter. * class.cs (MethodCore): Parameter clean up. (IMethodData): Added ParameterInfo. (MethodData): Parameter clean up. (Indexer.Define): Parameter clean up. * anonymous.cs, * codegen.cs, * cs-parser.jay, * decl.cs, * doc.cs, * ecore.cs, * flowanalysis.cs, * iterators.cs, * pending.cs, * statement.cs, * typemanager.cs: Parameter clean up. * delegate.cs (Define): Get rid of duplicated code. * expression.cs (ParameterReference): Removed useless parameters and simplified. (Invocation): Ditto. * parameter.cs (ParamsParameter): New class, params specialization. (ArglistParameter): Attemp to separate arglist. (Parameter): Refactored to be reusable and faster. (Parameter.Modifier): Made understandable. (Parameters): Changed to be used as a class for `this' assembly parameters. Refactored to use new specialized classes. * support.cs (ParameterData): Added Types property. (InternalParameters): Deleted. 2005-08-20 Martin Baulig Merging this patch from GMCS to fix #75867. * anonymous.cs (CaptureContext.CaptureThis): Create the topmost scope if we don't already have it. 2005-11-17 Martin Baulig * anonymous.cs (CaptureContext.EmitMethodHostInstance): Use `Ldarg_0' if we inherit the scope from our parent. Fixes #76653. 2005-11-16 Atsushi Enomoto * doc.cs : the previous patch does not actually fix the bug. PropertyInfo override check is now implemented and really fixed it. * expression.cs : Invocation.IsAncestralType() is used from doc.cs. 2005-11-16 Atsushi Enomoto * doc.cs : apply "override filter" also to properties. Fixed bug #76730. 2005-11-16 Atsushi Enomoto * doc.cs : renamed FindMembers() to FindMethodBase(). For interfaces, no need to check overrides. For classes, omit those results from interfaces since they must exist in the class. Fixed bug #76726. 2005-11-15 Atsushi Enomoto * typemanager.cs : (GetFullNameSignature) differentiate indexers with different parameters. Fixed the second problem in #76685. 2005-11-15 Atsushi Enomoto * doc.cs : (FindDocumentedMember) pass invocation_type as well (to get expected 'protected' access in CheckValidFamilyAccess()). Fixed bug #76692. 2005-11-15 Atsushi Enomoto * doc.cs : (GenerateTypeDocComment) Fields could be FixedField. Fixed bug #76705. CS1569 was incorrectly commented out. 2005-11-14 Atsushi Enomoto * doc.cs : use Invocation.IsOverride() to do real override check. * expression.cs : made Invocation.IsOverride() internal. 2005-11-14 Atsushi Enomoto * doc.cs : use TypeManager.FindMembers() instead of (possible) TypeBuilder.FindMembers() and filter overriden base members out. Fixed bug #76990. 2005-11-13 Atsushi Enomoto * doc.cs : ref/out parameters are represented as '@' (instead of '&' in type FullName). Fixed bug #76630 (additionally crefs). 2005-11-13 Atsushi Enomoto * doc.cs : when there was no '.' in cref to methods in doc comment, then parameters were missing in the output. Fixed bug #76691. 2005-11-13 Atsushi Enomoto * driver.cs : don't output docs when there is an error. Fixed bug #76693. 2005-11-13 Atsushi Enomoto * doc.cs : Now it should detect indexers. Fixed primary concern in bug #76685. Fixed CS0419 message to not show the identical member signature in the message. 2005-11-13 Atsushi Enomoto * doc.cs : (FindDocumentedMember) use TypeManager.MemberLookup() instead of Type.FindMembers() since it does not handle events. Fixed bug #71604. 2005-11-12 Gert Driesen * codegen.cs: Fixed typo (speficied -> specified). 2005-11-11 Marek Safar Fix #76369. * doc.cs (FindDocumentedTypeNonArray): Don't resolve again. 2005-11-11 Marek Safar * attribute.cs: Changed error message. * cs-tokenizer.cs: One more check. 2005-11-10 Marek Safar * statement.cs (Block.Resolve): Ignore empty statement. 2005-11-10 Marek Safar * report.cs: Made error/warning methods more strict to avoid their misuse. * anonymous.cs, attribute.cs, class.cs, codegen.cs, constant.cs, convert.cs, cs-parser.jay, cs-tokenizer.cs, decl.cs, delegate.cs, doc.cs, driver.cs, ecore.cs, expression.cs, location.cs, namespace.cs, parameter.cs, statement.cs, typemanager.cs: Updated. 2005-11-08 Marek Safar * attribute.cs (Attribute.GetCoClassAttributeValue): New method. (AttributeTester.GetCoClassAttribute): Get CoClassAttribute. * class.cs (TypeContainer.IsComImport): New property. (Constructor.Define): Create proper ctor for ComImport types. * expression.cs (New.CheckComImport): Fixed. 2005-11-07 Miguel de Icaza * anonymous.cs (CaptureContext.AddParameterToContext): The fact that a parameter has been captured does not mean that we do not have to do the rest of the processing. This fixes the second part of #76592. If there was another anonymous method capturing values in the past, the Scope would never be set for the second method that captured the same parameter. (CaptureContext.EmitAssignParameter): When `leave_copy' is passed, properly manipulate the stack. Second part of fix for #76592. * expression.cs (New): Add support for invoking "new" on interfaces that have been flagged with the ComImport attribute and the CoClass. Fixes #76637 * statement.cs (Try.DoEmit): When a variable is captured, do not try to emit the vi.LocalBuilder variable as it has been captured. Create a temporary variable and store the results on the FieldBuilder. Fixes #76642 2005-11-07 Marek Safar * class.cs (CheckPairedOperators): Made compilable with csc 2.0. * ecore.cs (InstanceResolve): Fixed CS1540 detection. * expression.cs (Binary.DoResolve): Added && optimalization. * typemanager.cs (AddUserType): Removed useless argument. 2005-11-04 Marek Safar * statement.cs (Block.variables): Uses ListDictionary. 2005-11-03 Marek Safar Fix #75969. * class.cs (PartialContainer.EmitType): Customized to emit security attributes. (ClassPart.ApplyAttributeBuilder): Transform security attribute for partial classes. 2005-11-03 Marek Safar Fix #76599. * expression.cs (ElementAccess.DoResolveLValue): Fixed buffer access has to be fixed. * typemanager.cs (IsUnmanagedType): Wrong common field type. 2005-11-01 Marek Safar Fix #76590. * ecore.cs (NullCast.Reduce): Implemented. * expression.cs (ArrayCreation.CheckIndices): Correcly check constant type. * statement.cs (SwitchLabel.ResolveAndReduce): Catch null properly. (Foreach.Resolve): Catch null properly. 2005-10-29 Marek Safar * cs-tokenizer.cs: Warning text fix. * driver.cs: AllWarningNumbers exposed on public interface. * report.cs (): Reviewed warning numbers. (IsValidWarning): Use binary search. 2005-10-29 Marek Safar * driver.cs: Implemeted resource visibility. (Resources): New class for code sharing between /res: and /linkres: 2005-10-28 Marek Safar Fix #76568. * cfold.cs (ConstantFold.BinaryFold): Implemented null cast folding. * convert (Convert.ImplicitReferenceConversion): NullCast holds contants only. * ecore.cs (NullCast): Child is contant only. * literal.cs (NullLiteral.Reduce): null can be converted to any reference type. 2005-10-28 Kornél Pál * driver.cs: Use Encoding.Default as default code page instead of ISO-28591. 2005-10-27 Raja R Harinath Fix #76085. * expression.cs (Invocation.Error_InvalidArguments): Handle __arglist parameters. (Invocation.VerifyArgumentsCompat): Likewise. * support.cs (ReflectionParameters.GetSignatureForError): Print __arglist parameters. (InternalParamters.GetSignatureForError): Likewise. * parameter.cs (Parameters.GetSignatureForError): Likewise. 2005-10-26 Marek Safar * attribute.cs (GetPropertyValue): Made public. * codegen.cs (AssemblyClass): ResolveClsCompliance renamed to Resolve. Add new property WrapNonExceptionThrows to handle 2.0 assembly attribute. (AssemblyClass.Emit): Emit RuntimeCompatibilityAttribute when it is not defined. * driver.cs: Reflect method name change. * statement.cs (Try.Resolve): Warn when try has both general exception handlers. * typemanager.cs: runtime_compatibility_attr_type new predefined type. 2005-10-26 Raja R Harinath Fix #76419. * pending.cs (InterfaceMethod): Allow tm.args [i] to be null -- treat it as an empty parameter list. 2005-10-26 Raja R Harinath Fix #76271. * ecore.cs (SimpleName.DoSimpleNameResolve): Make fall-back ResolveAsTypeStep silent. * statement.cs (Block.AddConstant): Mark block as used. (Block.ResolveMeta): Avoid piling on error messages if a constant initializer resolution fails. 2005-10-25 Raja R Harinath * namespace.cs (RootNamespace.VerifyUsingForAll, Namespace.VerifyUsing): Remove. (NamespaceEntry.VerifyAllUsing): New. (NamespaceEntry.AliasEntry.Resolve): New. Handles common error behaviour. Delegates actual resolution of alias to ... (NamespaceEntry.DoResolve): ... this. Renamed from Resolve. (NamespaceEntry.LocalAliasEntry, NamespaceEntry.ExternAliasEntry): Update. * driver.cs (Driver.MainDriver): Update. * namespace.cs (NamespaceEntry.DefineNamespace): Remove. (NamespaceEntry.SymbolFileID): Make into a on-demand computed property. (Namespace.DefineNamespaces, RootNamespace.DefineNamespacesForAll): Remove. * symbolwriter.cs (SymbolWriter.Initialize): Don't call RootNamespace.DefineNamespacesForAll. 2005-10-24 Raja R Harinath * typemanager.cs (assemblies, external_aliases, modules) (AddAssembly, AddExternAlias, AddModule GetAssemblies, Modules) (ComputeNamespaces, GetRootNamespace): Remove extra staging overhead. Move resposibility ... * namespace.cs (GlobalRootNamespace): ... here. Update to changes. * driver.cs, attribute.cs, codegen.cs: Update to changes. 2005-10-23 Raja R Harinath * namespace.cs (RootNamespace.all_namespaces): Renamed from cached_namespaces. Improve usage. (RootNamespace.Reset, RootNamespace.RegisterNamespace) (RootNamespace.VerifyUsingForAll, RootNamespace.DefineNamespacesForAll): Move from GlobalRootNamespace and simplify. (RootNamespace.Global): Make instance variable. (RootNamespace.RootNamespace): Add "alias name" parameter. (GlobalRootNamespace): Simplify drastically. (Namespace.Lookup): Don't use GetNamespace. * typemanager.cs (GetRootNamespace): Rename from ComputeNamespaceForAlias. (NamespaceClash): Use Global.IsNamespace instead of GetNamespace. 2005-10-23 Marek Safar * anonymous.cs (AnonymousContainer): Don't crash when container doesn't exist. 2005-10-23 Marek Safar * expression.cs (Binary.DoResolve): Warn when comparing same values. 2005-10-23 Marek Safar Fix #76486. * expression.cs (Binary.DoResolve): It looks like there are no convetsion rules in enum context. 2005-10-19 Carlos Alberto Cortez Add support for extern alias qualifiers. * typemanager.cs: Move some LookupTypeReflection code to namespace.cs, to have cleaner code. Added some methods to help us keep track of the extern aliased references. * driver.cs: Add suport for extern alias assemblies on command line and check for their warnings/errors. Also keep track of the extern aliased assemblies. * namespace.cs: Move the global functionality of Namespace to GlobalRootNamespace/RootNamespace. Now the global namespace is GlobalRootNamespace.Globa. Also the code moved from typemanager.cs lives in GlobalRootNames.cs/RootNamespace.cs. Finally added LocalAliasEntry (AliasEntry before) and ExternAliasEntry, to handle alias statements. * cs-parser.jay: Add support in the grammar for extern alias statement. * doc.cs, delegate.cs, expression.cs ecore.cs, symbolwriter.cs: Update callings to Namespace (now in GlobalRootNamespace). 2005-10-18 Raja R Harinath Fix #76371. * class.cs (TypeContainer.DefineType): Move updating of topological sort earlier in the code. * decl.cs (DeclSpace.ResolveBaseTypeExpr): Don't use TypeBuilder. 2005-10-18 Marek Safar Fix #76273. * cfold.cs (BinaryFold): Reduce constant in enum conversion. * constant.cs (Constant.TryReduce): Moved from Cast class. (Reduce): Made little bit more OO and fixed missing conversions. * ecore.cs (Reduce): Implemented. (Binary.EnumLiftUp): New method to upgrade values to enum values. * literal.cs (Reduce): Implemented. * class.cs: Reverted Miguel's wrong commit. 2005-10-14 Miguel de Icaza * ecore.cs (GetMemberType): Report the correct mapping for the MemberCore 2005-10-14 Atsushi Enomoto * cs-parser.jay, expression.cs : CS0214 was missing error location for constants. Fixed bug #76404. 2005-10-11 Marek Safar Fix #76370. * convert.cs (ExplicitConversionCore): Fixed object->enum conversion. 2005-10-10 Raja R Harinath * ecore.cs (PropertyExpr.Emit): Use Invocation.EmitCall to emit InstanceExpression. (PropertyExpr.EmitCall): Likewise. * expression.cs (Invocation.EmitArguments): Handle case where arguments == null. (Invocation.EmitCall): Avoid allocating temporary variable if there are no arguments. 2005-10-07 Raja R Harinath Fix #76323. * convert.cs (ImplicitConversionStandard): Move conversion of void* to arbitrary pointer types ... (ExplicitConversionStandard): .. here. * ecore.cs (Expression.Error_ValueCannotBeConverted): Fix CS0266 error to always print typenames. 2005-10-07 Raja R Harinath * convert.cs (GetConversionOperator): Rename from GetConversionOperators. Move operator selection code from ... (UserDefinedConversion): ... here. 2005-10-06 Marek Safar * convert.cs (ExplicitConversionCore): Removed duplicate enum conversion. 2005-10-05 Marek Safar * assign.cs (Assign.DoResolve): Error method changed. * cfold.cs (DoConstantNumericPromotions): Error method changed. * const.cs (ResolveValue): Reset in_transit immediately. * constant.cs: Error method changed. * convert.cs: Removed useless location parameter. (ExplicitNumericConversion): Don't do double enum check. (ExplicitConversionCore): Renamed from ExplicitConversion. (ExplicitUnsafe): Extracted from ExplicitConversion. (ExplicitConversion): Uses for error reporting. * ecore.cs (Error_ValueCannotBeConverted): More logic for more error messages. (ResolveBoolean): Uses common error method. (CastToDecimal): Get rid of ec. (CastFromDecimal): Optimized. (ConvCast): Get rid of ec. * enum.cs (ResolveValue): Reset in_transit immediately. (Emit): Return after first error. * expression.cs: Convert changes. * literal.cs: Error method changed. * statement.cs: Error method changed. 2005-10-03 Raja R Harinath * support.cs (SeekableStreamReader.Position): Don't error out when the requested position is just beyond the end of the current buffered data. 2005-09-28 Raja R Harinath * support.cs (SeekableStreamReader): Simplify drastically. Don't try to keep in sync with the byte count of the underlying Stream. However, this limits us to a window size of 2048 characters: i.e., the maximum lookahead of our lexer/parser can be 2048 characters. 2005-09-28 Marek Safar Fix #76255. * driver.cs: Fix compilation files with full root path. 2005-09-25 Miguel de Icaza * report.cs (SymbolRelatedToPreviousError): Format the output so it does not use an open parenthesis that is never closed. * driver.cs: Follow coding guidelines 2005-09-27 Marek Safar Fix #72930. * const.cs (Const.ResolveValue): Check for assigning non-null value to reference type. 2005-09-27 Marek Safar * anonymous.cs: Implemented ExprClassName. * assign.cs (Assign.DoResolve): Don't chrash when type is not delegate. * attribute.cs (ResolveArguments): Enabled MethodImplOptions check. * class.cs (StaticClass.DefineContainerMembers): Report protected members as error. * codegen.cs: if(ed) PRODUCTION. * convert.cs (Error_CannotImplicitConversion): Better error distinction. * cs-parser.jay: More error checks. * cs-tokenizer.cs (consume_identifier): Fixed Miguel's revert. * driver.cs (CSCParseOption): Enabled wrong option check. * ecore.cs (Expression.ExprClassName): Turned to property. (MemberExpr.CheckIntermediateModification): For checking boxed value types modification. * statement.cs (Fixed.Resolve): Expression type must be convertible to fixed type. (CollectionForeach.GetEnumeratorFilter,TryType): Small refactoring for easier error checking. 2005-09-26 Marek Safar * attribute.cs (Attribute.Resolve): Check Obsolete attribute for attributes. * class.cs (GeneratedBaseInitializer): New class for customization compiler generated initializers. (MemberBase.DoDefine): Check Obsolete attribute here. (FieldMember.DoDefine): Ditto. * const.cs (ExternalConstant.CreateDecimal): Builder for decimal constants. * decl.cs (MemberCore.EmitContext): Returns valid current ec. (MemberCore.GetObsoleteAttribute): Removed argument. (MemberCore.CheckObsoleteness): Obsolete attributes are hierarchic. (MemberCore.CheckObsoleteType): New helper. * delegate.cs, * enum.cs, * statement.cs: Updates after MemberCore changes. * ecore.cs (TypeExpr.ResolveType): Check type obsoleteness here. (FieldExpr.ResolveMemberAccess): Fixed decimal constants checks. * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't check obsolete attribute for compiler construct. (As.DoResolve): Cache result. * iterators.cs (Define_Constructor): Use GeneratedBaseInitializer. 2005-09-26 Raja R Harinath Fix #76133. * expression.cs (This.VerifyFixed): In a value type T, the type of 'this' is T&, iow, 'this' is either an out or ref parameter. In a value type R, 'this' is treated as a value parameter. 2005-09-22 Miguel de Icaza * statement.cs (Lock): Use the TemporaryVariable class instead of manually using local variables as those do not work when variables are captured. * ecore.cs: Moved the TemporaryVariable class from being a nested class inside Foreach to be a public class that can be employed in other places. 2005-09-19 Marek Safar * cs-parser.jay: interface_accessors replaced by accessor_declarations. * ecore.cs, literal.cs, statement.cs: NullLiteral holds null location. * statement.cs (GotoCase.Resolve): Convert null constant to null case. (SwitchLabel.ResolveAndReduce): Ditto. (SwitchLabel.NullStringCase): Custom null stamp. (Switch.SimpleSwitchEmit): Fix from NullLiteral to NullStringCase. typemanager.cs (CSharpSignature): Don't skip first argument for full names. 2005-09-18 Miguel de Icaza * driver.cs: Set InEmacs based on the environment variable EMACS. * location.cs (InEmacs): in this mode, do not report column location as it confuses Emacs. 2005-09-16 Marek Safar * cfold.cs, constant.cs, convert.cs, ecore.cs, expression.cs, iterators.cs, literal.cs: Store constants and literals location. * class.cs (MemberBase.ShortName): Pass location. * cs-parser.jay: Some location fixes. * ecore.cs (Expression.Location): Made virtual. 2005-09-05 Miguel de Icaza * expression.cs (Cast.TryReduce): Only reduce to an EnumConstant if the underlying types are the same, otherwise we need to produce code that will do the proper cast. This was exposed by Marek's constant rewrite which produced invalid code for the call site: enum X : long { a } void Method (X v) {} Method ((X) 5) This fixes test-49.cs 2005-09-05 Atsushi Enomoto * attribute.cs : (Attribute.IsValidArgumentType): array of string/ Type/Object should be allowed as well. Fixed bug #75968. 2005-09-05 Atsushi Enomoto * expression.cs : (Binary.DoResolve): when one is enum constant and another is constant 0, then return enum one *as enum type*. Fixed bug 74846. 2005-09-02 Raja R Harinath * attribute.cs (GetMarshal): Work even if "DefineCustom" is internal. Fix #75941. * ecore.cs (SimpleNameResolve.DoSimpleNameResolve): Disable flow-branching for LocalVariableReferences in case we were invoked from a MemberAccess. * expression.cs (LocalVariableReference.VerifyAssigned): New. Carved out of ... (LocalVariableReference.DoResolveBase): ... this. (MemberAccess.Resolve): Do the check that was disabled during SimpleNameResolve. 2005-09-01 Atsushi Enomoto * class.cs : (PartialContainer.Create): check abstract/sealed/static strictly but abstract/sealed can exist only at one side. Fixed bug #75883. 2005-09-01 Kornél Pál Fix #75945. * attribute.cs (Attribute.GetMarshal): If ArraySubType is not specified, don't default to UnmanagedType.I4. 2005-09-01 Atsushi Enomoto * expression.cs : conditional operator should check possibly incorrect assign expression. Fixed bug #75946. 2005-08-31 Atsushi Enomoto * cs-tokenizer.cs, cs-parser.jay, driver.cs, support.cs : Reverting the change. gmcs is much complex than mcs on this matter. 2005-08-31 Atsushi Enomoto * cs-tokenizer.cs : To read another token ahead of the actual consumption, use new SavedToken and cache token instead of moving back the stream with SeekableStreamReader (it seemed problematic). * cs-parser.jay, driver.cs : Thus use StreamReader directly. * support.cs : Thus removed SeekableStreamReader. 2005-08-30 Raja R Harinath Fix #75934. * anonymous.cs (ScopeInfo.MakeFieldName): New helper. (ScopeInfo.EmitScopeType): Use it to construct field names from names of captured locals. Fix #75929. * ecore.cs (BoxedCast.BoxedCast) [1-argument variant]: Remove. * convert.cs (ImplicitReferenceConversion, TryImplicitIntConversion): Pass 'target_type' to BoxedCast. Don't default to 'object'. (ExplicitConversion): Remove enum cases already handled by implicit conversion. Move implicit conversion check to the beginning. * delegate.cs (DelegateCreation.ResolveMethodGroupExpr): Update. * expression.cs (ArrayCreation.EmitDynamicInitializers): Don't treat System.Enum as a struct. 2005-08-30 Jb Evain * attribute.cs: handles as expression in parameters. 2005-08-30 Raja R Harinath Fix #75802. * class.cs (TypeContainer.VerifyClsName): Don't use a PartialContainer when verifying CLS compliance. (AbstractPropertyEventMethod): Set Parent here, ... (PropertyMethod): ... not here. 2005-08-30 Atsushi Enomoto * attribute.cs : escaped attribute name should not be allowed to be resolved (e.g. @class as classAttribute). Fixed bug #75930. 2005-08-29 Raja R Harinath Fix #75927. * convert.cs (ImplicitStandardConversionExists): Allow zero also when converting a long constant to unsigned long. * expression.cs (Invocation.OverloadResolve): Add sanity check to detect where IsApplicable and VerifyArgumentsCompat disagree. 2005-08-29 Raja R Harinath and Carlos Alberto Cortez Fix #75848. * class.cs (TypeContainer.CanElideInitializer): New helper. (TypeContainer.EmitFieldInitializers): Use it to determine if we can safely emitting the initializer of a field. 2005-08-25 Atsushi Enomoto * statement.cs : (Continue.Resolve()) Unlike break, continue is not allowed inside a switch (without loop). Fixed bug #75433. 2005-08-26 Kornél Pál * AssemblyInfo.cs: Using Consts.MonoVersion instead of MonoVersion.cs. * mcs.exe.sources: Using Consts.MonoVersion instead of MonoVersion.cs. 2005-08-25 Atsushi Enomoto * driver.cs : kinda reverting the default encoding changes (not exact revert since I noticed that "codepage:reset" might not work fine). 2005-08-25 Atsushi Enomoto * class.cs : (AbstractPropertyEventMethod) SetupName() now takes Location. Now getter and setter store location correctly. (errors/cs0111-12.cs now reports the expected location.) 2005-08-25 Atsushi Enomoto * driver.cs : Use default encoding on the environment. Removed (now that) extra parameter for SeekableStreamReader. * support.cs : (SeekableStreamReader) third .ctor() argument for StreamReader is not required (always true). preamble size could be acquired in simpler and safe way. 2005-08-24 Atsushi Enomoto * cs-parser.jay: report CS0642 at warning level 3 and report CS0642 for an if else statement also fixes bug #74745. Patch by John Luke (and a bit modified by me). Removed extra CS0642 warning check for "while", "for" and "fixed". * statement.cs: In Block.Resolve(), CS0642 check is reimplemented to check a sequence of an empty statement and a block. Both fix bug #66777. 2005-08-24 Marek Safar * attribute.cs (GetMethodObsoleteAttribute): Disabled obsolete properties detection until I fix it. * cs-tokenizer.cs: Changed error message. * cs-parser.jay: Fixed 2 error locations. * ecore.cs (Error_TypeDoesNotContainDefinition): Share error message. (PropertyExpr.Error_PropertyNotFound): First attempt to detect non C# properties. * enum.cs (GetSignatureForError): Fixed. * expression.cs (Invocation.IsSpecialMethodInvocation): Improved special method detection. * class.cs, * typemanager.cs (RegisterProperty): Removed. * statement.cs (CheckInvariantMeaningInBlock): Changed error message. 2005-08-24 Raja R Harinath Fix #75874. * expression.cs (ArrayAccess.EmitLoadOpcode): Emit ldelem.i for pointers. (ArrayAccess.GetStoreOpcode): Return stelem.i for pointers. 2005-08-23 Atsushi Enomoto * expression.cs : tiny fix is required for not warning positive ulong. See test-441.cs. 2005-08-23 Atsushi Enomoto * expression.cs : add CS0652 check for constant and integral expression. Fixed bug #53974. 2005-08-23 Atsushi Enomoto * expression.cs : in DoNumericPromotions(), check if there is implicit conversion overload for string (to check CS0034). Fixed bug #52492. 2005-08-23 Atsushi Enomoto * cs-tokenizer.cs : Check newline in char constant. Fixed bug #75245. 2005-08-23 Atsushi Enomoto * ecore.cs : report location when it is *not* Null. 2005-08-23 Atsushi Enomoto * codegen.cs, ecore.cs, flowanalysis.cs, expression.cs: Added OmitStructFlowAnalysis to EmitContext to handle CS0165 check correctly. Fixed bug #75721. 2005-08-23 Raja R Harinath * support.cs (SeekableStreamReader.Position): Avoid an expensive loop that performs 'min (pos, char_count)'. Fix #75862. * expression.cs (Unary.ResolveOperator): Don't discard implicit converted value in Operator.OnesComplement. 2005-08-22 Ben Maurer * anonymous.cs: If the anon method is pulled into a helper class, it needs to be `internal' not `private'. Fixes runtime behavior on msft. bug #75704 2005-08-20 Martin Baulig * anonymous.cs (CaptureContext.CaptureThis): Create the topmost scope if we don't already have it. * expression.cs (Invocation.EmitCall): Use `ec.EmitThis ()' rather than `ig.Emit (OpCodes.Ldarg_0)' to make it work inside iterators; fixes #75867. 2005-08-17 Marek Safar Fix #75803 * decl.cs (DeclSpace.VerifyClsCompliance): Skip when collision object is a partial class. 2005-08-16 Marek Safar The big constants rewrite Fix #75746, #75685 and more As a side effect saved 1MB for MWF ;-) * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue. (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not enum based for corlib compilation. * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum subtractions. * class.cs (FixedField.Define): Use ResolveAsConstant. * const.cs (IConstant): Interface constants and enums. (Const.ResolveValue): New method for constant resolvning. (ExternalConstant): Constants from imported assemblies. * constant.cs (Constant.GetTypedValue): Used to get constant with forced conversion; like enums. (Constant.ToType): Converts this constant to different type. (Constant.Increment): Adds 1. * convert.cs (ImplicitConversionRequired): Simplified. * cs-parser.jay: Create EnumMember directly. * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence. * doc.cs (GenerateEnumDocComment): Removed. * ecore.cs (Expression.ResolveAsConstant): New constant specific method. (ConvertIntLiteral): Removed. (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s). * enum.cs (EnumMember): Implement IConstant. (Enum.IsValidEnumConstant): Removed. (Enum.GetNextDefaultValue): Removed. (Enum.FindMembers): Updated. (Enum.GenerateDocComment): Iterate enum members. * expression.cs (Cast.TryReduce): Handle enums correctly. (New.Constantify): Made public. (MemberAccess.DoResolve): Removed contant specific if(s). * literal.cs (NullLiteral): Implement new abstract methods. * statement.cs (GotoCase.Resolve): Use new constant methods. (SwitchLabel.ResolveAndReduce): Use new constant methods. * typemanager.cs (LookupEnum): Removed. (IsEnumType): Fixed to work with corlib. (RegisterConstant): Removed. (LookupConstant): Removed. (GetConstant): Changed to work with IConstant. 2005-08-04 Atsushi Enomoto * location.cs : Fixed overflown (>255) column number. 2005-08-03 Raja R Harinath First cut of the qualified-alias-member feature. * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon token. * cs-parser.jay (DOUBLE_COLON): New token. (namespace_or_type_name): Add rule for recognizing qualified-alias-members. (primary_expression): Likewise. (element_access): Allow QualifiedAliasMember as a possible type-bearing expression. (local_variable_type, local_variable_pointer_type): Likewise. * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up aliases in the current and enclosing namespace declarations. (NamespaceEntry.UsingAlias): Add CS0440 warning. * decl.cs (MemberName.is_double_colon): New. (MemberName.MemberName): Add new constructor for alias-member. (MemberName.GetTypeExpression): Generate QualifiedAliasMember too. * expression.cs (QualifiedAliasMember): New expression type. 2005-08-02 Atsushi Enomoto * location.cs : it borked when no argument was specified. 2005-08-02 Atsushi Enomoto * location.cs : tiny ToString() format fix. 2005-08-02 Atsushi Enomoto * statement.cs : oops, it was missing. 2005-08-02 Atsushi Enomoto A set of fixes for precise line/column location. * location.cs : "token" field now holds a file/line "delta", a line number offset from the segment, and a column number. See also: http://lists.ximian.com/pipermail/mono-devel-list/2004- December/009508.html Removed static IsNull. Use instance IsNull property instead. * cs-tokenizer.cs : For some tokens it stores Location. For Identifier it stores LocatedToken which is a pair of string name and location. Column numbers are adjusted only at getChar(). * report.cs : Use Location.ToString() for reporting (it now contains column). * cs-parser.jay : Largely modified to use LocatedToken instead of string (IDENTIFIER), and to acquire Location from some tokens. * namespace.cs, decl.cs, ecore.cs, class.cs, delegate.cs, iterators.cs, const.cs, anonymous.cs, tree.cs, enum.cs, codegen.cs : Now MemberName holds Location. DeclSpace.ctor() receives Location as a parameter. Removed extra parameters to all derived classes. Replaced Location.IsNull() with instance property. * assign.cs, expression.cs : Added .ctor() overload that omits Location. * attribute.cs : Added "nameEscaped" flag that indicates the identifier was escaped in the source file. This fixes bug #57047. 2005-08-02 Marek Safar * attribute.cs (AttributeTester.GetImportedIgnoreCaseClsType): New method, looking for lo-case imported cls type. * decl.cs (DeclSpace.VerifyClsCompliance): Check CS3005 for types here. * driver.cs: Removed VerifyTopLevelNameClsCompliance usage. * enum (Enum.VerifyClsCompliance): Hardcode non-compliant types. * typemanager.cs (TypeManager.AllClsTopLevelTypes): Renamed from all_imported_types. (TypeManager.LoadAllImportedTypes): Lo-case imported types. Optimized to save 3.5 MB for SWF compilation. 2005-08-01 Marek Safar * class.cs (AddToTypeContainer): Use inheritance insted of if(s). (PartialContainer.Create): Moved logic AddToContainer. (PartialContainer.MarkForDuplicationCheck): Shares name. * decl.cs (DeclSpace.AddToContainer): Check name collisions at one place. * namespace.cs (Namespace.AddDeclSpace): Lazy declspaces initialization. (Namespace.GetSignatureForError): New method. * tree.cs (Tree.RecordDecl): Moved to AddToContainer. (RootTypes.AddToTypeContainer): se inheritance insted of if(s). 2005-08-01 Raja R Harinath Fix #75669. * ecore.cs (Expression.MemberLookupFailed): Use queried_type for member lookup rather than qualifier_type, since qualifier_type can be null. 2005-08-01 Marek Safar * enum.cs (Enum.VerifyClsName): Fixed to allow not CLSCompliant enum member. 2005-07-31 Miguel de Icaza * statement.cs: Copy the local exception into the exception captured local. Fixes 75674 2005-07-31 Raja R Harinath Fix #75658. * expression.cs (Invocation.OverloadResolve): Don't report error CS1501 if error CS1502 has been reported. (New.DoResolve): Delegate CS1501 reporting to Invocation.OverloadResolve. Fix #75656. * statement.cs (Block.CheckInvariantMeaningInBlock): Verify invariant-meaning-in-block property in an enclosing block if necessary. 2005-07-29 Marek Safar * statement.cs (SwitchLabel.ResolveAndReduce): Refactored. (SwitchLabel.Erorr_AlreadyOccurs): Share error message. (Switch.CheckSwitch): Just save 50kb for SWF. 2005-07-27 Martin Baulig * anonymous.cs (CaptureContext.AddField): Added `AnonymousContainer am' argument; compute its toplevel scope if it's not already computed. Fixes #75649. 2005-07-26 Raja R Harinath Fix #75628. * class.cs (Constructor.Emit): Reset block to null if the block resolve fails. 2005-07-25 Marek Safar * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169. 2005-07-25 Marek Safar * class.cs (MethodData.Define): Check whether accessor implementing interface is public. * driver.cs (Driver.parse): Try to be smart and check for `MZ' header. 2005-07-22 Marek Safar Fix #57245 * namespace.cs (LookupType): Moved same type check to... * typemanager.cs (LookupTypeReflection): Don't allow to import more types with the same name. 2005-07-21 Raja R Harinath * namespace.cs (NamespaceLookupType): Avoid a string allocation when we already found a typebuilder. * class.cs (MethodCore.IsDuplicateImplementation): Compare MemberNames, not strings. * const.cs (Error_ExpressionMustBeConst): Rename from Error_EpressionMustBeConst. * const.cs, class.cs, statement.cd: Update. 2005-07-21 Marek Safar Fix #65573 * const.cs (Const.LookupConstantValue): Report missing contant expression everytime. (Error_EpressionMustBeConstant): Only one error method. * class.cs, statement.c: Updated. 2005-07-20 Raja R Harinath * statement.cs (Block.Flags): Add back HasVarargs. (Block.flags): Make protected. (ToplevelBlock.HasVarargs): Convert to a property that updates flags. * typemanager.cs (types, typecontainers, user_types): Remove. (UserTypes, TypeContainers): Likewise. (HandleDuplicate, AddDelegateType, AddEnumType): Likewise. (CleanUp, Reset): Update. (AddUserType): Combine variants. Now, only updates builder_to_declspace. (GetNestedType): Use Type.GetNestedType. (CoreLookupType): Take two arguments, the namespace and the basename of the type. Update to use the Namespace.Lookup mechanism. (InitEnumUnderlyingTypes, InitCoreTypes): Update. (RealMemberLookup): Use IsNestedChildOf instead of playing with string concatenation and substring matches. * class.cs, enum.cs, delegate.cs: Update to changes. 2005-07-20 Marek Safar * constant.cs (Constant.Error_ConstantValueCannotBeConverted): Moved from Expression and made virtual. * convert.cs (ImplicitReferenceConversionExists): Skip for value types. (ImplicitStandardConversionExists): Fixed `byte' typo ? * ecore.cs (Expression.Error_ConstantValueCannotBeConverted): Moved. * literal.cs (NullLiteral.Error_ConstantValueCannotBeConverted): Customize error message. * convert.cs, ecore.cs, enum.cs: Reflect Error_ConstantValueCannotBeConverted change. 2005-07-18 Marek Safar Fix #57707 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Check whether AssemblyCultureAttribute is not used on executable. * rootcontext.cs, * typemanager.cs: Add System.Reflection.AssemblyCultureAttribute. 2005-07-16 Raja R Harinath Fix #60638. * expression.cs (Binary.Warning_UnintendeReferenceComparison): New. Reports CS0252/CS0253. Mostly taken from preliminary patch by Duncak Mak. (Binary.DoResolveOperator): Store results of operator lookup. Use them to detect if we need to warn about unintended reference comparisons. 2005-07-15 Raja R Harinath Fix #72969. * namespace.cs (Namespace.Lookup): Add back location parameter. (Namespace.LookupType): Add CS0436 report. Add location parameter. * delegate.cs, ecore.cs, expression.cs: Update to changes. * codegen.cs (EmitContext.DeclSpace): Make readonly. * namespace.cs (Namespace.Lookup): Carve out type lookup into ... (Namespace.LookupType): ... this. (NamespaceEntry.GetUsingTable): Allocate only one zero-sized array of namespaces. * typemanager.cs (LookupTypeReflection): Remove buggy code that purported to handle pointers. (char_ptr_type, void_ptr_type): Use GetPointerType rather than CoreLookupType. 2005-07-15 Marek Safar * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't report nested type as namespace. 2005-07-15 Raja R Harinath * namespace.cs (Namespace.Lookup): Drop location parameter. (NamespaceEntry.LookupAlias): Remove. Merge into ... (NamespaceEntry.Lookup): ... this. (NamespaceEntry.Error_AmbiguousTypeReference): Move here from DeclSpace. (NamespaceEntry.LookupNamespaceOrType): Move support for dotted names ... * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): ... here. * decl.cs (DeclSpace.ErrorAmbiguousTypeReference): Move to NamespaceEntry. * delegate.cs, expression.cs: Update to changes. 2005-07-14 Marek Safar * attribute.cs (Attribute.ResolveAttributeType): Renamed from CheckAttributeType and refactored. (Attribute.ResolvePossibleAttributeType): Changed to reuse ResolveAsTypeTerminal error handling. (ResolveAsTypeTerminal): Introduced because of global attributes extra handling. (GetSignatureForError): Print errors in same way. * class.cs, * codegen.cs: Reflect attribute GetSignatureForError change. * ecore.cs, * expression.cs: Add silent parameter to ResolveAsTypeStep. * namespace.cs (UsingEntry): Refactored to make fields private. * assign.cs, statement.cs: Error_UnexpectedKind has extra parameter. 2005-07-14 Raja R Harinath * ecore.cs (IAlias): Remove. * decl.cs (DeclSpace): Don't derive from IAlias. Remove members that implement the interface. * namespace.cs (Namespace): Likewise. (Namespace.declspaces): Renamed from 'defined_names'. (Namespace.AddDeclSpace): Renamed from 'DefineName'. Take a DeclSpace instead of an IAlias. * tree.cs (Tree.AddDecl): Update. 2005-07-12 Raja R Harinath * statement.cs (Block.Flags); Remove HasVarargs. (Block.HasVarargs): Move to ToplevelBlock. (Block.ThisVariable, Block.AddThisVariable): Likewise. (Block.Variables): Make protected. Initialize variable hashtable if necessary. (Block.AddVariable): Update. (Block.Resolve): Update to changes. (ToplevelBlock.HasVarargs): New boolean. (ToplevelBlock.ThisVariable): Move here from Block. (ToplevelBlock.AddThisVariable): Likewise. (ToplevelBlock.IsThisAssigned): New. Forwards call to this_variable. * expression.cs (This.ResolveBase): Update to changes. (ArglistAccess.DoResolve): Likewise. 2005-07-11 Marek Safar Fix #75321 * ecore.cs, class.cs: Use SetAssigned instead of direct access. * class.cs (TypeContainer.VerifyMembers): Distinguish between not used and not used & assigned. (FieldBase.ASSIGNED): Moved to MemberCore.Flags. 2005-07-11 Marek Safar Fix #75053 * expression.cs (Is.DoResolve): null is never provided type. 2005-07-08 Marek Safar Fix #52496 * cs-parser.jay: Less strict event error rule to catch more errors. 2005-07-08 Martin Baulig Fix test-iter-10.cs - distinguish whether we `yield' in a property gettter (allowed) or setter (not allowed). * class.cs (Accessor): Implement IIteratorContainer. (Accessor.Yields): New public field. (PropertyBase.PropertyMethod.Define): Handle iterators on a per-accessor basis. * cs-parser.jay (get_accessor_declaration, set_accessor_declaration): Set the `yields' flag on the accessor, not the property. (property_declaration): Do the iterators check on a per-accessor basis and not for the whole property. 2005-07-08 Martin Baulig * anonymous.cs (CaptureContext.EmitParameterInstance): Correctly handle parameters in nested scopes; fixes #74808; see gtest-188.cs. 2005-07-07 Marek Safar Fix #74975 * attribute.cs (orig_sec_assembly): Holds original version of assembly. (ExtractSecurityPermissionSet): Cope with self referencing security attributes properly. * driver.cs (SetOutputFile): Made public property OutputFile. 2005-07-07 Raja R Harinath Fix #75486. * class.cs (TypeContainer.first_nonstatic_field): Rename from has_nonstatic_fields. Make into a FieldBase pointer. (TypeContainer.AddField): Add CS0282 check. (TypeContainer.EmitType): Update. 2005-07-06 Miguel de Icaza * cs-tokenizer.cs (consume_identifier): Do not create strings to compare if they start with __. 2005-07-06 Raja R Harinath * statement.cs (Switch.SwitchGoverningType): Only look at UserCasts that don't need implicit standard conversions to one of the allowed switch types (Fixes test-322.cs). (LocalInfo.Resolve): Re-enable sanity-test. 2005-07-06 Marek Safar * cs-tokenizer.cs (consume_identifier): Detect double undescores * ecore.cs (FieldExpr.AddressOf): Changed volatile error to warning. * expression.cs (Invocation.DoResolve): Report error CS0245 here. 2005-07-06 Raja R Harinath Fix #75472. * ecore.cs (SimpleName.GetSignatureForError): Add. * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field. (MemberAccess.GetSignatureForError): Add. 2005-07-05 Marek Safar The big error and warning messages review. * anonymous.cs, * assign.cs, * attribute.cs, * class.cs, * codegen.cs, * convert.cs, * cs-parser.jay, * cs-tokenizer.cs, * decl.cs, * delegate.cs, * doc.cs, * driver.cs, * ecore.cs, * enum.cs, * expression.cs, * flowanalysis.cs, * iterators.cs, * literal.cs, * location.cs, * modifiers.cs, * namespace.cs, * parameter.cs, * pending.cs, * report.cs, * rootcontext.cs, * statement.cs, * support.cs, * tree.cs, * typemanager.cs: Updated. * class.cs: (MethodCore.SetYields): Moved here to share. (PropertyMethod.Define): Moved iterator setup here. * iterators.cs: Add orig_method to have full access to parent container. 2005-07-05 Raja R Harinath Make 'fixed variable' handling standards compliant. Fix #70807, #72729. * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter. (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed variable of struct type. * expression.cs (Unary.ResolveOperator): Update to change. (Indirection.VerifyFixed): Likewise. (LocalVariableReference.VerifyFixed): A local variable is always fixed. (ParameterReference.VerifyFixed): Value parameters are fixed. (This.VerifyFixed): Treat 'this' as a value parameter. * statement.cs (LocalInfo.IsFixed): Remove. 2005-07-01 Martin Baulig * iterators.cs (Iterator.CapturedThisReference.Emit): Use `ec.EmitThis ()' to get the correct scope. 2005-07-01 Martin Baulig * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's instance is a ParameterReference; fixes #75299. 2005-07-01 Martin Baulig Reverted Marek's latest patch (r46725): - it contains structural changes which are neither mentioned in the ChangeLog nor explained anywhere; for example the additional argument of EmitContext's and Iterator's .ctor's and the TypeContainer.DefineMembers() change. - structural changes like this should go in in seperate patches and not be hidden in a huge patch which just seems to affect warnings and errors. a big and hard to understand patch. - it breaks iterators and causes regressions, for instance in test-iter-03.cs. 2005-06-30 Raja R Harinath Fix #75412. * expression.cs (Indexers.map): Remove. (Indexers.Append): Filter out inaccessible setters and getters. (IndexerAccess.DoResolve, IndexerAccess.DoResolveLValue): Update. Fix #75283. * ecore.cs (MemberExpr.EmitInstance): New. Add CS0120 check. Refactored from ... (FieldExpr.EmitInstance, PropertyExpr.EmitInstance): ... these. (FieldExpr.Emit, PropertyExpr.Emit): Update. (FieldExpr.EmitAssign, PropertyExpr.EmitAssign): Update. * expression.cs (Invocation.EmitCall): Add CS0120 check. 2005-06-30 Marek Safar Fix #75322 * class.cs (FieldBase.GetInitializerExpression): One more field for backup. 2005-06-28 Miguel de Icaza * pending.cs: Do not define a proxy if the base method is virtual, it will be picked up by the runtime (bug 75270). 2005-06-08 Martin Baulig The big Iterators rewrite :-) * iterators.cs: Rewrite this to use the anonymous methods framework. * rootcontext.cs (RootContext.DefineTypes): Define Delegates before the TypeContainers; see 2test-21.cs. * class.cs (TypeContainer.DefineType): Don't create a new EmitContext if we already have one (this only happens if we're an Iterator). (TypeContainer.Define): Also call Define() on all our iterators. (Method.CreateEmitContext): Added support for iterators. * anonymous.cs (AnonymousContainer): New abstract base class for `AnonymousMethod'. (AnonymousContainer.CreateMethodHost): Moved here from AnonymousMethod and made abstract. (AnonymousContainer.CreateScopeType): New abstract method. (AnonymousContainer.IsIterator): New public property. (ScopeInfo.EmitScopeType): Call CreateScopeType() on our Host to get the ScopeTypeBuilder rather than manually defining it here. (ScopeInfo.EmitScopeInstance): New public method; correctly handle iterators here. * driver.cs (Driver.MainDriver): Call TypeManager.InitCodeHelpers() before RootContext.DefineTypes(). * codegen.cs (EmitContext.RemapToProxy): Removed. (EmitContext.CurrentAnonymousMethod): Changed type from AnonymousMethod -> AnonymousContainer. (EmitContext.ResolveTopBlock): Protect from being called twice. (EmitContext.MapVariable, RemapParameter(LValue)): Removed. (EmitContext.EmitThis): Removed the iterators hacks; use the anonymous methods framework for that. * statement.cs (ToplevelBlock.Container): Make this a property, not a field. (ToplevelBlock.ReParent): New public method; move the ToplevelBlock into a new container. (Foreach.TemporaryVariable): Simplify. 2005-06-05 Martin Baulig * statement.cs (LocalInfo.CompilerGenerated): New flag. (Block.AddTemporaryVariable): New public method; creates a new `LocalInfo' for a temporary variable. (Block.EmitMeta): Create the LocalBuilders for all the temporary variables here. (Foreach.TemporaryVariable): Use Block.AddTemporaryVariable() for non-iterator variables. 2005-06-05 Martin Baulig * statement.cs (Foreach.TemporaryVariable): Create the LocalBuilder in the Emit phase and not in Resolve since in some situations, we don't have an ILGenerator during Resolve; see 2test-19.cs for an example. 2005-06-04 Martin Baulig **** Merged r45395 from GCS **** The big Foreach rewrite - Part II. * typemanager.cs (TypeManager.object_getcurrent_void): Replaced with `PropertyInfo ienumerator_getcurrent'. * codegen.cs (VariableStorage): Removed. * statement.cs (Foreach): Derive from Statement, not ExceptionStatement. (Foreach.CollectionForeach): New nested class. Moved all the code dealing with collection foreach here. (Foreach.ForeachHelperMethods): Removed. (Foreach.TemporaryVariable): Implement IMemoryLocation. 2005-05-23 Martin Baulig * statement.cs (Try.DoResolve): Don't create a `finally' if we don't need to. Fix #75014. 2005-05-20 Martin Baulig Merged r44808 from GMCS. * class.cs (TypeContainer.CircularDepException): Removed. (TypeContainer.DefineType): Removed the `InTransit' stuff. (TypeContainer.CheckRecursiveDefinition): Check for circular class (CS0146) and interface (CS0529) dependencies here. 2005-06-21 Raja R Harinath * expression.cs (Invocation.EmitCall): Fix initialization 'this_call' to reflect current behaviour. Fix indentation. * convert.cs (FindMostEncompassedType): Add two trivial special cases (number_of_types == 0 || number_of_types == 1). (FindMostEncompasingType): Likewise. 2005-06-17 Raja R Harinath Some cleanups preparing for the fix of #75283. * ecore.cs (PropertyExpr.InstanceResolve): Tighten conditions for error testing. (EventExpr.InstanceResolve): Likewise. (EventExpr.DoResolve): Remove redundant checks. 2005-06-10 Duncan Mak * cs-tokenizer.cs (process_directives): New flag for controlling the processing of preprocessor directives. (x_token): After seeing a '#', return Token.NONE instead of going to handle_preprocessing_directive() when not processing directives. This avoids unnecessary processing during the token peek in is_punct(). This fixes #74939. * cs-tokenizer.cs (handle_preprocessing_directive, xtoken): Use the existing error reporting methods instead of Report.Error. * convert.cs (priv_fmt_expr): Remove. It's not needed anymore after Raja's rewrite. 2005-06-08 Miguel de Icaza * class.cs: Small fix. 2005-06-08 Raja R Harinath Fix #75160. * class.cs (GetPartialBases): Fix return value check of part.GetClassBases. 2005-06-07 Raja R Harinath Ensure that partial classes are registered in their enclosing namespace. Initial part of fix of #75160. * tree.cs (Tree.RecordDecl): Add new namespace argument. Register declspace with namespace here, not in DeclSpace.RecordDecl. * cs-parser.jay: Pass namespace to RecordDecl. * class.cs (PartialContainer.Create): Likewise. (ClassPart.DefineType): New sanity-check. Throws an exception if called. * decl.cs (Declspace.RecordDecl): Remove. * namespace.cs (NamespaceEntry.DefineName): Remove. 2005-06-06 Marek Safar * rootcontext.cs: Reset TargetExt as well. 2005-06-03 Raja R Harinath * ecore.cs (Expression.Resolve): Emit CS0654 error when -langversion:ISO-1. 2005-06-02 Raja R Harinath Fix #75080, cs0119.cs. * ecore.cs (Expression.ExprClassToResolveFlags): New. Broken out of ... (Expression.Resolve): ... this. Use it. Remove bogus code allowing ExprClass.Type and ExprClass.Namespace for ResolveFlags.VariableOrValue. (Expression.Resolve) [1-argument variant]: Change default resolve flags based on language version. (Expression.Error_UnexpectedKind): Use a simple string array rather than an ArrayList. * expression.cs (TypeOf.DoResolve): Set eclass to ExprClass.Value, not ExprClass.Type. (TypeOfVoid.DoResolve): Likewise. (MemberAccess.DoResolve) [3-argument variant]: Make private. Drop flags argument -- it always has the same value. 2005-05-31 Raja R Harinath Fix #75081. * ecore.cs (Expression.ResolveLValue): Add a Location parameter. Use it in the error message. * assign.cs, expression.cs, statement.cs: Update. 2005-05-30 Raja R Harinath Fix #75088. * ecore.cs (Expression.MemberLookupFailed): Add CS0122 check in the "almostMatchedMember" case too. * typemanager.cs (Closure.CheckValidFamilyAccess): Add anything that failed the accessibility checks to 'almost_match'. 2005-05-27 Vladimir Vukicevic * attribute.cs: Use internal MethodBuilder methods to set ExactSpelling and SetLastError on PInvoke methods, instead of passing them via charset. Fixes #75060. 2005-05-27 Raja R Harinath * parameter.cs (Parameter): Remove TODO comment. (Parameter.DefineParameter): Remove Location parameter. (Parameters.LabelParameters): Likewise. * class.cs (Constructor.Emit): Update to change. (MethodData.Emit): Likewise. * anonymous.cs (AnonymousMethod.EmitMethod): Likewise. * delegate.cs (Delegate.Define, Delegate.Emit): Likewise. 2005-05-27 Atsushi Enomoto * parameter.cs, Removed Parameters.Location and added Parameter.Location instead. Removed Location parameter from Emit() and GetSignature(). * anonymous.cs, class.cs, cs-parser.jay, delegate.cs, iterators.cs, statement.cs : Modified all related calls. 2005-05-26 Raja R Harinath Improve user-defined conversion handling. * convert.cs (GetConversionOperators): Rewrite. Return only the applicable operators. (AddConversionOperators): New. Helper for GetConversionOperators. (FindMostEncompassedType, FindMostEncompassingType): Verify that there is only one most encompassed/encompassing type. (FindMostSpecificSource, FindMostSpecificTarget): Remove "applicable operator" handling. (UserConversion): Move cache here from GetConversionOperators. Directly cache the chosen operator, rather than the whole MethodGroup. (ExplicitNumericConversion): Fix buggy implementation of Decimal case. Allow conversion of decimal to sbyte and byte too. * expression.cs (EmptyExpression.Grab, EmptyExpression.Release): New static methods. Used to avoid allocating EmptyExpressions in convert.cs. 2005-05-24 Duncan Mak * ecore.cs (CastFromDecimal): New class for casting a decimal to another class, used in Convert.ExplicitNumericConversion. (CastToDecimal): New class, similar to above, but casts to System.Decimal, used in Convert.ImplicitNumericConversion and also in explicit convesion from double/float to decimal. * convert.cs (ImplicitNumericConversion): Handle implicit conversions to System.Decimal. (ExplicitNumericConversion): handle explicit conversions to System.Decimal. This fixes #68711. 2005-05-20 Miguel de Icaza * typemanager.cs (EnumToUnderlying): Do not throw if we do not know the type at this stage, just break through. Fixes #75008 2005-05-19 Martin Baulig * delegate.cs (ImplicitDelegateCreation.Check): Added `bool check_only' argument to disable error reporting. * convert.cs (Convert.ImplicitStandardConversionExists): Use it here since we don't want to report an error; see the new test-336.cs. 2005-05-19 Raja R Harinath * statement.cs (ToplevelBlock.GetParameterReference) (ToplevelBlock.IsParameterReference,ToplevelBlock.IsLocalParameter): Move here from class Block. * ecore.cs (SimpleName.SimpleNameResolve): Update to changes. * expression.cs (ParameterReference.DoResolveBase): Likewise. 2005-05-18 Martin Baulig Fix #74978. * flowanalysis.cs (FlowBranching.Reachability): Add non-static public And() and Or() methods. (FlowBranchingSwitch): New class; do the `break_origins' thing like in FlowBranchingLoop. (FlowBranching.UsageVector.MergeBreakOrigins): Also merge the reachability, not just locals and parameters. (FlowBranching.MergeChild): Remove some of the hacks for loop and switch; MergeBreakOrigins() now takes care of that. 2005-05-18 Martin Baulig * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're a loop and may leave it, reset the barrier; fixes #74974. 2005-05-17 Marek Safar * attribute.cs (Attribute.ResolveArguments): GuidAttribute check is back. * cs-parser.jay: Catch more lexical errors. * report.cs: Add one more Error method. * rootcontext.cs, * typemanager.cs: Register System.Runtime.InteropServices.GuidAttribute 2005-05-17 Martin Baulig * expression.cs (Argument.Resolve): Turn on flow analysis; fix #70970. 2005-05-16 Raja R Harinath Fix test-382.cs. Emit values of decimal constants. * class.cs (TypeContainer.RegisterFieldForInitialization): New. Carved out of ... (TypeContainer.AddField): ... this. (TypeContainer.EmitFieldInitializers): Allow the list of fields with initializers to include 'Const's. (ClassPart.RegisterFieldForInitialization): Forward to PartialContainer. * const.cs (Const.Const): Pass initializer to base class. (Const.Define): In case of decimal constants, register them for initialization in a static constructor. 2005-05-14 Martin Baulig * statement.cs (Block.Resolve): Correctly handle unreachable code; do not call ResolveUnreachable() on unreachable statements in here, see the comment in the source code. 2005-05-13 Raja R Harinath Fix #74934. * expression.cs (BinaryResolveOperator): If one of the operands of an equality comparison is 'null' and the other is a pointer type, convert the null to a NullPointer. * convert.cs (ImplicitReferenceConversion): If the expression is a NullLiteral and the target type is a pointer type, return a NullPointer instead. (ImplicitConversionStandard): Likewise. 2005-05-13 Marek Safar * cs-parser.jay: Set readonly context based on special constructs. * expression.cs (LocalVariableReference.DoResolveBase): Improved readonly variable error handling. * rootcontext.cs (EmitCode): Don't verify members when error occurred. * statement.cs (LocalInfo): Add reaodnly context information. (SetReadOnlyContext, GetReadOnlyContext): New methods. 2005-05-13 Raja R Harinath * statement.cs (Block.Resolve): Revert change below. Modify fix for #74041 to initialize 'resolved' to false only for explicit blocks. Fixes #74873. 2005-05-12 Raja R Harinath Fix #74920. * typemanager.cs (unmanaged_enclosing_types): New. (IsUnmanagedType): Avoid infloops by using 'unmanaged_enclosing_types' to talk with recursive invocations. 2005-05-13 Martin Baulig * statement.cs (Block.Resolve): Make the `bool unresolved' flag an instance variable, not a local. Fix #74873. (Block.ResolveUnreachable): Set it to true here. 2005-05-11 Duncan Mak * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before continuing to process for 'arg'. (handle_preprocessing_directive): Check the argument of the #endif directive and report error CS1025 if there are any trailing characters. According to the C# spec, having even whitespace after the #endif directive is illegal; however, because we call arg.TrimEnd () beforehand, we have the same behavior as csc, allowing whitespace after the directive. Fixes #74892. 2005-05-11 Marek Safar Fix #74863. * class.cs (ConstructorInitializer.GetOverloadedConstructor): Removed. (Constructor.GetObsoleteAttribute): Implemented correctly. 2005-05-10 Martin Baulig * support.cs (ReflectionParameters.ParameterModifier): Use `Parameter.Modifier.REF' if we both have `ParameterAttributes.Out' and `ParameterAttributes.In'. Fixes #74884. 2005-05-10 Marek Safar * class.cs (Method.Define): Catch attempt for Finalizer declaration. * expression.cs (Argument.GetParameterModifier): Turned to property. (Invocation.Error_InvalidArguments): Add more descriptive errors. * parameter.cs (Parameter.GetModifierSignature): Translates modifier to its C# equivalent. 2005-05-09 Raja R Harinath Fix #74852. * decl.cs (MemberCache.AddMethods): Register override methods, rather than non-override methods. * typemanager.cs (RegisterOverride): New. (IsOverride): Update. 2005-05-09 Marek Safar Fix #73105. * ecore.cs (SimpleName.SimpleNameResolve): Add in_transit to catch recursive declaration. * statement.cs (Block.ResolveMeta): Report any error in resolving. 2005-05-06 Marek Safar * cfold (DoConstantNumericPromotions): Don't try to convert 0 enum. * expression.cs (Binary.DoResolve): (x && 0) is always 0. 2005-05-05 Raja R Harinath Fix #74797. * decl.cs (DeclSpace.FamilyAccessible): Use TypeManager.IsNestedFamilyAccessible. Fix reopened #64812. * typemanager.cs (Closure.Filter): Introduce checks for 'protected internal'. 2005-05-04 Raja R Harinath Abin Thomas Anoob V E Harilal P R Fix #64812. * typemanager.cs (Closure.CheckValidFamilyAccess): Don't blindly allow access to all static members. 2005-05-04 Martin Baulig * ecore.cs (FieldExpr.DoResolveLValue): Always call fb.SetAssigned(). 2005-05-04 Martin Baulig Fix #74655. * statement.cs (Switch.SimpleSwitchEmit): Always emit the default section at the end; make things work if `default' is not the last section. 2005-05-04 Martin Baulig Fix #70400. * statement.cs (Switch): Replaced the `got_default' field with a `default_section' one. (Switch.CheckSwitch): Set `default_section' here. (Switch.Resolve): If we're a constant switch and the constant is not found, use the default section. 2005-05-03 Martin Baulig * expression.cs (ArrayAccess.EmitGetLength): New public method. * statement.cs (Foreach.ArrayForeach): New nested class. (Foreach.TemporaryVariable): New nested class. (Foreach.EmitArrayForeach): Removed; this is now in the new ArrayForeach class. 2005-05-03 Raja R Harinath * pending.cs (BaseImplements): Move the #74773 fix here. This is more conservative. (VerifyPendingMethods): Revert change below. * typemanager.cs (IsOverride, RegisterNonOverride): New. * decl.cs (MemberCache.AddMethod): Register "non-override" methods that used to trigger warning -28. Remove warning -28. * expression.cs (Invocation.OverloadResolve): Use TypeManager.IsOverride to distinguish override methods. Fix #74773. * pending.cs (VerifyPendingMethods): If a base type implements the requested interface, don't bother checking individual methods of the base type. As a side-effect, this prevents the creation of unnecessary proxies. 2005-05-02 Martin Baulig Fix #70182. * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins): Also `And' the locals if the old vector is null. (FlowBranching.UsageVector.BitVector.And): Allow `vector' being null; in this case we basically reset all the variables. 2005-05-02 Martin Baulig Fix #74529. * flowanalysis.cs (FlowBranching.UsageVector.MergeBreakOrigins): Added `FlowBranching branching' argument; always `and' the variables instead of `or'ing them unless we're an infinite loop. * statement.cs (While.Resolve): Create a new sibling unless we're infinite. 2005-05-02 Martin Baulig Fix #70140. * class.cs (ConstructorInitializer.Resolve): Added `Block block' arguments; use it instead of creating a new TopLevelBlock. (Constructor.Emit): Call `block.ResolveMeta ()' before resolving our ConstructorInitializer. * statement.cs (TopLevelBlock.TopLevelBranching): New public property. (TopLevelBlock.ResolveMeta): New public method; call ResolveMeta() and create our `TopLevelBranching'. * codegen.cs (EmitContext.ResolveTopBlock): If we're not an anonymous method host, use `block.TopLevelBranching' rather than creating a new branching. 2005-04-20 Miguel de Icaza * anonymous.cs (ScopeInfo.AddChild): when adding a new child to a ScopeInfo, if any of the current children is a child of the new entry, move those children there. 2005-04-30 Martin Baulig * statement.cs (Switch.SimpleSwitchEmit): Reset `default_at_end' at the beginning of a SwitchSection. Fix #73335. 2005-04-27 Marek Safar Fix #74378 * class.cs (EmitFieldInitializers): Use FieldExpr in initializer. * ecore.cs (FieldExpr): Add a new ctor with in_initializer. (FieldExpr.DoResolve): Obsolete members are ignored for field initializers. 2005-04-26 Marek Safar * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array of arrays detection. * class.cs (Interface.VerifyClsCompliance): Add base interfaces verification. (Field.VerifyClsCompliance): Volatile fields are not compliant. * decl.cs (MemberCache.VerifyClsParameterConflict): Add array of arrays report. 2005-04-25 Ben Maurer * cs-parser.jay: Use the prefered version of -unsafe in error message. 2005-04-22 Marek Safar * driver.cs (CompilerCallableEntryPoint.Invoke): Reset under any circumstances. 2005-04-20 John Luke * driver.cs: fix typo in error message, --outout to --output 2005-04-20 Marek Safar * codegen.cs (InRefOutArgumentResolving): New field. * ecore.cs (FieldExpr.DoResolve): Check for assigning to readonly fields outside contructor. * expression.cs (Argument.Resolve): Set InRefOutArgumentResolving. 2005-04-19 Miguel de Icaza * anonymous.cs (CaptureContext.EmitParameterInstance): The parameter code was not completed ever, so it was not as up-to-date as local variables. Must finish it. The bug fix was to compare the Toplevel of the block, not the current block. Thanks for Ben for pointing this out. 2005-04-19 Raja R Harinath * decl.cs (AddMethods): Use the declaring type of the problem method to determine if we want to squash a warning. 2005-04-19 Marek Safar * attribute.cs: Removed debug output. * decl.cs (MemberCache.AddMethods): Fixed Finalize ignoring. * driver.cs (Driver.parse): Synchronize parser ErrorOutput with Report.Stderr. 2005-04-18 Raja R Harinath Fix #74481. * expression.cs (Binary.EqualsNullIsReferenceEquals): New. (Binary.DoResolveOperator): Use it to avoid blindly optimizing out all null comparisons against reference types. 2005-04-18 Marek Safar Fix# 74565 * class.cs (TypeContainer.CircularDepException) New nested exception class. (GetPartialBases, GetNormalBases, GetClassBases): Removed error. (TypeContainer.DefineType): Removed error, reset InTransit before exit. (Class.DefineType): Throw exception when is in Transit. Catch exception and report error. (Struct.DefineType): Throw exception when is in Transit. Catch exception and report error. (Interface.DefineType): Throw exception when is in Transit. Catch exception and report error. * codegen.cs: Add InCatch,InFinally to EmitContext to easily handle nested exception handlers. * flowanalysis.cs (InTryWithCatch): New method, search for try with a catch. * iterators.cs (Yield.CheckContext): Add CS1626 report. Updated InFinally and InCatch storage. * statement.cs (Throw.Resolve): Use InCatch, InFinally from ec. (Catch.Resolve): Set and Restore ec.InCatch. (Try.Resolve): Set and Restore ec.InFinally. (Try.HasCatch): True when try has catch. 2005-04-17 Atsushi Enomoto * doc.cs : In some cases FilterName returns MonoEvent and MonoField for the same event member, so exclude such cases from warning 419. Fixed bug #74633. 2005-04-16 Miguel de Icaza * expression.cs (Binary.ResolveOperator): Apply patch from John Luke to fix bug 59864: operators &, | and ^ on enumerations require that the same enum type on both sides. * driver.cs: Add warnings to old flag usage, this is to assist people who produce Makefiles and hope that the Makefiles will be used on Windows. * class.cs (TypeContainer.EmitType): Moved the definition of the special $PRIVATE$ field from the resolve phase to the Emit phase. During resolve we do not know if we are a struct with HasExplicitLayout, we know this only after the attributes for the type are emitted. Set the FieldOffset to zero on the dummy field that we create for the class. Fixes 74590. 2005-04-16 Raja R Harinath Fix #73834. * ecore.cs (PropertyExpr.resolved): New. (DoResolve): Use it to handle a case of double resolution here. Handle a case of identical-name-and-type-name. * expression.cs (ArrayCreation.CheckIndices): Avoid double resolution by storing the results of expression resolution back into the "probes" array. 2005-04-15 Raja R Harinath Fix cs0208-7.cs and cs0208-8.cs. * typemanager.cs (IsUnmanagedType): Arrays are not allowed (cf. ECMA standard, behaviour of CSC 1.1 and CSC 2.0). Improve error reporting to point out the reason a struct is not unmanaged. 2005-04-13 Atsushi Enomoto * doc.cs : In FindDocumentedType(), avoid TypeExpr.ResolveType() and just use TypeExpr.Type. This fixes bug #74595 when merged to gmcs. 2005-04-13 Raja R Harinath Fix #74528. * ecore.cs (PropertyExpr.InstanceResolve): Handle a case of IdenticalNameAndTypeName here. (EventExpr.InstanceResolve): Likewise. 2005-04-13 Marek Safar C# 2.0 DefaultCharSetAttribute implementation * attribute.cs (Attribute.ResolveAsTypeStep): New protected method which allows us to set GlobalNamespace for every resolve. (Attribute.ResolveArguments): Cut from Resolve. (Attribute.GetCharSetValue): Returns CharSet named argument. (Attribute.DefinePInvokeMethod): Gets default charset from module settings. (GlobalAttribute.ResolveAsTypeStep): Override. (GlobalAttribute.ResolveArguments): Override. * class.cs (TypeAttr): Is protected. * codegen.cs (ModuleClass.DefaultCharSet): New member. (ModuleClass.DefaultCharSetType): New memeber. (ModuleClass.ResolveAttributes): Resolves DefaultCharSetAttribute. * decl.cs (Decl.TypeAttr): New protected virtual. Returns default charset from module. * delegate.cs (TypeAttr): Override. (Delegate.DefineType): Use this TypeAttr. * driver.cs (Driver.MainDriver): Call Module.ResolveAttributes at very early stage (before types are defined) to resolve model module attributes. It will probably not work with corlib but it should be ok. * enum.cs (Enum.TypeAttr): New protected virtual. Returns default charset from module. * typemanager.cs (default_charset_type): New type. 2005-04-13 Raja R Harinath * decl.cs (MemberCache.AddMethods): Don't warn if System.Object.Finalize has buggy MethodAttributes. * typemanager.cs (IsUnmanagedType): Restore !IsValueType check removed below. 2005-04-13 Atsushi Enomoto * doc.cs : detect ambiguous reference to overloaded members. Fixed bug #71603. MS 1.1 csc does not detect it. 2005-04-13 Atsushi Enomoto * doc.cs : delegates must not be referenced with parameters. Fixed bug #71605. 2005-04-12 Miguel de Icaza * typemanager.cs (IsUnmanagedType): Arrays are allowed. 2005-04-10 Miguel de Icaza * driver.cs (MainDriver): Stop processing if the CLS stage found errors. (CompilerCallableEntryPoint.InvokeCompiler): Always reset after execution; Take a TextWriter argument for the output. * report.cs: Use the error stream instead of hardcoding stderr. 2005-04-09 Miguel de Icaza * class.cs: Reduce code paths to test, too small of an optimization to make it worth the extra testing. Always perform it. 2005-04-08 Raja R Harinath Fix #74510. * class.cs (OperatorArrayList.CheckPairedOperators): Skip operators that had errors reported on them. 2005-04-08 Marek Safar * attribute.cs (Attribute.IsValidArgumentType): Test valid named argument types. (Attribute.Resolve): Add named argument type checking. * class.cs (FixedField.Define): Use IsPrimitiveType * expression.cs (Binary.ResolveOperator): Reflect IsCLRType renaming. * iterators.cs (Iterator.DefineIterator): Add check for arglist and unsafe parameter types. * statement.cs (Using.ResolveExpression): Add better error description. * typemanager.cs (IsCLRType): Renamed to IsPrimitiveType. 2005-04-08 Raja R Harinath Fix #74484. * attribute.cs (Attribute.GetAttributeUsage): Resolve AttributeUsageAttribute in the emitcontext of the attribute class, not in the emitcontext of the attributable entity it was attached to. * cs-parser.jay: Use 'current_class', not 'current_container', when creating a GlobalAttribute. 2005-04-08 Alp Toker * pending.cs: The fix to #58413 failed to compile methods implementing interfaces with/without params modifiers and vice versa, even though params modifiers aren't part of the signature. Make the modifier check less strict as in csc. 2005-04-07 Abin Thomas Anoob V E Harilal P R Fix #58413. * pending.cs (TypeAndMethods.mods): New. Store the parameter modifiers of pending methods. (PendingImplementation.PendingImplementation): Initialize it. Add Parameter.Modifier [][] mods and initialize it with ParameterData. (PendingImplementation.InterFaceMethod): Repalce Type[] argument with ParameterData. Add check for modifiers. * class.cs (MethodData.Define): Update to changes. 2005-04-07 Raja R Harinath * ecore.cs (Expression.IsAccessorAccessible): Clarify code somewhat. 2005-04-07 Marek Safar * class.cs (PropertyMethod.Define): Check private accessor in abstract property. * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't allow RequiredAttribute * rootcontext.cs, * typemanager.cs: Registered RequiredAttributeAttribute. 2005-04-06 Marek Safar * class.cs (VerifyMembers): Doesn't need EmitContext argument. Warning CS0169 is back at level 3. (IMethodData.SetMemberIsUsed): New method. * decl.cs (IsUsed): New value; moved from FieldBase.Status (SetMemberIsUsed, IsUsed): New methods, encapsulate IsUsed. * delegate.cs (ResolveMethodGroupExpr): Call SetMemberIsUsed. * ecore.cs (FieldExpr.ResolveMemberAccess): Call SetMemberIsUsed for contants. (PropertyExpr.ResolveAccessors): Call SetMemberIsUsed when delegate is used. * expression.cs (OverloadResolve): Call SetMemberIsUsed. when method is used. * rootcontext.cs (RootContext.EmitCode): Call VerifyMembers in extra run to avoid the problems with nested types. 2005-04-05 Abin Thomas Anoob V.E Harilal P.R Raja R Harinath Fix #73820. * delegate.cs (Define): Emit ParamArrayAttribute for 'params' attribute. * typemanager (GetConstructor): Make public. 2005-04-05 John Luke Raja R Harinath Fix #62232. * typemanager.cs (IsUnmanagedType): Check non-public fields of a struct too. Return false quicker in a few cases. (VerifyUnManaged): Use it. 2005-04-05 Raja R Harinath Fix #74041. * statement.cs (Block.Resolve): Initialize 'unreachable' to false, not 'unreachable_seen'. 2005-04-04 Marek Safar * attribute.cs (Attribute.GetValue): Removed unused. * codegen.cs (CodeGen.TrimExt): Removed unused. * cs-parser.jay (output): Removed unused. * cs-tokenizer.cs (hex_digits): Removed unused. * enum.cs (MapToInternalType, GetEnumeratorName): Removed unused. * expression.cs (Indirection.LoadExprValue): Removed unused. (ArrayCreation.ExpressionToArrayArgument): Removed unused. * iterators.cs (Iterator.param_types): Removed unused. * statement.cs (Goto.block): Removed unused. (ToplevelBlock.did): Removed unused. (Switch.ResolveConstantSwitch): Removed unused. 2005-04-01 Ben Maurer * rootcontext.cs: Allow mcs to bootstrap with the compilation resetting thingy. 2005-04-01 Raja R Harinath Fix #74232 and cs0208-3.cs. * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0208 check. * typemanager.cs (IsUnmanagedType): Don't allow 'object' as an unmanaged type. Don't use FieldBuilders when 't' is a TypeBuilder. Use ModFlags and MemberType fields. * class.cs (MemberBase.member_type): Rename from MemberType. (MemberBase.MemberType): New property. Determines member_type on demand. (MemberBase.DoDefine): Don't initialize MemberType here. (FieldMember.Define): Likewise. 2005-04-01 Marek Safar Fix #74241 * class.cs (Event.Emit): Call Add/Remove emit even for interfaces. Attributes are emitted there. 2005-04-01 Raja R Harinath * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a keyword in 'partial enum' too. * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum' is not allowed). Report from Kamil Skalski . Fix #74309. * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can have partial containers too. * ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning in block' checks to Block.CheckInvariantMeaningInBlock. * statement.cs (Block.GetKnownVariableInfo): Make private. (Block.IsVariableUsedInChildBlock): Remove. (Block.IsVariableUsedInBlock): Likewise. (Block.CheckInvariantMeaningInBlock): New. Show location of conflicting declaration. (Block.AddVariable): Make error messages less long-winded and more specific. Show location of conflicting declaration. * parameter.cs (Parameters.Location): New readonly property. 2005-03-31 Raja R Harinath Clean up semantics of invoking ResolveMemberAccess. * ecore.cs (SimpleName.DoSimpleNameResolve): If a MemberExpression can have an instance, ensure that we pass in a non-TypeExpression to ResolveMemberAccess. Tighten up IdenticalNameAndTypeName checks. (MemberExpr.DoSimpleNameResolve): Remove type_is_inferred argument. Update to changes and simplify. (FieldExpr.Emitinstance): Remove CS0120 check. (PropertyExpr.EmitInstance): Likewise. * expression.cs (Argument.Resolve): Likewise. (Invocation.DoResolve): Update to changes in semantics of InstanceExpression. 2005-03-31 Marek Safar Fix #74241 * class.cs (AbstractPropertyEventMethod.EmitMethod): Enable emit method customization. * decl.cs (MemberCache.AddMethods): Fix infinite loop. 2005-03-31 Raja R Harinath Fix difference in behaviour with commandline invocation. * driver.cs (Driver.Reset): New. (CompilerCallableEntryPoint): Call it. * statement.cs (If.Resolve): Avoid spurious "uninitialized variable" warnings if the boolean expression failed to resolve. 2005-03-30 Sebastien Pouliot * attribute.cs: Fix the union of several permissions when some of them are unrestricted (so the result isn't an unrestricted permission set). Fix #74036. 2005-03-30 Raja R Harinath * ecore.cs (MemberExpr): New class. Convert from interface IMemberExpr. (MemberExpr.ResolveMemberAccess): Refactor and move here from MemberAccess.ResolveMemberAccess. Tighten up pre-conditions and error checks. (MethodGroupExpr, FieldExpr, PropertyExpr, EventExpr): Update. (MethodGroupExpr.IsExplicitImpl): Remove. (Expression.GetFieldFromEvent): Remove. (SimpleName.MemberStaticCheck): Remove. (SimpleName.DoSimpleNameResolve): Update to changes. * expression.cs (MemberAccess.ResolveMemberAccess): Refactor. (MemberAccess.IdenticalNameAndTypeName): Remove. (MemberAccess.error176): Move to MemberExpr. (MemberAccess.DoResolve): Update to changes. (BaseAccess.DoResolve): Likewise. 2005-03-30 Marek Safar C# 2.0 Conditional attribute class implementation * attribute.cs (AttributeTester.IsAttributeExcluded): New method. Analyzes class whether it has attribute which has ConditionalAttribute and its condition is not defined. * class.cs (Class.ApplyAttributeBuilder): Add IsAttributeExcluded check. (Class.IsExcluded): New method. Search for at least one defined condition in ConditionalAttribute of attribute class. 2005-03-30 Raja R Harinath * ecore.cs (PropertyExpr): Derive from Expression, not ExpressionStatement. (PropertyExpr.EmitStatement): Remove. 2005-03-29 Raja R Harinath Fix #74060. * expression.cs (MemberAccess.ResolveMemberAccess): Allow the internal field "value__" of an enum be private. The examples for "value__" that I found on MSDN all used FieldAttributes.Private. * decl.cs (MemberCache.AddMethods): Use C# terminology in warning. Don't mention IL method attribute names. Fix #47991. Remove a TODO. * statement.cs (Block.Toplevel): Make into a field. (Block.Parameters): Move into ToplevelBlock. (Block.known_variables): Rename from child_variable_names. (Block.Block): Remove variants that take Parameters. Initialize 'Toplevel' with the immediately surrounding toplevel block. (Block.AddKnownVariable): Rename from AddChildVariableName. Add a LocalInfo parameter. (Block.GetKnownVariableInfo): New. (Block.IsVariableNameUsedInChildBlock): Update. (Block.IsVariableNameUsedInBlock): New. Checks if a name is used in the block, even though it may not be in scope. (Block.AddVariable): Remove Parameters parameter. Use Toplevel.Parameters instead. (Block.AddConstant): Remove Parameters parameter. (Block.GetParameterReference): Update to use Toplevel.Parameters. (Block.IsParamaterReference): Likewise. (Block.IsLocalParameter): Likewise. Simplify a lot. (ToplevelBlock.Parameters): New. Moved from Block. (ToplevelBlock.ToplevelBlock): Update to changes. Always initialize Parameters to a non-null value. * cs-parser.jay: Update to changes. * ecore.cs (SimpleName.SimpleNameResolve): Emit cs0136 error for simple names that mean different things in the same block. Use Block.IsVariableNameUsedInBlock. 2005-03-28 Raja R Harinath * typemanager.cs (TypeHandle.BaseType): Make into an IMemberContainer. (TypeHandle.TypeHandle): Use LookupMemberCache rather than GetTypeHandle. It is possible for a reflected type to derive from a TypeBuilder (e.g., int[] derives from the TypeBuilder System.Array during mscorlib compilation). * decl.cs (MemberCache.MemberCache): If the base cache doesn't contain a method_hash, don't create one either. Don't create a deep copy of the base cache's method_hash. (MemberCache.SetupCache): Rename back from DeepCopy. (MemberCache.AddMethods): Rewrite, now that method_hash isn't already initialized. If we see an override function, add its underlying base virtual function to the member_hash too. * enum.cs (Enum.LookupEnumValue): Remove debugging code. 2005-03-26 Raja R Harinath Fix #73038. * assign.cs (Assign.DoResolve): When the RHS of an assignment fails to resolve, ensure that the LHS is still resolved as an lvalue. 2005-03-25 Raja R Harinath * enum.cs (Enum.DefineType): Set ec.InEnumContext and ec.ContainerType. (Enum.current_ec): Remove. (Enum.LookupEnumValue): Remove EmitContext argument. Just uses the one created during DefineType. (Enum.FindMembers): Update. * expression.cs (MemberAccess.DoResolve): Update. 2005-03-22 Marek Safar * assign.cs (Assign.DoResolve): Check for CS1717 when source and target are same (uses Equals). * expression.cs (LocalVariableReference, ParameterReference, This): Implemented Equals, GetHashCode. * statement.cs (Block.GetParameterReference): Removed useless local variable. 2005-03-22 Raja R Harinath Fix cs0128.cs * statement.cs (Block.AddVariable): Ensure that we skip implicit blocks before deciding whether the error is cs0136 or cs0128. * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl. (using_alias_directive, using_namespace_directive): Pass MemberName, not an expression to Namespace.UsingAlias and Namespace.Using. (MakeName): Use the MemberName of the namespace. * namespace.cs (Namespace.MemberName): New. (UsingEntry.UsingEntry): Take a MemberName, not an expression. (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias): Likewise. * decl.cs (MemberName.Name): Make readonly. (MemberName.FromDotted): New "constructor". (MemberName.Equals, MemberName.GetHashCode): Implement overrides. (MemberCore.Name): Compute from MemberName on demand. (MemberCore.SetMemberName): Provide a way to change the MemberName. (MemberCore.AddToContainer): Don't take a fullname parameter. * class.cs (TypeContainer.AddToMemberContainer): Don't add the fully qualified name of the container to the member name. (TypeContainer.AddToTypeContainer): Use a fully qualified name only if the type is a member of the root container. (TypeContainer.AddMethod, TypeContainer.AddProperty): Use MemberName.Left rather than searching for an embedded ".". (PartialContainer.CreatePart): Update to changes in RootContext. (MemberBase.ShortName): Turn into a property. Use MemberCore.SetMemberName. (MemberBase.ExplicitInterfaceName): Remove. (MemberBase.UpdateMemberName): Remove. (AbstractPropertyEventMethod.UpdateName): Use SetMemberName. (PropertyBase.SetMemberName): New override. * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key. (Tree.GetDecl): New. (Tree.AllDecls): Rename from Decls. * attribute.cs, enum.cs, report.cs: Update to changes. * driver.cs (MainDriver): Use MemberName.FromDotted on RootContext.MainClass. 2005-03-21 Marek Safar * class.cs (FixedField.Define): Check for CS1664 and more sanity checks. * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708. 2005-03-18 Marek Safar * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for property accessor modifiers. * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply fixed buffer attribute (CS1716). (PropertyMethod.HasCustomAccessModifier): When property accessor has custom modifier. * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor modifiers. (PropertyExpr.DoResolveLValue): Add CS0272. 2005-03-17 Miguel de Icaza * convert.cs: When converting to a pointer, use the proper Conv.U or Conv.I depending on the source data type. * cs-tokenizer.cs: Make the size for large decimal constants, fixes #72957. 2005-03-17 Martin Baulig * anonymous.cs (AnonymousMethod.method_modifiers): Change default from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260. 2005-03-17 Martin Baulig * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type to bool so we can return an error condition. (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod() returned an error. 2005-03-16 Zoltan Varga * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping attributes. 2005-03-16 Raja R Harinath Remove TypeManager.LookupType and TypeManager.LookupTypeDirect. Refactor to avoid traversing the list of assemblies, and to avoid string concatenation. * typemanager.cs (guid_attr_type): Remove. (negative_hits, pointers, references): Remove hashes. (type_hash): New. (GetConstructedType): New. Uses type_hash to handle constructed types (arrays, references, pointers). (GetReferenceType, GetPointerType): Use it. (GetNestedType): New. Uses type_hash to handle nested types of reflected types. (LookupType, LookupTypeDirect): Remove. (CoreLookupType): Inline parts of old LookupTypeDirect code. Use 'types' hash and LookupTypeReflection directly. (params_string, params_object): Use GetConstructedType. * namespace.cs (Namespace.cached_types): New. Cache of reflected top-level types. (Namespace.Lookup): Use cached_types. (NamespaceEntry.LookupNamespaceOrType): Inline the functionality provided by old TypeManager.LookupType. * rootcontext.cs (MakeFQN): Remove. * decl.cs (DeclSpace.MakeFQN): Likewise. (DeclSpace.LookupType): Use TypeManager.GetNestedType. * expression.cs (ComposedCast.DoResolveAsTypeStep): Use TypeManager.GetConstructedType. * tree.cs (decl_ns_hash, LookupByNamespace): Remove. 2005-03-15 Marek Safar * class.cs (MethodCore.CheckBase): Report CS1715 for properties and indexers. * cs-parser.jay: Reports CS1527 for any namespace element. * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate): Added CS0407. * expression.cs (ParameterReference.IsAssigned): Changed error to CS0269. (Error_WrongNumArguments): Moved CS0245 detection here. * statement.cs (Return.Resolve): Add CS1622 report. 2005-03-11 Marek Safar * class.cs (StaticClass.DefineContainerMembers): Added CS0720. 2005-03-11 Zoltan Varga * attribute.cs expression.cs: Get rid of some allocations. 2004-03-11 Atsushi Enomoto * doc.cs : just eliminate the latest change. 2004-03-10 Atsushi Enomoto * doc.cs : commented out the latest change. It breaks xml-030.cs 2004-03-10 Atsushi Enomoto * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will fail. So invoke CreateType() in FindDocumentedType(). 2004-03-10 Atsushi Enomoto * cs-tokenizer.cs : added IsKeyword(). * doc.cs : Detect keyword incorrectly used as identifier. Allow identifiers prefixed by @. 2005-03-10 Marek Safar * attributes.cs (Attributes.Emit): Continue after CheckTargets. It caused exception in namespace resolving (again!). * class.cs (Class.ctor): Removed exit. (PropertyMethod.ctor): ditto. * codegen.cs (Codegen.Reset): Reset static data. (Codegen.ResolveTopBlock): Forward error status from ResolveMeta. * cs-tokenizer.cs (Cleanup): Removed. * driver.cs (GetSystemDir): Rewrote to one line command. It caused problem with unloaded dynamic modules. (UnixParseOption): Removed Exit. (CompilerCallableEntryPoint.InvokeCompiler): Make static. (CompilerCallableEntryPoint.Reset): Reset suitable static data. Now can be mcs used as library. * ecore.cs (Expression.ResolveBoolean): Use Location.Null for empty location. * location.cs (Reset): Reset static data. * namespace.cs (Reset): Reset static data. * report.cs (Report.Reset): Reset static data. * rootcontext.cs (RootContext.Reset): Reset static data. * tree.cs (RootTypes.ctor): Use Location.Null * typemanager.cs (TypeManager.Reset): Reset static data. (CoreLookupType): Removed Exit. (TypeHandle.Reset): Reset static data. 2005-03-10 Raja R Harinath Fix #73516. * typemanager.cs (ComputeNamespaces): Import namespaces from referenced modules too. 2005-03-09 Raja R Harinath * class.cs (TypeContainer.AddToMemberContainer): Use "." rather than '.'. 2005-03-09 Raja R Harinath * decl.cs (DeclSpace.LookupType): Don't loop but recurse into enclosing DeclSpace. This ensures that a name-lookup populates more caches and there are fewer 'TypeExpression's. Carve out nested type lookup into ... (LookupNestedTypeInHierarchy): ... this. 2005-03-09 Raja R Harinath Clean up a few partial-class semantics. Fixes test-357.cs and cs1618-2.cs. * cs-parser.jay (struct_declaration): Use 'current_class' as parent of newly-created struct. Remove call to Register (). Use 'pop_current_class' to complete handing the current struct. (interface_declaration): Likewise. (class_declaration): Likewise. (enum_declaration): Use 'current_class' as parent of newly created enum. (delegate_declaration): Likewise. (pop_current_class): New function. This is used to handle closing up the 'current_class' and 'current_container', and pointing them to the enclosing class/container. (CSharpParser): Initialize 'current_class' too. * decl.cs (MemberCore): Add check for invariant: a partial container is not a parsed entity, and thus does not enclose any parsed members. (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'. (DeclSpace.BaseTypeExpr): Use it. (DeclSpace.LookupType): Add check for invariant. * class.cs (TypeContainer): Add check for invariant: a nested class should have the same NamespaceEntry as its enclosing class. (TypeContainer.EmitFieldInitializers): Make virtual. (TypeContainer.DefineDefaultConstructor): Adhere to invariant in MemberCore. (TypeContainer.Register): Remove. (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to null. Use TypeResolveEmitContext for resolving base types and interfaces. Move initialization of Parts.TypeBuilder here from ... (TypeContainer.DefineNestedTypes): ... here. (PartialContainer): Take a Namespace not a NamespaceEntry. (PartialContainer.Create): Don't use Register. Call the appropriate Add... function directly. (ClassPart): Take both the PartialContainer and the enclosing class as constructor arguments. (ClassPart.EmitFieldInitializers): Override. (ClassPart.PartFindNestedTypes): Remove. (FieldBase.GetInitializerExpression): Resolve the initializer expression in the emit context of the enclosing class. * tree.cs (RootTypes): Remove Register (). 2005-03-08 Marek Safar * cs-parser.jay: Removed CS0134. * driver.cs: Removed CS1901. * expression.cs (SizeOf.DoResolve): Don't report CS0233 for predefined types. 2005-03-07 Duncan Mak * codegen.cs (Save): Catch UnauthorizedAccessException as well. Fixes bug #73454. 2005-03-07 Marek Safar * cs-tokenizer.cs (xtoken): Add CS1035. * class.cs (MethodData.Define): Add CS0683. (FieldMember.ctor): Add CS0681. 2005-03-07 Raja R Harinath * ecore.cs (SimpleName.DoResolve): Rename from SimpleName.DoResolveAllowStatic. (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument. Pass 'intermediate' flag to MemberStaticCheck. (SimpleName.MemberStaticCheck): Skip "static check" only in case of "intermediate" lookups via MemberAccess. (SimpleName.IdenticalNameAndTypeName): New. Carved out of ... * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this. 2005-03-07 Raja R Harinath Fix #73394. * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that slipped in because of variable names that are identical to a builtin type's BCL equivalent ('string String;', 'int Int32;'). (PropertyExpr.EmitInstance): Likewise. 2005-03-04 Marek Safar * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635. * report.cs (warning_ignore_table): Made public. 2005-03-04 Raja R Harinath Fix #73282. * class.cs (MethodData.Emit): Pass 'container' to container.GetObsoleteAttribute instead of 'container.Parent'. 2005-03-03 Marek Safar * cs-parser.jay: Add 1534 error test. * iterators.cs (Yield.CheckContext): Add error 1629. (Iterator.ctor): Save unsafe modifier. (MoveNextMethod.DoEmit): Restore unsafe context. * namespace.cs (UsingAlias): Better error message. 2005-03-03 Dan Winship * convert.cs (Error_CannotImplicitConversion): fix two bugs in the warning message [#73219] 2005-03-03 Raja R Harinath Fix compile with MCS 1.0.0.0. * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and w_restore to not depend on string constant folding. 2005-03-03 Raja R Harinath * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move CS0246 check to users who passed 'silent = false'. * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246 check. (SimpleName.SimpleNameResolve): Update. * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check. (MemberAccess.IdenticalNameAndTypeName): Update. * doc.cs (FindDocumentedTypeNonArray): Update. 2005-03-03 Raja R Harinath * codegen.cs (EmitContext): Remove ResolvingTypeTree. * parameters.cs (ComputeAndDefineParameters): Remove. * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree. * delegate.cs (Define): Don't invoke ComputeAndDefineParameters. Use GetParameterInfo. 2005-03-02 Marek Safar * report.cs (StaticClass.DefineContainerMembers): Add warning 628. 2005-03-02 Raja R Harinath Unify DeclSpace.LookupType and DeclSpace.FindType. * decl.cs (DeclSpace.FindNestedType): New virtual function. This is in charge of defining nested types on demand. (DeclSpace.LookupType): Use it when the current_type is a TypeBuilder. Use LookupTypeDirect for reflected types. (DeclSpace.FindType): Remove. (DeclSpace.LookupInterfaceOrClass): Likewise. (DeclSpace.DefineTypeAndParents): Likewise. * ecore.cs (SimpleName.ResolveAsTypeStep): Just call DeclSpace.LookupType. * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType. * typemanager.cs (LookupType): Simplify. (AddUserType): Remove type from negative_hits. * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect. * class.cs (TypeContainer.FindMembers): Move handling of nested types ... (TypeContainer.FindMembers_NestedTypes): ... here. (TypeContainer.FindNestedType): Implement override. (ClassPart.FindNestedType): Delegate to PartialContainer. (ClassPart.PartFindNestedType): Looks up the nested types of the part alone. 2005-03-02 Martin Baulig * class.cs (TypeContainer.DoDefineMembers): We also need a default static constructor in static classes. 2005-03-01 Zoltan Varga * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or sizeParamIndex is not specified. 2005-03-01 Marek Safar Fix #73117 * report.cs (WarningMessage.IsEnabled): Missing null check. 2005-02-28 Marek Safar * attribute.cs (DefinePInvokeMethod): Fix, all data are stored in the fields and not in the properties. 2005-02-28 Zoltan Varga * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex fields as well. 2005-02-28 Marek Safar * attribute.cs: Small refactoring (improved robustness). (ImplOptions, UnmanagedType, UsageAttribute): Removed members. (ValidateGuid): Removed. (Resolve): Removed referenced to above mentioned. (GetAttributeUsage): Made private and changed to work without class assistance. (GetIndexerAttributeValue): Don't crash. (GetConditionalAttributeValue): Ditto. (GetClsCompliantAttributeValue): Ditto. (ExtractSecurityPermissionSet): All attributes exceptions are error 648. (GetPropertyValue): New helper. (GetMethodImplOptions): New method. (DefinePInvokeMethod): Reuse common code. Implemented handling of some missing properties. * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated. (Method.ApplyAttributeBuilder): Updated. * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared exception. 2005-02-28 Raja R Harinath Fix #73052. * report.cs (Report.SymbolRelatedToPreviousError): Handle non-simple types (array, pointer, reference). 2005-02-28 Marek Safar * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548 * class.cs (MethodCore.IsDuplicateImplementation): Special error for operators. (Method.CheckBase): Catch wrong destructor here. (MethodData.Define): Add errors 550, 668. * cs-tokenizer.cs (PreProcessPragma): Add warning 1634. * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code. * pending.cs (VerifyPendingMethods): Add error 551. * typemanager.cs (CSharpName): Next error report helper. 2005-02-25 Marek Safar * attribute.cs (Atttribute.Resolve): Add cache for parameter-less attributes. Removed useless attribute double check. It saves almost 2MBs for corlib. 2005-02-25 Raja R Harinath Fix #72924. * statement.cs (ExpressionStatement.Resolve): Make robust to being called twice in case of error. 2005-02-23 Chris Toshok Fix compiler portions of #72827. * statement.cs (Block.Emit): call Begin/EndScope on the EmitContext instead of the ILGenerator. * codegen.cs (EmitContext.BeginScope): new method, call ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if we have one.) (EmitContext.BeginScope): same, but EndScope and CloseScope * symbolwriter.cs (SymbolWriter.OpenScope): get the current il offset and call the superclass's OpenScope(int) with it. (SymbolWriter.CloseScope): get the current il offset and call superclass's CloseScope(int) with it. 2005-02-23 Marek Safar * anonymous.cs (AnonymousMethod.Compatible): Fixed to report CS1677 for out and ref as well. * class.cs (Method.Define): Add error CS1599 detection. * cs-parser.jay: Add CS1609, CS1670, CS1627 detection. * cs-tokenizer.cs (xtoken): Add error CS1646 detection. * delegate.cs (Delegate.Define): Add error CS1599 detection. * support.cs.cs (ModifierDesc): New helper method. 2005-02-23 Raja R Harinath Abin Thomas Anoob V E Harilal P R Fix #57851, #72718. * class.cs (ConstructorBuilder.Resolve): Make sure that the second MemberLookup (used for error reporting) actually returns a result. Fix error report number (122, not 112). 2005-02-22 Abin Thomas Anoob V E Harilal P R Fix #71134. * pending.cs (PendingImplementation.GetAbstractMethods): Find NonPublic members too. 2005-02-22 Marek Safar * expression.cs.cs (ConditionalLogicalOperator.DoResolve): Fixed error 217. * class.cs (MethodCore.CheckMethodAgainstBase): Add error 239 report. 2005-02-21 Raja R Harinath Fix #68955. * expression.cs (Invocation.IsApplicable): Make public. (Invocation.IsParamsMethodApplicable): Likewise. * delegate.cs (Delegate.VerifyApplicability): Don't use Invocation.VerifyArgumentCompat for parameter applicability testing. Use Invocation.IsApplicable and Invocation.IsParamsMethodApplicable. 2005-02-21 Marek Safar * ecore.cs (PropertyExpr.DoResolve): Add error 214 report. * class.cs (Operator.Define): Add error 217 report. 2005-02-21 Raja R Harinath * namespace.cs (UsingEntry.Resolve): Undo change below. 2005-02-21 Raja R Harinath Fix #72756. * ecore.cs (Expression.MemberLookupFailed): Add argument to disable the error message when the extended MemberLookup also fails. (Expression.MemberLookupFinal): Update. (SimpleName.DoSimpleNameResolve): Update. * expression.cs (MemberAccess.ResolveNamespaceOrType): Don't use MemberLookupFinal. (New.DoResolve): Update. (BaseAccess.CommonResolve): Update. 2005-02-21 Raja R Harinath Fix #72732. * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had occured previously, don't resolve again. 2005-02-21 Marek Safar Fix #69949 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext argument. Call ResolveAttributeUsage for unresolved. when types doesn't match ctor arguments. * class.cs (DoDefineMembers.TypeContainer): Removed safety check for nested attribute classes. (Class.attribute_usage): Removed. (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute for attribute class. * ecore.cs (IsAttribute): Removed. * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry. * rootcontext.cs (RegisterAttribute): Removed, attributes are now normal types. (attribute_types): Removed. (EmitCode): Global attributes are emited as the latest. 2005-02-18 Marek Safar * class.cs (EmitFieldInitializers): Don't emit field initializer for default values when optimilization is on. * constant.cs (Constant.IsDefaultValue): New property. * driver.cs: Add /optimize handling. * constant.cs, * ecore.cs, * literal.cs: Implement new IsDefaultValue property. * rootcontext.cs (Optimize): New field, holds /optimize option. 2005-02-18 Raja R Harinath Fix crasher in re-opened #72347. * namespace.cs (Namespace.Lookup): Return null if DeclSpace.DefineType returns null. Fix #72678. * expression.cs (Argument.Resolve): Handle a case of CS0120 here. 2005-02-18 Raja R Harinath Fix remainder of #63202. Change semantics of DoResolveLValue: it now returns null if it cannot resolve to an lvalue. * ecore.cs (Expression.DoResolveLValue): Return 'null' by default. (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue returned null. Remove check for SimpleName. (EventExpr.DoResolveLValue): New. * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New. * expression.cs (Argument.Error_LValueRequired): New. Move CS1510 error from ... (Argument.Resolve): ... here. Use it. Use DoResolveLValue to avoid CS0131 error. (Unary.ResolveOperator): Move CS0211 check ... (Unary.DoResolve): ... here. Use DoResolveLValue to avoid CS0131 error. (Unary.DoResolveLValue): Simplify. (AddressOf.DoResolveLValue): New. (ArrayAccess.DoResolveLValue): New. 2005-02-16 Marek Safar * attribute.cs (Attribute.Resolve): Add arguments casting for when types doesn't match ctor arguments. 2005-02-16 Raja R Harinath Fix parts of #63202. * expression.cs (UnaryMutator.ResolveOperator): Remove redundant lookup of operator in base type. Ensure that all checks happen when the operator resolves to an "op_..." method. 2005-02-15 Raja R Harinath Fix #71992. * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add 'ignore_cs0104' parameter. Pass it to ... (NamespaceEntry.Lookup): ... this. * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter. * ecore.cs (SimpleName.ResolveAsTypeStep): Update. (TypeLookupExpression.DoResolveAsTypeStep): Update. * expression.cs (MemberAccess.IdenticalNameAndTypeName): Update. Request that cs0104 errors be ignored. (ComposedCast.ResolveAsTypeStep): Update. 2005-02-14 Raja R Harinath Fix #59209. * expression.cs (Invocation.BetterFunction): Remove support for comparing virtual functions and their overrides. (Invocation.IsOverride): New. (Invocation.OverloadResolve): Don't consider 'override' functions during candidate selection. Store them in a lookaside list. If the selected method is a 'virtual' function, use the list to find any overrides that are closer to the LHS type. 2005-02-14 Marek Safar * expression.cs (New.DoResolve): Add complex core type reduction. (New.Constantify): Converts complex core type syntax like 'new int ()' to simple constant. 2005-02-14 Raja R Harinath * decl.cs (EntryType.EntryType): New constructor to create an updated copy of a cache entry. (MemberCache.AddMethods): Use it. (MemberCache.ClearDeclaredOnly): Remove. (MemberCache.MemberCache): Update. 2005-02-11 Miguel de Icaza * codegen.cs (EmitContext): Introduce the `MethodIsStatic' variable. This one is represents the actual low-level declaration of the method, as opposed to the semantic level `IsStatic'. An anonymous method which is hosted into a static method might be actually an instance method. IsStatic would reflect the container, while MethodIsStatic represents the actual code generated. * expression.cs (ParameterReference): Use the new MethodIsStatic instead of IsStatic. * anonymous.cs (AnonymousMethod.Compatible): Pass the Modifiers.STATIC to the Anonymous' Method EmitContext if static is set on the current EmitContext. * expression.cs (Cast): Overload DoResolveLValue so we can pass resolve our casted expression as an LValue. This triggers the proper LValue processing that is later required by Assign. This fixes 72347. * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903. 2005-02-11 Marek Safar C# 2.0 Fixed buffer implementation * anonymous.cs: Update after RegisterHelperClass renaming. * attribute.cs (AttributeTester.fixed_buffer_cache): Cache of external fixed buffers. (AttributeTester.GetFixedBuffer): Returns IFixedBuffer implementation if field is fixed buffer else null. * class.cs (TypeContainer.AddField): Accept FieldMember instead of Field. (FieldBase.IsFieldClsCompliant): Extracted code from VerifyClsCompliance descendant customization. (FixedField): New class handles fixed buffer fields. (FixedFieldExternal): Keeps information about imported fixed buffer. (IFixedField): Make access to internal or external fixed buffer same. * cs-parser.jay: Add fixed buffer parsing. * ecore.cs (FieldExpr.Emit): Add special emit case for fixed buffer. * expression.cs (Indirection): Extended implementation to accept fixed buffer field. (PointerArithmetic.Emit): Get element from fixed buffer as well. (ElementAccess.MakePointerAccess): Get type as parameter. (DoResolve): Add fixed buffer field expression conversion. (DoResolveLValue): Ditto. (FixedBufferPtr): New class. Moved most of original ArrayPtr. (ArrayPtr): Derives from FixedBufferPtr. (ArrayPtr.Emit): Add extra emit for array elements. * flowanalysis.cs.cs (StructInfo): Use FieldMember. * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute for compiler generated types. (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass. * statement.cs (Fixed): Refactored to be easier add fixed buffer and consume less memory. (Fixed.Resolve): Add fixed buffer case. * typemanager.cs (compiler_generated_attr_ctor, fixed_buffer_attr_ctor): Add new 2.0 compiler attributes. (HasElementType): Add our own implementation to work on every runtime. 2005-02-11 Miguel de Icaza * anonymous.cs (CaptureContext): Track whether `this' has been referenced. * expression.cs (This.ResolveBase): Call CaptureThis. Before we only captured `this' if it was implicitly done (instance methods/variables were used). * codegen.cs (EmitContext.CaptureThis): New method to flag that `this' must be captured. 2005-01-30 Miguel de Icaza * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder is null it means that there has been no need to capture anything, so we just create a sibling. Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses' Just a partial fix. The other half is fairly elusive. 2005-02-10 Raja R Harinath Fix #52586, cs0121-4.cs. * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take and return a hashtable. (MemberCache.ClearDeclaredOnly): New. (MemberCache.MemberCache): Update to change. Make a deep copy of the method_hash of a base type too. (MemberCache.AddMethods): Adapt to having a deep copy of the base type methods. Overwrite entries with the same MethodHandle so that the ReflectedType is correct. The process leaves in base virtual functions and their overrides as distinct entries. (CacheEntry): Now a class instead of a struct. It shouldn't alter matters since it was boxed in a ArrayList before. (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly' modifier. * expression.cs (Invocation.BetterFunction): Simplify. Handle the case of a virtual function and its override (choose the overload as better). (Invocation.OverloadResolve): Avoid 'override' members during 'applicable_type' calculation. 2005-02-09 Raja R Harinath Combine two near-redundant caches. * typemanager.cs (method_params): Rename from method_internal_params. (TypeManager.GetParameterData): New. Replace Invocation.GetParameterData. (TypeManager.LookupParametersByBuilder): Remove. * expression.cs (Invocation.method_parameter_cache): Remove. (Invocation.GetParameterData): Remove. Update to changes. * anonymous.cs, attribute.cs, convert.cs, delegate.cs: Update to changes. 2005-02-08 Raja R Harinath Fix #72015. * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if TypeManager.multicast_delegate_type is null, resolve it by looking up "System.MulticastDelegate". * rootcontext.cs (RootContext.ResolveCore): Simplify. 2005-02-07 Abin Thomas (NOSIP) Anoob V.E (NOSIP) Harilal P.R (NOSIP) Fix cs0164.cs. * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'. (LabeledStatement.AddReference): New. Set 'referenced'. (Goto.Resolve): Use it. 2005-02-05 John Luke * driver.cs: remove duplicate -doc line in Usage () 2005-02-04 Raja R Harinath * location.cs (Location.AddFile): Fix CS2002 error report. 2005-02-02 Martin Baulig * delegate.cs (Delegate.DefineType): Report an internal error if TypeManager.multicast_delegate_type is null. See bug #72015 for details. 2005-02-02 Raja R Harinath Fix a crasher in a variant of #31984. * const.cs (Constant.CheckBase): New override that defers the new-or-override check in case the base type hasn't been populated yet. (Constant.Define): Ensure the new-or-override check is performed. 2005-02-01 Duncan Mak * const.cs (LookupConstantValue): Check that `ce' is not null before calling GetValue (). 2005-02-01 Raja R Harinath Fix test-334.cs (#69519). * cs-parser.jay (using_alias_directive): Pass in an expression to NamespaceEntry.UsingAlias. (using_namespace_directive): Pass in an expression to NamespaceEntry.Using. (namespace_name): Don't flatten to a string. * namespace.cs (NamespaceEntry.AliasEntry): Store an expression. (NamespaceEntry.AliasEntry.Resolve): Lookup using ResolveAsTypeStep. (NamespaceEntry.UsingEntry): Likewise. (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to changes. (NamespaceEntry.LookupForUsing): Remove. (NamespaceEntry.LookupNamespaceOrType): Add support for dotted names. (NamespaceEntry.Lookup): Remove support for dotted names. 2005-02-01 Raja R Harinath * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and split into two. (NamespaceEntry.ImplicitParent): Compute on demand. (NamespaceEntry.Doppelganger): New implicit namespace-entry that parallels the current. (NamespaceEntry.LookupForUsing): Use it. (NamespaceEntry.Lookup): If the current namespace-entry is implicit, don't search aliases and using tables. 2005-02-01 Raja R Harinath Fix #31984. * class.cs (TypeContainer.DoDefineMembers): Don't initialize BaseCache here. (TypeContainer.BaseCache): Compute on demand. (TypeContainer.FindMembers): Define constants and types if they're not already created. (FieldMember.Define): Move resetting of ec.InUnsafe before error check. * const.cs (Constant.Define): Make idempotent. 2005-01-29 Miguel de Icaza * pending.cs: Produce better code (no nops produced by using Ldarg + value). * pending.cs (PendingImplementation.DefineProxy): It was not `arg i - 1' it should be arg + 1. Fixes bug #71819. 2005-01-28 Raja R Harinath * attribute.cs (Attribute.CheckAttributeType): Make private non-virtual. (Attribute.ResolveType): Make virtual. (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify handling of RootContext.Tree.Types. 2005-01-27 Raja R Harinath Update attribute-handling to use the SimpleName/MemberAccess mechanisms. * cs-parser.jay (attribute): Pass in an expression to the constructors of Attribute and GlobalAttribute. * attribute.cs (Attribute): Take an expression for the name. (Attribute.ResolvePossibleAttributeTypes): New. Resolves the passed in attribute name expression. (Attribute.CheckAttributeType): Use it. * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New. * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ... (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent' argument to prevent error messages if the lookup fails. 2005-01-27 Marek Safar * expression.cs (Indirection): Implemented IVariable interface to support indirection in AddressOf operator. (PointerArithmetic.Emit): Add optimalization for case where result can be precomputed. 2005-01-26 Martin Baulig * class.cs (TypeContainer.AttributeTargets): Return the correct AttributeTargets depending on our `Kind' instead of throwing an exception; fixes #71632. 2005-01-26 Marek Safar Fix #71257 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for constant members. 2005-01-25 Raja R Harinath Fix #71602. * expression.cs (MemberAccess.DoResolve): Don't complain with cs0572 when the LHS of a member access has identical name and type name. 2005-01-25 Marek Safar Fix #71651, #71675 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from CreatePermission. Create custom PermissionSet only for PermissionSetAttribute. 2005-01-24 Marek Safar Fix #71649 * class.cs (StaticClass.DefineContainerMembers): Enable enums and delegates in static class. 2005-01-24 Martin Baulig * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're merging an implicit block, just use its reachability. * statement.cs (Block.Resolve): Make the unreachable code check work wrt. implicit blocks; see test-337 from #63842. 2005-01-21 Alp Toker * cs-parser.jay: destructor_declaration's container is PartialContainer not Class when partial types are used, so use Kind prop instead of 'is'. 2005-01-22 Miguel de Icaza * cs-parser.jay: Improve error reporting when an interface declares new types. 2005-01-20 Dick Porter * support.cs: SeekableStreamReader fix from Sandor Dobos (dobos_s@ibcnet.hu) to cope with Position setting when multibyte chars are read. Fixes bug 70369. 2005-01-20 Raja R Harinath * cs-parser.jay (catch_clause): Simplify current_block handling somewhat. 2005-01-17 Miguel de Icaza * convert.cs (ImplicitStandardConversionExists): Synchronize the code with ImplicitStandardConversion to handle the implicit conversion of method groups into valid delegate invocations. The problem is that in parameter handling we were using this code path. Fixes bug #64698 2005-01-19 Raja R Harinath * cs-parser.jay: Fix several infelicities. - Avoid assigning to the parser value stack. Code like '$3 = null' is unclean. Synthesize a value for the code block instead. - Avoid using oob_stack for storing location information. Use ... (_mark_): ... this. New (empty) rule. Saves the current location in $$. (foreach_statement): Avoid using oob_stack for current_block handling. Use technique used in for_statement and using_statement. Synthesize a value for the code block to store additional intermediate information. 2005-01-13 Miguel de Icaza * ecore.cs (IsAccessorAccessible): Accessibility to private fields of a different type is only allowed to private fields of a containing type, not on fields of a base class. See test-174.cs and error cs0122-9.cs 2005-01-13 Raja R Harinath Fix test-335.cs (bug #58126). * cs-parser.jay (argument): Split out non-expression parts of the rule into 'non_simple_argument'. (invocation_expression): Support parenthesized invocations with multiple arguments, and with single non-simple arguments. 2005-01-13 Raja R Harinath * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more places. 2005-01-12 Raja R Harinath Fix cs0038-1.cs, cs1640-6.cs. * ecore.cs (Expression.Resolve): Remove special-case for SimpleName in error-handling. (Expression.almostMatchedMembers): Relax access permission to protected. (Expression.MemberLookupFailed): Handle duplicates in almostMatchedMembers list. (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier. * expression.cs (New.DoResolve): Report CS1540 for more cases. * typemanager.cs (GetFullNameSignature): Use the MethodBase overload if the passed in MemberInfo is a MethodBase. 2005-01-12 Marek Safar Fix #70749 * attribute.cs (ExtractSecurityPermissionSet): Don't report error for non-CAS & merge permission sets properly. 2005-01-11 Raja R Harinath Improve standard-compliance of simple name and member access resolution. Fixes bugs #52697, #57200, #67520, #69519. * ecore.cs (FullNamedExpression): New abstract base class for Namespaces and TypeExpressions. (ResolveFlags.SimpleName): Remove. (SimpleName): Remove support for dotted names. (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to DeclSpace.FindType and DeclSpace.LookupType. (SimpleName.DoSimpleNameResolve): Remove support for dotted names. (Expression.ExprClassName): Make member function. * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being a namespace. Remove creation of dotted "SimpleName"s. (MemberAccess.DoResolve): Likewise. * decl.cs (DeclSpace.Cache): Make private. (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression. (DeclSpace.FindType): Update. (DeclSpace.LookupType): Move here from RootContext. Return a FullNamedExpression. * namespace.cs (Namespace): Derive from FullNamedExpression so that it can be part of expression resolution. (Namespace.Lookup): Return an FullNamedExpression. (NamespaceEntry.LookupAlias): Lookup aliases only in current namespace. * rootcontext.cs (NamespaceLookup): Remove. (LookupType): Move to DeclSpace. * attribute.cs (CheckAttributeType): Update. * doc.cs (FindDocumentedType): Remove allowAlias argument. (FindDocumentedTypeNonArray): Likewise. 2005-01-11 Raja R Harinath Fix cs0509.cs, cs1632.cs. * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass is the same as IsInterface. (TypeContainer.GetClassBases): Likewise. * statement.cs (LabeledStatement.ig): New field. (LabeledStatement.LabelTarget): Save ILGenerator which created the label. (LabeledStatement.DoEmit): Check that the label was created with the same ILGenerator. 2005-01-10 Marek Safar Fix #71058 * attribute.cs (GetMethodObsoleteAttribute): Need to transform accessors to its properties. * ecore.cs (PropertyExpr): Add AccessorTable to help track back from accessors to property. 2005-01-10 Marek Safar Fix #70722 * class.cs (MethodCore.CheckBase): Test base method obsoleteness only for overrides. 2005-01-08 Miguel de Icaza * attribute.cs: Check for null and empty strings. I have lost another battle to Paolo. 2005-01-07 Marek Safar Fix #70942 * class.cs (PropertyMethod): Set Parent field in ctors. (SetMethod.InternalParameters): Add unsafe switch hack. Override MarkForDuplicationCheck where it is appropriate. * decl.cs (MemberCore.MarkForDuplicationCheck): New method. It says whether container allows members with the same name. Base default is no. (DeclSpace.AddToContainer): Use MarkForDuplicationCheck. Removed is_method parameter. 2005-01-06 Duncan Mak * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040 because the previous change led to incorrect reporting of CS1032 ("Cannot define/undefine preprocessor symbols after first token in file"). Instead of using `tokens_seen' as the only flag that triggers CS1040, introduce `comments_seen'. This new flag is used to signify having seen comments on the current line, so it is unset after a newline. 2005-01-06 Atsushi Enomoto * doc.cs : When searching for a type, find nested type too. This fixes bug #71040. 2005-01-06 Atsushi Enomoto * doc.cs : - Warn missing member comment on those classes which also does not have doc comments. Fixed bug #71041. - Don't warn missing doc comment on default constructor. Fixed bug #71042. 2005-01-06 Duncan Mak * cs-tokenizer.cs (xtoken): After handling traditional C-style comments, set `tokens_seen' to true. This allows us to detect misplaced preprocessor directives (i.e. not at the beginning of the a line, nor after whitespaces). In that case, report error CS1040. This fixes bug #56460. * cs-parser.jay (interface_member_declaration): Add checks for IsExplicitImpl, and report CS0541 error if an interface member is defined as an explicit interface declaration. 2005-01-06 Marek Safar Fix #70817 * class.cs (PropertyMethod): Set Parent field in ctors. (SetMethod.InternalParameters): Add unsafe switch hack. * decl.cs (MemberCore.Parent): Cannot be readonly. 2005-01-06 Raja R Harinath * decl.cs (DeclSpace.ResolveType): Remove. (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr. Merge in code from ... (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove. * class.cs, enum.cs: Update to changes. 2005-01-06 Miguel de Icaza * anonymous.cs: Ensure that we init the scope of our parent if it has not been initialized yet. 2004-12-30 Duncan Mak * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here if field.FieldBuilder is null. Fixes #70758. * convert.cs: Fixed some typos and updated some of the comments. (ImplicitStandardConversionExists): (TryImplicitIntConversion): If `target_type' is an interface and the type of `ic' implements this interface, return true or a new BoxedCast instead of null. This fixes #70468. 2004-12-29 Duncan Mak * expression.cs (Argument.Emit): Check that Expr is IMemoryLocation before casting to it, and report CS1510 otherwise. This fixes #70402. 2004-12-21 Ben Maurer * statement.cs (Block.ThisVariable): remove the recursion here, to make the --profile more sane. 2004-12-17 Carlos Cortez * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe assembly, by JB Evain. 2004-12-17 Raja R Harinath * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs, rootcontext.cs, typemanager.cs: Make nomenclature consistent. "parent" refers to enclosing type/class. "base" refers to superclass. 2004-12-17 Raja R Harinath * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute): Ensure that we only have GlobalAttributes. * attribute.cs (Attribute.Emit): Make non-virtual. (GlobalAttribute.Emit): Remove. (Attribute.Resolve): Make virtual. (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry. (Attribute.GetConditionalAttributeValue): Take an EmitContext as the argument. Don't create one. (Attribute.GetObsoleteAttribute): Likewise. (Attribute.GetClsCompliantAttributeValue): Likewise. * class.cs, decl.cs: Update to changes. 2004-12-17 Marek Safar * delegate.cs (NewDelegate.DoResolve): Add error 149 report. * ecore.cs (Expression.MemberLookupFailed): Fixed error 143. * statement.cs (Foreach.Resolve): Add error 186 report. 2004-12-16 Marek Safar * expression.cs (Conditional.DoResolve): Add warning 429. * statement.cs (If.Resolve): Add warning 665. 2004-12-16 Raja R Harinath New invariant: RootContext.Tree.Types.NamespaceEntry == null except when in the parser, and in GlobalAttribute. * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry. * attribute.cs (GlobalAttribute.CheckAttributeType): Reset RootContext.Tree.Types.NamespaceEntry once work is done. (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets and resets RootContext.Tree.Types.NamespaceEntry. 2004-12-15 Marek Safar * cs-parser.jay: Don't create a block for every variable. 2004-12-14 Miguel de Icaza * location.cs: Provide extra information. * statement.cs: The instance is not `ldarg_0.THIS' when accessing variables from the captured environment, it is the ldarg_0. 2004-12-14 Marek Safar * cs-parser.jay: Changed warning level for 642 to 4 until Miguel find a conclusion. * class.cs: Changed warning level for 169 to avoid developer displeasure from warning flooding. It will be changed back when they fix most of current BCL warnings. * RootContext.cs: Pushed default WarningLevel to 3. * statement.cs: Removed unused variable. 2004-12-14 Marek Safar * class.cs (TypeContainer.GetClassBases): Add error 1521 report. (TypeContainer.MethodModifiersValid): Refactored to use MemberCore. Add error 502 report. (StaticClass.DefineType): Add error 441 report. (Class.AllowedModifiersProp): New virtual property as temporary extension to AllowedModifiers. (Class.DefineType): Add error 418 report. Moved ModFlags check here to share implementation with StaticClass and don't call virtual methods from ctor. * driver.cs (MainDriver): Add error 1558 test. * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662 report. Moved error 36 test here. * statement.cs (Throw.Resolve): Add error 724 report. * typemanager.cs: Add out_attribute_type core type. 2004-12-13 Marek Safar * class.cs (TypeContainer.VerifyClsCompliance): Add error 3018 report. (PropertyBase.VerifyClsCompliance): Add errror 3025 report. * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error 3017 report. * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021. * parameter.cs (ReturnParameter.ApplyAttributeBuilder): Add error 3023 report. (Parameter.ApplyAttributeBuilder): Add error 3022 report. * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake implementation. 2004-12-12 John Luke * driver.cs (AddArgs): take -- into account when adding arguments, fixes bug 65710 2004-12-12 Martin Baulig * expression.cs (Unary.TryReduceNegative): Added support for SByteConstant and ByteConstant. (Unary.Reduce): Check error values from TryReduceNegative(). 2004-12-10 Marek Safar * attributes.cs (Attribute.Resolve): Avoid multiple error report and report exception as error 182. 2004-12-10 Raja R Harinath * driver.cs (Main): Fix message when there are warnings. 2004-12-09 Miguel de Icaza * delegate.cs: Fixed my fix from yesterday, sorry about that. 2004-12-09 Marek Safar * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs: Reduced number of warnings. * class.cs (TypeContainer.VerifyClsCompliance): One if is enough. 2004-12-08 Miguel de Icaza * driver.cs: Removed message. * delegate.cs: Fix bug introduced in 1.1.x: 70219. 2004-12-08 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug. 2004-12-08 Martin Baulig * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003 instead of a CS3002 for properties and indexer. 2004-12-08 Martin Baulig * decl.cs (MemberName.ToString): Make this work again. 2004-12-08 Marek Safar * attribute.cs (Resolve): Add error 591 detection. * class.cs (FieldMember.Define): Add error 1547 detection. (Indexer.Define): Add error 620 detection. (Operator.Define): Add error 590 detection. * ecore.cs: Missing argument for error 79. * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611 detection. 2004-12-07 Marek Safar Fix #70106 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types only. 2004-12-07 Atsushi Enomoto * cs-parser.jay : handle doc comments on implicit/explicit operators. Some operator comments were suppressed. * doc.cs : Implicit/explicit operator name in doc comments are like "op_Explicit(type)~returnType", so added suffix handling. 2004-12-07 Martin Baulig * decl.cs (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext. (MemberCore.GetClsCompliantAttributeValue): Likewise. (DeclSpace.ec): New protected field; store the EmitContext here. (DeclSpace.EmitContext): New public property; moved here from `TypeContainer'. (DeclSpace.GetClsCompliantAttributeValue): Don't create a new EmitContext. * enum.cs (Enum.Define): Store the EmitContext in the `ec' field. (Enum.Emit): Don't create a new EmitContext. * delegate.cs (Delegate.DefineType): Always create the EmitContext. * iterators.cs (Iterators.DefineIterator): Create a new EmitContext and store it in `ec'. 2004-08-24 Martin Baulig * typemanager.cs (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use this for accessibility checks. (TypeManager.IsSubclassOrNestedChildOf): Renamed to IsNestedFamilyAccessible. (TypeManager.IsSubclassOf): New method, do what the name actually says. 2004-12-06 Raja R Harinath Fix crash on cs0657-17.cs. * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute): Use RootContext.Tree.Types, not 'new RootTypes ()'. * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down the case where the NamespaceEntry gets overwritten. 2004-12-06 Marek Safar Fixed #69195, #56821 * ecore.cs (ResolveBoolean): Tiny refactoring. * expression.cs (Binary.DoResolve): Add warning 429 and skipping of right expression resolving when left is false constant and operator is LogicalAnd OR true constant and operator is LogicalOr. * statement.cs (ResolveUnreachable): Always reports warning. 2004-12-05 Miguel de Icaza * class.cs: Distinguish between 1721 and 1722 (just a little help for the programmer). 2004-12-03 Miguel de Icaza * delegate.cs: Only allow this on new versions of the language. 2004-12-02 Duncan Mak * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to Expression class. (Expression.IsAccessorAccessible): Moved from the PropertyExpr to here as a static method. Take an additional bool out parameter `must_do_cs1540_check' for signaling to InstanceResolve. (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check' member field from PropertyExpr class and made it an argument of the method instead. (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the check for MarshalByRefObject, and report CS0122 instead of CS1540. (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor' and `remove_accessor' as well as InstanceResolve: report CS0122 where applicable. Fixes #70129. 2004-12-03 Raja R Harinath Fix test-327.cs, test-328.cs, and put in early infrastructure for eventually fixing #52697. * namespace.cs (NamespaceEntry.LookupForUsing): New method. (NamespaceEntry.LookupNamespaceOrType): New method, refactored from other methods. (NamespaceEntry.Lookup): Remove 'ignore_using' flag. (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'. (VerifyUsing, error246): Update. * rootcontext.cs (RootContext.NamespaceLookup): Just use 'NamespaceEntry.LookupNamespaceOrType'. 2004-12-03 Martin Baulig * delegate.cs (NewDelegate.DoResolve): If we have an anonymous method as our child, call AnonymousMethod.Compatible() on it. 2004-12-03 Raja R Harinath Disable XML documentation support in 'basic' profile. * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml. Redirect XmlElement to System.Object. * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml. * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile. * mcs.exe.sources: Add doc-bootstrap.cs. * doc-bootstrap.cs: New file. Contains empty stub implementation of doc.cs. 2004-12-03 Atsushi Enomoto * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace comments are allowed. 2004-12-03 Carlos Alberto Cortez * delegate.cs: Add checks for subtypes in paramaters and return values in VerifyMethod () to add support for Covariance/Contravariance in delegates. 2004-12-02 Miguel de Icaza * report.cs: Remove extra closing parenthesis. * convert.cs (Error_CannotImplicitConversion): If the name of the types are the same, provide some extra information. * class.cs (FieldBase): Use an unused bit field from the field to encode the `has_offset' property from the FieldMember. This saves a couple of Ks on bootstrap compilation. * delegate.cs (NewDelegate.DoResolve): If we have an anonymous method as our child, return the AnonymousMethod resolved expression. * expression.cs (New.DoResolve): Allow return values from NewDelegate to also include AnonymousMethods. Fixes #70150. 2004-12-02 Marek Safar Fix bug #70102 * attribute.cs (Resolve): Improved implementation of params attribute arguments. * support.cs (ParameterData): Add HasParams to be faster. 2004-12-02 Atsushi Enomoto all things are for /doc support: * doc.cs: new file that supports XML documentation generation. * mcs.exe.sources: added doc.cs. * driver.cs: Handle /doc command line option. Report error 2006 instead of 5 for missing file name for /doc. Generate XML documentation when required, after type resolution. * cs-tokenizer.cs: Added support for picking up documentation (/// and /** ... */), including a new XmlCommentState enumeration. * cs-parser.jay: Added lines to fill Documentation element for field, constant, property, indexer, method, constructor, destructor, operator, event and class, struct, interface, delegate, enum. Added lines to warn incorrect comment. * rootcontext.cs : Added Documentation field (passed only when /doc was specified). * decl.cs: Added DocComment, DocCommentHeader, GenerateDocComment() and OnGenerateDocComment() and some supporting private members for /doc feature to MemberCore. * class.cs: Added GenerateDocComment() on TypeContainer, MethodCore and Operator. * delegate.cs: Added overriden DocCommentHeader. * enum.cs: Added overriden DocCommentHeader and GenerateDocComment(). 2004-12-01 Miguel de Icaza * cfold.cs (ConstantFold.DoConstantNumericPromotions): After unwrapping the enumeration values, chain to DoConstantNumericPromotions again, so we can promote things to the fundamental types (takes care of enums that are bytes, sbytes). Fixes bug #62054. 2004-12-01 Raja R Harinath * attribute.cs (Attribute.CheckAttributeType): Remove complain flag. Fix long-standing bug in type-lookup. Use FindType instead of LookupType when ec.ResolvingTypeTree. (Attribute.ResolveType, Attribute.Resolve) (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType): Update to changes. (Attributes.Search): Remove internal version. Update. (Attributes.SearchMulti): Update. (Attributes.GetClsCompliantAttribute): Remove. (Attributes.GetIndexerNameAttribute): Remove. * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes. (DeclSpace.GetClsCompliantAttributeValue): Likewise. * class.cs (Indexer.Define): Likewise. 2004-12-01 Marek Safar Fix bug #68790 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing MarshallByReference members access. * expression.cs: Use CheckMarshallByRefAccess; Better error CS0197 message. * report.cs: Print whole related error message. 2004-11-30 Raja R Harinath * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in the current directory to help debugging. 2004-11-29 Marek Safar * class (GetClassBases): Better error 60 report. (EventProperty): Disabled warning 67 detection. 2004-11-29 Marek Safar Fix bug #60324 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant. * constant.cs (DecimalConstant.Emit): Don't use int ctor for precise values. 2004-11-29 Marek Safar Fix bug #49488 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report. * decl.cs (MemberCore.MemberName): Error 1648 in compiler. 2004-11-26 Miguel de Icaza * attribute.cs (Attribute.Resolve): Refine error reporting and report a cs0117 if the identifier does not exist, to distinguish from 0617 which is a miss-use of the actual identifier. * ecore.cs (EventExpr.Emit): Refine error report and distinguish between cs0070 and cs0079. * class.cs (MemberBase.DoDefine): When reporting a wrong accessibility level, we use MethodCore to compare instead of Method (this was a regression in some refactoring effort). So now we correctly report cs0056 again. * convert.cs (ImplicitReferenceConversion): Corrected typo, I was testing the target_type (which was known to be object_type) and not the source type (which is anonymous_method). Fixed reporting of error cs1660. * expression.cs (UserCast.Source): Expose the underlying cast. * statement.cs (Switch.SwitchGoverningType): Sort the list of allowed types to find a match to int32 first (most common). In addition, it ignores any ImplicitUserConversions that did an internal implicit conversion (as the switch statement allows only one integral conversion to exist). * class.cs (PartialContainer.Create): rename `name' to `member_name' for clarity. Then replace the string calls with a call to MemberName.GetPartialName, as now using MemberName.ToString is an error (this is due to the side effects it had, that were fixed in the past). This will restore the error reporting on a number of partial class errors that were missusing this (and getting an exception as a results, which is now just a plain textual warning, because yyparse debug output would crash otherwise). 2004-11-26 Raja R Harinath * Makefile (PROGRAM_INSTALL_DIR): Remove. 2004-11-25 Ben Maurer * rootcontext.cs (LookupType): Make sure to cache lookups that don't give us a negative result. This saves about 5% of corlib compilation time. 2004-11-25 Miguel de Icaza * report.cs (AbstractMessage.Print): messages are sent to stderr * class.cs (TypeContainer.GetClassBases): It is an error to have a non-interface in the list of interfaces (at this point, either parent was properly set, or a base class is being listed in the interfaces section). This flags error 1722, and resolves the crash from bug 69259. 2004-11-25 Ben Maurer * statement.cs (Using.EmitExpressionFinally): make this work right for valuetypes. Fixes 69926. 2004-11-25 Miguel de Icaza * const.cs (Const.ChangeType): Cope with the "0 literal can be converted to an enum" here, before we try to change the underlying type. This code exists, but it is a different code path than the one used while encoding constants. * convert.cs (ImplicitReferenceConversionExists): A surprisingly old bug: when converting from the null literal to a pointer, return an EmptyCast, not the NullLiteral. This fixes #69921, the recent null_type changes probably made this bug more prominent. (ImplicitReferenceConversionExists): In addition, resynchronized the code here, so it matches the same code in ImplicitReferenceConversionExists for the `from any class-type S to any interface-type T'. 2004-11-25 Marek Safar * cfold.cs (BinaryFold): Add addition for DecimalConstant. 2004-11-24 Miguel de Icaza * cs-parser.jay: Use verbosity accordingly. 2004-11-24 Marek Safar * expression.cs (Unary.ResolveOperator): Do not report warning; AddressOf reads from variable. (LocalVariableReferences.DoResolveBase): Improved my previous fix. 2004-11-24 Marek Safar Fix bug #69462 * attribute.cs (Attributable): Removed CheckTargets. (Attributes.Emit): Explicit attribute targets are tested here. * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is not enabled for interfaces. * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets. (GetAssemblyName): Ouch next bug there. 2004-11-23 Carlos Alberto Cortez * expression.cs: Error 275 added. 2004-11-23 Marek Safar Fix bug #69177 (Implemented decimal constant support) * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant. (BinaryFold): Add DecimalConstant. * const.cs (Define): Decimal constant (is not constant. (ChangeType): Add decimal type handling. (LookupConstantValue): Don't set value for decimal type but emit DecimalConstantAttribute. Needed for constant optimization. * constant.cs (ToDecimal): New method. (ConvertToDecimal): New method. (IntConstant): Implemented ConvertToDecimal. (DecimalConstant.Emit): Emit optimized version for decimals in int range. * expression.cs (ResolveOperator): Changed order of constant reduction to work correctly with native types which have overloaded operators. (ResolveMemberAccess): Extract constant value from attribute for decimal type. * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute. * typemanager.cs (TypeManager): Add decimal_constant_attribute_type, void_decimal_ctor_int_arg, decimal_constant_attribute_ctor. (ChangeType): Decimal is special. (TypeToCoreType): Add decimal type. 2004-11-22 Marek Safar * convert.cs (ImplicitConversionRequired): Add error cs0642 for decimal types. 2004-11-22 Marek Safar * class.cs (EventField.ApplyAttributeBuilder): Fix error test cs1667-5.cs. 2004-11-19 Marek Safar * class.cs (MemberBase.DoDefine): Fix error cs0508 report. * pending.cs (PendingImplementation): Grab only interfaces. 2004-11-19 Marek Safar * statement.cs (ForeachHelperMethods): Add location member and error 202 detection. 2004-11-19 Raja R Harinath * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's automatically handled by executable.make. (PROGRAM): Make profile-specific. 2004-11-18 Marek Safar * expression.cs (DoResolveBase): Fixed wrong warning for out variables. 2004-11-18 Martin Baulig Merged latest changes into gmcs. Please keep this comment in here, it makes it easier for me to see what changed in MCS since the last time I merged. 2004-11-17 Raja R Harinath * typemanager.cs (TypeHandle.GetTypeHandle): Make private. (TypeHandle.GetMemberCache): New. (TypeHandle.TypeHandle): Update. (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer. (TypeManager.LookupParentInterfacesCache): Rename from LookupInterfaceCache. Optimize slightly. (TypeManager.MemberLookup_FindMembers): Update. * decl.cs (MemberCache.MemberCache): Set Container to null in the multi-type variant. (AddCacheContents): Rename from AddHashtable. * class.cs (TypeContainer.parent_container): Remove. (TypeContainer.VerifyClsCompliance): Don't use parent_container. (TypeContainer.DoDefineMembers): Don't initialize it. Update to name changes. 2004-11-17 Miguel de Icaza * class.cs (MethodCore.CheckAccessModifiers): New helper routine that factors the code to check access modifiers on override. (PropertyBase): Use the code here. Patch from Lluis S'anchez, fixes bug #69361. 2004-11-15 Miguel de Icaza * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New routine that is used to report the use of a captured variable whose address has been taken. There are two checks: one when variables are being captured and the other check is when the address of a variable is taken. (because an anonymous methods might be resolved before *or* after the address has been taken) and * expression.cs (Conditional.DoResolve): Remove the special casing that Martin added to trueExpr and falseExpr being both NullLiteral. We get the right behavior now just by introducing the null_type into the compiler. * convert.cs (ExplicitConversion): Change the code to use null_type instead of testing `expr is NullLiteral'. (ImplicitConversionStandard): use null_type too. (ImplicitReferenceConversionExists): use null_type too. (ImplicitReferenceConversion): use null_type too. * literal.cs: The type of `NullLiteral' is now null_type instead of object_type. (Resolve): Set the type here. * typemanager.cs: Introduce null_type. 2004-11-17 Martin Baulig * decl.cs (MemberCache.AddHashtable): Add entries in the opposite direction, like FindMembers() does. Fixes #69546, testcase is in test-315.cs. 2004-11-16 Martin Baulig This is based on a patch from Marek Safar, see bug #69082. Fixes bugs #63705 and #67130. * typemanager.cs (TypeManager.LookupInterfaceCache): New public method; create a MemberCache for an interface type and cache the result. * decl.cs (IMemberContainer.ParentContainer): Removed. (IMemberContainer.ParentCache): New property. (MemberCache.SetupCacheForInterface): Removed. (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this to create a cache for an interface's "parent". * class.cs (TypeContainer.DoDefineMembers): Setup cache for interfaces too. 2004-11-16 Martin Baulig Merged back from gmcs; these changes already went into gmcs a couple of weeks ago. * typemanager.cs (TypeManager.AddUserType): Removed the `ifaces' argument. (TypeManager.RegisterBuilder): Take a `Type []' instead of a `TypeExpr []'. (TypeManager.AddUserInterface): Removed. (TypeManager.ExpandInterfaces): Return a `Type []' instead of a `TypeExpr []'. (TypeManager.GetInterfaces): Likewise. (TypeManager.GetExplicitInterfaces): Likewise. * ecore.cs (TypeExpr.GetInterfaces): Removed. * class.cs (TypeContainer.base_class_type): Replaced with `ptype'. (TypeContainer.base_inteface_types): Replaced with `ifaces'. 2004-11-14 Ben Maurer * statement.cs: Avoid adding bools to a hashtable. 2004-11-07 Miguel de Icaza * expression.cs (Invocation.OverloadResolve): Flag error if we are calling an unsafe method from a safe location. 2004-11-06 Marek Safar Fix #69167 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning. 2004-11-06 Miguel de Icaza * namespace.cs (VerifyUsing): use GetPartialName instead of ToString. 2004-11-05 Miguel de Icaza * statement.cs (Return.Resolve): Fix regression in typo: if `in_exc', we have to request a NeedReturnLabel, this was a typo introduced in the anonymous method check-in. Fixes #69131. * Indexers were using the ShortName when defining themselves, causing a regression in the compiler bootstrap when applying the patch from 2004-11-02 (first part), now they use their full name and the bug is gone. 2004-11-04 Zoltan Varga * driver.cs: Strip the path from the names of embedded resources. Fixes #68519. 2004-11-04 Raja R Harinath Fix error message regression: cs0104-2.cs. * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag. (AliasEntry.Resolve): Update. * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove 'silent' flag. (RootContext.LookupType): Update. 2004-11-03 Carlos Alberto Cortez * cs-parser.jay: Add support for handling accessor modifiers * class: Add support port accessor modifiers and error checking, define PropertyMethod.Define as virtual (not abstract anymore) * ecore.cs: Add checking for proeprties access with access modifiers * iterators.cs: Modify Accessor constructor call based in the modified constructor 2004-11-02 Ben Maurer * expression.cs (StringConcat): Handle being called twice, as when we have a concat in a field init with more than two ctors in the class 2004-11-02 Miguel de Icaza * class.cs (Event.Define, Indexer.Define, Property.Define): Do not special case explicit implementations, we should always produce the .property or .event declaration. * decl.cs (MemberName): Renamed GetFullName to GetPartialName since it will not return correct data if people use this unresolved in the presence of using statements (see test-313). * class.cs (MethodData.Define): If we are an explicit interface implementation, set the method name to the full name of the interface plus the name of the method. Notice that using the method.MethodName.GetFullName() does not work, as it will only contain the name as declared on the source file (it can be a shorthand in the presence of using statements) and not the fully qualifed type name, for example: using System; class D : ICloneable { object ICloneable.Clone () { } } Would produce a method called `ICloneable.Clone' instead of `System.ICloneable.Clone'. * namespace.cs (Alias.Resolve): Use GetPartialName. 2004-11-01 Marek Safar * cs-parser.jay: Add error 1055 report. 2004-11-01 Miguel de Icaza * assign.cs (Assign.DoResolve): Only do the transform of assignment into a New if the types are compatible, if not, fall through and let the implicit code deal with the errors and with the necessary conversions. 2004-11-01 Marek Safar * cs-parser.jay: Add error 1031 report. * cs-tokenizer.cs: Add location for error 1038. 2004-10-31 Marek Safar * cs-parser.jay: Add error 1016 report. 2004-10-31 Marek Safar * cs-parser.jay: Add errors 1575,1611 report. 2004-10-31 Marek Safar * cs-parser.jay: Add error 1001 report. 2004-10-31 Marek Safar Fix #68850 * attribute.cs (GetMarshal): Add method argument for caller identification. * class.cs, codegen.cs, enum.cs, parameter.cs: Added agument for GetMarshal and RuntimeMissingSupport. 2004-10-31 Marek Safar * attribute.cs (ExtractSecurityPermissionSet): Removed TypeManager.code_access_permission_type. * typemanager.cs: Removed TypeManager.code_access_permission_type. 2004-10-27 Miguel de Icaza * expression.cs (LocalVariableReference.DoResolveLValue): Check for obsolete use of a variable here. Fixes regression on errors cs0619-25 and cs0619-26. 2004-10-27 Marek Safar Fix #62358, implemented security attribute encoding. * attribute.cs (Attribute.CheckSecurityActionValididy): New method. Tests permitted SecurityAction for assembly or other types. (Assembly.ExtractSecurityPermissionSet): New method. Transforms data from SecurityPermissionAttribute to PermisionSet class. * class.cs (ApplyAttributeBuilder): Added special handling for System.Security.Permissions.SecurityAttribute based types. * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added special handling for System.Security.Permissions.SecurityAttribute based types. * enum.cs (ApplyAttributeBuilder): Added special handling for System.Security.Permissions.SecurityAttribute based types. * parameter.cs (ApplyAttributeBuilder): Added special handling for System.Security.Permissions.SecurityAttribute based types. * rootcontext.cs: Next 2 core types. * typemanager.cs (TypeManager.security_permission_attr_type): Built in type for the SecurityPermission Attribute. (code_access_permission_type): Build in type. 2004-10-17 Miguel de Icaza * expression.cs (LocalVariableReference.DoResolveBase, Emit): Remove the tests for `ec.RemapToProxy' from here, and encapsulate all of this information into EmitContext.EmitCapturedVariableInstance. * codegen.cs (EmitCapturedVariableInstance): move here the funcionality of emitting an ldarg.0 in the presence of a remapping. This centralizes the instance emit code. (EmitContext.EmitThis): If the ScopeInfo contains a THIS field, then emit a load of this: it means that we have reached the topmost ScopeInfo: the one that contains the pointer to the instance of the class hosting the anonymous method. * anonymous.cs (AddField, HaveCapturedFields): Propagate field captures to the topmost CaptureContext. 2004-10-12 Miguel de Icaza * expression.cs (LocalVariableReference): Move the knowledge about the iterators into codegen's EmitCapturedVariableInstance. 2004-10-11 Miguel de Icaza * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not all code paths return a value from an anonymous method (it is the same as the 161 error, but for anonymous methods). 2004-10-08 Miguel de Icaza The introduction of anonymous methods in the compiler changed various ways of doing things in the compiler. The most significant one is the hard split between the resolution phase and the emission phases of the compiler. For instance, routines that referenced local variables no longer can safely create temporary variables during the resolution phase: they must do so from the emission phase, since the variable might have been "captured", hence access to it can not be done with the local-variable operations from the runtime. * statement.cs (Block.Flags): New flag `IsTopLevel' to indicate that this block is a toplevel block. (ToplevelBlock): A new kind of Block, these are the blocks that are created by the parser for all toplevel method bodies. These include methods, accessors and anonymous methods. These contain some extra information not found in regular blocks: A pointer to an optional CaptureContext (for tracking captured local variables and parameters). A pointer to the parent ToplevelBlock. (Return.Resolve): Catch missmatches when returning a value from an anonymous method (error 1662). Invoke NeedReturnLabel from the Resolve phase instead of the emit phase. (Break.Resolve): ditto. (SwitchLabel): instead of defining the labels during the resolution phase, we now turned the public ILLabel and ILLabelCode labels into methods called GetILLabelCode() and GetILLabel() that only define the label during the Emit phase. (GotoCase): Track the SwitchLabel instead of the computed label (its contained therein). Emit the code by using SwitchLabel.GetILLabelCode (). (LocalInfo.Flags.Captured): A new flag has been introduce to track whether the Local has been captured or not. (LocalInfo.IsCaptured): New property, used to tell whether the local has been captured. * anonymous.cs: Vastly updated to contain the anonymous method support. The main classes here are: CaptureContext which tracks any captured information for a toplevel block and ScopeInfo used to track the activation frames for various local variables. Each toplevel block has an optional capture context associated with it. When a method contains an anonymous method both the toplevel method and the anonymous method will create a capture context. When variables or parameters are captured, they are recorded on the CaptureContext that owns them, for example: void Demo () { int a; MyDelegate d = delegate { a = 1; } } Here `a' will be recorded as captured on the toplevel CapturedContext, the inner captured context will not have anything (it will only have data if local variables or parameters from it are captured in a nested anonymous method. The ScopeInfo is used to track the activation frames for local variables, for example: for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++){ MyDelegate d = delegate { call (i, j); } } At runtime this captures a single captured variable `i', but it captures 10 different versions of the variable `j'. The variable `i' will be recorded on the toplevel ScopeInfo, while `j' will be recorded on a child. The toplevel ScopeInfo will also track information like the `this' pointer if instance variables were referenced (this is necessary as the anonymous method lives inside a nested class in the host type of the method). (AnonymousMethod): Expanded to track the Toplevel, implement `AnonymousMethod.Compatible' to tell whether an anonymous method can be converted to a target delegate type. The routine now also produces the anonymous method content (AnonymousDelegate): A helper class that derives from DelegateCreation, this is used to generate the code necessary to produce the delegate for the anonymous method that was created. * assign.cs: API adjustments for new changes in Convert.ImplicitStandardConversionExists. * class.cs: Adjustments to cope with the fact that now toplevel blocks are of type `ToplevelBlock'. * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks insteda of standard blocks. Flag errors if params arguments are passed to anonymous methods. * codegen.cs (EmitContext): Replace `InAnonymousMethod' with `CurrentAnonymousMethod' which points to the current Anonymous Method. The variable points to the AnonymousMethod class that holds the code being compiled. It is set in the new EmitContext created for the anonymous method. (EmitContext.Phase): Introduce a variable and an enumeration to assist in enforcing some rules about when and where we are allowed to invoke certain methods (EmitContext.NeedsReturnLabel is the only one that enfonces this right now). (EmitContext.HaveCaptureInfo): new helper method that returns whether we have a CapturedContext initialized. (EmitContext.CaptureVariable): New method used to register that a LocalInfo must be flagged for capturing. (EmitContext.CapturedParameter): New method used to register that a parameters must be flagged for capturing. (EmitContext.CapturedField): New method used to register that a field must be flagged for capturing. (EmitContext.HaveCapturedVariables, EmitContext.HaveCapturedFields): Return whether there are captured variables or fields. (EmitContext.EmitMethodHostInstance): This is used to emit the instance for the anonymous method. The instance might be null (static methods), this (for anonymous methods that capture nothing and happen to live side-by-side with the current method body) or a more complicated expression if the method has a CaptureContext. (EmitContext.EmitTopBlock): Routine that drives the emission of code: it will first resolve the top block, then emit any metadata and then emit the code. The split is done so that we can extract any anonymous methods and flag any captured variables/parameters. (EmitContext.ResolveTopBlock): Triggers the resolution phase, during this phase, the ILGenerator should not be used as labels and local variables declared here might not be accessible to any code that is part of an anonymous method. Exceptions to this include the temporary variables that are created by some statements internally for holding temporary variables. (EmitContext.EmitMeta): New routine, in charge of emitting all the metadata for a cb (EmitContext.TemporaryReturn): This method is typically called from the Emit phase, and its the only place where we allow the ReturnLabel to be defined other than the EmitMeta. The reason is that otherwise we would have to duplicate a lot of logic in the Resolve phases of various methods that today is on the Emit phase. (EmitContext.NeedReturnLabel): This no longer creates the label, as the ILGenerator is not valid during the resolve phase. (EmitContext.EmitThis): Extended the knowledge in this class to work in anonymous methods in addition to iterators. (EmitContext.EmitCapturedVariableInstance): This emits whatever code is necessary on the stack to access the instance to a local variable (the variable will be accessed as a field). (EmitContext.EmitParameter, EmitContext.EmitAssignParameter, EmitContext.EmitAddressOfParameter): Routines to support parameters (not completed at this point). Removals: Removed RemapLocal and RemapLocalLValue. We probably will also remove the parameters. * convert.cs (Convert): Define a `ConstantEC' which points to a null. This is just to prefity some code that uses ImplicitStandardConversion code and do not have an EmitContext handy. The idea is to flag explicitly that at that point in time, it is known that the conversion will not trigger the delegate checking code in implicit conversions (which requires a valid EmitContext). Everywhere: pass new EmitContext parameter since ImplicitStandardConversionExists now requires it to check for anonymous method conversions. (Convert.ImplicitStandardConversionExists): If the type of an expression is the anonymous_method_type, and the type is a delegate, we invoke the AnonymousMethod.Compatible method to check whether an implicit conversion is possible. (Convert.ImplicitConversionStandard): Only do implicit method group conversions if the language level is not ISO_1. * delegate.cs (Delegate.GetInvokeMethod): Common method to get the MethodInfo for the Invoke method. used by Delegate and AnonymousDelegate. * expression.cs (Binary.DoNumericPromotions): only allow anonymous method conversions if the target type is a delegate. Removed extra debugging nops. (LocalVariableReference): Turn the `local_info' into a public field. Add `prepared' field, the same hack used for FieldExprs to cope with composed assignments, as Local variables do not necessarily operate purely on the stack as they used to: they can be captured fields. Add `temp' for a temporary result, like fields. Refactor DoResolve and DoResolveLValue into DoResolveBase. It now copes with Local variables that are captured and emits the proper instance variable to load it from a field in the captured case. (ParameterReference.DoResolveBase): During the resolve phase, capture parameters if we are in an anonymous method. (ParameterReference.Emit, ParameterReference.AddressOf): If in an anonymous method, use the EmitContext helper routines to emit the parameter reference. * iterators.cs: Set RemapToProxy to true/false during the EmitDispose class. * parameters.cs (GetParameterByName): New helper method. * typemanager.cs (anonymous_method_type) a new type that represents an anonyous method. This is always an internal type, used as a fencepost to test against the anonymous-methodness of an expression. 2004-10-20 Marek Safar * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544, 561 report. (PropertyBase.FindOutParentMethod): Add errors 545, 546 report. 2004-10-18 Martin Baulig * statement.cs (Fixed.Resolve): Don't access the TypeExpr's `Type' directly, but call ResolveType() on it. (Catch.Resolve): Likewise. (Foreach.Resolve): Likewise. 2004-10-18 Martin Baulig * expression.cs (Cast.DoResolve): Don't access the TypeExpr's `Type' directly, but call ResolveType() on it. (Probe.DoResolve): Likewise. (ArrayCreation.LookupType): Likewise. (TypeOf.DoResolve): Likewise. (SizeOf.DoResolve): Likewise. 2004-10-18 Martin Baulig * expression.cs (Invocation.BetterFunction): Put back TypeManager.TypeToCoreType(). 2004-10-18 Raja R Harinath * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing the ResolveType. 2004-10-18 Martin Baulig * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's `Type' directly, but call ResolveType() on it. 2004-10-18 Martin Baulig * class.cs (FieldMember.Define): Don't access the TypeExpr's `Type' directly, but call ResolveType() on it. (MemberBase.DoDefine): Likewise. * expression.cs (New.DoResolve): Don't access the TypeExpr's `Type' directly, but call ResolveType() on it. (ComposedCast.DoResolveAsTypeStep): Likewise. * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's `Type' directly, but call ResolveType() on it. 2004-10-17 John Luke * class.cs (Operator.GetSignatureForError): use CSharpName * parameter.cs (Parameter.GetSignatureForError): Returns correct name even if was not defined. 2004-10-13 Raja R Harinath Fix #65816. * class.cs (TypeContainer.EmitContext): New property. (DefineNestedTypes): Create an emitcontext for each part. (MethodCore.DoDefineParameters): Use container's emitcontext. Pass type array to InternalParameters. (MemberBase.DoDefine): Use container's emitcontext. (FieldMember.Define): Likewise. (Event.Define): Likewise. (SetMethod.GetParameterInfo): Change argument to EmitContext. Pass type array to InternalParameters. (SetIndexerMethod.GetParameterInfo): Likewise. (SetMethod.Define): Pass emitcontext to GetParameterInfo. * delegate.cs (Define): Pass emitcontext to ComputeAndDefineParameterTypes and GetParameterInfo. Pass type array to InternalParameters. * expression.cs (ParameterReference.DoResolveBase): Pass emitcontext to GetParameterInfo. (ComposedCast.DoResolveAsTypeStep): Remove check on ec.ResolvingTypeTree. * parameter.cs (Parameter.Resolve): Change argument to EmitContext. Use ResolveAsTypeTerminal. (Parameter.GetSignature): Change argument to EmitContext. (Parameters.ComputeSignature): Likewise. (Parameters.ComputeParameterTypes): Likewise. (Parameters.GetParameterInfo): Likewise. (Parameters.ComputeAndDefineParameterTypes): Likewise. Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree. * support.cs (InternalParameters..ctor): Remove variant that takes a DeclSpace. * typemanager.cs (system_intptr_expr): New. (InitExpressionTypes): Initialize it. 2004-10-12 Chris Toshok * cs-parser.jay: fix location for try_statement and catch_clause. 2004-10-11 Martin Baulig * report.cs: Don't make --fatal abort on warnings, we have -warnaserror for that. 2004-10-07 Raja R Harinath More DeclSpace.ResolveType avoidance. * decl.cs (MemberCore.InUnsafe): New property. * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal with newly created EmitContext. (FieldMember.Define): Likewise. * delegate.cs (Delegate.Define): Likewise. * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias only if normal name-lookup fails. (TypeExpr.DoResolve): Enable error-checking. * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal. (SizeOf.DoResolve): Likewise. (ComposedCast.DoResolveAsTypeStep): Likewise. (StackAlloc.DoResolve): Likewise. * statement.cs (Block.Flags): Add new flag 'Unsafe'. (Block.Unsafe): New property. (Block.EmitMeta): Set ec.InUnsafe as appropriate. (Unsafe): Set 'unsafe' flag of contained block. (LocalInfo.Resolve): Use ResolveAsTypeTerminal. (Fixed.Resolve): Likewise. (Catch.Resolve): Likewise. (Using.ResolveLocalVariableDecls): Likewise. (Foreach.Resolve): Likewise. 2004-10-05 John Luke * cs-parser.jay: add location to error CS0175 2004-10-04 Miguel de Icaza * ecore.cs (Expression.Constantity): Add support for turning null into a constant. * const.cs (Const.Define): Allow constants to be reference types as long as the value is Null. 2004-10-04 Juraj Skripsky * namespace.cs (NamespaceEntry.Using): No matter which warning level is set, check if this namespace name has already been added. 2004-10-03 Ben Maurer * expression.cs: reftype [!=]= null should always use br[true,false]. # 67410 2004-10-03 Marek Safar Fix #67108 * attribute.cs: Enum conversion moved to GetAttributeArgumentExpression to be applied to the all expressions. 2004-10-01 Raja R Harinath Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs. * class.c (TypeContainer.DefineType): Flag error if base types aren't accessible due to access permissions. * decl.cs (DeclSpace.ResolveType): Move logic to Expression.ResolveAsTypeTerminal. (DeclSpace.ResolveTypeExpr): Thin layer over Expression.ResolveAsTypeTerminal. (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess): Refactor code into NestedAccess. Use it. (DeclSpace.NestedAccess): New. * ecore.cs (Expression.ResolveAsTypeTerminal): Add new argument to silence errors. Check access permissions. (TypeExpr.DoResolve, TypeExpr.ResolveType): Update. * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal. (Cast.DoResolve): Likewise. (New.DoResolve): Likewise. (InvocationOrCast.DoResolve,ResolveStatement): Likewise. (TypeOf.DoResolve): Likewise. * expression.cs (Invocation.BetterConversion): Return the Type of the better conversion. Implement section 14.4.2.3 more faithfully. (Invocation.BetterFunction): Make boolean. Make correspondence to section 14.4.2.2 explicit. (Invocation.OverloadResolve): Update. (Invocation): Remove is_base field. (Invocation.DoResolve): Don't use is_base. Use mg.IsBase. (Invocation.Emit): Likewise. 2004-09-27 Raja R Harinath * README: Update to changes. 2004-09-24 Marek Safar * cs-parser.jay: Reverted 642 warning fix. 2004-09-23 Marek Safar Fix bug #66615 * decl.cs (FindMemberWithSameName): Indexer can have more than 1 argument. 2004-09-23 Marek Safar * expression.cs (LocalVariableReference.DoResolveLValue): Do not report warning 219 for out values. (EmptyExpression.Null): New member to avoid extra allocations. 2004-09-23 Marek Safar * cs-parser.jay: Fix wrong warning 642 report. * cs-tokenizer.cs (CheckNextToken): New helper; Inspect next character if is same as expected. 2004-09-23 Martin Baulig * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup. (Convert.ImplicitReferenceConversionExists): Likewise. 2004-09-23 Marek Safar * class.cs (Operator.Define): Add error 448 and 559 report. 2004-09-22 Marek Safar * class.cs (MemberBase.IsTypePermitted): New protected method for checking error CS0610. 2004-09-22 Marek Safar * class.cs (TypeContainer.HasExplicitLayout): New property Returns whether container has StructLayout attribute set Explicit. (FieldMember): New abstract class for consts and fields. (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report. (Field): Reuse FieldMember. * const.cs (Const): Reuse FieldMember. * rootcontext.cs: EmitConstants call moved to class. 2004-09-22 Martin Baulig Thanks to Peter Sestoft for this bug report. * expression.cs (Conditional): If both the `trueExpr' and the `falseExpr' is a NullLiteral, return a NullLiteral. 2004-09-22 Martin Baulig * statement.cs (Foreach.EmitCollectionForeach): If we're in an iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()' for the "get_Current" call. 2004-09-22 Martin Baulig Marek and me just fixed one of our oldest bugs: #28562 :-) * ecore.cs (EnumConstant.GetValueAsEnumType): New public method. * attribute.cs (Attribute.GetAttributeArgumentExpression): If we're an EnumConstant, just return that. (Attribute.Resolve): GetAttributeArgumentExpression() may give us an EnumConstant. In this case, we need to use GetValueAsEnumType() to get the value which'll actually be written into the attribute. However, we have to use GetValue() to access the attribute's value in the compiler. 2004-09-22 Marek Safar * constant.cs (Constant.IsNegative): New abstract property IsNegative. * expression.cs (ArrayAccess.DoResolve): Add warning 251. (StackAlloc.DoResolve): Reused IsNegative. 2004-09-21 Martin Baulig * codegen.cs (VariableStorage): Don't store the ILGenerator here; if we're used in an iterator, we may be called from different methods. * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if we actually have an exception block. 2004-09-20 John Luke * class.cs, cs-parser.jay: Improve the error report for 1520: report the actual line where the error happens, not where the class was declared. * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs: Pass location information that was available elsewhere. 2004-09-19 Sebastien Pouliot * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS runtime to delay sign assemblies. 2004-09-19 Miguel de Icaza * cs-parser.jay: Do not report the stack trace, this is barely used nowadays. 2004-08-22 John Luke * driver.cs : check that a resource id is not already used before adding it, report CS1508 if it is, bug #63637 2004-09-19 Miguel de Icaza * ecore.cs: Removed dead code. 2004-09-18 Marek Safar * class.cs: Do not report warning CS0067 on the interfaces. 2004-09-16 Marek Safar * cs-parser.jay: Add error 504 report. 2004-09-16 Marek Safar * rootcontext.cs: WarningLevel is 4 by default now. * statement.cs (Fixed.Resolve): Do not null VariableInfo. 2004-09-16 Marek Safar Fixed bug #55780 * ecore.cs (PropertyExpr.FindAccessors): Do not perform deep search when property is not virtual. (PropertyExpr.ResolveAccessors): Make one call for both accessors. 2004-09-15 Marek Safar Fixed bug #65766 * statement.cs: Error 152 report constains also location. 2004-09-15 Marek Safar Fixed bug #65766 * const.cs: Explicitly set constant as static. 2004-09-15 Marek Safar Fixed bug #64226 * cs-parser.jay: Add error 1017 report. 2004-09-15 Marek Safar Fixed bug #59980, #64224 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test. * typemanager.cs (IsSpecialMethod): Simplified 2004-09-14 Marek Safar * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute condition with better params. 2004-09-14 Marek Safar Fixed bug #65238 * attribute.cs (Resolve): Property has to have both accessors. 2004-09-14 Martin Baulig * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute(). 2004-09-14 Marek Safar Fixed bug #61902 * codegen.cs (TestObsoleteMethodUsage): Trace when method is called and is obsolete then this member suppress message when call is inside next [Obsolete] method or type. * expression.cs: Use TestObsoleteMethodUsage member. 2004-09-14 Martin Baulig * cs-parser.jay: Sync a bit with the GMCS version. 2004-09-14 Martin Baulig * cs-parser.jay (CSharpParser): Don't derive from GenericsParser. (CSharpParser.yacc_verbose_flag): New public field. * genericparser.cs: Removed. 2004-09-14 Raja R Harinath * cs-parser.jay (event_declaration): Re-enable cs0071 error. 2004-09-13 Marek Safar * class.cs (MethodCore.CheckBase): Fix bug #65757. 2004-09-10 Martin Baulig Backported my MemberName changes from GMCS into MCS. - we are now using a special `MemberName' class instead of using strings; in GMCS, the `MemberName' also contains the type arguments. - changed the grammar rules a bit: * the old `member_name' is now a `namespace_or_type_name': The rule is that we use `namespace_or_type_name' everywhere where we expect either a "member name" (GetEnumerator) or a "member name" with an explicit interface name (IEnumerable.GetEnumerator). In GMCS, the explicit interface name may include type arguments (IEnumerable.GetEnumerator). * we use `member_name' instead of just `IDENTIFIER' for "member names": The rule is that we use `member_name' wherever a member may have type parameters in GMCS. * decl.cs (MemberName): New public class. (MemberCore.MemberName): New public readonly field. (MemberCore.ctor): Take a `MemberName' argument, not a string. (DeclSpace): Likewise. * delegate.cs (Delegate.ctor): Take a MemberName, not a string. * enum.cs (Enum.ctor): Likewise. * namespace.cs (AliasEntry.Alias): Changed type from Expression to MemberName. (AliasEntry.ctor): Take a MemberName, not an Expression. (AliasEntry.UsingAlias): Likewise. * class.cs (TypeContainer.ctor): Take a MemberName, not a string. (IMethodData.MemberName): Changed type from string to MemberName. (MemberBase.ExplicitInterfaceName): Likewise. (AbstractPropertyEventMethod.SetupName): Make this private. (AbstractPropertyEventMethod.ctor): Added `string prefix' argument; compute the member name here. (AbstractPropertyEventMethod.UpdateName): Recompute the name based on the `member.MemberName' and the `prefix'. * cs-parser.jay (attribute_name): Use `namespace_or_type_name', not `type_name'. (struct_declaration): Use `member_name' instead of `IDENTIFIER'; thus, we get a `MemberName' instead of a `string'. These declarations may have type parameters in GMCS. (interface_method_declaration, delegate_declaration): Likewise. (class_declaration, interface_declaration): Likewise. (method_header): Use `namespace_or_type_name' instead of `member_name'. We may be an explicit interface implementation. (property_declaration, event_declaration): Likewise. (member_name): This is now just an `IDENTIFIER', not a `namespace_or_type_name'. (type_name, interface_type): Removed. (namespace_or_type_name): Return a MemberName, not an Expression. (primary_expression): Use `member_name' instead of `IDENTIFIER'; call GetTypeExpression() on the MemberName to get an expression. (IndexerDeclaration.interface_type): Changed type from string to MemberName. (MakeName): Operate on MemberName's instead of string's. 2004-09-13 Raja R Harinath Fix bug #55770. * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1. (NamespaceEntry.Lookup): Add new argument to flag if we want the lookup to avoid symbols introduced by 'using'. * rootcontext.cs (NamespaceLookup): Update. 2004-09-12 Marek Safar * class.cs (TypeContainer.DoDefineMembers): Do not call DefineDefaultConstructor for static classes. 2004-09-12 Marek Safar * attribute.cs (Attribute.Resolve): Add error 653 report. * class.cs (Class.ApplyAttributeBuilder): Add error 641 report. (Method.ApplyAttributeBuilder): Add error 685 report. (Operator.Define): Add error 564 report. * cs-tokenizer.cs (handle_hex): Add error 1013 report. * expression.cs (Invocation.DoResolve): Add error 245 and 250 report. * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 674 report. 2004-09-11 Marek Safar * class.cs (ConstructorInitializer.Resolve): Wrong error number (515->516). 2004-09-11 Marek Safar * class.cs (Indexer.Define): Add error 631 report. 2004-09-11 Marek Safar * ecore.cs (Error_NegativeArrayIndex): Fix 248 error. 2004-09-11 Marek Safar * expression.cs (Probe.DoResolve): Add error CS0241 report. 2004-09-10 Marek Safar * cs-parser.jay: Added error CS0241 report. 2004-09-10 Raja R Harinath * cs-parser.jay (fixed_statement): Introduce a scope for the declaration in the 'fixed' statement. 2004-09-09 Marek Safar * cs-parser.jay: Added CS0230 error report. 2004-09-09 Marek Safar * cs-parser.jay: Added errors CS0231 and CS0257 report. 2004-09-09 Marek Safar * expression.cs (Argument.Resolve): Added error CS0192 and CS0199 report. 2004-09-09 Marek Safar C# 2.0 #pragma warning feature * cs-tokenizer.cs (PreProcessPragma): New method; Handles #pragma directive. * report.cs (WarningRegions): New class; Support class for #pragma warning directive. It tests whether warning is enabled for a given line. 2004-09-08 Miguel de Icaza * const.cs: Add more descriptive error report, tahnks to Sebastien. 2004-09-08 Marek Safar * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report. 2004-09-07 Miguel de Icaza * expression.cs: Apply patch from Ben: Remove dead code from ArrayCreation, and remove the TurnintoConstant call in const.cs, as that code just threw an exception anwyays. * const.cs: Remove the call to the turnintoconstant, for details see bug: #63144 * literal.cs: The type of the null-literal is the null type; So we use a placeholder type (literal.cs:System.Null, defined here) for it. * expression.cs (Conditional.DoResolve): Remove some old code that is no longer needed, conversions have been fixed. (ArrayCreationExpression.DoResolve): Return false if we fail to resolve the inner expression. 2004-09-07 Raja R Harinath Fix test-290.cs. * cs-parser.jay (delegate_declaration): Record a delegate declaration as a type declaration. Reported by Jo Vermeulen . 2004-09-06 Miguel de Icaza * parameter.cs: Do not crash if the type can not be resolved. * expression.cs: Report errors with unsafe pointers, fixes #64896 2004-09-06 Ben Maurer * expression.cs: Pointer arith always needs to do a conv.i if the operand is a long. fix 65320 2004-09-04 Marek Safar Fixed cs0619-37.cs, cs0619-38.cs * enum.cs (GetObsoleteAttribute): Removed. * expression.cs (MemberAccess.DoResolve): Test for [Obsolete] on Enum member is double staged. The first is tested member and then enum. 2004-09-04 Marek Safar Fixed #56986, #63631, #65231 * class.cs: (TypeContainer.AddToMemberContainer): New method, adds member to name container. (TypeContainer.AddToTypeContainer): New method, adds type to name container. (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod, AddConstructor, AddInterface, AddField, AddProperty, AddEvent, AddOperator): Simplified by reusing AddToMemberContainer. (TypeContainer.UserDefinedStaticConstructor): Changed to property instead of field. (Method.CheckForDuplications): Fixed implementation to test all possibilities. (MemberBase): Detection whether member is explicit interface implementation is now in constructor. (MemberBase.UpdateMemberName): Handles IndexerName. (Accessor): Changed to keep also location information. (AbstractPropertyEventMethod): Is derived from MemberCore. (AbstractPropertyEventMethod.IsDummy): Says whether accessor will be emited or not. (PropertyBase.AreAccessorsDuplicateImplementation): Tests whether accessors are not in collision with some method. (Operator): Is derived from MethodCore to simplify common operations. * decl.cs (Flags.TestMethodDuplication): Test for duplication must be performed. (DeclSpace.AddToContainer): Adds the member to defined_names table. It tests for duplications and enclosing name conflicts. * enum.cs (EnumMember): Clean up to reuse the base structures 2004-09-03 Martin Baulig * class.cs (TypeContainer.DefineDefaultConstructor): Put this back into TypeContainer, to make partial classes work again. 2004-09-03 Martin Baulig * rootcontext.cs (RootContext.V2): Removed. 2004-03-23 Martin Baulig * expression.cs (Invocation.OverloadResolve): Added `bool may_fail' argument and use it instead of the Location.IsNull() hack. 2004-09-03 Martin Baulig Merged latest changes into gmcs. Please keep this comment in here, it makes it easier for me to see what changed in MCS since the last time I merged. 2004-09-03 Raja R Harinath Fix #61128. * expression.cs (BetterConversion): Don't allow either conversion to be null. Remove redundant implicit conversion test when 'q == null' -- when this function is invoked, we already know that the implicit conversion exists. (BetterFunction): Assume that 'best' is non-null. Remove redundant reimplementation of IsApplicable when 'best' is null. (IsParamsMethodApplicable, IsApplicable): Add new parameter for number of arguments. (IsAncestralType): Extract from OverloadResolve. (OverloadResolve): Make robust to the MethodGroupExpr being unsorted. Implement all the logic of Section 14.5.5.1, and support overloading of methods from multiple applicable types. Clean up logic somewhat. Don't pass null methods to BetterFunction. * report.cs (SymbolRelatedToPreviousError): Cleanup output. (RealError, Warning): Append type of report to related symbol. 2004-09-03 Marek Safar * enum.cs: Fixed CLS-Compliance checks for enum members. Error tests cs3008-8.cs, cs3014-8.cs 2004-09-02 Marek Safar Fixed bug #62342, #63102 * class.cs: ImplementIndexer uses member.IsExplicitImpl like ImplementMethod. 2004-09-02 Marek Safar * attribute.cs (Attribute.GetAttributeArgumentExpression): Fixed bug #65170. 2004-09-02 Martin Baulig * statement.cs (Using.EmitLocalVariableDeclFinally): Use TypeManager.GetArgumentTypes() rather than calling GetParameters() on the MethodBase. 2004-09-01 Marek Safar C# 2.0 Static classes implemented * class.cs (TypeContainer): instance_constructors, initialized_fields, initialized_static_fields, default_constructor, base_inteface_types are protected to be accessible from StaticClass. (TypeContainer.DefineDefaultConstructor): New virtual method for custom default constructor generating (StaticClass): New class to handle "Static classes" feature. * cs-parser.jay: Handle static keyword on class like instance of StaticClass. * driver.cs: Added "/langversion" command line switch with two options (iso-1, default). 2004-08-31 Marek Safar * ecore.cs (FieldExpr.Resolve): Fixed bug #64689. 2004-08-31 Miguel de Icaza * delegate.cs: Style. 2004-08-31 Ben Maurer * delegate.cs: Add seperate instance expr field for miguel. 2004-08-29 Ben Maurer * PointerArithmetic (Resolve): make sure we are not doing pointer arith on void*. Also, make sure we are resolved by not setting eclass until resolve. All callers: Make sure that PointerArithmetic gets resolved. 2004-08-29 Ben Maurer * ArrayCreation (LookupType): If the type does not resolve to an array, give an error. 2004-08-27 Marek Safar * statement.cs (Try.Resolve): Fixed bug #64222 2004-08-27 Martin Baulig * class.cs (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't crash here. 2004-08-26 Marek Safar * ecore.cs (Constantify): Get underlying type via System.Enum.GetUnderlyingType to avoid StackOverflow on the Windows in special cases. 2004-08-26 Marek Safar * typemanager.cs (GetAddMethod): Used GetAddMethod (true) for obtaining also private methods. (GetRemoveMethod): Used GetRemoveMethod (true) for obtaining also private methods. 2004-08-24 Martin Baulig * class.cs (Method.Define): Set MethodAttributes.SpecialName and MethodAttributes.HideBySig for operators. 2004-08-23 Martin Baulig Back to the old error reporting system :-) * report.cs (Message): Removed. (Report.MessageData, ErrorData, WarningData): Removed. (Report.Error, Warning): Back to the old system. 2004-08-23 Martin Baulig * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer. * class.cs (TypeContainer.ParentContainer): New public virtual method; replaces the explicit interface implementation. (ClassPart.ParentContainer): Override. 2004-08-23 Martin Baulig * statement.cs (Switch): Added support for constant switches; see #59428 or test-285.cs. 2004-08-22 Marek Safar Fixed bug #62740. * statement.cs (GetEnumeratorFilter): Removed useless logic because C# specs is strict. GetEnumerator must be public. 2004-08-22 Martin Baulig * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're a switch and may break, reset the barrier. Fixes #59867. 2004-08-22 Marek Safar CLS-Compliance speed up (~5% for corlib) * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance): New method. Tests container for CLS-Compliant names * class.cs (TypeContainer.VerifyClsName): New method. Checks whether container name is CLS Compliant. (Constructor): Implements IMethodData. * decl.cs (MemberCache.GetPublicMembers ): New method. Builds low-case table for CLS Compliance test. (MemberCache.VerifyClsParameterConflict): New method. Checks method parameters for CS3006 error. * enum.cs (EnumMember): Is derived from MemberCore. (Enum.VerifyClsName): Optimized for better performance. 2004-08-06 Marek Safar * report.cs: Renamed Error_T to Error and changed all references. 2004-08-06 Marek Safar * class.cs (TypeContainer.IndexerArrayList): New inner class container for indexers. (TypeContainer.DefaultIndexerName): New constant for default indexer name. Replaced all "Item" with this constant. (TypeContainer.DefineIndexers): Moved to IndexerArrayList class. * typemanager.cs (TypeManager.default_member_ctor): Cache here DefaultMemberAttribute constructor. 2004-08-05 Martin Baulig * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins): Fix bug #59429. 2004-08-05 Marek Safar * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid multi platforms problem. * compiler.csproj: Included shared files. 2004-08-04 Marek Safar Fix bug 60333, 55971 in the more general way * attribute.cs (Attribute.GetAttributeArgumentExpression): Added arg_type argument for constant conversion. (Attribute.Resolve): Reuse GetAttributeArgumentExpression. 2004-08-04 Marek Safar Fix bug #59760 * class.cs (TypeContainer ): New inner classes MethodArrayList, OperatorArrayList, MethodCoreArrayList for typecontainer containers. Changed class member types to these new types. (MethodArrayList.DefineMembers): Added test for CS0659. 2004-08-04 Miguel de Icaza * cfold.cs: Synchronize the folding with the code in expression.cs Binary.DoNumericPromotions for uint operands. * attribute.cs: Revert patch from Raja, it introduced a regression while building Blam-1.2.1 (hard to isolate a test case). 2004-08-04 Marek Safar Fix for #55382 * class.cs: (TypeContainer.Define): Renamed to DefineContainerMembers because of name collision. (MethodCore.parent_method): New member. The method we're overriding if this is an override method. (MethodCore.CheckBase): Moved from Method class and made common. (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made private. (MethodCore.CheckForDuplications): New abstract method. For custom member duplication search in a container (MethodCore.FindOutParentMethod): New abstract method. Gets parent method and its return type. (Event.conflict_symbol): New member. Symbol with same name in the parent class. * decl.cs: (MemberCache.FindMemberWithSameName): New method. The method is looking for conflict with inherited symbols. 2004-08-04 Martin Baulig * codegen.cs (VariableStorage.EmitLoadAddress): New public method. * statement.cs (Foreach.EmitFinally): Make this work for valuetypes. 2004-08-03 Marek Safar * report.cs (Message): New enum for better error, warning reference in the code. (MessageData): New inner abstract class. It generally handles printing of error and warning messages. Removed unused Error, Warning, Message methods. 2004-08-03 Marek Safar Fix for cs0592-8.cs test * attribute.cs (Attributable.ValidAttributeTargets): Made public. (Attribute.ExplicitTarget): New member for explicit target value. (Attribute.CheckTargets): Now we translate explicit attribute target to Target here. 2004-08-03 Ben Maurer * ecore.cs (MethodGroupExpr): new IsBase property. * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr. * delegate.cs (DelegateCreation): store a MethodGroupExpr rather than an instance expr. (DelegateCreation.Emit): Use the method group rather than the instance expression. Also, if you have base.Foo as the method for a delegate, make sure to emit ldftn, not ldftnvirt. (ResolveMethodGroupExpr): Use the MethodGroupExpr. (NewDelegate.DoResolve): Only check for the existance of Invoke if the method is going to be needed. Use MethodGroupExpr. (NewDelegate.Emit): Remove, DelegateCreation implements this. * expression.cs: For pointer arith., make sure to use the size of the type, not the size of the pointer to the type. 2004-08-03 Marek Safar Fix for #60722 * class.cs (Class): Added error CS0502 test. 2004-08-03 John Luke Raja R Harinath Fix for #60997. * attribute.cs (Attribute.complained_before): New flag. (Attribute.ResolveType, Attribute.Resolve), (Attribute.DefinePInvokeMethod): Set it. (Attributes.Search): Pass 'complain' to Attribute.ResolveType. 2004-08-03 Martin Baulig * expression.cs (Binary.ResolveOperator): Don't abort if we can't use a user-defined operator; we still need to do numeric promotions in case one argument is a builtin type and the other one has an implicit conversion to that type. Fixes #62322. 2004-08-02 Martin Baulig * statement.cs (LocalInfo.Flags): Added `IsThis'. (LocalInfo.IsThis): New public property. (Block.EmitMeta): Don't create a LocalBuilder for `this'. 2004-08-01 Martin Baulig * class.cs (TypeContainer.GetClassBases): Don't set the default here since we may get called from GetPartialBases(). (TypeContainer.DefineType): If GetClassBases() didn't return a parent, use the default one. 2004-07-30 Duncan Mak * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES). 2004-07-30 Martin Baulig * Makefile (EXTRA_SOURCES): List the symbol writer's sources here. * class.cs (SourceMethod): New public class, derive from the symbol writer's ISourceMethod. (Method): Use the new symbol writer API. * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename as argument and use the new symbol writer. * location.cs (SourceFile): Implement the symbol writer's ISourceFile. (Location.SymbolDocument): Removed. (Location.SourceFile): New public property. * symbolwriter.cs: Use the new symbol writer API. 2004-07-30 Raja R Harinath * Makefile (install-local): Remove. Functionality moved to executable.make. 2004-07-28 Lluis Sanchez Gual * Makefile: Install mcs.exe.config file together with mcs.exe. * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the correct runtime version. 2004-07-25 Martin Baulig * class.cs (TypeContainer.RegisterOrder): Removed, this was unused. (TypeContainer, interface_order): Removed. (TypeContainer.AddClass, AddStruct, AddInterface): Take a TypeContainer as argument since we can also be called with a `PartialContainer' for a partial class/struct/interface. (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead of checking whether we're an `Interface' - we could be a `PartialContainer'. (PartialContainer.Register): Override; call AddClass()/AddStruct()/AddInterface() on our parent. * cs-parser.jay (interface_member_declaration): Add things to the `current_container', not the `current_class'. * rootcontext.cs (RegisterOrder): The overloaded version which takes an `Interface' was unused, removed. * typemanager.cs (TypeManager.LookupInterface): Return a `TypeContainer', not an `Interface'. (TypeManager.IsInterfaceType): The `builder_to_declspace' may contain a `PartialContainer' for an interface, so check it's `Kind' to figure out what it is. 2004-07-25 Martin Baulig * class.cs (Class.DefaultTypeAttributes): New public constant. (Struct.DefaultTypeAttributes): Likewise. (Interface.DefaultTypeAttributes): Likewise. (PartialContainer.TypeAttr): Override this and add the DefaultTypeAttributes. 2004-07-25 Martin Baulig * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument, we can just use the `Parent' field instead. 2004-07-25 Martin Baulig * class.cs (TypeContainer.Emit): Renamed to EmitType(). 2004-07-25 Martin Baulig * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on our parts before defining any methods. (TypeContainer.VerifyImplements): Make this virtual. (ClassPart.VerifyImplements): Override and call VerifyImplements() on our PartialContainer. 2004-07-25 Martin Baulig * iterators.cs (Iterator.Define): Renamed to DefineIterator(). * decl.cs (DeclSpace.Define): Removed the `TypeContainer' argument, we can just use the `Parent' field instead. * class.cs (MemberBase.CheckBase): Removed the `TypeContainer' argument. (MemberBase.DoDefine): Likewise. 2004-07-24 Martin Baulig * decl.cs (MemberCore.Parent): New public field. (DeclSpace.Parent): Moved to MemberCore. * class.cs (MethodCore.ds): Removed; use `Parent' instead. (MemberBase.ctor): Added TypeContainer argument, pass it to our parent's .ctor. (FieldBase, Field, Operator): Likewise. (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace. (EventField, Event): Likewise. 2004-07-23 Martin Baulig * class.cs (PartialContainer): New public class. (ClassPart): New public class. (TypeContainer): Added support for partial classes. (TypeContainer.GetClassBases): Splitted some of the functionality out into GetNormalBases() and GetPartialBases(). * cs-tokenizer.cs (Token.PARTIAL): New token. (Tokenizer.consume_identifier): Added some hacks to recognize `partial', but only if it's immediately followed by `class', `struct' or `interface'. * cs-parser.jay: Added support for partial clases. 2004-07-23 Martin Baulig * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of a `DeclSpace' and also made it readonly. (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace. (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise. (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise. * cs-parser.jay: Pass the `current_class', not the `current_container' (at the moment, this is still the same thing) to a new Method, Property, Event, Indexer or Constructor. 2004-07-23 Martin Baulig * cs-parser.jay (CSharpParser): Added a new `current_class' field and removed the `current_interface' one. (struct_declaration, class_declaration, interface_declaration): Set `current_class' to the newly created class/struct/interface; set their `Bases' and call Register() before parsing their body. 2004-07-23 Martin Baulig * class.cs (Kind): New public enum. (TypeContainer): Made this class abstract. (TypeContainer.Kind): New public readonly field. (TypeContainer.CheckDef): New public method; moved here from cs-parser.jay. (TypeContainer.Register): New public abstract method. (TypeContainer.GetPendingImplementations): New public abstract method. (TypeContainer.GetClassBases): Removed the `is_class' and `is_iface' parameters. (TypeContainer.DefineNestedTypes): Formerly known as DoDefineType(). (ClassOrStruct): Made this class abstract. * tree.cs (RootTypes): New public type. 2004-07-20 Martin Baulig * tree.cs (Tree.RecordNamespace): Removed. (Tree.Namespaces): Removed. * rootcontext.cs (RootContext.IsNamespace): Removed. * cs-parser.jay (namespace_declaration): Just create a new NamespaceEntry here. 2004-07-20 Martin Baulig * statement.cs (ExceptionStatement): New abstract class. This is now used as a base class for everyone who's using `finally'. (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all our local variables before using them. * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public virtual method. This is used by Yield.Resolve() to "steal" an outer block's `finally' clauses. (FlowBranchingException): The .ctor now takes an ExceptionStatement argument. * codegen.cs (EmitContext.StartFlowBranching): Added overloaded version which takes an ExceptionStatement. This version must be used to create exception branchings. * iterator.cs (Yield.Resolve): "Steal" all `finally' clauses from containing blocks. (Iterator.EmitMoveNext): Added exception support; protect the block with a `fault' clause, properly handle 'finally' clauses. (Iterator.EmitDispose): Run all the `finally' clauses here. 2004-07-20 Martin Baulig * iterator.cs: This is the first of a set of changes in the iterator code. Match the spec more closely: if we're an IEnumerable, then GetEnumerator() must be called. The first time GetEnumerator() is called, it returns the current instance; all subsequent invocations (if any) must create a copy. 2004-07-19 Miguel de Icaza * expression.cs: Resolve the constant expression before returning it. 2004-07-19 Martin Baulig * iterators.cs (Iterator.MapVariable): Don't define fields twice. (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as the return type of the new EmitContext. 2004-07-18 Martin Baulig * class.cs (Property.Define): Fix iterators. * iterators.cs (Iterator.Define): Moved the `container.AddInterator (this)' call here from the .ctor; only do it if we resolved successfully. 2004-07-17 Miguel de Icaza * cs-tokenizer.cs (handle_preprocessing_directive): Do not return `true' for preprocessing directives that we parse. The return value indicates whether we should return to regular tokenizing or not, not whether it was parsed successfully. In the past if we were in: #if false ... #line #endif, we would resume parsing after `#line'. See bug 61604. * typemanager.cs: Removed an old hack from Gonzalo to get corlib building: IsEnumType should return true only for enums, not for enums or System.Enum itself. This fixes #61593. Likely what happened is that corlib was wrong: mcs depended on this bug in some places. The bug got fixed, we had to add the hack, which caused bug 61593. * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack that was a workaround for the older conditions. 2004-07-16 Ben Maurer * assign.cs: IAssignMethod has a new interface, as documented inline. All assignment code now uses this new api. * ecore.cs, expression.cs: All classes which implement IAssignMethod now use the new interface. * expression.cs (Invocation): add a hack to EmitCall so that IndexerAccess can be the target of a compound assignment without evaluating its arguments twice. * statement.cs: Handle changes in Invocation api. 2004-07-16 Martin Baulig * iterators.cs: Rewrote this. We're now using one single Proxy class for both the IEnumerable and the IEnumerator interface and `Iterator' derives from Class so we can use the high-level API. * class.cs (TypeContainer.AddIterator): New method. (TypeContainer.DoDefineType): New protected virtual method, which is called from DefineType(). (TypeContainer.DoDefineMembers): Call DefineType() and DefineMembers() on all our iterators. (TypeContainer.Emit): Call Emit() on all our iterators. (TypeContainer.CloseType): Call CloseType() on all our iterators. * codegen.cs (EmitContext.CurrentIterator): New public field. 2004-07-15 Martin Baulig * typemanager.cs (TypeManager.not_supported_exception_type): New type. 2004-07-14 Martin Baulig * iterators.cs: Use real error numbers. 2004-07-14 Martin Baulig * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly requires this to be a System.Collection.IEnumerable and not a class implementing that interface. (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator. 2004-07-13 Marek Safar * class.cs: Fixed previous fix, it broke some error tests. 2004-07-12 Martin Baulig * enum.cs (Enum.Define): Call Emit() to emit the attributes. Fixes #61293. 2004-07-09 Miguel de Icaza * assign.cs (LocalTemporary): Add new argument: is_address,If `is_address' is true, then the value that we store is the address to the real value, and not the value itself. * ecore.cs (PropertyExpr): use the new local temporary stuff to allow us to handle X.Y += z (where X is a struct) 2004-07-08 Martin Baulig * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do not always return, just like we're doing in Using.Resolve(). 2004-07-07 Miguel de Icaza * cs-parser.jay (fixed_statement): flag this as Pinned. 2004-07-06 Miguel de Icaza * typemanager.cs (TypeManager): Removed MakePinned method, this mechanism is replaced with the .NET 2.x compatible mechanism of calling `ILGenerator.DeclareLocal (Type t, bool pinned)'. * statement.cs (LocalInfo): Remove MakePinned, add Pinned property Rename `Fixed' to `Pinned' as a flag, to distinguish from the `IsFixed' property which has a different meaning. 2004-07-02 Raja R Harinath * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names visible from inside a nested class, not just the names of the immediately enclosing class. Fix for bug #60730. 2004-06-24 Raja R Harinath * expression.cs (BetterConversion): Remove buggy special-case handling of "implicit constant expression conversions". At this point, we already know that the conversion is possible -- we're only checking to see which is better. 2004-06-24 Marek Safar * cs-parser.jay: Added error CS0210 test. 2004-06-24 Marek Safar * cs-parser.jay: Added error CS0134 test. 2004-06-24 Marek Safar Fix bug #52507 * cs-parser.jay: Added error CS0145 test. 2004-06-24 Marek Safar * class.cs (Operator.Define): Added test for errors CS0553, CS0554. 2004-06-23 Ben Maurer * expression.cs (StackAlloc.Resolve): The argument may not be a constant; deal with this case. 2004-06-23 Marek Safar * attribute.cs (IndexerName_GetIndexerName): Renamed to GetIndexerAttributeValue. (ScanForIndexerName): Renamed to GetIndexerNameAttribute. * class.cs (Indexer.Define): Added error tests for CS0415, CS0609. 2004-06-23 Miguel de Icaza * attribute.cs (Attribute.Resolve): Keep field code in sync with property code. 2004-06-23 Martin Baulig * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we neither return nor throw, reset the barrier as well. Fixes #60457. 2004-06-22 Atsushi Enomoto * class.cs : EventAttributes is now set to None by default. This fixes bug #60459. 2004-06-18 Marek Safar Fix bug #60219 * class.cs (ConstructorInitializer.GetOverloadedConstructor): Don't throw exception but return null (it's sufficient now). 2004-06-18 Marek Safar * typemanager.cs (GetArgumentTypes): Faster implementation. 2004-06-18 Martin Baulig * attribute.cs (Attribute.Resolve): Check whether we're an EmptyCast which a Constant child. Fixes #60333. 2004-06-17 Ben Maurer * statement.cs (EmitCollectionForeach): Account for the fact that not all valuetypes are in areas which we can take the address of. For these variables, we store to a temporary variable. Also, make sure that we dont emit a `callvirt' on a valuetype method. 2004-06-15 Marek Safar * expression.cs (StackAlloc.DoReSolve): Added test for negative parameter (CS0247). 2004-06-15 Marek Safar Fix bug #59792 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag. 2004-06-15 Marek Safar Fix bug #59781 * expression.cs: (Binary.DoNumericPromotions): Added conversion for ulong. 2004-06-14 Marek Safar Fix bug #58254 & cs1555.cs, cs1556.cs * driver.cs (MainDriver): Added tests for errors CS1555, CS1556. 2004-06-14 Marek Safar * cs-parser.jay: Added error CS1669 test for indexers. 2004-06-11 Martin Baulig * expression.cs (Invocation.IsParamsMethodApplicable): We need to call this twice: for params and varargs methods. 2004-06-11 Marek Safar * class.cs: (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610. 2004-06-11 Marek Safar * attribute.cs (Attribute.GetValidTargets): Made public. * class.cs: (AbstractPropertyEventMethod): New class for better code sharing. (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error CS1667 report. (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod 2004-06-11 Raja R Harinath Fix bug #59477. * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell that the call to Resolve is part of a MemberAccess. (Expression.Resolve): Use it for SimpleName resolution. (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic): Add 'intermediate' boolean argument. (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an error message when the SimpleName can be resolved ambiguously between an expression and a type. * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make public. (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve() call on the left-side. 2004-06-11 Marek Safar * class.cs: (MethodCore.VerifyClsCompliance): Added test for error CS3000. 2004-06-11 Marek Safar * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting. 2004-06-11 Martin Baulig * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for varargs methods if applicable. 2004-06-11 Martin Baulig * expression.cs (Invocation.EmitCall): Don't use `method.CallingConvention == CallingConventions.VarArgs' since the method could also have `CallingConventions.HasThis'. 2004-06-11 Marek Safar * class.cs (Event.GetSignatureForError): Implemented. Fixed crash in error test cs3010.cs 2004-06-10 Miguel de Icaza * cs-tokenizer.cs: Change the way we track __arglist to be consistent with the other keywords. 2004-06-09 Miguel de Icaza * codegen.cs: FAQ avoider: turn 1577 into a warning for now until tomorrow. 2004-06-09 Sebastien Pouliot * codegen.cs: Check that all referenced assemblies have a strongname before strongnaming the compiled assembly. If not report error CS1577. Fix bug #56563. Patch by Jackson Harper. * typemanager.cs: Added a method to return all referenced assemblies. Fix bug #56563. Patch by Jackson Harper. 2004-06-08 Marek Safar * class.cs: (Method.ApplyAttributeBuilder): Moved and added conditional attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629). * delegate.cs: (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test. 2004-06-08 Marek Safar Fixed #59640 * class.cs: (EventField.attribute_targets): Changed default target. 2004-06-08 Martin Baulig * expression.cs (Invocation.EmitCall): Enable varargs methods. 2004-06-08 Martin Baulig * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle". 2004-06-07 Martin Baulig Added support for varargs methods. * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist' keyword. * cs-parser.jay: Added support for `__arglist'. * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods. * expression.cs (Argument.AType): Added `ArgList'. (Invocation): Added support for varargs methods. (ArglistAccess): New public class. (Arglist): New public class. * parameter.cs (Parameter.Modifier): Added `ARGLIST'. * statement.cs (Block.Flags): Added `HasVarargs'. We set this on a method's top-level block if the method has varargs. * support.cs (ReflectionParameters, InternalParameters): Added support for varargs methods. 2004-06-07 Miguel de Icaza * class.cs: Provide location in indexer error report. * driver.cs: Use standard names. * namespace.cs: Catch the use of using after a namespace has been declared also on using aliases. 2004-06-03 Raja R Harinath Bug #50820. * typemanager.cs (closure_private_ok, closure_invocation_type) (closure_qualifier_type, closure_invocation_assembly) (FilterWithClosure): Move to ... (Closure): New internal nested class. (Closure.CheckValidFamilyAccess): Split out from Closure.Filter. (MemberLookup, RealMemberLookup): Add new almost_match parameter. * ecore.cs (almostMatchedMembers): New variable to help report CS1540. (MemberLookup, MemberLookupFailed): Use it. * expression.cs (New.DoResolve): Treat the lookup for the constructor as being qualified by the 'new'ed type. (Indexers.GetIndexersForTypeOrInterface): Update. 2004-06-03 Marek Safar * attribute.cs (GetConditionalAttributeValue): New method. Returns condition of ConditionalAttribute. (SearchMulti): New method. Returns all attributes of type 't'. Use it when attribute is AllowMultiple = true. (IsConditionalMethodExcluded): New method. * class.cs (Method.IsExcluded): Implemented. Returns true if method has conditional attribute and the conditions is not defined (method is excluded). (IMethodData): Extended interface for ConditionalAttribute support. (PropertyMethod.IsExcluded): Implemented. * decl.cs (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags. * expression.cs (Invocation.IsMethodExcluded): Checks the ConditionalAttribute on the method. 2004-06-02 Ben Maurer * expression.cs (ArrayCreationExpression): Make this just an `expression'. It can't be a statement, so the code here was dead. 2004-06-02 Marek Safar Fixed #59072 * typemanager.cs (GetFullNameSignature): New method for MethodBase types. 2004-06-02 Marek Safar Fixed #56452 * class.cs (MemberBase.GetSignatureForError): New virtual method. Use this method when MethodBuilder is null. (MethodData.DefineMethodBuilder): Encapsulated code to the new method. Added test for error CS0626 (MONO reports error for this situation). (IMethodData.GetSignatureForError): Extended interface. 2004-06-01 Marek Safar * attribute.cs (AttributeTester.GetObsoleteAttribute): Returns instance of ObsoleteAttribute when type is obsolete. * class.cs (TypeContainer.VerifyObsoleteAttribute): Override. (Method.GetSignatureForError): New method for usage when MethodBuilder is null. (MethodCode.VerifyObsoleteAttribute): Override. (MemberBase.VerifyObsoleteAttribute): Override. * decl.cs (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute and report proper error. *delegate.cs Delegate.VerifyObsoleteAttribute): Override. * ecore.cs (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute and report proper error. (FieldExpr.DoResolve): Added tests for ObsoleteAttribute. * enum.cs (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type and enum member. * expression.cs (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve, New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve): Added test for ObsoleteAttribute. * statement.cs (Catch): Derived from Statement. 2004-06-01 Marek Safar Fixed bug #59071 & cs0160.cs * statement.cs (Try.Resolve): Check here whether order of catch clauses matches their dependencies. 2004-05-31 Miguel de Icaza * Reverted patch to namespace.cs (Use lookuptypedirect). This caused a regression: #59343. Referencing nested classes from an assembly stopped working. 2004-05-31 Martin Baulig MCS is now frozen for beta 2. 2004-05-30 Ben Maurer * convert.cs: add a trivial cache for overload operator resolution. 2004-05-30 Ben Maurer * decl.cs: If possible, use lookuptypedirect here. We can only do this if there is no `.' after the namespace. Avoids using LookupType, which does lots of slow processing. (FindNestedType) New method, does what it says :-). * namespace.cs: use LookupTypeDirect. * rootcontext.cs: use membercache, if possible. * typemanager.cs (LookupTypeDirect): Cache negative hits too. 2004-05-30 Ben Maurer * expression.cs: According to the spec, In a member access of the form E.I, if E is a single identifier, and if the meaning of E as a simple-name (§7.5.2) is a constant, field, property, localvariable, or parameter with the same type as the meaning of E as a type-name (§3.8), then both possible meanings of E are permitted. We did not check that E as a simple-name had the same type as E as a type name. This trivial check gives us 5-7% on bootstrap time. 2004-05-30 Ben Maurer * expression.cs (Invocation.OverloadResolve): Avoid the use of hashtables and boxing here by allocating on demand. 2004-05-30 Martin Baulig * rootcontext.cs (RootContext.LookupType): Don't cache things if we're doing a silent lookup. Don't try to lookup nested types in TypeManager.object_type (thanks to Ben Maurer). 2004-05-30 Martin Baulig Committing a patch from Ben Maurer. * rootcontext.cs (RootContext.LookupType): Cache negative results. 2004-05-29 Martin Baulig * class.cs (IMethodData.ShouldIgnore): New method. * typemanager.cs (TypeManager.MethodFlags): Don't take a `Location' argument, we don't need it anywhere. Use `IMethodData.ShouldIgnore ()' instead of `MethodData.GetMethodFlags ()'. (TypeManager.AddMethod): Removed. (TypeManager.AddMethod2): Renamed to AddMethod. 2004-05-29 Martin Baulig Committing a patch from Benjamin Jemlich . * convert.cs (Convert.ImplicitReferenceConversion): If we're converting from a class type S to an interface type and we already have an object on the stack, don't box it again. Fixes #52578. 2004-05-29 Martin Baulig * class.cs (ConstructorInitializer.GetOverloadedConstructor): Added support for `params' parameters. Fixes #59267. 2004-05-29 Martin Baulig * literal.cs (NullPointer): Provide a private .ctor which sets `type' to TypeManager.object_type. Fixes #59048. 2004-05-29 Martin Baulig * expression.cs (MemberAccess.ResolveMemberAccess): If we're an EventExpr, set `ee.InstanceExpression = left'. Fixes #59188. * ecore.cs (EventExpr.instance_expr): Make the field private. 2004-05-26 Marek Safar Fixed bug #50080 & cs0214-2.cs * expression.cs (Cast.DoResolve): Check unsafe context here. * statement.cs (Resolve.DoResolve): Likewise. 2004-05-26 Martin Baulig * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'. * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'. (RootContext.LookupType): Pass down the `silent' flag. 2004-05-25 Martin Baulig * expression.cs (MethodGroupExpr.IdenticalTypeName): New public property. (Invocation.DoResolve): Don't report a CS0176 if the "instance" expression actually refers to a type. 2004-05-25 Martin Baulig * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch for #56176 and made it actually work. 2004-05-25 Martin Baulig * ecore.cs (Expression.CacheTemporaries): Make this virtual. (FieldExpr, PropertyExpr): Override and implement CacheTemporaries. Fixes #52279. 2004-05-25 Miguel de Icaza * location.cs: In the new compiler listing a file twice is a warning, not an error. 2004-05-24 Martin Baulig * enum.cs (Enum.DefineType): For the `BaseType' to be a TypeLookupExpression; otherwise, report a CS1008. Fixes #58571. 2004-05-24 Martin Baulig * decl.cs (DeclSpace.FindType): Try doing an alias lookup before walking the `using' list. Fixes #53921. 2004-05-24 Martin Baulig * const.cs (Const.LookupConstantValue): Added support for EmptyCast's; fixes #55251. 2004-05-24 Martin Baulig * ecore.cs (SimpleName.SimpleNameResolve): Renamed to DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper which does the CS0135 check. The reason is that we first need to check whether the variable actually exists. 2004-05-24 Martin Baulig * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather than RootContext.LookupType() to find the explicit interface type. Fixes #58584. 2004-05-24 Raja R Harinath * Makefile: Simplify. Use executable.make. * mcs.exe.sources: New file. List of sources of mcs.exe. 2004-05-24 Anders Carlsson * decl.cs: * enum.cs: Use the invariant culture when doing String.Compare for CLS case sensitivity. 2004-05-23 Martin Baulig * decl.cs (DeclSpace.FindType): Only check the `using' list if we don't have any dots. Fixes #52622, added cs0246-8.cs. * namespace.cs (NamespaceEntry.Lookup): Likewise. 2004-05-23 Marek Safar * class.cs (MemberBase.Define): Reuse MemberType member for resolved type. Other methods can use it too. 2004-05-23 Martin Baulig * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if the variable also exists in the current block (otherwise, we need to report a CS0103). Fixes #58670. 2004-05-23 Martin Baulig * flowanalysis.cs (Reachability.Reachable): Compute this on-the-fly rather than storing it as a field. 2004-05-23 Martin Baulig * flowanalysis.cs (Reachability.And): Manually compute the resulting `barrier' from the reachability. 2004-05-23 Marek Safar Fix bug #57835 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns instance of ObsoleteAttribute when symbol is obsolete. * class.cs (IMethodData): Extended interface for ObsoleteAttribute support. 2004-05-22 Marek Safar * attribute.cs: Fix bug #55970 2004-05-22 Marek Safar Fix bug #52705 * attribute.cs (GetObsoleteAttribute): New method. Creates the instance of ObsoleteAttribute. (AttributeTester.GetMemberObsoleteAttribute): Returns instance of ObsoleteAttribute when member is obsolete. (AttributeTester.Report_ObsoleteMessage): Common method for Obsolete error/warning reporting. * class.cs (TypeContainer.base_classs_type): New member for storing parent type. * decl.cs (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute for this MemberCore. 2004-05-21 Marek Safar * attribute.cs, const.cs: Fix bug #58590 2004-05-21 Martin Baulig * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for out parameters if the end of the method is unreachable. Fixes #58098. 2004-05-21 Marek Safar * codegen.cs, cs-parser.jay: Removed SetAttributes method. Hari was right, why extra method. 2004-05-21 Marek Safar * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs. 2004-05-20 Martin Baulig Merged this back from gmcs to keep the differences to a minumum. * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext instead of a Declspace. (Attribute.ResolveType): Likewise. (Attributes.Search): Likewise. (Attributes.Contains): Likewise. (Attributes.GetClsCompliantAttribute): Likewise. * class.cs (TypeContainer.VerifyMembers): Added EmitContext argument. (MethodData.ApplyAttributes): Take an EmitContext instead of a DeclSpace. 2004-05-19 Marek Safar Fix bug #58688 (MCS does not report error when the same attribute is assigned twice) * attribute.cs (Attribute.Emit): Distinction between null and default. 2004-05-19 Raja R Harinath * cs-parser.jay (attribute): Create a GlobalAttribute for the case of a top-level attribute without an attribute target. * attribute.cs (Attribute.Error_AttributeConstructorMismatch): Make non-static. (Attribute.Conditional_GetConditionName), (Attribute.Obsolete_GetObsoleteMessage): Update. (Attribute.IndexerName_GetIndexerName): New. Attribute-specific part of ScanForIndexerName. (Attribute.CanIgnoreInvalidAttribute): New function. (Attribute.ScanForIndexerName): Move to ... (Attributes.ScanForIndexerName): ... here. (Attributes.Attrs): Rename from now-misnamed AttributeSections. (Attributes.Search): New internal variant that can choose not to complain if types aren't resolved. The original signature now complains. (Attributes.GetClsCompliantAttribute): Use internal variant, with complaints suppressed. (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry only if it not useful. (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at top-level for attributes that are shared between the assembly and a top-level class. * parameter.cs (ImplicitParameter): Rename from ParameterAtribute. * class.cs: Update to reflect changes. (DefineIndexers): Fuse loops. * codegen.cs (GetAssemblyName): Update to reflect changes. Accept a couple more variants of attribute names. 2004-05-18 Marek Safar Fix bug #52585 (Implemented explicit attribute declaration) * attribute.cs: (Attributable.ValidAttributeTargets): New abstract method. It gets list of valid attribute targets for explicit target declaration. (Attribute.Target): It holds target itself. (AttributeSection): Removed. (Attribute.CheckTargets): New method. It checks whether attribute target is valid for the current element. * class.cs: (EventProperty): New class. For events that are declared like property (with add and remove accessors). (EventField): New class. For events that are declared like field. class.cs * cs-parser.jay: Implemented explicit attribute target declaration. * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs: Override ValidAttributeTargets. * parameter.cs: (ReturnParameter): Class for applying custom attributes on the return type. (ParameterAtribute): New class. Class for applying custom attributes on the parameter type. 2004-05-17 Miguel de Icaza * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface definitions. (Method): Allow UNSAFE here. * modifiers.cs: Support unsafe reporting. 2004-05-17 Marek Safar * decl.cs: Fix bug #58478. 2004-05-17 Gonzalo Paniagua Javier * statement.cs: When checking for unreachable code on an EmptyStatement, set the location. Fixes bug #58488. 2004-05-13 Miguel de Icaza * driver.cs: Add -pkg handling. From Gonzalo: UseShelLExecute=false 2004-05-12 Marek Safar * attribute.cs: (Attribute.GetAttributeTargets): New method. Gets AttributeTargets for attribute. (Attribute.IsClsCompliaceRequired): Moved to base for better accesibility. (Attribute.UsageAttribute): New property for AttributeUsageAttribute when attribute is AttributeUsageAttribute. (Attribute.GetValidTargets): Simplified. (Attribute.GetAttributeUsage): New method returns AttributeUsage attribute for this type. (Attribute.ApplyAttributes): Method renamed to Emit and make non-static. (GlobalAttributeSection): New class for special handling of global attributes (assembly, module). (AttributeSection.Emit): New method. * class.cs: Implemented Attributable abstract methods. (MethodCore.LabelParameters): Moved to Parameter class. (Accessor): Is back simple class. (PropertyMethod): Implemented Attributable abstract class. (DelegateMethod): Implemented Attributable abstract class. (Event): New constructor for disctintion between normal Event and Event with accessors. * cs-parser.jay: Used new Event ctor and GlobalAttributeSection. * codegen.cs, const.cs, decl.cs, delegate.cs: (CommonAssemblyModulClass): Implemented Attributable abstract class and simplified. * enum.cs: Implement IAttributeSupport interface. (EnumMember): New class for emum members. Implemented Attributable abstract class * parameter.cs: (ParameterBase): Is abstract. (ReturnParameter): New class for easier [return:] attribute handling. * typemanager.cs: Removed builder_to_attr. 2004-05-11 Raja R Harinath Fix bug #57151. * attribute.cs (Attribute.GetPositionalValue): New function. * class.cs (TypeContainer.VerifyMembers): New function. (TypeContainer.Emit): Use it. (ClassOrStruct): New base class for Class and Struct. (ClassOrStruct.ApplyAttributeBuilder): New function. Note if StructLayout(LayoutKind.Explicit) was ascribed to the struct or class. (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out, then each non-static field should have a FieldOffset attribute. Otherwise, none of the fields should have a FieldOffset attribute. * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout and FieldOffset attributes. * typemanager.cs (TypeManager.struct_layout_attribute_type) (TypeManager.field_offset_attribute_type): New core types. (TypeManager.InitCoreTypes): Initialize them. 2004-05-11 Michal Moskal * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo): Return correct type. From bug #58270. 2004-05-09 Miguel de Icaza * expression.cs (Binary.DoNumericPromotions): 0 long constant can be implicitly converted to ulong. * expression.cs: The logic for allowing operator &, | and ^ worked was wrong, it worked before because we did not report an error in an else branch. Fixes 57895. * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to allow volatile fields to be reference types. 2004-05-07 Miguel de Icaza * driver.cs: Add support for /debug- 2004-05-07 Raja R Harinath * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType): Add a 'complain' parameter to silence errors. (Attribute.Resolve): Update to changes. Put in sanity check to catch silently overlooked type-resolutions. (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update to reflect changes. (Attributes.Search): New function. (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search. (Attributes.GetAttributeFullName): Remove hack. * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes): Update to reflect changes. * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute): Use Attributes.Search instead of nested loops. 2004-05-07 Marek Safar * decl.cs: (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute. (MemberCore.VerifyClsCompliance): Implemented CS3019 error report. (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool. * report.cs: (Report.Warning): Renamed to Warning_T because of parameter collision. 2004-05-05 Raja R Harinath * expression.cs (MemberAccess.ResolveMemberAccess): Exit with non-zero status after Report.Error. * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate): Likewise. * typemanager.cs (TypeManager.CoreLookupType): Likewise. 2004-05-04 Lluis Sanchez Gual * support.cs: Don't hang when the file is empty. 2004-05-04 Lluis Sanchez Gual * support.cs: In SeekableStreamReader, compute the preamble size of the underlying stream. Position changes should take into account that initial count of bytes. 2004-05-03 Todd Berman * driver.cs: remove unused GetSysVersion function. 2004-05-03 Todd Berman * driver.cs: Remove the hack from saturday, as well as the hack from jackson (LoadAssemblyFromGac), also adds the CWD to the link_paths to get that bit proper. 2004-05-01 Todd Berman * driver.cs: Try a LoadFrom before a Load, this checks the current path. This is currently a bug in mono that is be fixed, however, this provides a workaround for now. This will be removed when the bug is fixed. 2004-05-01 Sebastien Pouliot * CryptoConvert.cs: Updated to latest version. Fix issue with incomplete key pairs (#57941). 2004-05-01 Todd Berman * driver.cs: Remove '.' from path_chars, now System.* loads properly from the GAC 2004-04-30 Jackson Harper * codegen.cs: Open keys readonly. 2004-04-30 Gonzalo Paniagua Javier * typemanager.cs: don't report cyclic struct layout when a struct contains 2 or more fields of the same type. Failed for Pango.AttrShape which has 2 Pango.Rectangle fields. 2004-04-29 Ben Maurer * expression.cs: Handle IntPtr comparisons with IL code rather than a method call. 2004-04-29 Martin Baulig * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk the list of PropertyInfo's in class hierarchy and find the accessor. Fixes #56013. 2004-04-29 Martin Baulig * typemanager.cs (TypeManager.CheckStructCycles): Fixed. 2004-04-29 Martin Baulig Applying a patch from Benjamin Jemlich . * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes. 2004-04-29 Martin Baulig * class.cs (ConstructorInitializer.Resolve): Check whether the parent .ctor is accessible. Fixes #52146. 2004-04-29 Martin Baulig Applying a patch from Benjamin Jemlich . * statement.cs (Using.EmitLocalVariableDecls): Use TypeManager.idisposable_type, not typeof (IDisposable). (Foreach.EmitCollectionForeach): Added support for valuetypes. 2004-04-29 Martin Baulig * class.cs (Event.Define): Don't emit the field and don't set RTSpecialName and SpecialName for events on interfaces. Fixes #57703. 2004-04-29 Raja R Harinath Refactor Attribute.ApplyAttributes. * attribute.cs (Attributable): New base class for objects that can have Attributes applied on them. (Attribute): Make AttributeUsage fields public. (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static. (Attribute.IsInternalCall): New property. (Attribute.UsageAttr): Convert to a public read-only property. (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext. (Attribute.ResolveType, Attribute.Resolve) (Attribute.ScanForIndexerName): Update to reflect changes. (Attribute.CheckAttributeTarget): Re-format. (Attribute.ApplyAttributes): Refactor, to various Attributable.ApplyAttributeBuilder methods. * decl.cs (MemberCore): Make Attributable. * class.cs (Accessor): Make Attributable. (MethodData.ApplyAttributes): Use proper attribute types, not attribute names. (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes. (TypeContainer.ApplyAttributeBuilder) (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder) (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder) (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder) (Operator.ApplyAttributeBuilder): New factored-out methods. * const.cs (Const.ApplyAttributeBuilder): Likewise. * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise. * enum.cs (Enum.ApplyAttributeBuilder): Likewise. * parameter.cs (ParameterBase): New Attributable base class that can also represent Return types. (Parameter): Update to the changes. 2004-04-29 Jackson Harper * driver.cs: Prefer the corlib system version when looking for assemblies in the GAC. This is still a hack, but its a better hack now. 2004-04-29 Marek Safar * decl.cs, enum.cs: Improved error 3005 reporting. * report.cs (SymbolRelatedToPreviousError): New method for error reporting. (related_symbols): New private member for list of symbols related to reported error/warning. * tree.cs: Do not use now obsolete Report.LocationOfPreviousError. 2004-04-29 Martin Baulig * ecore.cs (Expression.Constantify): If we're an enum and TypeManager.TypeToCoreType() doesn't give us another type, use t.UnderlyingSystemType. Fixes #56178. 2004-04-29 Martin Baulig * decl.cs (MemberCache.SetupCacheForInterface): Look over all our interfaces and for each interface, only add members directly declared in that interface. Fixes #53255. 2004-04-28 Martin Baulig * expression.cs (ConditionalLogicalOperator): Use a temporary variable for `left' to avoid that we evaluate it more than once; bug #52588. 2004-04-28 Martin Baulig * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow `void[]' (CS1547). 2004-04-28 Martin Baulig * statement.cs (LocalInfo.Resolve): Check whether the type is not void (CS1547). * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check whether the type is not void (CS1547). 2004-04-28 Martin Baulig * expression.cs (Unary.DoResolveLValue): Override this and report CS0131 for anything but Operator.Indirection. 2004-04-28 Martin Baulig Committing a patch from Ben Maurer; see bug #50820. * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540 check for classes. * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for classes. 2004-04-28 Martin Baulig Committing a patch from Ben Maurer; see bug #50820. * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540 check for classes. * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for classes. 2004-04-28 Martin Baulig * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks. (Block.AddLabel): Call DoLookupLabel() to only search in the current block. 2004-04-28 Martin Baulig * cfold.cs (ConstantFold.BinaryFold): Added special support for comparing StringConstants and NullLiterals in Equality and Inequality. 2004-04-28 Jackson Harper * driver.cs: Attempt to load referenced assemblies from the GAC. This is the quick and dirty version of this method that doesnt take into account versions and just takes the first canidate found. Will be good enough for now as we will not have more then one version installed into the GAC until I update this method. 2004-04-28 Martin Baulig * typemanager.cs (TypeManager.CheckStructCycles): New public static method to check for cycles in the struct layout. * rootcontext.cs (RootContext.PopulateTypes): Call TypeManager.CheckStructCycles() for each TypeContainer. [Note: We only need to visit each type once.] 2004-04-28 Martin Baulig * constant.cs (StringConstant.Emit): Emit Ldnull if we're null. * const.cs (Const.LookupConstantValue): Return a `bool' signalling success and added `out object value'. Use a `bool resolved' field to check whether we've already been called rather than `ConstantValue != null' since this breaks for NullLiterals. 2004-04-28 Raja R Harinath * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the setting of this flag, since the 'set' method may be non-public. 2004-04-28 Raja R Harinath * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null check on current_vector.Block. 2004-04-27 Martin Baulig * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in a field initializer. Fixes #56459. 2004-04-27 Martin Baulig * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether we're not attempting to use an indexer. Fixes #52154. 2004-04-27 Martin Baulig * statement.cs (Return): Don't create a return label if we don't need it; reverts my change from January 20th. Thanks to Ben Maurer for this. 2004-04-27 Martin Baulig According to the spec, `goto' can only leave a nested scope, but never enter it. * statement.cs (Block.LookupLabel): Only lookup in the current block, don't recurse into parent or child blocks. (Block.AddLabel): Check in parent and child blocks, report CS0140/CS0158 if we find a duplicate. (Block): Removed this indexer for label lookups. (Goto.Resolve): Call LookupLabel() on our current FlowBranching; this already does the error reporting for us. * flowanalysis.cs (FlowBranching.UsageVector.Block): New public variable; may be null. (FlowBranching.CreateSibling): Added `Block' argument. (FlowBranching.LookupLabel): New public virtual method. Lookup a label for the target of a `goto' and check whether we're not leaving a `finally'. 2004-04-27 Martin Baulig * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're a finite loop block, also do the ALWAYS->SOMETIMES for throws (not just for returns). 2004-04-27 Martin Baulig * statement.cs (Block.AddLabel): Also check for implicit blocks and added a CS0158 check. 2004-04-27 Martin Baulig * flowanalysis.cs (FlowBranchingLoop): New class. (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of UsageVector's instead of an ArrayList. (FlowBranching.Label): Likewise. (FlowBranching.UsageVector.MergeBreakOrigins): New method. (FlowBranching.AddBreakVector): New method. 2004-04-27 Miguel de Icaza * attribute.cs: Small regression fix: only convert the type if we the type is different, fixes System.Drawing build. 2004-04-27 Martin Baulig * attribute.cs (Attribute.Resolve): If we have a constant value for a named field or property, implicity convert it to the correct type. 2004-04-27 Raja R Harinath * statement.cs (Block.Block): Implicit blocks share 'child_variable_names' fields with parent blocks. (Block.AddChildVariableNames): Remove. (Block.AddVariable): Mark variable as "used by a child block" in every surrounding block. * ecore.cs (SimpleName.SimpleNameResolve): If the name has already been used in a child block, complain about violation of "Invariant meaning in blocks" rule. * cs-parser.jay (declare_local_variables): Don't use AddChildVariableNames. (foreach_statement): Don't create an implicit block: 'foreach' introduces a scope. 2004-04-23 Miguel de Icaza * convert.cs (ImplicitNumericConversion): 0 is also positive when converting from 0L to ulong. Fixes 57522. 2004-04-22 Marek Safar * decl.cs (FindMemberToOverride): Fix wrong warning for case when derived class hides via 'new' keyword field from base class (test-242.cs). TODO: Handle this in the more general way. * class.cs (CheckBase): Ditto. 2004-04-22 Marek Safar * decl.cs (caching_flags): New member for storing cached values as bit flags. (MemberCore.Flags): New enum where bit flags for caching_flags are defined. (MemberCore.cls_compliance): Moved to caching_flags. (DeclSpace.Created): Moved to caching_flags. * class.cs: Use caching_flags instead of DeclSpace.Created 2004-04-21 Miguel de Icaza * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check if we are only a derived class, not a nested class. * typemanager.cs: Same as above, but do this at the MemberLookup level (used by field and methods, properties are handled in PropertyExpr). Allow for the qualified access if we are a nested method. 2004-04-21 Marek Safar * class.cs: Refactoring. (IMethodData): New inteface; Holds links to parent members to avoid member duplication (reduced memory allocation). (Method): Implemented IMethodData interface. (PropertyBase): New inner classes for get/set methods. (PropertyBase.PropertyMethod): Implemented IMethodData interface (Event): New inner classes for add/remove methods. (Event.DelegateMethod): Implemented IMethodData interface. * cs-parser.jay: Pass DeclSpace to Event class for creation of valid EmitContext (related to class.cs refactoring). 2004-04-21 Raja R Harinath * delegate.cs (Delegate.VerifyApplicability): If the number of arguments are the same as the number of parameters, first try to verify applicability ignoring any 'params' modifier on the last parameter. Fixes #56442. 2004-04-16 Raja R Harinath * class.cs (TypeContainer.AddIndexer): Use 'ExplicitInterfaceName' to determine if interface name was explicitly specified. 'InterfaceType' is not initialized at this time. (TypeContainer.DefineIndexers): Remove use of temporary list. The Indexers array is already in the required order. Initialize 'IndexerName' only if there are normal indexers. (TypeContainer.DoDefineMembers): Don't initialize IndexerName. (TypeContainer.Emit): Emit DefaultMember attribute only if IndexerName is initialized. Fixes #56300. 2004-04-15 Benjamin Jemlich * enum.cs (Enum.DefineType): Don't allow char as type for enum. Fixes #57007 2004-04-15 Raja R Harinath * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous attributes. Fix for #56456. * attribute.cs (Attribute.Resolve): Check for duplicate named attributes. Fix for #56463. 2004-04-15 Miguel de Icaza * iterators.cs (MarkYield): track whether we are in an exception, and generate code accordingly. Use a temporary value to store the result for our state. I had ignored a bit the interaction of try/catch with iterators since their behavior was not entirely obvious, but now it is possible to verify that our behavior is the same as MS .NET 2.0 Fixes 54814 2004-04-14 Miguel de Icaza * iterators.cs: Avoid creating temporaries if there is no work to do. * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with Enumerations, use TypeManager.EnumToUnderlying and call recursively. Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes bug #57013 (This.Emit): Use EmitContext.EmitThis to emit our instance variable. (This.EmitAssign): Ditto. * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special codepaths, we will move all the functionality into Mono.CSharp.This (FieldExpr.EmitAssign): Ditto. This fixes several hidden bugs that I uncovered while doing a code review of this today. * codegen.cs (EmitThis): reworked so the semantics are more clear and also support value types "this" instances. * iterators.cs: Changed so that for iterators in value types, we do not pass the value type as a parameter. Initialization of the enumerator helpers is now done in the caller instead of passing the parameters to the constructors and having the constructor set the fields. The fields have now `assembly' visibility instead of private. 2004-04-11 Miguel de Icaza * expression.cs (Argument.Resolve): Check if fields passed as ref or out are contained in a MarshalByRefObject. * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as another compiler type. 2004-04-06 Ben Maurer * class.cs (Indexer.Define): use the new name checking method. Also, return false on an error. * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier. (is_identifier_[start/part]_character): make static. 2004-04-10 Miguel de Icaza * expression.cs (Binary.ResolveOperator): Do no append strings twice: since we can be invoked more than once (array evaluation) on the same concatenation, take care of this here. Based on a fix from Ben (bug #56454) 2004-04-08 Sebastien Pouliot * codegen.cs: Fix another case where CS1548 must be reported (when delay-sign isn't specified and no private is available #56564). Fix loading the ECMA "key" to delay-sign an assembly. Report a CS1548 error when MCS is used on the MS runtime and we need to delay-sign (which seems unsupported by AssemblyBuilder - see #56621). 2004-04-08 Marek Safar * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too. (TypeManager.ComputeNamespaces): Faster implementation for Microsoft runtime. * compiler.csproj: Updated AssemblyName to mcs. 2004-04-07 Miguel de Icaza * rootcontext.cs: Add new types to the boot resolution. * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from MulticastDelegate is not allowed. * typemanager.cs: Add new types to lookup: System.TypedReference and ArgIterator. * paramter.cs (Parameter.Resolve): if we are an out/ref parameter, check for TypedReference or ArgIterator, they are not allowed. * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this makes us properly catch 1510 in some conditions (see bug 56016 for details). 2004-04-06 Bernie Solomon * CryptoConvert.cs: update from corlib version with endian fixes. 2004-04-05 Miguel de Icaza * class.cs (Indexer.Define): Check indexername declaration 2004-04-05 Marek Safar * attribute.cs (IsClsCompliant): Fixed problem with handling all three states (compliant, not-compliant, undetected). 2004-03-30 Marek Safar * attribute.cs (Attribute): Location is now public. (Resolve): Store resolved arguments (pos_values) in attribute class. Attribute extractors (now GetClsCompliantAttributeValue) can reuse them. (GetClsCompliantAttributeValue): New method that gets CLSCompliantAttribute value. (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace if exists else null. (AttributeTester): New class for CLS-Compliant verification routines. * class.cs (Emit): Add CLS-Compliant verification. (Method.GetSignatureForError): Implemented. (Constructor.GetSignatureForError): Implemented (Constructor.HasCompliantArgs): Returns if constructor has CLS-Compliant arguments. (Constructor.Emit): Override. (Construcor.IsIdentifierClsCompliant): New method; For constructors is needed to test only parameters. (FieldBase.GetSignatureForError): Implemented. (TypeContainer): New member for storing base interfaces. (TypeContainer.FindMembers): Search in base interfaces too. * codegen.cs (GetClsComplianceAttribute): New method that gets assembly or module CLSCompliantAttribute value. (ResolveClsCompliance): New method that resolve CLSCompliantAttribute for assembly. (ModuleClass.Emit): Add error 3012 test. * const.cs (Emit): Override and call base for CLS-Compliant tests. * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant state for all decl types. (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance if CLS-Compliant tests are required. (IsClsCompliaceRequired): New method. Analyze whether code must be CLS-Compliant. (IsExposedFromAssembly): New method. Returns true when MemberCore is exposed from assembly. (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute value or gets cached value. (HasClsCompliantAttribute): New method. Returns true if MemberCore is explicitly marked with CLSCompliantAttribute. (IsIdentifierClsCompliant): New abstract method. This method is used to testing error 3005. (IsIdentifierAndParamClsCompliant): New method. Common helper method for identifier and parameters CLS-Compliant testing. (VerifyClsCompliance): New method. The main virtual method for CLS-Compliant verifications. (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder null. I don't know why is null (too many public members !). (GetClsCompliantAttributeValue). New method. Goes through class hierarchy and get value of first CLSCompliantAttribute that found. * delegate.cs (Emit): Override and call base for CLS-Compliant tests. (VerifyClsCompliance): Override and add extra tests. * driver.cs (CSCParseOption): New command line options (clscheck[+|-]). clscheck- disable CLS-Compliant verification event if assembly is has CLSCompliantAttribute(true). * enum.cs (Emit): Override and call base for CLS-Compliant tests. ApllyAttribute is now called in emit section as in the other cases. Possible future Emit integration. (IsIdentifierClsCompliant): New override. (VerifyClsCompliance): New override. (GetEnumeratorName): Returns full enum name. * parameter.cs (GetSignatureForError): Implemented. * report.cs (WarningData): New struct for Warning message information. (LocationOfPreviousError): New method. (Warning): New method. Reports warning based on the warning table. (Error_T): New method. Reports error based on the error table. * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant verifications are done here. * tree.cs (RecordDecl): Used new LocationOfPreviousError method. * typemanager.cs (cls_compliant_attribute_type): New member thath holds CLSCompliantAttribute. (all_imported_types): New member holds all imported types from other assemblies. (LoadAllImportedTypes): New method fills static table with exported types from all referenced assemblies. (Modules): New property returns all assembly modules. 2004-03-30 Miguel de Icaza * cs-parser.jay: Add a rule to catch wrong event syntax instead of throwing a parser error. * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali which removes the hardcoded get_/set_ prefixes for properties, as IL allows for the properties to be named something else. Bug #56013 * expression.cs: Do not override operand before we know if it is non-null. Fix 56207 2004-03-29 Ben Maurer * typemanager.cs: support for pinned variables. 2004-03-29 Ben Maurer * decl.cs, typemanager.cs: Avoid using an arraylist as a buffer if there is only one result set. 2004-03-29 Ben Maurer * expression.cs: Make sure you cant call a static method with an instance expression, bug #56174. 2004-03-29 Miguel de Icaza * class.cs (IsDuplicateImplementation): Improve error reporting to flag 663 (method only differs in parameter modifier). * cs-tokenizer.cs: Do not require whitespace when a ( or " will do in preprocessor directives. * location.cs (LookupFile): Allow for the empty path. * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a better approach for some of that patch, but its failing with the CharSet enumeration. For now try/catch will do. * typemanager.cs: Do not crash if a struct does not have fields. Fixes 56150. 2004-03-28 Ben Maurer * expression.cs: cs0213, cant fix a fixed expression. fixes 50231. 2004-03-28 Ben Maurer * cs-parser.jay: detect invalid embeded statements gracefully. bug #51113. 2004-03-28 Ben Maurer * ecore.cs, typemanager.cs: Correct impl of cs1540 check. As a regex: s/ the invocation type may not be a subclass of the tye of the item/ The type of the item must be a subclass of the invocation item. /g Fixes bug #50820. 2004-03-25 Sebastien Pouliot * attribute.cs: Added methods to get a string and a bool from an attribute. Required to information from AssemblyKeyFileAttribute, AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool). * codegen.cs: Modified AssemblyName creation to include support for strongnames. Catch additional exceptions to report them as CS1548. * compiler.csproj: Updated include CryptoConvert.cs. * compiler.csproj.user: Removed file - user specific configuration. * CryptoConvert.cs: New. A COPY of the class CryptoConvert from Mono.Security assembly. The original class is maintained and tested in /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs. * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign like CSC 8.0 (C# v2) supports. * Makefile: Added CryptoConvert.cs to mcs sources. * rootcontext.cs: Added new options for strongnames. 2004-03-24 Ben Maurer * driver.cs: For --expect-error, report error code `2' if the program compiled with no errors, error code `1' if it compiled with an error other than the one expected. 2004-03-24 Sebastien Pouliot * compiler.csproj: Updated for Visual Studio .NET 2003. * compiler.csproj.user: Updated for Visual Studio .NET 2003. * compiler.sln: Updated for Visual Studio .NET 2003. 2004-03-24 Ravi Pratap M * expression.cs: Fix bug #47234. We basically need to apply the rule that we prefer the conversion of null to a reference type when faced with a conversion to 'object' (csc behaviour). 2004-03-23 Ben Maurer * statement.cs: Shorter form for foreach, eliminates a local variable. r=Martin. 2004-03-23 Ben Maurer * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that checks if we can use brtrue/brfalse to test for 0. * expression.cs: use the above in the test for using brtrue/brfalse. cleanup code a bit. 2004-03-23 Ben Maurer * expression.cs: Rewrite string concat stuff. Benefits: - "a" + foo + "b" + "c" becomes "a" + foo + "bc" - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []). rather than a concat chain. * typemanager.cs: Add lookups for more concat overloads. 2004-03-23 Ben Maurer * expression.cs: Emit shorter il code for array init. newarr dup // set 1 // set 2 newarr stloc.x ldloc.x // set 1 ldloc.x // set 2 2004-03-22 Ben Maurer * statement.cs: Before, two switch blocks would be merged if the total size of the blocks (end_item - begin_item + 1) was less than two times the combined sizes of the blocks. Now, it will only merge if after the merge at least half of the slots are filled. fixes 55885. 2004-03-20 Atsushi Enomoto * class.cs : csc build fix for GetMethods(). See bug #52503. 2004-03-20 Ben Maurer * expression.cs: Make sure fp comparisons work with NaN. This fixes bug #54303. Mig approved this patch a long time ago, but we were not able to test b/c the runtime had a related bug. 2004-03-19 Miguel de Icaza * ecore.cs (TypExpr.GetHashCode): implement this overload. 2004-03-19 Martin Baulig * class.cs (MemberCore.IsDuplicateImplementation): Report the error here and not in our caller. 2004-03-19 Martin Baulig * interface.cs: Completely killed this file. (Interface): We're now a TypeContainer and live in class.cs. * class.cs (TypeContainer.GetClassBases): Added `bool is_iface' argument; we're now also called for interfaces. (TypeContainer.DefineMembers): Allow this method being called multiple times. (TypeContainer.GetMethods): New public method; formerly known as Interface.GetMethod(). This is used by PendingImplementation. (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface; it's now private and non-static. (Interface): Moved this here; it's now implemented similar to Class and Struct. (Method, Property, Event, Indexer): Added `bool is_interface' argument to their .ctor's. (MemberBase.IsInterface): New public field. * cs-parser.jay: Create normal Method, Property, Event, Indexer instances instead of InterfaceMethod, InterfaceProperty, etc. (opt_interface_base): Removed; we now use `opt_class_base' instead. (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's. 2004-03-19 Martin Baulig * class.cs (MethodCore.IsDuplicateImplementation): New private method which does the CS0111 checking. (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase): Use IsDuplicateImplementation(). 2004-03-17 Ben Maurer * decl.cs (FindMemberToOverride): New method to find the correct method or property to override in the base class. * class.cs - Make Method/Property use the above method to find the version in the base class. - Remove the InheritableMemberSignatureCompare as it is now dead code. This patch makes large code bases much faster to compile, as it is O(n) rather than O(n^2) to do this validation. Also, it fixes bug 52458 which is that nested classes are not taken into account when finding the base class member. Reviewed/Approved by Martin. 2004-03-17 Marek Safar * interface.cs: In all interface classes removed redundant member initialization. 2004-03-16 Martin Baulig * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check. 2004-03-15 Miguel de Icaza * decl.cs (DefineTypeAndParents): New helper method to define a type's containers before the type itself is defined; This is a bug exposed by the recent changes to Windows.Forms when an implemented interface was defined inside a class that had not been built yet. * modifiers.cs (MethodAttr): All methods in C# are HideBySig. (Check): Loop correctly to report errors modifiers (UNSAFE was not in the loop, since it was the same as TOP). * interface.cs: Every interface member now takes a ModFlags, instead of a "is_new" bool, which we set on the base MemberCore. Every place where we called "UnsafeOk" in the interface, now we call the proper member (InterfaceMethod.UnsafeOK) instead to get the unsafe settings from the member declaration instead of the container interface. * cs-parser.jay (opt_new): Allow unsafe here per the spec. * pending.cs (TypeAndMethods): Add `get_indexer_name' and `set_indexer_name' to the pending bits (one per type). We fixed a bug today that was picking the wrong method to override, since for properties the existing InterfaceMethod code basically ignored the method name. Now we make sure that the method name is one of the valid indexer names. 2004-03-14 Gustavo Giráldez * support.cs (SeekableStreamReader): Keep track of stream byte positions and don't mix them with character offsets to the buffer. Patch from Gustavo Giráldez 2004-03-15 Marek Safar * interface.cs (InterfaceSetGetBase): Removed double member initialization, base class does it as well. 2004-03-13 Martin Baulig * class.cs: Reverted Miguel's latest commit; it makes mcs crash when compiling corlib. 2004-03-13 Miguel de Icaza * convert.cs (ExplicitConversion): We were reporting an error on certain conversions (object_type source to a value type, when the expression was `null') before we had a chance to pass it through the user defined conversions. * driver.cs: Replace / and \ in resource specifications to dots. Fixes 50752 * class.cs: Add check for duplicate operators. Fixes 52477 2004-03-11 Miguel de Icaza * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels that are in the middle of the statements, not only at the end. Fixes #54987 * class.cs (TypeContainer.AddField): No longer set the `HaveStaticConstructor' flag, now we call it `UserDefineStaticConstructor' to diferentiate the slightly semantic difference. The situation is that we were not adding BeforeFieldInit (from Modifiers.TypeAttr) to classes that could have it. BeforeFieldInit should be set to classes that have no static constructor. See: http://www.yoda.arachsys.com/csharp/beforefieldinit.html And most importantly Zoltan's comment: http://bugzilla.ximian.com/show_bug.cgi?id=44229 "I think beforefieldinit means 'it's ok to initialize the type sometime before its static fields are used', i.e. initialization does not need to be triggered by the first access to the type. Setting this flag helps the JIT to compile better code, since it can run the static constructor at JIT time, and does not need to generate code to call it (possibly lots of times) at runtime. Unfortunately, mcs does not set this flag for lots of classes like String. csc sets this flag if the type does not have an explicit static constructor. The reasoning seems to be that if there are only static initalizers for a type, and no static constructor, then the programmer does not care when this initialization happens, so beforefieldinit can be used. This bug prevents the AOT compiler from being usable, since it generates so many calls to mono_runtime_class_init that the AOT code is much slower than the JITted code. The JITted code is faster, because it does not generate these calls if the vtable is type is already initialized, which is true in the majority of cases. But the AOT compiler can't do this." 2004-03-10 Miguel de Icaza * class.cs (MethodData.Emit): Refactor the code so symbolic information is generated for destructors; For some reasons we were taking a code path that did not generate symbolic information before. 2004-03-11 Ben Maurer * class.cs: Create a Constructor.CheckBase method that takes care of all validation type code. The method contains some code that was moved from Define. It also includes new code that checks for duplicate ctors. This fixes bug #55148. 2004-03-09 Joshua Tauberer * expression.cs (ArrayCreation): Fix: More than 6 nulls in a { ... }-style array creation invokes EmitStaticInitializers which is not good for reference-type arrays. String, decimal and now null constants (NullCast) are not counted toward static initializers. 2004-03-05 Martin Baulig * location.cs (SourceFile.HasLineDirective): New public field; specifies whether the file contains or is referenced by a "#line" directive. (Location.DefineSymbolDocuments): Ignore source files which either contain or are referenced by a "#line" directive. 2004-02-29 Ben Maurer * class.cs (Method.CheckBase): Avoid using FindMembers, we have direct access to our parent, so check the method inline there. 2004-02-27 Ben Maurer * expression.cs (Invocation.EmitCall): Miguel's last commit caused a regression. If you had: T t = null; t.Foo (); In Foo the implict this would be null. 2004-02-27 Miguel de Icaza * expression.cs (Invocation.EmitCall): If the method is not virtual, do not emit a CallVirt to it, use Call. * typemanager.cs (GetFullNameSignature): Improve the method to cope with ".ctor" and replace it with the type name. * class.cs (ConstructorInitializer.Resolve): Now the method takes as an argument the ConstructorBuilder where it is being defined, to catch the recursive constructor invocations. 2004-02-26 Miguel de Icaza * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New routines to check if a type is an enumerable/enumerator allow classes that implement the IEnumerable or IEnumerator interfaces. * class.cs (Property, Operator): Implement IIteratorContainer, and implement SetYields. (Property.Define): Do the block swapping for get_methods in the context of iterators. We need to check if Properties also include indexers or not. (Operator): Assign the Block before invoking the OperatorMethod.Define, so we can trigger the Iterator code replacement. * cs-parser.jay (SimpleIteratorContainer): new helper class. Both Property and Operator classes are not created when we parse the declarator but until we have the block completed, so we use a singleton SimpleIteratorContainer.Simple to flag whether the SetYields has been invoked. We propagate this setting then to the Property or the Operator to allow the `yield' to function. 2004-02-25 Marek Safar * codegen.cs: Implemented attribute support for modules. New AssemblyClass, ModuleClass and CommonAssemblyModulClass for Assembly/Module functionality. * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs interface.cs, rootcontext.cs, statement.cs, typemanager.cs: Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder. 2004-02-16 Marek Safar * interface.cs (FindMembers): The operation is performed on all base interfaces and not only on the first. It is required for future CLS Compliance patch. 2004-02-12 Ben Maurer * statement.cs, codegen.cs: This patch deals with patterns such as: public class List : IEnumerable { public MyEnumerator GetEnumerator () { return new MyEnumerator(this); } IEnumerator IEnumerable.GetEnumerator () { ... } public struct MyEnumerator : IEnumerator { ... } } Before, there were a few things we did wrong: 1) we would emit callvirt on a struct, which is illegal 2) we emited ldarg when we needed to emit ldarga 3) we would mistakenly call the interface methods on an enumerator type that derived from IEnumerator and was in another assembly. For example: public class MyEnumerator : IEnumerator Would have the interface methods called, even if there were public impls of the method. In a struct, this lead to invalid IL code. 2004-02-11 Marek Safar * const.cs: Const is now derived from FieldBase. Method EmitConstant name renamed to Emit. * delegate.cs (Define): Fixed crash when delegate type is undefined. 2004-02-11 Miguel de Icaza * cs-parser.jay: Fix small regression: we were not testing V2 compiler features correctly. * interface.cs: If the emit context is null, then create one 2004-02-09 Marek Safar * decl.cs (GetSignatureForError): New virtual method to get full name for error messages. * attribute.cs (IAttributeSupport): New interface for attribute setting. Now it is possible to rewrite ApplyAttributes method to be less if/else. * interface.cs : All InterfaceXXX classes are now derived from MemberCore. Duplicated members and code in these classes has been removed. Better encapsulation in these classes. 2004-02-07 Miguel de Icaza * assign.cs (Assign.DoResolve): When dealing with compound assignments, there is a new rule in ECMA C# 2.4 (might have been there before, but it is documented here) that states that in: a op= b; If b is of type int, and the `op' is a shift-operator, then the above is evaluated as: a = (int) a op b * expression.cs (Binary.ResolveOperator): Instead of testing for int/uint/long/ulong, try to implicitly convert to any of those types and use that in pointer arithmetic. * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the method to print information for from the type, not from the null-method we were given. 2004-02-01 Duncan Mak * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before parsing for cmd, fixes bug #53694. 2004-02-04 Marek Safar * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored in the member name duplication tests. Property and operator name duplication was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs). 2004-02-03 Marek Safar * interface.cs (PopulateMethod): Fixed crash when interface method returns not existing type (error test cs0246-3.cs). 2004-02-02 Ravi Pratap M * cs-parser.jay (interface_accessors): Re-write actions to also store attributes attached to get and set methods. Fix spelling while at it. (inteface_property_declaration): Modify accordingly. (InterfaceAccessorInfo): New helper class to store information to pass around between rules that use interface_accessors. * interface.cs (Emit): Apply attributes on the get and set accessors of properties and indexers too. * attribute.cs (ApplyAttributes): Modify accordingly to use the right MethodBuilder when applying attributes to the get and set accessors. 2004-01-31 Miguel de Icaza * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386 2004-01-26 Miguel de Icaza * cs-tokenizer.cs: Handle #line hidden from PDC bits. 2004-01-25 Miguel de Icaza * cs-parser.jay: Remove YIELD token, instead use the new grammar changes that treat `yield' specially when present before `break' or `return' tokens. * cs-tokenizer.cs: yield is no longer a keyword. 2004-01-23 Marek Safar * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags setting for default constructors. For default constructors are almost every time set wrong Modifier. The generated IL code has been alright. But inside mcs this values was wrong and this was reason why several of my CLS Compliance tests failed. 2004-01-22 Martin Baulig * cs-parser.jay (namespace_or_type_name): Return an Expression, not a QualifiedIdentifier. This is what `type_name_expression' was previously doing. (type_name_expression): Removed; the code is now in `namespace_or_type_name'. (qualified_identifier): Removed, use `namespace_or_type_name' instead. (QualifiedIdentifier): Removed this class. 2004-01-22 Martin Baulig * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression, not a string as alias name. 2004-01-21 Miguel de Icaza * ecore.cs (FieldInfo.AddressOf): Revert patch from previous #52730 bug, and instead compute correctly the need to use a temporary variable when requesting an address based on the static/instace modified of the field and the constructor. 2004-01-21 Martin Baulig * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current class and namespace before looking up aliases. Fixes #52517. 2004-01-21 Martin Baulig * flowanalysis.cs (UsageVector.Merge): Allow variables being assinged in a 'try'; fixes exception4.cs. 2004-01-21 Marek Safar * class.cs : Implemented parameter-less constructor for TypeContainer * decl.cs: Attributes are now stored here. New property OptAttributes * delegate.cs, enum.cs, interface.cs: Removed attribute member. * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer 2004-01-21 Marek Safar * typemanager.cs (CSharpSignature): Now reports also inner class name. (CSharpSignature): New method for indexer and property signature. 2004-01-21 Marek Safar * pending.cs (IsVirtualFilter): Faster implementation. 2004-01-21 Marek Safar * typemanager.cs: Avoid inclusion of same assembly more than once. 2004-01-21 Marek Safar * cs-parser.jay: Fixed problem where the last assembly attribute has been applied also to following declaration (class, struct, etc.) 2004-01-21 Marek Safar * class.cs: Added error CS0538, CS0539 reporting. Fixed crash on Microsoft runtime when field type is void. * cs-parser.jay: Added error CS0537 reporting. * pending.cs: Added error CS0535 reporting. Improved error report for errors CS0536, CS0534. 2004-01-20 Miguel de Icaza Merge a few bits from the Anonymous Method MCS tree. * statement.cs (ToplevelBlock): New class for toplevel methods, will hold anonymous methods, lifted variables. * cs-parser.jay: Create toplevel blocks for delegates and for regular blocks of code. 2004-01-20 Martin Baulig * codegen.cs (EmitContext): Removed `InTry', `InCatch', `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel' and `NeedExplicitReturn'; added `IsLastStatement'. (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either have a `ReturnLabel' or we're not unreachable. * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the child's reachability; don't just override ours with it. Fixes #58058 (lluis's example). (FlowBranching): Added public InTryOrCatch(), InCatch(), InFinally(), InLoop(), InSwitch() and BreakCrossesTryCatchBoundary() methods. * statement.cs (Return): Do all error checking in Resolve(). Unless we are the last statement in a top-level block, always create a return label and jump to it. (Break, Continue): Do all error checking in Resolve(); also make sure we aren't leaving a `finally'. (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last statement in a top-level block. (Block.Flags): Added `IsDestructor'. (Block.IsDestructor): New public property. 2004-01-20 Martin Baulig * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427. 2004-01-20 Martin Baulig * statement.cs (Statement.ResolveUnreachable): New public method. (If, While): Do the dead-code elimination in Resolve(), not in Emit(). (Block.Resolve): Resolve unreachable statements. 2004-01-19 Ben Maurer * expression.cs: We need to fix the case where we do not have a temp variable here. * assign.cs: Only expression compound assignments need temporary variables. 2004-01-19 Ben Maurer * flowanalysis.cs: Reduce memory allocation in a few ways: - A block with no variables should not allocate a bit vector for itself. - A method with no out parameters does not need any tracking for assignment of the parameters, so we need not allocate any data for it. - The arrays: public readonly Type[] VariableTypes; public readonly string[] VariableNames; Are redundant. The data is already stored in the variable map, so we need not allocate another array for it. - We need to add alot of checks for if (params | locals) == null due to the first two changes. 2004-01-18 Miguel de Icaza * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not implement IMemoryLocation, we store a copy on a local variable and take the address of it. Patch from Benjamin Jemlich * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule to use a special "type_name_expression" rule which reduces the number of "QualifiedIdentifier" classes created, and instead directly creates MemberAccess expressions. 2004-01-17 Miguel de Icaza * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net) that fixes #52853. Null literal assignment to ValueType * class.cs (MethodData.Emit): Instead of checking the name of the method to determine if its a destructor, create a new derived class from Method called Destructor, and test for that. * cs-parser.jay: Create a Destructor object instead of a Method. Based on a fix from Benjamin Jemlich (pcgod@gmx.net) Fixes: 52933 2004-01-16 Miguel de Icaza * expression.cs (Binary.ResolveOperator): Perform an implicit conversion from MethodGroups to their delegate types on the Addition operation. * delegate.cs: Introduce a new class DelegateCreation that is the base class for `NewDelegate' and `ImplicitDelegateCreation', factor some code in here. * convert.cs (Convert.ImplicitConversionStandard): Add an implicit conversion from MethodGroups to compatible delegate types. * ecore.cs (Expression.Resolve): Do not flag error 654 (Methodgroupd needs parenthesis) if running on the V2 compiler, as we allow conversions from MethodGroups to delegate types now. * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup assignments in v2 either. 2004-01-10 Miguel de Icaza * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing static read-only fields in ctors. Applied patch from Benjamin Jemlich * expression.cs (UnaryMutator): Avoid leaking local variables. 2004-01-09 Miguel de Icaza * cs-tokenizer.cs (IsCastToken): Allow the various native types here to return true, as they can be used like this: (XXX) int.MEMBER () Fixed 49836 and all the other dups 2004-01-09 Zoltan Varga * driver.cs: Implement /win32res and /win32icon. 2004-01-08 Miguel de Icaza * cs-parser.jay: Add a rule to improve error handling for the common mistake of placing modifiers after the type. 2004-01-07 Miguel de Icaza * cs-parser.jay (interface_event_declaration): Catch initialization of events on interfaces, and report cs0068 * cs-parser.jay (interface_event_declaration): Catch initialization of events. * ecore.cs: Better report missing constructors. * expression.cs (Binary.ResolveOperator): My previous bug fix had the error reporting done in the wrong place. Fix. * expression.cs (Binary.ResolveOperator): Catch the operator + (E x, E y) error earlier, and later allow for implicit conversions in operator +/- (E e, U x) from U to the underlying type of E. * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug 52596, if the container class is abstract, the default constructor is protected otherwise its public (before, we were always public). * statement.cs (Fixed.Resolve): Catch a couple more errors in the fixed statement. (Using.EmitLocalVariableDecls): Applied patch from Benjamin Jemlich that fixes bug #52597, MCS was generating invalid code for idisposable structs. Thanks to Ben for following up with this bug as well. 2004-01-06 Miguel de Icaza * driver.cs: Allow assemblies without code to be generated, fixes 52230. 2004-01-07 Nick Drochak * attribute.cs: Remove unneeded catch variables. Eliminates a warning. 2004-01-05 Miguel de Icaza * cs-parser.jay: Add rules to improve error reporting if fields or methods are declared at the namespace level (error 116) * Add rules to catch event add/remove 2004-01-04 David Sheldon * expression.cs: Added matching ")" to error message for CS0077 2004-01-03 Todd Berman * ecore.cs, attribute.cs: Applying fix from #52429. 2004-01-03 Ben Maurer * ecore.cs, expression.cs, statement.cs: Total rewrite of how we handle branching. We now handle complex boolean expressions with fewer jumps. As well if (x == 0) no longer emits a ceq. if (x is Foo) is much faster now, because we generate better code. Overall, we get a pretty big improvement on our benchmark tests. The code we generate is smaller and more readable. I did a full two-stage bootstrap. The patch was reviewed by Martin and Miguel. 2004-01-03 Ben Maurer * cs-parser.jay: Make primary_expression not take a QI. we dont need this because the member_access rule covers us here. So we replace the rule with just IDENTIFIER. This has two good effects. First, we remove a s/r conflict. Second, we allocate many fewer QualifiedIdentifier objects. 2004-01-03 Ben Maurer * attribute.cs: Handle MarshalAs attributes as pseudo, and set the correct information via SRE. This prevents hanging on the MS runtime. Fixes #29374. 2004-01-03 Ben Maurer * convert.cs: correctly handle conversions to value types from Enum and ValueType as unboxing conversions. Fixes bug #52569. Patch by Benjamin Jemlich. 2004-01-02 Ravi Pratap * expression.cs (BetterConversion): Prefer int -> uint over int -> ulong (csc's behaviour). This fixed bug #52046. 2004-01-02 Ben Maurer * decl.cs (MemberCache.FindMembers): now returns a MemberInfo []. * typemanager.cs: In general, go with with ^^. (CopyNewMethods): take an IList. (RealMemberLookup): Only allocate an arraylist if we copy from two sets of methods. This change basically does two things: 1) Fewer array lists allocated due to CopyNewMethods. 2) the explicit cast in MemberList costed ALOT. 2004-01-02 Zoltan Varga * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in a hashtable to avoid needless string allocations when an identifier is used more than once (the common case). 2004-01-01 Ben Maurer * pending.cs: MS's TypeBuilder.GetInterfaces () is broken, it will not return anything. So, we have to use the information we have in mcs to do the task. * typemanager.cs: Add a cache for GetInterfaces, since this will now be used more often (due to ^^) (GetExplicitInterfaces) New method that gets the declared, not effective, interfaces on a type builder (eg, if you have interface IFoo, interface IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) == { IBar }. This patch makes MCS able to bootstrap itself on Windows again. 2004-01-01 Ben Maurer * expression.cs: Remove the Nop's that Miguel put in by mistake. 2003-12-31 Ben Maurer * report.cs, codegen.cs: Give the real stack trace to the error when an exception is thrown. 2003-12-31 Ben Maurer * decl.cs: only allocate hashtables for ifaces if it is an iface! 2003-12-31 Ben Maurer * expression.cs: fix the error from cs0121-2.cs (a parent interface has two child interfaces that have a function with the same name and 0 params and the function is called through the parent). 2003-12-30 Ben Maurer * class.cs, rootcontext.cs, typmanager.cs: do not leak pointers. 2003-12-28 Ben Maurer * codegen.cs: remove stack for the ec flow branching. It is already a linked list, so no need. 2003-12-27 Ben Maurer * Makefile: Allow custom profiler here. 2003-12-26 Ben Maurer * typemanager.cs (LookupType): - Use a static char [], because split takes a param array for args, so it was allocating every time. - Do not store true in a hashtable, it boxes. 2003-12-26 Ben Maurer * flowanalysis.cs: bytify common enums. 2003-12-25 Ben Maurer * modifiers.cs: Add a new set of flags for the flags allowed on explicit interface impls. * cs-parser.jay: catch the use of modifiers in interfaces correctly. * class.cs: catch private void IFoo.Blah (). All related to bug #50572. 2003-12-25 Ben Maurer * decl.cs: Rewrite the consistant accessability checking. Accessability is not linear, it must be implemented in a tableish way. Fixes #49704. 2003-12-25 Ben Maurer * expression.cs: Handle negation in a checked context. We must use subtraction from zero. Fixes #38674. 2003-12-23 Ben Maurer * class.cs: Ignore static void main in DLLs. * rootcontext.cs: Handle the target type here, since we are have to access it from class.cs * driver.cs: account for the above. 2003-12-23 Ben Maurer * report.cs: Give line numbers and files if available. 2003-12-20 Zoltan Varga * driver.cs: Implement /addmodule. * typemanager.cs: Change 'modules' field so it now contains Modules not ModuleBuilders. 2003-12-20 Martin Baulig * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here. (FieldBase.IsAssigned): Removed this field. (FieldBase.SetAssigned): New public method. (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work. 2003-12-20 Martin Baulig * expression.cs (LocalVariableReference.DoResolve): Don't set `vi.Used' if we're called from DoResolveLValue(). * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now returns the usage vector it just merged into the current one - pass this one to UsageWarning(). (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead of the `EmitContext', don't call this recursively on our children. 2003-12-19 Zoltan Varga * driver.cs: Implement /target:module. 2003-12-18 Zoltan Varga * support.cs (CharArrayHashtable): New helper class. * cs-tokenizer.cs: Store keywords in a hashtable indexed by char arrays, not strings, so we can avoid creating a string in consume_identifier if the identifier is a keyword. 2003-12-16 Martin Baulig * statement.cs (LocalInfo.Assigned): Removed this property. (LocalInfo.Flags): Removed `Assigned'. (LocalInfo.IsAssigned): New public method; takes the EmitContext and uses flow analysis. (Block.UsageWarning): Made this method private. (Block.Resolve): Call UsageWarning() if appropriate. * expression.cs (LocalVariableReference.DoResolve): Always set LocalInfo.Used here. 2003-12-13 Martin Baulig * statement.cs (Statement.DoEmit, Statement.Emit): Don't return any value here; we're now using flow analysis to figure out whether a statement/block returns a value. 2003-12-13 Martin Baulig * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this working again. (FlowBranching.MergeFinally): Don't call `branching.CheckOutParameters()' here, this is called in MergeTopBlock(). (FlowBranchingException.AddSibling): Call MergeFinallyOrigins() when adding the `finally' vector. 2003-12-13 Martin Baulig * flowanalysis.cs (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this actually work and also fix #48962. 2003-12-12 Ben Maurer * decl.cs: Do not check System.Object for nested types, since we know it does not have any. Big bang for buck: BEFORE: Run 1: 8.35 seconds Run 2: 8.32 seconds corlib: 17.99 seconds AFTER: Run 1: 8.17 seconds Run 2: 8.17 seconds corlib: 17.39 seconds 2003-12-11 Ben Maurer * class.cs (FindMembers): Allocate arraylists on demand. Most of the time we are returning 0 members, so we save alot here. 2003-12-11 Martin Baulig * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to `MergeChild()', also just take the `FlowBranching' as argument; call Merge() on it and return the result. (FlowBranching.Merge): We don't need to do anything if we just have one sibling. 2003-12-11 Martin Baulig * flowanalysis.cs: Use a list of `UsageVector's instead of storing them in an `ArrayList' to reduce memory usage. Thanks to Ben Maurer for this idea. 2003-12-11 Martin Baulig * flowanalysis.cs (MergeResult): This class is now gone; we now use the `UsageVector' for this. The reason for this is that if a branching just has one sibling, we don't need to "merge" them at all - that's the next step to do. (FlowBranching.Merge): We now return a `UsageVector' instead of a `MergeResult'. 2003-12-11 Martin Baulig Reworked flow analyis and made it more precise and bug-free. The most important change is that we're now using a special `Reachability' class instead of having "magic" meanings of `FlowReturns'. I'll do some more cleanups and optimizations and also add some more documentation this week. * flowanalysis.cs (Reachability): Added `Throws' and `Barrier'; largely reworked this class. (FlowReturns): Removed `Unreachable' and `Exception'; we now use the new `Reachability' class instead of having "magic" values here. (FlowBranching): We're now using an instance of `Reachability' instead of having separate `Returns', `Breaks' etc. fields. * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely based on flow analysis; ignore the return value of block.Emit (). 2003-12-10 Zoltan Varga * driver.cs typemanager.cs: Find the mono extensions to corlib even if they are private. 2003-12-09 Martin Baulig * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed; call them directly on the UsageVector. 2003-12-09 Martin Baulig * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock): Changed return type from `FlowReturns' to `Reachability'. 2003-12-09 Martin Baulig * flowanalysis.cs (FlowBranching.Reachability): New sealed class. (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and `Reachable' fields with a single `Reachability' one. 2003-12-08 Ben Maurer * class.cs (FindMembers): Remove foreach's. Bootstrap times: BEFORE Run 1: 8.74 seconds Run 2: 8.71 seconds AFTER Run 1: 8.64 seconds Run 2: 8.58 seconds 2003-12-08 Ben Maurer * cs-parser.jay: * gen-treedump.cs: * statement.cs: This patch does a few things: 1. EmptyStatement is now a singleton, so it is never reallocated. 2. All blah is EmptyStatement constructs have been changed to blah == EmptyStatement.Value, which is much faster and valid now that EmptyStatement is a singleton. 3. When resolving a block, rather than allocating a new array for the non-empty statements, empty statements are replaced with EmptyStatement.Value 4. Some recursive functions have been made non-recursive. Mainly the performance impact is from (3), however (1) and (2) are needed for this to work. (4) does not make a big difference in normal situations, however it makes the profile look saner. Bootstrap times: BEFORE 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k Total memory allocated: 56397 KB AFTER 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k Total memory allocated: 55666 KB 2003-12-08 Ben Maurer * support.cs: Rewrite DoubleHash to use its own impl. Is faster than the hashtable in a hashtable version * decl.cs: Right now, whenever we try to lookup a type inside a namespace, we always end up concating a string. This results in a huge perf loss, because many strings have to be tracked by the GC. In this patch, we first use a hashtable that works with two keys, so that the strings do not need to be concat'ed. Bootstrap times: BEFORE Run 1: 8.74 seconds Run 2: 8.71 seconds AFTER Run 1: 8.65 seconds Run 2: 8.56 seconds 2003-12-08 Ben Maurer * Makefile: Add a new target `do-time' that does a quick and simple profile, leaving easy to parse output. 2003-12-08 Zoltan Varga * codegen.cs (Init): Create the dynamic assembly with AssemblyBuilderAccess.Save, to enable some optimizations in the runtime. 2003-12-02 Ben Maurer * support.cs: Make the PtrHashtable use only one instance of its comparer. 2003-11-30 Zoltan Varga * typemanager.cs: Fix lookup of GetNamespaces. 2003-11-29 Miguel de Icaza * expression.cs: Removed redundant line. * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on ArrayLists, use for loops with bounds. * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on arraylist. * expression.cs (Invocation.OverloadResolve): Avoid foreach on arraylists, use for loop with bounds. The above three changes give us a 0.071 second performance improvement out of 3.294 seconds down to 3.223. On my machine the above changes reduced the memory usage by 1,387 KB during compiler bootstrap. * cs-parser.jay (QualifiedIdentifier): New class used to represent QualifiedIdentifiers. Before we created a new string through concatenation, and mostly later on, the result would be manipulated by DecomposeQI through string manipulation. This reduced the compiler memory usage for bootstrapping from 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the compile times in 0.05 seconds. 2003-11-28 Dick Porter * support.cs: Do string compares with the Invariant culture. * rootcontext.cs: * gen-treedump.cs: * expression.cs: * driver.cs: * decl.cs: * codegen.cs: * class.cs: Use the char forms of IndexOf and LastIndexOf, so that the comparison is done with the Invariant culture. 2003-11-27 Miguel de Icaza * statement.cs (Foreach.TryType): Use DeclaredOnly to find the GetEnumerator method. (ProbeCollectionType): Iterate starting at the most specific type upwards looking for a GetEnumerator * expression.cs: Shift count can be up to 31 for int/uint and 63 for long/ulong. 2003-11-26 Miguel de Icaza * statement.cs (Block.LookupLabel): Also look for the label on the children blocks. Use a hash table to keep track of visited nodes. * cfold.cs (IntConstant to UIntConstant mapping): Only return if we actually did transform the other operand, otherwise fall back to the common codepath that casts to long. * cs-tokenizer.cs: Use the same code pattern as the int case. Maybe I should do the parsing myself, and avoid depending on the Parse routines to get this done. 2003-11-25 Miguel de Icaza * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti), which fixes bug 51347. This time test it. * expression.cs: Make TypeOfVoid derive from TypeOf, so code in attributes for example can not tell the difference between these. The difference was only a syntax feature of the language. * attribute.cs: Apply attributes to delegates. * delegate.cs: Call the apply attributes method. 2003-11-24 Miguel de Icaza * convert.cs (TryImplicitIntConversion): One line bug fix: we were comparing 0 vs Byte.MinValue, not the value (ImplicitConversionRequired): When reporting a conversion error, use error 31 to print out the constant error instead of the simpler 29. * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti), which fixes bug 51347. 2003-11-22 Miguel de Icaza * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) which fixes the -warnaserror command line option. 2003-11-21 Miguel de Icaza * cfold.cs (DoNumericPromotions): During constant folding of additions on UIntConstant, special case intconstants with IntConstants like we do on the expression binary operator. 2003-11-12 Miguel de Icaza * convert.cs (ImplicitReferenceConversion): We were missing a case (System.Enum are not value types or class types, so we need to classify them separatedly). * driver.cs: We do not support error 2007. 2003-11-12 Jackson Harper * driver.cs: Use corlib.dll or mscorlib.dll when looking up the system directory. Also use the full file name so users can libraries names mscorlib-o-tron.dll in a non system dir. 2003-11-10 Martin Baulig * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed. (TypeManager.InitCoreTypes): Initialize them here, but instead of calling `ResolveType()' on them, directly assign their `Type'. 2003-11-08 Martin Baulig * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the return value and the `out parent' parameter. (TypeContainer.DefineType): Moved the CS0644 check into GetClassBases(). Don't pass the interface types to the `builder.DefineType()'/`builder.DefineNestedType()', but resolve them later and then call `TypeBuilder.AddInterfaceImplementation()'. * ecore.cs (TypeExpr.IsAttribute): New property. (TypeExpr.GetInterfaces): New method. * interface.cs (Interface.GetInterfaceTypeByName): Return a TypeExpr instead of a Type. (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's. (Interface.DefineType): Don't pass the interface types to the `builder.Definetype()'/`builder.DefineNestedType()', but resolve them later and then call `TypeBulider.AddInterfaceImplementation()'. * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]' instead of a `Type[]'. (TypeManager.RegisterBuilder): Likewise. (TypeManager.AddUserInterface): Likewise. (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a `Type[]' and also return a `TypeExpr[]'. (TypeManager.GetInterfaces): Return a `TypeExpr[]'. 2003-11-08 Martin Baulig * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an Expression. 2003-11-08 Martin Baulig * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call TypeManager.ResolveExpressionTypes(). * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr instead of an Expression. (TypeExpr): This is now an abstract base class for `TypeExpression'. (TypeExpression): New public class; formerly known as `TypeExpr'. * expression.cs (ComposedCast): Derive from TypeExpr. * typemanager.cs (TypeManager.system_*_expr): These are now TypExpr's instead of Expression's. (TypeManager.ResolveExpressionTypes): New public static function; called from DeclSpace.GetTypeResolveEmitContext() to resolve all of them. 2003-11-06 Miguel de Icaza * expression.cs (New.DoResolve): Do not dereference value that might be a null return. * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make sure that the constant value has the right type. Fixes an unreported bug, similar to 50425. * const.cs (Const.LookupConstantValue): Call ImplicitStandardConversionExists before doing a conversion to avoid havng the TypeManager.ChangeType do conversions. Reduced the number of casts used (Const.ChangeType): New routine to enable reuse of the constant type changing code from statement. * typemanager.cs (ChangeType): Move common initialization to static global variables. Fixes #50425. * convert.cs (ImplicitReferenceConversion): Somehow we allowed every value type to go through, even if it was void. Fix that. * cs-tokenizer.cs: Use is_identifier_start_character on the start character of the define, and the is_identifier_part_character for the rest of the string. 2003-11-05 Miguel de Icaza * expression.cs (UnaryMutator.EmitCode): When I updated LocalVariableReference.DoResolve, I overdid it, and dropped an optimization done on local variable references. 2003-11-04 Miguel de Icaza * ecore.cs: Convert the return from Ldlen into an int. 2003-10-20 Miguel de Icaza * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for the accessibility, this is a special case for toplevel non-public classes (internal for instance). 2003-10-20 Nick Drochak * ecore.cs: Fix typo and build. Needed another right paren. 2003-10-19 Miguel de Icaza * ecore.cs: Applied fix from Ben Maurer. We were handling in the `internal' case regular and protected, but not allowing protected to be evaluated later. Bug 49840 2003-10-15 Miguel de Icaza * statement.cs (Switch.TableSwitchEmit): Compare the upper bound to kb.Nlast, and not the kb.nFirst to isolate the switch statement. Extract the underlying type, so enumerations of long/ulong are treated like long/ulong. 2003-10-14 Miguel de Icaza * expression.cs (New): Overload the meaning of RequestedType to track the possible creation of the NewDelegate type, since DoResolve is invoked more than once for new constructors on field initialization. See bugs: #48800 and #37014 * cs-parser.jay (declare_local_constants): Take an arraylist instead of a single constant. (local_constant_declaration): It should take a constant_declarators, not a constant_declarator. Fixes 49487 * convert.cs: Fix error report. 2003-10-13 Jackson Harper * typemanager.cs (TypeToCoreType): Add float and double this fixes bug #49611 2003-10-09 Martin Baulig * class.cs (MethodCore): Added additional `DeclSpace ds' argument to the .ctor. (MethodCore.DoDefineParameters): Removed the TypeContainer argument; use the DeclSpace which was passed to the .ctor instead. (MethodCore.CheckParameter): Take a DeclSpace instead of a TypeContainer; we only need a DeclSpace here. 2003-10-09 Martin Baulig * class.cs (MethodData): Added additional `DeclSpace ds' argument to the .ctor. (MethodData.Define, MethodData.Emit): Pass the `ds' to the EmitContext's .ctor. 2003-10-09 Martin Baulig * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer. (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by AsAccessible(), moved them as well. * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace. 2003-10-08 Atsushi Enomoto * cs-parser.jay : Renamed yyName to yyNames related to jay. 2003-10-07 Miguel de Icaza * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code generation for >=, as spotted by Paolo, bug 48679. Patch from David Waite. * cs-tokenizer.cs: Add handling for #pragma. * cs-parser.jay: Allow for both yield and yield return in the syntax. The anti-cobolization of C# fight will go on! * class.cs (TypeBuilder.DefineType): Catch error condition here (Parent.DefineType erroring out and returning null). * expression.cs (ArrayCreation.EmitDynamicInitializers): When coping with enumerations variables, we were mistakenly processing them as a regular value type instead of built-in types. Fixes the bug #48063 * typemanager.cs (IsBuiltinOrEnum): New method. 2003-09-30 Miguel de Icaza * cs-parser.jay: Upgrade: yield now needs the return clause. 2003-09-19 Martin Baulig * decl.cs (MemberCache.SetupCacheForInterface): Take a `MemberCache parent' argument. Normally, an interface doesn't have a parent type except System.Object, but we use this in gmcs for generic type parameters. 2003-09-18 Martin Baulig * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based on `type.IsInterface'; don't check whether the type has a parent to determine whether it's an interface. 2003-09-15 Martin Baulig * class.cs (TypeContainer.DefineType): Added an error flag to avoid reporting duplicate CS0146's ("class definition is circular."). * driver.cs (Driver.MainDriver): Abort if RootContext.ResolveTree() reported any errors. 2003-09-07 Martin Baulig * report.cs (Error, Warning): Added overloaded versions which take a `params object[] args' and call String.Format(). 2003-09-07 Martin Baulig * decl.cs (DeclSpace..ctor): Don't call NamespaceEntry.DefineName() here; do it in RecordDecl() which is called from Tree.RecordDecl(). Fixes the CS0101 reporting. (DeclSpace.RecordDecl): New method. * tree.cs (Tree.RecordDecl): Call ds.RecordDecl(). 2003-09-02 Ravi Pratap * attribute.cs (CheckAttributeTarget): Ensure that we allow return value attributes to be applied to ParameterBuilders. * class.cs (MethodCore.LabelParameters): Make static and more generic so that it can be used from other places - like interface methods, for instance. * interface.cs (Interface.Emit): Call LabelParameters before emitting attributes on the InterfaceMethod. 2003-08-26 Martin Baulig * ecore.cs (SimpleName.SimpleNameResolve): Look for members before resolving aliases; fixes #47927. 2003-08-26 Martin Baulig * statement.cs (Using.DoResolve): This is internally emitting a try/finally clause, so we need to set ec.NeedExplicitReturn if we do not always return. Fixes #47681. 2003-08-26 Martin Baulig * decl.cs (MemberCore): Moved WarningNotHiding(), Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase() into MemberBase. (AdditionResult): Make this nested in DeclSpace. (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry argument; call NamespaceEntry.Define() unless we're nested in a class or struct. * namespace.cs (Namespace.DefineName): New public function. This is called from DeclSpace's .ctor to add (Namespace.Lookup): Include DeclSpaces in the lookup. * class.cs (Operator): Derive from MemberBase, not MemberCore. * const.cs (Const): Derive from MemberBase, not MemberCore. 2003-08-25 Martin Baulig * convert.cs (Convert.ExplicitReferenceConversion): When converting from an interface type to a class, unbox if the target type is a struct type. Fixes #47822. 2003-08-24 Gonzalo Paniagua Javier * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and #47854. 2003-08-22 Martin Baulig * class.cs (TypeManager.DefineType): When defining a nested type, call DefineType() on our parent; fixes #47801. 2003-08-22 Martin Baulig * class.cs (MethodData.Define): While checking if a method is an interface implementation, improve the test a bit more to fix #47654. 2003-08-22 Martin Baulig * expression.cs (Probe.DoResolve): Check whether `expr' resolved correctly; fixes #47722. 2003-08-22 Martin Baulig * expression.cs (UnaryMutator.ResolveVariable): If the target is a LocalVariableReference, ensure it's not read-only. Fixes #47536. * statement.cs (Fixed.DoResolve): Make all variables read-only. 2003-08-22 Martin Baulig * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields can only be assigned in static constructors. Fixes #47161. 2003-08-22 Martin Baulig Rewrote and improved the flow analysis code. * flowbranching.cs (FlowBranching): Make this class abstract. (FlowBranching.CreateBranching): New static function to create a new flow branching. (FlowBranchingBlock, FlowBranchingException): New classes. (FlowBranching.UsageVector.Type): New public readonly field. (FlowBranching.UsageVector.Breaks): Removed the setter. (FlowBranching.UsageVector.Returns): Removed the setter. (FlowBranching.UsageVector): Added Break(), Return(), NeverReachable() and Throw() methods to modify the reachability. (FlowBranching.UsageVector.MergeChildren): Removed, this is now done by FlowBranching.Merge(). (FlowBranching.UsageVector.MergeChild): New method; merges the merge result into the current vector. (FlowBranching.Merge): New abstract method to merge a branching. 2003-08-12 Martin Baulig * expression.cs (Indirection.CacheTemporaries): Create the LocalTemporary with the pointer type, not its element type. 2003-08-10 Miguel de Icaza * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a token was a keyword or not. Add `error' options where an IDENTIFIER was expected; Provide CheckToken and CheckIdentifierToken convenience error reporting functions. Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'. * decl.cs: Rename `NamespaceEntry Namespace' public field into NameSpaceEntry NameSpaceEntry. (LookupInterfaceOrClass): Avoid creating a full qualified name from namespace and name: avoid doing lookups when we know the namespace is non-existant. Use new Tree.LookupByNamespace which looks up DeclSpaces based on their namespace, name pair. * driver.cs: Provide a new `parser verbose' to display the exception thrown during parsing. This is turned off by default now, so the output of a failure from mcs is more graceful. * namespace.cs: Track all the namespaces defined in a hashtable for quick lookup. (IsNamespace): New method 2003-08-09 Miguel de Icaza * namespace.cs: Remove redundant call; Avoid using MakeFQN when we know that we need to concatenate (full typename can never be null). * class.cs: ditto. * statement.cs: Use a bitfield; Do not initialize to null things which are done by the constructor by default. * cs-parser.jay: bug fix, parameter was 4, not 3. * expression.cs: Just use the property; * statement.cs: No need for GetVariableInfo method. 2003-08-08 Martin Baulig * flowanalysis.cs (FlowReturns): This is now nested in the `FlowBranching' class. (MyBitVector): Moved this here from statement.cs. (FlowBranching.SiblingType): New enum type. (FlowBranching.CreateSibling): Added `SiblingType' argument. 2003-08-07 Martin Baulig * flowanalysis.cs (FlowBranchingType): This is now nested in the `FlowBranching' class and called `BranchingType'. 2003-08-07 Martin Baulig * flowanalysis.cs: Moved all the control flow analysis code into its own file. 2003-08-07 Martin Baulig * assign.cs (Assign.DoResolve): `target' must either be an IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes #37319. 2003-08-07 Miguel de Icaza * expression.cs (BinaryMethod): This kind of expression is created by the Binary class if it determines that the operator has to be handled by a method. (BinaryDelegate): This kind of expression is created if we are dealing with a + or - operator on delegates. (Binary): remove method, argumetns, and DelegateOperator: when dealing with methods, * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout. * statement.cs (Block): use bitfields for the three extra booleans we had in use. Remove unused topblock parameter. * codegen.cs: Remove unecessary argument to Block.EmitTopBlock * assign.cs: Drop extra unneeded tests. 2003-08-06 Miguel de Icaza * iterators.cs (Mapvariable): provide a mechanism to use prefixes. * statement.cs (Foreach): Use VariableStorage instead of LocalBuilders. * codegen.cs (VariableStorage): New class used by clients that require a variable stored: locals or fields for variables that need to live across yield. Maybe provide a convenience api for EmitThis+EmitLoad? (GetTemporaryLocal, FreeTemporaryLocal): Recycle these bad boys. 2003-08-05 Miguel de Icaza * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter, RemapParameterLValue): New methods that are used to turn a precomputed FieldInfo into an expression like this: instance.FieldInfo The idea is to use this instead of making LocalVariableReference have more than one meaning. * cs-parser.jay: Add error production to BASE. * ecore.cs: Deal with TypeManager.GetField returning null, which is now a valid return value. (FieldExprNoAddress): New expression for Fields whose address can not be taken. * expression.cs (LocalVariableReference): During the resolve phases, create new expressions if we are in a remapping context. Remove code that dealt with remapping here. (ParameterReference): same. (ProxyInstance): New expression, like the `This' expression, but it is born fully resolved. We know what we are doing, so remove the errors that are targeted to user-provided uses of `this'. * statement.cs (Foreach): our variable is now stored as an Expression; During resolution, follow the protocol, dont just assume it will return this. 2003-08-06 Martin Baulig * support.cs (SeekableStreamReader.cs): New public class. * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new SeekableStreamReader instead of the normal StreamReader. 2003-08-04 Martin Baulig * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST, CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to deambiguate casts and delegate invocations. (parenthesized_expression): Use the new tokens to ensure this is not a cast of method invocation. * cs-tokenizer.cs (is_punct): Return one of the new special tokens when reading a `)' and Deambiguate_CloseParens () was previously called. * expression.cs (ParenthesizedExpression): New class. This is just used for the CS0075 test. (Binary.DoResolve): Check for CS0075. 2003-07-29 Ravi Pratap * expression.cs (Invocation.MakeUnionSet): Patch from Lluis Sanchez : use TypeManager.ArrayContainsMethod instead of a direct reference comparison. (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also examine the ReturnType for equality - this is necessary in the cases of implicit and explicit operators whose signature also includes the return type. 2003-07-26 Miguel de Icaza * namespace.cs: Cache the result of the namespace computation, instead of computing it every time. 2003-07-24 Miguel de Icaza * decl.cs: Use a global arraylist that we reuse over invocations to avoid excesive memory consumption. Reduces memory usage on an mcs compile by one meg (45 average). * typemanager.cs (LookupTypeReflection): In .NET pointers are private, work around that. 2003-07-23 Miguel de Icaza * literal.cs (IntLiteral): Define Zero and One static literals. * cs-parser.jay (integer_literal): use static literals to reduce memory usage for the most used literals (0, 1 and -1). 211kb reduced in memory usage. Replace all calls to `new ArrayList' with `new ArrayList(4)' which is a good average number for most allocations, and also requires only 16 bytes of memory for its buffer by default. This reduced MCS memory usage in seven megabytes for the RSS after bootstrapping. 2003-07-28 Ravi Pratap * expression.cs (Invocation.OverloadResolve): Fix the algorithm to handle params methods the correct way by forming only one applicable set with params and normal methods in them. Earlier we were looking at params methods only if we found no normal methods which was not the correct thing to do. (Invocation.BetterFunction): Take separate arguments indicating when candidate and the best method are params methods in their expanded form. This fixes bugs #43367 and #46199. * attribute.cs: Documentation updates. (CheckAttribute): Rename to CheckAttributeTarget. (GetValidPlaces): Rename to GetValidTargets. * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial bug - use Convert.ImplicitConversion, not ImplicitUserConversion! Fixes bug #44468. 2003-07-28 Martin Baulig * class.cs (TypeContainer.DefineMembers): Use the base type's full name when looking up the base class of a nested class. Fixes #46977. 2003-07-26 Martin Baulig * expression.cs (Indexers.Indexer): New nested struct; contains getter, setter and the indexer's type. (Indexers.Properties): This is now an ArrayList of Indexers.Indexer's. (IndexerAccess.DoResolveLValue): Correctly set the type if the indexer doesn't have any getters. * assign.cs (Assign.DoResolve): Also do the implicit conversions for embedded property and indexer assignments. 2003-07-26 Martin Baulig * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a preprocessor directive is not the first non-whitespace character on a line. 2003-07-26 Martin Baulig * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the namespace parsing, follow the spec more closely. * rootcontext.cs (RootContext.NamespaceLookup): Use the new NamespaceEntry.Lookup(). 2003-07-25 Martin Baulig * MethodCore.cs (OverridesSomething): New public field; it's set from TypeContainer.DefineMembers if this method overrides something (which doesn't need to be a method). Fix #39462. 2003-07-25 Ravi Pratap * typemanager.cs (GetMembers): Ensure that the list of members is reversed. This keeps things in sync. * attribute.cs (Attribute.CheckAttribute): Break as soon as we find an AttributeUsage attribute. * expression.cs (Invocation.OverloadResolve): Perform the check which disallows Invoke to be directly called on a Delegate. (Error_InvokeOnDelegate): Report error cs1533. 2003-07-25 Martin Baulig * expression.cs (Indexers.GetIndexersForType): Only look in the interface hierarchy if the requested type is already an interface. Fixes #46788 while keeping #46502 fixed. 2003-07-25 Martin Baulig * class.cs (TypeContainer.DefineMembers): Check whether all readonly fields have been assigned and report warning CS0649 if not. * statement.cs (LocalInfo.IsFixed): Always return true if this is a valuetype. 2003-07-24 Ravi Pratap * decl.cs (MemberCache.AddMethods): Reverse the order of the array returned from GetMethods to make things consistent with the assumptions MCS makes about ordering of methods. This should comprehensively fix bug #45127 and it does :-) * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the ordering is actually reverse. * Clean up some debug messages I left lying around. * interface.cs (Populate*): Get rid of code which emits attributes since the stage in which we emit attributes is the 'Emit' stage, not the define stage. (Emit): Move attribute emission for interface members here. 2003-07-22 Ravi Pratap * expression.cs (Invocation.OverloadResolve): Follow the spec more closely: we eliminate methods in base types when we have an applicable method in a top-level type. Please see section 14.5.5.1 for an exact description of what goes on. This fixes bug #45127 and a host of other related to corlib compilation. * ecore.cs (MethodGroupExpr.DeclaringType): The element in the array is the method corresponding to the top-level type (this is because of the changes made to icall.c) so we change this accordingly. (MethodGroupExpr.Name): This too. * typemanager.cs (GetElementType): New method which does the right thing when compiling corlib. * everywhere: Make use of the above in the relevant places. 2003-07-22 Martin Baulig * cs-parser.jay (invocation_expression): Moved `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from `cast_expression', but create a InvocationOrCast which later resolves to either an Invocation or a Cast. * ecore.cs (ExpressionStatement.ResolveStatement): New virtual method; call this before EmitStatement() to make sure that this expression can be used as a statement. * expression.cs (InvocationOrCast): New class; resolves to either an Invocation or a Cast. * statement.cs (StatementExpression): Call ResolveStatement() on the ExpressionStatement before emitting it. 2003-07-21 Martin Baulig * expression.cs (Invocation.VerifyArgumentsCompat): Check whether `ref' and `out' attributes match; fixes #46220. (MemberAccess.ResolveMemberAccess): You can't reference a type through an expression; fixes #33180. (Indexers.GetIndexersForType): Don't return the indexers from interfaces the class implements; fixes #46502. 2003-07-21 Martin Baulig * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and CS0661 checks; fixes bug #30442. 2003-07-21 Martin Baulig * decl.cs (AdditionResult): Added `Error'. * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'. * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes cs0031.cs actually work. 2003-07-20 Martin Baulig * namespace.cs: Fixed that bug which caused a crash when compiling the debugger's GUI. 2003-07-20 Miguel de Icaza * typemanager.cs (LookupTypeReflection): Never expose types which are NotPublic, NestedPrivate, NestedAssembly, or NestedFamANDAssem. We used to return these, and later do a check that would report a meaningful error, but the problem is that we would not get the real match, if there was a name override. 2003-07-18 Miguel de Icaza * namespace.cs (Namespace, Name): Do not compute the namespace name dynamically, compute it in the constructor. This reduced memory usage by 1697 KB. * driver.cs: Use --pause to pause at the end. 2003-07-17 Peter Williams * Makefile: Change the name of the test target so that it doesn't conflict with the recursive test target. 2003-07-17 Miguel de Icaza * expression.cs (LocalVariableReference.Emit, EmitAssign, AddressOf): Do not use EmitThis, that was wrong, use the actual this pointer. 2003-07-15 Miguel de Icaza * class.cs (MethodData.Define): While checking if a method is an interface implementation, improve the test: If we are not public (use new test here: use the computed MethodAttributes directly, instead of the parsed modifier flags) check if the `implementing' method comes from an interface or not. * pending.cs (VerifyPendingMethods): Slightly better error message. * makefile: add test target that does the mcs bootstrap. 2003-07-16 Ravi Pratap * interface.cs (Define): Do nothing here since there are no members to populate etc. Move the attribute emission out of here since this was just totally the wrong place to put it. Attribute application happens during the 'Emit' phase, not in the 'Define' phase. (Emit): Add this method and move the attribute emission here * rootcontext.cs (EmitCode): Call the Emit method on interface types too. 2003-07-14 Ravi Pratap M * expression.cs (OverloadResolve): Report error only if Location is not 'Null' which means that there was a probe going on. 2003-07-14 Martin Baulig * expression.cs (ConditionalLogicalOperator): New public class to implement user defined conditional logical operators. This is section 14.11.2 in the spec and bug #40505. 2003-07-14 Martin Baulig * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198. 2003-07-14 Martin Baulig * codegen.cs (EmitContext.InFixedInitializer): New public field. * ecore.cs (IVariable.VerifyFixed): New interface method. * expression.cs (Unary.ResolveOperator): When resolving the `&' operator, check whether the variable is actually fixed. Fixes bug #36055. Set a variable definitely assigned when taking its address as required by the spec. * statement.cs (LocalInfo.IsFixed): New field. (LocalInfo.MakePinned): Set `IsFixed' to true. 2003-07-14 Ravi Pratap M * attribute.cs (Attribute.Resolve): While doing a Member lookup for .ctors, ensure that we only ask for members declared in the attribute type (BindingFlags.DeclaredOnly). Fixes bug #43632. * expression.cs (Error_WrongNumArguments): Report error 1501 correctly the way CSC does. 2003-07-13 Martin Baulig * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type lookup on the fully qualified name, to make things like "X.X" work where "X.X" is a fully qualified type name, but we also have a namespace "X" in the using list. Fixes #41975. 2003-07-13 Martin Baulig * assign.cs (Assign.GetEmbeddedAssign): New protected virtual function. If we're a CompoundAssign, we need to create an embedded CompoundAssign, not an embedded Assign. (Assign.DoResolve): Make this work for embedded CompoundAssign's. Fixes #45854. 2003-07-13 Martin Baulig * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually work to fix bug #46088. 2003-07-13 Ravi Pratap * class.cs (Operator.Emit): Do not emit attributes here - it is taken care of by the Method class that we delegate too. This takes care of bug #45876. 2003-07-10 Martin Baulig * expression.cs (TypeOfVoid): New class. (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264. 2003-07-10 Martin Baulig * class.cs (MethodCore.DoDefineParameters): Added CS0225 check; bug #35957. 2003-07-10 Martin Baulig * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace, not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel(). * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel(). * typemanager.cs (TypeManager.IsAccessibleFrom): Removed. 2003-07-10 Martin Baulig * expression.cs (ArrayCreation): Don't use a byte blob for arrays of decimal. Fixes #42850. NOTE: I also fixed the created byte blob, but this doesn't work on the MS runtime and csc never produces any byte blobs for decimal arrays. 2003-07-10 Martin Baulig * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in structs; fixes #32068. (Block.AddChildVariableNames): Fixed #44302. 2003-07-07 Gonzalo Paniagua Javier * namespace.cs: fixed compilation with csc. It's bugzilla #44302. 2003-07-07 Miguel de Icaza * attribute.cs: And this test is onger needed. 2003-07-08 Martin Baulig * rootcontext.cs (RootContext.NamespaceLookup): Ignore inaccessible types. Fixes #36313. * decl.cs (DeclSpace.FindType): Ignore inaccessible types. * namespace.cs (NamespaceEntry): Create implicit entries for all namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create implicit entries for N1.N2 and N1. 2003-07-08 Martin Baulig Rewrote the handling of namespaces to fix a lot of the issues wrt. `using' aliases etc. * namespace.cs (Namespace): Splitted this class into a per-assembly `Namespace' and a per-file `NamespaceEntry'. * typemanager.cs (TypeManager.IsNamespace): Removed. (TypeManager.ComputeNamespaces): Only compute namespaces from loaded assemblies here, not the namespaces from the assembly we're currently compiling. 2003-07-08 Martin Baulig * rootcontext.cs, class.cs: Fixed the CS1530 reporting. 2003-07-07 Miguel de Icaza * typemanager.cs: Reverted patch from Gonzalo, my previous patch already fixed it. I thought about the memory savings here, but LookupTypeReflection is used under already very constrained scenarios. Compiling corlib or mcs only exposes one hit, so it would not really reduce any memory consumption. 2003-07-07 Gonzalo Paniagua Javier * typemanager.cs: fixes bug #45889 by only adding public types from other assemblies to the list of known types. 2003-07-07 Miguel de Icaza * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel on the type we resolved. 2003-07-05 Martin Baulig * pending.cs (PendingImplementation.ParentImplements): Don't create the proxy if the parent is abstract. * class.cs (TypeContainer.DefineIndexers): Process explicit interface implementations first. Fixes #37714. 2003-07-04 Miguel de Icaza * expression.cs (MemberAccess.ResolveMemberAccess): Events are defined recursively; but since we modify the input parameters (left is set to `this' temporarily), we reset this value if the left_is_explicit is false, which gives the original semantics to the code. * literal.cs (NullPointer): new class used to represent a null literal in a pointer context. * convert.cs (Convert.ImplicitReferenceConversion): Is the target type is a pointer, use a NullPointer object instead of a NullLiteral. Closes 43687 (ExplicitConversion): Convert pointer values using the conv opcode to the proper type. * ecore.cs (New): change ValueTypeVariable property into a method, that returns whether the valuetype is suitable for being used. * expression.cs (Binary.DoNumericPromotions): Only return if we the int constant was a valid uint, and we can return both left and right as uints. If not, we continue processing, to trigger the type conversion. This fixes 39018. * statement.cs (Block.EmitMeta): During constant resolution, set the CurrentBlock property on the emitcontext, so that we resolve constants propertly. 2003-07-02 Martin Baulig * codegen.cs (EmitContext.NeedExplicitReturn): New public variable. (EmitContext.EmitTopBlock): Emit an explicit return if it's set. * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather than emitting it here. * statement.cs: Fixed some more flow analysis bugs. 2003-07-02 Martin Baulig * class.cs (MethodData.Define): When implementing interface methods, set Final unless we're Virtual. * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506 check work for interface methods. 2003-07-01 Martin Baulig * ecore.cs (EmitContext.This): Replaced this property with a GetThis() method which takes a Location argument. This ensures that we get the correct error location for a CS0188. 2003-07-01 Miguel de Icaza * ecore.cs: (Convert.ConvertIntLiteral): Add test for ImplicitStandardConversion. * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649. 2003-07-01 Zoltan Varga * expression.cs (ResolveOperator): Fix Concat (string, string, string) optimization. 2003-06-30 Miguel de Icaza * class.cs (Constructor.Define): Turn off initlocals for unsafe constructors. (MethodData.Define): Turn off initlocals for unsafe methods. 2003-06-29 Miguel de Icaza * decl.cs (DeclSpace.CheckAccessLevel): Make this routine complete; Fixes #37521. * delegate.cs: Use Modifiers.TypeAttr to compute the TypeAttributes, instead of rolling our own. This makes the flags correct for the delegates. 2003-06-28 Miguel de Icaza * class.cs (Constructor.Define): Set the private flag for static constructors as well. * cs-parser.jay (statement_expression): Set the return value to null, to avoid a crash when we catch an error. 2003-06-24 Miguel de Icaza * cs-parser.jay: Applied patch from Jackson that adds support for extern and unsafe modifiers to destructor declarations. * expression.cs: Report error 21 if the user is trying to index a System.Array. * driver.cs: Add an error message, suggested by the bug report. * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers if we do not have a ": this ()" constructor initializer. Fixes 45149 2003-06-14 Miguel de Icaza * namespace.cs: Add some information to reduce FAQs. 2003-06-13 Miguel de Icaza * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other underlying enumeration types. Fixes #43915. * expression.cs: Treat ushort/short as legal values to be used in bitwise operations. Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro * delegate.cs: transfer custom attributes for paramenters from the delegate declaration to Invoke and BeginInvoke. Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro * attribute.cs: handle custom marshalers and emit marshal info for fields, too. 2003-05-28 Hector E. Gomez Morales * makefile.gnu: Added anonymous.cs to the compiler sources. 2003-05-28 Miguel de Icaza * iterators.cs: Change the name of the proxy class to include two underscores. * cs-parser.jay: Update grammar to include anonymous methods. * anonymous.cs: new file. 2003-05-27 Miguel de Icaza * class.cs (Field.Define): Add missing test for pointers and safety. 2003-05-27 Ravi Pratap * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr, we use the stobj opcode. (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch since it wasn't the correct fix. It still is puzzling that we are required to use stobj for IntPtr which seems to be a ValueType. 2003-05-26 Miguel de Icaza * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases during regular simple name resolution. Now, the trick is that instead of returning for processing the simplename, we do a TypeManager.LookupType (ie, a rooted lookup as opposed to a contextual lookup type). If a match is found, return that, if not, return for further composition. This fixes long-standing 30485. * expression.cs (ArrayCreation.EmitDynamicInitializers): When using the address to initialize an object, do an Stobj instead of using the regular Stelem. (IndexerAccess.Emit, IndexerAccess.EmitAssign): Pass `is_base_indexer' to Invocation.EmitCall instead of false. Because if we are a BaseIndexerAccess that value will be true. Fixes 43643. * statement.cs (GotoCase.Resolve): Return after reporting an error, do not attempt to continue. * expression.cs (PointerArithmetic.Emit): If our operand is a long, convert our constants to match the operand before multiplying. Convert to I type before adding. Fixes 43670. 2003-05-14 Ravi Pratap * enum.cs (ImplicitConversionExists) : Rename to ImplicitEnumConversionExists to remove ambiguity. * ecore.cs (NullCast): New type of cast expression class which basically is very similar to EmptyCast with the difference being it still is a constant since it is used only to cast a null to something else (eg. (string) null) * convert.cs (ImplicitReferenceConversion): When casting a null literal, we return a NullCast. * literal.cs (NullLiteralTyped): Remove - I don't see why this should be around anymore. The renaming (reported was slightly wrong). Corrections: ConvertImplicitStandard -> ImplicitConversionStandard ConvertExplicitStandard -> ExplicitConversionStandard * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments before passing them in ! * convert.cs (ImplicitConversionStandard): When comparing for equal expr and target types, ensure that expr is not a NullLiteral. In general, we must not be checking (expr_type == target_type) in the top level conversion methods (ImplicitConversion, ExplicitConversion etc). This checking is done in the methods that they delegate to. 2003-05-20 Miguel de Icaza * convert.cs: Move Error_CannotConvertType, ImplicitReferenceConversion, ImplicitReferenceConversionExists, ImplicitNumericConversion, ImplicitConversionExists, ImplicitUserConversionExists, StandardConversionExists, FindMostEncompassedType, FindMostSpecificSource, FindMostSpecificTarget, ImplicitUserConversion, ExplicitUserConversion, GetConversionOperators, UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard, TryImplicitIntConversion, Error_CannotConvertImplicit, ConvertImplicitRequired, ConvertNumericExplicit, ExplicitReferenceConversionExists, ConvertReferenceExplicit, ConvertExplicit, ConvertExplicitStandard from the ecore.cs into its own file. Perform the following renames: StandardConversionExists -> ImplicitStandardConversionExists ConvertImplicit -> ImplicitConversion ConvertImplicitStandard -> ImplicitStandardConversion TryImplicitIntConversion -> ImplicitIntConversion ConvertImplicitRequired -> ImplicitConversionRequired ConvertNumericExplicit -> ExplicitNumericConversion ConvertReferenceExplicit -> ExplicitReferenceConversion ConvertExplicit -> ExplicitConversion ConvertExplicitStandard -> ExplicitStandardConversion 2003-05-19 Martin Baulig * statement.cs (TypeInfo.StructInfo): Made this type protected. (TypeInfo): Added support for structs having structs as fields. * ecore.cs (FieldExpr): Implement IVariable. (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the VariableInfo for the field. 2003-05-18 Martin Baulig * expression.cs (This.DoResolve): Report a CS0027 if we're emitting a field initializer. 2003-05-18 Martin Baulig * expression.cs (This.ResolveBase): New public function. (This.DoResolve): Check for CS0188. * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not This.Resolve(). * ecore.cs (MethodGroupExpr.DoResolve): Set the `instance_expression' to null if we don't have any non-static methods. 2003-05-18 Martin Baulig Reworked the way how local variables and parameters are handled by the flow analysis code. * statement.cs (TypeInfo, VariableMap): New public classes. (VariableInfo): New public class. This is now responsible for checking whether a variable has been assigned. It is used for parameters and local variables. (Block.EmitMeta): Take the InternalParameters as argument; compute the layout of the flow vectors here. (Block.LocalMap, Block.ParameterMap): New public properties. (FlowBranching): The .ctor doesn't get the InternalParameters anymore since Block.EmitMeta() now computes the layout of the flow vector. (MyStructInfo): This class is now known as `StructInfo' and nested in `TypeInfo'; we don't access this directly anymore. * ecore.cs (IVariable): Added `VariableInfo VariableInfo' property and removed IsAssigned(), IsFieldAssigned(), SetAssigned() and SetFieldAssigned(); we now call them on the VariableInfo so we don't need to duplicate this code everywhere. * expression.cs (ParameterReference): Added `Block block' argument to the .ctor. (LocalVariableReference, ParameterReference, This): The new VariableInfo class is now responsible for all the definite assignment stuff. * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned, IsParameterAssigned, SetParameterAssigned): Removed. 2003-05-18 Martin Baulig * typemanager.cs (InitCoreTypes): Try calling SetCorlibTypeBuilders() with 4 args; if that fails, fall back to the 3-args-version. Corlib now also needs our `void_type'. (GetMethod): Added overloaded version which takes an optional `bool report_errors' to allow lookups of optional methods. 2003-05-12 Martin Baulig * statement.cs (VariableInfo): Renamed to LocalInfo since it's only used for locals and not for parameters. 2003-05-12 Miguel de Icaza * support.cs (InternalParameters.ParameterType): Return the ExternalType of the parameter. * parameter.cs (Parameter.ExternalType): drop the two arguments, they were unused. 2003-05-11 Miguel de Icaza * class.cs (MethodData.Define): Do not set the `newslot' on interface members, if they are also flagged as "override". * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit better code for ++i and i++. This only works for static fields and local variables. * typemanager.cs (LookupDeclSpace): Add new method, sometimes we want to pull the DeclSpace out of the builder_to_declspace instead of the TypeBuilder (like in TypeContainer.FindMembers). * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace instead of LookupTypeContainer. Fixes the crash on .NET for looking up interface members. * const.cs: Create our own emit context during the Definition stage, so that constants are evaluated in the proper context, when a recursive definition happens. 2003-05-11 Martin Baulig * statement.cs (Block.CreateSwitchBlock): New method. Creates a new block for a switch section. (Block.AddLabel, Block.LookupLabel): If we're a switch section, do the adding/lookup in the switch block. Fixes #39828. 2003-05-09 Miguel de Icaza * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing functionality: I needed to convert the data after I had performed the add/sub operation into the operands type size. * ecore.cs (ImplicitReferenceConversion): When boxing an interface pass the type for the box operation, otherwise the resulting object would have been of type object. (BoxedCast): Add constructor to specify the type to box as. 2003-05-07 Miguel de Icaza * iterators.cs: I was reusing the `count' variable inadvertently, take steps to not allow this to happen. 2003-05-06 Miguel de Icaza * attribute.cs (Attribute.Resolve): Params attributes are encoded by creating an array at the point where the params starts and putting all those arguments there, then adjusting the size of the array. 2003-05-05 Miguel de Icaza * expression.cs (New.AddressOf): Implement interface IMemoryLocation. This is used when the `new' operator is used in the context of an invocation to a method on a value type. See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an example. * namespace.cs: Also check the using aliases here. * driver.cs: Move the test for using validity after the types have been entered, so we do a single pass that also includes the using aliases. * statement.cs (Try.Resolve): Avoid crashing if there is a failure in the regular case. CreateSiblingForFinally is doing extra error checking. * attribute.cs (GetAttributeArgumentExpression): Store the result on an out value, and use the return value to indicate failure instead of using null (which is a valid return for Constant.GetValue). * statement.cs: Perform the analysis flow for the increment portion after the statement, because this will be the real flow of execution. Fixes #42385 * codegen.cs (EmitContext.EmitArgument, EmitContext.EmitStoreArgument): New helper functions when the RemapToProxy flag is set. * expression.cs (ParameterReference.EmitLdarg): Expose this useful function. Add support for remapping parameters. * iterators.cs: Propagate parameter values; Store parameter values in the proxy classes. 2003-05-04 Miguel de Icaza * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not need a proxy reference; I do not know what I was thinking * cs-parser.jay (constructor_initializer): catch another error, and display nice message. (field_declaration): catch void field declaration to flag a better error. * class.cs (MemberBase.CheckBase): Report an error instead of a warning if a new protected member is declared in a struct. (Field.Define): catch the error of readonly/volatile. * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup. (FieldExpr.AddressOf): ditto. Catch error where the address of a volatile variable is taken 2003-05-02 Miguel de Icaza * statement.cs (Fixed.Resolve): Report an error if we are not in an unsafe context. 2003-05-01 Miguel de Icaza * typemanager.cs: reuse the code that handles type clashes for delegates and enumerations. * class.cs (Report28): Always report. * expression.cs (EncodeAsAttribute): Allow nulls here. 2003-04-28 Miguel de Icaza * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved the functionality for testing whether an expression is valid for an attribute here. Also handle the case of arrays of elements being stored. * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for encoding a linear array into an array of objects that are suitable to be passed to an CustomAttributeBuilder. * delegate.cs: Check unsafe types being used outside of an Unsafe context. * ecore.cs: (FieldExpr): Handle field remapping here. * iteratators.cs: Pass the instance variable (if the method is an instance method) to the constructors, so we can access the field variables on the class. TODO: Test this with structs. I think the THIS variable on structs might have to be a pointer, and not a refenrece 2003-04-27 Miguel de Icaza * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map local variables to fields in a proxy class. * iterators.cs (PopulateProxy): Rename our internal fields to . Create a field if we are an instance method, so we can reference our parent container variables. (MapVariable): Called back from the EmitContext code to enter a new variable to field mapping into the proxy class (we just create a FieldBuilder). * expression.cs (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support for using the remapped locals to fields. I placed the code here, because that gives the same semantics to local variables, and only changes the Emit code. * statement.cs (Fixed.Resolve): it is not allowed to have fixed statements inside iterators. (VariableInfo): Add a FieldBuilder for the cases when we are remapping local variables to fields in a proxy class * ecore.cs (SimpleNameResolve): Avoid testing two times for current_block != null. * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did not cope with strings, as it has been moved to the TableSwitchEmit. Fixed bug in switch generation. * expression.cs (New.DoResolve): Provide more context for the user when reporting an error. * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading pointers. * expression.cs (MemberAccess.DoResolve): When we get a type back, check the permissions for it. Note than in a type-resolution context the check was already present in DeclSpace.ResolveType, but was missing from the MemberAccess. (ArrayCreation.CheckIndices): warn if the user has more nested levels of expressions, but there are no more dimensions specified. Avoids crash on bug 41906. 2003-04-26 Miguel de Icaza * statement.cs (Block): replace Implicit bool, for a generic flags. New flag: `Unchecked'. This is used during the EmitMeta phase (which is out-of-line with the regular Resolve/Emit process for a statement, as this is done ahead of time, but still gets a chance to call constant resolve). (Block.Flags): new enum for adding a new flag. (Block.EmitMeta): track the state of unchecked. (Unchecked): Set the "UnChecked" flags on any blocks we enclose, to enable constant resolution to work there as well. 2003-04-22 Miguel de Icaza * typemanager.cs (ienumerable_type): Also look up System.Collections.IEnumerable. 2003-04-21 Miguel de Icaza TODO: Test more than one conditional per method. * class.cs (Indexer.Define): Report the location where the user is referencing the unsupported feature. (MethodData): Overload the use of `conditionals' to minimize the creation of needless ArrayLists. This saves roughly 212kb on my machine. (Method): Implement the new IIteratorContainer interface. (Method.SetYields): Implement the method by setting the ModFlags to contain METHOD_YIELDS. * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr, which just got set to null. * iterators.cs: New file. (Yield, YieldBreak): New statements. * statement.cs (Return.Resolve): Flag an error if we are used in an iterator method. * codegen.cs (InIterator): New flag set if the code is being compiled in an iterator method. * modifiers.cs: New flag METHOD_YIELDS. This modifier is an internal modifier, and we just use it to avoid adding extra fields, as this is seldom used. * cs-parser.jay: Add yield_statement (yield and yield break). * driver.cs: New flag -v2 to turn on version 2 features. * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the hashtable when v2 is enabled. 2003-04-20 Miguel de Icaza * typemanager.cs (TypeManager.NamespaceClash): Use to check if there is already a namespace defined with this name. (TypeManager.InitCoreTypes): Remove the temporary workaround, as people upgraded their corlibs. (TypeManager.CoreLookupType): Use LookupTypeDirect, as we always use fully qualified types, no need to use the compiler front end. (TypeManager.IsNamespace): Use binarysearch. * class.cs (AddClass, AddStruct, AddInterface, AddEvent, AddDelegate): I did not quite use the new IsValid API properly: I have to pass the short-name and the fullname. I was passing only the basename instead of the fullname sometimes. (TypeContainer.DefineType): call NamespaceClash. * interface.cs (Interface.DefineType): use NamespaceClash before defining the type. * delegate.cs (Delegate.DefineType): use NamespaceClash before defining the type. * enum.cs: (Enum.DefineType): use NamespaceClash before defining the type. * typemanager.cs (: 3-line patch that gives us some tasty 11% speed increase. First, use the negative_hits cache when we get a negative. Second, add the type with its full original name instead of the new . and + encoded name (reflection uses + to separate type from a nested type). Use LookupTypeReflection directly which bypasses the type->name hashtable (that we already know does not contain the type. * decl.cs (DeclSpace.ResolveTypeExpr): track the location/container type. * driver.cs: When passing utf8, use directly the UTF8Encoding. 2003-04-19 Miguel de Icaza * decl.cs (ResolveTypeExpr): Mirror check acess here too. * delegate.cs (NewDelegate.Resolve): Test whether an instance method is being referenced in the method group from a static context, and report error 120 if so. * expression.cs, ecore.cs (Error_UnexpectedKind): New name for Error118. * typemanager.cs: Add intermediate namespaces (if a namespace A.B is created, we create the A namespace). * cs-parser.jay: A namespace also introduces a DeclarationFound. Fixes #41591 2003-04-18 Miguel de Icaza * typemanager.cs (GetReferenceType, GetPointerType): In .NET each invocation to ModuleBuilder.GetType with the same values will return a new type instance, so we need to cache its return values. * expression.cs (Binary.ResolveOperator): Only allow the compare operators on enums if they are of the same type. * ecore.cs (Expression.ImplicitReferenceConversion): handle target types of ValueType on their own case. Before we were giving them the same treatment as objects. * decl.cs (DeclSpace.IsValid): IsValid takes the short name and fullname. Short name is used to compare against container name. Fullname is used to check against defined namespace names. * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum, AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid (Method.CheckBase): Call parent. (MemberBase.CheckBase): Check for protected members on sealed classes. (PropertyBase.CheckBase): Call parent. (Field.Define): Call parent. * report.cs: Negative error codes are now mapped to 8000 - code, so that the display is render more nicely. * typemanager.cs: Do not use try/catch, instead report a regular error. (GetPointerType, GetReferenceType): These methods provide mechanisms to obtain the T* and T& from a T. We had the code previously scattered around the code base, and it also used TypeManager.LookupType that would go through plenty of caches. This one goes directly to the type source. In some places we did the Type.GetType followed by ModuleBuilder.GetType, but not in others, so this unifies the processing as well. * namespace.cs (VerifyUsing): Perform a non-lazy approach to using statements now that we have namespace information. * typemanager.cs (IsNamespace): New method, returns whether the string presented is a namespace or not. (ComputeNamespaces): New public entry point, computes the list of available namespaces, using the GetNamespaces API call in Mono, or the slower version in MS.NET. Now before we start the semantic analysis phase, we have a complete list of namespaces including everything that the user has provided. Deleted old code to cache namespaces in .nsc files. 2003-04-17 Miguel de Icaza * class.cs: (TypeContainer.DefineDefaultConstructor): Use the class/struct location definition Location for the implicit constructor location. (Operator.Define): Use the location of the operator for the implicit Method definition. (Constructor.Emit): use the constructor location for the implicit base initializer constructor. * ecore.cs: Remove ITypeExpression. This interface is now gone, and the Expression class now contains two new methods: ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to isolate type lookup from the rest of the resolution process. Since we use Expressions to hold type definitions due to the way we parse the input we have historically overloaded Resolve to perform the Type lookups if a special flag is passed. Now this is eliminated and two methods take their place. The differences in the two methods between xStep and xTerminal is that xStep is involved in our current lookup system that uses SimpleNames to compose a name, while xTerminal is used just to catch the case where the simplename lookup failed. 2003-04-16 Miguel de Icaza * expression.cs (ResolveMemberAccess): Remove redundant code. TypeExpr expressions are always born fully resolved. * interface.cs (PopulateMethod): Do not lookup the types twice. We were doing it once during SemanticAnalysis and once during PopulateMethod. * cs-parser.jay: Due to our hack in the grammar, things like A.B[] in local variable type definitions, were being returned as a SimpleName (we decomposed everything into a string), that is because primary_expression was being used instead of a type in the grammar (reduce/reduce conflicts). The part that was wrong is that we converted the expression into a string (an oversimplification in one hand, compounded with primary expressions doing string concatenation). So things like: A.B.C [] x; Would return "A.B.C[]" as a SimpleName. This stopped things like using clauses from working on this particular context. And a type was being matched directly against "A.B.C[]". We now use the correct approach, and allow for ComposedCast to be part of the unary expression. So the "A.B.C []" become a composed cast of "A.B.C" (as a nested group of MemberAccess with a SimpleName at the end) plus the rank composition "[]". Also fixes 35567 2003-04-10 Miguel de Icaza * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules for the access level checking. * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to `TypeContainer container', because I kept getting confused when I was debugging this code. * expression.cs (Indexers): Instead of tracking getters/setters, we now track them in parallel. We create one arraylist less, but most importantly it is possible now for the LValue code to find a matching get for a set. (IndexerAccess.DoResolveLValue): Update the code. GetIndexersForType has been modified already to extract all the indexers from a type. The code assumed it did not. Also make the code set the correct return type for the indexer. This was fixed a long time ago for properties, but was missing for indexers. It used to be void_type. (Binary.Emit): Test first for doubles instead of floats, as they are more common. (Binary.EmitBranchable): Use the .un version of the branch opcodes when dealing with floats and the <=, >= operators. This fixes bug #39314 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used to load the array value by emitting a load on the foreach variable type. This was incorrect. We now emit the code to load an element using the the array variable type, and then we emit the conversion operator. Fixed #40176 2003-04-10 Zoltan Varga * attribute.cs: Avoid allocation of ArrayLists in the common case. 2003-04-09 Miguel de Icaza * class.cs (MethodSignature.InheritableMemberSignatureCompare): test for protection before we test for signatures. (MethodSignature.ToString): implement. * expression.cs (Unary.TryReduceNegative): Add missing minus sign to the case where we reduced into a LongConstant. * decl.cs (CheckAccessLevel): If the type is an array, we can not depend on whether the information is acurrate, because the Microsoft runtime will always claim that the array type is public, regardless of the real state. If the type is a pointer, another problem happens: the type is reported as non-public in Microsoft. In both cases we have to call CheckAccessLevel recursively with the underlying type as the argument to be tested. 2003-04-08 Miguel de Icaza * assign.cs (Assign.Emit): If we are dealing with a compound assignment expression, we should use the code path that stores the intermediate result in a temporary value. This fixes #40903. *expression.cs (Indirection.ToString): Provide ToString method for debugging. 2003-04-08 Zoltan Varga * class.cs: Null out fields holding references to Block objects so they can be garbage collected. * expression.cs (OverloadResolve): Remove unused local. 2003-04-07 Martin Baulig * codegen.cs (EmitContext.CurrentFile): New public field. (EmitContext.Mark): Use the CurrentFile to check whether the location is in the correct file. (EmitContext.EmitTopBlock): Initialize CurrentFile here. 2003-04-07 Martin Baulig * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark(). * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the location. [FIXME: The location argument which gets passed to this method is sometimes wrong!] 2003-04-07 Nick Drochak * codegen.cs: Be more verbose when we can't find the symbol writer dll. 2003-04-07 Miguel de Icaza * expression.cs (Indirection.EmitAssign): We were using the temporary, but returning immediately instead of continuing the EmitAssing flow. 2003-04-06 Martin Baulig * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error if it's a nested child, but also deriving from the outer class. See test 190.cs. * typemanager.cs (IsNestedChildOf): Make this work if it's a nested child, but also deriving from the outer class. See test-190.cs. (FilterWithClosure): We may access private members of the outer class if we're a nested child and deriving from the outer class. (RealMemberLookup): Only set `closure_private_ok' if the `original_bf' contained BindingFlags.NonPublic. 2003-04-05 Martin Baulig * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670. 2003-04-02 Miguel de Icaza * class.cs (Event.Define): Do not allow abstract events to have initializers. 2003-04-01 Miguel de Icaza * cs-parser.jay: Add error productions for ADD/REMOVE missing a block in event declarations. * ecore.cs (FieldExpr.AddressOf): If our instance expression is a value type, get its address. * expression.cs (Is.Emit): For action `LeaveOnStack' we were leaving a class on the stack instead of a boolean value (int 0/1). Change the code so we compare against null, and then the result against zero. * class.cs (TypeContainer.GetClassBases): We were checking for the parent class being sealed too late. * expression.cs (Binary.Emit): For <= and >= when dealing with floating point values, use cgt.un and clt.un instead of cgt and clt alone. 2003-04-01 Zoltan Varga * statement.cs: Apply the same optimization as MS: skip the GetEnumerator returning an IEnumerator, and use the one returning a CharEnumerator instead. This allows us to avoid the try-finally block and the boxing. 2003-03-31 Gaurav Vaish * cs-parser.jay: Attributes cannot be applied to namespaces. Fixes #40473 2003-03-31 Gonzalo Paniagua Javier * class.cs: (Add*): check if the name is valid using the full name for constants, fields, properties and events. 2003-03-28 Miguel de Icaza * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow char constants to be part of the enumeration. * expression.cs (Conditional.DoResolve): Add support for operator true. Implements the missing functionality from 14.12 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on operator true/false as required by the spec. * expression.cs (Unary.ResolveOperator): In LogicalNot, do an implicit conversion to boolean. * statement.cs (Statement.ResolveBoolean): A boolean expression is also one where the type implements `operator true'. * ecore.cs (Expression.GetOperatorTrue): New helper routine to get an expression that will invoke operator true based on an expression. (GetConversionOperators): Removed the hack that called op_True here. (Expression.ResolveBoolean): Move this from Statement. 2003-03-17 Miguel de Icaza * ecore.cs (FieldExpr): do not allow initialization of initonly fields on derived classes 2003-03-13 Martin Baulig * statement.cs (Block.Emit): Call ig.BeginScope() and ig.EndScope() when compiling with debugging info; call LocalBuilder.SetLocalSymInfo _after_ opening the scope. 2003-03-08 Miguel de Icaza * expression.cs (Indexers): Do not construct immediately, allow for new members to be appended as we go. Fixes 38143 2003-03-07 Gonzalo Paniagua Javier * expression.cs: save/restore context when resolving an unchecked expression. 2003-03-05 Miguel de Icaza * cfold.cs: Catch division by zero in modulus operator during constant folding. 2003-03-03 Miguel de Icaza * interface.cs (Interface.DefineMembers): Avoid defining members twice. 2003-02-27 Miguel de Icaza * driver.cs: handle the +/- options for -noconfig * statement.cs (Unckeched.Resolve): Also track the state of unchecked in the Resolve phase. 2003-02-27 Martin Baulig * ecore.cs (Expression.MemberLookup): Don't create a MethodGroupExpr for something which is not a method. Fixes #38291. 2003-02-25 Miguel de Icaza * class.cs (MemberBase.CheckParameters): Also check that the type is unmanaged if it is a pointer. * expression.cs (SizeOf.Resolve): Add location information. * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to a managed type is declared. * expression.cs (Invocation.VerifyArgumentsCompat): Check for the parameter modifiers as well. Fixes bug 38606 * class.cs: Very sad. Am backing out the speed up changes introduced by the ArrayList -> Array in the TypeContainer, as they were not actually that much faster, and introduced a bug (no error reports on duplicated methods). * assign.cs (CompoundAssign.DoLResolve): Resolve the original source first, this will guarantee that we have a valid expression before calling in lower levels functions that will require a resolved object. Then use this original_source in the target.ResolveLValue instead of the original source that was passed to us. Another change. Use target.Resolve instead of LValueResolve. Although we are resolving for LValues, we will let the Assign code take care of that (it will be called again from Resolve). This basically allows code like this: class X { X operator + (X x, object o) {} X this [int idx] { get; set; } } class Y { void A (X x) { x [0] += o; } The problem was that the indexer was trying to resolve for set_Item (idx, object o) and never finding one. The real set_Item was set_Item (idx, X). By delaying the process we get the right semantics. Fixes bug 36505 2003-02-23 Martin Baulig * statement.cs (Block.Emit): Override this and set ec.CurrentBlock while calling DoEmit (). * codegen.cs (EmitContext.Mark): Don't mark locations in other source files; if you use the #line directive inside a method, the compiler stops emitting line numbers for the debugger until it reaches the end of the method or another #line directive which restores the original file. 2003-02-23 Martin Baulig * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708. 2003-02-23 Martin Baulig * statement.cs (Block.AddChildVariableNames): We need to call this recursively, not just for our immediate children. 2003-02-23 Martin Baulig * class.cs (Event.Define): Always make the field private, like csc does. * typemanager.cs (TypeManager.RealMemberLookup): Make events actually work, fixes bug #37521. 2003-02-23 Miguel de Icaza * delegate.cs: When creating the various temporary "Parameters" classes, make sure that we call the ComputeAndDefineParameterTypes on those new parameters (just like we do with the formal ones), to allow them to be resolved in the context of the DeclSpace. This fixes the bug that Dick observed in Bugzilla #38530. 2003-02-22 Miguel de Icaza * expression.cs (ResolveMemberAccess): When resolving a constant, do not attempt to pull a constant if the value was not able to generate a valid constant. * const.cs (LookupConstantValue): Do not report more errors than required. 2003-02-19 Gonzalo Paniagua Javier * expression.cs: fixes bug #38328. 2003-02-18 Miguel de Icaza * class.cs: Changed all the various members that can be part of a class from being an ArrayList to be an Array of the right type. During the DefineType type_list, interface_list, delegate_list and enum_list are turned into types, interfaces, delegates and enums arrays. And during the member population, indexer_list, event_list, constant_list, field_list, instance_constructor_list, method_list, operator_list and property_list are turned into their real arrays. Although we could probably perform this operation earlier, for good error reporting we need to keep the lists and remove the lists for longer than required. This optimization was triggered by Paolo profiling the compiler speed on the output of `gen-sample-program.pl' perl script. * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do not crash in methods like MemberLookupFailed that use this field. This problem arises when the compiler fails to resolve a type during interface type definition for example. 2003-02-18 Miguel de Icaza * expression.cs (Indexers.GetIndexersForType): Interfaces do not inherit from System.Object, so we have to stop at null, not only when reaching System.Object. 2003-02-17 Miguel de Icaza * expression.cs: (Indexers.GetIndexersForType): Martin's fix used DeclaredOnly because the parent indexer might have had a different name, but did not loop until the top of the hierarchy was reached. The problem this one fixes is 35492: when a class implemented an indexer from an interface, we were getting the interface method (which was abstract) and we were flagging an error (can not invoke abstract method). This also keeps bug 33089 functioning, and test-148 functioning. * typemanager.cs (IsSpecialMethod): The correct way of figuring out if a method is special is to see if it is declared in a property or event, or whether it is one of the predefined operator names. This should fix correctly #36804. 2003-02-15 Miguel de Icaza The goal here is to remove the dependency on EmptyCast.Peel (). Killing it completely. The problem is that currently in a number of places where constants are expected, we have to "probe" for an EmptyCast, and Peel, which is not the correct thing to do, as this will be repetitive and will likely lead to errors. The idea is to remove any EmptyCasts that are used in casts that can be reduced to constants, so we only have to cope with constants. This bug hunt was triggered by Bug 37363 and the desire to remove the duplicate pattern where we were "peeling" emptycasts to check whether they were constants. Now constants will always be constants. * ecore.cs: Use an enumconstant here instead of wrapping with EmptyCast. * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was throwing me off. By handling this we can get rid of a few hacks. * statement.cs (Switch): Removed Peel() code. 2003-02-14 Miguel de Icaza * class.cs: Location information for error 508 * expression.cs (New.DoResolve): Add a guard against double resolution of an expression. The New DoResolve might be called twice when initializing field expressions (see EmitFieldInitializers, the call to GetInitializerExpression will perform a resolve on the expression, and later the assign will trigger another resolution This leads to bugs (#37014) * delegate.cs: The signature for EndInvoke should contain any ref or out parameters as well. We were not doing this in the past. * class.cs (Field.Define): Do not overwrite the type definition inside the `volatile' group. Turns out that volatile enumerations were changing the type here to perform a validity test, which broke conversions. 2003-02-12 Miguel de Icaza * ecore.cs (FieldExpr.AddressOf): In the particular case of This and structs, we do not want to load the instance variable (ImplicitReferenceConversion, ImplicitReferenceConversionExists): enum_type has to be handled like an object reference (implicit conversions exists from this to object), but the regular IsClass and IsValueType tests will never return true for this one. Also we use TypeManager.IsValueType instead of type.IsValueType, just for consistency with the rest of the code (this is only needed if we ever use the construct exposed by test-180.cs inside corlib, which we dont today). 2003-02-12 Zoltan Varga * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not just InternalCall. 2003-02-09 Martin Baulig * namespace.cs (Namespace..ctor): Added SourceFile argument. (Namespace.DefineNamespaces): New static public method; this is called when we're compiling with debugging to add all namespaces to the symbol file. * tree.cs (Tree.RecordNamespace): Added SourceFile argument and pass it to the Namespace's .ctor. * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer and MethodBase arguments; pass the namespace ID to the symwriter; pass the MethodBase instead of the token to the symwriter. (SymbolWriter.DefineNamespace): New method to add a namespace to the symbol file. 2003-02-09 Martin Baulig * symbolwriter.cs: New file. This is a wrapper around ISymbolWriter with a cleaner API. We'll dynamically Invoke() methods here in near future. 2003-02-09 Martin Baulig * codegen.cs (EmitContext.Mark): Just pass the arguments to ILGenerator.MarkSequencePoint() which are actually used by the symbol writer. 2003-02-09 Martin Baulig * location.cs (SourceFile): New public sealed class. This contains the name and an index which is used in the location's token. (Location): Reserve an appropriate number of bits in the token for the source file instead of walking over that list, this gives us a really huge performance improvement when compiling with debugging. * driver.cs (Driver.parse, Driver.tokenize_file): Take a `SourceFile' argument instead of a string. (Driver.ProcessFile): Add all the files via Location.AddFile(), but don't parse/tokenize here, we need to generate the list of all source files before we do that. (Driver.ProcessFiles): New static function. Parses/tokenizes all the files. * cs-parser.jay (CSharpParser): Take a `SourceFile' argument instead of a string. * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead of a string. 2003-02-09 Martin Baulig * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the filename on `#line default'. Sat Feb 8 17:03:16 CET 2003 Paolo Molaro * statement.cs: don't clear the pinned var when the fixed statement returns from the method (fixes bug#37752). Sat Feb 8 12:58:06 CET 2003 Paolo Molaro * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) to IsValueType. 2003-02-07 Martin Baulig * driver.cs: Removed the `--debug-args' command line argument. * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done automatically by the AsssemblyBuilder. (CodeGen.InitializeSymbolWriter): We don't need to call any initialization function on the symbol writer anymore. This method doesn't take any arguments. 2003-02-03 Miguel de Icaza * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types from referenced assemblies as well. 2003-02-02 Martin Baulig * class.cs (MethodData.Emit): Generate debugging info for external methods. 2003-02-02 Martin Baulig * class.cs (Constructor.Emit): Open the symbol writer before emitting the constructor initializer. (ConstructorInitializer.Emit): Call ec.Mark() to allow single-stepping through constructor initializers. 2003-01-30 Miguel de Icaza * class.cs: Handle error 549: do not allow virtual methods in sealed classes. 2003-02-01 Jackson Harper * decl.cs: Check access levels when resolving types 2003-01-31 Jackson Harper * statement.cs: Add parameters and locals set in catch blocks that might return to set vector 2003-01-29 Miguel de Icaza * class.cs (Operator): Set the SpecialName flags for operators. * expression.cs (Invocation.DoResolve): Only block calls to accessors and operators on SpecialName methods. (Cast.TryReduce): Handle conversions from char constants. Tue Jan 28 17:30:57 CET 2003 Paolo Molaro * statement.cs: small memory and time optimization in FlowBranching. 2003-01-28 Pedro Mart * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same problem that the last fix but in the other sid (Set). * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null access when there is no indexer in the hierarchy. 2003-01-27 Jackson Harper * class.cs: Combine some if statements. 2003-01-27 Gonzalo Paniagua Javier * driver.cs: fixed bug #37187. 2003-01-27 Pedro Martinez Juliá * expression.cs (IndexerAccess.DoResolve): Before trying to resolve any indexer, it's needed to build a list with all the indexers in the hierarchy (AllGetters), else we have problems. Fixes #35653. 2003-01-23 Miguel de Icaza * class.cs (MethodData.Define): It is wrong for an interface implementation to be static in both cases: explicit and implicit. We were only handling this in one case. Improve the if situation there to not have negations. * class.cs (Field.Define): Turns out that we do not need to check the unsafe bit on field definition, only on usage. Remove the test. 2003-01-22 Gonzalo Paniagua Javier * driver.cs: use assembly.Location instead of Codebase (the latest patch made mcs fail when using MS assemblies). 2003-01-21 Tim Haynes * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to get the path to *corlib.dll. 2003-01-21 Nick Drochak * cs-tokenizer.cs: * pending.cs: * typemanager.cs: Remove compiler warnings 2003-01-20 Duncan Mak * AssemblyInfo.cs: Bump the version number to 0.19. 2003-01-20 Gonzalo Paniagua Javier * cs-tokenizer.cs: little fixes to line numbering when #line is used. 2003-01-18 Zoltan Varga * class.cs (Constructor::Emit): Emit debugging info for constructors. 2003-01-17 Miguel de Icaza * cs-parser.jay: Small fix: we were not comparing the constructor name correctly. Thanks to Zoltan for the initial pointer. 2003-01-16 Jackson Harper * cs-tokenizer.cs: Set file name when specified with #line 2003-01-15 Miguel de Icaza * cs-parser.jay: Only perform the constructor checks here if we are named like the class; This will help provider a better error. The constructor path is taken when a type definition is not found, but most likely the user forgot to add the type, so report that rather than the constructor error. Tue Jan 14 10:36:49 CET 2003 Paolo Molaro * class.cs, rootcontext.cs: small changes to avoid unnecessary memory allocations. 2003-01-13 Jackson Harper * cs-parser.jay: Add cleanup call. 2003-01-13 Duncan Mak * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more consistent with other methods. 2003-01-13 Jackson Harper * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages. Sun Jan 12 19:58:42 CET 2003 Paolo Molaro * attribute.cs: only set GuidAttr to true when we have a GuidAttribute. 2003-01-09 Gonzalo Paniagua Javier * ecore.cs: * expression.cs: * typemanager.cs: fixes to allow mcs compile corlib with the new Type.IsSubclassOf fix. 2003-01-08 Miguel de Icaza * expression.cs (LocalVariableReference.DoResolve): Classify a constant as a value, not as a variable. Also, set the type for the variable. * cs-parser.jay (fixed_statement): take a type instead of a pointer_type, so we can produce a better error message later. * statement.cs (Fixed.Resolve): Flag types that are not pointers as an error. (For.DoEmit): Make inifinite loops have a non-conditional branch back. (Fixed.DoEmit): First populate the pinned variables, then emit the statement, then clear the variables. Before I was emitting the code once for each fixed piece. 2003-01-08 Martin Baulig * statement.cs (FlowBranching.MergeChild): A break in a SWITCH_SECTION does not leave a loop. Fixes #36155. 2003-01-08 Martin Baulig * statement.cs (FlowBranching.CheckOutParameters): `struct_params' lives in the same number space than `param_map'. Fixes #36154. 2003-01-07 Miguel de Icaza * cs-parser.jay (constructor_declaration): Set the Constructor.ModFlags before probing for it. This makes the compiler report 514, 515 and 132 (the code was there, but got broken). * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS. (GotoDefault.Resolve): Set `Returns' to ALWAYS. (GotoCase.Resolve): Set `Returns' to ALWAYS. Tue Jan 7 18:32:24 CET 2003 Paolo Molaro * enum.cs: create the enum static fields using the enum type. Tue Jan 7 18:23:44 CET 2003 Paolo Molaro * class.cs: don't try to create the ParamBuilder for the return type if it's not needed (and handle it breaking for the ms runtime anyway). 2003-01-06 Jackson Harper * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly 2002-12-29 Miguel de Icaza * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate the command. This showed up while compiling the JANET source code, which used \r as its only newline separator. 2002-12-28 Miguel de Icaza * class.cs (Method.Define): If we are an operator (because it reuses our code), then set the SpecialName and HideBySig. #36128 2002-12-22 Miguel de Icaza * ecore.cs (FieldExpr.DoResolve): Instead of throwing an exception, report error 120 `object reference required'. * driver.cs: Add --pause option, used during to measure the size of the process as it goes with --timestamp. * expression.cs (Invocation.DoResolve): Do not allow methods with SpecialName to be invoked. 2002-12-21 Miguel de Icaza * cs-tokenizer.cs: Small fix to the parser: compute the ascii number before adding it. 2002-12-21 Ravi Pratap * ecore.cs (StandardImplicitConversion): When in an unsafe context, we allow conversion between void * to any other pointer type. This fixes bug #35973. 2002-12-20 Jackson Harper * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception is not thrown when extensionless outputs are used 2002-12-20 Gonzalo Paniagua Javier * rootcontext.cs: fixed compilation of corlib. 2002-12-19 Miguel de Icaza * attribute.cs (Attributes.Contains): Add new method. * class.cs (MethodCore.LabelParameters): if the parameter is an `out' parameter, check that no attribute `[In]' has been passed. * enum.cs: Handle the `value__' name in an enumeration. 2002-12-14 Jaroslaw Kowalski * decl.cs: Added special case to allow overrides on "protected internal" methods 2002-12-18 Ravi Pratap * attribute.cs (Attributes.AddAttributeSection): Rename to this since it makes much more sense. (Attributes.ctor): Don't require a Location parameter. * rootcontext.cs (AddGlobalAttributeSection): Rename again. * attribute.cs (ApplyAttributes): Remove extra Location parameters since we already have that information per attribute. * everywhere : make appropriate changes. * class.cs (LabelParameters): Write the code which actually applies attributes to the return type. We can't do this on the MS .NET runtime so we flag a warning in the case an exception is thrown. 2002-12-18 Miguel de Icaza * const.cs: Handle implicit null conversions here too. 2002-12-17 Ravi Pratap * class.cs (MethodCore.LabelParameters): Remove the extra Type [] parameter since it is completely unnecessary. Instead pass in the method's attributes so that we can extract the "return" attribute. 2002-12-17 Miguel de Icaza * cs-parser.jay (parse): Use Report.Error to flag errors instead of ignoring it and letting the compile continue. * typemanager.cs (ChangeType): use an extra argument to return an error condition instead of throwing an exception. 2002-12-15 Miguel de Icaza * expression.cs (Unary.TryReduce): mimic the code for the regular code path. Perform an implicit cast in the cases where we can implicitly convert to one of the integral types, and then reduce based on that constant. This fixes bug #35483. 2002-12-14 Gonzalo Paniagua Javier * typemanager.cs: fixed cut & paste error in GetRemoveMethod. 2002-12-13 Gonzalo Paniagua Javier * namespace.cs: fixed bug #35489. 2002-12-12 Miguel de Icaza * class.cs: Remove some dead code. * cs-parser.jay: Estimate the number of methods needed (RootContext.MethodCount); * cs-tokenizer.cs: Use char arrays for parsing identifiers and numbers instead of StringBuilders. * support.cs (PtrHashtable): Add constructor with initial size; We can now reduce reallocations of the method table. 2002-12-10 Ravi Pratap * attribute.cs (ApplyAttributes): Keep track of the emitted attributes on a per-target basis. This fixes bug #35413. 2002-12-10 Miguel de Icaza * driver.cs (MainDriver): On rotor encoding 28591 does not exist, default to the Windows 1252 encoding. (UnixParseOption): Support version, thanks to Alp for the missing pointer. * AssemblyInfo.cs: Add nice assembly information. * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler (bug 35169). * cs-parser.jay: Allow a trailing comma before the close bracked in the attribute_section production. * ecore.cs (FieldExpr.AddressOf): Until I figure out why the address of the instance was being taken, I will take this out, because we take the address of the object immediately here. 2002-12-09 Ravi Pratap * typemanager.cs (AreMultipleAllowed): Take care of the most obvious case where attribute type is not in the current assembly - stupid me ;-) 2002-12-08 Miguel de Icaza * ecore.cs (SimpleName.DoResolve): First perform lookups on using definitions, instead of doing that afterwards. Also we use a nice little hack, depending on the constructor, we know if we are a "composed" name or a simple name. Hence, we avoid the IndexOf test, and we avoid * codegen.cs: Add code to assist in a bug reporter to track down the source of a compiler crash. 2002-12-07 Ravi Pratap * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute types have been emitted for a given element and flag an error if something which does not have AllowMultiple set is used more than once. * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of attribute types and their corresponding AllowMultiple properties (AreMultipleAllowed): Check the property for a given type. * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple property in the case we have a TypeContainer. (Attributes.AddAttribute): Detect duplicates and just skip on adding them. This trivial fix catches a pretty gross error in our attribute emission - global attributes were being emitted twice! Bugzilla bug #33187 is now fixed. 2002-12-06 Miguel de Icaza * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr instead of pp_and). * expression.cs (Binary.ResolveOperator): I can only use the Concat (string, string, string) and Concat (string, string, string, string) if the child is actually a concatenation of strings. 2002-12-04 Miguel de Icaza * cs-tokenizer.cs: Small fix, because decimal_digits is used in a context where we need a 2-character lookahead. * pending.cs (PendingImplementation): Rework so we can keep track of interface types all the time, and flag those which were implemented by parents as optional. 2002-12-03 Miguel de Icaza * expression.cs (Binary.ResolveOperator): Use String.Concat(string,string,string) or String.Concat(string,string,string,string) when possible. * typemanager: More helper methods. Tue Dec 3 19:32:04 CET 2002 Paolo Molaro * pending.cs: remove the bogus return from GetMissingInterfaces() (see the 2002-11-06 entry: the mono runtime is now fixed in cvs). 2002-12-02 Gonzalo Paniagua Javier * namespace.cs: avoid duplicated 'using xxx' being added to using_clauses. This prevents mcs from issuing and 'ambiguous type' error when we get more than one 'using' statement for the same namespace. Report a CS0105 warning for it. 2002-11-30 Miguel de Icaza * cs-tokenizer.cs (consume_identifier): use read directly, instead of calling getChar/putback, uses internal knowledge of it. (xtoken): Reorder tokenizer so most common patterns are checked first. This reduces the compilation time in another 5% (from 8.11s average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz). The parsing time is 22% of the compilation in mcs, and from that 64% is spent on the tokenization process. I tried using a binary search for keywords, but this is slower than the hashtable. Another option would be to do a couple of things: * Not use a StringBuilder, instead use an array of chars, with a set value. Notice that this way we could catch the 645 error without having to do it *afterwards*. * We could write a hand-parser to avoid the hashtable compares altogether. The identifier consumption process takes 37% of the tokenization time. Another 15% is spent on is_number. 56% of the time spent on is_number is spent on Int64.Parse: * We could probably choose based on the string length to use Int32.Parse or Int64.Parse and avoid all the 64-bit computations. Another 3% is spend on wrapping `xtoken' in the `token' function. Handle 0xa0 as whitespace (#34752) 2002-11-26 Miguel de Icaza * typemanager.cs (IsCLRType): New routine to tell whether a type is one of the builtin types. Maybe it needs to use TypeCodes to be faster. Maybe we could use typecode in more places instead of doing pointer comparissions. We could leverage some knowledge about the way the typecodes are laid out. New code to cache namespaces in assemblies, it is currently not invoked, to be used soon. * decl.cs (DeclSpace.MakeFQN): Simple optimization. * expression.cs (Binary.ResolveOperator): specially handle strings, and do not perform user-defined operator overloading for built-in types. 2002-11-24 Miguel de Icaza * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an internalcall as it is a pretty simple operation; Avoid whenever possible to call Char.IsLetter. (consume_identifier): Cut by half the number of hashtable calls by merging the is_keyword and GetKeyword behavior. Do not short-circuit, because if we do, we report errors (ie, #if false && true would produce an invalid directive error); 2002-11-24 Martin Baulig * expression.cs (Cast.TryReduce): If we're in checked syntax, check constant ranges and report a CS0221. Fixes #33186. 2002-11-24 Martin Baulig * cs-parser.jay: Make this work for uninitialized variable declarations in the `for' initializer. Fixes #32416. 2002-11-24 Martin Baulig * ecore.cs (Expression.ConvertExplicit): Make casting from/to System.Enum actually work. Fixes bug #32269, added verify-6.cs. 2002-11-24 Martin Baulig * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv' argument; if true, we also check for user-defined conversions. This is only needed if both arguments are of a user-defined type. Fixes #30443, added test-175.cs. (Binary.ForceConversion): Pass the location argument to ConvertImplicit. * ecore.cs (Expression.ImplicitUserConversionExists): New method. 2002-11-24 Martin Baulig * expression.cs (ArrayAccess.GetStoreOpcode): New public static function to get the store opcode. (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and only emit the Ldelema if the store opcode is Stobj. You must run both test-34 and test-167 to test this. Fixes #34529. 2002-11-23 Martin Baulig * ecore.cs (Expression.MemberLookup): Added additional `qualifier_type' argument which is used when we're being called from MemberAccess.DoResolve() and null if we're called from a SimpleName lookup. (Expression.MemberLookupFailed): New method to report errors; this does the CS1540 check and reports the correct error message. * typemanager.cs (MemberLookup): Added additional `qualifier_type' argument for the CS1540 check and redone the way how we're dealing with private members. See the comment in the source code for details. (FilterWithClosure): Reverted this back to revision 1.197; renamed `closure_start_type' to `closure_qualifier_type' and check whether it's not null. It was not this filter being broken, it was just being called with the wrong arguments. * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal() and pass it the correct `qualifier_type'; this also does the error handling for us. 2002-11-22 Miguel de Icaza * expression.cs (Invocation.EmitParams): If the we are dealing with a non-built-in value type, load its address as well. (ArrayCreation): Use a a pretty constant instead of the hardcoded value 2. Use 6 instead of 2 for the number of static initializers. (ArrayCreation.EmitDynamicInitializers): Peel enumerations, because they are not really value types, just glorified integers. * driver.cs: Do not append .exe, the CSC compiler does not do it. * ecore.cs: Remove redundant code for enumerations, make them use the same code path as everything else, fixes the casting issue with enumerations in Windows.Forms. * attribute.cs: Do only cast to string if it is a string, the validation happens later. * typemanager.cs: Temproary hack to avoid a bootstrap issue until people upgrade their corlibs. * ecore.cs: Oops, enumerations were not following the entire code path 2002-11-21 Miguel de Icaza * typemanager.cs (FilterWithClosure): Commented out the test for 1540 in typemanager.cs, as it has problems when accessing protected methods from a parent class (see test-174.cs). * attribute.cs (Attribute.ValidateGuid): new method. (Attribute.Resolve): Use above. 2002-11-19 Miguel de Icaza * enum.cs: In FindMembers, perform a recursive lookup for values. (34308) * ecore.cs (SimpleName.SimpleNameResolve): Remove the special handling for enumerations, as we only needed the TypeContainer functionality to begin with (this is required for the fix below to work for enums that reference constants in a container class for example). * codegen.cs (EmitContext): Make TypeContainer a DeclSpace. * enum.cs (Enum.Define): Use `this' instead of parent, so we have a valid TypeBuilder to perform lookups on.o * class.cs (InheritableMemberSignatureCompare): Use true in the call to GetGetMethod and GetSetMethod, because we are comparing the signature, and we need to get the methods *even* if they are private. (PropertyBase.CheckBase): ditto. * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta, GotoCase.Resolve): Use Peel on EmpytCasts. * ecore.cs (EmptyCast): drop child, add Peel method. 2002-11-17 Martin Baulig * ecore.cs (EmptyCast.Child): New public property. * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the label resolved to an EmptyCast. Fixes #34162. (GotoCase.Resolve): Likewise. (Block.EmitMeta): Likewise. 2002-11-17 Martin Baulig * expression.cs (Invocation.BetterConversion): Prefer int over uint; short over ushort; long over ulong for integer literals. Use ImplicitConversionExists instead of StandardConversionExists since we also need to check for user-defined implicit conversions. Fixes #34165. Added test-173.cs. 2002-11-16 Martin Baulig * expression.cs (Binary.EmitBranchable): Eliminate comparisions with the `true' and `false' literals. Fixes #33151. 2002-11-16 Martin Baulig * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from October 22nd; don't do the cs1540 check for static members. * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're now using our own filter here and doing the cs1540 check again. 2002-11-16 Martin Baulig * support.cs (InternalParameters): Don't crash if we don't have any fixed parameters. Fixes #33532. 2002-11-16 Martin Baulig * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy when looking up static methods to make this work on Windows. Fixes #33773. 2002-11-16 Martin Baulig * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have a setter rather than using PropertyInfo.CanWrite. 2002-11-15 Nick Drochak * class.cs: Allow acces to block member by subclasses. Fixes build breaker. 2002-11-14 Martin Baulig * class.cs (Constructor.Emit): Added the extern/block check. Fixes bug #33678. 2002-11-14 Martin Baulig * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly iteration while looking for indexers, this is needed because the indexer may have a different name in our base classes. Fixed the error reporting (no indexers at all, not get accessor, no overloaded match). Fixes bug #33089. (IndexerAccess.DoResolveLValue): Likewise. 2002-11-14 Martin Baulig * class.cs (PropertyBase.CheckBase): Make this work for multiple indexers. Fixes the first part of bug #33089. (MethodSignature.InheritableMemberSignatureCompare): Added support for properties. 2002-11-13 Ravi Pratap * attribute.cs (Attribute.Resolve): Catch the NullReferenceException and report it since it isn't supposed to happen. 2002-11-12 Miguel de Icaza * expression.cs (Binary.EmitBranchable): Also handle the cases for LogicalOr and LogicalAnd that can benefit from recursively handling EmitBranchable. The code now should be nice for Paolo. 2002-11-08 Miguel de Icaza * typemanager.cs (LookupType): Added a negative-hit hashtable for the Type lookups, as we perform quite a number of lookups on non-Types. This can be removed once we can deterministically tell whether we have a type or a namespace in advance. But this might require special hacks from our corlib. * TODO: updated. * ecore.cs (TryImplicitIntConversion): Handle conversions to float and double which avoids a conversion from an integer to a double. * expression.cs: tiny optimization, avoid calling IsConstant, because it effectively performs the lookup twice. 2002-11-06 Miguel de Icaza But a bogus return here to keep the semantics of the old code until the Mono runtime is fixed. * pending.cs (GetMissingInterfaces): New method used to remove all the interfaces that are already implemented by our parent classes from the list of pending methods. * interface.cs: Add checks for calls after ResolveTypeExpr. 2002-11-05 Miguel de Icaza * class.cs (Class.Emit): Report warning 67: event not used if the warning level is beyond 3. * ecore.cs (Expression.ConvertExplicit): Missed a check for expr being a NullLiteral. * cs-parser.jay: Fix, Gonzalo reverted the order of the rank specifiers. * class.cs (TypeContainer.GetClassBases): Cover a missing code path that might fail if a type can not be resolved. * expression.cs (Binary.Emit): Emit unsigned versions of the operators. * driver.cs: use error 5. 2002-11-02 Gonzalo Paniagua Javier * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared. 2002-11-01 Miguel de Icaza * cs-parser.jay (switch_section): A beautiful patch from Martin Baulig that fixed 33094. 2002-10-31 Miguel de Icaza * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve): Check whether the base is abstract and report an error if so. * expression.cs (IndexerAccess.DoResolveLValue, IndexerAccess.DoResolve): ditto. (Invocation.DoResolve): ditto. (Invocation.FullMethodDesc): Improve the report string. * statement.cs (Block): Eliminate IsVariableDefined as it is basically just a wrapper for GetVariableInfo. * ecore.cs (SimpleName): Use new * support.cs (ReflectionParamter.ParameterType): We unwrap the type, as we return the actual parameter ref/unref state on a different call. 2002-10-30 Miguel de Icaza * support.cs: Return proper flags REF/OUT fixing the previous commit. * expression.cs: Reverted last patch, that was wrong. Is_ref is not used to mean `ref' but `ref or out' in ParameterReference * delegate.cs (FullDelegateDesc): use ParameterDesc to get the full type signature instead of calling TypeManger.CSharpName ourselves. * support.cs (InternalParameters.ParameterDesc): Do not compare directly to the modflags, because REF/OUT will actually be bitsets if set. * delegate.cs (VerifyMethod): Check also the modifiers. * cs-tokenizer.cs: Fix bug where floating point values with an exponent where a sign was missing was ignored. * driver.cs: Allow multiple assemblies to be specified in a single /r: argument 2002-10-28 Miguel de Icaza * cs-parser.jay: Ugly. We had to add a multiplicative_expression, because identifiers after a parenthesis would end up in this kind of production, and we needed to desamiguate it for having casts like: (UserDefinedType *) xxx 2002-10-24 Miguel de Icaza * typemanager.cs (RealMemberLookup): when we deal with a subclass, we should set on the Bindingflags.NonPublic, but not turn on private_ok. private_ok controls whether a Private member is returned (this is chekced on the filter routine), while the BindingFlags.NonPublic just controls whether private/protected will be allowed. This fixes the problem part of the problem of private properties being allowed to be used in derived classes. * expression.cs (BaseAccess): Provide an DoResolveLValue method, so we can call the children DoResolveLValue method (this will properly signal errors on lvalue assignments to base properties) * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and getter are null, and we have a property info, we know that this happened because the lookup failed, so we report an error 122 for protection level violation. We also silently return if setter and getter are null in the resolve functions, this condition only happens if we have flagged the error before. This is the other half of the problem. (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does not have accessibility information, that is why we were returning true in the filter function in typemanager.cs. To properly report 122 (property is inaccessible because of its protection level) correctly, we report this error in ResolveAccess by failing if both the setter and the getter are lacking (ie, the lookup failed). DoResolve and DoLResolve have been modified to check for both setter/getter being null and returning silently, the reason being that I did not want to put the knowledge about this error in upper layers, like: int old = Report.Errors; x = new PropertyExpr (...); if (old != Report.Errors) return null; else return x; So the property expr is returned, but it is invalid, so the error will be flagged during the resolve process. * class.cs: Remove InheritablePropertySignatureCompare from the class, as we no longer depend on the property signature to compute whether it is possible to implement a method or not. The reason is that calling PropertyInfo.GetGetMethod will return null (in .NET, in Mono it works, and we should change this), in cases where the Get Method does not exist in that particular class. So this code: class X { public virtual int A { get { return 1; } } } class Y : X { } class Z : Y { public override int A { get { return 2; } } } Would fail in Z because the parent (Y) would not have the property defined. So we avoid this completely now (because the alternative fix was ugly and slow), and we now depend exclusively on the method names. (PropertyBase.CheckBase): Use a method-base mechanism to find our reference method, instead of using the property. * typemanager.cs (GetPropertyGetter, GetPropertySetter): These routines are gone now. * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the names, they were incorrectly named. * cs-tokenizer.cs: Return are more gentle token on failure. * pending.cs (PendingImplementation.InterfaceMethod): This routine had an out-of-sync index variable, which caused it to remove from the list of pending methods the wrong method sometimes. 2002-10-22 Miguel de Icaza * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead, CanWrite, because those refer to this particular instance of the property, and do not take into account the fact that we can override single members of a property. Constructor requires an EmitContext. The resolution process does not happen here, but we need to compute the accessors before, because the resolution does not always happen for properties. * typemanager.cs (RealMemberLookup): Set private_ok if we are a subclass, before we did not update this flag, but we did update bindingflags. (GetAccessors): Drop this routine, as it did not work in the presence of partially overwritten set/get methods. Notice that this broke the cs1540 detection, but that will require more thinking. 2002-10-22 Gonzalo Paniagua Javier * class.cs: * codegen.cs: * driver.cs: issue a warning instead of an error if we don't support debugging for the platform. Also ignore a couple of errors that may arise when trying to write the symbols. Undo my previous patch. 2002-10-22 Gonzalo Paniagua Javier * driver.cs: ignore /debug switch except for Unix platforms. 2002-10-23 Nick Drochak * makefile: Remove mcs2.exe and mcs3.exe on 'make clean' 2002-10-21 Miguel de Icaza * driver.cs: Do not make mcs-debug conditional, so we do not break builds that use it. * statement.cs (UsageVector.MergeChildren): I would like Martin to review this patch. But basically after all the children variables have been merged, the value of "Breaks" was not being set to new_breaks for Switch blocks. I think that it should be set after it has executed. Currently I set this to the value of new_breaks, but only if new_breaks is FlowReturn.ALWAYS, which is a bit conservative, but I do not understand this code very well. I did not break anything in the build, so that is good ;-) * cs-tokenizer.cs: Also allow \r in comments as a line separator. 2002-10-20 Mark Crichton * cfold.cs: Fixed compile blocker. Really fixed it this time. 2002-10-20 Nick Drochak * cfold.cs: Fixed compile blocker. 2002-10-20 Miguel de Icaza * driver.cs: I was chekcing the key, not the file. 2002-10-19 Ravi Pratap * ecore.cs (UserDefinedConversion): Get rid of the bogus error message that we were generating - we just need to silently return a null. 2002-10-19 Miguel de Icaza * class.cs (Event.Define): Change my previous commit, as this breaks the debugger. This is a temporary hack, as it seems like the compiler is generating events incorrectly to begin with. * expression.cs (Binary.ResolveOperator): Added support for "U operator - (E x, E y)" * cfold.cs (BinaryFold): Added support for "U operator - (E x, E y)". * ecore.cs (FieldExpr.AddressOf): We had a special code path for init-only variables, but this path did not take into account that there might be also instance readonly variables. Correct this problem. This fixes bug 32253 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe delegates as well. * driver.cs: Change the extension for modules to `netmodule' * cs-parser.jay: Improved slightly the location tracking for the debugger symbols. * class.cs (Event.Define): Use Modifiers.FieldAttr on the modifiers that were specified instead of the hardcoded value (FamAndAssem). This was basically ignoring the static modifier, and others. Fixes 32429. * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and fixed a bug in the process (32476) * expression.cs (ArrayAccess.EmitAssign): Patch from hwang_rob@yahoo.ca that fixes bug 31834.3 2002-10-18 Miguel de Icaza * driver.cs: Make the module extension .netmodule. 2002-10-16 Miguel de Icaza * driver.cs: Report an error if the resource file is not found instead of crashing. * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of false, like Emit does. 2002-10-16 Nick Drochak * typemanager.cs: Remove unused private member. Also reported mcs bug to report this as a warning like csc. 2002-10-15 Martin Baulig * statement.cs (Statement.Emit): Made this a virtual method; emits the line number info and calls DoEmit(). (Statement.DoEmit): New protected abstract method, formerly knows as Statement.Emit(). * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer. 2002-10-11 Miguel de Icaza * class.cs: Following the comment from 2002-09-26 to AddMethod, I have fixed a remaining problem: not every AddXXXX was adding a fully qualified name. Now everyone registers a fully qualified name in the DeclSpace as being defined instead of the partial name. Downsides: we are slower than we need to be due to the excess copies and the names being registered this way. The reason for this is that we currently depend (on the corlib bootstrap for instance) that types are fully qualified, because we dump all the types in the namespace, and we should really have types inserted into the proper namespace, so we can only store the basenames in the defined_names array. 2002-10-10 Martin Baulig * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch from bug #31834, see the bug report for a testcase which is miscompiled. 2002-10-10 Martin Baulig * codegen.cs (EmitContext.Breaks): Removed, we're now using the flow analysis code for this. * statement.cs (Do, While, For): Tell the flow analysis code about infinite loops. (FlowBranching.UsageVector): Added support for infinite loops. (Block.Resolve): Moved the dead code elimination here and use flow analysis to do it. 2002-10-09 Miguel de Icaza * class.cs (Field.Define): Catch cycles on struct type definitions. * typemanager.cs (IsUnmanagedtype): Do not recursively check fields if the fields are static. We only need to check instance fields. * expression.cs (As.DoResolve): Test for reference type. * statement.cs (Using.ResolveExpression): Use ConvertImplicitRequired, not ConvertImplicit which reports an error on failture (Using.ResolveLocalVariableDecls): ditto. * expression.cs (Binary.ResolveOperator): Report errors in a few places where we had to. * typemanager.cs (IsUnmanagedtype): Finish implementation. 2002-10-08 Miguel de Icaza * expression.cs: Use StoreFromPtr instead of extracting the type and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca * ecore.cs (ImplicitReferenceConversion): It is possible to assign an enumeration value to a System.Enum, but System.Enum is not a value type, but an class type, so we need to box. (Expression.ConvertExplicit): One codepath could return errors but not flag them. Fix this. Fixes #31853 * parameter.cs (Resolve): Do not allow void as a parameter type. 2002-10-06 Martin Baulig * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash if it's a class type and not a struct. Fixes #31815. 2002-10-06 Martin Baulig * statement.cs: Reworked the flow analysis code a bit to make it usable for dead code elimination. 2002-10-06 Gonzalo Paniagua Javier * cs-parser.jay: allow empty source files. Fixes bug #31781. 2002-10-04 Miguel de Icaza * expression.cs (ComposedCast.DoResolveType): A quick workaround to fix the test 165, will investigate deeper. 2002-10-04 Martin Baulig * statement.cs (FlowBranching.UsageVector.MergeChildren): Make finally blocks actually work. (Try.Resolve): We don't need to create a sibling for `finally' if there is no finally block. 2002-10-04 Martin Baulig * class.cs (Constructor.Define): The default accessibility for a non-default constructor is private, not public. 2002-10-04 Miguel de Icaza * class.cs (Constructor): Make AllowedModifiers public, add EXTERN. * cs-parser.jay: Perform the modifiers test here, as the constructor for the Constructor class usually receives a zero because of the way we create it (first we create, later we customize, and we were never checking the modifiers). * typemanager.cs (Typemanager.LookupTypeDirect): This new function is a version of LookupTypeReflection that includes the type-name cache. This can be used as a fast path for functions that know the fully qualified name and are only calling into *.GetType() to obtain a composed type. This is also used by TypeManager.LookupType during its type composition. (LookupType): We now also track the real type name, as sometimes we can get a quey for the real type name from things like ComposedCast. This fixes bug 31422. * expression.cs (ComposedCast.Resolve): Since we are obtaining a complete type fullname, it does not have to go through the type resolution system to obtain the composed version of the type (for obtaining arrays or pointers). (Conditional.Emit): Use the EmitBoolExpression to generate nicer code, as requested by Paolo. (ArrayCreation.CheckIndices): Use the patch from hwang_rob@yahoo.ca to validate the array initializers. 2002-10-03 Miguel de Icaza * class.cs (ConstructorInitializer.Emit): simplify code by using Invocation.EmitCall, and at the same time, fix the bugs in calling parent constructors that took variable arguments. * ecore.cs (Expression.ConvertNumericExplicit, Expression.ImplicitNumericConversion): Remove the code that manually wrapped decimal (InternalTypeConstructor call is now gone as well). * expression.cs (Cast.TryReduce): Also handle decimal types when trying to perform a constant fold on the type. * typemanager.cs (IsUnmanagedtype): Partially implemented. * parameter.cs: Removed ResolveAndDefine, as it was not needed, as that only turned off an error report, and did nothing else. 2002-10-02 Miguel de Icaza * driver.cs: Handle and ignore /fullpaths 2002-10-01 Miguel de Icaza * expression.cs (Binary.ResolveOperator): Catch the case where DoNumericPromotions returns true, (Binary.DoNumericPromotions): Simplify the code, and the tests. 2002-09-27 Miguel de Icaza * ecore.cs (EventExpr.Emit): Instead of emitting an exception, report error 70. 2002-09-26 Miguel de Icaza * ecore.cs (ConvertNumericExplicit): It is not enough that the conversion exists, but it is also required that the conversion be performed. This manifested in "(Type64Enum) 2". * class.cs (TypeManager.AddMethod): The fix is not to change AddEnum, because that one was using a fully qualified name (every DeclSpace derivative does), but to change the AddMethod routine that was using an un-namespaced name. This now correctly reports the duplicated name. Revert patch until I can properly fix it. The issue is that we have a shared Type space across all namespaces currently, which is wrong. Options include making the Namespace a DeclSpace, and merge current_namespace/current_container in the parser. 2002-09-25 Miguel de Icaza * cs-parser.jay: Improve error reporting when we get a different kind of expression in local_variable_type and local_variable_pointer_type. Propagate this to avoid missleading errors being reported. * ecore.cs (ImplicitReferenceConversion): treat TypeManager.value_type as a target just like object_type. As code like this: ValueType v = 1; Is valid, and needs to result in the int 1 being boxed before it is assigned to the value type v. * class.cs (TypeContainer.AddEnum): Use the basename, not the name to validate the enumeration name. * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from EmitDynamicInitializers for the criteria to use Ldelema. Thanks to hwang_rob@yahoo.ca for finding the bug and providing a patch. * ecore.cs (TryImplicitIntConversion): When doing an implicit-enumeration-conversion, check if the type is 64-bits and perform a conversion before passing to EnumConstant. 2002-09-23 Miguel de Icaza * decl.cs (Error_AmbiguousTypeReference); New routine used to report ambiguous type references. Unlike the MS version, we report what the ambiguity is. Innovation at work ;-) (DeclSpace.FindType): Require a location argument to display when we display an ambiguous error. * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType. * interface.cs (GetInterfaceTypeByName): Pass location to FindType. * expression.cs (EmitDynamicInitializers): Apply patch from hwang_rob@yahoo.ca that fixes the order in which we emit our initializers. 2002-09-21 Martin Baulig * delegate.cs (Delegate.VerifyApplicability): Make this work if the delegate takes no arguments. 2002-09-20 Miguel de Icaza * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs from integers. * expression.cs: Extract the underlying type. * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum * decl.cs (FindType): Sorry about this, fixed the type lookup bug. 2002-09-19 Miguel de Icaza * class.cs (TypeContainer.DefineType): We can not use the nice PackingSize with the size set to 1 DefineType method, because it will not allow us to define the interfaces that the struct implements. This completes the fixing of bug 27287 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S' means also structs. This fixes part of the problem. (Expresion.ImplicitReferenceConversionExists): ditto. * decl.cs (DeclSparce.ResolveType): Only report the type-not-found error if there were no errors reported during the type lookup process, to avoid duplicates or redundant errors. Without this you would get an ambiguous errors plus a type not found. We have beaten the user enough with the first error. (DeclSparce.FindType): Emit a warning if we have an ambiguous reference. * ecore.cs (SimpleName.DoResolveType): If an error is emitted during the resolution process, stop the lookup, this avoids repeated error reports (same error twice). * rootcontext.cs: Emit a warning if we have an ambiguous reference. * typemanager.cs (LookupType): Redo the type lookup code to match the needs of System.Reflection. The issue is that System.Reflection requires references to nested types to begin with a "+" sign instead of a dot. So toplevel types look like: "NameSpace.TopLevelClass", and nested ones look like "Namespace.TopLevelClass+Nested", with arbitrary nesting levels. 2002-09-19 Martin Baulig * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis says that a method always returns or always throws an exception, don't report the CS0161. * statement.cs (FlowBranching.UsageVector.MergeChildren): Always set `Returns = new_returns'. 2002-09-19 Martin Baulig * expression.cs (MemberAccess.ResolveMemberAccess): When resolving to an enum constant, check for a CS0176. 2002-09-18 Miguel de Icaza * class.cs (TypeContainer.CheckPairedOperators): Now we check for operators that must be in pairs and report errors. * ecore.cs (SimpleName.DoResolveType): During the initial type resolution process, when we define types recursively, we must check first for types in our current scope before we perform lookups in the enclosing scopes. * expression.cs (MakeByteBlob): Handle Decimal blobs. (Invocation.VerifyArgumentsCompat): Call TypeManager.TypeToCoreType on the parameter_type.GetElementType. I thought we were supposed to always call this, but there are a few places in the code where we dont do it. 2002-09-17 Miguel de Icaza * driver.cs: Add support in -linkres and -resource to specify the name of the identifier. 2002-09-16 Miguel de Icaza * ecore.cs (StandardConversionExists): Sync with the conversion code: allow anything-* to void* conversions. (FindMostSpecificSource): Use an Expression argument instead of a Type, because we might be handed over a Literal which gets a few more implicit conversions that plain types do not. So this information was being lost. Also, we drop the temporary type-holder expression when not required. 2002-09-17 Martin Baulig * class.cs (PropertyBase.CheckBase): Don't check the base class if this is an explicit interface implementation. 2002-09-17 Martin Baulig * class.cs (PropertyBase.CheckBase): Make this work for indexers with different `IndexerName' attributes. * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess. (IndexerAccess): Added special protected ctor for BaseIndexerAccess and virtual CommonResolve(). 2002-09-16 Miguel de Icaza * enum.cs (LookupEnumValue): Use the EnumConstant declared type, and convert that to the UnderlyingType. * statement.cs (Foreach.Resolve): Indexers are just like variables or PropertyAccesses. * cs-tokenizer.cs (consume_string): Track line numbers and columns inside quoted strings, we were not doing this before. 2002-09-16 Martin Baulig * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression, resolve it. This is needed for the definite assignment check of the instance expression, fixes bug #29846. (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise. 2002-09-16 Nick Drochak * parameter.cs: Fix compile error. Cannot reference static member from an instance object. Is this an mcs bug? 2002-09-14 Martin Baulig * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface multiple times. Fixes bug #30295, added test-166.cs. 2002-09-14 Martin Baulig * statement.cs (Block.Emit): Don't emit unreachable code. (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing `break' statements. (Goto.Emit, Continue.Emit): Set ec.Breaks = true. 2002-09-14 Martin Baulig * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF is set. 2002-09-14 Martin Baulig * typemanager.cs (TypeManager.IsNestedChildOf): This must return false if `type == parent' since in this case `type.IsSubclassOf (parent)' will be false on the ms runtime. 2002-09-13 Martin Baulig * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in the CS0038 error message. 2002-09-12 Miguel de Icaza * expression.cs (CheckedExpr, UnCheckedExpr): If we have a constant inside, return it. 2002-09-12 Martin Baulig * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an implicit conversion can be done between enum types. * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant, check whether an implicit conversion to the current enum's UnderlyingType exists and report an error if not. * codegen.cs (CodeGen.Init): Delete the symbol file when compiling without debugging support. * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead. Fixes bug #30235. Thanks to Ricardo Fernández Pascual. 2002-09-12 Martin Baulig * typemanager.cs (TypeManager.IsNestedChildOf): New method. * ecore.cs (IMemberExpr.DeclaringType): New property. (SimpleName.SimpleNameResolve): Check whether we're accessing a nonstatic member of an outer type (CS0038). 2002-09-11 Miguel de Icaza * driver.cs: Activate the using-error detector at warning level 4 (at least for MS-compatible APIs). * namespace.cs (VerifyUsing): Small buglett fix. * pending.cs (PendingImplementation): pass the container pointer. * interface.cs (GetMethods): Allow for recursive definition. Long term, I would like to move every type to support recursive definitions, not the current ordering mechanism that we have right now. The situation is this: Attributes are handled before interfaces, so we can apply attributes to interfaces. But some attributes implement interfaces, we will now handle the simple cases (recursive definitions will just get an error). * parameter.cs: Only invalidate types at the end if we fail to lookup all types. 2002-09-09 Martin Baulig * ecore.cs (PropertyExpr.Emit): Also check for TypeManager.system_int_array_get_length so this'll also work when compiling corlib. Fixes #30003. 2002-09-09 Martin Baulig * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums and throw an exception if we can't get the type's size. Fixed #30040, added test-165.cs. 2002-09-09 Martin Baulig * ecore.cs (PropertyExpr.DoResolve): Added check for static properies. * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe context. Fixes bug #30027. * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for virtual functions. Fixes bug #30043, added test-164.cs. 2002-09-08 Ravi Pratap * attribute.cs : Fix a small NullRef crash thanks to my stupidity. 2002-09-08 Nick Drochak * driver.cs: Use an object to get the windows codepage since it's not a static property. 2002-09-08 Miguel de Icaza * statement.cs (For.Emit): for infinite loops (test == null) return whether there is a break inside, not always "true". * namespace.cs (UsingEntry): New struct to hold the name of the using definition, the location where it is defined, and whether it has been used in a successful type lookup. * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of strings. * decl.cs: ditto. 2002-09-06 Ravi Pratap * attribute.cs : Fix incorrect code which relied on catching a NullReferenceException to detect a null being passed in where an object was expected. 2002-09-06 Miguel de Icaza * statement.cs (Try): flag the catch variable as assigned * expression.cs (Cast): Simplified by using ResolveType instead of manually resolving. * statement.cs (Catch): Fix bug by using ResolveType. 2002-09-06 Ravi Pratap * expression.cs (BetterConversion): Special case for when we have a NullLiteral as the argument and we have to choose between string and object types - we choose string the way csc does. * attribute.cs (Attribute.Resolve): Catch the NullReferenceException and report error #182 since the Mono runtime no more has the bug and having this exception raised means we tried to select a constructor which takes an object and is passed a null. 2002-09-05 Ravi Pratap * expression.cs (Invocation.OverloadResolve): Flag a nicer error message (1502, 1503) when we can't locate a method after overload resolution. This is much more informative and closes the bug Miguel reported. * interface.cs (PopulateMethod): Return if there are no argument types. Fixes a NullReferenceException bug. * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf expressions too. Previously we were checking only in one place for positional arguments leaving out named arguments. * ecore.cs (ImplicitNumericConversion): Conversion from underlying type to the enum type is not allowed. Remove code corresponding to that. (ConvertNumericExplicit): Allow explicit conversions from the underlying type to enum type. This precisely follows the spec and closes a bug filed by Gonzalo. 2002-09-04 Gonzalo Paniagua Javier * compiler.csproj: * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com). 2002-09-03 Miguel de Icaza * statement.cs (SwitchLabel.ResolveAndReduce): In the string case, it was important that we stored the right value after the reduction in `converted'. 2002-09-04 Martin Baulig * location.cs (Location.SymbolDocument): Use full pathnames for the source files. 2002-08-30 Miguel de Icaza * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead of the expression resolve mechanism, because that will catch the SimpleName error failures. (Conditional): If we can not resolve the expression, return, do not crash. 2002-08-29 Gonzalo Paniagua Javier * cs-tokenizer.cs: (location): display token name instead of its number. 2002-08-28 Martin Baulig * expression.cs (Binary.ResolveOperator): Don't silently return but return an error if an operator cannot be applied between two enum types. 2002-08-28 Martin Baulig * class.cs (Constructor.Define): Set the permission attributes correctly instead of making all constructors public. 2002-08-28 Martin Baulig * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook for private members before reporting a CS0103; if we find anything, it's a CS0122. 2002-08-28 Martin Baulig * typemanager.cs (TypeManager.FilterWithClosure): It's not enough to check whether `closure_start_type == closure_invocation_type', we also need to check whether `m.DeclaringType == closure_invocation_type' before bypassing the permission checks. We might be accessing protected/private members from the base class. (TypeManager.RealMemberLookup): Only set private_ok if private members were requested via BindingFlags.NonPublic. * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property. * expression.cs (MemberAccess.ResolveMemberAccess): Set MethodGroupExpr.IsExplicitImpl if appropriate. (Invocation.DoResolve): Don't report the CS0120 for explicit interface implementations. 2002-08-27 Martin Baulig * expression.cs (Invocation.DoResolve): If this is a static method and we don't have an InstanceExpression, we must report a CS0120. 2002-08-25 Martin Baulig * expression.cs (Binary.ResolveOperator): Don't allow `!=' and `==' between a valuetype and an object. 2002-08-25 Miguel de Icaza * ecore.cs (TypeExpr): Provide a ToString method. 2002-08-24 Martin Baulig * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is now called proggie.dbg and it's a binary file. 2002-08-23 Martin Baulig * decl.cs (MemberCache.AddMethods): Ignore varargs methods. 2002-08-23 Martin Baulig * struct.cs (MyStructInfo.ctor): Make this work with empty structs; it's not allowed to use foreach() on null. 2002-08-23 Martin Baulig * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol writer the full pathname of the generated assembly. 2002-08-23 Martin Baulig * statements.cs (FlowBranching.UsageVector.MergeChildren): A `finally' block never returns or breaks; improved handling of unreachable code. 2002-08-23 Martin Baulig * statement.cs (Throw.Resolve): Allow `throw null'. 2002-08-23 Martin Baulig * expression.cs (MemberAccess.ResolveMemberAccess): If this is an EventExpr, don't do a DeclaredOnly MemberLookup, but check whether `ee.EventInfo.DeclaringType == ec.ContainerType'. The MemberLookup would return a wrong event if this is an explicit interface implementation and the class has an event with the same name. 2002-08-23 Martin Baulig * statement.cs (Block.AddChildVariableNames): New public method. (Block.AddChildVariableName): Likewise. (Block.IsVariableNameUsedInChildBlock): Likewise. (Block.AddVariable): Check whether a variable name has already been used in a child block. * cs-parser.jay (declare_local_variables): Mark all variable names from the current block as being used in a child block in the implicit block. 2002-08-23 Martin Baulig * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't find the symbol writer. * driver.cs: csc also allows the arguments to /define being separated by commas, not only by semicolons. 2002-08-23 Martin Baulig * interface.cs (Interface.GetMembers): Added static check for events. 2002-08-15 Martin Baulig * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup call, use ec.ContainerType.BaseType as queried_type and invocation_type. * ecore.cs (Expression.MemberLookup): Added documentation and explained why the MethodData.EmitDestructor() change was necessary. 2002-08-20 Martin Baulig * class.cs (TypeContainer.FindMembers): Added static check for events. * decl.cs (MemberCache.AddMembers): Handle events like normal members. * typemanager.cs (TypeHandle.GetMembers): When queried for events only, use Type.GetEvents(), not Type.FindMembers(). 2002-08-20 Martin Baulig * decl.cs (MemberCache): Added a special method cache which will be used for method-only searched. This ensures that a method search will return a MethodInfo with the correct ReflectedType for inherited methods. 2002-08-20 Martin Baulig * decl.cs (DeclSpace.FindMembers): Made this public. 2002-08-20 Gonzalo Paniagua Javier * delegate.cs: fixed build on windows. [FIXME: Filed as bug #29150: MCS must report these errors.] 2002-08-19 Ravi Pratap * ecore.cs (StandardConversionExists): Return a false if we are trying to convert the void type to anything else since that is not allowed. * delegate.cs (DelegateInvocation.DoResolve): Ensure that we flag error 70 in the event an event is trying to be accessed directly from outside the declaring type. 2002-08-20 Martin Baulig * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and MemberCache from typemanager.cs to decl.cs. 2002-08-19 Martin Baulig * class.cs (TypeContainer): Implement IMemberContainer. (TypeContainer.DefineMembers): Create the MemberCache. (TypeContainer.FindMembers): Do better BindingFlags checking; only return public members if BindingFlags.Public was given, check whether members are static. 2002-08-16 Martin Baulig * decl.cs (DeclSpace.Define): Splitted this in Define and DefineMembers. DefineMembers is called first and initializes the MemberCache. * rootcontext.cs (RootContext.DefineMembers): New function. Calls DefineMembers() on all our DeclSpaces. * class.cs (TypeContainer.Define): Moved all code to DefineMembers(), but call DefineMembers() on all nested interfaces. We call their Define() in our new Define() function. * interface.cs (Interface): Implement IMemberContainer. (Interface.Define): Moved all code except the attribute stuf to DefineMembers(). (Interface.DefineMembers): Initialize the member cache. * typemanager.cs (IMemberFinder): Removed this interface, we don't need this anymore since we can use MemberCache.FindMembers directly. 2002-08-19 Martin Baulig * typemanager.cs (MemberCache): When creating the cache for an interface type, add all inherited members. (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching' to `out bool used_cache' and documented it. (TypeManager.MemberLookup): If we already used the cache in the first iteration, we don't need to do the interfaces check. 2002-08-19 Martin Baulig * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this here from IMemberFinder and don't implement this interface anymore. (DeclSpace.MemberCache): Moved here from IMemberFinder. * typemanager.cs (IMemberFinder): This interface is now only used by classes which actually support the member cache. (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace since we only put DeclSpaces into this Hashtable. (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is a dynamic type and TypeHandle.GetTypeHandle() otherwise. 2002-08-16 Martin Baulig * typemanager.cs (ICachingMemberFinder): Removed. (IMemberFinder.MemberCache): New property. (TypeManager.FindMembers): Merged this with RealFindMembers(). This function will never be called from TypeManager.MemberLookup() so we can't use the cache here, just the IMemberFinder. (TypeManager.MemberLookup_FindMembers): Check whether the IMemberFinder has a MemberCache and call the cache's FindMembers function. (MemberCache): Rewrote larger parts of this yet another time and cleaned it up a bit. 2002-08-15 Miguel de Icaza * driver.cs (LoadArgs): Support quoting. (Usage): Show the CSC-like command line arguments. Improved a few error messages. 2002-08-15 Martin Baulig * typemanager.cs (IMemberContainer.Type): New property. (IMemberContainer.IsInterface): New property. The following changes are conditional to BROKEN_RUNTIME, which is defined at the top of the file. * typemanager.cs (MemberCache.MemberCache): Don't add the base class'es members, but add all members from TypeHandle.ObjectType if we're an interface. (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType is the current type. (MemberCache.CacheEntry.Container): Removed this field. (TypeHandle.GetMembers): Include inherited members. 2002-08-14 Gonzalo Paniagua Javier * typemanager.cs: fixed compilation and added a comment on a field that is never used. 2002-08-15 Martin Baulig * class.cs (ConstructorInitializer.Resolve): In the Expression.MemberLookup call, use the queried_type as invocation_type. * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool declared' attribute, it's always true. (IMemberContainer.Parent, IMemberContainer.Name): New properties. (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added temporary wrapper for FindMembers which tells MemberLookup whether members from the base classes are included in the return value. This will go away soon. (TypeManager.MemberLookup): Use this temporary hack here; once the new MemberCache is completed, we don't need to do the DeclaredOnly looping here anymore since the MemberCache will take care of this. (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'. (MemberCache): When creating the MemberCache for a class, get members from the current class and all its base classes. (MemberCache.CacheEntry.Container): New field. This is a temporary hack until the Mono runtime is fixed to distinguish between ReflectedType and DeclaringType. It allows us to use MCS with both the MS runtime and the unfixed Mono runtime without problems and without accecting performance. (MemberCache.SearchMembers): The DeclaredOnly looping from TypeManager.MemberLookup is now done here. 2002-08-14 Martin Baulig * statement.cs (MyStructInfo.MyStructInfo): Don't call Type.GetFields on dynamic types but get the fields from the corresponding TypeContainer. (MyStructInfo.GetStructInfo): Added check for enum types. * typemanager.cs (MemberList.IsSynchronized): Implemented. (MemberList.SyncRoot): Implemented. (TypeManager.FilterWithClosure): No need to check permissions if closure_start_type == closure_invocation_type, don't crash if closure_invocation_type is null. 2002-08-13 Martin Baulig Rewrote TypeContainer.FindMembers to use a member cache. This gives us a speed increase of about 35% for the self-hosting MCS build and of about 15-20% for the class libs (both on GNU/Linux). * report.cs (Timer): New class to get enhanced profiling. This whole class is "TIMER" conditional since it remarkably slows down compilation speed. * class.cs (MemberList): New class. This is an IList wrapper which we're now using instead of passing MemberInfo[]'s around to avoid copying this array unnecessarily. (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo []. (ICachingMemberFinder, IMemberContainer): New interface. (TypeManager.FilterWithClosure): If `criteria' is null, the name has already been checked, otherwise use it for the name comparision. (TypeManager.FindMembers): Renamed to RealMemberFinder and provided wrapper which tries to use ICachingMemberFinder.FindMembers if possible. Returns a MemberList, not a MemberInfo []. (TypeHandle): New class, implements IMemberContainer. We create one instance of this class per type, it contains a MemberCache which is used to do the member lookups. (MemberCache): New class. Each instance of this class contains all members of a type and a name-based hash table. (MemberCache.FindMembers): This is our new member lookup function. First, it looks up all members of the requested name in the hash table. Then, it walks this list and sorts out all applicable members and returns them. 2002-08-13 Martin Baulig In addition to a nice code cleanup, this gives us a performance increase of about 1.4% on GNU/Linux - not much, but it's already half a second for the self-hosting MCS compilation. * typemanager.cs (IMemberFinder): New interface. It is used by TypeManager.FindMembers to call FindMembers on a TypeContainer, Enum, Delegate or Interface. (TypeManager.finder_to_member_finder): New PtrHashtable. (TypeManager.finder_to_container): Removed. (TypeManager.finder_to_delegate): Removed. (TypeManager.finder_to_interface): Removed. (TypeManager.finder_to_enum): Removed. * interface.cs (Interface): Implement IMemberFinder. * delegate.cs (Delegate): Implement IMemberFinder. * enum.cs (Enum): Implement IMemberFinder. * class.cs (TypeContainer): Implement IMemberFinder. 2002-08-12 Martin Baulig * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual. 2002-08-12 Martin Baulig * ecore.cs (ITypeExpression): New interface for expressions which resolve to a type. (TypeExpression): Renamed to TypeLookupExpression. (Expression.DoResolve): If we're doing a types-only lookup, the expression must implement the ITypeExpression interface and we call DoResolveType() on it. (SimpleName): Implement the new ITypeExpression interface. (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes hack, the situation that we're only looking up types can't happen anymore when this method is called. Moved the type lookup code to DoResolveType() and call it. (SimpleName.DoResolveType): This ITypeExpression interface method is now doing the types-only lookup. (TypeExpr, TypeLookupExpression): Implement ITypeExpression. (ResolveFlags): Added MaskExprClass. * expression.cs (MemberAccess): Implement the ITypeExpression interface. (MemberAccess.DoResolve): Added support for a types-only lookup when we're called via ITypeExpression.DoResolveType(). (ComposedCast): Implement the ITypeExpression interface. * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call Expression.Resolve() with ResolveFlags.Type instead. 2002-08-12 Martin Baulig * interface.cs (Interface.Define): Apply attributes. * attribute.cs (Attribute.ApplyAttributes): Added support for interface attributes. 2002-08-11 Martin Baulig * statement.cs (Block.Emit): Only check the "this" variable if we do not always throw an exception. * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check whether the property has a set accessor. 2002-08-11 Martin Baulig Added control flow analysis support for structs. * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve with control flow analysis turned off. (IVariable): New interface. (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess returns an IMemberExpr, call DoResolve/DoResolveLValue on it. (FieldExpr.DoResolve): Resolve the instance expression with flow analysis turned off and do the definite assignment check after the resolving when we know what the expression will resolve to. * expression.cs (LocalVariableReference, ParameterReference): Implement the new IVariable interface, only call the flow analysis code if ec.DoFlowAnalysis is true. (This): Added constructor which takes a Block argument. Implement the new IVariable interface. (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call DoResolve/DoResolveLValue on the result of ResolveMemberLookup(). This does the definite assignment checks for struct members. * class.cs (Constructor.Emit): If this is a non-static `struct' constructor which doesn't have any initializer, call Block.AddThisVariable() to tell the flow analysis code that all struct elements must be initialized before control returns from the constructor. * statement.cs (MyStructInfo): New public class. (UsageVector.this [VariableInfo vi]): Added `int field_idx' argument to this indexer. If non-zero, check an individual struct member, not the whole struct. (FlowBranching.CheckOutParameters): Check struct members. (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added overloaded versions of these methods which take an additional `int field_idx' argument to check struct members. (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added overloaded versions of these methods which take an additional `string field_name' argument to check struct member.s (VariableInfo): Implement the IVariable interface. (VariableInfo.StructInfo): New public property. Returns the MyStructInfo instance of the variable if it's a struct or null. (Block.AddThisVariable): New public method. This is called from Constructor.Emit() for non-static `struct' constructor which do not have any initializer. It creates a special variable for the "this" instance variable which will be checked by the flow analysis code to ensure that all of the struct's fields are initialized before control returns from the constructor. (UsageVector): Added support for struct members. If a variable/parameter is a struct with N members, we reserve a slot in the usage vector for each member. A struct is considered fully initialized if either the struct itself (slot 0) or all its members are initialized. 2002-08-08 Martin Baulig * driver.cs (Driver.MainDriver): Only report an error CS5001 if there were no compilation errors. * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's `UnsafeContext' property to determine whether the parent is in unsafe context rather than checking the parent's ModFlags: classes nested in an unsafe class are unsafe as well. 2002-08-08 Martin Baulig * statement.cs (UsageVector.MergeChildren): Distinguish between `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if we return. Added test17() and test18() to test-154.cs. 2002-08-08 Martin Baulig * typemanager.cs (TypeManager.FilterWithClosure): If we have Family access, make sure the invoking type isn't a subclass of the queried type (that'd be a CS1540). * ecore.cs (Expression.MemberLookup): Added overloaded version of this method which takes an additional `Type invocation_type'. * expression.cs (BaseAccess.DoResolve): Use the base type as invocation and query type. (MemberAccess.DoResolve): If the lookup failed and we're about to report a CS0122, try a lookup with the ec.ContainerType - if this succeeds, we must report a CS1540. 2002-08-08 Martin Baulig * ecore.cs (IMemberExpr): Added `bool IsInstance' property. (MethodGroupExpr): Implement the IMemberExpr interface. * expression (MemberAccess.ResolveMemberAccess): No need to have any special code for MethodGroupExprs anymore, they're now IMemberExprs. 2002-08-08 Martin Baulig * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly, Family, FamANDAssem and FamORAssem permissions. (TypeManager.IsSubclassOrNestedChildOf): New public method. 2002-08-08 Martin Baulig * statement.cs (FlowBranchingType): Added LOOP_BLOCK. (UsageVector.MergeChildren): `break' breaks unless we're in a switch or loop block. Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro * driver.cs: implemented /resource option to embed managed resources. 2002-08-07 Martin Baulig * class.cs (FieldBase.Initializer): Renamed to `init' and made private. (FieldBase.HasFieldInitializer): New public property. (FieldBase.GetInitializerExpression): New public method. Resolves and returns the field initializer and makes sure it is only resolved once. (TypeContainer.EmitFieldInitializers): Call FieldBase.GetInitializerExpression to get the initializer, this ensures that it isn't resolved multiple times. * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells the resolving process (SimpleName/MemberLookup) that we're currently emitting a field initializer (which must not access any instance members, this is an error CS0236). * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext argument, if the `IsFieldInitializer' flag is set, we must report and error CS0236 and not an error CS0120. 2002-08-07 Martin Baulig * ecore.cs (IMemberExpr): New public interface. (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr. (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess if the expression is an IMemberExpr. * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left' to be null, implicitly default to `this' if we're non-static in this case. Simplified the code a lot by using the new IMemberExpr interface. Also fixed bug #28176 here. 2002-08-06 Martin Baulig * cs-parser.jay (SimpleLookup): Removed. We need to create ParameterReferences during semantic analysis so that we can do a type-only search when resolving Cast, TypeOf and SizeOf. (block): Pass the `current_local_parameters' to the Block's constructor. * class.cs (ConstructorInitializer): Added `Parameters parameters' argument to the constructor. (ConstructorInitializer.Resolve): Create a temporary implicit block with the parameters. * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter references here if we aren't doing a type-only search. * statement.cs (Block): Added constructor which takes a `Parameters parameters' argument. (Block.Parameters): New public property. * support.cs (InternalParameters.Parameters): Renamed `parameters' to `Parameters' and made it public readonly. 2002-08-06 Martin Baulig * ecore.cs (Expression.Warning): Made this public as well. * report.cs (Report.Debug): Print the contents of collections. 2002-08-06 Martin Baulig * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is used to tell Resolve() which kinds of expressions it may return. (Expression.Resolve): Added overloaded version of this method which takes a `ResolveFlags flags' argument. This can be used to tell Resolve() which kinds of expressions it may return. Reports a CS0118 on error. (Expression.ResolveWithSimpleName): Removed, use Resolve() with ResolveFlags.SimpleName. (Expression.Error118): Added overloaded version of this method which takes a `ResolveFlags flags' argument. It uses the flags to determine which kinds of expressions are allowed. * expression.cs (Argument.ResolveMethodGroup): New public method. Resolves an argument, but allows a MethodGroup to be returned. This is used when invoking a delegate. * TODO: Updated a bit. 2002-08-06 Gonzalo Paniagua Javier Fixed compilation with csc. * ecore.cs: Expression.Error made public. Is this correct? Should Warning be made public too? * expression.cs: use ea.Location instead of ea.loc. [FIXME: Filed as bug #28607: MCS must report these errors.] 2002-08-06 Martin Baulig * ecore.cs (Expression.loc): Moved the location here instead of duplicating it in all derived classes. (Expression.Location): New public property. (Expression.Error, Expression.Warning): Made them non-static and removed the location argument. (Expression.Warning): Added overloaded version which takes an `int level' argument. (Expression.Error118): Make this non-static and removed the expression and location arguments. (TypeExpr): Added location argument to the constructor. * expression.cs (StaticCallExpr): Added location argument to the constructor. (Indirection, PointerArithmetic): Likewise. (CheckedExpr, UnCheckedExpr): Likewise. (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise. (StringPtr): Likewise. 2002-08-05 Martin Baulig * expression.cs (BaseAccess.DoResolve): Actually report errors. * assign.cs (Assign.DoResolve): Check whether the source expression is a value or variable. * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally while resolving the corresponding blocks. * interface.cs (Interface.GetInterfaceTypeByName): Actually report an error, don't silently return null. * statement.cs (Block.AddVariable): Do the error reporting here and distinguish between CS0128 and CS0136. (Block.DoResolve): Report all unused labels (warning CS0164). (LabeledStatement): Pass the location to the constructor. (LabeledStatement.HasBeenReferenced): New property. (LabeledStatement.Resolve): Set it to true here. * statement.cs (Return.Emit): Return success even after reporting a type mismatch error (CS0126 or CS0127), this is what csc does and it avoids confusing the users with any consecutive errors. 2002-08-05 Martin Baulig * enum.cs (Enum.LookupEnumValue): Catch circular definitions. * const.cs (Const.LookupConstantValue): Catch circular definitions. * expression.cs (MemberAccess.DoResolve): Silently return if an error has already been reported. * ecore.cs (Expression.MemberLookupFinal): Silently return if an error has already been reported. 2002-08-05 Martin Baulig * statement.cs (UsageVector): Only initialize the `parameters' vector if we actually have any "out" parameters. 2002-08-05 Martin Baulig * expression.cs (Binary.ResolveOperator): When combining delegates, they must have the same type. 2002-08-05 Martin Baulig * typemanager.cs (TypeManager.GetArgumentTypes): Don't call PropertyInfo.GetIndexParameters() on dynamic types, this doesn't work with the ms runtime and we also don't need it: if we're a PropertyBuilder and not in the `indexer_arguments' hash, then we are a property and not an indexer. * class.cs (TypeContainer.AsAccessible): Use Type.IsArray, Type.IsPointer and Type.IsByRef instead of Type.HasElementType since the latter one doesn't work with the ms runtime. 2002-08-03 Martin Baulig Fixed bugs #27998 and #22735. * class.cs (Method.IsOperator): New public field. (Method.CheckBase): Report CS0111 if there's already a method with the same parameters in the current class. Report CS0508 when attempting to change the return type of an inherited method. (MethodData.Emit): Report CS0179 if a method doesn't have a body and it's not marked abstract or extern. (PropertyBase): New abstract base class for Property and Indexer. (PropertyBase.CheckBase): Moved here from Property and made it work for indexers. (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is the same so we can reuse it there. (Property, Indexer): Derive from PropertyBase. (MethodSignature.inheritable_property_signature_filter): New delegate to find properties and indexers. * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name' argument and improved error reporting. * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to EmptyReadOnlyParameters and made it a property. * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded version of this method which takes a `PropertyInfo indexer'. (TypeManager.RegisterIndexer): New method. * class.cs: Added myself as author of this file :-) 2002-08-03 Gonzalo Paniagua Javier * class.cs: fixed compilation on windoze. 2002-08-03 Martin Baulig * interface.cs (Interface.GetInterfaceBases): Check whether all base interfaces are at least as accessible than the current one. * class.cs (TypeContainer.GetClassBases): Check whether base types are at least as accessible than the current type. (TypeContainer.AsAccessible): Implemented and made non-static. (MemberBase.CheckParameters): Report errors if the accessibility checks fail. * delegate.cs (Delegate.Delegate): The default visibility is internal for top-level types and private for nested types. (Delegate.Define): Report errors if the accessibility checks fail. * enum.cs (Enum.Enum): The default visibility is internal for top-level types and private for nested types. (Enum.DefineType): Compute the correct visibility. * modifiers.cs (Modifiers.TypeAttr): Added a version of this function which takes a `bool is_toplevel' instead of a TypeContainer. * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a builtin type. 2002-08-02 Martin Baulig * expression.cs (LocalVariableReferenc): Added constructor which takes additional `VariableInfo vi' and `bool is_readonly' arguments. (LocalVariableReference.IsReadOnly): New property. (LocalVariableReference.DoResolveLValue): Report a CS1604 if the variable is readonly, use our own readonly flag to do this; you can use the new constructor to get a writable reference to a read-only variable. * cs-parser.jay (foreach_statement, using_statement): Get a writable reference to the local variable. 2002-08-01 Miguel de Icaza * rootcontext.cs (ResolveCore): Also include System.Exception * statement.cs (Block.Emit): Do not emit the dead-code warnings if we reach an EmptyStatement. (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception is also fine. * expression.cs (Binary.ResolveOperator): Check error result in two places. use brtrue/brfalse directly and avoid compares to null. 2002-08-02 Martin Baulig * class.cs (TypeContainer.Define): Define all nested interfaces here. Fixes bug #28407, added test-155.cs. 2002-08-01 Martin Baulig * class.cs (Event.EmitDefaultMethod): Make this work with static events. Fixes #28311, added verify-3.cs. 2002-08-01 Martin Baulig * statement.cs (ForeachHelperMethods): Added `enumerator_type' and `is_disposable' fields. (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and `hm.is_disposable' if we're using the collection pattern. (Foreach.EmitCollectionForeach): Use the correct type for the enumerator's local variable, only emit the try/finally block if necessary (fixes #27713). 2002-08-01 Martin Baulig * ecore.cs (Expression.report118): Renamed to Error118 and made it public static. * statement.cs (Throw.Resolve): Check whether the expression is of the correct type (CS0118) and whether the type derives from System.Exception (CS0155). (Catch.Resolve): New method. Do the type lookup here and check whether it derives from System.Exception (CS0155). (Catch.CatchType, Catch.IsGeneral): New public properties. * typemanager.cs (TypeManager.exception_type): Added. 2002-07-31 Miguel de Icaza * driver.cs: Updated About function. 2002-07-31 Martin Baulig Implemented Control Flow Analysis. * codegen.cs (EmitContext.DoFlowAnalysis): New public variable. (EmitContext.CurrentBranching): Added. (EmitContext.StartFlowBranching): Added. (EmitContext.EndFlowBranching): Added. (EmitContext.KillFlowBranching): Added. (EmitContext.IsVariableAssigned): Added. (EmitContext.SetVariableAssigned): Added. (EmitContext.IsParameterAssigned): Added. (EmitContext.SetParameterAssigned): Added. (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument. Added control flow analysis stuff here. * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf, resolve the expression as lvalue. (LocalVariableReference.DoResolve): Check whether the variable has already been assigned. (ParameterReference.DoResolveLValue): Override lvalue resolve to mark the parameter as assigned here. (ParameterReference.DoResolve): Check whether the parameter has already been assigned. (Argument.Resolve): If it's a `ref' or `out' argument, resolve the expression as lvalue. * statement.cs (FlowBranching): New class for the flow analysis code. (Goto): Resolve the label in Resolve, not in Emit; added flow analysis. (LabeledStatement.IsDefined): New public property. (LabeledStatement.AddUsageVector): New public method to tell flow analyis that the label may be reached via a forward jump. (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added flow analysis. (VariableInfo.Number): New public field. This is used by flow analysis to number all locals of a block. (Block.CountVariables): New public property. This is the number of local variables in this block (including the locals from all parent blocks). (Block.EmitMeta): Number all the variables. * statement.cs: Added flow analysis support to all classes. 2002-07-31 Martin Baulig * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined. To get debugging messages, compile mcs with /define:MCS_DEBUG and then use this argument. * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG". * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may use this to specify /define options. 2002-07-29 Martin Baulig * statement.cs (Fixed): Moved all code that does variable lookups and resolvings from Emit to Resolve. * statement.cs (For): Moved all code that does variable lookups and resolvings from Emit to Resolve. * statement.cs (Using): Moved all code that does variable lookups and resolvings from Emit to Resolve. 2002-07-29 Martin Baulig * attribute.cs (Attribute.Resolve): Explicitly catch a System.NullReferenceException when creating the CustromAttributeBuilder and report a different warning message. 2002-07-29 Martin Baulig * support.cs (ParameterData.ParameterName): Added method to get the name of a parameter. * typemanager.cs (TypeManager.IsValueType): New public method. 2002-07-29 Martin Baulig * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This is a flag which specifies that it's either ref or out. (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed the out parameter to `out Parameter.Modifier mod', also set the Parameter.Modifier.ISBYREF flag on it if it's either ref or out. * support.cs (InternalParameters.ParameterModifier): Distinguish between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the Parameter.Modifier.ISBYREF flag if it's either ref or out. * expression.cs (Argument.GetParameterModifier): Distinguish between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the Parameter.Modifier.ISBYREF flag if it's either ref or out. 2002-07-29 Martin Baulig * expression.cs (ParameterReference.ParameterReference): Added `Location loc' argument to the constructor. * cs-parser.jay: Pass location to ParameterReference. 2002-07-28 Miguel de Icaza * statement.cs (Try): Initialize the location. * cs-parser.jay: pass location to Try. * expression.cs (Unary.Reduce): Change the prototype to return whether a constant fold could be performed or not. The result is returned in an out parameters. In the case of Indirection and AddressOf, we want to perform the full tests. 2002-07-26 Miguel de Icaza * statement.cs (Statement.Emit): Flag dead code. 2002-07-27 Andrew Birkett * expression.cs (Unary.Reduce): Handle AddressOf and Indirection. 2002-07-27 Martin Baulig * class.cs (MethodData.Define): Put back call to TypeManager.AddMethod(), accidentally commented this out. * report.cs (Debug): New public method to print debugging information, this is `[Conditional ("DEBUG")]'. 2002-07-26 Martin Baulig * cs-parser.jay (CSharpParser): Added `Stack switch_stack'. (switch_statement): Push the current_block to the switch_stack and pop it again when we're done with the switch. (switch_section): The new block is a child of the current_block. Fixes bug #24007, added test-152.cs. 2002-07-27 Martin Baulig * expression.cs (Invocation.EmitArguments): When calling a varargs function with only its fixed arguments, we need to pass an empty array. 2002-07-27 Martin Baulig Mono 0.13 has been released. 2002-07-25 Miguel de Icaza * driver.cs: Rename --resource to --linkres, because that is what we do currently, we dont support --resource yet. * cs-tokenizer.cs: Fix test for reporting endif mismatches. 2002-07-25 Martin Baulig * class.cs (MethodData): New public class. This is a `method builder' class for a method or one accessor of a Property/Indexer/Event. (MethodData.GetMethodFlags): Moved here from MemberBase. (MethodData.ApplyAttributes): Likewise. (MethodData.ApplyObsoleteAttribute): Likewise. (MethodData.ApplyConditionalAttribute): Likewise. (MethodData.ApplyDllImportAttribute): Likewise. (MethodData.CheckAbstractAndExternal): Likewise. (MethodData.Define): Formerly knows as MemberBase.DefineMethod(). (MethodData.Emit): Formerly known as Method.Emit(). (MemberBase): Moved everything which was specific to a single accessor/method to MethodData. (Method): Create a new MethodData and call Define() and Emit() on it. (Property, Indexer, Event): Create a new MethodData objects for each accessor and call Define() and Emit() on them. 2002-07-25 Martin Baulig Made MethodCore derive from MemberBase to reuse the code from there. MemberBase now also checks for attributes. * class.cs (MethodCore): Derive from MemberBase, not MemberCore. (MemberBase.GetMethodFlags): Moved here from class Method and marked as virtual. (MemberBase.DefineAccessor): Renamed to DefineMethod(), added `CallingConventions cc' and `Attributes opt_attrs' arguments. (MemberBase.ApplyAttributes): New virtual method; applies the attributes to a method or accessor. (MemberBase.ApplyObsoleteAttribute): New protected virtual method. (MemberBase.ApplyConditionalAttribute): Likewise. (MemberBase.ApplyDllImportAttribute): Likewise. (MemberBase.CheckAbstractAndExternal): Likewise. (MethodCore.ParameterTypes): This is now a property instead of a method, it's initialized from DoDefineParameters(). (MethodCore.ParameterInfo): Removed the set accessor. (MethodCore.DoDefineParameters): New protected virtual method to initialize ParameterTypes and ParameterInfo. (Method.GetReturnType): We can now simply return the MemberType. (Method.GetMethodFlags): Override the MemberBase version and add the conditional flags. (Method.CheckBase): Moved some code from Define() here, call DoDefineParameters() here. (Method.Define): Use DoDefine() and DefineMethod() from MemberBase here to avoid some larger code duplication. (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to ensure that abstract and external accessors don't declare a body. * attribute.cs (Attribute.GetValidPieces): Make this actually work: `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive lookup in the attribute's parent classes, so we need to abort as soon as we found the first match. (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if the attribute has no arguments. * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead of a Method. 2002-07-24 Gonzalo Paniagua Javier * cs-parser.jay: reverted previous patch. 2002-07-24 Gonzalo Paniagua Javier * cs-parser.jay: fixed bug #22119. 2002-07-24 Gonzalo Paniagua Javier * attribute.cs: fixed compilation. The error was: "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must be assigned to before control leaves the current method." [FIXME: Filed as bug #28186: MCS must report this error.] 2002-07-25 Martin Baulig * attribute.cs (Attribute.Conditional_GetConditionName): New static method to pull the condition name ouf of a Conditional attribute. (Attribute.Obsolete_GetObsoleteMessage): New static method to pull the obsolete message and error flag out of an Obsolete attribute. * class.cs (Method.GetMethodFlags): New public method to get the TypeManager.MethodFlags for this method. (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New private methods. (Method.Define): Get and apply the Obsolete and Conditional attributes; if we're overriding a virtual function, set the new private variable `parent_method'; call the new TypeManager.AddMethod(). * typemanager.cs (TypeManager.AddMethod): New static method. Stores the MethodBuilder and the Method in a PtrHashtable. (TypeManager.builder_to_method): Added for this purpose. (TypeManager.MethodFlags): Added IsObsoleteError. (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup Obsolete and Conditional arguments in MethodBuilders. If we discover an Obsolete attribute, emit an appropriate warning 618 / error 619 with the message from the attribute. 2002-07-24 Martin Baulig * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in preprocessor directives, ensure that the argument to #define/#undef is exactly one identifier and that it's actually an identifier. Some weeks ago I did a `#define DEBUG 1' myself and wondered why this did not work .... 2002-07-24 Martin Baulig * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type', initialize it to TypeManager.object_type in the constructor. (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type of the `hm.get_current' method if we're using the collection pattern. (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type for the explicit conversion to make it work when we're using the collection pattern and the `Current' property has a different return type than `object'. Fixes #27713. 2002-07-24 Martin Baulig * delegate.cs (Delegate.VerifyMethod): Simply return null if the method does not match, but don't report any errors. This method is called in order for all methods in a MethodGroupExpr until a matching method is found, so we don't want to bail out if the first method doesn't match. (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr matches, report the 123. Fixes #28070. 2002-07-24 Martin Baulig * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the TypeManager.TypeToCoreType() to the top of the method so the following equality checks will work. Fixes #28107. 2002-07-24 Martin Baulig * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either operand is of type uint, and the other operand is of type sbyte, short or int, the operands are converted to type long." - Actually do what this comment already told us. Fixes bug #28106, added test-150.cs. 2002-07-24 Martin Baulig * class.cs (MethodBase): New abstract class. This is now a base class for Property, Indexer and Event to avoid some code duplication in their Define() and DefineMethods() methods. (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual generic methods for Define() and DefineMethods(). (FieldBase): Derive from MemberBase, not MemberCore. (Property): Derive from MemberBase, not MemberCore. (Property.DefineMethod): Moved all the code from this method to the new MethodBase.DefineAccessor(), just call it with appropriate argumetnts. (Property.Define): Call the new Property.DoDefine(), this does some sanity checks and we don't need to duplicate the code everywhere. (Event): Derive from MemberBase, not MemberCore. (Event.Define): Use the new MethodBase.DefineAccessor() to define the accessors, this will also make them work with interface events. (Indexer): Derive from MemberBase, not MemberCore. (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead. (Indexer.Define): Use the new MethodBase functions. * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc' argument to the constructor. (Interface.FindMembers): Added support for interface events. (Interface.PopluateEvent): Implemented. Added test-149.cs for this. This also fixes bugs #26067 and #24256. 2002-07-22 Miguel de Icaza * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid, but this is required to check for a method name being the same as the containing class. Handle this now. 2002-07-22 Gonzalo Paniagua Javier * interface.cs: initialize variable. 2002-07-23 Martin Baulig Implemented the IndexerName attribute in interfaces. * class.cs (TypeContainer.DefineIndexers): Don't set the indexer name if this is an explicit interface implementation. (Indexer.InterfaceIndexerName): New public variable. If we're implementing an interface indexer, this is the IndexerName in that interface. Otherwise, it's the IndexerName. (Indexer.DefineMethod): If we're implementing interface indexer, set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer and Pending.ImplementIndexer methods. (Indexer.Define): Also define the PropertyBuilder if we're implementing an interface indexer and this is neither an explicit interface implementation nor do the IndexerName match the one in the interface. * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'. If a method is defined here, then we always need to create a proxy for it. This is used when implementing interface indexers. (Pending.IsInterfaceIndexer): New public method. (Pending.ImplementIndexer): New public method. (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument. This is used when implementing interface indexers to define a proxy if necessary. (Pending.VerifyPendingMethods): Look in the `need_proxy' array and define a proxy if necessary. * interface.cs (Interface.IndexerName): New public variable. (Interface.PopulateIndexer): Set the IndexerName. (Interface.DefineIndexers): New private method. Populate all the indexers and make sure their IndexerNames match. * typemanager.cs (IndexerPropertyName): Added support for interface indexers. 2002-07-22 Martin Baulig * codegen.cs (EmitContext.HasReturnLabel): New public variable. (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a ret if HasReturnLabel. (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public variables. * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save and set the ec.LoopBeginTryCatchLevel. (Try.Emit): Increment the ec.TryCatchLevel while emitting the block. (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than the current ec.TryCatchLevel, the branch goes out of an exception block. In this case, we need to use Leave and not Br. 2002-07-22 Martin Baulig * statement.cs (Try.Emit): Emit an explicit ret after the end of the block unless the block does not always return or it is contained in another try { ... } catch { ... } block. Fixes bug #26506. Added verify-1.cs to the test suite. 2002-07-22 Martin Baulig * statement.cs (Switch.TableSwitchEmit): If we don't have a default, then we do not always return. Fixes bug #24985. 2002-07-22 Martin Baulig * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction() lookup on a per-class level; ie. walk up the class hierarchy until we found at least one applicable method, then choose the best among them. Fixes bug #24463 and test-29.cs. 2002-07-22 Martin Baulig * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the return types of the methods. The return type is not part of the signature and we must not check it to make the `new' modifier work. Fixes bug #27999, also added test-147.cs. (TypeManager.TypeToCoreType): Added TypeManager.type_type. * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType() on the method's return type. 2002-07-21 Martin Baulig * assign.cs: Make this work if the rightmost source is a constant and we need to do an implicit type conversion. Also adding a few more tests to test-38.cs which should have caught this. * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe target in the makefile for this. The makefile.gnu is primarily intended for end-users who don't want to debug the compiler. 2002-07-21 Martin Baulig * assign.cs: Improved the Assign class so it can now handle embedded assignments (X = Y = Z = something). As a side-effect this'll now also consume less local variables. test-38.cs now passes with MCS, added a few new test cases to that test. 2002-07-20 Martin Baulig * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch instructions. Fixes bug #27977, also added test-146.cs. 2002-07-19 Gonzalo Paniagua Javier * cs-tokenizer.cs: fixed getHex (). 2002-07-19 Martin Baulig * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(), not Type.GetType() to lookup the array type. This is needed when we're constructing an array of a user-defined type. (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for single-dimensional arrays, but also for single-dimensial arrays of type decimal. 2002-07-19 Martin Baulig * expression.cs (New.DoEmit): Create a new LocalTemporary each time this function is called, it's not allowed to share LocalBuilders among ILGenerators. 2002-07-19 Martin Baulig * expression.cs (Argument.Resolve): Report an error 118 when trying to pass a type as argument. 2002-07-18 Martin Baulig * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a Conv_R_Un for the signed `long' type. 2002-07-15 Miguel de Icaza * expression.cs (MemberAccess.DoResolve): Do not reuse the field `expr' for the temporary result, as that will fail if we do multiple resolves on the same expression. 2002-07-05 Miguel de Icaza * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of ec.TypeContainer for looking up aliases. * class.cs (TypeContainer): Remove LookupAlias from here. * decl.cs (DeclSpace); Move here. 2002-07-01 Miguel de Icaza * class.cs (FindMembers): Only call filter if the constructor bulider is not null. Also handle delegates in `NestedTypes' now. Now we will perform type lookups using the standard resolution process. This also fixes a bug. * decl.cs (DeclSpace.ResolveType): New type resolution routine. This uses Expressions (the limited kind that can be parsed by the tree) instead of strings. * expression.cs (ComposedCast.ToString): Implement, used to flag errors since now we have to render expressions. (ArrayCreation): Kill FormElementType. Use ComposedCasts in FormArrayType. * ecore.cs (SimpleName.ToString): ditto. * cs-parser.jay: Instead of using strings to assemble types, use Expressions to assemble the type (using SimpleName, ComposedCast, MemberAccess). This should fix the type lookups in declarations, because we were using a different code path for this. * statement.cs (Block.Resolve): Continue processing statements even when there is an error. 2002-07-17 Miguel de Icaza * class.cs (Event.Define): Also remove the `remove' method from the list of pending items. * expression.cs (ParameterReference): Use ldarg.N (0..3) to generate more compact code. 2002-07-17 Martin Baulig * const.cs (Const.LookupConstantValue): Add support for constant `unchecked' and `checked' expressions. Also adding test case test-140.cs for this. 2002-07-17 Martin Baulig * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib, check whether mi.ReturnType implements the IEnumerator interface; the `==' and the IsAssignableFrom() will fail in this situation. 2002-07-16 Ravi Pratap * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix here too. 2002-07-16 Gonzalo Paniagua Javier * expression.cs: fixed bug #27811. 2002-07-14 Miguel de Icaza * expression.cs (ParameterReference.AddressOf): Patch from Paolo Molaro: when we are a ref, the value already contains a pointer value, do not take the address of it. 2002-07-14 Rafael Teixeira * removed mb-parser.jay and mb-tokenizer.cs Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro * expression.cs: check against the building corlib void type. Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro * ecore.cs: fix for valuetype static readonly fields: when initializing them, we need their address, not the address of a copy. Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro * typemanager.cs: register also enum_type in corlib. Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro * class.cs: allow calling this (but not base) initializers in structs. Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro * ecore.cs: make sure we compare against the building base types in GetTypeSize (). Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro * typemanager.cs: fix TypeToCoreType() to handle void and object (corlib gets no more typerefs after this change). 2002-07-12 Miguel de Icaza * expression.cs (ArrayCreation.EmitArrayArguments): use Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed. (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as array indexes, the runtime actually forbids them. * ecore.cs (ExpressionToArrayArgument): Move the conversion code for array arguments here. * expression.cs (EmitLoadOpcode): System.Char is a U2, use that instead of the default for ValueTypes. (New.DoEmit): Use IsValueType instead of IsSubclassOf (value_type) (New.DoResolve): ditto. (Invocation.EmitCall): ditto. * assign.cs (Assign): ditto. * statement.cs (Unsafe): Ok, so I got the semantics wrong. Statements *are* currently doing part of their resolution during Emit. Expressions do always resolve during resolve, but statements are only required to propagate resolution to their children. 2002-07-11 Miguel de Icaza * driver.cs (CSCParseOption): Finish the /r: and /lib: support. (LoadAssembly): Do not add the dll if it is already specified (MainDriver): Add the System directory to the link path at the end, after all the other -L arguments. * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the wrong opcode for loading bytes and bools (ldelem.i1 instead of ldelem.u1) and using the opposite for sbytes. This fixes Digger, and we can finally run it. * driver.cs (UnixParseOption): Move the option parsing here. (CSCParseOption): Implement CSC-like parsing of options. We now support both modes of operation, the old Unix way, and the new CSC-like way. This should help those who wanted to make cross platform makefiles. The only thing broken is that /r:, /reference: and /lib: are not implemented, because I want to make those have the same semantics as the CSC compiler has, and kill once and for all the confussion around this. Will be doing this tomorrow. * statement.cs (Unsafe.Resolve): The state is checked during resolve, not emit, so we have to set the flags for IsUnsfe here. 2002-07-10 Miguel de Icaza * expression.cs (MemberAccess.ResolveMemberAccess): Since we can not catch the Error_ObjectRefRequired in SimpleName (as it is possible to have a class/instance variable name that later gets deambiguated), we have to check this here. 2002-07-10 Ravi Pratap * class.cs (TypeContainer.GetFieldFromEvent): Move away from here, make static and put into Expression. (Event.Define): Register the private field of the event with the TypeManager so that GetFieldFromEvent can get at it. (TypeManager.RegisterPrivateFieldOfEvent): Implement to keep track of the private field associated with an event which has no accessors. (TypeManager.GetPrivateFieldOfEvent): Implement to get at the private field. * ecore.cs (GetFieldFromEvent): RE-write to use the above methods. 2002-07-10 Miguel de Icaza * expression.cs (Binary.EmitBranchable): this routine emits the Binary expression in a branchable context. This basically means: we need to branch somewhere, not just get the value on the stack. This works together with Statement.EmitBoolExpression. * statement.cs (Statement.EmitBoolExpression): Use EmitBranchable. 2002-07-09 Miguel de Icaza * statement.cs (For): Reduce the number of jumps in loops. (For): Implement loop inversion for the For statement. (Break): We can be breaking out of a Try/Catch controlled section (foreach might have an implicit try/catch clause), so we need to use Leave instead of Br. * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented now). If the instace expression supports IMemoryLocation, we use the AddressOf method from the IMemoryLocation to extract the address instead of emitting the instance. This showed up with `This', as we were emitting the instance always (Emit) instead of the Address of This. Particularly interesting when This is a value type, as we dont want the Emit effect (which was to load the object). 2002-07-08 Miguel de Icaza * attribute.cs: Pass the entry point to the DefinePInvokeMethod * statement.cs (Checked): Set the CheckedState during the resolve process too, as the ConvCast operations track the checked state on the resolve process, and not emit. * cs-parser.jay (namespace_member_declaration): Flag that we have found a declaration when we do. This is used to flag error 1529 * driver.cs: Report ok when we display the help only. 2002-07-06 Andrew Birkett * cs-tokenizer.cs (xtoken): Improve handling of string literals. 2002-07-04 Miguel de Icaza * cs-tokenizer.cs (define): We also have to track locally the defines. AllDefines is just used for the Conditional Attribute, but we also need the local defines for the current source code. 2002-07-03 Miguel de Icaza * statement.cs (While, For, Do): These loops can exit through a Break statement, use this information to tell whether the statement is the last piece of code. (Break): Flag that we break. * codegen.cs (EmitContexts): New `Breaks' state variable. 2002-07-03 Martin Baulig * class.cs (TypeContainer.MethodModifiersValid): Allow override modifiers in method declarations in structs. Otherwise, you won't be able to override things like Object.Equals(). 2002-07-02 Miguel de Icaza * class.cs (Method, Property, Indexer): Do not allow the public modifier to be used in explicit interface implementations. (TypeContainer.MethodModifiersValid): Catch virtual, abstract and override modifiers in method declarations in structs 2002-07-02 Andrew Birkett * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on integer or real overflow, report an error 2002-07-02 Martin Baulig * typemanager.cs (TypeManager.InitCoreTypes): When compiling corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders() to tell the runtime about our newly created System.Object and System.ValueType types. 2002-07-02 Miguel de Icaza * expression.cs (This): Use Stobj/Ldobj when we are a member of a struct instead of Ldarg/Starg. 2002-07-02 Martin Baulig * expression.cs (Indirection.Indirection): Call TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'. 2002-07-02 Martin Baulig * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a ValueType, call TypeManager.TypeToCoreType() on it. (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on the OpCodes.Newarr argument. 2002-07-02 Martin Baulig * expression.cs (Invocation.EmitCall): When compiling corlib, replace all calls to the system's System.Array type to calls to the newly created one. * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more System.Array methods. (TypeManager.InitCoreTypes): When compiling corlib, get the methods from the system's System.Array type which must be replaced. Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro * typemanager.cs: load unverifiable_code_ctor so we can build corlib using the correct type. Avoid using GetTypeCode() with TypeBuilders. * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and TypeManager.object_type to allow building corlib. Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro * ecore.cs: handle System.Enum separately in LoadFromPtr(). 2002-07-01 Martin Baulig * class.cs: Make the last change actually work, we need to check whether `ifaces != null' to avoid a crash. Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro * class.cs: when we build structs without fields that implement interfaces, we need to add the interfaces separately, since there is no API to both set the size and add the interfaces at type creation time. Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro * expression.cs: the dimension arguments to the array constructors need to be converted if they are a long. Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro * class.cs: don't emit ldarg.0 if there is no parent constructor (fixes showstopper for corlib). 2002-06-29 Martin Baulig MCS now compiles corlib on GNU/Linux :-) * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method, ie. check for MethodImplOptions.InternalCall. * class.cs (TypeContainer.DefineType): When compiling corlib, both parent and TypeManager.attribute_type are null, so we must explicitly check whether parent is not null to find out whether it's an attribute type. (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder and SetBuilder, not only if the property is neither abstract nor external. This is necessary to set the MethodImplOptions on the accessor methods. (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and SetBuilder, see Property.Emit(). * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't populate "System.Object", "System.ValueType" and "System.Attribute" since they've already been populated from BootCorlib_PopulateCoreTypes(). 2002-06-29 Martin Baulig * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr is the NullLiteral, we also need to make sure that target_type is not an enum type. 2002-06-29 Martin Baulig * rootcontext.cs (RootContext.ResolveCore): We must initialize `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type' before calling BootstrapCorlib_ResolveDelegate (). 2002-06-27 Gonzalo Paniagua Javier * statement.cs: fixed build-breaker. All tests passed ok. 2002-06-27 Martin Baulig * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check for System.Decimal when compiling corlib. 2002-06-27 Martin Baulig * statement.cs (Switch.TableSwitchEmit): Make this work with empty switch blocks which contain nothing but a default clause. 2002-06-26 Andrew * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks. 2002-06-27 Martin Baulig * ecore.cs (PropertyExpr.PropertyExpr): Call TypeManager.TypeToCoreType() on the `pi.PropertyType'. * typemanager.cs (TypeManager.TypeToCoreType): Return if the type is already a TypeBuilder. 2002-06-27 Martin Baulig * ecore.cs (Expression.ImplicitReferenceConversionExists): Use `target_type == TypeManager.array_type', not IsAssignableFrom() in the "from an array-type to System.Array" case. This makes it work when compiling corlib. 2002-06-27 Martin Baulig * ecore.cs (Expression.SimpleNameResolve): If the expression is a non-static PropertyExpr, set its InstanceExpression. This makes the `ICollection.Count' property work in System/Array.cs. 2002-06-25 Andrew Birkett * driver.cs: Made error handling more consistent. Errors now tracked by Report class, so many methods which used to return int now return void. Main() now prints success/failure and errors/warnings message. Renamed '--probe' compiler argument to '--expect-error'. Removed the magic number return values (123 and 124). Now, if the expected error occurs, the compiler exits with success (exit value 0). If the compilation completes without seeing that particular error, the compiler exits with failure (exit value 1). The makefile in mcs/errors has been changed to handle the new behaviour. * report.cs: Made 'expected error' number a property and renamed it from 'Probe' to 'ExpectedError'. * genericparser.cs: Removed error handling support, since it is now all done by Report class. * cs-parser.jay, mb-parser.jay: Errors are tracked by Report class, so parse() no longer returns an int. * namespace.cs: Use Report.Error instead of GenericParser.error 2002-06-22 Miguel de Icaza * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer, TypeContainer.AddOperator): At the front of the list put the explicit implementations, so they get resolved/defined first. 2002-06-21 Miguel de Icaza * class.cs (TypeContainer.VerifyImplements): Verifies that a given interface type is implemented by this TypeContainer. Used during explicit interface implementation. (Property.Define, Indexer.Define, Method.Define): Validate that the given interface in the explicit implementation is one of the base classes for the containing type. Also if we are explicitly implementing an interface, but there is no match in the pending implementation table, report an error. (Property.Define): Only define the property if we are not explicitly implementing a property from an interface. Use the correct name also for those properties (the same CSC uses, although that is really not needed). (Property.Emit): Do not emit attributes for explicitly implemented properties, as there is no TypeBuilder. (Indexer.Emit): ditto. Hiding then means that we do not really *implement* a pending implementation, which makes code fail. 2002-06-22 Martin Baulig * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on the return value of Object.GetType(). [FIXME: we need to do this whenever we get a type back from the reflection library]. Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces. 2002-06-20 Miguel de Icaza * attribute.cs: Return null if we can not look up the type. * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on the interface types found. * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the interface types found. * typemanager.cs (GetInterfaces): Make this routine returns alll the interfaces and work around the lame differences between System.Type and System.Reflection.Emit.TypeBuilder in the results result for GetInterfaces. (ExpandInterfaces): Given an array of interface types, expand and eliminate repeated ocurrences of an interface. This expands in context like: IA; IB : IA; IC : IA, IB; the interface "IC" to be IA, IB, IC. 2002-06-21 Martin Baulig * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function on System.Enum. 2002-06-21 Martin Baulig * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib and called with one of the core types, return the corresponding typebuilder for that type. * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the element type. 2002-06-21 Martin Baulig * ecore.cs (Expression.ExplicitReferenceConversionExists): Use `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'. (Expression.ConvertReferenceExplicit): Likewise. * expression.cs (ElementAccess.DoResolve): Likewise. (ElementAccess.DoResolveLValue): Likewise. 2002-06-10 Martin Baulig * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to add the "value" parameter to the parameter list. * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit() to our caller. 2002-06-19 Miguel de Icaza * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert the argument to an int, uint, long or ulong, per the spec. Also catch negative constants in array creation. Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro * class.cs: do not allow the same interface to appear twice in the definition list. Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro * ecore.cs: don't use ldlen with System.Array. Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro * ecore.cs: stobj requires a type argument. Handle indirect stores on enums. Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro * modifiers.cs: produce correct field attributes for protected internal. Easy fix so miguel can work on ther harder stuff:-) 2002-06-18 Miguel de Icaza * pending.cs: New file. Move the code from class.cs here. Support clearning the pending flag for all methods (when not doing explicit interface implementation). Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro * rootcontext.cs: added a couple more types needed to bootstrap. 2002-06-17 Miguel de Icaza * typemanager.cs (GetConstructor): Use DeclaredOnly to look the constructor in the type, instead of any constructor in the type hierarchy. Thanks to Paolo for finding this bug (it showed up as a bug in the Mono runtime when applying the params attribute). 2002-06-16 Rafael Teixeira * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)" 2002-06-14 Rachel Hestilow * expression.cs (Unary.ResolveOperator): Use TypeManager to resolve the type. 2002-06-13 Ravi Pratap * cs-parser.jay (enum_member_declaration): Pass in the attributes attached. * enum.cs (AddEnumMember): Add support to store the attributes associated with each member too. * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle field builders too - this takes care of the enum member case. 2002-06-10 Rachel Hestilow * typemanager.cs (TypeManager.VerifyUnManaged): Allow address-of operator on both value types and pointers. 2002-06-10 Martin Baulig * interface.cs (Interface.PopulateIndexer): Add the indexer's PropertyBuilder to the `property_builders' list. * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method. (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't find any indexers which are inherited from an interface. 2002-06-09 Martin Baulig * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of the same type as the constant if necessary. There's also a test-130.cs for this. * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public. * typemanager.cs (TypeManager.ChangeType): Previously known as Enum.ChangeEnumType(). 2002-06-09 Martin Baulig * expression.cs (Cast.TryReduce): Added support for consts. 2002-06-08 Ravi Pratap * class.cs (Accessor): Hold attributes information so we can pass it along. * cs-parser.jay (get_accessor_declaration, set_accessor_declaration): Modify to pass in attributes attached to the methods. (add_accessor_declaration, remove_accessor_declaration): Ditto. * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly to handle the Accessor kind :-) * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors 2002-06-08 Martin Baulig * expression.cs (Unary.TryReduceNegative): Added support for ULongConstants. 2002-06-08 Martin Baulig * enum.cs (Enum.LookupEnumValue): Don't report an error if the name can't be found in the `defined_names' - the caller will do a MemberLookup in this case and thus find methods in System.Enum such as Enum.IsDefined(). 2002-06-08 Martin Baulig * enum.cs (Enum.ChangeEnumType): This is a custom version of Convert.ChangeType() which works with TypeBuilder created types. (Enum.LookupEnumValue, Enum.Define): Use it here. * class.cs (TypeContainer.RegisterRequiredImplementations): Added `TypeBuilder.BaseType != null' check. (TypeContainer.FindMembers): Only lookup parent members if we actually have a parent. (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check. (ConstructorInitializer.Resolve): Likewise. * interface.cs (Interface.FindMembers): Added `TypeBuilder.BaseType != null' check. * rootcontext.cs (RootContext.ResolveCore): Added "System.Runtime.CompilerServices.IndexerNameAttribute" to classes_second_stage. * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize debug_type and trace_type when compiling with --nostdlib. 2002-06-07 Martin Baulig * class.cs (TypeContainer): Added `have_nonstatic_fields' field. (AddField): Set it to true when adding a non-static field. (DefineType): Use `have_nonstatic_fields' to find out whether we have non-static fields, not `Fields != null'. 2002-06-02 Miguel de Icaza * ecore.cs (SimpleNameResolve): Removed simple bug (we were dereferencing a null on the static-field code path) 2002-05-30 Martin Baulig * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument to take command line arguments. Use reflection to call the new custom `Initialize' function on the symbol writer and pass it the command line arguments. * driver.cs (--debug-args): New command line argument to pass command line arguments to the symbol writer. 2002-05-28 Miguel de Icaza * assign.cs (DoResolve): Forgot to do the implicit conversion to the target type for indexers and properties. Thanks to Joe for catching this. 2002-05-27 Miguel de Icaza * typemanager.cs (MethodFlags): returns the method flags (Obsolete/ShouldIgnore) that control warning emission and whether the invocation should be made, or ignored. * expression.cs (Invocation.Emit): Remove previous hack, we should not do this on matching a base type, we should do this based on an attribute Only emit calls to System.Diagnostics.Debug and System.Diagnostics.Trace if the TRACE and DEBUG defines are passed on the command line. * rootcontext.cs: Global settings for tracing and debugging. * cs-tokenizer.cs (define): New utility function to track defines. Set the global settings for TRACE and DEBUG if found. 2002-05-25 Ravi Pratap * interface.cs (Populate*): Pass in the TypeContainer as well as the DeclSpace as parameters so that we can create EmitContexts and then use that to apply attributes etc. (PopulateMethod, PopulateEvent, PopulateProperty) (PopulateIndexer): Apply attributes everywhere. * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent etc. (ApplyAttributes): Update accordingly. We now apply interface attributes for all members too. 2002-05-26 Miguel de Icaza * class.cs (Indexer.Define); Correctly check if we are explicit implementation (instead of checking the Name for a ".", we directly look up if the InterfaceType was specified). Delay the creation of the PropertyBuilder. Only create the PropertyBuilder if we are not an explicit interface implementation. This means that explicit interface implementation members do not participate in regular function lookups, and hence fixes another major ambiguity problem in overload resolution (that was the visible effect). (DefineMethod): Return whether we are doing an interface implementation. * typemanager.cs: Temporary hack until we get attributes in interfaces (Ravi is working on that) and we get IndexerName support in interfaces. * interface.cs: Register the indexers as properties. * attribute.cs (Attribute.Resolve): Catch the error, and emit a warning, I have verified that this is a bug in the .NET runtime (JavaScript suffers of the same problem). * typemanager.cs (MemberLookup): When looking up members for interfaces, the parent of an interface is the implicit System.Object (so we succeed in searches of Object methods in an interface method invocation. Example: IEnumerable x; x.ToString ()) 2002-05-25 Miguel de Icaza * class.cs (Event): Events should also register if they do implement the methods that an interface requires. * typemanager.cs (MemberLookup); use the new GetInterfaces method. (GetInterfaces): The code used to lookup interfaces for a type is used in more than one place, factor it here. * driver.cs: Track the errors at the bottom of the file, we kept on going. * delegate.cs (NewDelegate.Emit): We have to emit a null as the instance if the method we are calling is static! 2002-05-24 Miguel de Icaza * attribute.cs (ApplyAttributes): Make this function filter out the IndexerName attribute (as that attribute in reality is never applied) and return the string constant for the IndexerName attribute. * class.cs (TypeContainer.Emit): Validate that all the indexers have the same IndexerName attribute, and if so, set the DefaultName attribute on the class. * typemanager.cs: The return value might contain other stuff (not only methods). For instance, consider a method with an "Item" property and an Item method. * class.cs: If there is a problem with the parameter types, return. 2002-05-24 Ravi Pratap * ecore.cs (ImplicitConversionExists): Wrapper function which also looks at user defined conversion after making a call to StandardConversionExists - we need this for overload resolution. * expression.cs : Update accordingly the various method calls. This fixes 2 bugs filed against implicit user defined conversions 2002-05-22 Miguel de Icaza * statement.cs: Track the result of the assignment. 2002-05-21 Miguel de Icaza * expression.cs (MemberAccess): Improved error reporting for inaccessible members. 2002-05-22 Martin Baulig * makefile (mcs-mono2.exe): New target. This is mcs compiled with itself with debugging support. 2002-05-22 Martin Baulig * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"): Removed, this isn't needed anymore. 2002-05-20 Martin Baulig * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't be underlying type for an enum. 2002-05-20 Miguel de Icaza * typemanager.cs (InitEnumUnderlyingTypes): New helper function that splits out the loading of just the core types. * rootcontext.cs (ResolveCore): Split the struct resolution in two, so we can load the enumeration underlying types before any enums are used. * expression.cs (Is): Bandaid until we fix properly Switch (see bug #24985 for details). * typemanager.cs (ImplementsInterface): The hashtable will contain a null if there are no interfaces implemented. 2002-05-18 Miguel de Icaza * cs-parser.jay (indexer_declarator): It is fine to have array parameters 2002-05-17 Miguel de Icaza * typemanager.cs: (RegisterBuilder): New function used to register TypeBuilders that implement interfaces. Since TypeBuilder.GetInterfaces (as usual) does not work with lame Reflection.Emit. (AddUserType): register interfaces. (ImplementsInterface): Use the builder_to_ifaces hash if we are dealing with TypeBuilder. Also, arrays are showing up as SymbolTypes, which are not TypeBuilders, but whose GetInterfaces methods can not be invoked on them! * ecore.cs (ExplicitReferenceConversionExists): Made public. (ImplicitReferenceConversionExists): Split out from StandardConversionExists. * expression.cs (As): We were only implementing one of the three cases for the as operator. We now implement them all. (Is): Implement the various other cases for Is as well. * typemanager.cs (CACHE): New define used to control if we want or not the FindMembers cache. Seems to have a negative impact on performance currently (MemberLookup): Nested types have full acess to enclosing type members Remove code that coped with instance/static returns for events, we now catch this in RealFindMembers. (RealFindMembers): only perform static lookup if the instance lookup did not return a type or an event. 2002-05-17 Miguel de Icaza * assign.cs (CompoundAssign): We pass more semantic information now to Compound Assignments than we did before: now we have all the information at hand, and now we resolve the target *before* we do the expression expansion, which allows the "CacheValue" method to have the effect we intended (before, a [x] += 1 would generate two differen ArrayAccess expressions from the ElementAccess, during the resolution process). (CompoundAssign.DoResolve): Resolve target and original_source here. 2002-05-16 Miguel de Icaza * expression.cs (ArrayAccess): dropped debugging information. * typemanager.cs: Small bug fix: I was always returning i_members, instead of one of i_members or s_members (depending on which had the content). * assign.cs (IAssignMethod.CacheTemporaries): New method. This method is invoked before any code generation takes place, and it is a mechanism to inform that the expression will be invoked more than once, and that the method should use temporary values to avoid having side effects (Assign.Emit): Call CacheTemporaries in the IAssignMethod. * ecore.cs (Expression.CacheTemporaries): Provide empty default implementation. * expression.cs (Indirection, ArrayAccess): Add support for CacheTemporaries in these two bad boys. * ecore.cs (LoadFromPtr): figure out on our own if we need to use ldobj or ldind_ref. (StoreFromPtr): Handle stobj as well. * expression.cs (UnaryMutator): Share more code. * typemanager.cs (FindMembers): Thanks to Paolo for tracking this down: I was not tracking the Filter function as well, which was affecting the results of the cache. 2002-05-15 Miguel de Icaza * attribute.cs: Remove the hack to handle the CharSet property on StructLayouts. 2002-05-14 Miguel de Icaza * attribute.cs (DoResolve): More uglyness, we now only try to resolve the attribute partially, to extract the CharSet information (only if we are a StructLayout attribute). Otherwise (GetExtraTypeInfo): Add some code to conditionally kill in the future this. I am more and more convinced that the .NET framework has special code to handle the attribute setting on certain elements. * expression.cs (IsParamsMethodApplicable): Revert my previous foreach change here, it was wrong. 2002-05-13 Miguel de Icaza * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end. (pp_expr): do not abort on unknown input, just return. (eval): abort if there are pending chars. * attribute.cs (Attribute.Resolve): Positional parameters are optional. Deal with that case. * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch the Ansi/Unicode/Auto information for the type. (TypeContainer.DefineType): instantiate the EmitContext here, as we will be using it during the type definition (to resolve attributes) and during the emit phase. * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used to pull type information out of the attributes (Attribute.Resolve): track the constructor builder, and allow for multiple invocations (structs and classes will use this). * ecore.cs (MemberLookupFinal): new version with all the parameters customizable. * expression.cs (New.DoResolve): Use MemberLookupFinal to locate constructors. Return if the result value is null (as the error would have been flagged already by MemberLookupFinal) Do not allow instances of abstract classes or interfaces to be created. * class.cs: (MethodSignature.InheritableMemberSignatureCompare): We have to compare the assembly property here when dealing with FamANDAssem and Assembly access modifiers, because we might be creating an assembly from *modules* (that means that we are not getting TypeBuilders for types defined in other modules that are part of this assembly). (Method.Emit): If the method is marked abstract and has a body, emit an error. (TypeContainer.DefineMembers): If both the defined member and the parent name match are methods, then do not emit any warnings: let the Method.Define routine take care of flagging warnings. But if there is a mismatch (method overrides something else, or method is overriwritten by something, then emit warning). (MethodSignature.MemberSignatureCompare): If the sig.ret_type is set to null, this means `do not check for the return type on the signature'. (Method.Define): set the return type for the method signature to null, so that we get methods with the same name and parameters and different return types. This is used to flag warning 114 (you are hiding a method, and you probably want to use the new/override keywords instead). * typemanager.cs (MemberLookup): Implemented proper access control, closing a long standing set of bug reports. The problem was that the Framework only has two bits: Public and NonPublic, and NonPublic includes private and protected methods, but we need to enforce the FamANDAssem, FamOrAssem and Family. 2002-05-11 Miguel de Icaza * statement.cs (GotoCase): Return true: Ammounts to giving up knowledge on whether we return or not, and letting the other case be responsible for it. 2002-05-10 Miguel de Icaza * driver.cs: Do not load directories for each file processed, only do it if there is a pattern. * ecore.cs: Report readonly assigns here as well, as we might have been resolved only by MemberAccess. (SimpleName.SimpleNameResolve): Also be useful for LValue resolution. We need this to propagate assign to local readonly variables * typemanager.cs: Use a ptrhashtable for the criteria, because we do not want to reuse potential criteria memory. * class.cs (MyEventBuilder): Set reflected_type; * ecore.cs (Constantify): Added support for constifying bools. (RootContext.LookupType): Added a cache for values looked up in the declaration space. * typemanager.cs (FindMembers): Now is a front-end to RealFindMembers, and provides a two-level hashtable-based cache to the request. 15% performance improvement: from 22.5 to 19.2 seconds. * expression.cs (IsParamsMethodApplicable): use foreach. (Invocation.DoResolve): ditto. (New.DoResolve): ditto. (ArrayCreation.DoResolve): ditto. * ecore.cs (FindMostEncompassingType): use foreach. * delegate.cs (NewDelegate.DoResolve): Use foreach * ecore.cs (Expression.FindMostSpecificSource): Use foreach. (RemoveMethods): use foreach. * expression.cs (Invocation.MakeUnionSet): Optimization: Use two nested foreach statements instead of for, and also break out of the inner loop once a match is found. (Invocation.OverloadResolve): Use foreach, simplify the code. 2002-05-08 Miguel de Icaza * cfold.cs (BinaryFold): During an enumeration evaluation context, we actually unwrap the expression to allow for extra information to be extracted. * expression.cs: Use Shr_Un on unsigned operations. 2002-05-08 Ravi Pratap * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of applicable operators was not being considered correctly. This closes the bug Miguel reported. Wed May 8 16:40:50 CEST 2002 Paolo Molaro * attribute.cs: check that the type derives from System.Attribute and report the correct error in that case (moved the duplicate code to its own method, too). Wed May 8 11:50:31 CEST 2002 Paolo Molaro * attribute.cs: lookup attribute type name as the spec says: first the bare attribute name and then name + "Attribute" (nant compiles with mcs after this fix). 2002-05-07 Miguel de Icaza * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky! Because of the way we parse things, we should try to see if a UIntConstant can fit in an integer. 2002-05-07 Ravi Pratap * ecore.cs (GetConversionOperators): Do not pick up op_True operators when we are in an explicit context. (ConvertReferenceExplicit): When converting from Iface type S to Class T make sure the rules are implemented as an OR. * parameter.cs (ParameterType): Make it a property for now although the purpose really isn't anything immediate. * expression.cs (Is*Applicable): Do better checking on the parameter type of a ref/out parameter. The ones from the system assemblies are already marked with the correct type so we don't need to do any correction. * ecore.cs (StandardConversionExists): Conversion from Interface types to the object type is standard too so include that. 2002-05-06 Miguel de Icaza * ecore.cs (StandardConversionExists): Augment with missing code: deal with IntConstant, LongConstants and Enumerations. * assign.cs: Report the error, instead of failing silently * rootcontext.cs (AddGlobalAttributes): Track attributes on the typecontainer that they are declared, because the typecontainer/namespace will have the list of using clauses that need to be applied. Assembly Attributes were escaping the normal registration mechanism. (EmitCode): Apply attributes within an EmitContext that represents the container they were declared on. * cs-parser.jay: Track bases for structs. How did I get this wrong? 2002-05-06 Ravi Pratap * ecore.cs (FindMostEncompassingType, FindMostEncompassedType): Revamp completely - make much cleaner as we now operate only on a set of Types. (FindMostSpecificSource, FindMostSpecificTarget): New methods to implement the logic detailed in the spec more correctly. (UserDefinedConversion): Update accordingly. 2002-05-06 Miguel de Icaza * statement.cs: Return flow analysis information up. * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE and the default. (token): Do not consume an extra character before calling decimal_digits. 2002-05-06 Piers Haken * cs-parser.jay: add 'override' attribute to System.Object.Finalize 2002-05-06 Miguel de Icaza * class.cs (Constructor.Emit): Set the IsStatic flag in the EmitContext during the instance constructor initializer resolution, to stop access to instance variables. This is mandated by the spec, last paragraph of the `constructor initializers' section. 2002-05-05 Miguel de Icaza * cs-parser.jay, class.cs (Accessor): new class used to represent an accessor (get or set). In the past we used `null' to represent a missing accessor. But this is ambiguous because there was no way to tell in abstract indexers/properties if one of them was specified. Now there is a way of addressing that. * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup instead of FindMembers. * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast the result of Assign.Resolve as Assign, but rather as ExpressionStatement. * attribute.cs: Treat indexers and properties as the same in terms of applying attributes * ecore.cs (FindMostEncompassedType): Use statically initialized EmptyExpressions()s like we do elsewhere to avoid creating useless objects (and we take this out of the tight loop). (GetConversionOperators): Move the code to extract the actual operators to a separate routine to clean things up. 2002-05-04 Miguel de Icaza * ecore.cs (FieldExpr): Remove un-needed tests for null, since now events are always registered FieldBuilders. * class.cs (FieldBase): New class shared by Fields * delegate.cs: If we are a toplevel delegate, use our full name. If we are a nested delegate, then only use our tail name. 2002-05-02 Ravi Pratap * expression.cs (IsApplicable): Ensure that we add the "&" to ref/out types before comparing it with the type of the argument. (IsParamsMethodApplicable): Ditto. (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - silly me ;-) * delegate.cs : Handle the case when we have more than one applicable method. Flag an error only when we finish checking all. 2002-05-02 Miguel de Icaza * expression.cs: Add support for boolean static initializers. 2002-05-01 Miguel de Icaza * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder. * parameter.cs (ComputeParameterTypes, ComputeAndDefineParameterTypes): Better error handling: now we clear the `types' cache if we fail during any of the type lookups. We also return the status code correctly to our caller * delegate.cs: If we fail to define a delegate, abort the extra steps. * expression.cs (Binary.ResolveOperator): for operator==(object,object) and operator !=(object, object) we also have to verify that there is an implicit conversion from one to the other. (ArrayAccess.DoResolve): Array Access can operate on non-variables. 2002-04-30 Miguel de Icaza * assign.cs (CompoundAssign): A new class used as a "flag" that the assignment actually is happening as part of a compound assignment operator. During compound assignment, a few new rules exist to enable things like: byte b |= 1 + 2 From the spec: x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast to the type of x) if y is implicitly convertible to the type of x, and the operator is a builtin operator and the return type of the operator is explicitly convertible to the type of x. * rootcontext.cs: Reset warning level to 2. 4 catches various "interesting" features in mcs, we must clean this up at some point, but currently am trying to kill other bugs ;-) * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups in container classes as well. * expression.cs (Binary.ResolveOperator): Handle string case before anything else (as operator overloading does emit an error before doing anything else). This code could go away when we move to a table driven model, but i could not come up with a good plan last night. 2002-04-30 Lawrence Pit * typemanager.cs (CSharpName): reimplementation using regex. * class.cs: added null check for fields in Emit * rootcontext.cs: set warninglevel to 4 2002-04-29 Miguel de Icaza * typemanager.cs (CSharpName): reimplemented with Lupus suggestion. 2002-04-28 Miguel de Icaza * statement.cs (If): correclty implement Resolve, because we were not catching sem errors in there. The same process is needed everywhere else. (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve (Statement.Warning_DeadCodeFound): Factorize code. (While): Report dead code here too. (Statement): Added Resolve virtual method to allow for resolution split from the emit code. 2002-04-26 Miguel de Icaza * statement.cs (EmitBoolExpression): No longer try to resolve the expression here. (MakeBoolean): New utility function that resolve, implicitly converts to boolean and tags the expression. (If, Do): Implement dead code elimination. (While): Implement loop inversion (Do, While, For, If): Resolve the expression prior to calling our code generation. 2002-04-22 Lawrence Pit * class.cs: - added method Report28 (warning: program has more than one entry point) - added method IsEntryPoint, implements paragraph 10.1 of the spec - modified method Method.Define, the part at the end of the method * rootcontext.cs: added static public Location EntryPointLocation; * ../errors/cs0028.cs : Add test case for the above warning. * typemanager.cs: - modified method CSharpName to allow arrays of primitive type to be printed nicely (e.g. instead of System.Int32[][] it now prints int[][]) - added method CSharpSignature: returns the signature of a method in string format to be used in reporting errors, warnings, etc. * support.cs: InternalParameters.ParameterDesc variable tmp initialized with String.Empty. 2002-04-26 Ravi Pratap * delegate.cs (Define): Fix extremely silly bug where I was setting the type of the 'object' parameter of the BeginInvoke method to System.IAsyncResult instead of System.Object ;-) 2002-04-26 Miguel de Icaza * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly here. (Constructor.Emit): return if we fail to initialize the constructor. Another door closed! * expression.cs (New.DoResolve): Improve error message (from -6 to 1501). Use DeclaredOnly lookup to find the exact constructor. * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not loop. This is useful. * cs-parser.jay: Adjust the default parameters so that destructors have the proper signature. 2002-04-26 Martin Baulig * driver.cs (LoadAssembly): If `assembly' contains any characters which are only valid in path names and not in assembly names (currently slash, backslash and point), use Assembly.LoadFrom () instead of Assembly.Load () on the `assembly' (before iteration over the link_paths). 2002-04-26 Martin Baulig * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars. 2002-04-25 Miguel de Icaza * class.cs (Property): use the new typemanager.MemberLookup (TypeContainer.MemberLookup): Implement using the TypeManager.MemberLookup now. * typemanager.cs: Make MemberLookup a function of the TypeManager, and return MemberInfos, so that these can be used without an EmitContext (what we had before). 2002-04-24 Miguel de Icaza * expression.cs: Fix the case where the argument to params if the type of the params. I omitted handling this before. Fixed 2002-04-22 Miguel de Icaza * driver.cs: Call BootCorlib_PopulateCoreType * class.cs (Property.CheckBase): Check for properties only, not for all members. * interface.cs: Temporary hack: try/catch around the CustomAttributeBuilder, because I am getting an exception that I do not understand. * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some types whose definitions are required to be there (attributes are defined before standard types). Compute definitions as we boot the various types, as they are used immediately (value_type class will need object_type, but if we do not initialize object_type, we will pass a null, which will let the runtime pick the System.Object from the existing corlib, which is not what we want). 2002-04-22 Patrik Torstensson * cs-tokenizer.cs: fixed a number of trim() issues. 2002-04-22 Ravi Pratap * expression.cs (Argument.Type): Ensure that we return the correct type when we have out or ref parameters [in which case we append a "&"]. 2002-04-22 Miguel de Icaza * class.cs (Property, Indexer): Allow extern modifier in there. * typemanager.cs (InitBaseTypes): Initializes object_type and value_type, since those will be used early on during the bootstrap process to compile corlib. (InitCoreTypes): Move code from here to InitBaseTypes. 2002-04-21 Miguel de Icaza * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on single-dimension arrays as using the ldlen opcode. Daniel Lewis discovered this optimization. * typemanager.cs: Add signature for System.Array::get_Length 2002-04-20 Gonzalo Paniagua Javier * statement.cs: report the error when the foreach does not apply to an array nor a collection. 2002-04-19 Miguel de Icaza * expression.cs: Add implicit conversions to the operator ~. * constant.cs (DecimalConstant.Emit): Emit decimal value. * typemanager.cs: Locate the decimal constructor. 2002-04-17 Gonzalo Paniagua Javier * attribute.cs: use the new property of TypeOf. * expression.cs: added 'get' property around typearg. These changes fix a build breaker reported by NickD. Is this the correct way to fix? If not, please, revert my changes and make it work :-). 2002-04-17 Miguel de Icaza * attribute.cs: Add support for typeof in attribute invocations. I am not sure that this is right though. 2002-04-14 Duncan Mak * cfold.cs (BinaryFold): Catch DivideByZeroException in the Binary.Operator.Division case. 2002-04-13 Ravi Pratap * class.cs (DefineType): Ensure that we do a proper check on attribute types and also register it with the TypeManager. (TypeContainer.Targets): The default for attribute types is AttributeTargets.All. * attribute.cs (ApplyAttributes): Registering the attribute type is done elsewhere, not when we discover we have a Usage attribute. 2002-04-12 Ravi Pratap * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion and get rid of is_delegate parameter. * everywhere : update. 2002-04-12 Ravi Pratap * cs-parser.jay (compilation_unit): Revamp completely to use some new ideas that I got from Rhys' grammar to solve the problems with assembly level attributes. (outer_declaration): New grammar production. (attribute_sections): Add. (opt_attributes): Base on attribute_sections (namespace_declaration): Allow opt_attributes to tackle the case when we have assembly level attributes - we are clever in this regard now ;-) * attribute.cs (ApplyAttributes): Do not worry about assembly attributes in the non-global context. * rootcontext.cs (AddGlobalAttributes): Go back to using this instead of SetGlobalAttributes. * class.cs, rootcontext.cs : Ensure we define and generate attribute types before anything else. * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception and flag the new error -20 for the case when the attribute type does not have valid targets specified. csc does not catch this. * ../errors/errors.txt : update for error # -20 2002-04-11 Ravi Pratap * support.cs (InternalParameters.ParameterModifier): Do some null checking and return sane values. * class.cs (Method.Define): If we are a PInvoke method, ensure that we are static and extern. Report error # 601 * ../errors/cs0601.cs : Add test case for the above error. 2002-04-07 Ravi Pratap * rootcontext.cs (attribute_types): We need to keep type of all attribute types separately and emit code for them first. (RegisterAttribute) : Implement. * class.cs (DefineType): Check if the current Type is a custom attribute type and register it accordingly. * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were adding the first attribute twice and rename to (SetGlobalAttributes): this. * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform lookups. * attribute.cs (ApplyAttributes): Take an additional argument telling us if we are processing global arguments. Hmm, I am unsure of this. 2002-04-12 Gonzalo Paniagua Javier * expression.cs: added static array of strings to avoid calling Enum.ToString () for Operator in Binary. Significant recover of performance. 2002-04-10 Miguel de Icaza * class.cs (FindMembers): Allow the Builders of the various members to be null. If they are skip them. This only happens during the PInvoke declaration. 2002-04-09 Miguel de Icaza * parameter.cs (Parameters.ComputeParameterTypes): Flag the failure, so we do not keep going afterwards. * expression.cs: (Invocation.OverloadResolve): I believe Ravi wanted to pass `false' as the `is_delegate' argument. If this is the case, why not use delegate_type == null to mean `is_delegate = false' and anything else as is_delegate = true. Tue Apr 9 05:40:12 2002 Piers Haken * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the code for the section, not the beginning of the tests. 2002-04-08 Miguel de Icaza * cfold.cs: Handle operator + (Enum x, Underlying x) * expression.cs (Binary): same. Warn about errors where we have Enum/Enum in operator + as well. Mon Apr 8 06:29:03 2002 Piers Haken * statement.cs: - added support for switch(bool) - optimize loading of I8/U8 constants (ldc.i4, iconv_i8) - add TableSwitchEmit() to handle table-based switch statements 2002-04-05 Ravi Pratap * expression.cs (Invocation.OverloadResolve): Factor out code which does parameter compatibility checking with arguments so that we can re-use the code even from Delegate.VerifyApplicability (VerifyArgumentsCompat): Move above code here. * delegate.cs (VerifyApplicability): Get rid of duplicate code and instead make a call to the above method. 2002-03-31 Ravi Pratap * typemanager.cs (attribute_type): Corresponds to System.Attribute. We use it to keep track of classes which are attribute types. 2002-04-02 Miguel de Icaza * delegate.cs (Delegate.Define): Correctly define the types in the presence of fixed and array parameters. * class.cs (TypeContainers.FindMembers): Use NonPublic flag while doing FindMembers. * ecore.cs (Expression.MemberLookup): Reset binding flags to not include NonPublic after the first iteration. * class.cs (Indexer.CheckBase): Only check if both parents are non-null. * cs-parser.jay (accessor_body): If empty, set to null. * ecore.cs (SimpleName.SimpleNameResolve): We did not have the same code path here to resolve constants names that we did have in MemberAccess.DoResolve. There is too much code duplicated here. 2002-04-01 Miguel de Icaza * statement.cs, makefile: Drop Statementcollection and just use ArrayLists * ecore.cs: Optimize UserDefinedConversion by minimizing the calls to MakeUnionSet. * cs-tokenizer.cs: Reuse a single StringBuilder for assembling tokens, numbers and strings. * ecore.cs (MethodGroupExpr): Make Emit warn about missing parenthesis. * delegate.cs: Use ComputeAndDefineParameterTypes for both the asyncronous parameters and the regular parameters. * codegen.cs (CodeGen.Init): Use the constructor that allows us to specify the target directory. * expression.cs: (This.DoResolve): Simplify (As.Emit): Optimize, do not generate IsInst if the expression is always of the given type. (Is.DoResolve): Bug fix, we were reporting both always/never for the is expression. * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were creating too many unnecessary arrays. 2002-03-31 Miguel de Icaza * class.cs (EmitFieldInitializer): Use Assign expression to assign fields instead of rolling our own initializer. Takes care of all implicit conversions, and drops unnecessary static checks/argument. 2002-03-31 Dick Porter * driver.cs: use the GetDirectories() return values properly, and use "/" as path separator. 2002-03-30 Miguel de Icaza * expression.cs (Unary): Optimize - - expr into expr. (Binary): Optimize a + (-b) into a -b. * codegen.cs (CodeGen): Made all methods static. 2002-03-29 Miguel de Icaza * rootcontext.cs: * decl.cs: Rename `definition' into `TypeBuilder' and drop the TypeBuilder property. * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl instead. * tree.cs: Removed the various RecordXXXX, and replaced with a single RecordDecl. Removed all the accessor methods, and just left a single access point Type * enum.cs: Rename DefineEnum to DefineType. * decl.cs: New abstract method `DefineType' used to unify the Defines for Enumerations, Interfaces, TypeContainers and Delegates. (FindType): Moved LookupInterfaceOrClass here. Moved the LookupBaseClasses method that used to live in class.cs and interface.cs here, and renamed to FindType. * delegate.cs: Implement DefineType. Take advantage of the refactored pattern for locating the parent builder without taking the parent_builder argument (which we know does not work if we are nested, and triggering a toplevel definition). 2002-03-28 Miguel de Icaza * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the accessibility of a member has changed during override and report an error if so. * class.cs (Method.Define, Property.Define): Only complain on overrides if the method is private, any other accessibility is fine (and since we just checked the permission is the same, we are good to go). * cs-tokenizer.cs: only line, region, endregion, if, endif, else and elif are processed always. The other pre-processing directives are only processed if we are "taking" the path 2002-03-29 Martin Baulig * class.cs (Method.Emit): Only emit symbolic debugging info if the current location is not Null. * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into a separate method so we can profile it. * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since `span.Seconds' are just seconds, but no minutes or hours. (MainDriver): Profile the CodeGen.SaveSymbols calls. 2002-03-28 Miguel de Icaza * class.cs (Method.Define), (Property.Define), (Indexer.Define): Remove the gratuitous set of Final: // If an interface implementation, then we can set Final. if (((flags & MethodAttributes.Abstract) == 0) && implementing.DeclaringType.IsInterface) flags |= MethodAttributes.Final; I do not know what I was smoking when I used that. * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first step into fixing the name resolution issues for delegates and unifying the toplevel name resolution. 2002-03-28 Martin Baulig * class.cs (Method.Emit): If we have a symbol writer, call its OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to tell it about the current method. * codegen.cs (EmitContext.Mark): New public method. Tell the symbol writer that we're going to emit the first byte of IL code for a new statement (a new source line). (EmitContext.EmitTopBlock): If we have a symbol writer, call EmitContext.Mark() before emitting any code. * location.cs (SymbolDocument): Return null when we're Null. * statement.cs (Statement): Moved the `Location loc' variable here. (Statement.EmitBoolExpression): If we have a symbol writer, call ec.Mark() before emitting any code to tell it that we're at the beginning of a new statement. (StatementExpression): Added `Location' argument to the constructor. (Block): Added public readonly variable `StartLocation' and public variable `EndLocation'. The latter is to be set using SetEndLocation(). (Block): Added constructor which takes a start and end location. (Block.SetEndLocation): New method. This sets the end location. (Block.EmitMeta): If we have a symbol writer, tell it the names of the local variables we create. (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting each statement and do also mark the begin and end of the block. * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to tell it the current lexer.Location, use Location.Null for the end of the block. (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the current block, set its end location using SetEndLocation(). (statement_expression): StatementExpression constructor now takes the lexer.Location as additional argument. (for_statement, declare_local_variables): Likewise. (declare_local_variables): When creating a new implicit block, use the new Block constructor and pass it the lexer.Location. 2002-03-28 Miguel de Icaza * ecore.cs (Expression.MemberLookup): On interfaces, lookup members also on the parent interfaces recursively. 2002-03-27 Miguel de Icaza * report.cs: Use new formats, since Gonzalo finished the missing bits. * expression.cs (Binary.ResolveOperator): added missing operator| operator& and operator^ for bool/bool. * cs-parser.jay: CheckDef now takes a Location argument that is used to report errors more precisly (instead of reporting the end of a definition, we try to track something which is a lot closer to the source of the problem). * cs-tokenizer.cs: Track global token use, so we can properly flag the use of #define/#undef after the first token has been seen. Also, rename the reportXXXX to Error_DescriptiveName * decl.cs (DeclSpace.IsTopLevel): Move property here from TypeContainer, so that Enum and Interface can use this too. * class.cs (TypeContainer.LookupInterfaceOrClass, GetInterfaceOrClass, GetClassBases, DefineType): Drop the `builder' argument. Typically this was used to pass the parent builder (a ModuleBuilder or a TypeBuilder from whoever triggered the definition). The problem is that a nested class could trigger the definition of a toplevel class, and the builder would be obviously wrong in that case. So we drop this argument, and we compute dynamically the TypeBuilder/ModuleBuilder (the correct information was available to us anyways from DeclSpace.Parent) * interface.cs (Interface.DefineInterface): Drop builder parameter cleanup like class.cs * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up like class.cs * statement.cs (Switch.EmitObjectInteger): Emit short/ushort values. (Try.Emit): Propagate the returns value from the statement. (Return.Emit): Even if we are leavning * driver.cs: Catch IOExpcetion for Directory.GetFiles as well. * modifiers.cs: Fix the computation of MethodAttributes flags. Tue Mar 26 21:14:36 CET 2002 Paolo Molaro * driver.cs: allow compilation of files that start with '/'. Add a default case when checking the argument of --target. 2002-03-25 Miguel de Icaza * interface.cs: Implement the same search algorithm for types in the interface code. * delegate.cs: Do not allow multiple definition. * Recovered ChangeLog that got accidentally amputated * interface.cs (Interface.DefineInterface): Prevent from double definitions. * rootcontext.cs: Load manually enum to allow core classes to contain enumerations. * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs: Update to new static methods in TypeManager. * typemanager.cs (GetMethod, GetConstructor): Use our implementation of FindMembers to find the members, since during corlib compilation, the types are TypeBuilders and GetMethod and GetConstructor do not work. Make all methods in TypeManager static. (InitCodeHelpers): Split the functionality from the InitCodeTypes function. * driver.cs: Call InitCodeHelpers after we have populated the types. * cs-parser.jay (delegate_declaration): we did not used to compute the delegate name correctly for void delegates. 2002-03-24 Miguel de Icaza * rootcontext.cs (RootContext): Init the interface_resolve_order and type_container_resolve_order always. (ResolveCore, BootstrapCorlib_ResolveClass, BootstrapCorlib_ResolveStruct): New functions to bootstrap the compiler when compiling with --nostdlib * class.cs (TypeContainer.DefineType): Check that our parent is not null. This test is most important when we are bootstraping the core types. * codegen.cs: Split out the symbol writing code. 2002-03-25 Martin Baulig * driver.cs (-g): Made -g an alias for --debug. 2002-03-24 Martin Baulig * codegen.cs (SymbolWriter): New public variable. Returns the current symbol writer. (CodeGen): Added `bool want_debugging_support' argument to the constructor. If true, tell the ModuleBuild that we want debugging support and ask it for the ISymbolWriter. (Save): If we have a symbol writer, call it's Close() method after saving the assembly. * driver.c (--debug): New command line argument to create a debugger information file. * location.cs (SymbolDocument): New public property. Returns an ISymbolDocumentWriter object for the current source file or null if we don't have a symbol writer. 2002-03-21 Miguel de Icaza * driver.cs (LoadAssembly): Correctly return when all the paths have been tried and not before. * statement.cs (Switch.Emit): return the actual coverage for this statement (returns/not-returns) (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the switch of the statement if we are the last switch section. That kills two problems: try/catch problems (we used to emit an empty nop at the end) and switch statements where all branches would return. 2002-03-19 Miguel de Icaza * driver.cs: Add default assemblies (the equivalent to the Microsoft CSC.RSP file) * cs-tokenizer.cs: When updating `cols and setting it to zero, also update tokens_seen and set it to false. * driver.cs: Implement --recurse for Mike. * driver.cs (SplitPathAndPattern): Small bug fix, I was not correctly splitting out the paths. 2002-03-18 Miguel de Icaza * interface.cs (Interface.PopulateProperty): Instead of using `parent' as the declaration space for the set parameters, use `this' * support.cs (InternalParameters): InternalParameters constructor takes a DeclSpace instead of a TypeContainer. * expression.cs (ArrayCreation.EmitDynamicInitializers): If value types are being initialized, load the address of it before calling the function. (New): Provide a mechanism to disable the generation of local value type temporaries when the caller will be providing us with an address to store it. (ArrayCreation.EmitDynamicInitializers): Use it. 2002-03-17 Miguel de Icaza * expression.cs (Invocation.EmitArguments): Only probe for array property if there is more than one argument. Sorry about that. * class.cs (Invocation.EmitArguments): Fix to emit arguments for empty param arrays. * class.cs (Method.LabelParameters): Fix incorrect code path that prevented the `ParamArrayAttribute' from being applied to the params attribute. 2002-03-16 Miguel de Icaza * support.cs (ReflectionParameters): Correctly compute whether the last argument is a params array. Fixes the problem with string.Split ('a') * typemanager.cs: Make the assemblies array always be non-null (empty, but non-null) * tree.cs (RecordDecl): New function that abstracts the recording of names. This reports error 101, and provides a pointer to the previous declaration. Fixes a crash in the compiler. * cs-parser.jay (constructor_declaration): Update to new grammar, and provide a constructor_body that can be empty. 2002-03-15 Miguel de Icaza * driver.cs: Add support for --resources. * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign): Make all types for the various array helper methods be integer. * ecore.cs (Expression.ConvertNumericExplicit): Pass the CheckState to ConvCast. (ConvCast): Now it takes a `checked' state argument, to avoid depending on the emit context for the conversion, and just using the resolve time setting. * expression.cs (ArrayCreation.EmitArrayArguments): New function, instead of Invocation.EmitArguments. We do not emit the original arguments, instead we emit those which have been converted to unsigned int expressions. * statement.cs (Block.EmitMeta): Drop tracking of indexes. * codegen.cs: ditto. * expression.cs (LocalVariableReference): Drop the use of the Store function that depended on the variable index. * statement.cs (VariableInfo): Drop the `Idx' property from this class, as this is not taking into account the indexes for temporaries tat we generate during the execution, getting the indexes wrong. * class.cs: First emit class initializers, then call the parent constructor. * expression.cs (Binary): Fix opcode emision. (UnaryMutator.EmitCode): Support checked code generation * ecore.cs (MemberLookup): TypeManager.FindMembers will return matches for events for both the Static and Instance scans, pointing to the same element. Fix that. 2002-03-14 Miguel de Icaza * rootcontext.cs (ResolveTree): Always set the interface_resolve_order, because nested interfaces will be calling into us. * class.cs (GetInterfaceOrClass): Track the same resolution process used by TypeManager.LookupType. This fixes the nested type lookups in class declarations (separate path from LookupType). (TypeContainer.DefineType): Also define nested interfaces. (TypeContainer.RegisterOrder): New public function used to register the order in which child interfaces need to be closed. Nested interfaces need to be closed after their parents have been created. * interface.cs (InterfaceAttr): Put all the logic for computing the interface attribute here. (DefineInterface): Register our interface order with the RootContext or with the TypeContainer depending on the case. 2002-03-12 Miguel de Icaza * cs-parser.jay: rework foreach statement to work with the new changes to the policy on SimpleNames. * report.cs: support Stacktrace on warnings as well. * makefile: drop --unsafe and /unsafe from the compile. 2002-03-13 Ravi Pratap * ecore.cs (StandardConversionExists): Modify to take an Expression as the first parameter. Ensure we do null -> reference type conversion checking. * Everywhere : update calls accordingly, making use of MyEmptyExpr to store temporary Expression objects. Wed Mar 13 12:32:40 CET 2002 Paolo Molaro * interface.cs: workaround bug in method overloading resolution (there is already a bugzilla bug for it). 2002-03-12 Miguel de Icaza We could also solve this problem by having a separate path for performing type lookups, instead of DoResolve, we could have a ResolveType entry point, and only participating pieces of the production (simplename, deref, array) would implement this. * codegen.cs (EmitContext): New field OnlyLookupTypes used to signal SimpleName to only resolve type names and not attempt to resolve anything else. * expression.cs (Cast): Set the flag. * ecore.cs (SimpleName): Use the OnlyLookupTypes flag * class.cs: Only report 108 if there is no `new' modifier. * cs-parser.jay: rework foreach statement to work with the new changes to the policy on SimpleNames. * report.cs: support Stacktrace on warnings as well. * makefile: drop --unsafe and /unsafe from the compile. 2002-03-11 Miguel de Icaza * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable lookups here, instead of doing that at parse time. This means that our grammar will not introduce `LocalVariableReferences' as expressions at this point. That solves the problem of code like this: class X { static void Main () { int X = 1; { X x = null }}} This is only half the fix. The full fix requires parameters to also be handled in this way. * Everywhere: Use ec.DeclSpace on calls to LookupType, as this makes the use more obvious of the DeclSpace. The ec.TypeContainer.TypeBuilder is now only used to pull the TypeBuilder for it. My theory is that I can get rid of the TypeBuilder completely from the EmitContext, and have typecasts where it is used (from DeclSpace to where it matters). The only pending problem is that the code that implements Aliases is on TypeContainer, and probably should go in DeclSpace. * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable lookups here, instead of doing that at parse time. This means that our grammar will not introduce `LocalVariableReferences' as expressions at this point. That solves the problem of code like this: class X { static void Main () { int X = 1; { X x = null }}} This is only half the fix. The full fix requires parameters to also be handled in this way. * class.cs (Property.DefineMethod): When implementing an interface method, set newslot, when implementing an abstract method, do not set the flag (before we tried never setting it, or always setting it, which is the difference). (Indexer.DefineMethod): same. (Method.DefineMethod): same. * ecore.cs: Only set the status used flag if we get back a Field. * attribute.cs: Temporary hack, so Paolo can keep working. 2002-03-08 Ravi Pratap * attribute.cs (Attribute.UnmanagedType): This is to keep track of the unmanaged type in the case we have a MarshalAs attribute. (Resolve): Handle the case when we are parsing the special MarshalAs attribute [we need to store the unmanaged type to use later] * typemanager.cs (marshal_as_attr_type): Built in type for the MarshalAs Attribute. * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute on parameters and accordingly set the marshalling info. 2002-03-09 Miguel de Icaza * class.cs: Optimizing slightly by removing redundant code after we switched to the `NoTypes' return value. (Property.DefineMethod): use NoTypes here too. This fixes the bug I introduced in my last batch of changes. 2002-03-05 Ravi Pratap * tree.cs (RecordEnum): Add. We now keep track of enums too. * class.cs (LookupInterfaceOrClass): Check against the list of recorded Enums since those are types too. * cs-parser.jay (enum_declaration): Record enums as we parse them. * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined thanks to a call during the lookup process. 2002-03-07 Miguel de Icaza * statement.cs (Foreach): Lots of work to accomodate a particular kind of foreach statement that I had not kept in mind. It is possible to have foreachs on classes that provide a GetEnumerator method that return objects that implement the "pattern" for using a foreach, there is no need to support GetEnumerator specifically. This is needed to compile nant. * decl.cs: Only report 114 if the member is not `Finalize' and if the warning level is at least 2. * class.cs: Moved the compare function from Method to MethodSignature. (MethodSignature.InheritableMemberSignatureCompare): Add new filter function that is used to extract inheritable methods from a class. (Method.Define): Use the new `inheritable_method_signature_filter' delegate * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the command. 2002-03-06 Miguel de Icaza * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code. * cs-parser.jay: Add opt_semicolon to the interface declaration. * expression.cs: Pass location information to ConvertImplicitStandard. * class.cs: Added debugging code to track return values from interfaces. 2002-03-05 Miguel de Icaza * expression.cs (Is.DoResolve): If either side of the `is' is an interface, do not flag the warning. * ecore.cs (ImplicitReferenceConversion): We need a separate test for interfaces * report.cs: Allow for --fatal to be used with --probe. * typemanager.cs (NoTypes): Move the definition for the empty Type array here. * class.cs (TypeContainer.FindMembers): Also look for methods defined by properties. (TypeContainer.DefineProxy): New function used to proxy to parent implementations when implementing interfaces. (TypeContainer.ParentImplements): used to lookup if our parent implements a public function that is required by an interface. (TypeContainer.VerifyPendingMethods): Hook this up. * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the `modules' and `assemblies' arraylists into arrays. We only grow these are the very early start up of the program, so this improves the speedof LookupType (nicely measured). * expression.cs (MakeByteBlob): Replaced unsafe code with BitConverter, as suggested by Paolo. * cfold.cs (ConstantFold.Binary): Special case: perform constant folding of string concatenation, but if either side is a string, and the other is not, then return null, and let the runtime use the concatenation on the string plus the object (using `Object.ToString'). 2002-03-04 Miguel de Icaza Constant Folding has been implemented now. * expression.cs (Unary.Reduce): Do not throw an exception, catch the error instead on types that are not supported in one's complement. * constant.cs (Constant and all children): New set of functions to perform implict and explicit conversions. * ecore.cs (EnumConstant): Implement the new functions to perform conversion by proxying to the child expression. * codegen.cs: (ConstantCheckState): Constant evaluation has its own separate setting that can not be turned off from the command line using --unchecked or --checked and is only controlled using the checked/unchecked statements and expressions. This setting is used by the constant folder to flag errors. * expression.cs (CheckedExpr, UncheckedExpr): Set the ConstantCheckState as well. During Resolve, they also have to flag the state, because the constant folder runs completely in the Resolve phase. * statement.cs (Checked, Unchecked): Set the ConstantCheckState as well. 2002-03-01 Miguel de Icaza * cfold.cs: New file, this file contains the constant folder. * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra argument to track whether we are using the resulting address to load or store a value and provide better error messages. (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use new AddressOf arguments. * statement.cs (Foreach.EmitCollectionForeach): Update * expression.cs (Argument.Emit): Call AddressOf with proper arguments to track usage. (New.DoEmit): Call AddressOf with new arguments. (Unary.Emit): Adjust AddressOf call. 2002-03-01 Ravi Pratap * cs-parser.jay (member_access): Change the case for pre-defined types to use a MemberAccess instead of a SimpleName. Thanks to Felix again for this suggestion. * class.cs (Operator::Emit): If we are abstract or extern, we don't have a method body. * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators essentially like methods and apply attributes like MethodImplOptions to them too. * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder not being null. * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer is the DeclSpace. * Update code everywhere accordingly. * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate. * cs-parser.jay (enum_declaration): Set the current namespace of the enum. 2002-02-28 Ravi Pratap * rootcontext.cs (LookupType): As we cycle through the chain of namespaces try performing lookups against those instead of jumping straight into using the 'using' clauses. (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea. (LookupType): Perform lookups in implicit parents too. * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup sequence as RootContext.LookupType. * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries the various cases of namespace lookups into this method. 2002-03-01 Miguel de Icaza * cs-parser.jay: Add support for [Attribute ()] (empty arguments in positional arguments) * class.cs (Operator): Update the AllowedModifiers to contain extern. * cs-parser.jay: Update operator declaration to allow for the operator body to be empty. * cs-tokenizer.cs: Added '\u' unicode support in strings and hex values. 2002-02-27 Miguel de Icaza * class.cs (Method.Emit): Label parameters. * driver.cs: Return 1 or 0 as the program exit code. 2002-02-26 Miguel de Icaza * expression.cs: Special case the `null' object when trying to auto-compute the type, as anything can be explicitly converted to that. * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for spotting this Paolo. (Expression.ImplicitNumericConversion): Perform comparissions of the type using the underlying type in the case of an enumeration rather than using the enumeration type for the compare. Cope with the underlying == type case, which is not possible to catch before. (Expression.ConvertNumericExplicit): Perform comparissions of the type using the underlying type in the case of an enumeration rather than using the enumeration type for the compare. * driver.cs: If the user does not supply an extension, assume .exe * cs-parser.jay (if_statement): Rewrote so that we can track the location for the if statement. * expression.cs (Binary.ConstantFold): Only concat strings when the operation is "+", not everything ;-) * statement.cs (Statement.EmitBoolExpression): Take a location argument. (If, While, Do): Track location. * expression.cs (Binary.ResolveOperator): In the object + string case, I was missing a call to ConvertImplicit 2002-02-25 Ravi Pratap * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and Location arguments. Ensure we use RootContext.LookupType to do our work and not try to do a direct Type.GetType and ModuleBuilder.GetType * interface.cs (PopulateMethod): Handle the type of the parameter being null gracefully. * expression.cs (Invocation.BetterFunction): Handle the case when we have a params method with no fixed arguments and a call is made with no arguments. 2002-02-25 Miguel de Icaza * cs-tokenizer.cs: Add support for the quote-escape-sequence in the verbatim-string-literal * support.cs (InternalParameters.ParameterModifier): handle null fixed parameters. (InternalParameters.ParameterType): ditto. * parameter.cs (VerifyArgs): Also check if the fixed parameter is duplicating the name of the variable parameter. (GetParameterByName): Fix bug where we were not looking up array paramters if they were the only present (thanks Paolo!). (GetParameterInfo): We only have an empty set of types if both fixed and array are set to null. (GetParameterInfo-idx): Handle FixedParameter == null * cs-parser.jay: Handle the case where there is no catch statements (missing null test). 2002-02-22 Miguel de Icaza * driver.cs (MainDriver): Be conservative on our command line handling. Catch DirectoryNotFoundException when calling GetFiles. (SplitPathAndPattern): Used to split the input specification into a path and a pattern that we can feed to Directory.GetFiles. 2002-02-21 Miguel de Icaza * statement.cs (Fixed): Implement the last case of the Fixed statement (string handling). * expression.cs (StringPtr): New class used to return a char * to a string; Used by the Fixed statement. * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method. * expression.cs (Binary.ResolveOperator): Remove redundant MemberLookup pn parent type. Optimize union call, we do not need a union if the types are the same. (Unary.ResolveOperator): REmove redundant MemberLookup on parent type. Specialize the use of MemberLookup everywhere, instead of using the default settings. (StackAlloc): Implement stackalloc keyword. * cs-parser.jay: Add rule to parse stackalloc. * driver.cs: Handle /h, /help, /? * expression.cs (MakeByteBlob): Removed the hacks we had in place before we supported unsafe code. * makefile: add --unsafe to the self compilation of mcs. 2002-02-20 Miguel de Icaza * expression.cs (PointerArithmetic): New class that is used to perform pointer arithmetic. (Binary.Resolve): Handle pointer arithmetic Handle pointer comparission. (ArrayPtr): Utility expression class that is used to take the address of an array. (ElementAccess): Implement array access for pointers * statement.cs (Fixed): Implement fixed statement for arrays, we are missing one more case before we are done. * expression.cs (Indirection): Implement EmitAssign and set the ExprClass to Variable. This allows pointer dereferences to be treated as variables, and to have values assigned to them. * ecore.cs (Expression.StoreFromPtr): New utility function to store values dereferencing. 2002-02-20 Ravi Pratap * expression.cs (Binary.ResolveOperator): Ensure that we are not trying to operate on a void type - this fixes the reported bug. * decl.cs (CheckMethodAgainstBase): Do not allow overriding if the parent implementation is sealed. * ../errors/cs0239.cs : Add. * attribute.cs (ApplyAttributes): Handle Modulebuilders too. * typemanager.cs (unverifiable_code_type): Corresponds to System.Security.UnverifiableCodeAttribute. We need to emit this for modules which have unsafe code in them. * rootcontext.cs (EmitCode): Emit the above attribute when we are in an unsafe context. 2002-02-19 Miguel de Icaza * cs-tokenizer.cs: Add support for @"litreal strings" Make tokenizer accept pre-processor directives on any column (remove the old C-like limitation). * rootcontext.cs (EmitCode): Emit any global attributes. (AddGlobalAttributes): Used to keep track of assembly attributes. * attribute.cs (ApplyAttributes): Support AssemblyAttributes. * cs-parser.jay: Add support for global attributes. 2002-02-17 Miguel de Icaza * expression.cs (Indirection): New helper class. Unary will create Indirection classes to be able to implement the IMemoryLocation interface on it. 2002-02-16 Miguel de Icaza * cs-parser.jay (fixed_statement): reference the right statement. * statement.cs (Fixed.Emit): Finish implementing the fixed statement for the &x case. 2002-02-14 Miguel de Icaza * class.cs (Property.Define, Method.Define): Remove newslot when `implementing'. * modifiers.cs: My use of NewSlot when `Abstract' was set was wrong. NewSlot should only be used if the `new' keyword is present. * driver.cs (GetSystemDir): Use CodeBase instead of FullName for locating our system dir. Sorry about this. 2002-02-13 Miguel de Icaza * driver.cs (GetSystemDir): Compute correctly the location of our system assemblies. I was using the compiler directory instead of the library directory. 2002-02-13 Ravi Pratap * expression.cs (BetterFunction): Put back in what Miguel commented out since it is the correct fix. The problem is elsewhere ;-) (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed parameters of the parms method are themselves compatible or not ! (StandardConversionExists): Fix very dangerous bug where we were forgetting to check that a class implements an interface before saying that an implicit conversion was allowed. Use ImplementsInterface to do the checking. 2002-02-13 Miguel de Icaza * class.cs (Method.Define): Track whether we are an explicit implementation or not. And only call DefineMethodOverride if we are an explicit implementation. (Property.DefineMethod): Ditto. 2002-02-11 Ravi Pratap * expression.cs (BetterFunction): Catch hideous bug which was preventing us from detecting ambiguous calls due to implicit casts i.e cs0121. 2002-01-29 Miguel de Icaza * support.cs (Pair): Remove un-needed method. I figured why I was getting the error in cs-parser.jay, the variable in a foreach loop is readonly, and the compiler does not really treat this as a variable. * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN instead of EQUALS in grammar. * typemanager.cs (VerifyUnmanaged): Report correct error (208) * expression.cs (Unary.DoResolve): Check whether the argument is managed or not. 2002-01-28 Miguel de Icaza * support.cs: Api for Pair to set a value. Despite the fact that the variables are public the MS C# compiler refuses to compile code that accesses the field if the variable is part of a foreach statement. * statement.cs (Fixed): Begin implementation of the fixed statement. (Block.AddVariable): Return the VariableInfo on success and null on failure instead of true/false. * cs-parser.jay (foreach): Catch errors on variables already defined (we were ignoring this value before) and properly unwind the block hierarchy (fixed_statement): grammar for the fixed statement. 2002-01-25 Miguel de Icaza * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also pointer types to be incretemented. (SizeOf): Implement. * cs-parser.jay (pointer_member_access): Implement expr->IDENTIFIER production. * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve, MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers on safe contexts. (Unary): Implement indirection. * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer use in non-unsafe context). (SimpleName.DoResolve): Check for pointers in field access on safe contexts. (Expression.LoadFromPtr): Factor the load-indirect code in this function. This was duplicated in UnboxCast and ParameterReference 2002-01-24 Miguel de Icaza * expression.cs (ComposedCast): report an error if a pointer cast is used in a safe region. * ecore.cs (Expression.ConvertExplicit): Add rules for implicit pointer type casts in unsafe context. * codegen.cs (EmitContext): Set up IsUnsafe. * cs-parser.jay (non_expression_type): Add productions for pointer casts. * expression.cs (Invocation.EmitCall): Remove chunk of buggy code. We should not use force into static mode if the method is not virtual. Fixes bug in MIS * statement.cs (Do.Emit, While.Emit, For.Emit, Statement.EmitBoolExpression): Add support to Do and While to propagate infinite loop as `I do return' semantics. Improve the For case to also test for boolean constants. * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder to the list of attributes we can add. Remove `EmitContext' argument. * class.cs (Method.Define): Apply parameter attributes. (Constructor.Define): Apply parameter attributes. (MethodCore.LabelParameters): Move here the core of labeling parameters. * support.cs (ReflectionParameters.ParameterModifier, InternalParameters.ParameterModifier): Use IsByRef on the type and only return the OUT bit for these parameters instead of in/out/ref flags. This is because I miss-understood things. The ParameterInfo.IsIn and IsOut represent whether the parameter has the [In] and [Out] attributes set. 2002-01-22 Miguel de Icaza * ecore.cs (FieldExpr.Emit): Release temporaries. * assign.cs (LocalTemporary.Release): new function. * codegen.cs (EmitContext.GetTemporaryStorage, EmitContext.FreeTemporaryStorage): Rework the way we deal with temporary storage. Now we can "put back" localbuilders when we are done with them 2002-01-21 Miguel de Icaza * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we need to make a copy of the variable to generate verifiable code. 2002-01-19 Miguel de Icaza * driver.cs: Compute dynamically the system directory. * ecore.cs (CopyNewMethods): reworked, exposed, made public. Slower, but more generally useful. Used by the abstract registering implementation. * expression.cs (ResolveMemberAccess): Reorder the way we evaluate the rules for the special rule on Type/instances. First check if we have the same name, and if so, try that special static path rather than the instance path. 2002-01-18 Miguel de Icaza * cs-parser.jay: Emit 642 (warning: possible empty statement) for for, while and if. * class.cs (TypeBuilder.DefineType): Do not allow inheritance from Enum, ValueType, Delegate or Array for non-corlib compiles. * cs-tokenizer.cs: Catch long identifiers (645) * typemanager.cs (IndexerPropetyName): Ravi never tested this piece of code. * class.cs (TypeContainer.RegisterRequiredImplementations): Bug fix, we were returning too early, so we were not registering pending methods from abstract classes. Do not register pending methods if the class is abstract. * expression.cs (Conditional.DoResolve): Report circular implicit conversions when we neecd to compute it for conditional expressions. (Is.DoResolve): If the expression is always of the provided type, flag warning 183. If the expression can not ever be of the provided type flag warning 184. * class.cs: Catch 169 as well. * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and read. 2002-01-18 Nick Drochak * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead. 2002-01-17 Miguel de Icaza * interface.cs: (PopulateMethod): Check for pointers being defined only if the unsafe context is active. (PopulateProperty): ditto. (PopulateIndexer): ditto. * class.cs (Method, Method.Define): Allow `unsafe' modifier to be specified. If pointers are present, make sure that they are present in an unsafe context. (Constructor, Constructor.Define): ditto. (Field, Field.Define): ditto. (Property, Property.Define): ditto. (Event, Event.Define): ditto. * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the hashtable if there are classes or structs defined. * expression.cs (LocalVariableReference.DoResolve): Simplify this code, as the constant resolution moved. * statement.cs (Block.EmitMeta): Resolve all constants as we emit the metadata, so we can flag error 133. * decl.cs (MemberCore.UnsafeOK): New function to test that a pointer is being declared in an unsafe context. 2002-01-16 Miguel de Icaza * modifiers.cs (Modifiers.Check): Require a Location argument. Report error 227 for Unsafe use. * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer * statement.cs (For.Emit): If the test is null, then report that we do `return', as we wont reach anything afterwards. (Switch.SwitchGoverningType): Track the expression that matched the conversion. * driver.cs: Allow negative numbers as an error code to flag. * cs-parser.jay: Handle 1551. * namespace.cs: Add 1537 checking (repeated using alias namespaces). 2002-01-15 Miguel de Icaza * cs-parser.jay: Report 1518 (type declaration can only contain class, struct, interface, enum or delegate) (switch_label): Report 1523 (keywords `case' or `default' must preced code) (opt_switch_sections): Report 1522 (empty switch) * driver.cs: Report 1515 (response file specified multiple times) Report 1516 (Source file specified multiple times). * expression.cs (Argument.Resolve): Signal 1510 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base access not allowed in static code) 2002-01-11 Ravi Pratap * typemanager.cs (IsPointerType): Utility method which we are going to need a lot. * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to the object type, so we take care of that. * expression.cs (FullMethodDesc): Also include the return type in descriptions. * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be added to non-params parameters :-) * typemanager.cs (CSharpName): Include 'void' type too. (void_ptr_type): Include in the set of core types. * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of duplicating code. (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have an unsafe context. * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had completely forgotten about it. 2002-01-10 Ravi Pratap * cs-parser.jay (pointer_type): Add. This begins our implementation of parsing rules for unsafe code. (unsafe_statement): Implement. (embedded_statement): Modify to include the above. * statement.cs (Unsafe): Implement new class for unsafe blocks. * codegen.cs (EmitContext.InUnsafe): Add. This determines if the current context is an unsafe one. * cs-parser.jay (local_variable_pointer_type): Since local variable types are handled differently, we need separate rules for them. (local_variable_declaration): Update to use local_variable_pointer_type to allow variable declarations of unmanaged pointer types. * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only in unsafe contexts. * ../errors/cs0214.cs : Add. 2002-01-16 Nick Drochak * makefile: remove 'response' file when cleaning. 2002-01-15 Miguel de Icaza * cs-parser.jay: Report 1524. 2002-01-14 Miguel de Icaza * typemanager.cs (RegisterMethod): drop checking if we have registered this from here 2002-01-12 Miguel de Icaza * class.cs (Method.EmitDestructor): Implement calling our base destructor. * statement.cs (Try.Emit): Fix to reset the InFinally to the old value of InFinally. * codegen.cs (EmitContext.EmitTopBlock): Destructors will call this routine and will wrap the call in a try/catch block. Deal with the case. 2002-01-11 Miguel de Icaza * ecore.cs (Expression.MemberLookup): instead of taking a parameter `same_type' that was used to tell whether we could access private members we compute our containing type from the EmitContext. (FieldExpr): Added partial support for volatile fields. This does not work for volatile fields exposed from assemblies, as I can not figure out how to extract the modreq from it. Updated all the source files to use this. * codegen.cs (EmitContext): Compute ContainerType ahead of time, because it is referenced by MemberLookup very often. 2002-01-09 Ravi Pratap * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use TypeBuilder.GetCustomAttributes to retrieve what we need. Get rid of redundant default_member_attr_type as this is the same as default_member_type which already exists. * interface.cs, attribute.cs : Update accordingly. 2002-01-08 Miguel de Icaza * typemanager.cs: Enable IndexerPropertyName again. It does not work for TYpeBuilders though. Ravi, can you please fix this? * cs-tokenizer.cs: Accept _ as a name in pp-expressions. * expression.cs (Argument.Emit): Handle the case of ref objects being passed to ref functions; (ParameterReference.EmitLoad): Loads the content of the pointer without dereferencing. 2002-01-07 Miguel de Icaza * cs-tokenizer.cs: Implemented the pre-processing expressions. 2002-01-08 Ravi Pratap * class.cs (Indexer.DefineMethod): Incorporate the interface type in the name of the method if we are doing explicit interface implementation. * expression.cs (ConversionExists): Remove as it is completely obsolete. (BetterConversion): Fix extremely trivial bug where we were referring to ConversionExists instead of StandardConversionExists ! Hooray, things are fine again ! * ../errors/bug16.cs : Add although we have fixed it. 2002-01-07 Miguel de Icaza * expression.cs (BaseIndexer): Begin implementation. * class.cs (TypeContainer.IsInterfaceMethod): Bug fix. * cs-parser.jay (indexer_declarator): Use qualified_identifier production directly to remove a shift/reduce, and implement explicit interface implementation. * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char after a floating point suffix. * expression.cs (DoNumericPromotions): Improved the conversion for uint/uint. If we have a constant, we avoid doing a typecast to a larger type. * class.cs (Indexer): Implement explicit interface implementation for indexers. Sat Jan 5 16:08:23 CET 2002 Paolo Molaro * class.cs: make the default instance constructor public and hidebysig. 2001-01-03 Ravi Pratap * interface.cs (EmitDefaultMemberAttr): Make this helper method static so we can call it from elsewhere. * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that we emit it internally if the class has a defined indexer; otherwise the user emits it by decorating the class definition with the DefaultMemberAttribute. * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember attribute is not used on a type which defines an indexer. * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab character when we skip whitespace. * ../errors/cs0646.cs : Add. 2002-01-03 Miguel de Icaza * ecore.cs (SimpleName.ResolveSimpleName): Report error 120 again. * makefile: Add practical target `mcs3.exe' which builds the third generation compiler. * expression.cs (New): Fix structures constructor calling. * class.cs (Property, Method, Indexer): Emit Final flag on the method if we are an interface implementation and we are not abstract. * ecore.cs (PropertyExpr): New public field `IsBase', tells whether this property is referencing a `base' method. * expression.cs (Invocation.EmitCall): take an extra argument: is_base, this is used to determine whether the `call' or `callvirt' opcode should be used. * delegate.cs: update EmitCall. * class.cs (Method.Define): Set NewSlot for the cases where we are not implementing an interface method. (Property.Define): ditto. 2002-01-02 Miguel de Icaza * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as 'r'. Allows mcs to parse itself fully. 2002-01-02 Ravi Pratap * expression.cs (ArrayCreation.num_automatic_initializers): Keep track of the number of initializers that require the InitializeArray method. (CheckIndices): Store the Expression in all cases - not the plain value. Also update the above field where necessary. (MakeByteBlob): Update accordingly. (DoEmit): Call EmitStaticInitializers only if the number of initializers is greater than 2. (EmitDynamicInitializers): Update in accordance with the new optimization. (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the same OpCode applies. * cs-parser.jay : Fix some glaring errors I introduced. 2002-01-01 Ravi Pratap * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters so that we can check for name clashes there too. * typemanager.cs (default_member_attr_type): The attribute that we need to emit for interface indexers. * interfaces.cs (Define): Emit the default member attribute. * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong variable was being referred to while setting the value ;-) 2002-01-01 Miguel de Icaza * expression.cs (MakeByteBlob): Optimize: we do not need to fill byte-by-byte information when we know the data is zero. Make the block always a multiple of 4, because DefineInitializedData has a bug. * assign.cs: Fix, we should assign from the temporary, not from the source. * expression.cs (MakeByteBlob): Fix my incorrect code. 2001-12-31 Miguel de Icaza * typemanager.cs (EnumToUnderlying): This function is used to get the underlying type from an enumeration, because it does not always work. * constant.cs: Use the I4_S form for values between -128 and 127. * statement.cs (Block.LookupLabel): Looks up a label. (Block): Drop support for labeled blocks. (LabeledStatement): New kind of statement that represents a label only. (Goto): Finally implement this bad boy. * cs-parser.jay: Update to reflect new mechanism to implement labels. 2001-12-30 Miguel de Icaza * codegen.cs (EmitContext.This): a codegen property that keeps the a single instance of this instead of creating many different this instances. * delegate.cs (Delegate.DoResolve): Update to use the property; * ecore.cs (SimpleName.SimpleNameResolve): Ditto * expression.cs (BaseAccess.DoResolve): Ditto. 2001-12-29 Ravi Pratap * typemanager.cs (methodimpl_attr_type): Add to hold the type corresponding to System.Runtime.CompilerServices.MethodImplAttribute. (InitCoreTypes): Update accordingly. * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute so we can quickly store the state. (ApplyAttributes): Set the correct implementation flags for InternalCall methods. 2001-12-29 Miguel de Icaza * expression.cs (EmitCall): if a method is not virtual, then do not use callvirt on it. (ArrayAccess.EmitAssign): storing non-builtin value types (ie, user defined stuff) requires the use of stobj, which takes an address on the stack instead of an array and an index. So emit the Ldelema operation for it. (EmitStoreOpcode): Use stobj for valuetypes. (UnaryMutator.EmitCode): Use the right 1 value depending on whether we are dealing with int64/uint64, float or doubles. * class.cs (TypeContainer.AddConstructor): Fix the logic to define constructors that I implemented last night. (Constructor.IsDefault): Fix to work properly for static constructors. * cs-parser.jay (CheckDef): report method signature errors. Update error number 103 to be 132. * decl.cs: New AdditionResult enumeration value: MethodExists. Although we do this check for methods later on in the semantic analysis, catching repeated default constructors is so easy that we catch these here. * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type promotions code. (ParameterReference.EmitAssign, Emit): handle bools as bytes. (ArrayAccess.EmitLoadOpcode): Handle bool type here. (ArrayAccess.EmitStoreOpcode): ditto. * cs-tokenizer.cs (is_punct): Eliminated empty computation. * expression.cs (MakeByteBlob): Complete all the missing types (uint, short, ushort, byte, sbyte) * class.cs: Only init instance field initializers on instance constructors. Rename `constructors' to instance_constructors. (TypeContainer.AddConstructor): Only add constructors to the list if it is not static. Make sure that we handle default_static_constructor independently everywhere where we handle instance_constructors 2001-12-28 Miguel de Icaza * class.cs: Do not lookup or create a base initializer for a static constructor. (ConstructorInitializer.Resolve): use the proper type to lookup for constructors. * cs-parser.jay: Report error 1585 (modifiers between type and name). * enum.cs, interface.cs: Remove CloseType, this is taken care by in DeclSpace. * decl.cs: CloseType is now an virtual method, the default implementation just closes this type. 2001-12-28 Ravi Pratap * attribute.cs (DefinePInvokeMethod): Set the implementation flags to PreserveSig by default. Also emit HideBySig on such methods. Basically, set the defaults to standard values. * expression.cs (Invocation.BetterFunction): We need to make sure that for each argument, if candidate is better, it can't be worse than the best ! (Invocation): Re-write bits to differentiate between methods being applicable in their expanded form and their normal form - for params methods of course. Get rid of use_standard everywhere as only standard conversions are allowed in overload resolution. More spec conformance. 2001-12-27 Miguel de Icaza * driver.cs: Add --timestamp, to see where the compiler spends most of its time. * ecore.cs (SimpleName.DoResolve): Do not create an implicit `this' in static code. (SimpleName.DoResolve): Implement in terms of a helper function that allows static-references to be passed upstream to MemberAccess. (Expression.ResolveWithSimpleName): Resolve specially simple names when called by MemberAccess to implement the special semantics. (Expression.ImplicitReferenceConversion): Handle conversions from Null to reference types before others, as Null's type is System.Object. * expression.cs (Invocation.EmitCall): Handle the special case of calling methods declared on a reference type from a ValueType (Base classes System.Object and System.Enum) (MemberAccess.Resolve): Only perform lookups on Enumerations if the left hand side is a TypeExpr, not on every enumeration. (Binary.Resolve): If types are reference types, then do a cast to object on operators != and == of both arguments. * typemanager.cs (FindMembers): Extract instance and static members if requested. * interface.cs (PopulateProperty): Use void_type instead of null as the return type for the setter method. (PopulateIndexer): ditto. 2001-12-27 Ravi Pratap * support.cs (ReflectionParameters): Fix minor bug where we were examining the wrong parameter for the ParamArray attribute. Cope with requests for the type of the parameter at position greater than the params parameter's. We now return the element type of the params array as that makes more sense. * expression.cs (Invocation.IsParamsMethodApplicable): Update accordingly as we no longer have to extract the element type ourselves. (Invocation.OverloadResolve): Update. 2001-12-27 Miguel de Icaza * statement.cs (Foreach.GetEnumeratorFilter): Do not compare against IEnumerator, test whether the return value is a descendant of the IEnumerator interface. * class.cs (Indexer.Define): Use an auxiliary method to implement the other bits of the method definition. Begin support for explicit interface implementation. (Property.DefineMethod): Use TypeManager.void_type instead of null for an empty return value. 2001-12-26 Miguel de Icaza * expression.cs (MemberAccess.ResolveMemberAccess): if we are dealing with a FieldExpr which is composed of a FieldBuilder, in the code path we did extract the constant, but we should have obtained the underlying value to be able to cast it (otherwise we end up in an infinite loop, this is what Ravi was running into). (ArrayCreation.UpdateIndices): Arrays might be empty. (MemberAccess.ResolveMemberAccess): Add support for section 14.5.4.1 that deals with the special case of E.I when E is a type and something else, that I can be a reference to a static member. (ArrayCreation.MakeByteBlob): It is not an error to not be able to handle a particular array type to create byte blobs, it is just something we dont generate byteblobs for. * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and arguments. * location.cs (Push): remove the key from the hashtable that we are about to add. This happens for empty files. * driver.cs: Dispose files after we have parsed them. (tokenize): new function that only runs the tokenizer on its input, for speed testing. 2001-12-26 Ravi Pratap * class.cs (Event.Define): Define the private field only if there are no accessors defined. * expression.cs (ResolveMemberAccess): If there is no associated field with the event, that means we have an event defined with its own accessors and we should flag error cs0070 since transforming ourselves into a field is not valid in that case. * ecore.cs (SimpleName.DoResolve): Same as above. * attribute.cs (DefinePInvokeMethod): Set the default calling convention and charset to sane values. 2001-12-25 Ravi Pratap * assign.cs (DoResolve): Perform check on events only if they are being accessed outside the declaring type. * cs-parser.jay (event_declarations): Update rules to correctly set the type of the implicit parameter etc. (add_accessor, remove_accessor): Set current local parameters. * expression.cs (Binary): For delegate addition and subtraction, cast the return value from the method into the appropriate delegate type. 2001-12-24 Ravi Pratap * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid of these as the workaround is unnecessary. * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered delegate data - none of that is needed at all. Re-write bits to extract the instance expression and the delegate method correctly. * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator on delegates too. * attribute.cs (ApplyAttributes): New method to take care of common tasks of attaching attributes instead of duplicating code everywhere. * everywhere : Update code to do attribute emission using the above method. 2001-12-23 Miguel de Icaza * expression.cs (IsParamsMethodApplicable): if there are not parameters, return immediately. * ecore.cs: The 0 literal can be implicity converted to an enum type. (SimpleName.DoResolve): First lookup the type, then lookup the members. (FieldExpr.Emit): If the InstanceExpression is a ValueType, we want to get its address. If the InstanceExpression is not addressable, store the result in a temporary variable, then get the address of it. * codegen.cs: Only display 219 errors on warning level or above. * expression.cs (ArrayAccess): Make it implement the IMemoryLocation interface. (Binary.DoResolve): handle the operator == (object a, object b) and operator != (object a, object b) without incurring into a BoxedCast (because 5 != o should never be performed). Handle binary enumerator operators. (EmitLoadOpcode): Use Ldelema if the object we are loading is a value type, otherwise use Ldelem_ref. Use precomputed names; (AddressOf): Implement address of * cs-parser.jay (labeled_statement): Fix recursive block addition by reworking the production. * expression.cs (New.DoEmit): New has a special case: If we are dealing with a ValueType, we have a few situations to deal with: * The target of New is a ValueType variable, that is easy, we just pass this as the variable reference * The target of New is being passed as an argument, to a boxing operation or a function that takes a ValueType. In this case, we need to create a temporary variable that is the argument of New. 2001-12-23 Ravi Pratap * rootcontext.cs (LookupType): Check that current_type is not null before going about looking at nested types. * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do not implement the IAssignMethod interface any more. * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially where we tranform them into FieldExprs if they are being resolved from within the declaring type. * ecore.cs (SimpleName.DoResolve): Do the same here. * assign.cs (DoResolve, Emit): Clean up code considerably. * ../errors/bug10.cs : Add. * ../errors/cs0070.cs : Add. * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc. * assign.cs : Get rid of EventIsLocal everywhere. 2001-12-23 Miguel de Icaza * ecore.cs (ConvertIntLiteral): finished the implementation. * statement.cs (SwitchLabel): Convert the value we are using as a key before looking up the table. 2001-12-22 Miguel de Icaza * codegen.cs (EmitTopBlock): Require a Location argument now. * cs-parser.jay (constructor_declarator): We need to setup current_local_parameters before we parse the opt_constructor_initializer, to allow the variables to be bound to the constructor arguments. * rootcontext.cs (LookupType): First lookup nested classes in our class and our parents before we go looking outside our class. * expression.cs (ConstantFold): Extract/debox the values at the beginnning. * rootcontext.cs (EmitCode): Resolve the constants first before we resolve the types. This is not really needed, but it helps debugging. * statement.cs: report location. * cs-parser.jay: pass location to throw statement. * driver.cs: Small bug fix. * report.cs: Updated format to be 4-zero filled digits. 2001-12-22 Ravi Pratap * expression.cs (CheckIndices): Fix minor bug where the wrong variable was being referred to ;-) (DoEmit): Do not call EmitStaticInitializers when the underlying type is System.Object. 2001-12-21 Ravi Pratap * ecore.cs (EventExpr.Resolve): Implement to correctly set the type and do the usual workaround for SRE. * class.cs (MyEventBuilder.EventType): New member to get at the type of the event, quickly. * expression.cs (Binary.ResolveOperator): Handle delegate addition. * assign.cs (Assign.DoResolve): Handle the case when the target is an EventExpr and perform the necessary checks. * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod interface. (SimpleName.MemberStaticCheck): Include check for EventExpr. (EventExpr): Set the type in the constructor itself since we are meant to be born fully resolved. (EventExpr.Define): Revert code I wrote earlier. * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's instance expression is null. The instance expression is a This in that case or a null, depending on whether it is a static method or not. Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr refers to more than one method. * assign.cs (DoResolve): Check whether the event belongs to the same Type container and accordingly flag errors. 2001-12-21 Miguel de Icaza * statement.cs (Throw.Emit): Add support for re-throwing exceptions. 2001-12-22 Miguel de Icaza * location.cs (ToString): Provide useful rutine. 2001-12-21 Miguel de Icaza * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant objects, return the actual integral boxed. * statement.cs (SwitchLabel): define an ILLabel for each SwitchLabel. (Switch.CheckSwitch): If the value is a Literal, extract the underlying literal. Also in the unused hashtable we had, add the SwitchLabel so we can quickly look this value up. * constant.cs: Implement a bunch of new constants. Rewrite Literal based on this. Made changes everywhere to adapt to this. * expression.cs (Expression.MakeByteBlob): Optimize routine by dereferencing array only once, and also copes with enumrations. bytes are two bytes wide, not one. (Cast): Perform constant conversions. * ecore.cs (TryImplicitIntConversion): Return literals instead of wrappers to the literals here. * expression.cs (DoNumericPromotions): long literals can converted to ulong implicity (this is taken care of elsewhere, but I was missing this spot). * ecore.cs (Expression.Literalize): Make the return type Literal, to improve type checking. * rootcontext.cs: Lookup for nested classes in our class hierarchy. 2001-12-20 Miguel de Icaza * literal.cs: Revert code from ravi that checked the bounds. The bounds are sane by the definition of the type itself. * typemanager.cs: Fix implementation of ImplementsInterface. We need to actually look up in our parent hierarchy for interfaces implemented. * const.cs: Use the underlying type for enumerations * delegate.cs: Compute the basename for the delegate creation, that should fix the delegate test case, and restore the correct Type Lookup semantics in rootcontext * rootcontext.cs: Revert Ravi's last patch. The correct way of referencing a nested type with the Reflection API is using the "+" sign. * cs-parser.jay: Do not require EOF token at the end. 2001-12-20 Ravi Pratap * rootcontext.cs (LookupType): Concatenate type names with a '.' instead of a '+' The test suite passes again. * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__' field of the enumeration. * expression.cs (MemberAccess.ResolveMemberAccess): Add support for the case when the member is an EventExpr. * ecore.cs (EventExpr.InstanceExpression): Every event which is not static has an associated instance expression. * typemanager.cs (RegisterEvent): The usual workaround, now for events. (GetAddMethod, GetRemoveMethod): Workarounds, as usual. * class.cs (Event.Define): Register event and perform appropriate checks for error #111. We define the Add and Remove methods even if the use provides none because in that case, we provide default implementations ourselves. Define a private field of the type of the event. This is done by the CSC compiler and we should be doing it too ;-) * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate): More methods we use in code we generate. (multicast_delegate_type, delegate_type): Two separate types since the distinction is important. (InitCoreTypes): Update accordingly for the above. * class.cs (Event.Emit): Generate code for default accessors that we provide (EmitDefaultMethod): Do the job in the above. * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the appropriate place. 2001-12-20 Miguel de Icaza * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set builders even if we were missing one. * interface.cs, class.cs, enum.cs: When calling DefineNestedType pass the Basename as our class name instead of the Name. The basename will be correctly composed for us. * parameter.cs (Paramters): Now takes a Location argument. * decl.cs (DeclSpace.LookupType): Removed convenience function and make all the code call directly LookupType in RootContext and take this chance to pass the Location information everywhere. * Everywhere: pass Location information. 2001-12-19 Miguel de Icaza * class.cs (Constructor.Define): Updated way of detecting the length of the parameters. (TypeContainer.DefineType): Use basename as the type name for nested types. (TypeContainer.Define): Do not recursively define types here, as definition is taken care in order by the RootContext. * tree.cs: Keep track of namespaces in a per-file basis. * parameter.cs (Parameter.ComputeSignature): Update to use DeclSpace. (Parameters.GetSignature): ditto. * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace instead of a TypeContainer. (Interface.SemanticAnalysis): Use `this' instead of our parent to resolve names. Because we need to be resolve in our context, not our parents. * driver.cs: Implement response files. * class.cs (TypeContainer.DefineType): If we are defined, do not redefine ourselves. (Event.Emit): Emit the code for add/remove handlers. (Event.Define): Save the MethodBuilders for add/remove. * typemanager.cs: Use pair here too. * cs-parser.jay: Replaced use of DictionaryEntry for Pair because DictionaryEntry requires the first argument to be non-null. (enum_declaration): Compute full name for registering the enumeration. (delegate_declaration): Instead of using formal_parameter_list, use opt_formal_parameter_list as the list can be empty. * cs-tokenizer.cs (PropertyParsing): renamed from `properties' (EventParsing): New property that controls whether `add' and `remove' are returned as tokens or identifiers (for events); 2001-12-19 Ravi Pratap * class.cs (Event.Define): Revamp use of EventBuilder completely. We now use MyEventBuilder only and let it wrap the real builder for us. (MyEventBuilder): Revamp constructor etc. Implement all operations that we perform on EventBuilder in precisely the same way here too. (FindMembers): Update to use the EventBuilder member. (Event.Emit): Update accordingly. 2001-12-18 Ravi Pratap * class.cs (MyEventBuilder.Set*): Chain to the underlying builder by calling the appropriate methods. (GetCustomAttributes): Make stubs as they cannot possibly do anything useful. (Event.Emit): Use MyEventBuilder everywhere - even to set attributes. 2001-12-17 Ravi Pratap * delegate.cs (Delegate.Populate): Check that the return type and various parameters types are indeed accessible. * class.cs (Constructor.Define): Same here. (Field.Define): Ditto. (Event.Define): Ditto. (Operator.Define): Check that the underlying Method defined itself correctly - so it's MethodBuilder should not be null. * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance expression happens to be null. * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract members but as of now we don't seem to be able to do anything really useful with it. (FindMembers): Handle events separately by returning the MyEventBuilder of the event, not the EventBuilder. 2001-12-18 Miguel de Icaza * cs-tokenizer.cs: Add support for defines. Add support for #if, #elif, #else, #endif (eval_var): evaluates a variable. (eval): stubbed for evaluating functions. * cs-parser.jay: Pass the defines information * driver.cs: Add --define command line option. * decl.cs: Move MemberCore here. Make it the base class for DeclSpace. This allows us to catch and report 108 and 109 for everything now. * class.cs (TypeContainer.Define): Extract all the members before populating and emit the warning 108 (new keyword required to override) instead of having each member implement this. (MemberCore.Define): New abstract method, we will be using this in the warning reporting engine in Populate. (Operator.Define): Adjust to new MemberCore protocol. * const.cs (Const): This does not derive from Expression, it is a temporary object we use to create fields, it is a MemberCore. * class.cs (Method.Define): Allow the entry point to be in a specific class. * driver.cs: Rewrite the argument handler to clean it up a bit. * rootcontext.cs: Made it just an auxiliary namespace feature by making everything static. * driver.cs: Adapt code to use RootContext type name instead of instance variable. * delegate.cs: Remove RootContext argument. * class.cs: (Struct, TypeContainer, Class): Remove RootContext argument. * class.cs (Event.Define): The lookup can fail. * cs-tokenizer.cs: Begin implementation of pre-procesor. * expression.cs: Resolve the this instance before invoking the code. 2001-12-17 Miguel de Icaza * cs-parser.jay: Add a production in element_access that allows the thing to become a "type" reference. This way we can parse things like "(string [])" as a type. Note that this still does not handle the more complex rules of casts. * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. * ecore.cs: (CopyNewMethods): new utility function used to assemble the list of methods from running FindMembers. (MemberLookup): Rework FindMembers so that 2001-12-16 Miguel de Icaza * class.cs (TypeContainer): Remove Delegates who fail to be defined. * delegate.cs (Populate): Verify that we dont get null return values. TODO: Check for AsAccessible. * cs-parser.jay: Use basename to emit error 574 (destructor should have the same name as container class), not the full name. * cs-tokenizer.cs (adjust_int): Fit the integer in the best possible representation. Also implements integer type suffixes U and L. 2001-12-15 Miguel de Icaza * expression.cs (ArrayCreation.DoResolve): We need to do the argument resolution *always*. * decl.cs: Make this hold the namespace. Hold the root context as well. (LookupType): Move here. * enum.cs, class.cs, interface.cs: Adapt to new hierarchy. * location.cs (Row, Name): Fixed the code, it was always returning references to the first file. * interface.cs: Register properties defined through interfaces. * driver.cs: Add support for globbing on the command line * class.cs (Field): Make it derive from MemberCore as well. (Event): ditto. 2001-12-15 Ravi Pratap * class.cs (Event::Define): Check that the type of the event is a delegate type else flag error #66. Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the same. * attribute.cs (DefinePInvokeMethod): Handle named arguments and process values of EntryPoint, CharSet etc etc. Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly. * class.cs (FindMembers): If a method is in transit, its MethodBuilder will be null and we should ignore this. I am not sure if this is really clean. Apparently, there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve, which needs this to do its work. * ../errors/cs0066.cs : Add. 2001-12-14 Miguel de Icaza * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New helper functions. * class.cs: (MethodSignature.MethodSignature): Removed hack that clears out the parameters field. (MemberSignatureCompare): Cleanup (MemberCore): New base class used to share code between MethodCore and Property. (RegisterRequiredImplementations) BindingFlags.Public requires either BindingFlags.Instace or Static. Use instance here. (Property): Refactored code to cope better with the full spec. * parameter.cs (GetParameterInfo): Return an empty array instead of null on error. * class.cs (Property): Abstract or extern properties have no bodies. * parameter.cs (GetParameterInfo): return a zero-sized array. * class.cs (TypeContainer.MethodModifiersValid): Move all the method modifier validation to the typecontainer so we can reuse this on properties. (MethodCore.ParameterTypes): return an empty sized array of types. (Property.Define): Test property modifier validity. Add tests for sealed/override too. (Method.Emit): abstract or extern methods have no bodies. 2001-12-14 Ravi Pratap * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive thing. (Method::Define, ::Emit): Modify accordingly. * expression.cs (Invocation::OverloadResolve): Handle error # 121. (ArrayCreation::MakeByteBlob): Handle floats and doubles. * makefile: Pass in /unsafe. 2001-12-13 Miguel de Icaza * class.cs (MakeKey): Kill routine. * class.cs (TypeContainer.Define): Correctly define explicit method implementations (they require the full interface name plus the method name). * typemanager.cs: Deply the PtrHashtable here and stop using the lame keys. Things work so much better. This of course broke everyone who depended on `RegisterMethod' to do the `test for existance' test. This has to be done elsewhere. * support.cs (PtrHashtable): A hashtable that avoid comparing with the object stupid Equals method (because, that like fails all over the place). We still do not use it. * class.cs (TypeContainer.SetRequiredInterface, TypeContainer.RequireMethods): Killed these two routines and moved all the functionality to RegisterRequiredImplementations. (TypeContainer.RegisterRequiredImplementations): This routine now registers all the implementations required in an array for the interfaces and abstract methods. We use an array of structures which can be computed ahead of time to reduce memory usage and we also assume that lookups are cheap as most classes will not implement too many interfaces. We also avoid creating too many MethodSignatures. (TypeContainer.IsInterfaceMethod): Update and optionally does not clear the "pending" bit if we find that there are problems with the declaration. (TypeContainer.VerifyPendingMethods): Update to report errors of methods that look like implementations but are not. (TypeContainer.Define): Add support for explicit interface method implementation. 2001-12-12 Miguel de Icaza * typemanager.cs: Keep track of the parameters here instead of being a feature of the TypeContainer. * class.cs: Drop the registration of parameters here, as InterfaceMethods are also interface declarations. * delegate.cs: Register methods with the TypeManager not only with the TypeContainer. This code was buggy. * interface.cs: Full registation here. 2001-12-11 Miguel de Icaza * expression.cs: Remove reducer for binary expressions, it can not be done this way. * const.cs: Put here the code that used to go into constant.cs * constant.cs: Put here the code for constants, this is a new base class for Literals. * literal.cs: Make Literal derive from Constant. 2001-12-09 Miguel de Icaza * statement.cs (Return.Emit): Report error 157 if the user attempts to return from a finally block. (Return.Emit): Instead of emitting a return, jump to the end of the function. * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new LocalBuilder to store the result of the function. ReturnLabel is the target where we jump. 2001-12-09 Radek Doulik * cs-parser.jay: remember alias in current namespace * ecore.cs (SimpleName::DoResolve): use aliases for types or namespaces * class.cs (LookupAlias): lookup alias in my_namespace * namespace.cs (UsingAlias): add alias, namespace_or_type pair to aliases hashtable (LookupAlias): lookup alias in this and if needed in parent namespaces 2001-12-08 Miguel de Icaza * support.cs: * rootcontext.cs: (ModuleBuilder) Made static, first step into making things static. I need this to avoid passing the TypeContainer when calling ParameterType. * support.cs (InternalParameters.ParameterType): Remove ugly hack that did string manipulation to compute the type and then call GetType. Use Parameter.ParameterType instead. * cs-tokenizer.cs: Consume the suffix for floating values. * expression.cs (ParameterReference): figure out whether this is a reference parameter or not. Kill an extra variable by computing the arg_idx during emission. * parameter.cs (Parameters.GetParameterInfo): New overloaded function that returns whether a parameter is an out/ref value or not. (Parameter.ParameterType): The type of the parameter (base, without ref/out applied). (Parameter.Resolve): Perform resolution here. (Parameter.ExternalType): The full type (with ref/out applied). * statement.cs (Using.Emit, Using.EmitExpression): Implement support for expressions on the using statement. 2001-12-07 Miguel de Icaza * statement.cs (Using.EmitLocalVariableDecls): Split the localvariable handling of the using statement. (Block.EmitMeta): Keep track of variable count across blocks. We were reusing slots on separate branches of blocks. (Try.Emit): Emit the general code block, we were not emitting it. Check the type of the declaration to be an IDisposable or something that can be implicity converted to it. Emit conversions if required. * ecore.cs (EmptyExpression): New utility class. (Expression.ImplicitConversionExists): New utility function. 2001-12-06 Miguel de Icaza * statement.cs (Using): Implement. * expression.cs (LocalVariableReference): Support read only variables. * statement.cs: Remove the explicit emit for the Leave opcode. (VariableInfo): Add a readonly field. 2001-12-05 Miguel de Icaza * ecore.cs (ConvCast): new class used to encapsulate the various explicit integer conversions that works in both checked and unchecked contexts. (Expression.ConvertNumericExplicit): Use new ConvCast class to properly generate the overflow opcodes. 2001-12-04 Miguel de Icaza * statement.cs: The correct type for the EmptyExpression is the element_type, not the variable type. Ravi pointed this out. 2001-12-04 Ravi Pratap * class.cs (Method::Define): Handle PInvoke methods specially by using DefinePInvokeMethod instead of the usual one. * attribute.cs (DefinePInvokeMethod): Implement as this is what is called above to do the task of extracting information and defining the method. 2001-12-04 Ravi Pratap * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid of the condition for string type. (Emit): Move that here. (ArrayCreation::CheckIndices): Keep string literals in their expression form. (EmitDynamicInitializers): Handle strings appropriately. 2001-12-04 Miguel de Icaza * codegen.cs (EmitContext): Replace multiple variables with a single pointer to the current Switch statement. * statement.cs (GotoDefault, Switch): Adjust to cleaned up EmitContext. 2001-12-03 Miguel de Icaza * statement.cs * statement.cs (GotoDefault), cs-parser.jay: Implement `goto default'. (Foreach.Emit): Foreach on arrays was not setting up the loop variables (for break/continue). (GotoCase): Semi-implented. 2001-12-03 Ravi Pratap * attribute.cs (CheckAttribute): Handle system attributes by using Attribute.GetAttributes to examine information we need. (GetValidPlaces): Same here. * class.cs (Method::Define): Catch invalid use of extern and abstract together. * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute. * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method. (Method::Define): Set appropriate flags if we have a DllImport attribute. (Method::Emit): Handle the case when we are a PInvoke method. 2001-12-03 Miguel de Icaza * expression.cs: Use ResolveWithSimpleName on compound names. 2001-12-02 Ravi Pratap * constant.cs (EmitConstant): Make sure we resolve the associated expression before trying to reduce it. * typemanager.cs (RegisterConstant, LookupConstant): Implement. * constant.cs (LookupConstantValue): Implement. (EmitConstant): Use the above in emitting the constant. * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants that are user-defined by doing a LookupConstantValue on them. (SimpleName::DoResolve): When we have a FieldExpr, cope with constants too, like above. 2001-11-29 Miguel de Icaza * expression.cs (BaseAccess, BaseIndexer): Also split this out. (BaseAccess.DoResolve): Implement. (MemberAccess.DoResolve): Split this routine into a ResolveMemberAccess routine that can be used independently 2001-11-28 Miguel de Icaza * expression.cs (Probe, Is, As): Split Probe in two classes Is and As that share bits of the implementation. Is returns a boolean, while As returns the Type that is being probed. 2001-12-01 Ravi Pratap * enum.cs (LookupEnumValue): Re-write various bits, return an object value instead of a Literal - much easier. (EnumInTransit): Remove - utterly useless :-) (Populate): Re-write bits - remove duplicate code etc. The code is much neater now. * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit. * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency chain when we have no associated expression. 2001-11-30 Ravi Pratap * constant.cs (Define): Use Location while reporting the errror. Also emit a warning when 'new' is used and there is no inherited member to hide. * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being populated. (LookupEnumValue): Implement to lookup an enum member's value and define it if necessary. (Populate): Re-write accordingly to use the above routine. 2001-11-27 Miguel de Icaza * expression.cs (This): Fix prototype for DoResolveLValue to override the base class DoResolveLValue. * cs-parser.cs: Report errors cs574 and cs575 (destructor declarations) * ecore.cs (FieldExpr.EmitAssign): Handle value types specially (we need to load the address of the field here). This fixes test-22. (FieldExpr.DoResolveLValue): Call the DoResolve function to initialize the Instance expression. * statement.cs (Foreach.Emit): Fix the bug where we did not invoke correctly the GetEnumerator operation on a value type. * cs-parser.jay: Add more simple parsing error catches. * statement.cs (Switch): Add support for string switches. Handle null specially. * literal.cs (NullLiteral): Make NullLiteral objects singletons. 2001-11-28 Ravi Pratap * cs-parser.jay (local_constant_declaration): Use declare_local_constant. (declare_local_constant): New helper function. * statement.cs (AddConstant): Keep a separate record of constants (IsConstant): Implement to determine if a variable is a constant. (GetConstantExpression): Implement. * expression.cs (LocalVariableReference): Handle the case when it is a constant. * statement.cs (IsVariableDefined): Re-write. 2001-11-27 Ravi Pratap * class.cs (TypeContainer::FindMembers): Look for constants in the case when we are looking for MemberTypes.Field * expression.cs (MemberAccess::DoResolve): Check that in the case we are a FieldExpr and a Literal, we are not being accessed by an instance reference. * cs-parser.jay (local_constant_declaration): Implement. (declaration_statement): Implement for constant declarations. 2001-11-26 Miguel de Icaza * statement.cs (Switch): Catch double defaults. (Switch): More work on the switch() statement implementation. It works for integral values now, need to finish string support. 2001-11-24 Miguel de Icaza * ecore.cs (Expression.ConvertIntLiteral): New function to convert integer literals into other integer literals. To be used by switch. 2001-11-24 Ravi Pratap * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save some memory. (EmitDynamicInitializers): Cope with the above since we extract data directly from ArrayData now. (ExpectInitializers): Keep track of whether initializers are mandatory or not. (Bounds): Make it a hashtable to prevent the same dimension being recorded for every element in that dimension. (EmitDynamicInitializers): Fix bug which prevented the Set array method from being found. Also fix bug which was causing the indices to be emitted in the reverse order. 2001-11-24 Miguel de Icaza * expression.cs (ArrayCreation): Implement the bits that Ravi left unfinished. They do not work, because the underlying code is sloppy. 2001-11-22 Miguel de Icaza * cs-parser.jay: Remove bogus fixme. * statement.cs (Switch, SwitchSection, SwithLabel): Started work on Switch statement. 2001-11-23 Ravi Pratap * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine the same. * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant parameter. Apparently, any expression is allowed. (ValidateInitializers): Update accordingly. (CheckIndices): Fix some tricky bugs thanks to recursion. * delegate.cs (NewDelegate::DoResolve): Re-write large portions as I was being completely brain-dead. (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static and re-write acordingly. (DelegateInvocation): Re-write accordingly. * expression.cs (ArrayCreation::Emit): Handle string initialization separately. (MakeByteBlob): Handle types more correctly. * expression.cs (ArrayCreation:Emit): Write preliminary code to do initialization from expressions but it is incomplete because I am a complete Dodo :-| 2001-11-22 Miguel de Icaza * statement.cs (If.Emit): Fix a bug that generated incorrect code on If. Basically, we have to return `true' (ie, we do return to our caller) only if both branches of the if return. * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are short-circuit operators, handle them as short circuit operators. (Cast.DoResolve): Resolve type. (Cast.Cast): Take an expression as the target type. * cs-parser.jay (cast_expression): Remove old hack that only allowed a limited set of types to be handled. Now we take a unary_expression and we resolve to a type during semantic analysis. Use the grammar productions from Rhys to handle casts (this is not complete like Rhys syntax yet, we fail to handle that corner case that C# has regarding (-x), but we will get there. 2001-11-22 Ravi Pratap * class.cs (EmitFieldInitializer): Take care of the case when we have a field which is an array type. * cs-parser.jay (declare_local_variables): Support array initialization too. * typemanager.cs (MakeKey): Implement. (everywhere): Use the above appropriately. * cs-parser.jay (for_statement): Update for array initialization while declaring variables. * ecore.cs : The error message was correct, it's the variable's names that were misleading ;-) Make the code more readable. (MemberAccess::DoResolve): Fix the code which handles Enum literals to set the correct type etc. (ConvertExplicit): Handle Enum types by examining the underlying type. 2001-11-21 Ravi Pratap * parameter.cs (GetCallingConvention): Always return CallingConventions.Standard for now. 2001-11-22 Miguel de Icaza * expression.cs (Binary.ResolveOperator): Update the values of `l' and `r' after calling DoNumericPromotions. * ecore.cs: Fix error message (the types were in the wrong order). * statement.cs (Foreach.ProbeCollectionType): Need to pass BindingFlags.Instance as well * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result implicit int literal conversion in an empty cast so that we propagate the right type upstream. (UnboxCast): new class used to unbox value types. (Expression.ConvertExplicit): Add explicit type conversions done by unboxing. (Expression.ImplicitNumericConversion): Oops, forgot to test for the target type before applying the implicit LongLiterals to ULong literal cast. 2001-11-21 Miguel de Icaza * cs-parser.jay (for_statement): Reworked the way For works: now we declare manually any variables that are introduced in for_initializer to solve the problem of having out-of-band code emition (that is what got for broken). (declaration_statement): Perform the actual variable declaration that used to be done in local_variable_declaration here. (local_variable_declaration): Do not declare anything, just pass the information on a DictionaryEntry 2001-11-20 Ravi Pratap * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete re-write of the logic to now make it recursive. (UpdateIndices): Re-write accordingly. Store element data in a separate ArrayData list in the above methods. (MakeByteBlob): Implement to dump the array data into a byte array. 2001-11-19 Ravi Pratap * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers into CheckIndices. * constant.cs (Define): Implement. (EmitConstant): Re-write fully. Pass in location info. * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant respectively. * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of DictionaryEntry since we need location info too. (constant_declaration): Update accordingly. * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring code into another method : UpdateIndices. 2001-11-18 Ravi Pratap * expression.cs (ArrayCreation::ValidateInitializers): Update to perform some type checking etc. 2001-11-17 Ravi Pratap * expression.cs (ArrayCreation::ValidateInitializers): Implement bits to provide dimension info if the user skips doing that. Update second constructor to store the rank correctly. 2001-11-16 Ravi Pratap * expression.cs (ArrayCreation::ValidateInitializers): Poke around and try to implement. * ../errors/cs0150.cs : Add. * ../errors/cs0178.cs : Add. 2001-11-16 Miguel de Icaza * statement.cs: Implement foreach on multi-dimensional arrays. * parameter.cs (Parameters.GetParameterByName): Also lookup the name of the params argument. * expression.cs: Use EmitStoreOpcode to get the right opcode while initializing the array. (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so we can use this elsewhere. * statement.cs: Finish implementation of foreach for single dimension arrays. * cs-parser.jay: Use an out-of-band stack to pass information around, I wonder why I need this. foreach_block: Make the new foreach_block the current_block. * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New function used to return a static Parameters structure. Used for empty parameters, as those are created very frequently. * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters 2001-11-15 Ravi Pratap * interface.cs : Default modifier is private, not public. The make verify test passes again. 2001-11-15 Ravi Pratap * support.cs (ReflectionParameters): Fix logic to determine whether the last parameter is a params one. Test 9 passes again. * delegate.cs (Populate): Register the builders we define with RegisterParameterForBuilder. Test 19 passes again. * cs-parser.jay (property_declaration): Reference $6 instead of $$ to get at the location. (indexer_declaration): Similar stuff. (attribute): Ditto. * class.cs (Property): Register parameters for the Get and Set methods if they exist. Test 23 passes again. * expression.cs (ArrayCreation::Emit): Pass null for the method in the call to EmitArguments as we are sure there aren't any params arguments. Test 32 passes again. * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing IndexOutOfRangeException. * class.cs (Property::Define): Register property using TypeManager.RegisterProperty Test 33 now passes again. 2001-11-15 Miguel de Icaza * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that broke a bunch of things. Will have to come up with a better way of tracking locations. * statement.cs: Implemented foreach for single dimension arrays. 2001-11-09 Miguel de Icaza * enum.cs (Enum.Emit): Delay the lookup of loc until we run into an error. This removes the lookup from the critical path. * cs-parser.jay: Removed use of temporary_loc, which is completely broken. 2001-11-14 Miguel de Icaza * support.cs (ReflectionParameters.ParameterModifier): Report whether the argument is a PARAMS argument or not. * class.cs: Set the attribute `ParamArrayAttribute' on the parameter argument. * typemanager.cs: Define param_array_type (ParamArrayAttribute) and cons_param_array_attribute (ConstructorInfo for ParamArrayAttribute)., * codegen.cs: Emit the return using the `Return' statement, that way we can report the error correctly for missing return values. * class.cs (Method.Emit): Clean up. * expression.cs (Argument.Resolve): Take another argument: the location where this argument is used. Notice that this is not part of the "Argument" class as to reduce the size of the structure (we know the approximate location anyways). Test if the argument is a variable-reference, if not, then complain with a 206. (Argument.Emit): Emit addresses of variables. (Argument.FullDesc): Simplify. (Invocation.DoResolve): Update for Argument.Resolve. (ElementAccess.DoResolve): ditto. * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke method should be virtual, as this method is always virtual. (NewDelegate.DoResolve): Update for Argument.Resolve. * class.cs (ConstructorInitializer.DoResolve): ditto. * attribute.cs (Attribute.Resolve): ditto. 2001-11-13 Miguel de Icaza * statement.cs (Foreach.Emit): Use EmitAssign instead of Store. * expression.cs (ParameterReference): Drop IStackStorage and implement IAssignMethod instead. (LocalVariableReference): ditto. * ecore.cs (FieldExpr): Drop IStackStorage and implement IAssignMethod instead. 2001-11-13 Miguel de Icaza * parameter.cs, expression.cs, class.cs, ecore.cs: Made all enumerations that are used in heavily used structures derive from byte in a laughable and pathetic attempt to reduce memory usage. This is the kind of pre-optimzations that you should not do at home without adult supervision. * expression.cs (UnaryMutator): New class, used to handle ++ and -- separatedly from the other unary operators. Cleans up the code, and kills the ExpressionStatement dependency in Unary. (Unary): Removed `method' and `Arguments' from this class, making it smaller, and moving it all to SimpleCall, so I can reuse this code in other locations and avoid creating a lot of transient data strucutres when not required. * cs-parser.jay: Adjust for new changes. 2001-11-11 Miguel de Icaza * enum.cs (Enum.Populate): If there is a failure during definition, return * cs-parser.jay (opt_enum_base): we used to catch type errors here, but this is really incorrect. The type error should be catched during semantic analysis. 2001-12-11 Ravi Pratap * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set current_local_parameters as expected since I, in my stupidity, had forgotten to do this :-) * attribute.cs (GetValidPlaces): Fix stupid bug. * class.cs (Method::Emit): Perform check on applicability of attributes. (Constructor::Emit): Ditto. (Field::Emit): Ditto. (Field.Location): Store location information. (Property, Event, Indexer, Operator): Ditto. * cs-parser.jay (field_declaration): Pass in location for each field. * ../errors/cs0592.cs : Add. 2001-11-12 Ravi Pratap * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage. (InitCoreTypes): Update accordingly. (RegisterAttrType, LookupAttr): Implement. * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold info about the same. (Resolve): Update to populate the above as necessary. (Error592): Helper. (GetValidPlaces): Helper to the above. (CheckAttribute): Implement to perform validity of attributes on declarative elements. * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc. 2001-11-12 Ravi Pratap * attribute.cs (Attribute::Resolve): Expand to handle named arguments too. * ../errors/cs0617.cs : Add. 2001-11-11 Ravi Pratap * enum.cs (Emit): Rename to Populate to be more consistent with what we expect it to do and when exactly it is called. * class.cs, rootcontext.cs : Update accordingly. * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again ! * enum.cs (Populate): Register fields with TypeManager.RegisterField. * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value of a fieldinfo using the above, when dealing with a FieldBuilder. 2001-11-10 Ravi Pratap * ../errors/cs0031.cs : Add. * ../errors/cs1008.cs : Add. * ../errrors/cs0543.cs : Add. * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid enum type. (FindMembers): Implement. * typemanager.cs (FindMembers): Re-write to call the appropriate methods for enums and delegates too. (enum_types): Rename to builder_to_enum. (delegate_types): Rename to builder_to_delegate. * delegate.cs (FindMembers): Implement. 2001-11-09 Ravi Pratap * typemanager.cs (IsEnumType): Implement. * enum.cs (Emit): Re-write parts to account for the underlying type better and perform checking etc. (GetNextDefaultValue): Helper to ensure we don't overshoot max value of the underlying type. * literal.cs (GetValue methods everywhere): Perform bounds checking and return value * enum.cs (error31): Helper to report error #31. * cs-parser.jay (enum_declaration): Store location of each member too. * enum.cs (member_to_location): New hashtable. (AddEnumMember): Update location hashtable. (Emit): Use the location of each member while reporting errors. 2001-11-09 Miguel de Icaza * cs-parser.jay: A for_initializer if is a local_variable_declaration really ammount to have an implicit block with the variable declaration and no initializer for for. * statement.cs (For.Emit): Cope with null initializers. This fixes the infinite loop on for initializers. 2001-11-08 Miguel de Icaza * enum.cs: More cleanup. * ecore.cs: Remove dead code. * class.cs (Property.Emit): More simplification. (Event.Emit): ditto. Reworked to have less levels of indentation. 2001-11-08 Ravi Pratap * class.cs (Property): Emit attributes. (Field): Ditto. (Event): Ditto. (Indexer): Ditto. (Operator): Ditto. * enum.cs (Emit): Ditto. * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for Enums too. * class.cs (Field, Event, etc.): Move attribute generation into the Emit method everywhere. * enum.cs (Enum): Revamp to use the same definition semantics as delegates so we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right as we had no way of defining nested enums ! * rootcontext.cs : Adjust code accordingly. * typemanager.cs (AddEnumType): To keep track of enum types separately. 2001-11-07 Ravi Pratap * expression.cs (EvalConstantExpression): Move into ecore.cs * enum.cs (Enum): Rename some members and make them public and readonly according to our convention. * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags, nothing else. * enum.cs (Enum::Define): Use the above instead of TypeAttr. (Enum::Emit): Write a simple version for now which doesn't try to compute expressions. I shall modify this to be more robust in just a while. * class.cs (TypeContainer::Emit): Make sure we include Enums too. (TypeContainer::CloseType): Create the Enum types too. * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression. * expression.cs (EvalConstantExpression): Get rid of completely. * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning user-defined values and other cases. (IsValidEnumLiteral): Helper function. * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing out there in the case we had a literal FieldExpr. (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here. (Literalize): Revamp a bit to take two arguments. (EnumLiteral): New class which derives from Literal to wrap enum literals. 2001-11-06 Ravi Pratap * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now. * expression.cs (ArrayCreation::ValidateInitializers): Implement. (Resolve): Use the above to ensure we have proper initializers. 2001-11-05 Ravi Pratap * expression.cs (Expression::EvalConstantExpression): New method to evaluate constant expressions. * attribute.cs (Attribute::Resolve): Modify bits to use the above function. 2001-11-07 Miguel de Icaza * expression.cs (ArrayCreation.Emit): Some bits to initialize data in an array. (Binary.ResolveOperator): Handle operator != (object a, object b) and operator == (object a, object b); (Binary.DoNumericPromotions): Indicate whether the numeric promotion was possible. (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign): Implement. Made the ArrayAccess implement interface IAssignMethod instead of IStackStore as the order in which arguments are passed reflects this. * assign.cs: Instead of using expr.ExprClass to select the way of assinging, probe for the IStackStore/IAssignMethod interfaces. * typemanager.cs: Load InitializeArray definition. * rootcontext.cs (RootContext.MakeStaticData): Used to define static data that can be used to initialize arrays. 2001-11-05 Miguel de Icaza * expression.cs: Handle operator== and operator!= for booleans. (Conditioal.Reduce): Implement reducer for the ?: operator. (Conditional.Resolve): Implement dead code elimination. (Binary.Resolve): Catch string literals and return a new concatenated string. (Unary.Reduce): Implement reduction of unary expressions. * ecore.cs: Split out the expression core handling here. (Expression.Reduce): New method used to perform constant folding and CSE. This is needed to support constant-expressions. * statement.cs (Statement.EmitBoolExpression): Pass true and false targets, and optimize for !x. 2001-11-04 Ravi Pratap * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution of an attribute gives us a CustomAttributeBuilder which we use accordingly to set custom atttributes. * literal.cs (Literal::GetValue): New abstract method to return the actual value of the literal, cast as an object. (*Literal): Implement GetValue method. * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain expressions to the arraylist but objects of type Argument. * class.cs (TypeContainer::Emit): Emit our attributes too. (Method::Emit, Constructor::Emit): Ditto. * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed to be ignoring earlier. 2001-11-03 Ravi Pratap * attribute.cs (AttributeSection::Define): Implement to do the business of constructing a CustomAttributeBuilder. (Attribute): New trivial class. Increases readability of code. * cs-parser.jay : Update accordingly. (positional_argument_list, named_argument_list, named_argument): New rules (attribute_arguments): Use the above so that we are more correct. 2001-11-02 Ravi Pratap * expression.cs (Invocation::IsParamsMethodApplicable): Implement to perform all checks for a method with a params parameter. (Invocation::OverloadResolve): Update to use the above method and therefore cope correctly with params method invocations. * support.cs (InternalParameters::ParameterDesc): Provide a desc for params too. * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public constructors in our parent too because we can't afford to miss out on protected ones ;-) * attribute.cs (AttributeSection): New name for the class Attribute Other trivial changes to improve readability. * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to use the new class names. 2001-11-01 Ravi Pratap * class.cs (Method::Define): Complete definition for params types too (Indexer::Define): Ditto. * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier): Cope everywhere with a request for info about the array parameter. 2001-11-01 Ravi Pratap * tree.cs (RecordNamespace): Fix up to check for the correct key. * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in local_variable_type to extract the string corresponding to the type. (local_variable_type): Fixup the action to use the new helper method. * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to go. * expression.cs : Clean out code which uses the above. 2001-10-31 Ravi Pratap * typemanager.cs (RegisterMethod): Check if we already have an existing key and bale out if necessary by returning a false. (RegisterProperty): Ditto. * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod and print out appropriate error messages. * interface.cs (everywhere): Ditto. * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass location to constructor. * class.cs (Property, Event, Indexer): Update accordingly. * ../errors/cs111.cs : Added. * expression.cs (Invocation::IsApplicable): New static method to determine applicability of a method, as laid down by the spec. (Invocation::OverloadResolve): Use the above method. 2001-10-31 Ravi Pratap * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We now take a TypeContainer and a Parameters object. (ParameterData): Modify return type of ParameterModifier method to be Parameter.Modifier and not a string. (ReflectionParameters, InternalParameters): Update accordingly. * expression.cs (Argument::GetParameterModifier): Same here. * support.cs (InternalParameters::ParameterType): Find a better way of determining if we are a ref/out parameter. Actually, the type shouldn't be holding the '&' symbol in it at all so maybe this is only for now. 2001-10-30 Ravi Pratap * support.cs (InternalParameters): Constructor now takes an extra argument which is the actual Parameters class. (ParameterDesc): Update to provide info on ref/out modifiers. * class.cs (everywhere): Update call to InternalParameters to pass in the second argument too. * support.cs (ParameterData): Add ParameterModifier, which is a method to return the modifier info [ref/out etc] (InternalParameters, ReflectionParameters): Implement the above. * expression.cs (Argument::ParameterModifier): Similar function to return info about the argument's modifiers. (Invocation::OverloadResolve): Update to take into account matching modifiers too. * class.cs (Indexer::Define): Actually define a Parameter object and put it onto a new SetFormalParameters object which we pass to InternalParameters. 2001-10-30 Ravi Pratap * expression.cs (NewArray): Merge into the ArrayCreation class. 2001-10-29 Ravi Pratap * expression.cs (NewArray): Merge classes NewBuiltinArray and NewUserdefinedArray into one as there wasn't much of a use in having two separate ones. * expression.cs (Argument): Change field's name to ArgType from Type. (Type): New readonly property which returns the proper type, taking into account ref/out modifiers. (everywhere): Adjust code accordingly for the above. * codegen.cs (EmitContext.RefOrOutParameter): New field to determine whether we are emitting for a ref or out parameter. * expression.cs (Argument::Emit): Use the above field to set the state. (LocalVariableReference::Emit): Update to honour the flag and emit the right stuff. * parameter.cs (Attributes): Set the correct flags for ref parameters. * expression.cs (Argument::FullDesc): New function to provide a full desc. * support.cs (ParameterData): Add method ParameterDesc to the interface. (ReflectionParameters, InternalParameters): Implement the above method. * expression.cs (Invocation::OverloadResolve): Use the new desc methods in reporting errors. (Invocation::FullMethodDesc): Ditto. 2001-10-29 Miguel de Icaza * cs-parser.jay: Add extra production for the second form of array creation. * expression.cs (ArrayCreation): Update to reflect the above change. * Small changes to prepare for Array initialization. 2001-10-28 Miguel de Icaza * typemanager.cs (ImplementsInterface): interface might be null; Deal with this problem; Also, we do store negative hits on the cache (null values), so use this instead of calling t.GetInterfaces on the type everytime. 2001-10-28 Ravi Pratap * typemanager.cs (IsBuiltinType): New method to help determine the same. * expression.cs (New::DoResolve): Get rid of array creation code and instead split functionality out into different classes. (New::FormArrayType): Move into NewBuiltinArray. (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears quite useless. (NewBuiltinArray): New class to handle creation of built-in arrays. (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into account creation of one-dimensional arrays. (::Emit): Implement to use Newarr and Newobj opcodes accordingly. (NewUserdefinedArray::DoResolve): Implement. * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too. * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules we maintain inside the TypeManager. This is necessary to perform lookups on the module builder. (LookupType): Update to perform GetType on the module builders too. * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager. * exprssion.cs (NewUserdefinedArray::Emit): Implement. 2001-10-23 Ravi Pratap * expression.cs (New::DoResolve): Implement guts of array creation. (New::FormLookupType): Rename to FormArrayType and modify ever so slightly. 2001-10-27 Miguel de Icaza * expression.cs: Fix bug I introduced lsat night that broke Delegates. (Expression.Resolve): Report a 246 error (can not resolve name) if we find a SimpleName in the stream. (Expression.ResolveLValue): Ditto. (Expression.ResolveWithSimpleName): This function is a variant of ResolveName, this one allows SimpleNames to be returned without a warning. The only consumer of SimpleNames is MemberAccess 2001-10-26 Miguel de Icaza * expression.cs (Invocation::DoResolve): Catch SimpleNames that might arrive here. I have my doubts that this is correct. * statement.cs (Lock): Implement lock statement. * cs-parser.jay: Small fixes to support `lock' and `using' * cs-tokenizer.cs: Remove extra space * driver.cs: New flag --checked, allows to turn on integer math checking. * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and Threading.Monitor.Exit 2001-10-23 Miguel de Icaza * expression.cs (IndexerAccess::DoResolveLValue): Set the Expression Class to be IndexerAccess. Notice that Indexer::DoResolve sets the eclass to Value. 2001-10-22 Miguel de Icaza * class.cs (TypeContainer::Emit): Emit code for indexers. * assign.cs (IAssignMethod): New interface implemented by Indexers and Properties for handling assignment. (Assign::Emit): Simplify and reuse code. * expression.cs (IndexerAccess, PropertyExpr): Implement IAssignMethod, clean up old code. 2001-10-22 Ravi Pratap * typemanager.cs (ImplementsInterface): New method to determine if a type implements a given interface. Provides a nice cache too. * expression.cs (ImplicitReferenceConversion): Update checks to use the above method. (ConvertReferenceExplicit): Ditto. * delegate.cs (Delegate::Populate): Update to define the parameters on the various methods, with correct names etc. * class.cs (Operator::OpType): New members Operator.UnaryPlus and Operator.UnaryNegation. * cs-parser.jay (operator_declarator): Be a little clever in the case where we have a unary plus or minus operator. * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and UnaryMinus. * everywhere : update accordingly. * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement respectively. * class.cs (Method::Define): For the case where we are implementing a method inherited from an interface, we need to set the MethodAttributes.Final flag too. Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig. 2001-10-21 Ravi Pratap * interface.cs (FindMembers): Implement to work around S.R.E lameness. * typemanager.cs (IsInterfaceType): Implement. (FindMembers): Update to handle interface types too. * expression.cs (ImplicitReferenceConversion): Re-write bits which use IsAssignableFrom as that is not correct - it doesn't work. * delegate.cs (DelegateInvocation): Derive from ExpressionStatement and accordingly override EmitStatement. * expression.cs (ConvertReferenceExplicit): Re-write similary, this time using the correct logic :-) 2001-10-19 Ravi Pratap * ../errors/cs-11.cs : Add to demonstrate error -11 2001-10-17 Miguel de Icaza * assign.cs (Assign::Resolve): Resolve right hand side first, and then pass this as a hint to ResolveLValue. * expression.cs (FieldExpr): Add Location information (FieldExpr::LValueResolve): Report assignment to readonly variable. (Expression::ExprClassFromMemberInfo): Pass location information. (Expression::ResolveLValue): Add new method that resolves an LValue. (Expression::DoResolveLValue): Default invocation calls DoResolve. (Indexers): New class used to keep track of indexers in a given Type. (IStackStore): Renamed from LValue, as it did not really describe what this did. Also ResolveLValue is gone from this interface and now is part of Expression. (ElementAccess): Depending on the element access type * typemanager.cs: Add `indexer_name_type' as a Core type (System.Runtime.CompilerServices.IndexerNameAttribute) * statement.cs (Goto): Take a location. 2001-10-18 Ravi Pratap * delegate.cs (Delegate::VerifyDelegate): New method to verify if two delegates are compatible. (NewDelegate::DoResolve): Update to take care of the case when we instantiate a delegate from another delegate. * typemanager.cs (FindMembers): Don't even try to look up members of Delegate types for now. 2001-10-18 Ravi Pratap * delegate.cs (NewDelegate): New class to take care of delegate instantiation. * expression.cs (New): Split the delegate related code out into the NewDelegate class. * delegate.cs (DelegateInvocation): New class to handle delegate invocation. * expression.cs (Invocation): Split out delegate related code into the DelegateInvocation class. 2001-10-17 Ravi Pratap * expression.cs (New::DoResolve): Implement delegate creation fully and according to the spec. (New::DoEmit): Update to handle delegates differently. (Invocation::FullMethodDesc): Fix major stupid bug thanks to me because of which we were printing out arguments in reverse order ! * delegate.cs (VerifyMethod): Implement to check if the given method matches the delegate. (FullDelegateDesc): Implement. (VerifyApplicability): Implement. * expression.cs (Invocation::DoResolve): Update to accordingly handle delegate invocations too. (Invocation::Emit): Ditto. * ../errors/cs1593.cs : Added. * ../errors/cs1594.cs : Added. * delegate.cs (InstanceExpression, TargetMethod): New properties. 2001-10-16 Ravi Pratap * typemanager.cs (intptr_type): Core type for System.IntPtr (InitCoreTypes): Update for the same. (iasyncresult_type, asynccallback_type): Ditto. * delegate.cs (Populate): Fix to use System.Intptr as it is indeed correct. * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class too. * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold the builders for the 4 members of a delegate type :-) (Populate): Define the BeginInvoke and EndInvoke methods on the delegate type. * expression.cs (New::DoResolve): Implement guts for delegate creation. * ../errors/errors.txt : Update for an error (-11) which only we catch :-) 2001-10-15 Miguel de Icaza * statement.cs (Break::Emit): Implement. (Continue::Emit): Implement. (For::Emit): Track old being/end loops; Set Begin loop, ack end loop (While::Emit): Track old being/end loops; Set Begin loop, ack end loop (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop (Foreach::Emit): Track old being/end loops; Set Begin loop, ack end loop * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New properties that track the label for the current loop (begin of the loop and end of the loop). 2001-10-15 Ravi Pratap * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible use of emitting anything at all. * class.cs, rootcontext.cs : Get rid of calls to the same. * delegate.cs (DefineDelegate): Make sure the class we define is also sealed. (Populate): Define the constructor correctly and set the implementation attributes. * typemanager.cs (delegate_types): New hashtable to hold delegates that have been defined. (AddDelegateType): Implement. (IsDelegateType): Implement helper method. * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType. * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type and accordingly handle it. * delegate.cs (Populate): Take TypeContainer argument. Implement bits to define the Invoke method. However, I still haven't figured out how to take care of the native int bit :-( * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) Qualify the name of the delegate, not its return type ! * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array conversion. (StandardConversionExists): Checking for array types turns out to be recursive. (ConvertReferenceExplicit): Implement array conversion. (ExplicitReferenceConversionExists): New method to determine precisely that :-) 2001-10-12 Ravi Pratap * cs-parser.jay (delegate_declaration): Store the fully qualified name as it is a type declaration. * delegate.cs (ReturnType, Name): Rename members to these. Make them readonly. (DefineDelegate): Renamed from Define. Does the same thing essentially, as TypeContainer::DefineType. (Populate): Method in which all the definition of the various methods (Invoke) etc is done. (Emit): Emit any code, if necessary. I am not sure about this really, but let's see. (CloseDelegate): Finally creates the delegate. * class.cs (TypeContainer::DefineType): Update to define delegates. (Populate, Emit and CloseType): Do the same thing here too. * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include delegates in all these operations. 2001-10-14 Miguel de Icaza * expression.cs: LocalTemporary: a new expression used to reference a temporary that has been created. * assign.cs: Handle PropertyAccess back here, so that we can provide the proper semantic access to properties. * expression.cs (Expression::ConvertReferenceExplicit): Implement a few more explicit conversions. * modifiers.cs: `NEW' modifier maps to HideBySig. * expression.cs (PropertyExpr): Make this into an ExpressionStatement, and support the EmitStatement code path. Perform get/set error checking, clean up the interface. * assign.cs: recognize PropertyExprs as targets, and if so, turn them into toplevel access objects. 2001-10-12 Miguel de Icaza * expression.cs: PropertyExpr::PropertyExpr: use work around the SRE. * typemanager.cs: Keep track here of our PropertyBuilders again to work around lameness in SRE. 2001-10-11 Miguel de Icaza * expression.cs (LValue::LValueResolve): New method in the interface, used to perform a second resolution pass for LValues. (This::DoResolve): Catch the use of this in static methods. (This::LValueResolve): Implement. (This::Store): Remove warning, assigning to `this' in structures is (Invocation::Emit): Deal with invocation of methods on value types. We need to pass the address to structure methods rather than the object itself. (The equivalent code to emit "this" for structures leaves the entire structure on the stack instead of a pointer to it). (ParameterReference::DoResolve): Compute the real index for the argument based on whether the method takes or not a `this' pointer (ie, the method is static). * codegen.cs (EmitContext::GetTemporaryStorage): Used to store value types returned from functions when we need to invoke a method on the sturcture. 2001-10-11 Ravi Pratap * class.cs (TypeContainer::DefineType): Method to actually do the business of defining the type in the Modulebuilder or Typebuilder. This is to take care of nested types which need to be defined on the TypeBuilder using DefineNestedMethod. (TypeContainer::GetClassBases): Implement. Essentially the code from the methods in RootContext, only ported to be part of TypeContainer. (TypeContainer::GetInterfaceOrClass): Ditto. (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto. * interface.cs (Interface::DefineInterface): New method. Does exactly what RootContext.CreateInterface did earlier, only it takes care of nested types too. (Interface::GetInterfaces): Move from RootContext here and port. (Interface::GetInterfaceByName): Same here. * rootcontext.cs (ResolveTree): Re-write. (PopulateTypes): Re-write. * class.cs (TypeContainer::Populate): Populate nested types too. (TypeContainer::Emit): Emit nested members too. * typemanager.cs (AddUserType): Do not make use of the FullName property, instead just use the name argument passed in as it is already fully qualified. (FindMembers): Check in the Builders to TypeContainer mapping instead of the name to TypeContainer mapping to see if a type is user-defined. * class.cs (TypeContainer::CloseType): Implement. (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating the default constructor. (TypeContainer::Populate): Fix minor bug which led to creating default constructors twice. (Constructor::IsDefault): Fix up logic to determine if it is the default constructor * interface.cs (CloseType): Create the type here. * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through the hierarchy. Remove all the methods which are now in TypeContainer. 2001-10-10 Ravi Pratap * delegate.cs (Define): Re-write bits to define the delegate correctly. 2001-10-10 Miguel de Icaza * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe * expression.cs (ImplicitReferenceConversion): handle null as well as a source to convert to any reference type. * statement.cs (Return): Perform any implicit conversions to expected return type. Validate use of return statement. * codegen.cs (EmitContext): Pass the expected return type here. * class.cs (Method, Constructor, Property): Pass expected return type to EmitContext. 2001-10-09 Miguel de Icaza * expression.cs: Make DoResolve take an EmitContext instead of a TypeContainer. Replaced `l' and `location' for `loc', for consistency. (Error, Warning): Remove unneeded Tc argument. * assign.cs, literal.cs, constant.cs: Update to new calling convention. * codegen.cs: EmitContext now contains a flag indicating whether code is being generated in a static method or not. * cs-parser.jay: DecomposeQI, new function that replaces the old QualifiedIdentifier. Now we always decompose the assembled strings from qualified_identifier productions into a group of memberaccesses. 2001-10-08 Miguel de Icaza * rootcontext.cs: Deal with field-less struct types correctly now by passing the size option to Define Type. * class.cs: Removed hack that created one static field. 2001-10-07 Miguel de Icaza * statement.cs: Moved most of the code generation here. 2001-10-09 Ravi Pratap * expression.cs (New::DoResolve): Revert changes for array creation, doesn't seem very right. (ElementAccess): Remove useless bits for now - keep checks as the spec says. 2001-10-08 Ravi Pratap * expression.cs (ElementAccess::DoResolve): Remove my crap code and start performing checks according to the spec. 2001-10-07 Ravi Pratap * cs-parser.jay (type_suffix*): Remove - they are redundant. Use rank_specifiers instead. (rank_specifiers): Change the order in which the rank specifiers are stored (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes. * expression.cs (ElementAccess): Implement the LValue interface too. 2001-10-06 Ravi Pratap * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit except that user defined conversions are not included. (UserDefinedConversion): Update to use the ConvertExplicitStandard to perform the conversion of the return type, if necessary. (New::DoResolve): Check whether we are creating an array or an object and accordingly do the needful. (New::Emit): Same here. (New::DoResolve): Implement guts of array creation. (New::FormLookupType): Helper function. 2001-10-07 Miguel de Icaza * codegen.cs: Removed most of the code generation here, and move the corresponding code generation bits to the statement classes. Added support for try/catch/finalize and throw. * cs-parser.jay: Added support for try/catch/finalize. * class.cs: Catch static methods having the flags override, virtual or abstract. * expression.cs (UserCast): This user cast was not really doing what it was supposed to do. Which is to be born in fully resolved state. Parts of the resolution were being performed at Emit time! Fixed this code. 2001-10-05 Miguel de Icaza * expression.cs: Implicity convert the result from UserCast. 2001-10-05 Ravi Pratap * expression.cs (Expression::FindMostEncompassingType): Fix bug which prevented it from working correctly. (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not merely ConvertImplicit. 2001-10-05 Miguel de Icaza * typemanager.cs: Make the LookupTypeContainer function static, and not per-instance. * class.cs: Make static FindMembers (the one that takes a Type argument). * codegen.cs: Add EmitForeach here. * cs-parser.jay: Make foreach a toplevel object instead of the inline expansion, as we need to perform semantic analysis on it. 2001-10-05 Ravi Pratap * expression.cs (Expression::ImplicitUserConversion): Rename to UserDefinedConversion. (Expression::UserDefinedConversion): Take an extra argument specifying whether we look for explicit user conversions too. (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion. (UserDefinedConversion): Incorporate support for user defined explicit conversions. (ExplicitUserConversion): Make it a call to UserDefinedConversion with the appropriate arguments. * cs-parser.jay (cast_expression): Record location too. * expression.cs (Cast): Record location info. (Expression::ConvertExplicit): Take location argument. (UserImplicitCast): Change name to UserCast. Take an extra constructor argument to determine if we are doing explicit conversions. (UserCast::Emit): Update accordingly. (Expression::ConvertExplicit): Report an error if everything fails. * ../errors/cs0030.cs : Add. 2001-10-04 Miguel de Icaza * modifiers.cs: If the ABSTRACT keyword is present, also set the virtual and newslot bits. * class.cs (TypeContainer::RegisterRequiredImplementations): Record methods we need. (TypeContainer::MakeKey): Helper function to make keys for MethodBases, since the Methodbase key is useless. (TypeContainer::Populate): Call RegisterRequiredImplementations before defining the methods. Create a mapping for method_builders_to_methods ahead of time instead of inside a tight loop. (::RequireMethods): Accept an object as the data to set into the hashtable so we can report interface vs abstract method mismatch. 2001-10-03 Miguel de Icaza * report.cs: Make all of it static. * rootcontext.cs: Drop object_type and value_type computations, as we have those in the TypeManager anyways. Drop report instance variable too, now it is a global. * driver.cs: Use try/catch on command line handling. Add --probe option to debug the error reporting system with a test suite. * report.cs: Add support for exiting program when a probe condition is reached. 2001-10-03 Ravi Pratap * expression.cs (Binary::DoNumericPromotions): Fix the case when we do a forcible conversion regardless of type, to check if ForceConversion returns a null. (Binary::error19): Use location to report error. (Unary::error23): Use location here too. * ../errors/cs0019.cs : Check in. * ../errors/cs0023.cs : Check in. * expression.cs (Expression.MemberLookup): Return null for a rather esoteric case of a non-null MethodInfo object with a length of 0 ! (Binary::ResolveOperator): Flag error if overload resolution fails to find an applicable member - according to the spec :-) Also fix logic to find members in base types. (Unary::ResolveOperator): Same here. (Unary::report23): Change name to error23 and make first argument a TypeContainer as I was getting thoroughly confused between this and error19 :-) * expression.cs (Expression::ImplicitUserConversion): Re-write fully (::FindMostEncompassedType): Implement. (::FindMostEncompassingType): Implement. (::StandardConversionExists): Implement. (UserImplicitCast): Re-vamp. We now need info about most specific source and target types so that we can do the necessary conversions. (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper mathematical union with no duplicates. 2001-10-03 Miguel de Icaza * rootcontext.cs (RootContext::PopulateTypes): Populate containers in order from base classes to child classes, so that we can in child classes look up in our parent for method names and attributes (required for handling abstract, virtual, new, override constructs: we need to instrospect our base class, and if we dont populate the classes in order, the introspection might be incorrect. For example, a method could query its parent before the parent has any methods and would determine that the parent has no abstract methods (while it could have had them)). (RootContext::CreateType): Record the order in which we define the classes. 2001-10-02 Miguel de Icaza * class.cs (TypeContainer::Populate): Also method definitions can fail now, keep track of this. (TypeContainer::FindMembers): Implement support for DeclaredOnly/noDeclaredOnly flag. (Constructor::Emit) Return the ConstructorBuilder. (Method::Emit) Return the MethodBuilder. Check for abstract or virtual methods to be public. * rootcontext.cs (RootContext::CreateType): Register all the abstract methods required for the class to be complete and the interface methods that must be implemented. * cs-parser.jay: Report error 501 (method requires body if it is not marked abstract or extern). * expression.cs (TypeOf::Emit): Implement. * typemanager.cs: runtime_handle_type, new global type. * class.cs (Property::Emit): Generate code for properties. 2001-10-02 Ravi Pratap * expression.cs (Unary::ResolveOperator): Find operators on base type too - we now conform exactly to the spec. (Binary::ResolveOperator): Same here. * class.cs (Operator::Define): Fix minor quirk in the tests. * ../errors/cs0215.cs : Added. * ../errors/cs0556.cs : Added. * ../errors/cs0555.cs : Added. 2001-10-01 Miguel de Icaza * cs-tokenizer.cs: Reimplemented Location to be a struct with a single integer which is really efficient 2001-10-01 Ravi Pratap * expression.cs (Expression::ImplicitUserConversion): Use location even in the case when we are examining True operators. * class.cs (Operator::Define): Perform extensive checks to conform with the rules for operator overloading in the spec. * expression.cs (Expression::ImplicitReferenceConversion): Implement some of the other conversions mentioned in the spec. * typemanager.cs (array_type): New static member for the System.Array built-in type. (cloneable_interface): For System.ICloneable interface. * driver.cs (Driver::Driver): Initialize TypeManager's core types even before we start resolving the tree and populating types. * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10 2001-10-01 Miguel de Icaza * expression.cs (Expression::ExprClassFromMemberInfo, Expression::Literalize): Create literal expressions from FieldInfos which are literals. (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few type casts, because they were wrong. The test suite in tests caught these ones. (ImplicitNumericConversion): ushort to ulong requires a widening cast. Int32 constant to long requires widening cast as well. * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants for integers because the type on the stack is not i4. 2001-09-30 Miguel de Icaza * expression.cs (report118): require location argument. * parameter.cs: Do not dereference potential null value. * class.cs: Catch methods that lack the `new' keyword when overriding a name. Report warnings when `new' is used without anything being there to override. * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot. * class.cs: Only add constructor to hashtable if it is non-null (as now constructors can fail on define). (TypeManager, Class, Struct): Take location arguments. Catch field instance initialization in structs as errors. accepting_filter: a new filter for FindMembers that is static so that we dont create an instance per invocation. (Constructor::Define): Catch errors where a struct constructor is parameterless * cs-parser.jay: Pass location information for various new constructs. * delegate.cs (Delegate): take a location argument. * driver.cs: Do not call EmitCode if there were problesm in the Definition of the types, as many Builders wont be there. * decl.cs (Decl::Decl): Require a location argument. * cs-tokenizer.cs: Handle properly hex constants that can not fit into integers, and find the most appropiate integer for it. * literal.cs: Implement ULongLiteral. * rootcontext.cs: Provide better information about the location of failure when CreateType fails. 2001-09-29 Miguel de Icaza * rootcontext.cs (RootContext::PopulateTypes): Populates structs as well. * expression.cs (Binary::CheckShiftArguments): Add missing type computation. (Binary::ResolveOperator): Add type to the logical and and logical or, Bitwise And/Or and Exclusive Or code paths, it was missing before. (Binary::DoNumericPromotions): In the case where either argument is ulong (and most signed types combined with ulong cause an error) perform implicit integer constant conversions as well. 2001-09-28 Miguel de Icaza * expression.cs (UserImplicitCast): Method should always be non-null. (Invocation::BetterConversion): Simplified test for IntLiteral. (Expression::ImplicitNumericConversion): Split this routine out. Put the code that performs implicit constant integer conversions here. (Expression::Resolve): Become a wrapper around DoResolve so we can check eclass and type being set after resolve. (Invocation::Badness): Remove this dead function (Binary::ResolveOperator): Do not compute the expensive argumnets unless we have a union for it. (Probe::Emit): Is needs to do an isinst and then compare against null. (::CanConvert): Added Location argument. If the Location argument is null (Location.Null), then we do not report errors. This is used by the `probe' mechanism of the Explicit conversion. We do not want to generate an error for something that the user explicitly requested to be casted. But the pipeline for an explicit cast first tests for potential implicit casts. So for now, if the Location is null, it means `Probe only' to avoid adding another argument. Might have to revise this strategy later. (ClassCast): New class used to type cast objects into arbitrary classes (used in Explicit Reference Conversions). Implement `as' as well. Reverted all the patches from Ravi below: they were broken: * The use of `level' as a mechanism to stop recursive invocations is wrong. That was there just to catch the bug with a strack trace but not as a way of addressing the problem. To fix the problem we have to *understand* what is going on and the interactions and come up with a plan, not just get things going. * The use of the type conversion cache that I proposed last night had an open topic: How does this work across protection domains. A user defined conversion might not be public in the location where we are applying the conversion, a different conversion might be selected (ie, private A->B (better) but public B->A (worse), inside A, A->B applies, but outside it, B->A will apply). * On top of that (ie, even if the above is solved), conversions in a cache need to be abstract. Ie, `To convert from an Int to a Short use an OpcodeCast', not `To convert from an Int to a Short use the OpcodeCast on the variable 5' (which is what this patch was doing). 2001-09-28 Ravi Pratap * expression.cs (Invocation::ConversionExists): Re-write to use the conversion cache (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also cache all conversions done, not just user-defined ones. (Invocation::BetterConversion): The real culprit. Use ConversionExists to determine if a conversion exists instead of acutually trying to perform the conversion. It's faster too. (Expression::ConvertExplicit): Modify to use ConversionExists to check and only then attempt the implicit conversion. 2001-09-28 Ravi Pratap * expression.cs (ConvertImplicit): Use a cache for conversions already found. Check level of recursion and bail out if necessary. 2001-09-28 Miguel de Icaza * typemanager.cs (string_concat_string_string, string_concat_object_object): Export standard methods that we expect for string operations. * statement.cs (Block::UsageWarning): Track usage of variables and report the errors for not used variables. * expression.cs (Conditional::Resolve, ::Emit): Implement ?: operator. 2001-09-27 Miguel de Icaza * codegen.cs: remove unnneded code * expression.cs: Removed BuiltinTypeAccess class Fix the order in which implicit conversions are done. The previous fixed dropped support for boxed conversions (adding a test to the test suite now) (UserImplicitCast::CanConvert): Remove test for source being null, that code is broken. We should not feed a null to begin with, if we do, then we should track the bug where the problem originates and not try to cover it up here. Return a resolved expression of type UserImplicitCast on success rather than true/false. Ravi: this is what I was talking about, the pattern is to use a static method as a "constructor" for objects. Also, do not create arguments until the very last minute, otherwise we always create the arguments even for lookups that will never be performed. (UserImplicitCast::Resolve): Eliminate, objects of type UserImplicitCast are born in a fully resolved state. * typemanager.cs (InitCoreTypes): Init also value_type (System.ValueType). * expression.cs (Cast::Resolve): First resolve the child expression. (LValue): Add new method AddressOf to be used by the `&' operator. Change the argument of Store to take an EmitContext instead of an ILGenerator, because things like FieldExpr need to be able to call their children expression to generate the instance code. (Expression::Error, Expression::Warning): Sugar functions for reporting errors. (Expression::MemberLookup): Accept a TypeContainer instead of a Report as the first argument. (Expression::ResolvePrimary): Killed. I still want to improve this as currently the code is just not right. (Expression::ResolveMemberAccess): Simplify, but it is still wrong. (Unary::Resolve): Catch errors in AddressOf operators. (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast index to a byte for the short-version, or the compiler will choose the wrong Emit call, which generates the wrong data. (ParameterReference::Emit, ::Store): same. (FieldExpr::AddressOf): Implement. * typemanager.cs: TypeManager: made public variable instead of property. * driver.cs: document --fatal. * report.cs (ErrorMessage, WarningMessage): new names for the old Error and Warning classes. * cs-parser.jay (member_access): Turn built-in access to types into a normal simplename 2001-09-27 Ravi Pratap * expression.cs (Invocation::BetterConversion): Fix to cope with q being null, since this was introducing a bug. * expression.cs (ConvertImplicit): Do built-in conversions first. 2001-09-27 Ravi Pratap * expression.cs (UserImplicitCast::Resolve): Fix bug. 2001-09-27 Ravi Pratap * class.cs (TypeContainer::AddConstructor): Fix a stupid bug I had introduced long ago (what's new ?). * expression.cs (UserImplicitCast::CanConvert): Static method to do the work of all the checking. (ConvertImplicit): Call CanConvert and only then create object if necessary. (UserImplicitCast::CanConvert, ::Resolve): Re-write. (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because that is the right way. (Invocation::MakeUnionSet): Convenience function to make unions of sets for overloading resolution. Use everywhere instead of cutting and pasting code. (Binary::ResolveOperator): Use MakeUnionSet. (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when we have to convert to bool types. Not complete yet. 2001-09-27 Miguel de Icaza * typemanager.cs (TypeManager::CSharpName): support ushort. * expression.cs (Expression::TryImplicitIntConversion): Attempts to provide an expression that performsn an implicit constant int conversion (section 6.1.6). (Expression::ConvertImplicitRequired): Reworked to include implicit constant expression conversions. (Expression::ConvertNumericExplicit): Finished. (Invocation::Emit): If InstanceExpression is null, then it means that we perform a call on this. 2001-09-26 Miguel de Icaza * expression.cs (Unary::Emit): Remove some dead code. (Probe): Implement Resolve and Emit for `is'. (Expression::ConvertImplicitRequired): Attempt to do constant expression conversions here. Maybe should be moved to ConvertImplicit, but I am not sure. (Expression::ImplicitLongConstantConversionPossible, Expression::ImplicitIntConstantConversionPossible): New functions that tell whether is it possible to apply an implicit constant expression conversion. (ConvertNumericExplicit): Started work on explicit numeric conversions. * cs-parser.jay: Update operator constants. * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs (Parameters::GetSignature): Hook up VerifyArgs here. (Parameters::VerifyArgs): Verifies that no two arguments have the same name. * class.cs (Operator): Update the operator names to reflect the ones that the spec expects (as we are just stringizing the operator names). * expression.cs (Unary::ResolveOperator): Fix bug: Use MethodInfo's ReturnType instead of LookupMethodByBuilder as the previous usage did only work for our methods. (Expression::ConvertImplicit): Handle decimal implicit numeric conversions as well. (Expression::InternalTypeConstructor): Used to invoke constructors on internal types for default promotions. (Unary::Emit): Implement special handling for the pre/post increment/decrement for overloaded operators, as they need to have the same semantics as the other operators. (Binary::ResolveOperator): ditto. (Invocation::ConversionExists): ditto. (UserImplicitCast::Resolve): ditto. 2001-09-26 Ravi Pratap * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded operator, return after emitting body. Regression tests pass again ! * expression.cs (ConvertImplicit): Take TypeContainer as first argument (Unary::ForceConversion, Binary::ForceConversion): Ditto. (Invocation::OverloadResolve): Ditto. (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto. * everywhere : update calls to the above methods accordingly. 2001-09-26 Miguel de Icaza * assign.cs (Assign): Make it inherit from ExpressionStatement. * expression.cs (ExpressionStatement): New base class used for expressions that can appear in statements, so that we can provide an alternate path to generate expression that do not leave a value on the stack. (Expression::Emit, and all the derivatives): We no longer return whether a value is left on the stack or not. Every expression after being emitted leaves a single value on the stack. * codegen.cs (EmitContext::EmitStatementExpression): Use the facilties of ExpressionStatement if possible. * cs-parser.jay: Update statement_expression. 2001-09-25 Miguel de Icaza * driver.cs: Change the wording of message 2001-09-25 Ravi Pratap * expression.cs (Binary::ResolveOperator): Had forgottten to set the type of the expression to the return type of the method if we have an overloaded operator match ! The regression tests pass again ! (Unary::ResolveOperator): Ditto. * expression.cs (Invocation::ConversionExists): Correct the member lookup to find "op_Implicit", not "implicit" ;-) (UserImplicitCast): New class to take care of user-defined implicit conversions. (ConvertImplicit, ForceConversion): Take TypeContainer argument * everywhere : Correct calls to the above accordingly. * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement. (ConvertImplicit): Do user-defined conversion if it exists. 2001-09-24 Miguel de Icaza * assign.cs: track location. (Resolve): Use implicit conversions on assignment. * literal.cs: Oops. Not good, Emit of short access values should pass (Bytes) or the wrong argument will be selected. * expression.cs (Unary::Emit): Emit code for -expr. (Unary::ResolveOperator): Handle `Substract' for non-constants (substract from zero from the non-constants). Deal with Doubles as well. (Expression::ConvertImplicitRequired): New routine that reports an error if no implicit conversion exists. (Invocation::OverloadResolve): Store the converted implicit expressions if we make them 2001-09-24 Ravi Pratap * class.cs (ConstructorInitializer): Take a Location argument. (ConstructorBaseInitializer): Same here. (ConstructorThisInitializer): Same here. * cs-parser.jay : Update all calls accordingly. * expression.cs (Unary, Binary, New): Take location argument. Update accordingly everywhere. * cs-parser.jay : Update all calls to the above to take a location argument. * class.cs : Ditto. 2001-09-24 Ravi Pratap * expression.cs (Invocation::BetterFunction): Take TypeContainer argument (Invocation::BetterConversion): Same here (Invocation::ConversionExists): Ditto. (Invocation::ConversionExists): Implement. 2001-09-22 Ravi Pratap * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503 Also take an additional TypeContainer argument. * All over : Pass in TypeContainer as argument to OverloadResolve. * typemanager.cs (CSharpName): Update to check for the string type and return that too. * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing a given method. 2001-09-21 Ravi Pratap * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec. (Invocation::BetterFunction): Implement. (Invocation::BetterConversion): Implement. (Invocation::ConversionExists): Skeleton, no implementation yet. Okay, things work fine ! 2001-09-21 Miguel de Icaza * typemanager.cs: declare and load enum_type, delegate_type and void_type. * expression.cs (Expression::Emit): Now emit returns a value that tells whether a value is left on the stack or not. This strategy might be reveted tomorrow with a mechanism that would address multiple assignments. (Expression::report118): Utility routine to report mismatches on the ExprClass. (Unary::Report23): Report impossible type/operator combination utility function. (Unary::IsIncrementableNumber): Whether the type can be incremented or decremented with add. (Unary::ResolveOperator): Also allow enumerations to be bitwise complemented. (Unary::ResolveOperator): Implement ++, !, ~, (Invocation::Emit): Deal with new Emit convetion. * All Expression derivatives: Updated their Emit method to return whether they leave values on the stack or not. * codegen.cs (CodeGen::EmitStatement): Pop values left on the stack for expressions that are statements. 2001-09-20 Miguel de Icaza * expression.cs (LValue): New interface. Must be implemented by LValue objects. (LocalVariableReference, ParameterReference, FieldExpr): Implement LValue interface. * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue interface for generating code, simplifies the code. 2001-09-20 Ravi Pratap * expression.cs (everywhere): Comment out return statements in ::Resolve methods to avoid the warnings. 2001-09-20 Miguel de Icaza * 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 * 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 * 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 * 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 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary. Move back code into TypeContainer::Populate. 2001-09-18 Ravi Pratap * 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 * 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 * 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 * 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 * rootcontext.cs: Fix bug: tree.Namespaces might be null. 2001-09-16 Ravi Pratap * 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 * 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 * 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 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to FamORAssem, not FamANDAssem. 2001-09-14 Miguel de Icaza * 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 * 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 * 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 * 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 * class.cs (TypeContainer::EmitField): Remove and move into (Field::Define): here and modify accordingly. (Field.FieldBuilder): New member. (TypeContainer::Populate): Update accordingly. (TypeContainer::FindMembers): Implement. 2001-09-13 Miguel de Icaza * statement.cs: (VariableInfo::VariableType): New field to be initialized with the full type once it is resolved. 2001-09-12 Miguel de Icaza * parameter.cs (GetParameterInfo): Use a type cache to compute things only once, and to reuse this information * expression.cs (LocalVariableReference::Emit): Implement. (OpcodeCast::Emit): fix. (ParameterReference::Resolve): Implement. (ParameterReference::Emit): Implement. * cs-parser.jay: Fix bug introduced by Ravi, variable initializers that are expressions need to stay as Expressions. * typemanager.cs (CSharpName): Returns the C# name of a type if possible. * expression.cs (Expression::ConvertImplicit): New function that implements implicit type conversions. (Expression::ImplicitReferenceConversion): Implements implicit reference conversions. (EmptyCast): New type for transparent casts. (OpcodeCast): New type for casts of types that are performed with a sequence of bytecodes. (BoxedCast): New type used for casting value types into reference types. Emits a box opcode. (Binary::DoNumericPromotions): Implements numeric promotions of and computation of the Binary::Type. (Binary::EmitBranchable): Optimization. (Binary::Emit): Implement code emission for expressions. * typemanager.cs (TypeManager): Added two new core types: sbyte and byte. 2001-09-12 Ravi Pratap * class.cs (TypeContainer::FindMembers): Method which does exactly what Type.FindMembers does, only we don't have to use reflection. No implementation yet. * typemanager.cs (typecontainers): New hashtable to hold the corresponding typecontainer objects as we need to get at them. (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer. * rootcontext.cs : Correspondingly modify called to AddUserType to pass the typecontainer object. * expression.cs (MemberLookup): Modify signature to take a RootContext object instead of just a Report object. 2001-09-11 Ravi Pratap * class.cs (Event::Define): Go back to using the prefixes "add_" and "remove_" (TypeContainer::Populate): Now define the delegates of the type too. (TypeContainer.Delegates): Property to access the list of delegates defined in the type. * delegates.cs (Delegate::Define): Implement partially. * modifiers.cs (TypeAttr): Handle more flags. 2001-09-11 Ravi Pratap * class.cs (Indexer::Define): Fix for loop iteration condition to be just < and not <= (Operator::Define): Re-write logic to get types by using the LookupType method instead of blindly doing a Type.GetType ! How stupid can I get ;-) ? (Indexer::Define): Ditto. (Event::Define): Ditto. (Property::Define): Ditto. 2001-09-10 Ravi Pratap * class.cs (TypeContainer::Populate): Now define operators too. (TypeContainer.Operators): New property to access the list of operators in a type. (Operator.OperatorMethodBuilder): New member to hold the method builder for the operator we are defining. (Operator::Define): Implement. 2001-09-10 Ravi Pratap * class.cs (Event::Define): Make the prefixes of the accessor methods addOn_ and removeOn_ * genericparser.cs (GenericParser::error): Overloaded method to handle the case of the location being passed in too. Ideally, this should go later since all error reporting should be done through the Report object. * class.cs (TypeContainer.Indexers): New property to access the list of indexers. (Populate): Iterate thru the indexers we have and define them too. (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders for the get and set accessors. (Indexer::Define): Implement. 2001-09-09 Miguel de Icaza * expression.cs (Binary::Resolve): Beginning of it. I scratched my previous implementation, did not work. * typemanager.cs: Add a couple of missing types (the longs). * literal.cs: Use TypeManager.bool_type instead of getting it. * expression.cs (EventExpr): New kind of expressions. (Expressio::ExprClassFromMemberInfo): finish 2001-09-08 Miguel de Icaza * assign.cs: Emit stores to static fields differently. 2001-09-08 Ravi Pratap * Merge in changes and adjust code to tackle conflicts. Backed out my code in Assign::Resolve ;-) 2001-09-08 Ravi Pratap * cs-parser.jay (CheckAttributeTarget): Modify call to error to use instead Report.Error and also pass in the location. (CSharpParser::Lexer): New readonly property to return the reference to the Tokenizer object. (declare_local_variables): Use Report.Error with location instead of plain old error. (CheckDef): Ditto. * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay. (Operator.CheckBinaryOperator): Ditto. * cs-parser.jay (operator_declarator): Update accordingly. * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error (CheckBinaryOperator): Same here. * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup on the name without any prefixes of namespace names etc. This is because we already might have something already fully qualified like 'System.Console.WriteLine' * assign.cs (Resolve): Begin implementation. Stuck ;-) 2001-09-07 Ravi Pratap * cs-tokenizer.cs (location): Return a string which also contains the file name. * expression.cs (ElementAccess): New class for expressions of the type 'element access.' (BaseAccess): New class for expressions of the type 'base access.' (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions respectively. * cs-parser.jay (element_access): Implement action. (base_access): Implement actions. (checked_expression, unchecked_expression): Implement. * cs-parser.jay (local_variable_type): Correct and implement. (type_suffixes, type_suffix_list, type_suffix): Implement actions. * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar. * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's name and the specifiers. * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of making them all public ;-) * cs-parser.jay (error): Remove entirely as we have an implementation in the base class anyways. 2001-09-07 Miguel de Icaza * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and PropertyExprs. (FieldExpr, PropertyExprs): New resolved expressions. (SimpleName::MemberStaticCheck): Perform static checks for access to non-static fields on static methods. Maybe this should be generalized for MemberAccesses. (SimpleName::ResolveSimpleName): More work on simple name resolution. * cs-parser.jay (primary_expression/qualified_identifier): track the parameter index. * codegen.cs (CodeGen::Save): Catch save exception, report error. (EmitContext::EmitBoolExpression): Chain to expression generation instead of temporary hack. (::EmitStatementExpression): Put generic expression code generation. * assign.cs (Assign::Emit): Implement variable assignments to local variables, parameters and fields. 2001-09-06 Miguel de Icaza * statement.cs (Block::GetVariableInfo): New method, returns the VariableInfo for a variable name in a block. (Block::GetVariableType): Implement in terms of GetVariableInfo * literal.cs (IntLiteral::Emit, FloatLiteral::Emit, DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement 2001-09-06 Ravi Pratap * cs-parser.jay (operator_declaration): Continue on my quest : update to take attributes argument. (event_declaration): Ditto. (enum_declaration): Ditto. (indexer_declaration): Ditto. * class.cs (Operator::Operator): Update constructor accordingly. (Event::Event): Ditto. * delegate.cs (Delegate::Delegate): Same here. * enum.cs (Enum::Enum): Same here. 2001-09-05 Ravi Pratap * cs-parser.jay (CheckAttributeTarget): Update to use the right error number. * ../tests/cs0658.cs : New file to demonstrate error 0658. * attribute.cs (Attributes): New class to encapsulate all attributes which were being passed around as an arraylist. (Attributes::AddAttribute): Method to add attribute sections. * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class. (struct_declaration): Update accordingly. (constant_declaration): Update. (field_declaration): Update. (method_header): Update. (fixed_parameter): Update. (parameter_array): Ditto. (property_declaration): Ditto. (destructor_declaration): Ditto. * class.cs (Struct::Struct): Update constructors accordingly. (Class::Class): Ditto. (Field::Field): Ditto. (Method::Method): Ditto. (Property::Property): Ditto. (TypeContainer::OptAttribute): update property's return type. * interface.cs (Interface.opt_attributes): New member. (Interface::Interface): Update to take the extra Attributes argument. * parameter.cs (Parameter::Parameter): Ditto. * constant.cs (Constant::Constant): Ditto. * interface.cs (InterfaceMemberBase): New OptAttributes field. (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take the attributes as a parameter. (InterfaceProperty): Update constructor call. (InterfaceEvent): Ditto. (InterfaceMethod): Ditto. (InterfaceIndexer): Ditto. * cs-parser.jay (interface_indexer_declaration): Update call to constructor to pass the attributes too. (interface_event_declaration): Ditto. (interface_property_declaration): Ditto. (interface_method_declaration): Ditto. (interface_declaration): Ditto. 2001-09-05 Miguel de Icaza * class.cs (Method::Define): Track the "static Main" definition to create an entry point. * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the EntryPoint if we find it. * codegen.cs (EmitContext::EmitInvocation): Emit invocations. (EmitContext::ig): Make this variable public. * driver.cs: Make the default output file be the first file name with the .exe extension. Detect empty compilations Handle various kinds of output targets. Handle --target and rename -t to --dumper. * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve' methods inherited from Expression return now an Expression. This will is used during the tree rewriting as we resolve them during semantic analysis. (Expression::MemberLookup): Implements the MemberLookup (7.3) from the spec. Missing entirely is the information about accessability of elements of it. (Expression::ExprClassFromMemberInfo): New constructor for Expressions that creates a fully initialized Expression based on a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or a Type. (Invocation::Resolve): Begin implementing resolution of invocations. * literal.cs (StringLiteral): Implement Emit. 2001-09-05 Ravi Pratap * cs-parser.jay (error): Add new modifier because we are hiding an inherited member. 2001-09-04 Ravi Pratap * cs-parser.jay (attribute_arguments): Implement actions. (attribute): Fix bug in production. Implement action. (attribute_list): Implement. (attribute_target): Implement. (attribute_target_specifier, opt_target_specifier): Implement (CheckAttributeTarget): New method to check if the attribute target is valid. (attribute_section): Implement. (opt_attributes): Implement. * attribute.cs : New file to handle attributes. (Attribute): Class to hold attribute info. * cs-parser.jay (opt_attribute_target_specifier): Remove production (attribute_section): Modify production to use 2 different rules to achieve the same thing. 1 s/r conflict down ! Clean out commented, useless, non-reducing dimension_separator rules. * class.cs (TypeContainer.attributes): New member to hold list of attributes for a type. (Struct::Struct): Modify to take one more argument, the attribute list. (Class::Class): Ditto. (Field::Field): Ditto. (Method::Method): Ditto. (Property::Property): Ditto. * cs-parser.jay (struct_declaration): Update constructor call to pass in the attributes too. (class_declaration): Ditto. (constant_declaration): Ditto. (field_declaration): Ditto. (method_header): Ditto. (fixed_parameter): Ditto. (parameter_array): Ditto. (property_declaration): Ditto. * constant.cs (Constant::Constant): Update constructor similarly. Use System.Collections. * parameter.cs (Parameter::Parameter): Update as above. 2001-09-02 Ravi Pratap * class.cs (TypeContainer::AddDelegate): New method to add a delegate. (TypeContainer.delegates): New member to hold list of delegates. * cs-parser.jay (delegate_declaration): Implement the action correctly this time as I seem to be on crack ;-) 2001-09-02 Miguel de Icaza * rootcontext.cs (RootContext::IsNamespace): new function, used to tell whether an identifier represents a namespace. * expression.cs (NamespaceExpr): A namespace expression, used only temporarly during expression resolution. (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName): utility functions to resolve names on expressions. 2001-09-01 Miguel de Icaza * codegen.cs: Add hook for StatementExpressions. * class.cs: Fix inverted test for static flag in methods. 2001-09-02 Ravi Pratap * class.cs (Operator::CheckUnaryOperator): Correct error number used to make it coincide with MS' number. (Operator::CheckBinaryOperator): Ditto. * ../errors/errors.txt : Remove error numbers added earlier. * ../errors/cs1019.cs : Test case for error # 1019 * ../errros/cs1020.cs : Test case for error # 1020 * cs-parser.jay : Clean out commented cruft. (dimension_separators, dimension_separator): Comment out. Ostensibly not used anywhere - non-reducing rule. (namespace_declarations): Non-reducing rule - comment out. * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused with TypeContainer::AddEnum. * delegate.cs : New file for delegate handling classes. (Delegate): Class for declaring delegates. * makefile : Update. * cs-parser.jay (delegate_declaration): Implement. 2001-09-01 Ravi Pratap * class.cs (Event::Define): Implement. (Event.EventBuilder): New member. * class.cs (TypeContainer::Populate): Update to define all enums and events we have. (Events): New property for the events arraylist we hold. Shouldn't we move to using readonly fields for all these cases ? 2001-08-31 Ravi Pratap * class.cs (Property): Revamp to use the convention of making fields readonly. Accordingly modify code elsewhere. * class.cs : Apply patch from Mr. Mandar for implementing the Define method of the Property class. * class.cs : Clean up applied patch and update references to variables etc. Fix trivial bug. (TypeContainer::Populate): Update to define all the properties we have. Also define all enumerations. * enum.cs (Define): Implement. 2001-08-31 Ravi Pratap * cs-parser.jay (overloadable_operator): The semantic value is an enum of the Operator class. (operator_declarator): Implement actions. (operator_declaration): Implement. * class.cs (Operator::CheckUnaryOperator): New static method to help in checking validity of definitions. (Operator::CheckBinaryOperator): Static method to check for binary operators (TypeContainer::AddOperator): New method to add an operator to a type. * cs-parser.jay (indexer_declaration): Added line to actually call the AddIndexer method so it gets added ;-) * ../errors/errors.txt : Update to include new error numbers. Are these numbers already taken care of by the MS compiler ? 2001-08-29 Ravi Pratap * class.cs (Operator): New class for operator declarations. (Operator::OpType): Enum for the various operators. 2001-08-29 Ravi Pratap * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We ostensibly handle this in semantic analysis. * cs-parser.jay (general_catch_clause): Comment out (specific_catch_clauses, specific_catch_clause): Ditto. (opt_general_catch_clause, opt_specific_catch_clauses): Ditto (catch_args, opt_catch_args): New productions. (catch_clause): Rewrite to use the new productions above (catch_clauses): Modify accordingly. (opt_catch_clauses): New production to use in try_statement (try_statement): Revamp. Basically, we get rid of one unnecessary rule and re-write the code in the actions to extract the specific and general catch clauses by being a little smart ;-) * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' ! Hooray, try and catch statements parse fine ! 2001-08-28 Ravi Pratap * statement.cs (Block::GetVariableType): Fix logic to extract the type string from the hashtable of variables. * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did I end up making that mistake ;-) (catch_clauses): Fixed gross error which made Key and Value of the DictionaryEntry the same : $1 !! 2001-08-28 Ravi Pratap * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove' * cs-parser.jay (event_declaration): Correct to remove the semicolon when the add and remove accessors are specified. 2001-08-28 Ravi Pratap * cs-parser.jay (IndexerDeclaration): New helper class to hold information about indexer_declarator. (indexer_declarator): Implement actions. (parsing_indexer): New local boolean used to keep track of whether we are parsing indexers or properties. This is necessary because implicit_parameters come into picture even for the get accessor in the case of an indexer. (get_accessor_declaration, set_accessor_declaration): Correspondingly modified. * class.cs (Indexer): New class for indexer declarations. (TypeContainer::AddIndexer): New method to add an indexer to a type. (TypeContainer::indexers): New member to hold list of indexers for the type. 2001-08-27 Ravi Pratap * cs-parser.jay (add_accessor_declaration): Implement action. (remove_accessor_declaration): Implement action. (event_accessors_declaration): Implement (variable_declarators): swap statements for first rule - trivial. * class.cs (Event): New class to hold information about event declarations. (TypeContainer::AddEvent): New method to add an event to a type (TypeContainer::events): New member to hold list of events. * cs-parser.jay (event_declaration): Implement actions. 2001-08-27 Ravi Pratap * cs-parser.jay (dim_separators): Implement. Make it a string concatenating all the commas together, just as they appear. (opt_dim_separators): Modify accordingly (rank_specifiers): Update accordingly. Basically do the same thing - instead, collect the brackets here. (opt_rank_sepcifiers): Modify accordingly. (array_type): Modify to actually return the complete type string instead of ignoring the rank_specifiers. (expression_list): Implement to collect the expressions (variable_initializer): Implement. We make it a list of expressions essentially so that we can handle the array_initializer case neatly too. (variable_initializer_list): Implement. (array_initializer): Make it a list of variable_initializers (opt_array_initializer): Modify accordingly. * expression.cs (New::NType): Add enumeration to help us keep track of whether we have an object/delegate creation or an array creation. (New:NewType, New::Rank, New::Indices, New::Initializers): New members to hold data about array creation. (New:New): Modify to update NewType (New:New): New Overloaded contructor for the array creation case. * cs-parser.jay (array_creation_expression): Implement to call the overloaded New constructor. 2001-08-26 Ravi Pratap * class.cs (TypeContainer::Constructors): Return member constructors instead of returning null. 2001-08-26 Miguel de Icaza * typemanager.cs (InitCoreTypes): Initialize the various core types after we have populated the type manager with the user defined types (this distinction will be important later while compiling corlib.dll) * expression.cs, literal.cs, assign.cs, constant.cs: Started work on Expression Classification. Now all expressions have a method `Resolve' and a method `Emit'. * codegen.cs, cs-parser.jay: Fixed the bug that stopped code generation from working. Also add some temporary debugging code. 2001-08-24 Miguel de Icaza * codegen.cs: Lots of code generation pieces. This is only the beginning, will continue tomorrow with more touches of polish. We handle the fundamentals of if, while, do, for, return. Others are trickier and I need to start working on invocations soon. * gen-treedump.cs: Bug fix, use s.Increment here instead of s.InitStatement. * codegen.cs (EmitContext): New struct, used during code emission to keep a context. Most of the code generation will be here. * cs-parser.jay: Add embedded blocks to the list of statements of this block. So code generation proceeds in a top down fashion. 2001-08-23 Miguel de Icaza * statement.cs: Add support for multiple child blocks. 2001-08-22 Miguel de Icaza * codegen.cs (EmitCode): New function, will emit the code for a Block of code given a TypeContainer and its ILGenerator. * statement.cs (Block): Standard public readonly optimization. (Block::Block constructors): Link children. (Block::Child): Child Linker. (Block::EmitVariables): Emits IL variable declarations. * class.cs: Drop support for MethodGroups here, delay until Semantic Analysis. (Method::): Applied the same simplification that I did before, and move from Properties to public readonly fields. (Method::ParameterTypes): Returns the parameter types for the function, and implements a cache that will be useful later when I do error checking and the semantic analysis on the methods is performed. (Constructor::GetCallingConvention): Renamed from CallingConvetion and made a method, optional argument tells whether this is a class or a structure to apply the `has-this' bit. (Method::GetCallingConvention): Implement, returns the calling convention. (Method::Define): Defines the type, a second pass is performed later to populate the methods. (Constructor::ParameterTypes): implement a cache similar to the one on Method::ParameterTypes, useful later when we do semantic analysis. (TypeContainer::EmitMethod): New method. Emits methods. * expression.cs: Removed MethodGroup class from here. * parameter.cs (Parameters::GetCallingConvention): new method. 2001-08-21 Miguel de Icaza * class.cs (TypeContainer::Populate): Drop RootContext from the argument. (Constructor::CallingConvention): Returns the calling convention. (Constructor::ParameterTypes): Returns the constructor parameter types. (TypeContainer::AddConstructor): Keep track of default constructor and the default static constructor. (Constructor::) Another class that starts using `public readonly' instead of properties. (Constructor::IsDefault): Whether this is a default constructor. (Field::) use readonly public fields instead of properties also. (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep track of static constructors; If none is used, turn on BeforeFieldInit in the TypeAttributes. * cs-parser.jay (opt_argument_list): now the return can be null for the cases where there are no arguments. (constructor_declarator): If there is no implicit `base' or `this', then invoke the default parent constructor. * modifiers.cs (MethodAttr): New static function maps a set of modifiers flags into a MethodAttributes enum (FieldAttr): renamed from `Map'. So now we have FieldAttr, MethodAttr, TypeAttr to represent the various mappings where the modifiers are used. (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly' 2001-08-19 Miguel de Icaza * parameter.cs (GetParameterInfo): Fix bug where there would be no method arguments. * interface.cs (PopulateIndexer): Implemented the code generator for interface indexers. 2001-08-17 Miguel de Icaza * interface.cs (InterfaceMemberBase): Now we track the new status here. (PopulateProperty): Implement property population. Woohoo! Got Methods and Properties going today. Removed all the properties for interfaces, and replaced them with `public readonly' fields. 2001-08-16 Miguel de Icaza * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty): initialize their hashtables/arraylists only when they are needed instead of doing this always. * parameter.cs: Handle refs and out parameters. * cs-parser.jay: Use an ArrayList to construct the arguments instead of the ParameterCollection, and then cast that to a Parameter[] array. * parameter.cs: Drop the use of ParameterCollection and use instead arrays of Parameters. (GetParameterInfo): Use the Type, not the Name when resolving types. 2001-08-13 Miguel de Icaza * parameter.cs: Eliminate the properties Name, Type and ModFlags, and instead use public readonly fields. * class.cs: Put back walking code for type containers. 2001-08-11 Miguel de Icaza * class.cs (MakeConstant): Code to define constants. * rootcontext.cs (LookupType): New function. Used to locate types 2001-08-08 Miguel de Icaza * rootcontext.cs: OH MY! My trick works! It is amazing how nice this System.Reflection code is. Kudos to Microsoft * typemanager.cs: Implement a type cache and avoid loading all types at boot time. Wrap in LookupType the internals. This made the compiler so much faster. Wow. I rule! * driver.cs: Make sure we always load mscorlib first (for debugging purposes, nothing really important). * Renamespaced things that were on `CSC' to `CIR'. Maybe I should have moved to `CSC' rather than `CIR'. Oh man! The confussion! * rootcontext.cs: Lookup types on their namespace; Lookup types on namespaces that have been imported using the `using' keyword. * class.cs (TypeContainer::TypeAttr): Virtualize. (Class::TypeAttr): Return attributes suitable for this bad boy. (Struct::TypeAttr): ditto. Handle nested classes. (TypeContainer::) Remove all the type visiting code, it is now replaced with the rootcontext.cs code * rootcontext.cs (GetClassBases): Added support for structs. 2001-08-06 Miguel de Icaza * interface.cs, statement.cs, class.cs, parameter.cs, rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay: Drop use of TypeRefs, and use strings instead. 2001-08-04 Miguel de Icaza * rootcontext.cs: * class.cs (Struct::Struct): set the SEALED flags after checking the modifiers. (TypeContainer::TypeAttr): new property, returns the TypeAttributes for a class. * cs-parser.jay (type_list): Oops, list production was creating a new list of base types. * rootcontext.cs (StdLib): New property. (GetInterfaceTypeByName): returns an interface by type name, and encapsulates error handling here. (GetInterfaces): simplified. (ResolveTree): Encapsulated all the tree resolution here. (CreateClass, GetClassBases, GetInterfaceOrClass): Create class types. * driver.cs: Add support for --nostdlib, to avoid loading the default assemblies. (Main): Do not put tree resolution here. * rootcontext.cs: Beginning of the class resolution. 2001-08-03 Miguel de Icaza * rootcontext.cs: Provide better error reporting. * cs-parser.jay (interface_base): set our $$ to be interfaces. * rootcontext.cs (CreateInterface): Handle the case where there are no parent interfaces. (CloseTypes): Routine to flush types at the end. (CreateInterface): Track types. (GetInterfaces): Returns an array of Types from the list of defined interfaces. * typemanager.c (AddUserType): Mechanism to track user types (puts the type on the global type hash, and allows us to close it at the end). 2001-08-02 Miguel de Icaza * tree.cs: Removed RecordType, added RecordClass, RecordStruct and RecordInterface instead. * cs-parser.jay: Updated to reflect changes above. * decl.cs (Definition): Keep track of the TypeBuilder type that represents this type here. Not sure we will use it in the long run, but wont hurt for now. * driver.cs: Smaller changes to accomodate the new code. Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly when done. * rootcontext.cs (CreateInterface): New method, used to create the System.TypeBuilder type for interfaces. (ResolveInterfaces): new entry point to resolve the interface hierarchy. (CodeGen): Property, used to keep track of the code generator. 2001-07-26 Miguel de Icaza * cs-parser.jay: Add a second production for delegate_declaration with `VOID'. (enum_body): Put an opt_comma here instead of putting it on enum_body or enum_member_declarations so we can handle trailing commas on enumeration members. Gets rid of a shift/reduce. (type_list): Need a COMMA in the middle. (indexer_declaration): Tell tokenizer to recognize get/set * Remove old targets. * Re-add the parser target. 2001-07-13 Simon Cozens * cs-parser.jay: Add precendence rules for a number of operators ot reduce the number of shift/reduce conflicts in the grammar. 2001-07-17 Miguel de Icaza * tree.cs: moved IGenerator interface and renamed it to ITreeDump and put it here. Get rid of old crufty code. * rootcontext.cs: Use this to keep track of the parsed representation and the defined types available to the program. * gen-treedump.cs: adjust for new convention. * type.cs: Split out the type manager, and the assembly builder from here. * typemanager.cs: the type manager will live here now. * cil-codegen.cs: And the code generator here. 2001-07-14 Sean MacIsaac * makefile: Fixed up for easy making. 2001-07-13 Simon Cozens * cs-parser.jay (rank_specifier): Remove a conflict by reordering the (unary_expression): Expand pre_increment_expression and post_decrement_expression to reduce a shift/reduce. 2001-07-11 Simon Cozens * cs-tokenizer.cs: Hex numbers should begin with a 0. Improve allow_keyword_as_indent name. 2001-06-19 Miguel de Icaza * Adjustments for Beta2. 2001-06-13 Miguel de Icaza * decl.cs: Added `Define' abstract method. (InTransit): new property, used to catch recursive definitions. * interface.cs: Implement `Define'. * modifiers.cs: Map Modifiers.constants to System.Reflection.TypeAttribute flags. * class.cs: Keep track of types and user-defined types. (BuilderInit): New method for creating an assembly (ResolveType): New function to launch the resolution process, only used by interfaces for now. * cs-parser.jay: Keep track of Classes, Structs and Interfaces that are inserted into the name space. 2001-06-08 Miguel de Icaza * ARGH. I have screwed up my tree so many times due to the use of rsync rather than using CVS. Going to fix this at once. * driver.cs: Objetify driver. Load assemblies, use assemblies to load types. 2001-06-07 Miguel de Icaza * Experiment successful: Use System.Type rather that our own version of Type. 2001-05-25 Miguel de Icaza * cs-parser.jay: Removed nsAliases from here. Use new namespaces, handle `using XXX;' * namespace.cs: Reimplemented namespace handling, use a recursive definition of the class. Now we can keep track of using clauses and catch invalid using clauses. 2001-05-24 Miguel de Icaza * gen-treedump.cs: Adapted for all the renaming. * expression.cs (Expression): this class now has a Type property which returns an expression Type. (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from `Type', as this has a different meaning now in the base 2001-05-22 Miguel de Icaza * interface.cs, class.cs: Removed from all the sources the references to signature computation, as we can not do method signature computation during the parsing time, as we are not trying to solve at that point distinguishing: class X { void a (Blah x) {} void a (NS.Blah x) {} } Which depending on the context might be valid or not, as we do not know if Blah is the same thing as NS.Blah at that point. * Redid everything so the code uses TypeRefs now instead of Types. TypeRefs are just temporary type placeholders, that need to be resolved. They initially have a pointer to a string and the current scope in which they are used. This is used later by the compiler to resolve the reference to an actual Type. * DeclSpace is no longer a CIR.Type, and neither are TypeContainers (Class and Struct) nor Interfaces nor Enums. They are all DeclSpaces, but no Types. * type.cs (TypeRefManager): This implements the TypeRef manager, which keeps track of all the types that need to be resolved after the parsing has finished. 2001-05-13 Miguel de Icaza * ARGH. We are going to have to store `foreach' as a class rather than resolving it, as we need to verify error 1579 after name resolution. *OR* we could keep a flag that says `This request to IEnumerator comes from a foreach statement' which we can then use to generate the error. 2001-05-10 Miguel de Icaza * class.cs (TypeContainer.AddMethod): we now add methods to the MethodGroup instead of the method hashtable. * expression.cs: Add MethodGroup abstraction, which gets us one step closer to the specification in the way we handle method declarations. * cs-parser.jay (primary_expression): qualified_identifier now tried to match up an identifier to a local variable reference or to a parameter reference. current_local_parameters is now a parser global variable that points to the current parameters for the block, used during name lookup. (property_declaration): Now creates an implicit `value' argument to the set accessor. 2001-05-09 Miguel de Icaza * parameter.cs: Do not use `param' arguments as part of the signature, per the spec. 2001-05-08 Miguel de Icaza * decl.cs: Base class for classes, structs and interfaces. This is the "Declaration Space" * cs-parser.jay: Use CheckDef for checking declaration errors instead of having one on each function. * class.cs: Factor out some code for handling error handling in accordance to the "Declarations" section in the "Basic Concepts" chapter in the ECMA C# spec. * interface.cs: Make all interface member classes derive from InterfaceMemberBase. 2001-05-07 Miguel de Icaza * Many things: all interfaces are parsed and generated in gen-treedump. Support for member variables, constructors, destructors, properties, constants is there. Beginning of the IL backend, but very little done, just there for testing purposes. 2001-04-29 Miguel de Icaza * cs-parser.jay: Fix labeled statement. * cs-tokenizer.cs (escape): Escape " and ' always. ref_line, ref_name: keep track of the line/filename as instructed by #line by the compiler. Parse #line. 2001-04-27 Miguel de Icaza * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum to match the values in System.CodeDOM. Divid renamed to Divide. * System.CodeDOM/CodeForLoopStatement.cs: Always have valid statements. (Statements.set): remove. * System.CodeDOM/CodeCatchClause.cs: always have a valid statements. * System.CodeDOM/CodeIfStatement.cs: trueStatements and falseStatements always have valid values. * cs-parser.jay: Use System.CodeDOM now.