use of com.google.javascript.jscomp.parsing.parser.trees.ObjectLiteralExpressionTree in project closure-compiler by google.
the class Parser method parseObjectLiteral.
// 11.1.4 Object Literal Expression
private ParseTree parseObjectLiteral() {
SourcePosition start = getTreeStartLocation();
ImmutableList.Builder<ParseTree> result = ImmutableList.builder();
eat(TokenType.OPEN_CURLY);
Token commaToken = null;
while (peek(TokenType.SPREAD) || peekPropertyNameOrComputedProp(0) || peek(TokenType.STAR) || peekAccessibilityModifier()) {
commaToken = null;
result.add(parsePropertyAssignment());
commaToken = eatOpt(TokenType.COMMA);
if (commaToken == null) {
break;
}
}
eat(TokenType.CLOSE_CURLY);
maybeReportTrailingComma(commaToken);
return new ObjectLiteralExpressionTree(getTreeLocation(start), result.build());
}
Aggregations