Deprecated identifier now

This commit is contained in:
Harikrishnan Mulackal 2020-05-05 14:26:18 +05:30
parent ecbf216354
commit b5612f96c9

View File

@ -2908,6 +2908,20 @@ bool TypeChecker::visit(Identifier const& _identifier)
); );
} }
if (
MagicVariableDeclaration const* magicVar =
dynamic_cast<MagicVariableDeclaration const*>(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; return false;
} }