@@ -1697,21 +1697,21 @@ class PlaceholderExpansionScanner {
1697
1697
1698
1698
struct ParamClosureInfo {
1699
1699
Optional<ClosureInfo> placeholderClosure;
1700
- bool isNonPlacholderClosure = false ;
1700
+ bool isNonPlaceholderClosure = false ;
1701
1701
bool isWrappedWithBraces = false ;
1702
1702
};
1703
1703
1704
1704
// / Scan the given TupleExpr collecting parameter closure information and
1705
1705
// / 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 ,
1707
1707
std::vector<ParamClosureInfo> &outParams) {
1708
1708
if (TE->getElements ().empty ())
1709
1709
return llvm::None;
1710
1710
1711
1711
outParams.clear ();
1712
1712
outParams.reserve (TE->getNumElements ());
1713
1713
1714
- Optional<unsigned > targetPlacholderIndex ;
1714
+ Optional<unsigned > targetPlaceholderIndex ;
1715
1715
1716
1716
for (Expr *E : TE->getElements ()) {
1717
1717
outParams.emplace_back ();
@@ -1720,8 +1720,8 @@ class PlaceholderExpansionScanner {
1720
1720
if (auto CE = dyn_cast<ClosureExpr>(E)) {
1721
1721
if (CE->hasSingleExpressionBody () &&
1722
1722
CE->getSingleExpressionBody ()->getStartLoc () ==
1723
- targetPlacholderLoc ) {
1724
- targetPlacholderIndex = outParams.size () - 1 ;
1723
+ targetPlaceholderLoc ) {
1724
+ targetPlaceholderIndex = outParams.size () - 1 ;
1725
1725
if (auto *PHE = dyn_cast<EditorPlaceholderExpr>(
1726
1726
CE->getSingleExpressionBody ())) {
1727
1727
outParam.isWrappedWithBraces = true ;
@@ -1732,7 +1732,7 @@ class PlaceholderExpansionScanner {
1732
1732
}
1733
1733
}
1734
1734
// else...
1735
- outParam.isNonPlacholderClosure = true ;
1735
+ outParam.isNonPlaceholderClosure = true ;
1736
1736
continue ;
1737
1737
}
1738
1738
@@ -1741,15 +1741,15 @@ class PlaceholderExpansionScanner {
1741
1741
if (scanClosureType (PHE, info))
1742
1742
outParam.placeholderClosure = info;
1743
1743
} else if (containClosure (E)) {
1744
- outParam.isNonPlacholderClosure = true ;
1744
+ outParam.isNonPlaceholderClosure = true ;
1745
1745
}
1746
1746
1747
- if (E->getStartLoc () == targetPlacholderLoc ) {
1748
- targetPlacholderIndex = outParams.size () - 1 ;
1747
+ if (E->getStartLoc () == targetPlaceholderLoc ) {
1748
+ targetPlaceholderIndex = outParams.size () - 1 ;
1749
1749
}
1750
1750
}
1751
1751
1752
- return targetPlacholderIndex ;
1752
+ return targetPlaceholderIndex ;
1753
1753
}
1754
1754
1755
1755
public:
@@ -1785,21 +1785,21 @@ class PlaceholderExpansionScanner {
1785
1785
// and if the call parens can be removed in that case.
1786
1786
// We'll first find the enclosing CallExpr, and then do further analysis.
1787
1787
std::vector<ParamClosureInfo> params;
1788
- Optional<unsigned > targetPlacholderIndex ;
1788
+ Optional<unsigned > targetPlaceholderIndex ;
1789
1789
auto ECE = enclosingCallExprArg (SF, PlaceholderStartLoc);
1790
1790
Expr *Args = ECE.first ;
1791
1791
if (Args && ECE.second ) {
1792
1792
if (isa<ParenExpr>(Args)) {
1793
1793
params.emplace_back ();
1794
1794
params.back ().placeholderClosure = TargetClosureInfo;
1795
- targetPlacholderIndex = 0 ;
1795
+ targetPlaceholderIndex = 0 ;
1796
1796
} else if (auto *TE = dyn_cast<TupleExpr>(Args)) {
1797
- targetPlacholderIndex = scanTupleExpr (TE, PlaceholderStartLoc, params);
1797
+ targetPlaceholderIndex = scanTupleExpr (TE, PlaceholderStartLoc, params);
1798
1798
}
1799
1799
}
1800
1800
1801
1801
// If there was no appropriate parent call expression, it's non-trailing.
1802
- if (!targetPlacholderIndex .hasValue ()) {
1802
+ if (!targetPlaceholderIndex .hasValue ()) {
1803
1803
OneClosureCallback (Args, /* useTrailingClosure=*/ false ,
1804
1804
/* isWrappedWithBraces=*/ false , TargetClosureInfo);
1805
1805
return true ;
@@ -1811,23 +1811,23 @@ class PlaceholderExpansionScanner {
1811
1811
// Find the first parameter eligible to be trailing.
1812
1812
while (firstTrailingIndex != 0 ) {
1813
1813
unsigned i = firstTrailingIndex - 1 ;
1814
- if (params[i].isNonPlacholderClosure ||
1814
+ if (params[i].isNonPlaceholderClosure ||
1815
1815
!params[i].placeholderClosure .hasValue ())
1816
1816
break ;
1817
1817
firstTrailingIndex = i;
1818
1818
}
1819
1819
1820
- if (firstTrailingIndex > targetPlacholderIndex ) {
1820
+ if (firstTrailingIndex > targetPlaceholderIndex ) {
1821
1821
// Target comes before the eligible trailing closures.
1822
1822
OneClosureCallback (Args, /* isTrailing=*/ false ,
1823
- params[*targetPlacholderIndex ].isWrappedWithBraces ,
1823
+ params[*targetPlaceholderIndex ].isWrappedWithBraces ,
1824
1824
TargetClosureInfo);
1825
1825
return true ;
1826
- } else if (targetPlacholderIndex == end - 1 &&
1826
+ } else if (targetPlaceholderIndex == end - 1 &&
1827
1827
firstTrailingIndex == end - 1 ) {
1828
1828
// Target is the only eligible trailing closure.
1829
1829
OneClosureCallback (Args, /* isTrailing=*/ true ,
1830
- params[*targetPlacholderIndex ].isWrappedWithBraces ,
1830
+ params[*targetPlaceholderIndex ].isWrappedWithBraces ,
1831
1831
TargetClosureInfo);
1832
1832
return true ;
1833
1833
}
0 commit comments