diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-12-05 21:44:20 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-12-05 22:52:11 +0800 |
commit | 745eefa36f9bc04c91cb28e81bd16f8d01a11c7c (patch) | |
tree | f6a3497b5355de175f6535c14c1996052654ce1e /libsolidity/analysis/ViewPureChecker.cpp | |
parent | a08d853bbb0d5f052cc264a84340bde577f54c4e (diff) | |
download | dexon-solidity-745eefa36f9bc04c91cb28e81bd16f8d01a11c7c.tar dexon-solidity-745eefa36f9bc04c91cb28e81bd16f8d01a11c7c.tar.gz dexon-solidity-745eefa36f9bc04c91cb28e81bd16f8d01a11c7c.tar.bz2 dexon-solidity-745eefa36f9bc04c91cb28e81bd16f8d01a11c7c.tar.lz dexon-solidity-745eefa36f9bc04c91cb28e81bd16f8d01a11c7c.tar.xz dexon-solidity-745eefa36f9bc04c91cb28e81bd16f8d01a11c7c.tar.zst dexon-solidity-745eefa36f9bc04c91cb28e81bd16f8d01a11c7c.zip |
Split Instruction and FunctionalInstruction in Julia
Diffstat (limited to 'libsolidity/analysis/ViewPureChecker.cpp')
-rw-r--r-- | libsolidity/analysis/ViewPureChecker.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libsolidity/analysis/ViewPureChecker.cpp b/libsolidity/analysis/ViewPureChecker.cpp index 7e41fc16..6788cb05 100644 --- a/libsolidity/analysis/ViewPureChecker.cpp +++ b/libsolidity/analysis/ViewPureChecker.cpp @@ -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); + } }; } |