Use reference for so we have to type less

This commit is contained in:
Mathias Baumann 2019-03-05 19:41:29 +01:00 committed by chriseth
parent 3ccf73b3eb
commit db3bea7b56

View File

@ -83,9 +83,11 @@ void StructuralSimplifier::simplify(std::vector<yul::Statement>& _statements)
return {}; return {};
}, },
[&](Switch& _switchStmt) -> OptionalStatements { [&](Switch& _switchStmt) -> OptionalStatements {
if (_switchStmt.cases.size() == 1) auto& cases = _switchStmt.cases;
if (cases.size() == 1)
{ {
auto& switchCase = _switchStmt.cases.front(); auto& switchCase = cases.front();
auto loc = locationOf(*_switchStmt.expression); auto loc = locationOf(*_switchStmt.expression);
if (switchCase.value) if (switchCase.value)
{ {
@ -112,7 +114,7 @@ void StructuralSimplifier::simplify(std::vector<yul::Statement>& _statements)
Block* matchingCaseBlock = nullptr; Block* matchingCaseBlock = nullptr;
Case* defaultCase = nullptr; Case* defaultCase = nullptr;
for (auto& _case: _switchStmt.cases) for (auto& _case: cases)
{ {
if (_case.value && valueOfLiteral(*_case.value) == constExprVal) if (_case.value && valueOfLiteral(*_case.value) == constExprVal)
{ {