From 8dabdd428acd30aac4ebb7e17270505fc3ba4a59 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Mon, 28 Oct 2024 21:00:07 -0400 Subject: Eliminate AST parameter in high level rendering APIs, as it is already part of the HLIL instruction --- python/highlevelil.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'python/highlevelil.py') 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: """ -- cgit v1.3.1