diff options
author | Leonardo Alt <leo@ethereum.org> | 2018-07-04 17:42:05 +0800 |
---|---|---|
committer | Leonardo Alt <leo@ethereum.org> | 2018-07-04 17:42:05 +0800 |
commit | 8202d512e0bd4e6b4a19ed483afff288514e75bd (patch) | |
tree | 126d4afb677ecd531532573f22be95090145f48f /libsolidity/analysis | |
parent | 533d5d4b1cc4374decc704de8c86ad4cef6214fc (diff) | |
download | dexon-solidity-8202d512e0bd4e6b4a19ed483afff288514e75bd.tar.gz dexon-solidity-8202d512e0bd4e6b4a19ed483afff288514e75bd.tar.zst dexon-solidity-8202d512e0bd4e6b4a19ed483afff288514e75bd.zip |
Enforcing error on msg.gas and block.blockhash()
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/StaticAnalyzer.cpp | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp index c7440565..323282ca 100644 --- a/libsolidity/analysis/StaticAnalyzer.cpp +++ b/libsolidity/analysis/StaticAnalyzer.cpp @@ -150,36 +150,18 @@ bool StaticAnalyzer::visit(ExpressionStatement const& _statement) bool StaticAnalyzer::visit(MemberAccess const& _memberAccess) { - bool const v050 = m_currentContract->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050); - if (MagicType const* type = dynamic_cast<MagicType const*>(_memberAccess.expression().annotation().type.get())) { if (type->kind() == MagicType::Kind::Message && _memberAccess.memberName() == "gas") - { - if (v050) - m_errorReporter.typeError( - _memberAccess.location(), - "\"msg.gas\" has been deprecated in favor of \"gasleft()\"" - ); - else - m_errorReporter.warning( - _memberAccess.location(), - "\"msg.gas\" has been deprecated in favor of \"gasleft()\"" - ); - } - if (type->kind() == MagicType::Kind::Block && _memberAccess.memberName() == "blockhash") - { - if (v050) - m_errorReporter.typeError( - _memberAccess.location(), - "\"block.blockhash()\" has been deprecated in favor of \"blockhash()\"" - ); - else - m_errorReporter.warning( - _memberAccess.location(), - "\"block.blockhash()\" has been deprecated in favor of \"blockhash()\"" - ); - } + m_errorReporter.typeError( + _memberAccess.location(), + "\"msg.gas\" has been deprecated in favor of \"gasleft()\"" + ); + else if (type->kind() == MagicType::Kind::Block && _memberAccess.memberName() == "blockhash") + m_errorReporter.typeError( + _memberAccess.location(), + "\"block.blockhash()\" has been deprecated in favor of \"blockhash()\"" + ); } if (m_nonPayablePublic && !m_library) |