aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-01 03:31:12 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-19 18:11:19 +0800
commited1fd49ab07de1ddad9f3bc2864e17fe21ed993d (patch)
tree57f605da80c31affda99ddd7fc1b1ca359535b36 /libsolidity
parent1fc71bd75841850ee04d151e9bfbf938928b276a (diff)
downloaddexon-solidity-ed1fd49ab07de1ddad9f3bc2864e17fe21ed993d.tar
dexon-solidity-ed1fd49ab07de1ddad9f3bc2864e17fe21ed993d.tar.gz
dexon-solidity-ed1fd49ab07de1ddad9f3bc2864e17fe21ed993d.tar.bz2
dexon-solidity-ed1fd49ab07de1ddad9f3bc2864e17fe21ed993d.tar.lz
dexon-solidity-ed1fd49ab07de1ddad9f3bc2864e17fe21ed993d.tar.xz
dexon-solidity-ed1fd49ab07de1ddad9f3bc2864e17fe21ed993d.tar.zst
dexon-solidity-ed1fd49ab07de1ddad9f3bc2864e17fe21ed993d.zip
Warn about obsolete sha3/suicide calls
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 40add37e..4b2ec8d6 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -1477,6 +1477,14 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
else
_functionCall.annotation().type = make_shared<TupleType>(functionType->returnParameterTypes());
+ if (auto functionName = dynamic_cast<Identifier const*>(&_functionCall.expression()))
+ {
+ if (functionName->name() == "sha3" && functionType->kind() == FunctionType::Kind::SHA3)
+ m_errorReporter.warning(_functionCall.location(), "\"sha3\" has been deprecated in favour of \"keccak256\"");
+ else if (functionName->name() == "suicide" && functionType->kind() == FunctionType::Kind::Selfdestruct)
+ m_errorReporter.warning(_functionCall.location(), "\"suicide\" has been deprecated in favour of \"selfdestruct\"");
+ }
+
TypePointers parameterTypes = functionType->parameterTypes();
if (!functionType->padArguments())