Search in sources :

Example 1 with ThrowStatement

use of org.mozilla.javascript.ast.ThrowStatement in project HL4A by HL4A.

the class Parser method throwStatement.

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;
}
Also used : ThrowStatement(org.mozilla.javascript.ast.ThrowStatement) AstNode(org.mozilla.javascript.ast.AstNode)

Example 2 with ThrowStatement

use of org.mozilla.javascript.ast.ThrowStatement in project st-js by st-js.

the class RhinoJavaScriptBuilder method throwStatement.

/**
 * {@inheritDoc}
 */
@Override
public AstNode throwStatement(AstNode expr) {
    ThrowStatement s = new ThrowStatement();
    s.setExpression(expr);
    return s;
}
Also used : ThrowStatement(org.mozilla.javascript.ast.ThrowStatement)

Aggregations

ThrowStatement (org.mozilla.javascript.ast.ThrowStatement)2 AstNode (org.mozilla.javascript.ast.AstNode)1