use of com.google.javascript.jscomp.parsing.parser.trees.BlockTree in project closure-compiler by google.
the class Parser method parseSetAccessor.
private ParseTree parseSetAccessor(PartialClassElement partial) {
eatPredefinedString(PredefinedName.SET);
if (peekPropertyName(0)) {
Token propertyName = eatObjectLiteralPropertyName();
eat(TokenType.OPEN_PAREN);
IdentifierToken parameter = eatId();
ParseTree type = maybeParseColonType();
eat(TokenType.CLOSE_PAREN);
ParseTree returnType = maybeParseColonType();
if (returnType != null) {
reportError(scanner.peekToken(), "setter should not have any returns");
}
BlockTree body = parseFunctionBody();
return new SetAccessorTree(getTreeLocation(partial.start), propertyName, partial.isStatic, parameter, type, body);
} else {
ParseTree property = parseComputedPropertyName();
eat(TokenType.OPEN_PAREN);
IdentifierToken parameter = eatId();
ParseTree type = maybeParseColonType();
eat(TokenType.CLOSE_PAREN);
BlockTree body = parseFunctionBody();
return new ComputedPropertySetterTree(getTreeLocation(partial.start), property, partial.isStatic, partial.accessModifier, parameter, type, body);
}
}
Aggregations