Skip to content

Commit

Permalink
Fold EvalStringToAstsMixin into Frontend (#463)
Browse files Browse the repository at this point in the history
* Fold EvalStringToAstsMixin into Frontend

* Whoops

* Clean it up a little

* Fix length calculation

* Better length calculation
  • Loading branch information
twizmwazin authored Sep 2, 2024
1 parent 837b904 commit 39b0cea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
10 changes: 9 additions & 1 deletion claripy/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ def eval_to_ast(self, e, n, extra_constraints=(), exact=None):
:return: list of concrete ASTs
"""
return [ast.bv.BVV(v, e.size()) for v in self.eval(e, n, extra_constraints=extra_constraints, exact=exact)]
values = self.eval(e, n, extra_constraints=extra_constraints, exact=exact)

if isinstance(e, ast.BV):
return [ast.bv.BVV(v, e.size()) for v in values]
if isinstance(e, ast.String):
return [ast.strings.StringV(v, length=e.string_length) for v in values]

# TODO: Implement support for other types
raise NotImplementedError

def finalize(self):
raise NotImplementedError("finalize() is not implemented")
Expand Down
1 change: 0 additions & 1 deletion claripy/frontend_mixins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
from .simplify_skipper_mixin import SimplifySkipperMixin
from .composited_cache_mixin import CompositedCacheMixin
from .sat_cache_mixin import SatCacheMixin
from .eval_string_to_ast_mixin import EvalStringsToASTsMixin
16 changes: 0 additions & 16 deletions claripy/frontend_mixins/eval_string_to_ast_mixin.py

This file was deleted.

1 change: 0 additions & 1 deletion claripy/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class SolverStrings(
frontend_mixins.ConstraintFilterMixin,
frontend_mixins.ConstraintDeduplicatorMixin,
frontend_mixins.EagerResolutionMixin,
frontend_mixins.EvalStringsToASTsMixin,
frontends.FullFrontend,
):
"""SolverStrings is a frontend that uses Z3 to solve string constraints."""
Expand Down

0 comments on commit 39b0cea

Please sign in to comment.