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


C# EXPR.asLIST方法代码示例

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


在下文中一共展示了EXPR.asLIST方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StripNamedArguments

        private EXPR StripNamedArguments(EXPR pArg)
        {
            if (pArg.isLIST())
            {
                EXPRLIST list = pArg.asLIST();
                while (list != null)
                {
                    list.SetOptionalElement(StripNamedArgument(list.GetOptionalElement()));

                    if (list.GetOptionalNextListNode().isLIST())
                    {
                        list = list.GetOptionalNextListNode().asLIST();
                    }
                    else
                    {
                        list.SetOptionalNextListNode(StripNamedArgument(list.GetOptionalNextListNode()));
                        break;
                    }
                }
            }
            return StripNamedArgument(pArg);
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:22,代码来源:RuntimeBinder.cs

示例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);
//.........这里部分代码省略.........
开发者ID:noahfalk,项目名称:corefx,代码行数:101,代码来源:ExprVisitorBase.cs


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