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


C# Node.addChildrenToFront方法代码示例

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


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

示例1: initFunction

        internal Node initFunction(FunctionNode fnNode, int functionIndex, Node statements, int functionType)
        {
            fnNode.itsFunctionType = functionType;
            fnNode.addChildToBack (statements);

            int functionCount = fnNode.FunctionCount;
            if (functionCount != 0) {
                // Functions containing other functions require activation objects
                fnNode.itsNeedsActivation = true;
                for (int i = 0; i != functionCount; ++i) {
                    FunctionNode fn = fnNode.getFunctionNode (i);
                    // nested function expression statements overrides var
                    if (fn.FunctionType == FunctionNode.FUNCTION_EXPRESSION_STATEMENT) {
                        string name = fn.FunctionName;
                        if (name != null && name.Length != 0) {
                            fnNode.removeParamOrVar (name);
                        }
                    }
                }
            }

            if (functionType == FunctionNode.FUNCTION_EXPRESSION) {
                string name = fnNode.FunctionName;
                if (name != null && name.Length != 0 && !fnNode.hasParamOrVar (name)) {
                    // A function expression needs to have its name as a
                    // variable (if it isn't already allocated as a variable).
                    // See ECMA Ch. 13.  We add code to the beginning of the
                    // function to initialize a local variable of the
                    // function's name to the function value.
                    fnNode.addVar (name);
                    Node setFn = new Node (Token.EXPR_VOID, new Node (Token.SETNAME, Node.newString (Token.BINDNAME, name), new Node (Token.THISFN)));
                    statements.addChildrenToFront (setFn);
                }
            }

            // Add return to end if needed.
            Node lastStmt = statements.LastChild;
            if (lastStmt == null || lastStmt.Type != Token.RETURN) {
                statements.addChildToBack (new Node (Token.RETURN));
            }

            Node result = Node.newString (Token.FUNCTION, fnNode.FunctionName);
            result.putIntProp (Node.FUNCTION_PROP, functionIndex);
            return result;
        }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:45,代码来源:NodeFactory.cs


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