aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/formal/SSAVariable.cpp
diff options
context:
space:
mode:
authorLeonardo Alt <leonardoaltt@gmail.com>2018-03-09 23:19:03 +0800
committerLeonardo Alt <leonardoaltt@gmail.com>2018-03-13 03:16:47 +0800
commitc2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb (patch)
tree5603090f386fc913b8c6cf6c4eb384a96da67a31 /libsolidity/formal/SSAVariable.cpp
parent6a940f0a99e941c48e5deb695e89ac52784c4f3c (diff)
downloaddexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.tar
dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.tar.gz
dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.tar.bz2
dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.tar.lz
dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.tar.xz
dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.tar.zst
dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.zip
[SMTChecker_Bool] Fix PR comments; Add support to gt, ge, lt, le. and tests.
Diffstat (limited to 'libsolidity/formal/SSAVariable.cpp')
-rw-r--r--libsolidity/formal/SSAVariable.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/libsolidity/formal/SSAVariable.cpp b/libsolidity/formal/SSAVariable.cpp
index 4f8080ab..3f2a61f1 100644
--- a/libsolidity/formal/SSAVariable.cpp
+++ b/libsolidity/formal/SSAVariable.cpp
@@ -27,15 +27,15 @@ 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 (typeInteger(_decl.type()->category()))
m_symbolicVar = make_shared<SymbolicIntVariable>(_decl, _interface);
- else if (dynamic_cast<BoolType const*>(_decl->type().get()))
+ else if (typeBool(_decl.type()->category()))
m_symbolicVar = make_shared<SymbolicBoolVariable>(_decl, _interface);
else
{
@@ -43,10 +43,19 @@ SSAVariable::SSAVariable(
}
}
-bool SSAVariable::supportedType(Type const* _decl)
+bool SSAVariable::supportedType(Type::Category _category)
{
- return dynamic_cast<IntegerType const*>(_decl) ||
- dynamic_cast<BoolType const*>(_decl);
+ return typeInteger(_category) || typeBool(_category);
+}
+
+bool SSAVariable::typeInteger(Type::Category _category)
+{
+ return _category == Type::Category::Integer;
+}
+
+bool SSAVariable::typeBool(Type::Category _category)
+{
+ return _category == Type::Category::Bool;
}
void SSAVariable::resetIndex()