From f2b409250e1f12b08cabfcbc626858e750262a75 Mon Sep 17 00:00:00 2001 From: rihi <19492038+rihi@users.noreply.github.com> Date: Thu, 18 Jan 2024 11:18:03 +0100 Subject: [PATCH] Slight improvements to code --- decompiler/backend/codevisitor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/decompiler/backend/codevisitor.py b/decompiler/backend/codevisitor.py index 64537d2cc..ad064012b 100644 --- a/decompiler/backend/codevisitor.py +++ b/decompiler/backend/codevisitor.py @@ -80,13 +80,13 @@ def visit_condition_node(self, node: ast_nodes.ConditionNode) -> str: swap_branches = None - # if only one branch is a condition node we want to swap + # if only one branch is a condition node, we want to decide swapping by which branch is a condition node if isinstance(false_child, ast_nodes.ConditionNode) != isinstance(true_child, ast_nodes.ConditionNode): - swap_branches = swap_branches or not isinstance(false_child, ast_nodes.ConditionNode) + swap_branches = not isinstance(false_child, ast_nodes.ConditionNode) - length_comparisons = {"none": None, "smallest": len(true_str) > len(false_str), "largest": len(true_str) < len(false_str)} # if we haven't already decided on swapping (swap_branches is None), decide by length if swap_branches is None: + length_comparisons = {"none": None, "smallest": len(true_str) > len(false_str), "largest": len(true_str) < len(false_str)} swap_branches = length_comparisons[self._preferred_true_branch] if swap_branches: