Java 类org.mozilla.javascript.ast.ThrowStatement 实例源码

项目:HL4A    文件:Parser.java   
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;
}
项目:LoboEvolution    文件:Parser.java   
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;
}
项目:teavm    文件:JSBodyInlineUtil.java   
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;
}
项目:HL4A    文件:IRFactory.java   
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());
}
项目:LoboEvolution    文件:IRFactory.java   
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());
}
项目:teavm    文件:AstWriter.java   
private void print(ThrowStatement node) throws IOException {
    writer.append("throw ");
    print(node.getExpression());
    writer.append(';');
}