Skip to content

Commit e57ff02

Browse files
committed
[NFC] Replace similar if block in claimNextArgs with matchParameterLabel().
1 parent 66d5e67 commit e57ff02

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,8 @@ static bool matchCallArgumentsImpl(
340340
// Go hunting for an unclaimed argument whose name does match.
341341
Optional<unsigned> claimedWithSameName;
342342
for (unsigned i = nextArgIdx; i != numArgs; ++i) {
343-
auto argLabel = args[i].getLabel();
344343

345-
if (argLabel != paramLabel &&
346-
!(argLabel.str().startswith("$") &&
347-
argLabel.str().drop_front() == paramLabel.str())) {
344+
if (!args[i].matchParameterLabel(paramLabel)) {
348345
// If this is an attempt to claim additional unlabeled arguments
349346
// for variadic parameter, we have to stop at first labeled argument.
350347
if (forVariadic)
@@ -376,7 +373,7 @@ static bool matchCallArgumentsImpl(
376373
// func foo(_ a: Int, _ b: Int = 0, c: Int = 0, _ d: Int) {}
377374
// foo(1, c: 2, 3) // -> `3` will be claimed as '_ b:'.
378375
// ```
379-
if (argLabel.empty())
376+
if (args[i].getLabel().empty())
380377
continue;
381378

382379
potentiallyOutOfOrder = true;

0 commit comments

Comments
 (0)