From 8bbdd415bd6d2cfab846d8bb57f7534e37daf5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 17 Aug 2025 07:27:52 +0200 Subject: [PATCH] Fix TestLogicalComputing --- .../src/com/jpexs/decompiler/graph/Graph.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java index 48b3918bc..582904c43 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -3910,21 +3910,37 @@ public class Graph { boolean hideEmptyTrueFalse = true; if (leftSide instanceof DuplicateItem) { + if (!currentRet.isEmpty() && currentRet.get(currentRet.size() - 1) instanceof SetTemporaryItem) { + DuplicateItem d = (DuplicateItem) leftSide; + SetTemporaryItem st = (SetTemporaryItem) currentRet.get(currentRet.size() - 1); + if (st.tempIndex == d.tempIndex) { + currentRet.remove(currentRet.size() - 1); + stack.moveToStack(currentRet); + } + } isIf = false; if (hideEmptyTrueFalse && prevExpr.getNotCoercedNoDup() instanceof FalseItem) { stack.push(rightSide); } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof FalseItem) { stack.push(prevExpr); - } else { + } else { stack.push(new OrItem(dialect, null, localData.lineStartInstruction, prevExpr, rightSide)); } } else if (leftSide.invert(null).getNotCoercedNoDup() instanceof DuplicateItem) { + if (!currentRet.isEmpty() && currentRet.get(currentRet.size() - 1) instanceof SetTemporaryItem) { + DuplicateItem d = (DuplicateItem) leftSide.invert(null).getNotCoercedNoDup(); + SetTemporaryItem st = (SetTemporaryItem) currentRet.get(currentRet.size() - 1); + if (st.tempIndex == d.tempIndex) { + currentRet.remove(currentRet.size() - 1); + stack.moveToStack(currentRet); + } + } isIf = false; if (hideEmptyTrueFalse && prevExpr.getNotCoercedNoDup() instanceof TrueItem) { stack.push(rightSide); } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof TrueItem) { stack.push(prevExpr); - } else { + } else { stack.push(new AndItem(dialect, null, localData.lineStartInstruction, prevExpr, rightSide)); } } else if (prevExpr instanceof FalseItem) {