本文整理汇总了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;
}