File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -457,8 +457,7 @@ void ControlFlowBuilder::operator()(yul::Switch const& _switch)
457
457
}
458
458
mergeFlow (nodes);
459
459
460
- bool hasDefault = util::contains_if (_switch.cases , [](yul::Case const & _case) { return !_case.value ; });
461
- if (!hasDefault)
460
+ if (!hasDefaultCase (_switch))
462
461
connect (beforeSwitch, m_currentNode);
463
462
}
464
463
Original file line number Diff line number Diff line change @@ -144,4 +144,13 @@ template <class... Args> inline std::shared_ptr<DebugData const> debugDataOf(std
144
144
return std::visit ([](auto const & _arg) { return debugDataOf (_arg); }, _node);
145
145
}
146
146
147
+ inline bool hasDefaultCase (Switch const & _switch)
148
+ {
149
+ return std::any_of (
150
+ _switch.cases .begin (),
151
+ _switch.cases .end (),
152
+ [](Case const & _case) { return !_case.value ; }
153
+ );
154
+ }
155
+
147
156
}
Original file line number Diff line number Diff line change @@ -60,13 +60,7 @@ void removeEmptyDefaultFromSwitch(Switch& _switchStmt)
60
60
61
61
void removeEmptyCasesFromSwitch (Switch& _switchStmt)
62
62
{
63
- bool hasDefault = std::any_of (
64
- _switchStmt.cases .begin (),
65
- _switchStmt.cases .end (),
66
- [](Case const & _case) { return !_case.value ; }
67
- );
68
-
69
- if (hasDefault)
63
+ if (hasDefaultCase (_switchStmt))
70
64
return ;
71
65
72
66
ranges::actions::remove_if (
You can’t perform that action at this time.
0 commit comments