solidity-upgrade can now change now to block.timestamp

This commit is contained in:
Harikrishnan Mulackal
2020-05-05 21:11:15 +05:30
parent a207613f17
commit aed6c22318
7 changed files with 61 additions and 2 deletions
+19
View File
@@ -40,3 +40,22 @@ void DotSyntax::endVisit(FunctionCall const& _functionCall)
);
}
}
void NowKeyword::endVisit(Identifier const& _identifier)
{
IdentifierAnnotation& annotation = _identifier.annotation();
if (MagicVariableDeclaration const* magicVar
= dynamic_cast<MagicVariableDeclaration const*>(annotation.referencedDeclaration))
{
if (magicVar->type()->category() == Type::Category::Integer)
{
solAssert(_identifier.name() == "now", "");
m_changes.emplace_back(
UpgradeChange::Level::Safe,
_identifier.location(),
SourceTransform::nowUpdate(_identifier.location())
);
}
}
}