private TokenType maybeParseAccessibilityModifier() { if (config.parseTypeSyntax && peekAccessibilityModifier()) { return nextToken().type; } else { return null; } }
private TokenType maybeParseAccessibilityModifier() { if (peekAccessibilityModifier()) { features = features.require(FeatureSet.TYPESCRIPT); if (!config.is6Typed) { reportError("Accessibility modifier is only supported in ES6 typed mode"); } return nextToken().type; } else { return null; } }
private ParseTree parseObjectLiteral() { SourcePosition start = getTreeStartLocation(); ImmutableList.Builder<ParseTree> result = ImmutableList.builder(); eat(TokenType.OPEN_CURLY); Token commaToken = null; while (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()); }
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()); }