aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-09-21 00:00:40 +0800
committerGitHub <noreply@github.com>2017-09-21 00:00:40 +0800
commit8af298ade31ed1337ec20bf50cdb963bbd50c0db (patch)
tree172da56472b55194199bc310fe36ab6f1be9cd22 /libsolidity
parent2adeb26d4396d94b322aeeef98bfb679a7cbce27 (diff)
parented1fd49ab07de1ddad9f3bc2864e17fe21ed993d (diff)
downloaddexon-solidity-8af298ade31ed1337ec20bf50cdb963bbd50c0db.tar.gz
dexon-solidity-8af298ade31ed1337ec20bf50cdb963bbd50c0db.tar.zst
dexon-solidity-8af298ade31ed1337ec20bf50cdb963bbd50c0db.zip
Merge pull request #2902 from ethereum/warn-obsolete
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())