本文整理了Java中org.mozilla.javascript.Node.getFirstChild()
方法的一些代码示例,展示了Node.getFirstChild()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getFirstChild()
方法的具体详情如下:
包路径:org.mozilla.javascript.Node
类名称:Node
方法名:getFirstChild
暂无
代码示例来源:origin: rhino/js
/**
* Script (for associating file/url names with toplevel scripts.)
*/
void initScript(ScriptOrFnNode scriptNode, Node body)
{
Node children = body.getFirstChild();
if (children != null) { scriptNode.addChildrenToBack(children); }
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
/**
* Script (for associating file/url names with toplevel scripts.)
*/
void initScript(ScriptOrFnNode scriptNode, Node body)
{
Node children = body.getFirstChild();
if (children != null) { scriptNode.addChildrenToBack(children); }
}
代码示例来源:origin: rhino/js
private static Node replaceCurrent(Node parent, Node previous,
Node current, Node replacement)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.replaceChild(current, replacement);
} else if (previous.next == current) {
// Check cachedPrev.next == current is necessary due to possible
// tree mutations
parent.replaceChildAfter(previous, replacement);
} else {
parent.replaceChild(current, replacement);
}
return replacement;
}
代码示例来源:origin: geogebra/geogebra
private static Node replaceCurrent(Node parent, Node previous,
Node current, Node replacement)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.replaceChild(current, replacement);
} else if (previous.next == current) {
// Check cachedPrev.next == current is necessary due to possible
// tree mutations
parent.replaceChildAfter(previous, replacement);
} else {
parent.replaceChild(current, replacement);
}
return replacement;
}
代码示例来源:origin: io.apigee/rhino
private static Node replaceCurrent(Node parent, Node previous,
Node current, Node replacement)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.replaceChild(current, replacement);
} else if (previous.next == current) {
// Check cachedPrev.next == current is necessary due to possible
// tree mutations
parent.replaceChildAfter(previous, replacement);
} else {
parent.replaceChild(current, replacement);
}
return replacement;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private static Node replaceCurrent(Node parent, Node previous,
Node current, Node replacement)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.replaceChild(current, replacement);
} else if (previous.next == current) {
// Check cachedPrev.next == current is necessary due to possible
// tree mutations
parent.replaceChildAfter(previous, replacement);
} else {
parent.replaceChild(current, replacement);
}
return replacement;
}
代码示例来源:origin: rhino/js
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: geogebra/geogebra
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: io.apigee/rhino
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: com.github.tntim96/rhino
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private static Node addBeforeCurrent(Node parent, Node previous,
Node current, Node toAdd)
{
if (previous == null) {
if (!(current == parent.getFirstChild())) Kit.codeBug();
parent.addChildToFront(toAdd);
} else {
if (!(current == previous.getNext())) Kit.codeBug();
parent.addChildAfter(toAdd, previous);
}
return toAdd;
}
代码示例来源:origin: io.apigee/rhino
private void generateArrayLiteralFactory(Node node, int count) {
String methodName = codegen.getBodyMethodName(scriptOrFn) + "_literal" + count;
initBodyGeneration();
argsLocal = firstFreeLocal++;
localsMax = firstFreeLocal;
cfw.startMethod(methodName, "(Lorg/mozilla/javascript/Context;"
+"Lorg/mozilla/javascript/Scriptable;"
+"Lorg/mozilla/javascript/Scriptable;"
+"[Ljava/lang/Object;"
+")Lorg/mozilla/javascript/Scriptable;",
ACC_PRIVATE);
visitArrayLiteral(node, node.getFirstChild(), true);
cfw.add(ByteCode.ARETURN);
cfw.stopMethod((short)(localsMax + 1));
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private void generateArrayLiteralFactory(Node node, int count) {
String methodName = codegen.getBodyMethodName(scriptOrFn) + "_literal" + count;
initBodyGeneration();
argsLocal = firstFreeLocal++;
localsMax = firstFreeLocal;
cfw.startMethod(methodName, "(Lorg/mozilla/javascript/Context;"
+"Lorg/mozilla/javascript/Scriptable;"
+"Lorg/mozilla/javascript/Scriptable;"
+"[Ljava/lang/Object;"
+")Lorg/mozilla/javascript/Scriptable;",
ACC_PRIVATE);
visitArrayLiteral(node, node.getFirstChild(), true);
cfw.add(ByteCode.ARETURN);
cfw.stopMethod((short)(localsMax + 1));
}
代码示例来源:origin: com.github.tntim96/rhino
private void generateArrayLiteralFactory(Node node, int count) {
String methodName = codegen.getBodyMethodName(scriptOrFn) + "_literal" + count;
initBodyGeneration();
argsLocal = firstFreeLocal++;
localsMax = firstFreeLocal;
cfw.startMethod(methodName, "(Lorg/mozilla/javascript/Context;"
+"Lorg/mozilla/javascript/Scriptable;"
+"Lorg/mozilla/javascript/Scriptable;"
+"[Ljava/lang/Object;"
+")Lorg/mozilla/javascript/Scriptable;",
ACC_PRIVATE);
visitArrayLiteral(node, node.getFirstChild(), true);
cfw.add(ByteCode.ARETURN);
cfw.stopMethod((short)(localsMax + 1));
}
代码示例来源:origin: geogebra/geogebra
private void generateObjectLiteralFactory(Node node, int count) {
String methodName = codegen.getBodyMethodName(scriptOrFn) + "_literal" + count;
initBodyGeneration();
argsLocal = firstFreeLocal++;
localsMax = firstFreeLocal;
cfw.startMethod(methodName, "(Lorg/mozilla/javascript/Context;"
+"Lorg/mozilla/javascript/Scriptable;"
+"Lorg/mozilla/javascript/Scriptable;"
+"[Ljava/lang/Object;"
+")Lorg/mozilla/javascript/Scriptable;",
ACC_PRIVATE);
visitObjectLiteral(node, node.getFirstChild(), true);
cfw.add(ByteCode.ARETURN);
cfw.stopMethod((short)(localsMax + 1));
}
代码示例来源:origin: geogebra/geogebra
private void generateArrayLiteralFactory(Node node, int count) {
String methodName = codegen.getBodyMethodName(scriptOrFn) + "_literal" + count;
initBodyGeneration();
argsLocal = firstFreeLocal++;
localsMax = firstFreeLocal;
cfw.startMethod(methodName, "(Lorg/mozilla/javascript/Context;"
+"Lorg/mozilla/javascript/Scriptable;"
+"Lorg/mozilla/javascript/Scriptable;"
+"[Ljava/lang/Object;"
+")Lorg/mozilla/javascript/Scriptable;",
ACC_PRIVATE);
visitArrayLiteral(node, node.getFirstChild(), true);
cfw.add(ByteCode.ARETURN);
cfw.stopMethod((short)(localsMax + 1));
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private void generateObjectLiteralFactory(Node node, int count) {
String methodName = codegen.getBodyMethodName(scriptOrFn) + "_literal" + count;
initBodyGeneration();
argsLocal = firstFreeLocal++;
localsMax = firstFreeLocal;
cfw.startMethod(methodName, "(Lorg/mozilla/javascript/Context;"
+"Lorg/mozilla/javascript/Scriptable;"
+"Lorg/mozilla/javascript/Scriptable;"
+"[Ljava/lang/Object;"
+")Lorg/mozilla/javascript/Scriptable;",
ACC_PRIVATE);
visitObjectLiteral(node, node.getFirstChild(), true);
cfw.add(ByteCode.ARETURN);
cfw.stopMethod((short)(localsMax + 1));
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private Node transformScript(ScriptNode node) {
decompiler.addToken(Token.SCRIPT);
if (currentScope != null) Kit.codeBug();
currentScope = node;
Node body = new Node(Token.BLOCK);
for (Node kid : node) {
body.addChildToBack(transform((AstNode)kid));
}
node.removeChildren();
Node children = body.getFirstChild();
if (children != null) {
node.addChildrenToBack(children);
}
return node;
}
代码示例来源:origin: com.github.tntim96/rhino
private Node transformScript(ScriptNode node) {
decompiler.addToken(Token.SCRIPT);
if (currentScope != null) Kit.codeBug();
currentScope = node;
Node body = new Node(Token.BLOCK);
for (Node kid : node) {
body.addChildToBack(transform((AstNode)kid));
}
node.removeChildren();
Node children = body.getFirstChild();
if (children != null) {
node.addChildrenToBack(children);
}
return node;
}
内容来源于网络,如有侵权,请联系作者删除!