summaryrefslogtreecommitdiff
path: root/python/highlevelil.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2024-10-28 21:00:07 -0400
committerRusty Wagner <rusty.wagner@gmail.com>2024-10-28 21:04:03 -0400
commit8dabdd428acd30aac4ebb7e17270505fc3ba4a59 (patch)
treea4d8ab90d164458a6138c96e7aa856c81e174bd0 /python/highlevelil.py
parent717a2ea5c79a95dd3178447e27be979895f55892 (diff)
Eliminate AST parameter in high level rendering APIs, as it is already part of the HLIL instruction
Diffstat (limited to 'python/highlevelil.py')
-rw-r--r--python/highlevelil.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py
index 21359685..8a400c1e 100644
--- a/python/highlevelil.py
+++ b/python/highlevelil.py
@@ -696,7 +696,10 @@ class HighLevelILInstruction(BaseILInstruction):
return variable.ConstantData(value, 0, state, core.max_confidence, self.core_instr.size, self.function.source_function)
def get_expr(self, operand_index: int) -> 'HighLevelILInstruction':
- return HighLevelILInstruction.create(self.function, ExpressionIndex(self.core_instr.operands[operand_index]))
+ return HighLevelILInstruction.create(
+ self.function, ExpressionIndex(self.core_instr.operands[operand_index]),
+ self.as_ast
+ )
def get_intrinsic(self, operand_index: int) -> 'lowlevelil.ILIntrinsic':
if self.function.arch is None:
@@ -2801,7 +2804,7 @@ class HighLevelILFunction:
"""
return core.BNGetHighLevelILExprCount(self.handle)
- def get_expr(self, index: ExpressionIndex) -> Optional[HighLevelILInstruction]:
+ def get_expr(self, index: ExpressionIndex, as_ast: bool = True) -> Optional[HighLevelILInstruction]:
"""
``get_expr`` retrieves the IL expression at a given expression index in the function.
@@ -2809,12 +2812,13 @@ class HighLevelILFunction:
they might not be used by the function and might not contain properly structured data.
:param index: Index of desired expression in function
+ :param as_ast: Whether to return the expression as a full AST or a single instruction (defaults to AST)
:return: A HighLevelILInstruction object for the expression, if it exists. Otherwise, None
"""
if index >= self.get_expr_count():
return None
- return HighLevelILInstruction.create(self, index)
+ return HighLevelILInstruction.create(self, index, as_ast)
def copy_expr(self, original: HighLevelILInstruction) -> ExpressionIndex:
"""