本文整理汇总了C#中Mono.CSharp.MethodGroupExpr.CreateExpressionTree方法的典型用法代码示例。如果您正苦于以下问题:C# MethodGroupExpr.CreateExpressionTree方法的具体用法?C# MethodGroupExpr.CreateExpressionTree怎么用?C# MethodGroupExpr.CreateExpressionTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.MethodGroupExpr
的用法示例。
在下文中一共展示了MethodGroupExpr.CreateExpressionTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateExpressionTree
Expression CreateExpressionTree (ResolveContext ec, MethodGroupExpr method)
{
string method_name;
bool lift_arg = false;
switch (oper) {
case Operator.Addition:
if (method == null && ec.HasSet (ResolveContext.Options.CheckedScope) && !IsFloat (type))
method_name = "AddChecked";
else
method_name = "Add";
break;
case Operator.BitwiseAnd:
method_name = "And";
break;
case Operator.BitwiseOr:
method_name = "Or";
break;
case Operator.Division:
method_name = "Divide";
break;
case Operator.Equality:
method_name = "Equal";
lift_arg = true;
break;
case Operator.ExclusiveOr:
method_name = "ExclusiveOr";
break;
case Operator.GreaterThan:
method_name = "GreaterThan";
lift_arg = true;
break;
case Operator.GreaterThanOrEqual:
method_name = "GreaterThanOrEqual";
lift_arg = true;
break;
case Operator.Inequality:
method_name = "NotEqual";
lift_arg = true;
break;
case Operator.LeftShift:
method_name = "LeftShift";
break;
case Operator.LessThan:
method_name = "LessThan";
lift_arg = true;
break;
case Operator.LessThanOrEqual:
method_name = "LessThanOrEqual";
lift_arg = true;
break;
case Operator.LogicalAnd:
method_name = "AndAlso";
break;
case Operator.LogicalOr:
method_name = "OrElse";
break;
case Operator.Modulus:
method_name = "Modulo";
break;
case Operator.Multiply:
if (method == null && ec.HasSet (ResolveContext.Options.CheckedScope) && !IsFloat (type))
method_name = "MultiplyChecked";
else
method_name = "Multiply";
break;
case Operator.RightShift:
method_name = "RightShift";
break;
case Operator.Subtraction:
if (method == null && ec.HasSet (ResolveContext.Options.CheckedScope) && !IsFloat (type))
method_name = "SubtractChecked";
else
method_name = "Subtract";
break;
default:
throw new InternalErrorException ("Unknown expression tree binary operator " + oper);
}
Arguments args = new Arguments (2);
args.Add (new Argument (left.CreateExpressionTree (ec)));
args.Add (new Argument (right.CreateExpressionTree (ec)));
if (method != null) {
if (lift_arg)
args.Add (new Argument (new BoolConstant (false, loc)));
args.Add (new Argument (method.CreateExpressionTree (ec)));
}
return CreateExpressionFactoryCall (ec, method_name, args);
}