mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replace pop(0)-statements by empty blocks.
This commit is contained in:
parent
4370bf5c40
commit
c7245ba362
@ -156,6 +156,25 @@ void InlineModifier::visit(Expression& _expression)
|
|||||||
m_statementsToPrefix.emplace_back(BodyCopier(m_nameDispenser, fun.name + "_", variableReplacements)(fun.body));
|
m_statementsToPrefix.emplace_back(BodyCopier(m_nameDispenser, fun.name + "_", variableReplacements)(fun.body));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InlineModifier::visit(Statement& _statement)
|
||||||
|
{
|
||||||
|
ASTModifier::visit(_statement);
|
||||||
|
// Replace pop(0) expression statemets by empty blocks.
|
||||||
|
if (_statement.type() == typeid(ExpressionStatement))
|
||||||
|
{
|
||||||
|
ExpressionStatement& expSt = boost::get<ExpressionStatement&>(_statement);
|
||||||
|
if (expSt.expression.type() == typeid(FunctionalInstruction))
|
||||||
|
{
|
||||||
|
FunctionalInstruction& funInstr = boost::get<FunctionalInstruction&>(expSt.expression);
|
||||||
|
if (funInstr.instruction == solidity::Instruction::POP)
|
||||||
|
{
|
||||||
|
if (funInstr.arguments.at(0).type() == typeid(Literal))
|
||||||
|
_statement = Block{expSt.location, {}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InlineModifier::visitArguments(
|
void InlineModifier::visitArguments(
|
||||||
vector<Expression>& _arguments,
|
vector<Expression>& _arguments,
|
||||||
vector<string> const& _nameHints,
|
vector<string> const& _nameHints,
|
||||||
|
@ -116,6 +116,7 @@ public:
|
|||||||
|
|
||||||
using ASTModifier::visit;
|
using ASTModifier::visit;
|
||||||
virtual void visit(Expression& _expression) override;
|
virtual void visit(Expression& _expression) override;
|
||||||
|
virtual void visit(Statement& _st) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user