From b5612f96c97dd6fc77fda7179f85d31a38a8cd1e Mon Sep 17 00:00:00 2001 From: Harikrishnan Mulackal Date: Tue, 5 May 2020 14:26:18 +0530 Subject: [PATCH] Deprecated identifier now --- libsolidity/analysis/TypeChecker.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index e626dac2c..ecafd1dae 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2908,6 +2908,20 @@ bool TypeChecker::visit(Identifier const& _identifier) ); } + if ( + MagicVariableDeclaration const* magicVar = + dynamic_cast(annotation.referencedDeclaration) + ) + if (magicVar->type()->category() == Type::Category::Integer) + { + solAssert(_identifier.name() == "now", ""); + m_errorReporter + .typeError( + _identifier.location(), + "\"now\" has been deprecated. Use \"block.timestamp\" instead." + ); + } + return false; }