Search in sources :

Example 1 with ReturnStatementTree

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

the class Parser method parseReturnStatement.

// 12.9 The return Statement
private ParseTree parseReturnStatement() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.RETURN);
    ParseTree expression = null;
    if (!peekImplicitSemiColon()) {
        expression = parseExpression();
    }
    eatPossiblyImplicitSemiColon();
    return new ReturnStatementTree(getTreeLocation(start), expression);
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) ReturnStatementTree(com.google.javascript.jscomp.parsing.parser.trees.ReturnStatementTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Aggregations

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