Search in sources :

Example 1 with WhileLoop

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

the class RhinoJavaScriptBuilder method whileLoop.

/**
 * {@inheritDoc}
 */
@Override
public AstNode whileLoop(AstNode condition, AstNode body) {
    WhileLoop w = new WhileLoop();
    w.setCondition(condition);
    w.setBody(body);
    return w;
}
Also used : WhileLoop(org.mozilla.javascript.ast.WhileLoop)

Example 2 with WhileLoop

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

the class Parser method whileLoop.

private WhileLoop whileLoop() throws IOException {
    if (currentToken != Token.WHILE)
        codeBug();
    consumeToken();
    int pos = ts.tokenBeg;
    WhileLoop pn = new WhileLoop(pos);
    pn.setLineno(ts.lineno);
    enterLoop(pn);
    try {
        ConditionData data = condition();
        pn.setCondition(data.condition);
        pn.setParens(data.lp - pos, data.rp - pos);
        AstNode body = statement();
        pn.setLength(getNodeEnd(body) - pos);
        pn.setBody(body);
    } finally {
        exitLoop();
    }
    return pn;
}
Also used : WhileLoop(org.mozilla.javascript.ast.WhileLoop) AstNode(org.mozilla.javascript.ast.AstNode)

Aggregations

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