Search in sources :

Example 1 with ComprehensionForTree

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

the class Parser method parseComprehensionFor.

private ParseTree parseComprehensionFor() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.FOR);
    eat(TokenType.OPEN_PAREN);
    ParseTree initializer;
    if (peekId()) {
        initializer = parseIdentifierExpression();
    } else {
        initializer = parsePattern(PatternKind.ANY);
    }
    eatPredefinedString(PredefinedName.OF);
    ParseTree collection = parseAssignmentExpression();
    eat(TokenType.CLOSE_PAREN);
    return new ComprehensionForTree(getTreeLocation(start), initializer, collection);
}
Also used : ComprehensionForTree(com.google.javascript.jscomp.parsing.parser.trees.ComprehensionForTree) SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Aggregations

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