/** * 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); } }
/** * 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); } }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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; }
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; }