Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 11076 lines (7346 sloc) 380 KB
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
(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
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
(GetConversionOperators): Removed the hack that called op_True
(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
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
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
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
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 `' 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
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
* ecore.cs: Use an enumconstant here instead of wrapping with
* 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 (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
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
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
* 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
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
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
* 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
* 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
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
* 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
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
* 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
(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
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
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
* 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
* 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
* 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
* 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
(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;
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
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
(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
* 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
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 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
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
* typemanager.cs (IsUnmanagedtype): Do not recursively check
fields if the fields are static. We only need to check instance
* 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
* 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
* 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
(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 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
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 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 that fixes the order in which we emit our
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
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
* 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
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
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
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
* 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
(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 (
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
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
* 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
(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
(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
* 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
(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
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
* 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
(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
* 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
(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
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
(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
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
* 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
* 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
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
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
* 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
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
* 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
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
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
* 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
(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
* 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
(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
* 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,
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
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
(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
* 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
* 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
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
* 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
(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
(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
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
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
* 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
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
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
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 <>