public class UserOperatorCall : Expression {
public delegate Expression ExpressionTreeExpression (EmitContext ec, MethodGroupExpr mg);
- protected readonly ArrayList arguments;
+ protected readonly Arguments arguments;
protected readonly MethodGroupExpr mg;
readonly ExpressionTreeExpression expr_tree;
- public UserOperatorCall (MethodGroupExpr mg, ArrayList args, ExpressionTreeExpression expr_tree, Location loc)
+ public UserOperatorCall (MethodGroupExpr mg, Arguments args, ExpressionTreeExpression expr_tree, Location loc)
{
this.mg = mg;
this.arguments = args;
if (expr_tree != null)
return expr_tree (ec, mg);
- ArrayList args = new ArrayList (arguments.Count + 1);
- args.Add (new Argument (new NullLiteral (loc)));
- args.Add (new Argument (mg.CreateExpressionTree (ec)));
- foreach (Argument a in arguments) {
- args.Add (new Argument (a.Expr.CreateExpressionTree (ec)));
- }
+ Arguments args = Arguments.CreateForExpressionTree (ec, arguments,
+ new NullLiteral (loc),
+ mg.CreateExpressionTree (ec));
return CreateExpressionFactoryCall ("Call", args);
}
public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
{
- foreach (Argument a in arguments)
- a.Expr.MutateHoistedGenericType (storey);
-
+ arguments.MutateHoistedGenericType (storey);
mg.MutateHoistedGenericType (storey);
}
}
//
// Unary implements unary expressions.
//
- public class Unary : Expression {
+ public class Unary : Expression
+ {
public enum Operator : byte {
UnaryPlus, UnaryNegation, LogicalNot, OnesComplement,
AddressOf, TOP
throw new InternalErrorException ("Unknown unary operator " + Oper.ToString ());
}
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
args.Add (new Argument (Expr.CreateExpressionTree (ec)));
if (user_op != null)
args.Add (new Argument (user_op.CreateExpressionTree (ec)));
if (Expr == null)
return null;
+ if (Expr.Type == InternalType.Dynamic) {
+ Arguments args = new Arguments (1);
+ args.Add (new Argument (Expr));
+ return new DynamicUnaryConversion (GetOperatorExpressionTypeName (), args, loc).DoResolve (ec);
+ }
+
if (TypeManager.IsNullableType (Expr.Type))
return new Nullable.LiftedUnaryOperator (Oper, Expr).Resolve (ec);
oper, TypeManager.CSharpName (t));
}
+ //
+ // Converts operator to System.Linq.Expressions.ExpressionType enum name
+ //
+ string GetOperatorExpressionTypeName ()
+ {
+ switch (Oper) {
+ case Operator.UnaryPlus:
+ return "UnaryPlus";
+ default:
+ throw new NotImplementedException ("Unknown express type operator " + Oper.ToString ());
+ }
+ }
+
static bool IsFloat (Type t)
{
return t == TypeManager.float_type || t == TypeManager.double_type;
if (user_op == null)
return null;
- ArrayList args = new ArrayList (1);
+ Arguments args = new Arguments (1);
args.Add (new Argument (expr));
user_op = user_op.OverloadResolve (ec, ref args, false, expr.Location);
if (user_op == null)
return null;
- Expr = ((Argument) args [0]).Expr;
+ Expr = args [0].Expr;
return new UserOperatorCall (user_op, args, CreateExpressionTree, expr.Location);
}
// a property access or an indexer access
//
if (expr.eclass == ExprClass.Variable || expr.eclass == ExprClass.IndexerAccess || expr.eclass == ExprClass.PropertyAccess) {
- expr = expr.ResolveLValue (ec, expr, Location);
+ expr = expr.ResolveLValue (ec, expr);
} else {
Report.Error (1059, loc, "The operand of an increment or decrement operator must be a variable, property or indexer");
}
mg = MemberLookup (ec.ContainerType, type, op_name, MemberTypes.Method, AllBindingFlags, loc) as MethodGroupExpr;
if (mg != null) {
- ArrayList args = new ArrayList (1);
- args.Add (new Argument (expr, Argument.AType.Expression));
+ Arguments args = new Arguments (1);
+ args.Add (new Argument (expr));
mg = mg.OverloadResolve (ec, ref args, false, loc);
if (mg == null)
return null;
return null;
}
- if (expr.Type == TypeManager.anonymous_method_type) {
+ if (expr.Type == InternalType.AnonymousMethod) {
Report.Error (837, loc, "The `{0}' operator cannot be applied to a lambda expression or anonymous method",
OperatorName);
return null;
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
- args.Add (new Argument (expr.CreateExpressionTree (ec)));
- args.Add (new Argument (new TypeOf (probe_type_expr, loc)));
+ Arguments args = Arguments.CreateForExpressionTree (ec, null,
+ expr.CreateExpressionTree (ec),
+ new TypeOf (probe_type_expr, loc));
+
return CreateExpressionFactoryCall ("TypeIs", args);
}
return CreateConstantResult (TypeManager.IsEqual (d, t));
}
- if (!TypeManager.IsReferenceType (expr.Type))
+ if (TypeManager.IsGenericParameter (expr.Type))
expr = new BoxedCast (expr, d);
return this;
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
- args.Add (new Argument (expr.CreateExpressionTree (ec)));
- args.Add (new Argument (new TypeOf (probe_type_expr, loc)));
+ Arguments args = Arguments.CreateForExpressionTree (ec, null,
+ expr.CreateExpressionTree (ec),
+ new TypeOf (probe_type_expr, loc));
+
return CreateExpressionFactoryCall ("TypeAs", args);
}
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
args.Add (new Argument (this));
args.Add (new Argument (new TypeOf (new TypeExpression (type, loc), loc)));
return CreateExpressionFactoryCall ("Constant", args);
/// <summary>
/// Binary operators
/// </summary>
- public class Binary : Expression {
+ public class Binary : Expression, IDynamicBinder
+ {
protected class PredefinedOperator {
protected readonly Type left;
Error_OperatorCannotBeApplied (left, right, OperName (oper), loc);
}
+ //
+ // Converts operator to System.Linq.Expressions.ExpressionType enum name
+ //
+ string GetOperatorExpressionTypeName ()
+ {
+ switch (oper) {
+ case Operator.Addition:
+ return is_compound ? "AddAssign" : "Add";
+ case Operator.Equality:
+ return "Equal";
+ case Operator.Multiply:
+ return is_compound ? "MultiplyAssign" : "Multiply";
+ default:
+ throw new NotImplementedException ("Unknown expression type operator " + oper.ToString ());
+ }
+ }
+
static string GetOperatorMetadataName (Operator op)
{
CSharp.Operator.OpType op_type;
CheckUselessComparison (rc, left.Type);
}
+ if (left.Type == InternalType.Dynamic || right.Type == InternalType.Dynamic) {
+ Arguments args = new Arguments (2);
+ args.Add (new Argument (left));
+ args.Add (new Argument (right));
+ return new DynamicExpressionStatement (this, args, loc).Resolve (ec);
+ }
+
if (RootContext.Version >= LanguageVersion.ISO_2 &&
((TypeManager.IsNullableType (left.Type) && (right is NullLiteral || TypeManager.IsNullableType (right.Type) || TypeManager.IsValueType (right.Type))) ||
(TypeManager.IsValueType (left.Type) && right is NullLiteral) ||
Expression ResolveOperatorDelegate (EmitContext ec, Type l, Type r)
{
bool is_equality = (oper & Operator.EqualityMask) != 0;
- if (!TypeManager.IsEqual (l, r)) {
+ if (!TypeManager.IsEqual (l, r) && !TypeManager.IsVariantOf (r, l)) {
Expression tmp;
- if (right.eclass == ExprClass.MethodGroup || (r == TypeManager.anonymous_method_type && !is_equality)) {
+ if (right.eclass == ExprClass.MethodGroup || (r == InternalType.AnonymousMethod && !is_equality)) {
tmp = Convert.ImplicitConversionRequired (ec, right, l, loc);
if (tmp == null)
return null;
right = tmp;
r = right.Type;
- } else if (left.eclass == ExprClass.MethodGroup || (l == TypeManager.anonymous_method_type && !is_equality)) {
+ } else if (left.eclass == ExprClass.MethodGroup || (l == InternalType.AnonymousMethod && !is_equality)) {
tmp = Convert.ImplicitConversionRequired (ec, left, r, loc);
if (tmp == null)
return null;
return ResolveUserOperator (ec, l, r);
MethodInfo method;
- ArrayList args = new ArrayList (2);
- args.Add (new Argument (left, Argument.AType.Expression));
- args.Add (new Argument (right, Argument.AType.Expression));
+ Arguments args = new Arguments (2);
+ args.Add (new Argument (left));
+ args.Add (new Argument (right));
if (oper == Operator.Addition) {
if (TypeManager.delegate_combine_delegate_delegate == null) {
return null;
}
- if (l == TypeManager.anonymous_method_type)
+ if (l == InternalType.AnonymousMethod)
return null;
if (TypeManager.IsValueType (l))
return null;
}
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
Argument larg = new Argument (left);
args.Add (larg);
Argument rarg = new Argument (right);
target.left = left.Clone (clonectx);
target.right = right.Clone (clonectx);
}
+
+ public Expression CreateCallSiteBinder (EmitContext ec, Arguments args)
+ {
+ Arguments binder_args = new Arguments (4);
+
+ MemberAccess sle = new MemberAccess (new MemberAccess (
+ new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Linq", loc), "Expressions", loc);
+
+ MemberAccess binder = DynamicExpressionStatement.GetBinderNamespace (loc);
+
+ binder_args.Add (new Argument (new MemberAccess (new MemberAccess (sle, "ExpressionType", loc), GetOperatorExpressionTypeName (), loc)));
+ binder_args.Add (new Argument (new BoolLiteral (ec.CheckState, loc)));
+
+ bool member_access = left is DynamicMemberBinder || right is DynamicMemberBinder;
+ binder_args.Add (new Argument (new BoolLiteral (member_access, loc)));
+ binder_args.Add (new Argument (new ImplicitlyTypedArrayCreation ("[]", args.CreateDynamicBinderArguments (), loc)));
+
+ return new New (new MemberAccess (binder, "CSharpBinaryOperationBinder", loc), binder_args, loc);
+ }
public override Expression CreateExpressionTree (EmitContext ec)
{
throw new InternalErrorException ("Unknown expression tree binary operator " + oper);
}
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
args.Add (new Argument (left.CreateExpressionTree (ec)));
args.Add (new Argument (right.CreateExpressionTree (ec)));
if (method != null) {
// b, c, d... may be strings or objects.
//
public class StringConcat : Expression {
- ArrayList arguments;
+ Arguments arguments;
public StringConcat (EmitContext ec, Location loc, Expression left, Expression right)
{
type = TypeManager.string_type;
eclass = ExprClass.Value;
- arguments = new ArrayList (2);
+ arguments = new Arguments (2);
Append (ec, left);
Append (ec, right);
}
public override Expression CreateExpressionTree (EmitContext ec)
{
- Argument arg = (Argument) arguments [0];
- return CreateExpressionAddCall (ec, arg, arg.Expr.CreateExpressionTree (ec), 1);
+ Argument arg = arguments [0];
+ return CreateExpressionAddCall (ec, arg, arg.CreateExpressionTree (ec), 1);
}
//
//
Expression CreateExpressionAddCall (EmitContext ec, Argument left, Expression left_etree, int pos)
{
- ArrayList concat_args = new ArrayList (2);
- ArrayList add_args = new ArrayList (3);
+ Arguments concat_args = new Arguments (2);
+ Arguments add_args = new Arguments (3);
concat_args.Add (left);
add_args.Add (new Argument (left_etree));
concat_args.Add (arguments [pos]);
- add_args.Add (new Argument (((Argument) arguments [pos]).Expr.CreateExpressionTree (ec)));
+ add_args.Add (new Argument (arguments [pos].CreateExpressionTree (ec)));
MethodGroupExpr method = CreateConcatMemberExpression ().Resolve (ec) as MethodGroupExpr;
if (method == null)
StringConstant sc = operand as StringConstant;
if (sc != null) {
if (arguments.Count != 0) {
- Argument last_argument = (Argument) arguments [arguments.Count - 1];
+ Argument last_argument = arguments [arguments.Count - 1];
StringConstant last_expr_constant = last_argument.Expr as StringConstant;
if (last_expr_constant != null) {
last_argument.Expr = new StringConstant (
public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
{
- foreach (Argument a in arguments)
- a.Expr.MutateHoistedGenericType (storey);
+ arguments.MutateHoistedGenericType (storey);
}
}
readonly bool is_and;
Expression oper;
- public ConditionalLogicalOperator (MethodGroupExpr oper_method, ArrayList arguments,
+ public ConditionalLogicalOperator (MethodGroupExpr oper_method, Arguments arguments,
ExpressionTreeExpression expr_tree, bool is_and, Location loc)
: base (oper_method, arguments, expr_tree, loc)
{
//
// Emit and duplicate left argument
//
- ((Argument)arguments [0]).Expr.Emit (ec);
+ arguments [0].Expr.Emit (ec);
ig.Emit (OpCodes.Dup);
arguments.RemoveAt (0);
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (3);
+ Arguments args = new Arguments (3);
args.Add (new Argument (expr.CreateExpressionTree (ec)));
args.Add (new Argument (true_expr.CreateExpressionTree (ec)));
args.Add (new Argument (false_expr.CreateExpressionTree (ec)));
public override Expression DoResolve (EmitContext ec)
{
- expr = expr.Resolve (ec);
-
- if (expr == null)
- return null;
-
- if (expr.Type != TypeManager.bool_type){
- expr = Expression.ResolveBoolean (
- ec, expr, loc);
-
- if (expr == null)
- return null;
- }
+ expr = Expression.ResolveBoolean (ec, expr, loc);
Assign ass = expr as Assign;
if (ass != null && ass.Source is Constant) {
true_expr = true_expr.Resolve (ec);
false_expr = false_expr.Resolve (ec);
- if (true_expr == null || false_expr == null)
+ if (true_expr == null || false_expr == null || expr == null)
return null;
eclass = ExprClass.Value;
public Block Block;
public LocalInfo local_info;
bool is_readonly;
+ bool resolved; // TODO: merge with eclass
public LocalVariableReference (Block block, string name, Location l)
{
Block = block;
this.name = name;
loc = l;
- eclass = ExprClass.Variable;
}
//
HoistedVariable hv = GetHoistedVariable (ec);
if (hv != null)
return hv.CreateExpressionTree (ec);
-
- ArrayList arg = new ArrayList (1);
+
+ Arguments arg = new Arguments (1);
arg.Add (new Argument (this));
return CreateExpressionFactoryCall ("Constant", arg);
}
}
}
+ resolved |= ec.DoFlowAnalysis;
+ eclass = ExprClass.Variable;
return this;
}
public override Expression DoResolve (EmitContext ec)
{
+ if (resolved)
+ return this;
+
ResolveLocalInfo ();
local_info.Used = true;
return DoResolveBase (ec);
}
- override public Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ public override Expression DoResolveLValue (EmitContext ec, Expression right_side)
{
ResolveLocalInfo ();
}
}
- /// <summary>
- /// Used for arguments to New(), Invocation()
- /// </summary>
- public class Argument {
- public enum AType : byte {
- Expression,
- Ref,
- Out,
- ArgList
- };
-
- public static readonly Argument[] Empty = new Argument [0];
-
- public readonly AType ArgType;
- public Expression Expr;
-
- public Argument (Expression expr, AType type)
- {
- this.Expr = expr;
- this.ArgType = type;
- }
-
- public Argument (Expression expr)
- {
- this.Expr = expr;
- this.ArgType = AType.Expression;
- }
-
- public Type Type {
- get { return Expr.Type; }
- }
-
- public Parameter.Modifier Modifier
- {
- get {
- switch (ArgType) {
- case AType.Out:
- return Parameter.Modifier.OUT;
-
- case AType.Ref:
- return Parameter.Modifier.REF;
-
- default:
- return Parameter.Modifier.NONE;
- }
- }
- }
-
- public string GetSignatureForError ()
- {
- if (Expr.eclass == ExprClass.MethodGroup)
- return Expr.ExprClassName;
-
- return TypeManager.CSharpName (Expr.Type);
- }
-
- public bool ResolveMethodGroup (EmitContext ec)
- {
- SimpleName sn = Expr as SimpleName;
- if (sn != null)
- Expr = sn.GetMethodGroup ();
-
- // FIXME: csc doesn't report any error if you try to use `ref' or
- // `out' in a delegate creation expression.
- Expr = Expr.Resolve (ec, ResolveFlags.VariableOrValue | ResolveFlags.MethodGroup);
- if (Expr == null)
- return false;
-
- return true;
- }
-
- public bool Resolve (EmitContext ec, Location loc)
- {
- if (Expr == null)
- return false;
-
- using (ec.With (EmitContext.Flags.DoFlowAnalysis, true)) {
- // Verify that the argument is readable
- if (ArgType != AType.Out)
- Expr = Expr.Resolve (ec);
-
- // Verify that the argument is writeable
- if (Expr != null && (ArgType == AType.Out || ArgType == AType.Ref))
- Expr = Expr.ResolveLValue (ec, EmptyExpression.OutAccess, loc);
-
- return Expr != null;
- }
- }
-
- public void Emit (EmitContext ec)
- {
- if (ArgType != AType.Ref && ArgType != AType.Out) {
- Expr.Emit (ec);
- return;
- }
-
- AddressOp mode = AddressOp.Store;
- if (ArgType == AType.Ref)
- mode |= AddressOp.Load;
-
- IMemoryLocation ml = (IMemoryLocation) Expr;
- ParameterReference pr = ml as ParameterReference;
-
- //
- // ParameterReferences might already be references, so we want
- // to pass just the value
- //
- if (pr != null && pr.IsRef)
- pr.EmitLoad (ec);
- else
- ml.AddressOf (ec, mode);
- }
-
- public Argument Clone (CloneContext clonectx)
- {
- return new Argument (Expr.Clone (clonectx), ArgType);
- }
- }
-
/// <summary>
/// Invocation of methods or delegates.
/// </summary>
- public class Invocation : ExpressionStatement {
- protected ArrayList Arguments;
+ public class Invocation : ExpressionStatement
+ {
+ protected Arguments arguments;
protected Expression expr;
protected MethodGroupExpr mg;
bool arguments_resolved;
// arguments is an ArrayList, but we do not want to typecast,
// as it might be null.
//
- public Invocation (Expression expr, ArrayList arguments)
+ public Invocation (Expression expr, Arguments arguments)
{
SimpleName sn = expr as SimpleName;
if (sn != null)
else
this.expr = expr;
- Arguments = arguments;
+ this.arguments = arguments;
if (expr != null)
loc = expr.Location;
}
- public Invocation (Expression expr, ArrayList arguments, bool arguments_resolved)
+ public Invocation (Expression expr, Arguments arguments, bool arguments_resolved)
: this (expr, arguments)
{
this.arguments_resolved = arguments_resolved;
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args;
+ Arguments args;
//
// Special conversion for nested expression trees
//
if (TypeManager.DropGenericTypeArguments (type) == TypeManager.expression_type) {
- args = new ArrayList (1);
+ args = new Arguments (1);
args.Add (new Argument (this));
return CreateExpressionFactoryCall ("Quote", args);
}
- ExtensionMethodGroupExpr emg = mg as ExtensionMethodGroupExpr;
-
- int arg_count = Arguments == null ? 2 : Arguments.Count + 2;
- if (emg != null)
- ++arg_count;
- args = new ArrayList (arg_count);
-
- if (mg.IsInstance)
- args.Add (new Argument (mg.InstanceExpression.CreateExpressionTree (ec)));
- else
- args.Add (new Argument (new NullLiteral (loc)));
-
- args.Add (new Argument (mg.CreateExpressionTree (ec)));
+ Expression instance = mg.IsInstance ?
+ mg.InstanceExpression.CreateExpressionTree (ec) :
+ new NullLiteral (loc);
- //
- // Use extension argument when exists
- //
- if (emg != null) {
- Expression e = emg.ExtensionExpression.CreateExpressionTree (ec);
- if (e != null)
- args.Add (new Argument (e));
- }
-
- if (Arguments != null) {
- foreach (Argument a in Arguments) {
- Expression e = a.Expr.CreateExpressionTree (ec);
- if (e != null)
- args.Add (new Argument (e));
- }
- }
+ args = Arguments.CreateForExpressionTree (ec, arguments,
+ instance,
+ mg.CreateExpressionTree (ec));
if (mg.IsBase)
MemberExpr.Error_BaseAccessInExpressionTree (loc);
if (mg == null) {
Type expr_type = expr_resolved.Type;
+ if (expr_type == InternalType.Dynamic) {
+ Arguments args = ((DynamicMemberBinder) expr_resolved).Arguments;
+ return new DynamicInvocation (expr as MemberAccess, args, loc).Resolve (ec);
+ }
+
if (expr_type != null && TypeManager.IsDelegateType (expr_type)){
return (new DelegateInvocation (
- expr_resolved, Arguments, loc)).Resolve (ec);
+ expr_resolved, arguments, loc)).Resolve (ec);
}
MemberExpr me = expr_resolved as MemberExpr;
//
// Next, evaluate all the expressions in the argument list
//
- if (Arguments != null && !arguments_resolved) {
- for (int i = 0; i < Arguments.Count; ++i)
- {
- if (!((Argument)Arguments[i]).Resolve(ec, loc))
- return null;
- }
+ if (arguments != null && !arguments_resolved) {
+ arguments.Resolve (ec);
}
mg = DoResolveOverload (ec);
return null;
}
- if (Arguments == null && method.DeclaringType == TypeManager.object_type && method.Name == Destructor.MetadataName) {
+ if (arguments == null && method.DeclaringType == TypeManager.object_type && method.Name == Destructor.MetadataName) {
if (mg.IsBase)
Report.Error (250, loc, "Do not directly call your base class Finalize method. It is called automatically from your destructor");
else
protected virtual MethodGroupExpr DoResolveOverload (EmitContext ec)
{
- return mg.OverloadResolve (ec, ref Arguments, false, loc);
+ return mg.OverloadResolve (ec, ref arguments, false, loc);
}
public static bool IsSpecialMethodInvocation (MethodBase method, Location loc)
return true;
}
- /// <summary>
- /// Emits a list of resolved Arguments that are in the arguments
- /// ArrayList.
- ///
- /// The MethodBase argument might be null if the
- /// emission of the arguments is known not to contain
- /// a `params' field (for example in constructors or other routines
- /// that keep their arguments in this structure)
- ///
- /// if `dup_args' is true, a copy of the arguments will be left
- /// on the stack. If `dup_args' is true, you can specify `this_arg'
- /// which will be duplicated before any other args. Only EmitCall
- /// should be using this interface.
- /// </summary>
- public static void EmitArguments (EmitContext ec, ArrayList arguments, bool dup_args, LocalTemporary this_arg)
- {
- if (arguments == null)
- return;
-
- int top = arguments.Count;
- LocalTemporary [] temps = null;
-
- if (dup_args && top != 0)
- temps = new LocalTemporary [top];
-
- int argument_index = 0;
- Argument a;
- for (int i = 0; i < top; i++) {
- a = (Argument) arguments [argument_index++];
- a.Emit (ec);
- if (dup_args) {
- ec.ig.Emit (OpCodes.Dup);
- (temps [i] = new LocalTemporary (a.Type)).Store (ec);
- }
- }
-
- if (dup_args) {
- if (this_arg != null)
- this_arg.Emit (ec);
-
- for (int i = 0; i < top; i ++) {
- temps [i].Emit (ec);
- temps [i].Release (ec);
- }
- }
- }
-
- static Type[] GetVarargsTypes (MethodBase mb, ArrayList arguments)
+ static Type[] GetVarargsTypes (MethodBase mb, Arguments arguments)
{
AParametersCollection pd = TypeManager.GetParameterData (mb);
- Argument a = (Argument) arguments [pd.Count - 1];
+ Argument a = arguments [pd.Count - 1];
Arglist list = (Arglist) a.Expr;
return list.ArgumentTypes;
/// </remarks>
public static void EmitCall (EmitContext ec, bool is_base,
Expression instance_expr,
- MethodBase method, ArrayList Arguments, Location loc)
+ MethodBase method, Arguments Arguments, Location loc)
{
EmitCall (ec, is_base, instance_expr, method, Arguments, loc, false, false);
}
// only have been evaluated once.
public static void EmitCall (EmitContext ec, bool is_base,
Expression instance_expr,
- MethodBase method, ArrayList Arguments, Location loc,
+ MethodBase method, Arguments Arguments, Location loc,
bool dup_args, bool omit_args)
{
ILGenerator ig = ec.ig;
}
}
- if (!omit_args)
- EmitArguments (ec, Arguments, dup_args, this_arg);
+ if (!omit_args && Arguments != null)
+ Arguments.Emit (ec, dup_args, this_arg);
OpCode call_op;
if (is_static || struct_call || is_base || (this_call && !method.IsVirtual)) {
public override void Emit (EmitContext ec)
{
- mg.EmitCall (ec, Arguments);
+ mg.EmitCall (ec, arguments);
}
public override void EmitStatement (EmitContext ec)
{
Invocation target = (Invocation) t;
- if (Arguments != null) {
- target.Arguments = new ArrayList (Arguments.Count);
- foreach (Argument a in Arguments)
- target.Arguments.Add (a.Clone (clonectx));
- }
+ if (arguments != null)
+ target.arguments = arguments.Clone (clonectx);
target.expr = expr.Clone (clonectx);
}
public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
{
mg.MutateHoistedGenericType (storey);
- if (Arguments != null) {
- foreach (Argument a in Arguments)
- a.Expr.MutateHoistedGenericType (storey);
+ type = storey.MutateType (type);
+ if (arguments != null) {
+ arguments.MutateHoistedGenericType (storey);
}
}
}
/// Implements the new expression
/// </summary>
public class New : ExpressionStatement, IMemoryLocation {
- ArrayList Arguments;
+ Arguments Arguments;
//
// During bootstrap, it contains the RequestedType,
MethodGroupExpr method;
bool is_type_parameter;
-
- public New (Expression requested_type, ArrayList arguments, Location l)
+
+ public New (Expression requested_type, Arguments arguments, Location l)
{
RequestedType = requested_type;
Arguments = arguments;
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = Arguments == null ?
- new ArrayList (1) : new ArrayList (Arguments.Count + 1);
-
+ Arguments args;
if (method == null) {
+ args = new Arguments (1);
args.Add (new Argument (new TypeOf (new TypeExpression (type, loc), loc)));
} else {
- args.Add (new Argument (method.CreateExpressionTree (ec)));
- if (Arguments != null) {
- Expression expr;
- foreach (Argument a in Arguments) {
- expr = a.Expr.CreateExpressionTree (ec);
- if (expr != null)
- args.Add (new Argument (expr));
- }
- }
+ args = Arguments.CreateForExpressionTree (ec, Arguments,
+ method.CreateExpressionTree (ec));
}
return CreateExpressionFactoryCall ("New", args);
Expression ml = MemberLookupFinal (ec, type, type, ".ctor",
MemberTypes.Constructor, AllBindingFlags | BindingFlags.DeclaredOnly, loc);
- if (Arguments != null){
- foreach (Argument a in Arguments){
- if (!a.Resolve (ec, loc))
- return null;
- }
- }
+ if (Arguments != null)
+ Arguments.Resolve (ec);
if (ml == null)
return null;
vr.EmitLoad (ec);
}
- if (is_type_parameter)
- return DoEmitTypeParameter (ec);
-
- if (method != null)
- method.EmitArguments (ec, Arguments);
+ if (Arguments != null)
+ Arguments.Emit (ec);
if (is_value_type) {
if (method == null) {
return false;
}
}
+
+ if (is_type_parameter)
+ return DoEmitTypeParameter (ec);
ConstructorInfo ci = (ConstructorInfo) method;
#if MS_COMPATIBLE
ec.ig.Emit (OpCodes.Pop);
}
+ public bool IsDefaultValueType {
+ get {
+ return TypeManager.IsValueType (type) && !HasInitializer && Arguments == null;
+ }
+ }
+
public virtual bool HasInitializer {
get {
return false;
if (method == null) {
ec.ig.Emit (OpCodes.Initobj, type);
} else {
- method.EmitArguments (ec, Arguments);
+ if (Arguments != null)
+ Arguments.Emit (ec);
+
ec.ig.Emit (OpCodes.Call, (ConstructorInfo) method);
}
target.RequestedType = RequestedType.Clone (clonectx);
if (Arguments != null){
- target.Arguments = new ArrayList ();
- foreach (Argument a in Arguments){
- target.Arguments.Add (a.Clone (clonectx));
- }
+ target.Arguments = Arguments.Clone (clonectx);
}
}
if (method != null) {
method.MutateHoistedGenericType (storey);
if (Arguments != null) {
- foreach (Argument a in Arguments)
- a.Expr.MutateHoistedGenericType (storey);
+ Arguments.MutateHoistedGenericType (storey);
}
}
arguments = new ArrayList (exprs.Count);
foreach (Expression e in exprs) {
- arguments.Add (new Argument (e, Argument.AType.Expression));
+ arguments.Add (e);
num_arguments++;
}
}
bool CheckIndices (EmitContext ec, ArrayList probe, int idx, bool specified_dims, int child_bounds)
{
if (specified_dims) {
- Argument a = (Argument) arguments [idx];
-
- if (!a.Resolve (ec, loc))
+ Expression a = (Expression) arguments [idx];
+ a = a.Resolve (ec);
+ if (a == null)
return false;
- Constant c = a.Expr as Constant;
+ Constant c = a as Constant;
if (c != null) {
- c = c.ImplicitConversionRequired (ec, TypeManager.int32_type, a.Expr.Location);
+ c = c.ImplicitConversionRequired (ec, TypeManager.int32_type, a.Location);
}
if (c == null) {
- Report.Error (150, a.Expr.Location, "A constant value is expected");
+ Report.Error (150, a.Location, "A constant value is expected");
return false;
}
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args;
+ Arguments args;
if (array_data == null) {
- args = new ArrayList (arguments.Count + 1);
+ args = new Arguments (arguments.Count + 1);
args.Add (new Argument (new TypeOf (new TypeExpression (array_element_type, loc), loc)));
- foreach (Argument a in arguments) {
+ foreach (Expression a in arguments) {
if (arguments.Count == 1) {
- Constant c = a.Expr as Constant;
+ Constant c = a as Constant;
if (c.IsDefaultValue)
return CreateExpressionFactoryCall ("NewArrayInit", args);
}
- args.Add (new Argument (a.Expr.CreateExpressionTree (ec)));
+ args.Add (new Argument (a.CreateExpressionTree (ec)));
}
return CreateExpressionFactoryCall ("NewArrayBounds", args);
return null;
}
- args = new ArrayList (array_data == null ? 1 : array_data.Count + 1);
+ args = new Arguments (array_data == null ? 1 : array_data.Count + 1);
args.Add (new Argument (new TypeOf (new TypeExpression (array_element_type, loc), loc)));
if (array_data != null) {
for (int i = 0; i < array_data.Count; ++i) {
for (ArrayList probe = initializers; probe != null;) {
if (probe.Count > 0 && probe [0] is ArrayList) {
Expression e = new IntConstant (probe.Count, Location.Null);
- arguments.Add (new Argument (e, Argument.AType.Expression));
+ arguments.Add (e);
bounds [i++] = probe.Count;
} else {
Expression e = new IntConstant (probe.Count, Location.Null);
- arguments.Add (new Argument (e, Argument.AType.Expression));
+ arguments.Add (e);
bounds [i++] = probe.Count;
return;
if (!ResolveInitializers (ec))
return null;
- foreach (Argument a in arguments){
- if (!a.Resolve (ec, loc))
+ for (int i = 0; i < arguments.Count; ++i) {
+ Expression e = ((Expression) arguments[i]).Resolve (ec);
+ if (e == null)
continue;
- a.Expr = ConvertExpressionToArrayIndex (ec, a.Expr);
+ arguments [i] = ConvertExpressionToArrayIndex (ec, e);
}
eclass = ExprClass.Value;
array_element_type = storey.MutateType (array_element_type);
type = storey.MutateType (type);
if (arguments != null) {
- foreach (Argument a in arguments)
- a.Expr.MutateHoistedGenericType (storey);
+ foreach (Expression e in arguments)
+ e.MutateHoistedGenericType (storey);
}
if (array_data != null) {
first_emit_temp.Store (ec);
}
- foreach (Argument a in arguments)
- a.Emit (ec);
+ foreach (Expression e in arguments)
+ e.Emit (ec);
if (arguments.Count == 1)
ig.Emit (OpCodes.Newarr, array_element_type);
}
if (array_data == null) {
- Constant c = (Constant)((Argument)arguments [0]).Expr;
+ Constant c = (Constant) arguments [0];
if (c.IsDefaultValue) {
value = Array.CreateInstance (array_element_type, 0);
return true;
if (arguments != null){
target.arguments = new ArrayList (arguments.Count);
- foreach (Argument a in arguments)
- target.arguments.Add (a.Clone (clonectx));
+ foreach (Expression e in arguments)
+ target.arguments.Add (e.Clone (clonectx));
}
if (initializers != null){
return null;
if (array_element_type == null || array_element_type == TypeManager.null_type ||
- array_element_type == TypeManager.void_type || array_element_type == TypeManager.anonymous_method_type ||
+ array_element_type == TypeManager.void_type || array_element_type == InternalType.AnonymousMethod ||
arguments.Count != dimensions) {
Error_NoBestType ();
return null;
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (1);
+ Arguments args = new Arguments (1);
args.Add (new Argument (this));
// Use typeless constant for ldarg.0 to save some
public override Expression DoResolve (EmitContext ec)
{
eclass = ExprClass.Variable;
- type = typeof (ArglistAccess);
+ type = TypeManager.runtime_argument_handle_type;
if (ec.IsInFieldInitializer || !ec.CurrentBlock.Toplevel.Parameters.HasArglist)
{
/// <summary>
/// Represents the `__arglist (....)' construct
/// </summary>
- public class Arglist : Expression
+ class Arglist : Expression
{
- Argument[] Arguments;
+ Arguments Arguments;
public Arglist (Location loc)
- : this (Argument.Empty, loc)
+ : this (null, loc)
{
}
- public Arglist (Argument[] args, Location l)
+ public Arglist (Arguments args, Location l)
{
Arguments = args;
loc = l;
}
public Type[] ArgumentTypes {
- get {
- Type[] retval = new Type [Arguments.Length];
- for (int i = 0; i < Arguments.Length; i++)
- retval [i] = Arguments [i].Type;
- return retval;
- }
+ get {
+ if (Arguments == null)
+ return Type.EmptyTypes;
+
+ Type[] retval = new Type [Arguments.Count];
+ for (int i = 0; i < retval.Length; i++)
+ retval [i] = Arguments [i].Expr.Type;
+
+ return retval;
+ }
}
public override Expression CreateExpressionTree (EmitContext ec)
public override Expression DoResolve (EmitContext ec)
{
eclass = ExprClass.Variable;
- type = typeof (ArglistAccess);
-
- foreach (Argument arg in Arguments) {
- if (!arg.Resolve (ec, loc))
- return null;
- }
+ type = InternalType.Arglist;
+ if (Arguments != null)
+ Arguments.Resolve (ec);
return this;
}
public override void Emit (EmitContext ec)
{
- foreach (Argument arg in Arguments)
- arg.Emit (ec);
+ if (Arguments != null)
+ Arguments.Emit (ec);
}
public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
{
- foreach (Argument arg in Arguments)
- arg.Expr.MutateHoistedGenericType (storey);
+ if (Arguments != null)
+ Arguments.MutateHoistedGenericType (storey);
}
protected override void CloneTo (CloneContext clonectx, Expression t)
{
Arglist target = (Arglist) t;
- target.Arguments = new Argument [Arguments.Length];
- for (int i = 0; i < Arguments.Length; i++)
- target.Arguments [i] = Arguments [i].Clone (clonectx);
+ if (Arguments != null)
+ target.Arguments = Arguments.Clone (clonectx);
}
}
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
args.Add (new Argument (this));
args.Add (new Argument (new TypeOf (new TypeExpression (type, loc), loc)));
return CreateExpressionFactoryCall ("Constant", args);
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
args.Add (new Argument (this));
args.Add (new Argument (new TypeOf (new TypeExpression (type, loc), loc)));
return CreateExpressionFactoryCall ("Constant", args);
}
Type expr_type = expr_resolved.Type;
+ if (expr_type == InternalType.Dynamic) {
+ Arguments args = new Arguments (2);
+ args.Add (new Argument (expr_resolved.Resolve (ec)));
+ if (right_side != null)
+ args.Add (new Argument (right_side));
+
+ return new DynamicMemberBinder (right_side != null, Name, args, loc).Resolve (ec);
+ }
+
if (expr_type.IsPointer || expr_type == TypeManager.void_type ||
- expr_type == TypeManager.null_type || expr_type == TypeManager.anonymous_method_type) {
+ expr_type == TypeManager.null_type || expr_type == InternalType.AnonymousMethod) {
Unary.Error_OperatorCannotBeApplied (loc, ".", expr_type);
return null;
}
/// IndexerAccess, ArrayAccess or a PointerArithmetic.
/// </summary>
public class ElementAccess : Expression {
- public ArrayList Arguments;
+ public Arguments Arguments;
public Expression Expr;
-
- public ElementAccess (Expression e, ArrayList e_list)
+
+ public ElementAccess (Expression e, Arguments args)
{
Expr = e;
loc = e.Location;
-
- if (e_list == null)
- return;
-
- Arguments = new ArrayList (e_list.Count);
- foreach (Expression tmp in e_list)
- Arguments.Add (new Argument (tmp, Argument.AType.Expression));
+ this.Arguments = args;
}
bool CommonResolve (EmitContext ec)
{
Expr = Expr.Resolve (ec);
- if (Arguments == null)
- return false;
-
- foreach (Argument a in Arguments){
- if (!a.Resolve (ec, loc))
- return false;
- }
+ if (Arguments != null)
+ Arguments.Resolve (ec);
return Expr != null;
}
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (Arguments.Count + 1);
- args.Add (new Argument (Expr.CreateExpressionTree (ec)));
- foreach (Argument a in Arguments)
- args.Add (new Argument (a.Expr.CreateExpressionTree (ec)));
+ Arguments args = Arguments.CreateForExpressionTree (ec, Arguments,
+ Expr.CreateExpressionTree (ec));
return CreateExpressionFactoryCall ("ArrayIndex", args);
}
return null;
}
- Expression p = new PointerArithmetic (Binary.Operator.Addition, Expr, ((Argument) Arguments [0]).Expr, t, loc).Resolve (ec);
+ if (Arguments [0] is NamedArgument)
+ Error_NamedArgument ((NamedArgument) Arguments[0]);
+
+ Expression p = new PointerArithmetic (Binary.Operator.Addition, Expr, Arguments [0].Expr, t, loc).Resolve (ec);
if (p == null)
return null;
return new Indirection (p, loc).Resolve (ec);
if (t.IsPointer)
return MakePointerAccess (ec, t);
+ if (t == InternalType.Dynamic) {
+ Arguments args = new Arguments (Arguments.Count + 1);
+ args.Add (new Argument (Expr));
+ args.AddRange (Arguments);
+ return new DynamicIndexBinder (false, args, loc).Resolve (ec);
+ }
+
FieldExpr fe = Expr as FieldExpr;
if (fe != null) {
IFixedBuffer ff = AttributeTester.GetFixedBuffer (fe.FieldInfo);
if (type.IsPointer)
return MakePointerAccess (ec, type);
+ if (type == InternalType.Dynamic) {
+ Arguments args = new Arguments (Arguments.Count + 2);
+ args.Add (new Argument (Expr));
+ args.AddRange (Arguments);
+ args.Add (new Argument (right_side));
+ return new DynamicIndexBinder (true, args, loc).Resolve (ec);
+ }
+
if (Expr.eclass != ExprClass.Variable && TypeManager.IsStruct (type))
Error_CannotModifyIntermediateExpressionValue (ec);
throw new Exception ("Should never be reached");
}
+ public static void Error_NamedArgument (NamedArgument na)
+ {
+ Report.Error (1742, na.Name.Location, "An element access expression cannot use named argument");
+ }
+
public override string GetSignatureForError ()
{
return Expr.GetSignatureForError ();
ElementAccess target = (ElementAccess) t;
target.Expr = Expr.Clone (clonectx);
- target.Arguments = new ArrayList (Arguments.Count);
- foreach (Argument a in Arguments)
- target.Arguments.Add (a.Clone (clonectx));
+ if (Arguments != null)
+ target.Arguments = Arguments.Clone (clonectx);
}
}
}
foreach (Argument a in ea.Arguments) {
+ if (a is NamedArgument)
+ ElementAccess.Error_NamedArgument ((NamedArgument) a);
+
a.Expr = ConvertExpressionToArrayIndex (ec, a.Expr);
}
ea.Expr.Emit (ec);
for (int i = 0; i < ea.Arguments.Count; ++i) {
- ((Argument)ea.Arguments [i]).Emit (ec);
+ ea.Arguments [i].Emit (ec);
}
}
protected Type indexer_type;
protected Type current_type;
protected Expression instance_expr;
- protected ArrayList arguments;
+ protected Arguments arguments;
public IndexerAccess (ElementAccess ea, Location loc)
: this (ea.Expr, false, loc)
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (arguments.Count + 2);
- args.Add (new Argument (instance_expr.CreateExpressionTree (ec)));
- args.Add (new Argument (new TypeOfMethodInfo (get, loc)));
- foreach (Argument a in arguments)
- args.Add (new Argument (a.Expr.CreateExpressionTree (ec)));
+ Arguments args = Arguments.CreateForExpressionTree (ec, arguments,
+ instance_expr.CreateExpressionTree (ec),
+ new TypeOfMethodInfo (get, loc));
return CreateExpressionFactoryCall ("Call", args);
}
value = temp;
}
- arguments.Add (new Argument (value, Argument.AType.Expression));
+ if (!prepared)
+ arguments.Add (new Argument (value));
+
Invocation.EmitCall (ec, is_base_indexer, instance_expr, set, arguments, loc, false, prepared);
if (temp != null) {
set = storey.MutateGenericMethod (set);
instance_expr.MutateHoistedGenericType (storey);
- foreach (Argument a in arguments)
- a.Expr.MutateHoistedGenericType (storey);
+ if (arguments != null)
+ arguments.MutateHoistedGenericType (storey);
type = storey.MutateType (type);
}
{
IndexerAccess target = (IndexerAccess) t;
- if (arguments != null){
- target.arguments = new ArrayList ();
- foreach (Argument a in arguments)
- target.arguments.Add (a.Clone (clonectx));
- }
+ if (arguments != null)
+ target.arguments = arguments.Clone (clonectx);
+
if (instance_expr != null)
target.instance_expr = instance_expr.Clone (clonectx);
}
/// The base indexer operator
/// </summary>
public class BaseIndexerAccess : IndexerAccess {
- public BaseIndexerAccess (ArrayList args, Location loc)
+ public BaseIndexerAccess (Arguments args, Location loc)
: base (null, true, loc)
{
- arguments = new ArrayList ();
- foreach (Expression tmp in args)
- arguments.Add (new Argument (tmp, Argument.AType.Expression));
+ this.arguments = args;
}
protected override bool CommonResolve (EmitContext ec)
current_type = ec.ContainerType.BaseType;
indexer_type = current_type;
- foreach (Argument a in arguments){
- if (!a.Resolve (ec, loc))
- return false;
- }
+ arguments.Resolve (ec);
return true;
}
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (3);
+ Arguments args = new Arguments (3);
args.Add (new Argument (source.CreateExpressionTree (ec)));
args.Add (new Argument (new TypeOf (new TypeExpression (type, loc), loc)));
args.Add (new Argument (new TypeOfMethodInfo (method, loc)));
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
args.Add (new Argument (child.CreateExpressionTree (ec)));
args.Add (new Argument (new TypeOf (new TypeExpression (TypeManager.int32_type, loc), loc)));
return CreateExpressionFactoryCall ("ConvertChecked", args);
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
FieldExpr fe = target as FieldExpr;
if (fe != null)
args.Add (new Argument (fe.CreateTypeOfExpression ()));
//
// A collection initializer expression
//
- public class CollectionElementInitializer : Invocation
+ class CollectionElementInitializer : Invocation
{
public class ElementInitializerArgument : Argument
{
}
public CollectionElementInitializer (Expression argument)
- : base (null, new ArrayList (1), true)
+ : base (null, new Arguments (1), true)
{
- Arguments.Add (argument);
+ base.arguments.Add (new ElementInitializerArgument (argument));
this.loc = argument.Location;
}
public CollectionElementInitializer (ArrayList arguments, Location loc)
- : base (null, arguments, true)
+ : base (null, new Arguments (arguments.Count), true)
{
+ foreach (Expression e in arguments)
+ base.arguments.Add (new ElementInitializerArgument (e));
+
this.loc = loc;
}
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
args.Add (new Argument (mg.CreateExpressionTree (ec)));
- ArrayList expr_initializers = new ArrayList (Arguments.Count);
- foreach (Argument a in Arguments)
- expr_initializers.Add (a.Expr.CreateExpressionTree (ec));
+ ArrayList expr_initializers = new ArrayList (arguments.Count);
+ foreach (Argument a in arguments)
+ expr_initializers.Add (a.CreateExpressionTree (ec));
args.Add (new Argument (new ArrayCreation (
CreateExpressionTypeExpression (loc), "[]", expr_initializers, loc)));
protected override void CloneTo (CloneContext clonectx, Expression t)
{
CollectionElementInitializer target = (CollectionElementInitializer) t;
-
- target.Arguments = new ArrayList (Arguments.Count);
- foreach (Expression e in Arguments)
- target.Arguments.Add (e.Clone (clonectx));
+ if (arguments != null)
+ target.arguments = arguments.Clone (clonectx);
}
public override Expression DoResolve (EmitContext ec)
// TODO: We could call a constructor which takes element count argument,
// for known types like List<T>, Dictionary<T, U>
-
- for (int i = 0; i < Arguments.Count; ++i) {
- Expression expr = Arguments [i] as Expression;
- if (expr == null)
- return null;
- expr = expr.Resolve (ec);
- if (expr == null)
- return null;
-
- Arguments [i] = new ElementInitializerArgument (expr);
- }
+ arguments.Resolve (ec);
base.expr = new AddMemberAccess (ec.CurrentInitializerVariable, loc);
CollectionOrObjectInitializers initializers;
IMemoryLocation instance;
- public NewInitialize (Expression requested_type, ArrayList arguments, CollectionOrObjectInitializers initializers, Location l)
+ public NewInitialize (Expression requested_type, Arguments arguments, CollectionOrObjectInitializers initializers, Location l)
: base (requested_type, arguments, l)
{
this.initializers = initializers;
public override Expression CreateExpressionTree (EmitContext ec)
{
- ArrayList args = new ArrayList (2);
+ Arguments args = new Arguments (2);
args.Add (new Argument (base.CreateExpressionTree (ec)));
if (!initializers.IsEmpty)
args.Add (new Argument (initializers.CreateExpressionTree (ec)));
}
bool error = false;
- ArrayList arguments = new ArrayList (parameters.Count);
+ Arguments arguments = new Arguments (parameters.Count);
TypeExpression [] t_args = new TypeExpression [parameters.Count];
for (int i = 0; i < parameters.Count; ++i) {
Expression e = ((AnonymousTypeParameter) parameters [i]).Resolve (ec);
type = e.Type;
if (type == TypeManager.void_type || type == TypeManager.null_type ||
- type == TypeManager.anonymous_method_type || type.IsPointer) {
+ type == InternalType.AnonymousMethod || type.IsPointer) {
Error_InvalidInitializer (e.GetSignatureForError ());
return null;
}