diff options
Diffstat (limited to 'libsolidity/formal/SSAVariable.cpp')
-rw-r--r-- | libsolidity/formal/SSAVariable.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libsolidity/formal/SSAVariable.cpp b/libsolidity/formal/SSAVariable.cpp index 4e6bcbcb..f3213e03 100644 --- a/libsolidity/formal/SSAVariable.cpp +++ b/libsolidity/formal/SSAVariable.cpp @@ -17,6 +17,7 @@ #include <libsolidity/formal/SSAVariable.h> +#include <libsolidity/formal/SymbolicBoolVariable.h> #include <libsolidity/formal/SymbolicIntVariable.h> #include <libsolidity/ast/AST.h> @@ -26,23 +27,35 @@ using namespace dev; using namespace dev::solidity; SSAVariable::SSAVariable( - Declaration const* _decl, + Declaration const& _decl, smt::SolverInterface& _interface ) { resetIndex(); - if (dynamic_cast<IntegerType const*>(_decl->type().get())) + if (isInteger(_decl.type()->category())) m_symbolicVar = make_shared<SymbolicIntVariable>(_decl, _interface); + else if (isBool(_decl.type()->category())) + m_symbolicVar = make_shared<SymbolicBoolVariable>(_decl, _interface); else { solAssert(false, ""); } } -bool SSAVariable::supportedType(Type const* _decl) +bool SSAVariable::isSupportedType(Type::Category _category) { - return dynamic_cast<IntegerType const*>(_decl); + return isInteger(_category) || isBool(_category); +} + +bool SSAVariable::isInteger(Type::Category _category) +{ + return _category == Type::Category::Integer; +} + +bool SSAVariable::isBool(Type::Category _category) +{ + return _category == Type::Category::Bool; } void SSAVariable::resetIndex() |