本文整理汇总了C#中Microsoft.CSharp.RuntimeBinder.Semantics.EXPR.isBIN方法的典型用法代码示例。如果您正苦于以下问题:C# EXPR.isBIN方法的具体用法?C# EXPR.isBIN怎么用?C# EXPR.isBIN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CSharp.RuntimeBinder.Semantics.EXPR
的用法示例。
在下文中一共展示了EXPR.isBIN方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rewrite
/////////////////////////////////////////////////////////////////////////////////
public static Expression Rewrite(TypeManager typeManager, EXPR pExpr, IEnumerable<Expression> listOfParameters)
{
ExpressionTreeCallRewriter rewriter = new ExpressionTreeCallRewriter(typeManager, listOfParameters);
// We should have a EXPRBINOP thats an EK_SEQUENCE. The RHS of our sequence
// should be a call to PM_EXPRESSION_LAMBDA. The LHS of our sequence is the
// set of declarations for the parameters that we'll need.
// Assert all of these first, and then unwrap them.
Debug.Assert(pExpr != null);
Debug.Assert(pExpr.isBIN());
Debug.Assert(pExpr.kind == ExpressionKind.EK_SEQUENCE);
Debug.Assert(pExpr.asBIN().GetOptionalRightChild() != null);
Debug.Assert(pExpr.asBIN().GetOptionalRightChild().isCALL());
Debug.Assert(pExpr.asBIN().GetOptionalRightChild().asCALL().PredefinedMethod == PREDEFMETH.PM_EXPRESSION_LAMBDA);
Debug.Assert(pExpr.asBIN().GetOptionalLeftChild() != null);
// Visit the left to generate the parameter construction.
rewriter.Visit(pExpr.asBIN().GetOptionalLeftChild());
EXPRCALL call = pExpr.asBIN().GetOptionalRightChild().asCALL();
ExpressionEXPR e = rewriter.Visit(call) as ExpressionEXPR;
return e.Expression;
}
示例2: VisitChildren
protected void VisitChildren(EXPR pExpr)
{
Debug.Assert(pExpr != null);
EXPR exprRet = null;
// Lists are a special case. We treat a list not as a
// binary node but rather as a node with n children.
if (pExpr.isLIST())
{
EXPRLIST list = pExpr.asLIST();
while (true)
{
list.SetOptionalElement(Visit(list.GetOptionalElement()));
if (list.GetOptionalNextListNode() == null)
{
return;
}
if (!list.GetOptionalNextListNode().isLIST())
{
list.SetOptionalNextListNode(Visit(list.GetOptionalNextListNode()));
return;
}
list = list.GetOptionalNextListNode().asLIST();
}
}
switch (pExpr.kind)
{
default:
if (pExpr.isUnaryOperator())
{
goto VISIT_EXPRUNARYOP;
}
Debug.Assert(pExpr.isBIN());
goto VISIT_EXPRBINOP;
VISIT_EXPR:
break;
VISIT_BASE_EXPRSTMT:
goto VISIT_EXPR;
VISIT_EXPRSTMT:
goto VISIT_BASE_EXPRSTMT;
case ExpressionKind.EK_BINOP:
goto VISIT_EXPRBINOP;
VISIT_BASE_EXPRBINOP:
goto VISIT_EXPR;
VISIT_EXPRBINOP:
exprRet = Visit((pExpr as EXPRBINOP).GetOptionalLeftChild());
(pExpr as EXPRBINOP).SetOptionalLeftChild(exprRet as EXPR);
exprRet = Visit((pExpr as EXPRBINOP).GetOptionalRightChild());
(pExpr as EXPRBINOP).SetOptionalRightChild(exprRet as EXPR);
goto VISIT_BASE_EXPRBINOP;
case ExpressionKind.EK_LIST:
goto VISIT_EXPRLIST;
VISIT_BASE_EXPRLIST:
goto VISIT_EXPR;
VISIT_EXPRLIST:
exprRet = Visit((pExpr as EXPRLIST).GetOptionalElement());
(pExpr as EXPRLIST).SetOptionalElement(exprRet as EXPR);
exprRet = Visit((pExpr as EXPRLIST).GetOptionalNextListNode());
(pExpr as EXPRLIST).SetOptionalNextListNode(exprRet as EXPR);
goto VISIT_BASE_EXPRLIST;
case ExpressionKind.EK_ASSIGNMENT:
goto VISIT_EXPRASSIGNMENT;
VISIT_BASE_EXPRASSIGNMENT:
goto VISIT_EXPR;
VISIT_EXPRASSIGNMENT:
exprRet = Visit((pExpr as EXPRASSIGNMENT).GetLHS());
Debug.Assert(exprRet != null);
(pExpr as EXPRASSIGNMENT).SetLHS(exprRet as EXPR);
exprRet = Visit((pExpr as EXPRASSIGNMENT).GetRHS());
Debug.Assert(exprRet != null);
(pExpr as EXPRASSIGNMENT).SetRHS(exprRet as EXPR);
goto VISIT_BASE_EXPRASSIGNMENT;
case ExpressionKind.EK_QUESTIONMARK:
goto VISIT_EXPRQUESTIONMARK;
VISIT_BASE_EXPRQUESTIONMARK:
goto VISIT_EXPR;
VISIT_EXPRQUESTIONMARK:
exprRet = Visit((pExpr as EXPRQUESTIONMARK).GetTestExpression());
Debug.Assert(exprRet != null);
(pExpr as EXPRQUESTIONMARK).SetTestExpression(exprRet as EXPR);
exprRet = Visit((pExpr as EXPRQUESTIONMARK).GetConsequence());
Debug.Assert(exprRet != null);
(pExpr as EXPRQUESTIONMARK).SetConsequence(exprRet as EXPRBINOP);
goto VISIT_BASE_EXPRQUESTIONMARK;
case ExpressionKind.EK_ARRAYINDEX:
goto VISIT_EXPRARRAYINDEX;
VISIT_BASE_EXPRARRAYINDEX:
goto VISIT_EXPR;
VISIT_EXPRARRAYINDEX:
exprRet = Visit((pExpr as EXPRARRAYINDEX).GetArray());
Debug.Assert(exprRet != null);
(pExpr as EXPRARRAYINDEX).SetArray(exprRet as EXPR);
//.........这里部分代码省略.........