use of com.google.javascript.jscomp.parsing.parser.trees.YieldExpressionTree in project closure-compiler by google.
the class Parser method parseYield.
// yield [no line terminator] (*)? AssignExpression
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluation
private ParseTree parseYield(Expression expressionIn) {
SourcePosition start = getTreeStartLocation();
eat(TokenType.YIELD);
boolean isYieldAll = false;
ParseTree expression = null;
if (!peekImplicitSemiColon()) {
isYieldAll = eatOpt(TokenType.STAR) != null;
if (peekAssignmentExpression()) {
expression = parseAssignment(expressionIn);
} else if (isYieldAll) {
reportError("yield* requires an expression");
}
}
return new YieldExpressionTree(getTreeLocation(start), isYieldAll, expression);
}
Aggregations