Search in sources :

Example 1 with AwaitExpressionTree

use of com.google.javascript.jscomp.parsing.parser.trees.AwaitExpressionTree in project closure-compiler by google.

the class Parser method parseAwaitExpression.

private ParseTree parseAwaitExpression() {
    SourcePosition start = getTreeStartLocation();
    if (functionContextStack.isEmpty() || !functionContextStack.peekLast().isAsynchronous) {
        reportError("'await' used in a non-async function context");
    }
    eatPredefinedString(AWAIT);
    ParseTree expression = parseUnaryExpression();
    return new AwaitExpressionTree(getTreeLocation(start), expression);
}
Also used : AwaitExpressionTree(com.google.javascript.jscomp.parsing.parser.trees.AwaitExpressionTree) SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Aggregations

AwaitExpressionTree (com.google.javascript.jscomp.parsing.parser.trees.AwaitExpressionTree)1 ParseTree (com.google.javascript.jscomp.parsing.parser.trees.ParseTree)1 SourcePosition (com.google.javascript.jscomp.parsing.parser.util.SourcePosition)1