From 2cbbe5828191707f5e51ba699699bfa4dc6c3691 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 6 Feb 2018 09:53:49 +0000 Subject: Support variable declarations without assignment in UnusedPruner --- libjulia/optimiser/UnusedPruner.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libjulia/optimiser') diff --git a/libjulia/optimiser/UnusedPruner.cpp b/libjulia/optimiser/UnusedPruner.cpp index e33bef78..50f4d9f1 100644 --- a/libjulia/optimiser/UnusedPruner.cpp +++ b/libjulia/optimiser/UnusedPruner.cpp @@ -60,12 +60,14 @@ void UnusedPruner::operator()(Block& _block) [=](TypedName const& _typedName) { return used(_typedName.name); } )) { - if (!varDecl.value || MovableChecker(*varDecl.value).movable()) + if (!varDecl.value) + statement = Block{std::move(varDecl.location), {}}; + else if (MovableChecker(*varDecl.value).movable()) { subtractReferences(ReferencesCounter::countReferences(*varDecl.value)); statement = Block{std::move(varDecl.location), {}}; } - else if (varDecl.value && varDecl.variables.size() == 1) + else if (varDecl.variables.size() == 1) statement = ExpressionStatement{varDecl.location, FunctionalInstruction{ varDecl.location, solidity::Instruction::POP, -- cgit v1.2.3