From db3bea7b569884a50f266b50097245d253bac072 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 5 Mar 2019 19:41:29 +0100 Subject: [PATCH] Use reference for so we have to type less --- libyul/optimiser/StructuralSimplifier.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libyul/optimiser/StructuralSimplifier.cpp b/libyul/optimiser/StructuralSimplifier.cpp index 8010b7b22..e7b34e201 100644 --- a/libyul/optimiser/StructuralSimplifier.cpp +++ b/libyul/optimiser/StructuralSimplifier.cpp @@ -83,9 +83,11 @@ void StructuralSimplifier::simplify(std::vector& _statements) return {}; }, [&](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); if (switchCase.value) { @@ -112,7 +114,7 @@ void StructuralSimplifier::simplify(std::vector& _statements) Block* matchingCaseBlock = nullptr; Case* defaultCase = nullptr; - for (auto& _case: _switchStmt.cases) + for (auto& _case: cases) { if (_case.value && valueOfLiteral(*_case.value) == constExprVal) {