Skip to content

Commit 92afbc5

Browse files
xedinrjmccall
authored andcommitted
[AST] PackExpansionMatcher/NFC: Rename {lhs, rhs}Params to {lhs, rhs}Elts
1 parent 9d24f80 commit 92afbc5

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

include/swift/AST/PackExpansionMatcher.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ class TypeListPackMatcher {
6363
SmallVector<MatchedPair, 4> pairs;
6464

6565
[[nodiscard]] bool match() {
66-
ArrayRef<Element> lhsParams(lhsElements);
67-
ArrayRef<Element> rhsParams(rhsElements);
66+
ArrayRef<Element> lhsElts(lhsElements);
67+
ArrayRef<Element> rhsElts(rhsElements);
6868

69-
unsigned minLength = std::min(lhsParams.size(), rhsParams.size());
69+
unsigned minLength = std::min(lhsElts.size(), rhsElts.size());
7070

7171
// Consume the longest possible prefix where neither type in
7272
// the pair is a pack expansion type.
@@ -75,8 +75,8 @@ class TypeListPackMatcher {
7575
unsigned lhsIdx = i;
7676
unsigned rhsIdx = i;
7777

78-
auto lhsElt = lhsParams[lhsIdx];
79-
auto rhsElt = rhsParams[rhsIdx];
78+
auto lhsElt = lhsElts[lhsIdx];
79+
auto rhsElt = rhsElts[rhsIdx];
8080

8181
if (getElementLabel(lhsElt) != getElementLabel(rhsElt))
8282
break;
@@ -101,11 +101,11 @@ class TypeListPackMatcher {
101101
// the pair is a pack expansion type.
102102
unsigned suffixLength = 0;
103103
for (unsigned i = 0; i < minLength - prefixLength; ++i) {
104-
unsigned lhsIdx = lhsParams.size() - i - 1;
105-
unsigned rhsIdx = rhsParams.size() - i - 1;
104+
unsigned lhsIdx = lhsElts.size() - i - 1;
105+
unsigned rhsIdx = rhsElts.size() - i - 1;
106106

107-
auto lhsElt = lhsParams[lhsIdx];
108-
auto rhsElt = rhsParams[rhsIdx];
107+
auto lhsElt = lhsElts[lhsIdx];
108+
auto rhsElt = rhsElts[rhsIdx];
109109

110110
// FIXME: Check flags
111111

@@ -124,27 +124,27 @@ class TypeListPackMatcher {
124124
++suffixLength;
125125
}
126126

127-
assert(prefixLength + suffixLength <= lhsParams.size());
128-
assert(prefixLength + suffixLength <= rhsParams.size());
127+
assert(prefixLength + suffixLength <= lhsElts.size());
128+
assert(prefixLength + suffixLength <= rhsElts.size());
129129

130130
// Drop the consumed prefix and suffix from each list of types.
131-
lhsParams = lhsParams.drop_front(prefixLength).drop_back(suffixLength);
132-
rhsParams = rhsParams.drop_front(prefixLength).drop_back(suffixLength);
131+
lhsElts = lhsElts.drop_front(prefixLength).drop_back(suffixLength);
132+
rhsElts = rhsElts.drop_front(prefixLength).drop_back(suffixLength);
133133

134134
// If nothing remains, we're done.
135-
if (lhsParams.empty() && rhsParams.empty())
135+
if (lhsElts.empty() && rhsElts.empty())
136136
return false;
137137

138138
// If the left hand side is a single pack expansion type, bind it
139139
// to what remains of the right hand side.
140-
if (lhsParams.size() == 1) {
141-
auto lhsType = getElementType(lhsParams[0]);
140+
if (lhsElts.size() == 1) {
141+
auto lhsType = getElementType(lhsElts[0]);
142142
if (auto *lhsExpansion = lhsType->template getAs<PackExpansionType>()) {
143143
unsigned lhsIdx = prefixLength;
144144
unsigned rhsIdx = prefixLength;
145145

146146
SmallVector<Type, 2> rhsTypes;
147-
for (auto rhsElt : rhsParams) {
147+
for (auto rhsElt : rhsElts) {
148148
if (!getElementLabel(rhsElt).empty())
149149
return true;
150150

@@ -161,14 +161,14 @@ class TypeListPackMatcher {
161161

162162
// If the right hand side is a single pack expansion type, bind it
163163
// to what remains of the left hand side.
164-
if (rhsParams.size() == 1) {
165-
auto rhsType = getElementType(rhsParams[0]);
164+
if (rhsElts.size() == 1) {
165+
auto rhsType = getElementType(rhsElts[0]);
166166
if (auto *rhsExpansion = rhsType->template getAs<PackExpansionType>()) {
167167
unsigned lhsIdx = prefixLength;
168168
unsigned rhsIdx = prefixLength;
169169

170170
SmallVector<Type, 2> lhsTypes;
171-
for (auto lhsElt : lhsParams) {
171+
for (auto lhsElt : lhsElts) {
172172
if (!getElementLabel(lhsElt).empty())
173173
return true;
174174

0 commit comments

Comments
 (0)