Skip to content

Commit 81b17b7

Browse files
Closure Teamcopybara-github
Closure Team
authored andcommitted
Format source files
PiperOrigin-RevId: 722800745
1 parent 1cd0f04 commit 81b17b7

10 files changed

+34
-43
lines changed

src/com/google/javascript/jscomp/CodeGenerator.java

+15-13
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class CodeGenerator {
4646
private final boolean preferSingleQuotes;
4747
private final boolean preserveTypeAnnotations;
4848
private final boolean printNonJSDocComments;
49+
4950
/**
5051
* To distinguish between gents and non-gents mode so that we can turn off checking the sanity of
5152
* the source location of comments, and also provide a different mode for comment printing between
@@ -303,7 +304,7 @@ protected void add(Node node, Context context, boolean printComments) {
303304

304305
// Must have a ';' after a throw statement, otherwise safari can't
305306
// parse this.
306-
cc.endStatement(/*needSemiColon=*/ true, hasTrailingCommentOnSameLine(node));
307+
cc.endStatement(/* needSemiColon= */ true, hasTrailingCommentOnSameLine(node));
307308
break;
308309

309310
case RETURN:
@@ -572,7 +573,7 @@ protected void add(Node node, Context context, boolean printComments) {
572573
add("import.meta");
573574
break;
574575

575-
// CLASS -> NAME,EXPR|EMPTY,BLOCK
576+
// CLASS -> NAME,EXPR|EMPTY,BLOCK
576577
case CLASS:
577578
{
578579
checkState(childCount == 3, node);
@@ -1364,7 +1365,7 @@ protected void add(Node node, Context context, boolean printComments) {
13641365
cc.endTemplateLit();
13651366
break;
13661367

1367-
// Type Declaration ASTs.
1368+
// Type Declaration ASTs.
13681369
case STRING_TYPE:
13691370
add("string");
13701371
break;
@@ -1411,7 +1412,7 @@ protected void add(Node node, Context context, boolean printComments) {
14111412
addList(first.getNext());
14121413
add(">");
14131414
break;
1414-
// CLASS -> NAME,EXPR|EMPTY,BLOCK
1415+
// CLASS -> NAME,EXPR|EMPTY,BLOCK
14151416
case GENERIC_TYPE_LIST:
14161417
add("<");
14171418
addList(first, false, Context.STATEMENT, ",");
@@ -1794,7 +1795,7 @@ private void addNonEmptyStatement(Node n, Context context, boolean allowNonBlock
17941795
cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT));
17951796
} else {
17961797
printTrailingComment(n);
1797-
cc.endStatement(/* needSemiColon= */ true, /*hasTrailingCommentOnSameLine=*/ false);
1798+
cc.endStatement(/* needSemiColon= */ true, /* hasTrailingCommentOnSameLine= */ false);
17981799
}
17991800
return;
18001801
}
@@ -1821,7 +1822,7 @@ private void addNonEmptyStatement(Node n, Context context, boolean allowNonBlock
18211822

18221823
if (nodeToProcess.isEmpty()) {
18231824
printTrailingComment(n);
1824-
cc.endStatement(/* needSemiColon= */ true, /*hasTrailingCommentOnSameLine=*/ false);
1825+
cc.endStatement(/* needSemiColon= */ true, /* hasTrailingCommentOnSameLine= */ false);
18251826
} else {
18261827
add(nodeToProcess, context);
18271828
printTrailingComment(n);
@@ -2145,7 +2146,7 @@ private String strEscape(
21452146
sb.append("\\x0B");
21462147
}
21472148
break;
2148-
// From the SingleEscapeCharacter grammar production.
2149+
// From the SingleEscapeCharacter grammar production.
21492150
case '\b':
21502151
sb.append("\\b");
21512152
break;
@@ -2282,7 +2283,7 @@ private String escapeUnrecognizedCharacters(String s) {
22822283
for (int i = 0; i < s.length(); i++) {
22832284
char c = s.charAt(i);
22842285
switch (c) {
2285-
// From the SingleEscapeCharacter grammar production.
2286+
// From the SingleEscapeCharacter grammar production.
22862287
case '\b':
22872288
case '\f':
22882289
case '\n':
@@ -2337,6 +2338,7 @@ static String identifierEscape(String s) {
23372338
}
23382339
return sb.toString();
23392340
}
2341+
23402342
/**
23412343
* @param maxCount The maximum number of children to look for.
23422344
* @return The number of children of this node that are non empty up to maxCount.
@@ -2453,7 +2455,7 @@ private void processEnd(Node n, Context context) {
24532455
break;
24542456
case FUNCTION:
24552457
if (n.getLastChild().isEmpty()) {
2456-
cc.endStatement(/* needSemiColon= */ true, /*hasTrailingCommentOnSameLine=*/ false);
2458+
cc.endStatement(/* needSemiColon= */ true, /* hasTrailingCommentOnSameLine= */ false);
24572459
} else {
24582460
cc.endFunction(context == Context.STATEMENT);
24592461
}
@@ -2471,22 +2473,22 @@ private void processEnd(Node n, Context context) {
24712473
break;
24722474
case COMPUTED_PROP:
24732475
if (n.hasOneChild()) {
2474-
cc.endStatement(/* needSemiColon= */ true, /*hasTrailingCommentOnSameLine=*/ false);
2476+
cc.endStatement(/* needSemiColon= */ true, /* hasTrailingCommentOnSameLine= */ false);
24752477
}
24762478
break;
24772479
case MEMBER_FUNCTION_DEF:
24782480
case GETTER_DEF:
24792481
case SETTER_DEF:
24802482
if (n.getFirstChild().getLastChild().isEmpty()) {
2481-
cc.endStatement(/* needSemiColon= */ true, /*hasTrailingCommentOnSameLine=*/ false);
2483+
cc.endStatement(/* needSemiColon= */ true, /* hasTrailingCommentOnSameLine= */ false);
24822484
}
24832485
break;
24842486
case MEMBER_VARIABLE_DEF:
2485-
cc.endStatement(/* needSemiColon= */ true, /*hasTrailingCommentOnSameLine=*/ false);
2487+
cc.endStatement(/* needSemiColon= */ true, /* hasTrailingCommentOnSameLine= */ false);
24862488
break;
24872489
default:
24882490
if (context == Context.STATEMENT) {
2489-
cc.endStatement(/*hasTrailingCommentOnSameLine=*/ false);
2491+
cc.endStatement(/* hasTrailingCommentOnSameLine= */ false);
24902492
}
24912493
}
24922494
}

src/com/google/javascript/jscomp/TranspilationPasses.java

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ public static void addTranspilationPasses(PassListBuilder passes, CompilerOption
106106
passes.maybeAdd(rewriteNullishCoalesceOperator);
107107
}
108108

109-
110109
// NOTE: This needs to be _before_ await and yield are transpiled away.
111110
if (options.getInstrumentAsyncContext()) {
112111
passes.maybeAdd(instrumentAsyncContext);

src/com/google/javascript/jscomp/parsing/IRFactory.java

-1
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,6 @@ private boolean hasAnyPendingCommentBefore(
857857
}
858858
result.append(currentComment.value);
859859

860-
861860
lastComment = currentComment;
862861
if (commentFromJsdocTracker) {
863862
this.parsedComments.add(currentComment);

src/com/google/javascript/jscomp/parsing/parser/IdentifierToken.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
import com.google.javascript.jscomp.parsing.parser.util.SourceRange;
2020

21-
/**
22-
* A token representing an identifier.
23-
*/
21+
/** A token representing an identifier. */
2422
public class IdentifierToken extends Token {
2523
public IdentifierToken(SourceRange location, String value) {
2624
super(TokenType.IDENTIFIER, location);

src/com/google/javascript/jscomp/parsing/parser/Parser.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -3027,7 +3027,7 @@ private ParseTree maybeParseOptionalExpression(ParseTree operand) {
30273027
getTreeLocation(start),
30283028
operand,
30293029
arguments,
3030-
/* isStartOfOptionalChain = */ true,
3030+
/* isStartOfOptionalChain= */ true,
30313031
arguments.hasTrailingComma);
30323032
break;
30333033
case OPEN_SQUARE:
@@ -3036,7 +3036,7 @@ private ParseTree maybeParseOptionalExpression(ParseTree operand) {
30363036
eat(TokenType.CLOSE_SQUARE);
30373037
operand =
30383038
new OptionalMemberLookupExpressionTree(
3039-
getTreeLocation(start), operand, member, /* isStartOfOptionalChain = */ true);
3039+
getTreeLocation(start), operand, member, /* isStartOfOptionalChain= */ true);
30403040
break;
30413041
case NO_SUBSTITUTION_TEMPLATE:
30423042
case TEMPLATE_HEAD:
@@ -3047,7 +3047,7 @@ private ParseTree maybeParseOptionalExpression(ParseTree operand) {
30473047
IdentifierToken id = eatIdOrKeywordAsId();
30483048
operand =
30493049
new OptionalMemberExpressionTree(
3050-
getTreeLocation(start), operand, id, /* isStartOfOptionalChain = */ true);
3050+
getTreeLocation(start), operand, id, /* isStartOfOptionalChain= */ true);
30513051
} else {
30523052
reportError("syntax error: %s not allowed in optional chain", peekType());
30533053
}
@@ -3084,7 +3084,7 @@ private ParseTree parseRemainingOptionalChainSegment(ParseTree optionalExpressio
30843084
getTreeLocation(start),
30853085
optionalExpression,
30863086
id,
3087-
/*isStartOfOptionalChain=*/ false);
3087+
/* isStartOfOptionalChain= */ false);
30883088
break;
30893089
case OPEN_PAREN:
30903090
ArgumentListTree arguments = parseArguments();
@@ -3093,7 +3093,7 @@ private ParseTree parseRemainingOptionalChainSegment(ParseTree optionalExpressio
30933093
getTreeLocation(start),
30943094
optionalExpression,
30953095
arguments,
3096-
/* isStartOfOptionalChain = */ false,
3096+
/* isStartOfOptionalChain= */ false,
30973097
arguments.hasTrailingComma);
30983098
break;
30993099
case OPEN_SQUARE:
@@ -3105,7 +3105,7 @@ private ParseTree parseRemainingOptionalChainSegment(ParseTree optionalExpressio
31053105
getTreeLocation(start),
31063106
optionalExpression,
31073107
member,
3108-
/* isStartOfOptionalChain = */ false);
3108+
/* isStartOfOptionalChain= */ false);
31093109
break;
31103110
default:
31113111
throw new AssertionError("unexpected case: " + peekType());

src/com/google/javascript/jscomp/parsing/parser/Scanner.java

+6-9
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ public class Scanner {
4747
private int typeParameterLevel;
4848

4949
public Scanner(
50-
ErrorReporter errorReporter,
51-
CommentRecorder commentRecorder,
52-
SourceFile file,
53-
int offset) {
50+
ErrorReporter errorReporter, CommentRecorder commentRecorder, SourceFile file, int offset) {
5451
this.errorReporter = errorReporter;
5552
this.commentRecorder = commentRecorder;
5653
this.source = file;
@@ -626,8 +623,8 @@ private Token scanToken() {
626623
}
627624
case '#':
628625
return createToken(TokenType.POUND, beginToken);
629-
// TODO: add NumberToken
630-
// TODO: character following NumericLiteral must not be an IdentifierStart or DecimalDigit
626+
// TODO: add NumberToken
627+
// TODO: character following NumericLiteral must not be an IdentifierStart or DecimalDigit
631628
case '0':
632629
return scanPostZero(beginToken);
633630
case '1':
@@ -985,7 +982,7 @@ private SkipTemplateCharactersResult skipTemplateCharacters() {
985982
if (peekChar(1) == '{') {
986983
return result;
987984
}
988-
// Fall through.
985+
// Fall through.
989986
default:
990987
nextChar();
991988
}
@@ -1049,15 +1046,15 @@ private SkipTemplateCharactersResult skipTemplateCharacters() {
10491046
}
10501047
return null;
10511048
}
1052-
// https://tc39.es/ecma262/#prod-TemplateEscapeSequence
1049+
// https://tc39.es/ecma262/#prod-TemplateEscapeSequence
10531050
case '\\':
10541051
case 'b':
10551052
case 'f':
10561053
case 'n':
10571054
case 'r':
10581055
case 't':
10591056
case 'v':
1060-
// special meaning in template literal
1057+
// special meaning in template literal
10611058
case '$':
10621059
case '`':
10631060
return null;

src/com/google/javascript/jscomp/parsing/parser/trees/FunctionDeclarationTree.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ private FunctionDeclarationTree(Builder builder) {
5858
this.isAsync = builder.isAsync;
5959
}
6060

61-
/**
62-
* Builds a {@link FunctionDeclarationTree}.
63-
*/
61+
/** Builds a {@link FunctionDeclarationTree}. */
6462
public static class Builder {
6563
private final Kind kind;
6664

@@ -149,8 +147,8 @@ public Builder setAsync(boolean isAsync) {
149147
/**
150148
* Return a new {@link FunctionDeclarationTree}.
151149
*
152-
* <p> The location is provided at this point because it cannot be correctly calculated
153-
* until the whole function has been parsed.
150+
* <p>The location is provided at this point because it cannot be correctly calculated until the
151+
* whole function has been parsed.
154152
*/
155153
public FunctionDeclarationTree build(SourceRange location) {
156154
this.location = location;

src/com/google/javascript/jscomp/parsing/parser/trees/GetAccessorTree.java

-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ public GetAccessorTree(
3333
this.isStatic = isStatic;
3434
this.body = body;
3535
}
36-
3736
}

src/com/google/javascript/rhino/JSIdentifier.java

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545

4646
package com.google.javascript.rhino;
4747

48-
4948
/**
5049
* Utility class to hold isJSIdentifier.
5150
*

src/com/google/javascript/rhino/Node.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,7 @@ public final boolean isQualifiedName() {
23702370
return getFirstChild().isQualifiedName();
23712371

23722372
case MEMBER_FUNCTION_DEF:
2373-
// These are explicitly *not* qualified name components.
2373+
// These are explicitly *not* qualified name components.
23742374
default:
23752375
return false;
23762376
}
@@ -2436,7 +2436,7 @@ private boolean matchesQualifiedName(String qname, int endIndex) {
24362436
&& getFirstChild().matchesQualifiedName(qname, start - 1);
24372437

24382438
case MEMBER_FUNCTION_DEF:
2439-
// These are explicitly *not* qualified name components.
2439+
// These are explicitly *not* qualified name components.
24402440
default:
24412441
return false;
24422442
}
@@ -2462,7 +2462,7 @@ public final boolean matchesQualifiedName(Node n) {
24622462
&& getFirstChild().matchesQualifiedName(n.getFirstChild());
24632463

24642464
case MEMBER_FUNCTION_DEF:
2465-
// These are explicitly *not* qualified name components.
2465+
// These are explicitly *not* qualified name components.
24662466
default:
24672467
return false;
24682468
}

0 commit comments

Comments
 (0)