public String getIdentifier() { return node.getIdentifier(); }
public ASTName(Name name) { super(name); super.setImage(name.getIdentifier()); }
private void print(Name node, int precedence) throws IOException { NameEmitter alias = nameMap.get(node.getIdentifier()); if (alias == null) { alias = prec -> writer.append(node.getIdentifier()); } alias.emit(precedence); }
public ASTBreakStatement(BreakStatement breakStatement) { super(breakStatement); super.setImage(breakStatement.getBreakLabel() != null ? breakStatement.getBreakLabel().getIdentifier() : null); }
public ASTContinueStatement(ContinueStatement continueStatement) { super(continueStatement); super.setImage(continueStatement.getLabel() != null ? continueStatement.getLabel().getIdentifier() : null); }
private boolean tryJavaInvocation(FunctionCall node) throws IOException { if (!(node.getTarget() instanceof PropertyGet)) { return false; } PropertyGet propertyGet = (PropertyGet) node.getTarget(); String callMethod = getJavaMethod(propertyGet.getTarget()); if (callMethod == null || !propertyGet.getProperty().getIdentifier().equals("invoke")) { return false; } MethodReference method = MethodReference.parseIfPossible(callMethod); if (method == null) { return false; } writer.appendMethodBody(method).append('('); printList(node.getArguments()); writer.append(')'); return true; }
/** * Returns the function name as a string * @return the function name, {@code ""} if anonymous */ public String getName() { return functionName != null ? functionName.getIdentifier() : ""; }
/** * Returns the function name as a string * @return the function name, {@code ""} if anonymous */ public String getName() { return functionName != null ? functionName.getIdentifier() : ""; }
private boolean validNode(AstNode node) { switch(node.getType()) { case Token.NAME: return ((Name) node).getIdentifier() != null && ((Name) node).getIdentifier().length() > 0; } return true; }
private void checkCallRequiresActivation(AstNode pn) { if ((pn.getType() == Token.NAME && "eval".equals(((Name)pn).getIdentifier())) || (pn.getType() == Token.GETPROP && "eval".equals(((PropertyGet)pn).getProperty().getIdentifier()))) setRequiresActivation(); }
@Override public boolean visit(AstNode node) { if (node instanceof Name) { Name name = (Name) node; if (!name.isLocalName()) { String id = name.getIdentifier(); usages.put(id, getUsage(id) + 1); } } return true; } }
private void checkCallRequiresActivation(AstNode pn) { if ((pn.getType() == Token.NAME && "eval".equals(((Name)pn).getIdentifier())) || (pn.getType() == Token.GETPROP && "eval".equals(((PropertyGet)pn).getProperty().getIdentifier()))) setRequiresActivation(); }
private void checkCallRequiresActivation(AstNode pn) { if ((pn.getType() == Token.NAME && "eval".equals(((Name)pn).getIdentifier())) || (pn.getType() == Token.GETPROP && "eval".equals(((PropertyGet)pn).getProperty().getIdentifier()))) setRequiresActivation(); }
/** * Returns the {@link Scope} in which this {@code Name} is defined. * @return the scope in which this name is defined, or {@code null} * if it's not defined in the current lexical scope chain */ public Scope getDefiningScope() { Scope enclosing = getEnclosingScope(); String name = getIdentifier(); return enclosing == null ? null : enclosing.getDefiningScope(name); }
public int getIndexForNameNode(Node nameNode) { if (variableNames == null) codeBug(); Scope node = nameNode.getScope(); Symbol symbol = node == null ? null : node.getSymbol(((Name)nameNode).getIdentifier()); return (symbol == null) ? -1 : symbol.getIndex(); }
public int getIndexForNameNode(Node nameNode) { if (variableNames == null) codeBug(); Scope node = nameNode.getScope(); Symbol symbol = node == null ? null : node.getSymbol(((Name)nameNode).getIdentifier()); return (symbol == null) ? -1 : symbol.getIndex(); }
private Node transformBreak(BreakStatement node) { decompiler.addToken(Token.BREAK); if (node.getBreakLabel() != null) { decompiler.addName(node.getBreakLabel().getIdentifier()); } decompiler.addEOL(Token.SEMI); return node; }
private Node transformContinue(ContinueStatement node) { decompiler.addToken(Token.CONTINUE); if (node.getLabel() != null) { decompiler.addName(node.getLabel().getIdentifier()); } decompiler.addEOL(Token.SEMI); return node; }
private Node transformPropertyGet(PropertyGet node) { Node target = transform(node.getTarget()); String name = node.getProperty().getIdentifier(); decompiler.addToken(Token.DOT); decompiler.addName(name); return createPropertyGet(target, null, name, 0); }
private Node transformPropertyGet(PropertyGet node) { Node target = transform(node.getTarget()); String name = node.getProperty().getIdentifier(); decompiler.addToken(Token.DOT); decompiler.addName(name); return createPropertyGet(target, null, name, 0); }