mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Split Instruction and FunctionalInstruction in Julia
This commit is contained in:
1 parent
a08d853bbb
commit
745eefa36f
7 files changed
+27
-19
No files matched your search
@@ -40,16 +40,13 @@ public:
|
||||
void operator()(assembly::Label const&) { }
|
||||
void operator()(assembly::Instruction const& _instruction)
|
||||
{
|
||||
if (eth::SemanticInformation::invalidInViewFunctions(_instruction.instruction))
|
||||
m_reportMutability(StateMutability::NonPayable, _instruction.location);
|
||||
else if (eth::SemanticInformation::invalidInPureFunctions(_instruction.instruction))
|
||||
m_reportMutability(StateMutability::View, _instruction.location);
|
||||
checkInstruction(_instruction.location, _instruction.instruction);
|
||||
}
|
||||
void operator()(assembly::Literal const&) {}
|
||||
void operator()(assembly::Identifier const&) {}
|
||||
void operator()(assembly::FunctionalInstruction const& _instr)
|
||||
{
|
||||
(*this)(_instr.instruction);
|
||||
checkInstruction(_instr.location, _instr.instruction);
|
||||
for (auto const& arg: _instr.arguments)
|
||||
boost::apply_visitor(*this, arg);
|
||||
}
|
||||
@@ -102,6 +99,13 @@ public:
|
||||
|
||||
private:
|
||||
std::function<void(StateMutability, SourceLocation const&)> m_reportMutability;
|
||||
void checkInstruction(SourceLocation _location, solidity::Instruction _instruction)
|
||||
{
|
||||
if (eth::SemanticInformation::invalidInViewFunctions(_instruction))
|
||||
m_reportMutability(StateMutability::NonPayable, _location);
|
||||
else if (eth::SemanticInformation::invalidInPureFunctions(_instruction))
|
||||
m_reportMutability(StateMutability::View, _location);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user