From bf27e869842790cd3e4c84f5c820d80a4071ee5c Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 6 Feb 2018 15:51:46 +0100 Subject: [PATCH] Extend pop(0)-remover to any movable expression. --- libjulia/optimiser/FullInliner.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libjulia/optimiser/FullInliner.cpp b/libjulia/optimiser/FullInliner.cpp index d2d9d1884..10955e940 100644 --- a/libjulia/optimiser/FullInliner.cpp +++ b/libjulia/optimiser/FullInliner.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -159,7 +160,7 @@ void InlineModifier::visit(Expression& _expression) void InlineModifier::visit(Statement& _statement) { ASTModifier::visit(_statement); - // Replace pop(0) expression statemets by empty blocks. + // Replace pop(0) expression statemets (and others) by empty blocks. if (_statement.type() == typeid(ExpressionStatement)) { ExpressionStatement& expSt = boost::get(_statement); @@ -167,10 +168,8 @@ void InlineModifier::visit(Statement& _statement) { FunctionalInstruction& funInstr = boost::get(expSt.expression); if (funInstr.instruction == solidity::Instruction::POP) - { - if (funInstr.arguments.at(0).type() == typeid(Literal)) + if (MovableChecker(funInstr.arguments.at(0)).movable()) _statement = Block{expSt.location, {}}; - } } } }