diff options
author | Erik Kundt <bitshift@posteo.org> | 2018-07-27 03:45:24 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-09-04 00:35:57 +0800 |
commit | 75a92b0ffd0946c17a27a58e6e02abe96cd3fa00 (patch) | |
tree | 3a7c0b7e11942266eed23e7b2a0259fd5db1a56c /libsolidity/analysis/StaticAnalyzer.cpp | |
parent | 378f69160884ba23f6876d57a3eb6425bfa1d2cf (diff) | |
download | dexon-solidity-75a92b0ffd0946c17a27a58e6e02abe96cd3fa00.tar dexon-solidity-75a92b0ffd0946c17a27a58e6e02abe96cd3fa00.tar.gz dexon-solidity-75a92b0ffd0946c17a27a58e6e02abe96cd3fa00.tar.bz2 dexon-solidity-75a92b0ffd0946c17a27a58e6e02abe96cd3fa00.tar.lz dexon-solidity-75a92b0ffd0946c17a27a58e6e02abe96cd3fa00.tar.xz dexon-solidity-75a92b0ffd0946c17a27a58e6e02abe96cd3fa00.tar.zst dexon-solidity-75a92b0ffd0946c17a27a58e6e02abe96cd3fa00.zip |
Warns if modifier uses msg.value in non-payable function.
Diffstat (limited to 'libsolidity/analysis/StaticAnalyzer.cpp')
-rw-r--r-- | libsolidity/analysis/StaticAnalyzer.cpp | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp index 60a58665..487a5cca 100644 --- a/libsolidity/analysis/StaticAnalyzer.cpp +++ b/libsolidity/analysis/StaticAnalyzer.cpp @@ -56,7 +56,6 @@ bool StaticAnalyzer::visit(FunctionDefinition const& _function) else solAssert(!m_currentFunction, ""); solAssert(m_localVarUseCount.empty(), ""); - m_nonPayablePublic = _function.isPublic() && !_function.isPayable(); m_constructor = _function.isConstructor(); return true; } @@ -64,7 +63,6 @@ bool StaticAnalyzer::visit(FunctionDefinition const& _function) void StaticAnalyzer::endVisit(FunctionDefinition const&) { m_currentFunction = nullptr; - m_nonPayablePublic = false; m_constructor = false; for (auto const& var: m_localVarUseCount) if (var.second == 0) @@ -154,14 +152,6 @@ bool StaticAnalyzer::visit(MemberAccess const& _memberAccess) ); } - if (m_nonPayablePublic && !m_library) - if (MagicType const* type = dynamic_cast<MagicType const*>(_memberAccess.expression().annotation().type.get())) - if (type->kind() == MagicType::Kind::Message && _memberAccess.memberName() == "value") - m_errorReporter.warning( - _memberAccess.location(), - "\"msg.value\" used in non-payable function. Do you want to add the \"payable\" modifier to this function?" - ); - if (_memberAccess.memberName() == "callcode") if (auto const* type = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type.get())) if (type->kind() == FunctionType::Kind::BareCallCode) |