Skip to content

Commit c5695c2

Browse files
committed
[ConstraintGraph] NFC: Convert shouldContractEdge into a closure since it's only used by contractEdges
1 parent 0cc0a3a commit c5695c2

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lib/Sema/ConstraintGraph.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,25 +1298,24 @@ ConstraintGraph::computeConnectedComponents(
12981298
return cc.getComponents();
12991299
}
13001300

1301-
1302-
/// For a given constraint kind, decide if we should attempt to eliminate its
1303-
/// edge in the graph.
1304-
static bool shouldContractEdge(ConstraintKind kind) {
1305-
switch (kind) {
1306-
case ConstraintKind::BindParam:
1307-
return true;
1308-
1309-
default:
1310-
return false;
1311-
}
1312-
}
1313-
13141301
bool ConstraintGraph::contractEdges() {
13151302
// Current constraint system doesn't have any closure expressions
13161303
// associated with it so there is nothing to here.
13171304
if (CS.ClosureTypes.empty())
13181305
return false;
13191306

1307+
// For a given constraint kind, decide if we should attempt to eliminate its
1308+
// edge in the graph.
1309+
auto shouldContractEdge = [](ConstraintKind kind) {
1310+
switch (kind) {
1311+
case ConstraintKind::BindParam:
1312+
return true;
1313+
1314+
default:
1315+
return false;
1316+
}
1317+
};
1318+
13201319
SmallVector<Constraint *, 16> constraints;
13211320
for (const auto &closure : CS.ClosureTypes) {
13221321
for (const auto &param : closure.second->getParams()) {

0 commit comments

Comments
 (0)