Skip to content

Commit cae7a70

Browse files
authored
Merge pull request #31946 from xwu/he-plac
[NFC][SourceKit] Correct a typo in SwiftEditor.cpp
2 parents 28fa3ab + e59d9eb commit cae7a70

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,21 +1697,21 @@ class PlaceholderExpansionScanner {
16971697

16981698
struct ParamClosureInfo {
16991699
Optional<ClosureInfo> placeholderClosure;
1700-
bool isNonPlacholderClosure = false;
1700+
bool isNonPlaceholderClosure = false;
17011701
bool isWrappedWithBraces = false;
17021702
};
17031703

17041704
/// Scan the given TupleExpr collecting parameter closure information and
17051705
/// returning the index of the given target placeholder (if found).
1706-
Optional<unsigned> scanTupleExpr(TupleExpr *TE, SourceLoc targetPlacholderLoc,
1706+
Optional<unsigned> scanTupleExpr(TupleExpr *TE, SourceLoc targetPlaceholderLoc,
17071707
std::vector<ParamClosureInfo> &outParams) {
17081708
if (TE->getElements().empty())
17091709
return llvm::None;
17101710

17111711
outParams.clear();
17121712
outParams.reserve(TE->getNumElements());
17131713

1714-
Optional<unsigned> targetPlacholderIndex;
1714+
Optional<unsigned> targetPlaceholderIndex;
17151715

17161716
for (Expr *E : TE->getElements()) {
17171717
outParams.emplace_back();
@@ -1720,8 +1720,8 @@ class PlaceholderExpansionScanner {
17201720
if (auto CE = dyn_cast<ClosureExpr>(E)) {
17211721
if (CE->hasSingleExpressionBody() &&
17221722
CE->getSingleExpressionBody()->getStartLoc() ==
1723-
targetPlacholderLoc) {
1724-
targetPlacholderIndex = outParams.size() - 1;
1723+
targetPlaceholderLoc) {
1724+
targetPlaceholderIndex = outParams.size() - 1;
17251725
if (auto *PHE = dyn_cast<EditorPlaceholderExpr>(
17261726
CE->getSingleExpressionBody())) {
17271727
outParam.isWrappedWithBraces = true;
@@ -1732,7 +1732,7 @@ class PlaceholderExpansionScanner {
17321732
}
17331733
}
17341734
// else...
1735-
outParam.isNonPlacholderClosure = true;
1735+
outParam.isNonPlaceholderClosure = true;
17361736
continue;
17371737
}
17381738

@@ -1741,15 +1741,15 @@ class PlaceholderExpansionScanner {
17411741
if (scanClosureType(PHE, info))
17421742
outParam.placeholderClosure = info;
17431743
} else if (containClosure(E)) {
1744-
outParam.isNonPlacholderClosure = true;
1744+
outParam.isNonPlaceholderClosure = true;
17451745
}
17461746

1747-
if (E->getStartLoc() == targetPlacholderLoc) {
1748-
targetPlacholderIndex = outParams.size() - 1;
1747+
if (E->getStartLoc() == targetPlaceholderLoc) {
1748+
targetPlaceholderIndex = outParams.size() - 1;
17491749
}
17501750
}
17511751

1752-
return targetPlacholderIndex;
1752+
return targetPlaceholderIndex;
17531753
}
17541754

17551755
public:
@@ -1785,21 +1785,21 @@ class PlaceholderExpansionScanner {
17851785
// and if the call parens can be removed in that case.
17861786
// We'll first find the enclosing CallExpr, and then do further analysis.
17871787
std::vector<ParamClosureInfo> params;
1788-
Optional<unsigned> targetPlacholderIndex;
1788+
Optional<unsigned> targetPlaceholderIndex;
17891789
auto ECE = enclosingCallExprArg(SF, PlaceholderStartLoc);
17901790
Expr *Args = ECE.first;
17911791
if (Args && ECE.second) {
17921792
if (isa<ParenExpr>(Args)) {
17931793
params.emplace_back();
17941794
params.back().placeholderClosure = TargetClosureInfo;
1795-
targetPlacholderIndex = 0;
1795+
targetPlaceholderIndex = 0;
17961796
} else if (auto *TE = dyn_cast<TupleExpr>(Args)) {
1797-
targetPlacholderIndex = scanTupleExpr(TE, PlaceholderStartLoc, params);
1797+
targetPlaceholderIndex = scanTupleExpr(TE, PlaceholderStartLoc, params);
17981798
}
17991799
}
18001800

18011801
// If there was no appropriate parent call expression, it's non-trailing.
1802-
if (!targetPlacholderIndex.hasValue()) {
1802+
if (!targetPlaceholderIndex.hasValue()) {
18031803
OneClosureCallback(Args, /*useTrailingClosure=*/false,
18041804
/*isWrappedWithBraces=*/false, TargetClosureInfo);
18051805
return true;
@@ -1811,23 +1811,23 @@ class PlaceholderExpansionScanner {
18111811
// Find the first parameter eligible to be trailing.
18121812
while (firstTrailingIndex != 0) {
18131813
unsigned i = firstTrailingIndex - 1;
1814-
if (params[i].isNonPlacholderClosure ||
1814+
if (params[i].isNonPlaceholderClosure ||
18151815
!params[i].placeholderClosure.hasValue())
18161816
break;
18171817
firstTrailingIndex = i;
18181818
}
18191819

1820-
if (firstTrailingIndex > targetPlacholderIndex) {
1820+
if (firstTrailingIndex > targetPlaceholderIndex) {
18211821
// Target comes before the eligible trailing closures.
18221822
OneClosureCallback(Args, /*isTrailing=*/false,
1823-
params[*targetPlacholderIndex].isWrappedWithBraces,
1823+
params[*targetPlaceholderIndex].isWrappedWithBraces,
18241824
TargetClosureInfo);
18251825
return true;
1826-
} else if (targetPlacholderIndex == end - 1 &&
1826+
} else if (targetPlaceholderIndex == end - 1 &&
18271827
firstTrailingIndex == end - 1) {
18281828
// Target is the only eligible trailing closure.
18291829
OneClosureCallback(Args, /*isTrailing=*/true,
1830-
params[*targetPlacholderIndex].isWrappedWithBraces,
1830+
params[*targetPlaceholderIndex].isWrappedWithBraces,
18311831
TargetClosureInfo);
18321832
return true;
18331833
}

0 commit comments

Comments
 (0)