diff options
author | chriseth <chris@ethereum.org> | 2018-02-06 22:51:46 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-05-02 23:39:42 +0800 |
commit | bf27e869842790cd3e4c84f5c820d80a4071ee5c (patch) | |
tree | 2e9825d5fc6d3863fa7f35b140bc9c0f4ada1e1e /libjulia | |
parent | c7245ba362e2300c794451328639ef924325771a (diff) | |
download | dexon-solidity-bf27e869842790cd3e4c84f5c820d80a4071ee5c.tar.gz dexon-solidity-bf27e869842790cd3e4c84f5c820d80a4071ee5c.tar.zst dexon-solidity-bf27e869842790cd3e4c84f5c820d80a4071ee5c.zip |
Extend pop(0)-remover to any movable expression.
Diffstat (limited to 'libjulia')
-rw-r--r-- | libjulia/optimiser/FullInliner.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libjulia/optimiser/FullInliner.cpp b/libjulia/optimiser/FullInliner.cpp index d2d9d188..10955e94 100644 --- a/libjulia/optimiser/FullInliner.cpp +++ b/libjulia/optimiser/FullInliner.cpp @@ -23,6 +23,7 @@ #include <libjulia/optimiser/ASTCopier.h> #include <libjulia/optimiser/ASTWalker.h> #include <libjulia/optimiser/NameCollector.h> +#include <libjulia/optimiser/Semantics.h> #include <libsolidity/inlineasm/AsmData.h> @@ -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<ExpressionStatement&>(_statement); @@ -167,10 +168,8 @@ void InlineModifier::visit(Statement& _statement) { FunctionalInstruction& funInstr = boost::get<FunctionalInstruction&>(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, {}}; - } } } } |