Skip to content

Commit c4ea2d9

Browse files
jensjohaCommit Queue
authored and
Commit Queue
committed
[parser] Add comments to calls
Change-Id: Ide38846a6ff93c0bb7714ad89cc2f14accb0ed20 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263126 Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent b3dbaad commit c4ea2d9

File tree

9 files changed

+295
-231
lines changed

9 files changed

+295
-231
lines changed

pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ class Parser {
12661266
// Insert missing 'Function' below.
12671267
reportRecoverableError(endGroup,
12681268
missingParameterMessage(MemberKind.FunctionTypeAlias));
1269-
rewriter.insertParens(endGroup, /*includeIdentifier =*/ false);
1269+
rewriter.insertParens(endGroup, /* includeIdentifier = */ false);
12701270
recover = true;
12711271
} else if (optional('(', endGroup.next!) &&
12721272
endGroup.next!.endGroup != null &&
@@ -2856,7 +2856,7 @@ class Parser {
28562856
} else {
28572857
token = IdentifierContext.extensionShowHideElementMemberOrType
28582858
.ensureIdentifier(token.next!, this);
2859-
listener.handleShowHideIdentifier(null, token);
2859+
listener.handleShowHideIdentifier(/* modifier = */ null, token);
28602860
}
28612861
}
28622862
++elementCount;
@@ -4447,7 +4447,7 @@ class Parser {
44474447
codes.templateExperimentNotEnabled
44484448
.withArguments("triple-shift", "2.14"));
44494449
operator = rewriter.replaceNextTokensWithSyntheticToken(
4450-
name, 2, TokenType.GT_GT_GT);
4450+
name, /* count = */ 2, TokenType.GT_GT_GT);
44514451
}
44524452
}
44534453
}
@@ -5520,7 +5520,7 @@ class Parser {
55205520
.withArguments("triple-shift", "2.14"));
55215521
assert(next == operator);
55225522
next = rewriter.replaceNextTokensWithSyntheticToken(
5523-
token, 2, TokenType.GT_GT_GT_EQ);
5523+
token, /* count = */ 2, TokenType.GT_GT_GT_EQ);
55245524
operator = next;
55255525
}
55265526
token = optional('throw', next.next!)
@@ -5615,7 +5615,7 @@ class Parser {
56155615
.withArguments("triple-shift", "2.14"));
56165616
assert(next == operator);
56175617
next = rewriter.replaceNextTokensWithSyntheticToken(
5618-
token, 2, TokenType.GT_GT_GT);
5618+
token, /* count = */ 2, TokenType.GT_GT_GT);
56195619
operator = next;
56205620
}
56215621
}
@@ -5646,7 +5646,7 @@ class Parser {
56465646
if (!enteredLoop && _recoverAtPrecedenceLevel && !_currentlyRecovering) {
56475647
// Attempt recovery
56485648
if (_attemptPrecedenceLevelRecovery(
5649-
token, precedence, /*currentLevel = */ -1, allowCascades, typeArg)) {
5649+
token, precedence, /* currentLevel = */ -1, allowCascades, typeArg)) {
56505650
return _parsePrecedenceExpressionLoop(
56515651
precedence, allowCascades, typeArg, token);
56525652
}
@@ -6121,7 +6121,8 @@ class Parser {
61216121
}
61226122
bool old = mayParseFunctionExpressions;
61236123
mayParseFunctionExpressions = true;
6124-
token = parseParenthesizedExpressionOrRecordLiteral(token, null);
6124+
token = parseParenthesizedExpressionOrRecordLiteral(
6125+
token, /* constKeywordForRecord = */ null);
61256126
mayParseFunctionExpressions = old;
61266127
return token;
61276128
}
@@ -6243,7 +6244,7 @@ class Parser {
62436244
listener.handleParenthesizedCondition(begin, case_);
62446245
} else {
62456246
token = ensureCloseParen(token, begin);
6246-
listener.handleParenthesizedCondition(begin, null);
6247+
listener.handleParenthesizedCondition(begin, /* case_ = */ null);
62476248
}
62486249
assert(optional(')', token));
62496250
return token;
@@ -9293,7 +9294,7 @@ class Parser {
92939294
// grammar
92949295
token = parsePrecedenceExpression(
92959296
token, SELECTOR_PRECEDENCE, /* allowCascades = */ false);
9296-
listener.handleConstantPattern(null);
9297+
listener.handleConstantPattern(/* constKeyword = */ null);
92979298
return token;
92989299
}
92999300

pkg/_fe_analyzer_shared/lib/src/parser/parser_main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DebugListener extends Listener {
3333
mainEntryPoint(List<String> arguments) async {
3434
for (String argument in arguments) {
3535
if (argument.startsWith("@")) {
36-
Uri uri = Uri.base.resolve(argument.substring(/* startIndex = */ 1));
36+
Uri uri = Uri.base.resolve(argument.substring(/* start = */ 1));
3737
await for (String file in new File.fromUri(uri)
3838
.openRead()
3939
.cast<List<int>>()

pkg/_fe_analyzer_shared/lib/src/parser/quote.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ String unescapeLastStringPart(String last, Quote quote, Object location,
130130
bool isLastQuoteSynthetic, UnescapeErrorListener listener) {
131131
int end = last.length - (isLastQuoteSynthetic ? 0 : lastQuoteLength(quote));
132132
return unescape(
133-
last.substring(/* startIndex = */ 0, end), quote, location, listener);
133+
last.substring(/* start = */ 0, end), quote, location, listener);
134134
}
135135

136136
String unescapeString(

pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ abstract class StackListener extends Listener {
261261
String s = " $o";
262262
int index = s.indexOf("\n");
263263
if (index != -1) {
264-
s = s.substring(/* startIndex = */ 0, index) + "...";
264+
s = s.substring(/* start = */ 0, index) + "...";
265265
}
266266
print(s);
267267
}

pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ TypeParamOrArgInfo computeTypeParamOrArg(Token token,
403403
} else if (optional('(', next)) {
404404
bool recordType = false;
405405
if (isPossibleRecordType(next)) {
406-
TypeInfo type = computeType(beginGroup, false);
406+
TypeInfo type = computeType(beginGroup, /* required = */ false);
407407
if (type is ComplexTypeInfo &&
408408
(type.recordType || type.gftReturnTypeHasRecordType) &&
409409
!type.recovered) {

pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,11 @@ class ComplexTypeInfo implements TypeInfo {
600600
// generate the full type.
601601
noType.parseType(token, parser);
602602
} else if (recordType) {
603-
token = parser.parseRecordType(start, token, beforeQuestionMark != null);
603+
token = parser.parseRecordType(start, token,
604+
/* questionMarkPartOfType = */ beforeQuestionMark != null);
604605
} else if (gftReturnTypeHasRecordType) {
605-
token = parser.parseRecordType(start, token, true);
606+
token = parser.parseRecordType(
607+
start, token, /* questionMarkPartOfType = */ true);
606608
} else {
607609
Token typeRefOrPrefix = token.next!;
608610
if (optional('void', typeRefOrPrefix)) {

pkg/_fe_analyzer_shared/lib/src/scanner/string_canonicalizer.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ abstract class Node {
1818
class StringNode extends Node {
1919
StringNode(super.payload, super.next);
2020

21-
int get hash => StringCanonicalizer.hashString(payload, 0, payload.length);
21+
int get hash =>
22+
StringCanonicalizer.hashString(payload, /* start = */ 0, payload.length);
2223
}
2324

2425
class Utf8Node extends Node {
@@ -163,7 +164,8 @@ class StringCanonicalizer {
163164

164165
String canonicalizeString(String data) {
165166
if (_count > _size) rehash();
166-
final int index = hashString(data, 0, data.length) & (_size - 1);
167+
final int index =
168+
hashString(data, /* start = */ 0, data.length) & (_size - 1);
167169
Node? s = _nodes[index];
168170
Node? t = s;
169171
while (t != null) {

0 commit comments

Comments
 (0)