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


C# Node.addChildrenToBack方法代码示例

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


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

示例1: CreateLoop

        private Node CreateLoop(Node.Jump loop, int loopType, Node body, Node cond, Node init, Node incr)
        {
            Node bodyTarget = Node.newTarget ();
            Node condTarget = Node.newTarget ();
            if (loopType == LOOP_FOR && cond.Type == Token.EMPTY) {
                cond = new Node (Token.TRUE);
            }
            Node.Jump IFEQ = new Node.Jump (Token.IFEQ, cond);
            IFEQ.target = bodyTarget;
            Node breakTarget = Node.newTarget ();

            loop.addChildToBack (bodyTarget);
            loop.addChildrenToBack (body);
            if (loopType == LOOP_WHILE || loopType == LOOP_FOR) {
                // propagate lineno to condition
                loop.addChildrenToBack (new Node (Token.EMPTY, loop.Lineno));
            }
            loop.addChildToBack (condTarget);
            loop.addChildToBack (IFEQ);
            loop.addChildToBack (breakTarget);

            loop.target = breakTarget;
            Node continueTarget = condTarget;

            if (loopType == LOOP_WHILE || loopType == LOOP_FOR) {
                // Just add a GOTO to the condition in the do..while
                loop.addChildToFront (makeJump (Token.GOTO, condTarget));

                if (loopType == LOOP_FOR) {
                    if (init.Type != Token.EMPTY) {
                        if (init.Type != Token.VAR) {
                            init = new Node (Token.EXPR_VOID, init);
                        }
                        loop.addChildToFront (init);
                    }
                    Node incrTarget = Node.newTarget ();
                    loop.addChildAfter (incrTarget, body);
                    if (incr.Type != Token.EMPTY) {
                        incr = new Node (Token.EXPR_VOID, incr);
                        loop.addChildAfter (incr, incrTarget);
                    }
                    continueTarget = incrTarget;
                }
            }

            loop.Continue = continueTarget;

            return loop;
        }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:49,代码来源:NodeFactory.cs

示例2: CreateIf

        /// <summary> If statement</summary>
        internal Node CreateIf(Node cond, Node ifTrue, Node ifFalse, int lineno)
        {
            int condStatus = isAlwaysDefinedBoolean (cond);
            if (condStatus == ALWAYS_TRUE_BOOLEAN) {
                return ifTrue;
            }
            else if (condStatus == ALWAYS_FALSE_BOOLEAN) {
                if (ifFalse != null) {
                    return ifFalse;
                }
                return new Node (Token.BLOCK, lineno);
            }

            Node result = new Node (Token.BLOCK, lineno);
            Node ifNotTarget = Node.newTarget ();
            Node.Jump IFNE = new Node.Jump (Token.IFNE, cond);
            IFNE.target = ifNotTarget;

            result.addChildToBack (IFNE);
            result.addChildrenToBack (ifTrue);

            if (ifFalse != null) {
                Node endTarget = Node.newTarget ();
                result.addChildToBack (makeJump (Token.GOTO, endTarget));
                result.addChildToBack (ifNotTarget);
                result.addChildrenToBack (ifFalse);
                result.addChildToBack (endTarget);
            }
            else {
                result.addChildToBack (ifNotTarget);
            }

            return result;
        }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:35,代码来源:NodeFactory.cs

示例3: CreateWith

 /// <summary> Throw, Return, Label, Break and Continue are defined in ASTFactory.</summary>
 /// <summary> With</summary>
 internal Node CreateWith(Node obj, Node body, int lineno)
 {
     setRequiresActivation ();
     Node result = new Node (Token.BLOCK, lineno);
     result.addChildToBack (new Node (Token.ENTERWITH, obj));
     Node bodyNode = new Node (Token.WITH, body, lineno);
     result.addChildrenToBack (bodyNode);
     result.addChildToBack (new Node (Token.LEAVEWITH));
     return result;
 }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:12,代码来源:NodeFactory.cs


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