Skip to content

Commit 511662b

Browse files
committed
[clang-format][NFC] Don't call startsSequence() in the parser
It always returns false in the unwrapped line parser!
1 parent 36c1e56 commit 511662b

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,8 +2278,7 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
22782278
}
22792279

22802280
void UnwrappedLineParser::tryToParseJSFunction() {
2281-
assert(FormatTok->is(Keywords.kw_function) ||
2282-
FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function));
2281+
assert(FormatTok->is(Keywords.kw_function));
22832282
if (FormatTok->is(Keywords.kw_async))
22842283
nextToken();
22852284
// Consume "function".
@@ -2357,8 +2356,7 @@ bool UnwrappedLineParser::parseBracedList(bool ContinueOnSemicolons,
23572356
continue;
23582357
}
23592358
if (Style.isJavaScript()) {
2360-
if (FormatTok->is(Keywords.kw_function) ||
2361-
FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) {
2359+
if (FormatTok->is(Keywords.kw_function)) {
23622360
tryToParseJSFunction();
23632361
continue;
23642362
}
@@ -2511,14 +2509,10 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType) {
25112509
nextToken();
25122510
break;
25132511
case tok::identifier:
2514-
if (Style.isJavaScript() &&
2515-
(FormatTok->is(Keywords.kw_function) ||
2516-
FormatTok->startsSequence(Keywords.kw_async,
2517-
Keywords.kw_function))) {
2512+
if (Style.isJavaScript() && (FormatTok->is(Keywords.kw_function)))
25182513
tryToParseJSFunction();
2519-
} else {
2514+
else
25202515
nextToken();
2521-
}
25222516
break;
25232517
case tok::kw_requires: {
25242518
auto RequiresToken = FormatTok;

0 commit comments

Comments
 (0)