From e29ea081517d975d15d8344e274632ffd8724c01 Mon Sep 17 00:00:00 2001 From: Manuel Blatt Date: Thu, 26 Oct 2023 09:50:04 +0200 Subject: [PATCH] fix formatting --- .../rules/collapse_add_neg.py | 41 +++---------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_add_neg.py b/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_add_neg.py index 0cddd4bfc..89d142c46 100644 --- a/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_add_neg.py +++ b/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_add_neg.py @@ -17,48 +17,17 @@ class CollapseAddNeg(SimplificationRule): def apply(self, operation: Operation) -> list[tuple[Expression, Expression]]: replacement: Optional[Expression] = None match operation: - case BinaryOperation( - operation=OperationType.plus, - left=e0, - right=UnaryOperation( - operation=OperationType.negate, - operand=e1 - ) - ): + case BinaryOperation(operation=OperationType.plus, left=e0, right=UnaryOperation(operation=OperationType.negate, operand=e1)): replacement = BinaryOperation(OperationType.minus, [e0, e1], operation.type) - case BinaryOperation( - operation=OperationType.minus, - left=e0, - right=UnaryOperation( - operation=OperationType.negate, - operand=e1 - ) - ): + case BinaryOperation(operation=OperationType.minus, left=e0, right=UnaryOperation(operation=OperationType.negate, operand=e1)): replacement = BinaryOperation(OperationType.plus, [e0, e1], operation.type) - case BinaryOperation( - operation=OperationType.plus, - left=UnaryOperation( - operation=OperationType.negate, - operand=e0 - ), - right=e1 - ): + case BinaryOperation(operation=OperationType.plus, left=UnaryOperation(operation=OperationType.negate, operand=e0), right=e1): replacement = BinaryOperation(OperationType.minus, [e1, e0], operation.type) - case BinaryOperation( - operation=OperationType.minus, - left=UnaryOperation( - operation=OperationType.negate, - operand=e0 - ), - right=e1 - ): - replacement = UnaryOperation( - OperationType.negate, - [BinaryOperation(OperationType.plus, [e0, e1], operation.type)] - ) + case BinaryOperation(operation=OperationType.minus, left=UnaryOperation(operation=OperationType.negate, operand=e0), right=e1): + replacement = UnaryOperation(OperationType.negate, [BinaryOperation(OperationType.plus, [e0, e1], operation.type)]) if replacement is None: return []