diff options
-rw-r--r-- | libevmasm/SemanticInformation.cpp | 2 | ||||
-rw-r--r-- | libevmasm/SemanticInformation.h | 2 | ||||
-rw-r--r-- | libsolidity/analysis/ViewPureChecker.cpp | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp index ceb3fbdd..e277a08d 100644 --- a/libevmasm/SemanticInformation.cpp +++ b/libevmasm/SemanticInformation.cpp @@ -189,7 +189,7 @@ bool SemanticInformation::invalidatesStorage(Instruction _instruction) } } -bool SemanticInformation::invalidInPureFunctions(Instruction _instruction) +bool SemanticInformation::readsFromState(Instruction _instruction) { switch (_instruction) { diff --git a/libevmasm/SemanticInformation.h b/libevmasm/SemanticInformation.h index e5ea7c18..963088d9 100644 --- a/libevmasm/SemanticInformation.h +++ b/libevmasm/SemanticInformation.h @@ -53,7 +53,7 @@ struct SemanticInformation static bool invalidatesMemory(solidity::Instruction _instruction); /// @returns true if the given instruction modifies storage (even indirectly). static bool invalidatesStorage(solidity::Instruction _instruction); - static bool invalidInPureFunctions(solidity::Instruction _instruction); + static bool readsFromState(solidity::Instruction _instruction); static bool invalidInViewFunctions(solidity::Instruction _instruction); }; diff --git a/libsolidity/analysis/ViewPureChecker.cpp b/libsolidity/analysis/ViewPureChecker.cpp index 705d61e8..6621edb1 100644 --- a/libsolidity/analysis/ViewPureChecker.cpp +++ b/libsolidity/analysis/ViewPureChecker.cpp @@ -27,6 +27,8 @@ using namespace std; using namespace dev; using namespace dev::solidity; +namespace +{ class AssemblyViewPureChecker: public boost::static_visitor<void> { @@ -39,7 +41,7 @@ public: { if (eth::SemanticInformation::invalidInViewFunctions(_instruction.instruction)) m_reportMutability(StateMutability::NonPayable, _instruction.location); - else if (eth::SemanticInformation::invalidInPureFunctions(_instruction.instruction)) + else if (eth::SemanticInformation::readsFromState(_instruction.instruction)) m_reportMutability(StateMutability::View, _instruction.location); } void operator()(assembly::Literal const&) {} @@ -96,6 +98,7 @@ private: std::function<void(StateMutability, SourceLocation const&)> m_reportMutability; }; +} bool ViewPureChecker::check() { |