mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Only run stack filler on AST elements that are or contain declarations.
This commit is contained in:
parent
34717838da
commit
b622c2e9d3
@ -46,17 +46,6 @@ ScopeFiller::ScopeFiller(ScopeFiller::Scopes& _scopes, ErrorList& _errors):
|
|||||||
m_currentScope = &scope(nullptr);
|
m_currentScope = &scope(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScopeFiller::operator()(FunctionalInstruction const& _instr)
|
|
||||||
{
|
|
||||||
bool success = true;
|
|
||||||
for (auto const& arg: _instr.arguments | boost::adaptors::reversed)
|
|
||||||
if (!boost::apply_visitor(*this, arg))
|
|
||||||
success = false;
|
|
||||||
if (!(*this)(_instr.instruction))
|
|
||||||
success = false;
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ScopeFiller::operator()(Label const& _item)
|
bool ScopeFiller::operator()(Label const& _item)
|
||||||
{
|
{
|
||||||
if (!m_currentScope->registerLabel(_item.name))
|
if (!m_currentScope->registerLabel(_item.name))
|
||||||
@ -72,17 +61,9 @@ bool ScopeFiller::operator()(Label const& _item)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScopeFiller::operator()(FunctionalAssignment const& _assignment)
|
|
||||||
{
|
|
||||||
return boost::apply_visitor(*this, *_assignment.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ScopeFiller::operator()(assembly::VariableDeclaration const& _varDecl)
|
bool ScopeFiller::operator()(assembly::VariableDeclaration const& _varDecl)
|
||||||
{
|
{
|
||||||
bool success = boost::apply_visitor(*this, *_varDecl.value);
|
return registerVariable(_varDecl.name, _varDecl.location, *m_currentScope);
|
||||||
if (!registerVariable(_varDecl.name, _varDecl.location, *m_currentScope))
|
|
||||||
success = false;
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScopeFiller::operator()(assembly::FunctionDefinition const& _funDef)
|
bool ScopeFiller::operator()(assembly::FunctionDefinition const& _funDef)
|
||||||
@ -111,15 +92,6 @@ bool ScopeFiller::operator()(assembly::FunctionDefinition const& _funDef)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScopeFiller::operator()(assembly::FunctionCall const& _funCall)
|
|
||||||
{
|
|
||||||
bool success = true;
|
|
||||||
for (auto const& arg: _funCall.arguments | boost::adaptors::reversed)
|
|
||||||
if (!boost::apply_visitor(*this, arg))
|
|
||||||
success = false;
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ScopeFiller::operator()(Block const& _block)
|
bool ScopeFiller::operator()(Block const& _block)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
@ -61,13 +61,13 @@ public:
|
|||||||
bool operator()(assembly::Instruction const&) { return true; }
|
bool operator()(assembly::Instruction const&) { return true; }
|
||||||
bool operator()(assembly::Literal const&) { return true; }
|
bool operator()(assembly::Literal const&) { return true; }
|
||||||
bool operator()(assembly::Identifier const&) { return true; }
|
bool operator()(assembly::Identifier const&) { return true; }
|
||||||
bool operator()(assembly::FunctionalInstruction const& _functionalInstruction);
|
bool operator()(assembly::FunctionalInstruction const&) { return true; }
|
||||||
bool operator()(assembly::Label const& _label);
|
bool operator()(assembly::Label const& _label);
|
||||||
bool operator()(assembly::Assignment const&) { return true; }
|
bool operator()(assembly::Assignment const&) { return true; }
|
||||||
bool operator()(assembly::FunctionalAssignment const& _functionalAssignment);
|
bool operator()(assembly::FunctionalAssignment const&) { return true; }
|
||||||
bool operator()(assembly::VariableDeclaration const& _variableDeclaration);
|
bool operator()(assembly::VariableDeclaration const& _variableDeclaration);
|
||||||
bool operator()(assembly::FunctionDefinition const& _functionDefinition);
|
bool operator()(assembly::FunctionDefinition const& _functionDefinition);
|
||||||
bool operator()(assembly::FunctionCall const& _functionCall);
|
bool operator()(assembly::FunctionCall const&) { return true; }
|
||||||
bool operator()(assembly::Block const& _block);
|
bool operator()(assembly::Block const& _block);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user