use of com.google.javascript.jscomp.parsing.parser.trees.IfStatementTree in project closure-compiler by google.
the class Parser method parseIfStatement.
// 12.5 If Statement
private IfStatementTree parseIfStatement() {
SourcePosition start = getTreeStartLocation();
eat(TokenType.IF);
eat(TokenType.OPEN_PAREN);
ParseTree condition = parseExpression();
eat(TokenType.CLOSE_PAREN);
ParseTree ifClause = parseStatement();
ParseTree elseClause = null;
if (peek(TokenType.ELSE)) {
eat(TokenType.ELSE);
elseClause = parseStatement();
}
return new IfStatementTree(getTreeLocation(start), condition, ifClause, elseClause);
}
Aggregations