use of com.google.javascript.jscomp.parsing.parser.trees.BlockTree in project closure-compiler by google.
the class Parser method parseGetAccessor.
private ParseTree parseGetAccessor(PartialClassElement partial) {
eatPredefinedString(PredefinedName.GET);
if (peekPropertyName(0)) {
Token propertyName = eatObjectLiteralPropertyName();
eat(TokenType.OPEN_PAREN);
eat(TokenType.CLOSE_PAREN);
ParseTree returnType = maybeParseColonType();
BlockTree body = parseFunctionBody();
return new GetAccessorTree(getTreeLocation(partial.start), propertyName, partial.isStatic, returnType, body);
} else {
ParseTree property = parseComputedPropertyName();
eat(TokenType.OPEN_PAREN);
eat(TokenType.CLOSE_PAREN);
ParseTree returnType = maybeParseColonType();
BlockTree body = parseFunctionBody();
return new ComputedPropertyGetterTree(getTreeLocation(partial.start), property, partial.isStatic, partial.accessModifier, returnType, body);
}
}
use of com.google.javascript.jscomp.parsing.parser.trees.BlockTree 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;
}
use of com.google.javascript.jscomp.parsing.parser.trees.BlockTree in project closure-compiler by google.
the class Parser method parseFunctionBody.
private BlockTree parseFunctionBody() {
SourcePosition start = getTreeStartLocation();
eat(TokenType.OPEN_CURLY);
ImmutableList<ParseTree> result = parseSourceElementList();
eat(TokenType.CLOSE_CURLY);
return new BlockTree(getTreeLocation(start), result);
}
use of com.google.javascript.jscomp.parsing.parser.trees.BlockTree in project closure-compiler by google.
the class Parser method parseFinallyBlock.
private FinallyTree parseFinallyBlock() {
SourcePosition start = getTreeStartLocation();
eat(TokenType.FINALLY);
BlockTree finallyBlock = parseBlock();
return new FinallyTree(getTreeLocation(start), finallyBlock);
}
use of com.google.javascript.jscomp.parsing.parser.trees.BlockTree in project closure-compiler by google.
the class Parser method parseBlock.
// 12.1 Block
private BlockTree parseBlock() {
SourcePosition start = getTreeStartLocation();
eat(TokenType.OPEN_CURLY);
// Spec says Statement list. However functions are also embedded in the wild.
ImmutableList<ParseTree> result = parseSourceElementList();
eat(TokenType.CLOSE_CURLY);
return new BlockTree(getTreeLocation(start), result);
}
Aggregations