| 35 | } |
| 36 | |
| 37 | void ConditionalSimplifier::operator()(Switch& _switch) |
| 38 | { |
| 39 | visit(*_switch.expression); |
| 40 | if (!std::holds_alternative<Identifier>(*_switch.expression)) |
| 41 | { |
| 42 | ASTModifier::operator()(_switch); |
| 43 | return; |
| 44 | } |
| 45 | YulName expr = std::get<Identifier>(*_switch.expression).name; |
| 46 | for (auto& _case: _switch.cases) |
| 47 | { |
| 48 | if (_case.value) |
| 49 | { |
| 50 | (*this)(*_case.value); |
| 51 | auto assignment = Statement{Assignment{ |
| 52 | _case.body.debugData, |
| 53 | {Identifier{_case.body.debugData, expr}}, |
| 54 | std::make_unique<Expression>(*_case.value) |
| 55 | }}; |
| 56 | _case.body.statements.insert(_case.body.statements.begin(), std::move(assignment)); |
| 57 | } |
| 58 | (*this)(_case.body); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | void ConditionalSimplifier::operator()(Block& _block) |
| 63 | { |
nothing calls this directly
no test coverage detected