mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] Move global variables and functions to encoding context
This commit is contained in:
@@ -38,6 +38,7 @@ void EncodingContext::reset()
|
||||
{
|
||||
resetAllVariables();
|
||||
m_expressions.clear();
|
||||
m_globalContext.clear();
|
||||
m_thisAddress->increaseIndex();
|
||||
m_balances->increaseIndex();
|
||||
}
|
||||
@@ -153,6 +154,28 @@ bool EncodingContext::knownExpression(solidity::Expression const& _e) const
|
||||
return m_expressions.count(&_e);
|
||||
}
|
||||
|
||||
/// Global variables and functions.
|
||||
|
||||
shared_ptr<SymbolicVariable> EncodingContext::globalSymbol(string const& _name)
|
||||
{
|
||||
solAssert(knownGlobalSymbol(_name), "");
|
||||
return m_globalContext.at(_name);
|
||||
}
|
||||
|
||||
bool EncodingContext::createGlobalSymbol(string const& _name, solidity::Expression const& _expr)
|
||||
{
|
||||
solAssert(!knownGlobalSymbol(_name), "");
|
||||
auto result = newSymbolicVariable(*_expr.annotation().type, _name, m_solver);
|
||||
m_globalContext.emplace(_name, result.second);
|
||||
setUnknownValue(*result.second);
|
||||
return result.first;
|
||||
}
|
||||
|
||||
bool EncodingContext::knownGlobalSymbol(string const& _var) const
|
||||
{
|
||||
return m_globalContext.count(_var);
|
||||
}
|
||||
|
||||
// Blockchain
|
||||
|
||||
Expression EncodingContext::thisAddress()
|
||||
|
||||
Reference in New Issue
Block a user