Search in sources :

Example 1 with SwitchStatementTree

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

the class Parser method parseSwitchStatement.

// 12.11 The switch Statement
private ParseTree parseSwitchStatement() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.SWITCH);
    eat(TokenType.OPEN_PAREN);
    ParseTree expression = parseExpression();
    eat(TokenType.CLOSE_PAREN);
    eat(TokenType.OPEN_CURLY);
    ImmutableList<ParseTree> caseClauses = parseCaseClauses();
    eat(TokenType.CLOSE_CURLY);
    return new SwitchStatementTree(getTreeLocation(start), expression, caseClauses);
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) SwitchStatementTree(com.google.javascript.jscomp.parsing.parser.trees.SwitchStatementTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Aggregations

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