mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Extend pop(0)-remover to any movable expression.
This commit is contained in:
parent
c7245ba362
commit
bf27e86984
@ -23,6 +23,7 @@
|
|||||||
#include <libjulia/optimiser/ASTCopier.h>
|
#include <libjulia/optimiser/ASTCopier.h>
|
||||||
#include <libjulia/optimiser/ASTWalker.h>
|
#include <libjulia/optimiser/ASTWalker.h>
|
||||||
#include <libjulia/optimiser/NameCollector.h>
|
#include <libjulia/optimiser/NameCollector.h>
|
||||||
|
#include <libjulia/optimiser/Semantics.h>
|
||||||
|
|
||||||
#include <libsolidity/inlineasm/AsmData.h>
|
#include <libsolidity/inlineasm/AsmData.h>
|
||||||
|
|
||||||
@ -159,7 +160,7 @@ void InlineModifier::visit(Expression& _expression)
|
|||||||
void InlineModifier::visit(Statement& _statement)
|
void InlineModifier::visit(Statement& _statement)
|
||||||
{
|
{
|
||||||
ASTModifier::visit(_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))
|
if (_statement.type() == typeid(ExpressionStatement))
|
||||||
{
|
{
|
||||||
ExpressionStatement& expSt = boost::get<ExpressionStatement&>(_statement);
|
ExpressionStatement& expSt = boost::get<ExpressionStatement&>(_statement);
|
||||||
@ -167,13 +168,11 @@ void InlineModifier::visit(Statement& _statement)
|
|||||||
{
|
{
|
||||||
FunctionalInstruction& funInstr = boost::get<FunctionalInstruction&>(expSt.expression);
|
FunctionalInstruction& funInstr = boost::get<FunctionalInstruction&>(expSt.expression);
|
||||||
if (funInstr.instruction == solidity::Instruction::POP)
|
if (funInstr.instruction == solidity::Instruction::POP)
|
||||||
{
|
if (MovableChecker(funInstr.arguments.at(0)).movable())
|
||||||
if (funInstr.arguments.at(0).type() == typeid(Literal))
|
|
||||||
_statement = Block{expSt.location, {}};
|
_statement = Block{expSt.location, {}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void InlineModifier::visitArguments(
|
void InlineModifier::visitArguments(
|
||||||
vector<Expression>& _arguments,
|
vector<Expression>& _arguments,
|
||||||
|
Loading…
Reference in New Issue
Block a user