DynamicMetaObject GetFakeMetaObject (object value)
{
Type t = value == null ? typeof (object) : value.GetType ();
- var v = Expression.Variable (t);
- Expression e = Expression.Block (new[] { v }, Expression.Default (t));
+ Expression<Func<object>> et = () => value;
Expression restr = Expression.Constant (true);
- return new DynamicMetaObject (e, BindingRestrictions.GetExpressionRestriction (restr));
+ return new DynamicMetaObject (Expression.Convert (et.Body, t), BindingRestrictions.GetExpressionRestriction (restr));
}
public override DynamicMetaObject BindBinaryOperation (BinaryOperationBinder binder, DynamicMetaObject arg)
if (values.Count != expected.Length)
throw new ApplicationException (name + ": Array length does not match " + values.Count + " != " + expected.Length);
- for (int i = 0; i < expected.Length; i++)
- {
+ for (int i = 0; i < expected.Length; i++) {
Assert (flags.GetValue (expected[i]), flags.GetValue (values[i]), "flags");
}
}
Assert (binder.Operation, ExpressionType.Add, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.Add, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.LiteralConstant, null) // CSC bug?
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null)
}, "ArgumentInfo");
Assert (arg, Enum.A, "arg");
Assert (binder.Operation, ExpressionType.Add, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.LiteralConstant, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, null) },
"ArgumentInfo");
Assert (arg, 3, "arg");
d = checked (d + 3);
}
-
+
void BinaryAddChecked_2 (dynamic d, DynamicObjectMock mock)
{
mock.BinaryOperation = (binder, arg) => {
Assert (binder.Operation, ExpressionType.Add, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.LiteralConstant, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, null) },
"ArgumentInfo");
Assert (arg, 3, "arg");
checked {
r = () => d + 3;
}
-
+
r ();
}
Assert (binder.Operation, ExpressionType.AddAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.AddAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.And, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.AndAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.Divide, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.DivideAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.Equal, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.ExclusiveOr, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.ExclusiveOrAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.GreaterThan, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.GreaterThanOrEqual, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.LeftShift, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.LeftShiftAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.LessThan, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.LessThanOrEqual, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.Modulo, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.ModuloAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.Multiply, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.MultiplyAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.NotEqual, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 4, "arg");
Assert (binder.Operation, ExpressionType.Or, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 2, "arg");
Assert (binder.Operation, ExpressionType.OrAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 2, "arg");
Assert (binder.Operation, ExpressionType.RightShift, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.RightShiftAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.Subtract, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
Assert (binder.Operation, ExpressionType.SubtractAssign, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, 1, "arg");
mock.ConvertOperation = (binder) => {
Assert (binder.Explicit, false, "Explicit");
Assert (binder.Type, typeof (int), "Type");
- return 2;
+ return 1;
};
- object[] o = new object [2];
+ object[] o = new object[2];
d = o[d];
}
return (byte) 2;
};
- object b = checked((byte) d);
+ object b = checked ((byte) d);
}
void Convert_4 (dynamic d, DynamicObjectMock mock)
var g = new int[d];
}
+ void Convert_5 (dynamic d, DynamicObjectMock mock)
+ {
+ int counter = 0;
+ mock.ConvertOperation = (binder) => {
+ Assert (binder.Explicit, false, "Explicit");
+ Assert (binder.Type, typeof (System.Collections.IEnumerable), "Type");
+ return new object[] { 1 };
+ };
+
+ foreach (int v in d) {
+// Console.WriteLine (v);
+ }
+ }
+
void GetIndex_1 (dynamic d, DynamicObjectMock mock)
{
mock.GetIndexOperation = (binder, args) => {
// Assert (binder.CallingContext, typeof (Tester), "CallingContext");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
- Assert ((IList<object>)args, new object[] { 0 }, "args");
+ Assert ((IList<object>) args, new object[] { 0 }, "args");
};
- var o = d [0];
+ var o = d[0];
}
void GetIndex_2 (dynamic d, DynamicObjectMock mock)
// Assert (binder.CallingContext, typeof (Tester), "CallingContext");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
// Assert (binder.CallingContext, typeof (Tester), "CallingContext");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null)
- }, "ArgumentInfo");
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null)
+ }, "ArgumentInfo");
Assert ((IList<object>) args, new object[] { "foo", null }, "args");
};
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.NamedArgument | CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.LiteralConstant, "name") // CSC bug?
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.NamedArgument | CSharpArgumentInfoFlags.UseCompileTimeType, "name")
+ }, "ArgumentInfo");
+
+ Assert ((IList<object>) args, new object[] { typeof (bool), -1 }, "args");
+ };
+
+ d (typeof (bool), name: -1);
+ }
+
+ void Invoke_5 (dynamic d, DynamicObjectMock mock)
+ {
+ mock.InvokeOperation = (binder, args) => {
+ Assert (binder.CallInfo, new CallInfo (2, new string[] { "name" }), "CallInfo");
+ AssertArgument (binder, new[] {
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null),
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.NamedArgument | CSharpArgumentInfoFlags.UseCompileTimeType, "name")
}, "ArgumentInfo");
Assert ((IList<object>) args, new object[] { typeof (bool), -1 }, "args");
};
- d (typeof (bool), name:-1);
+ Action<object> a = (i) => { };
+ a (d);
}
void InvokeMember_1 (dynamic d, DynamicObjectMock mock)
// Assert (binder.CallingContext, typeof (Tester), "CallingContext");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null)},
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null)},
"ArgumentInfo");
// Assert (binder.Flags, CSharpCallFlags.None, "Flags");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null),
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.LiteralConstant, null),
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, null),
}, "ArgumentInfo");
// Assert (binder.Flags, CSharpCallFlags.SimpleNameCall, "Flags");
Assert (binder.IgnoreCase, false, "IgnoreCase");
// Assert (binder.CallingContext, typeof (Tester), "CallingContext");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null)},
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null)},
"ArgumentInfo");
Assert ((IList<object>) args, new object[] { 0 }, "args");
// Assert (binder.CallingContext, typeof (Tester), "CallingContext");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null)
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null)
}, "ArgumentInfo");
Assert ((IList<object>) args, new object[] { 2, 3 }, "args");
// Assert (binder.CallingContext, typeof (Tester), "CallingContext");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.LiteralConstant, null) // CSC bug?
- }, "ArgumentInfo");
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, null) // CSC bug?
+ }, "ArgumentInfo");
Assert (value, d_const, "value");
};
Assert (binder.Operation, ExpressionType.Equal, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, null, "arg");
Assert (binder.Operation, ExpressionType.NotEqual, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, null, "arg");
Assert (binder.Operation, ExpressionType.And, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, null, "arg");
return true;
};
- object g = d ? 1 :4;
+ object g = d ? 1 : 4;
}
void UnaryIsTrue_2 (dynamic d, DynamicObjectMock mock)
Assert (binder.Operation, ExpressionType.Or, "Operation");
AssertArgument (binder, new[] {
CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
+ CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null) },
"ArgumentInfo");
Assert (arg, null, "arg");
object x = d || null;
}
-
+
#pragma warning restore 168, 169, 219
static bool RunTest (MethodInfo test)
Console.Write ("Running test {0, -25}", test.Name);
try {
var d = new DynamicObjectMock ();
- test.Invoke (new Tester (), new [] { d, d });
+ test.Invoke (new Tester (), new[] { d, d });
if (d.HitCounter < 1)
Assert (true, false, "HitCounter");