mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] Replace constants by their value in-place
This commit is contained in:
@@ -932,7 +932,26 @@ void SMTEncoder::visitObjectCreation(FunctionCall const& _funCall)
|
||||
void SMTEncoder::endVisit(Identifier const& _identifier)
|
||||
{
|
||||
if (auto decl = identifierToVariable(_identifier))
|
||||
defineExpr(_identifier, currentValue(*decl));
|
||||
{
|
||||
if (decl->isConstant())
|
||||
{
|
||||
if (RationalNumberType const* rationalType = isConstant(_identifier))
|
||||
{
|
||||
if (rationalType->isNegative())
|
||||
defineExpr(_identifier, smtutil::Expression(u2s(rationalType->literalValue(nullptr))));
|
||||
else
|
||||
defineExpr(_identifier, smtutil::Expression(rationalType->literalValue(nullptr)));
|
||||
}
|
||||
else
|
||||
{
|
||||
solAssert(decl->value(), "");
|
||||
decl->value()->accept(*this);
|
||||
defineExpr(_identifier, expr(*decl->value()));
|
||||
}
|
||||
}
|
||||
else
|
||||
defineExpr(_identifier, currentValue(*decl));
|
||||
}
|
||||
else if (_identifier.annotation().type->category() == Type::Category::Function)
|
||||
visitFunctionIdentifier(_identifier);
|
||||
else if (_identifier.name() == "now")
|
||||
|
||||
Reference in New Issue
Block a user