use of org.mozilla.javascript.ast.Assignment in project st-js by st-js.
the class RhinoJavaScriptBuilder method assignment.
/**
* {@inheritDoc}
*/
@Override
public AstNode assignment(AssignOperator operator, AstNode left, AstNode right) {
Assignment a = new Assignment();
a.setOperator(operator.getJavaScript());
a.setLeft(left);
a.setRight(right);
return a;
}
use of org.mozilla.javascript.ast.Assignment in project HL4A by HL4A.
the class Parser method assignExpr.
private AstNode assignExpr() throws IOException {
int tt = peekToken();
if (tt == Token.YIELD) {
return returnOrYield(tt, true);
}
AstNode pn = condExpr();
boolean hasEOL = false;
tt = peekTokenOrEOL();
if (tt == Token.EOL) {
hasEOL = true;
tt = peekToken();
}
if (Token.FIRST_ASSIGN <= tt && tt <= Token.LAST_ASSIGN) {
consumeToken();
// Pull out JSDoc info and reset it before recursing.
Comment jsdocNode = getAndResetJsDoc();
markDestructuring(pn);
int opPos = ts.tokenBeg;
pn = new Assignment(tt, pn, assignExpr(), opPos);
if (jsdocNode != null) {
pn.setJsDocNode(jsdocNode);
}
} else if (tt == Token.SEMI) {
// For example: /** @type Number */ C.prototype.x;
if (currentJsDocComment != null) {
pn.setJsDocNode(getAndResetJsDoc());
}
} else if (!hasEOL && tt == Token.ARROW) {
consumeToken();
pn = arrowFunction(pn);
}
return pn;
}
Aggregations