private ThrowStatement throwStatement() throws IOException { if (currentToken != Token.THROW) codeBug(); consumeToken(); int pos = ts.tokenBeg, lineno = ts.lineno; if (peekTokenOrEOL() == Token.EOL) { // ECMAScript does not allow new lines before throw expression, // see bug 256617 reportError("msg.bad.throw.eol"); } AstNode expr = expr(); ThrowStatement pn = new ThrowStatement(pos, getNodeEnd(expr), expr); pn.setLineno(lineno); return pn; }
private static AstNode getExpression(MethodReference method, AstNode statement) { if (method.getReturnType() == ValueType.VOID) { if (statement instanceof ExpressionStatement) { return ((ExpressionStatement) statement).getExpression(); } else if (statement instanceof ThrowStatement) { return ((ThrowStatement) statement).getExpression(); } } else { if (statement instanceof ReturnStatement) { return ((ReturnStatement) statement).getReturnValue(); } } return null; }
private Node transformThrow(ThrowStatement node) { decompiler.addToken(Token.THROW); Node value = transform(node.getExpression()); decompiler.addEOL(Token.SEMI); return new Node(Token.THROW, value, node.getLineno()); }
private void print(ThrowStatement node) throws IOException { writer.append("throw "); print(node.getExpression()); writer.append(';'); }