Skip to content

Commit

Permalink
Remove AST split method
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Nov 4, 2024
1 parent f01ac31 commit 1a58a26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
9 changes: 0 additions & 9 deletions claripy/ast/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,6 @@ def swap_args(self, new_args: tuple[ArgType, ...], new_length: int | None = None
# Other helper functions
#

def split(self, split_on: Iterable[str]) -> list[ArgType]:
"""
Splits the AST if its operation is `split_on` (i.e., return all the arguments). Otherwise, return a list with
just the AST.
"""
if self.op in split_on:
return list(self.args)
return [self]

# we don't support iterating over Base objects
def __iter__(self) -> NoReturn:
"""
Expand Down
8 changes: 5 additions & 3 deletions claripy/frontend/constrained_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ def simplify(self):
if len(to_simplify) == 0:
return self.constraints

simplified = simplify(And(*to_simplify)).split(["And"]) # pylint:disable=no-member
self.constraints = no_simplify + simplified
simplified = simplify(And(*to_simplify))
simplified_split = list(simplified.args) if simplified.op == "And" else [simplified]

self.constraints = no_simplify + simplified_split
return self.constraints

#
Expand Down Expand Up @@ -169,7 +171,7 @@ def _split_constraints(constraints, concrete=True):

splitted = []
for i in constraints:
splitted.extend(i.split(["And"]))
splitted.extend(list(i.args) if i.op == "And" else [i])

log.debug("... splitted of size %d", len(splitted))

Expand Down

0 comments on commit 1a58a26

Please sign in to comment.