From ed1fd49ab07de1ddad9f3bc2864e17fe21ed993d Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 31 Jul 2017 20:31:12 +0100 Subject: Warn about obsolete sha3/suicide calls --- libsolidity/analysis/TypeChecker.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libsolidity/analysis') 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(functionType->returnParameterTypes()); + if (auto functionName = dynamic_cast(&_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()) -- cgit v1.2.3