Search in sources :

Example 1 with CatchTree

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

the class Parser method parseCatch.

private CatchTree parseCatch() {
    SourcePosition start = getTreeStartLocation();
    CatchTree catchBlock;
    eat(TokenType.CATCH);
    eat(TokenType.OPEN_PAREN);
    ParseTree exception;
    if (peekPatternStart()) {
        exception = parsePattern(PatternKind.INITIALIZER);
    } else {
        exception = parseIdentifierExpression();
    }
    eat(TokenType.CLOSE_PAREN);
    BlockTree catchBody = parseBlock();
    catchBlock = new CatchTree(getTreeLocation(start), exception, catchBody);
    return catchBlock;
}
Also used : CatchTree(com.google.javascript.jscomp.parsing.parser.trees.CatchTree) SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) BlockTree(com.google.javascript.jscomp.parsing.parser.trees.BlockTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Aggregations

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