Skip to content

Commit

Permalink
Use keyword-only arguments for init
Browse files Browse the repository at this point in the history
This will help with multiple inheritance in a future commit
  • Loading branch information
ekilmer committed Mar 1, 2021
1 parent 8aa7b16 commit 7ad7d2e
Show file tree
Hide file tree
Showing 16 changed files with 427 additions and 334 deletions.
22 changes: 15 additions & 7 deletions manticore/core/smtlib/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def add(self, constraint) -> None:
:param constraint: The constraint to add to the set.
"""
if isinstance(constraint, bool):
constraint = BoolConstant(constraint)
constraint = BoolConstant(value=constraint)
assert isinstance(constraint, Bool)
constraint = simplify(constraint)
# If self._child is not None this constraint set has been forked and a
Expand Down Expand Up @@ -380,8 +380,7 @@ def new_bool(self, name=None, taint=frozenset(), avoid_collisions=False):
name = self._make_unique_name(name)
if not avoid_collisions and name in self._declarations:
raise ValueError(f"Name {name} already used")
var = BoolVariable(name, taint=taint)
return self._declare(var)
return self._declare(BoolVariable(name=name, taint=taint))

def new_bitvec(self, size, name=None, taint=frozenset(), avoid_collisions=False):
"""Declares a free symbolic bitvector in the constraint store
Expand All @@ -400,8 +399,7 @@ def new_bitvec(self, size, name=None, taint=frozenset(), avoid_collisions=False)
name = self._make_unique_name(name)
if not avoid_collisions and name in self._declarations:
raise ValueError(f"Name {name} already used")
var = BitVecVariable(size, name, taint=taint)
return self._declare(var)
return self._declare(BitVecVariable(size=size, name=name, taint=taint))

def new_array(
self,
Expand Down Expand Up @@ -430,5 +428,15 @@ def new_array(
name = self._make_unique_name(name)
if not avoid_collisions and name in self._declarations:
raise ValueError(f"Name {name} already used")
var = self._declare(ArrayVariable(index_bits, index_max, value_bits, name, taint=taint))
return ArrayProxy(var, default=default)
return ArrayProxy(
array=self._declare(
ArrayVariable(
index_bits=index_bits,
index_max=index_max,
value_bits=value_bits,
name=name,
taint=taint,
)
),
default=default,
)
Loading

0 comments on commit 7ad7d2e

Please sign in to comment.