Skip to content

Commit

Permalink
GUI: Fix bug in simplifier that was mangling expressions with complex…
Browse files Browse the repository at this point in the history
… functions.
  • Loading branch information
jim-carciofini committed Jan 21, 2025
1 parent b5d8b99 commit 333c5d4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pate_binja/pate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1738,10 +1738,6 @@ def simplify_sexp(sexp, env=None):
and len(arg) == 1 and isinstance(arg[0], str)):
return f'{arg[0]}<{op[2]}:{op[3]}>'

# If op is not a string, don't try to process it.
if not isinstance(op, str):
return sexp

# Simplify call(F, args...) => F(args...)
if op == 'call' and len(arg) >= 1:
return simplify_sexp([arg[0]] + arg[1:], env)
Expand All @@ -1755,7 +1751,7 @@ def simplify_sexp(sexp, env=None):
return ['read1', arg[1]]

# Simplify read{LE|GE}N(memory, ADDR) -> read{LE|GE}N(ADDR)
if re.fullmatch(r'read(?:LE|GE)\d+', op) and len(arg) == 2 and arg[0] == 'memory':
if isinstance(op, str) and re.fullmatch(r'read(?:LE|GE)\d+', op) and len(arg) == 2 and arg[0] == 'memory':
return [op, arg[1]]

# Simplify sbvToInteger(x) => x
Expand Down

0 comments on commit 333c5d4

Please sign in to comment.