Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression use keyword-only arguments for init #2395

Merged
merged 1 commit into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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