mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
solidity-upgrade can now change now to block.timestamp
This commit is contained in:
@@ -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())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user