Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
ebehner committed Apr 24, 2024
1 parent 1b328e4 commit 755eccc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from dataclasses import dataclass
from itertools import chain, combinations
from typing import Dict, Iterator, List, Optional, Set, Tuple, Literal
from typing import Dict, Iterator, List, Literal, Optional, Set, Tuple

from decompiler.structures.ast.ast_nodes import AbstractSyntaxTreeNode, ConditionNode, SeqNode
from decompiler.structures.ast.reachability_graph import SiblingReachability
Expand Down Expand Up @@ -185,7 +185,9 @@ def update(self, ast_node: ConditionNode):
"""update the graph for the given condition-node."""
assert ast_node in self._candidates, "The condition node must be a candidate."
formula = self._candidates[ast_node]
if not ast_node.is_single_branch and not all(isinstance(clause, ClauseFormula) for clause in self._formula_graph.successors(formula)):
if not ast_node.is_single_branch and not all(
isinstance(clause, ClauseFormula) for clause in self._formula_graph.successors(formula)
):
assert len(clauses := formula.clauses()) == 1, "A non-single condition node should have one formula clause"
self._logic_graph.remove_nodes_from(list(self._formula_graph.successors(formula)))
self._logic_graph.add_edge(ast_node, clauses[0])
Expand Down
7 changes: 6 additions & 1 deletion decompiler/structures/ast/syntaxforest.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ def __create_branch_for(self, branch_nodes: List[AbstractSyntaxTreeNode], condit
self._remove_edge(branch.parent, branch)
return branch

def add_branches_to_condition_node(self, condition_node: ConditionNode, true_branch: AbstractSyntaxTreeNode = None, false_branch: Optional[AbstractSyntaxTreeNode] = None):
def add_branches_to_condition_node(
self,
condition_node: ConditionNode,
true_branch: AbstractSyntaxTreeNode = None,
false_branch: Optional[AbstractSyntaxTreeNode] = None,
):
"""TODO"""
if true_branch:
self._remove_edge(true_branch.parent, true_branch)
Expand Down

0 comments on commit 755eccc

Please sign in to comment.