当前位置: 首页>>代码示例>>C#>>正文


C# EXPR.asBIN方法代码示例

本文整理汇总了C#中Microsoft.CSharp.RuntimeBinder.Semantics.EXPR.asBIN方法的典型用法代码示例。如果您正苦于以下问题:C# EXPR.asBIN方法的具体用法?C# EXPR.asBIN怎么用?C# EXPR.asBIN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.CSharp.RuntimeBinder.Semantics.EXPR的用法示例。


在下文中一共展示了EXPR.asBIN方法的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;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:26,代码来源:ExpressionTreeCallRewriter.cs

示例2: Dispatch

        protected virtual EXPR Dispatch(EXPR pExpr)
        {
            switch (pExpr.kind)
            {
                case ExpressionKind.EK_BLOCK:
                    return VisitBLOCK(pExpr as EXPRBLOCK);
                case ExpressionKind.EK_RETURN:
                    return VisitRETURN(pExpr as EXPRRETURN);
                case ExpressionKind.EK_BINOP:
                    return VisitBINOP(pExpr as EXPRBINOP);
                case ExpressionKind.EK_UNARYOP:
                    return VisitUNARYOP(pExpr as EXPRUNARYOP);
                case ExpressionKind.EK_ASSIGNMENT:
                    return VisitASSIGNMENT(pExpr as EXPRASSIGNMENT);
                case ExpressionKind.EK_LIST:
                    return VisitLIST(pExpr as EXPRLIST);
                case ExpressionKind.EK_QUESTIONMARK:
                    return VisitQUESTIONMARK(pExpr as EXPRQUESTIONMARK);
                case ExpressionKind.EK_ARRAYINDEX:
                    return VisitARRAYINDEX(pExpr as EXPRARRAYINDEX);
                case ExpressionKind.EK_ARRAYLENGTH:
                    return VisitARRAYLENGTH(pExpr as EXPRARRAYLENGTH);
                case ExpressionKind.EK_CALL:
                    return VisitCALL(pExpr as EXPRCALL);
                case ExpressionKind.EK_EVENT:
                    return VisitEVENT(pExpr as EXPREVENT);
                case ExpressionKind.EK_FIELD:
                    return VisitFIELD(pExpr as EXPRFIELD);
                case ExpressionKind.EK_LOCAL:
                    return VisitLOCAL(pExpr as EXPRLOCAL);
                case ExpressionKind.EK_THISPOINTER:
                    return VisitTHISPOINTER(pExpr as EXPRTHISPOINTER);
                case ExpressionKind.EK_CONSTANT:
                    return VisitCONSTANT(pExpr as EXPRCONSTANT);
                case ExpressionKind.EK_TYPEARGUMENTS:
                    return VisitTYPEARGUMENTS(pExpr as EXPRTYPEARGUMENTS);
                case ExpressionKind.EK_TYPEORNAMESPACE:
                    return VisitTYPEORNAMESPACE(pExpr as EXPRTYPEORNAMESPACE);
                case ExpressionKind.EK_CLASS:
                    return VisitCLASS(pExpr as EXPRCLASS);
                case ExpressionKind.EK_FUNCPTR:
                    return VisitFUNCPTR(pExpr as EXPRFUNCPTR);
                case ExpressionKind.EK_PROP:
                    return VisitPROP(pExpr as EXPRPROP);
                case ExpressionKind.EK_MULTI:
                    return VisitMULTI(pExpr as EXPRMULTI);
                case ExpressionKind.EK_MULTIGET:
                    return VisitMULTIGET(pExpr as EXPRMULTIGET);
                case ExpressionKind.EK_WRAP:
                    return VisitWRAP(pExpr as EXPRWRAP);
                case ExpressionKind.EK_CONCAT:
                    return VisitCONCAT(pExpr as EXPRCONCAT);
                case ExpressionKind.EK_ARRINIT:
                    return VisitARRINIT(pExpr as EXPRARRINIT);
                case ExpressionKind.EK_CAST:
                    return VisitCAST(pExpr as EXPRCAST);
                case ExpressionKind.EK_USERDEFINEDCONVERSION:
                    return VisitUSERDEFINEDCONVERSION(pExpr as EXPRUSERDEFINEDCONVERSION);
                case ExpressionKind.EK_TYPEOF:
                    return VisitTYPEOF(pExpr as EXPRTYPEOF);
                case ExpressionKind.EK_ZEROINIT:
                    return VisitZEROINIT(pExpr as EXPRZEROINIT);
                case ExpressionKind.EK_USERLOGOP:
                    return VisitUSERLOGOP(pExpr as EXPRUSERLOGOP);
                case ExpressionKind.EK_MEMGRP:
                    return VisitMEMGRP(pExpr as EXPRMEMGRP);
                case ExpressionKind.EK_BOUNDLAMBDA:
                    return VisitBOUNDLAMBDA(pExpr as EXPRBOUNDLAMBDA);
                case ExpressionKind.EK_UNBOUNDLAMBDA:
                    return VisitUNBOUNDLAMBDA(pExpr as EXPRUNBOUNDLAMBDA);
                case ExpressionKind.EK_HOISTEDLOCALEXPR:
                    return VisitHOISTEDLOCALEXPR(pExpr as EXPRHOISTEDLOCALEXPR);
                case ExpressionKind.EK_FIELDINFO:
                    return VisitFIELDINFO(pExpr as EXPRFIELDINFO);
                case ExpressionKind.EK_METHODINFO:
                    return VisitMETHODINFO(pExpr as EXPRMETHODINFO);

                // Binary operators
                case ExpressionKind.EK_EQUALS:
                    return VisitEQUALS(pExpr.asBIN());
                case ExpressionKind.EK_COMPARE:
                    return VisitCOMPARE(pExpr.asBIN());
                case ExpressionKind.EK_NE:
                    return VisitNE(pExpr.asBIN());
                case ExpressionKind.EK_LT:
                    return VisitLT(pExpr.asBIN());
                case ExpressionKind.EK_LE:
                    return VisitLE(pExpr.asBIN());
                case ExpressionKind.EK_GT:
                    return VisitGT(pExpr.asBIN());
                case ExpressionKind.EK_GE:
                    return VisitGE(pExpr.asBIN());
                case ExpressionKind.EK_ADD:
                    return VisitADD(pExpr.asBIN());
                case ExpressionKind.EK_SUB:
                    return VisitSUB(pExpr.asBIN());
                case ExpressionKind.EK_MUL:
                    return VisitMUL(pExpr.asBIN());
                case ExpressionKind.EK_DIV:
                    return VisitDIV(pExpr.asBIN());
//.........这里部分代码省略.........
开发者ID:noahfalk,项目名称:corefx,代码行数:101,代码来源:ExprVisitorBase.cs


注:本文中的Microsoft.CSharp.RuntimeBinder.Semantics.EXPR.asBIN方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。