summaryrefslogtreecommitdiff
path: root/python/highlevelil.py
diff options
context:
space:
mode:
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:
"""