Skip to content

Commit 5851c59

Browse files
committed
[CS] NFC: Introduce a convenience createConjunction
1 parent cc507fc commit 5851c59

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

lib/Sema/CSSyntacticElement.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,12 @@ class SyntacticElementConstraintGenerator
517517
ConstraintLocator *locator)
518518
: cs(cs), context(context), locator(locator) {}
519519

520+
void createConjunction(ArrayRef<ElementInfo> elements,
521+
ConstraintLocator *locator, bool isIsolated = false,
522+
ArrayRef<TypeVariableType *> extraTypeVars = {}) {
523+
::createConjunction(cs, elements, locator, isIsolated, extraTypeVars);
524+
}
525+
520526
void visitExprPattern(ExprPattern *EP) {
521527
auto target = SyntacticElementTarget::forExprPattern(EP);
522528

@@ -859,7 +865,7 @@ class SyntacticElementConstraintGenerator
859865
if (auto *join = context.ElementJoin.getPtrOrNull())
860866
elements.push_back(makeJoinElement(cs, join, locator));
861867

862-
createConjunction(cs, elements, locator);
868+
createConjunction(elements, locator);
863869
}
864870

865871
void visitGuardStmt(GuardStmt *guardStmt) {
@@ -868,7 +874,7 @@ class SyntacticElementConstraintGenerator
868874
visitStmtCondition(guardStmt, elements, locator);
869875
elements.push_back(makeElement(guardStmt->getBody(), locator));
870876

871-
createConjunction(cs, elements, locator);
877+
createConjunction(elements, locator);
872878
}
873879

874880
void visitWhileStmt(WhileStmt *whileStmt) {
@@ -877,16 +883,15 @@ class SyntacticElementConstraintGenerator
877883
visitStmtCondition(whileStmt, elements, locator);
878884
elements.push_back(makeElement(whileStmt->getBody(), locator));
879885

880-
createConjunction(cs, elements, locator);
886+
createConjunction(elements, locator);
881887
}
882888

883889
void visitDoStmt(DoStmt *doStmt) {
884890
visitBraceStmt(doStmt->getBody());
885891
}
886892

887893
void visitRepeatWhileStmt(RepeatWhileStmt *repeatWhileStmt) {
888-
createConjunction(cs,
889-
{makeElement(repeatWhileStmt->getCond(),
894+
createConjunction({makeElement(repeatWhileStmt->getCond(),
890895
cs.getConstraintLocator(
891896
locator, ConstraintLocator::Condition),
892897
getContextForCondition()),
@@ -895,8 +900,7 @@ class SyntacticElementConstraintGenerator
895900
}
896901

897902
void visitPoundAssertStmt(PoundAssertStmt *poundAssertStmt) {
898-
createConjunction(cs,
899-
{makeElement(poundAssertStmt->getCondition(),
903+
createConjunction({makeElement(poundAssertStmt->getCondition(),
900904
cs.getConstraintLocator(
901905
locator, ConstraintLocator::Condition),
902906
getContextForCondition())},
@@ -913,12 +917,10 @@ class SyntacticElementConstraintGenerator
913917
auto *errorExpr = throwStmt->getSubExpr();
914918

915919
createConjunction(
916-
cs,
917-
{makeElement(
918-
errorExpr,
919-
cs.getConstraintLocator(
920-
locator, LocatorPathElt::SyntacticElement(errorExpr)),
921-
{errType, CTP_ThrowStmt})},
920+
{makeElement(errorExpr,
921+
cs.getConstraintLocator(
922+
locator, LocatorPathElt::SyntacticElement(errorExpr)),
923+
{errType, CTP_ThrowStmt})},
922924
locator);
923925
}
924926

@@ -939,12 +941,10 @@ class SyntacticElementConstraintGenerator
939941
auto *selfExpr = discardStmt->getSubExpr();
940942

941943
createConjunction(
942-
cs,
943-
{makeElement(
944-
selfExpr,
945-
cs.getConstraintLocator(
946-
locator, LocatorPathElt::SyntacticElement(selfExpr)),
947-
{nominalType, CTP_DiscardStmt})},
944+
{makeElement(selfExpr,
945+
cs.getConstraintLocator(
946+
locator, LocatorPathElt::SyntacticElement(selfExpr)),
947+
{nominalType, CTP_DiscardStmt})},
948948
locator);
949949
}
950950

@@ -962,7 +962,7 @@ class SyntacticElementConstraintGenerator
962962
// Body of the `for-in` loop.
963963
elements.push_back(makeElement(forEachStmt->getBody(), stmtLoc));
964964

965-
createConjunction(cs, elements, locator);
965+
createConjunction(elements, locator);
966966
}
967967

968968
void visitSwitchStmt(SwitchStmt *switchStmt) {
@@ -990,7 +990,7 @@ class SyntacticElementConstraintGenerator
990990
if (auto *join = context.ElementJoin.getPtrOrNull())
991991
elements.push_back(makeJoinElement(cs, join, switchLoc));
992992

993-
createConjunction(cs, elements, switchLoc);
993+
createConjunction(elements, switchLoc);
994994
}
995995

996996
void visitDoCatchStmt(DoCatchStmt *doStmt) {
@@ -1007,7 +1007,7 @@ class SyntacticElementConstraintGenerator
10071007
for (auto *catchStmt : doStmt->getCatches())
10081008
elements.push_back(makeElement(catchStmt, doLoc));
10091009

1010-
createConjunction(cs, elements, doLoc);
1010+
createConjunction(elements, doLoc);
10111011
}
10121012

10131013
void visitCaseStmt(CaseStmt *caseStmt) {
@@ -1040,7 +1040,7 @@ class SyntacticElementConstraintGenerator
10401040

10411041
elements.push_back(makeElement(caseStmt->getBody(), caseLoc));
10421042

1043-
createConjunction(cs, elements, caseLoc);
1043+
createConjunction(elements, caseLoc);
10441044
}
10451045

10461046
void visitBraceStmt(BraceStmt *braceStmt) {
@@ -1127,7 +1127,7 @@ class SyntacticElementConstraintGenerator
11271127
// want to type-check captures to make sure that the context
11281128
// is valid.
11291129
if (captureList)
1130-
createConjunction(cs, elements, locator);
1130+
createConjunction(elements, locator);
11311131

11321132
return;
11331133
}
@@ -1195,7 +1195,7 @@ class SyntacticElementConstraintGenerator
11951195
contextInfo.value_or(ContextualTypeInfo()), isDiscarded));
11961196
}
11971197

1198-
createConjunction(cs, elements, locator);
1198+
createConjunction(elements, locator);
11991199
}
12001200

12011201
void visitReturnStmt(ReturnStmt *returnStmt) {
@@ -1282,7 +1282,7 @@ class SyntacticElementConstraintGenerator
12821282
auto resultElt = makeElement(resultExpr, locator,
12831283
contextInfo.value_or(ContextualTypeInfo()),
12841284
/*isDiscarded=*/false);
1285-
createConjunction(cs, {resultElt}, locator);
1285+
createConjunction({resultElt}, locator);
12861286
}
12871287

12881288
ContextualTypeInfo getContextualResultInfo() const {

0 commit comments

Comments
 (0)