From 14403e034b87fd8cc3b6dbcd4729bff5978739b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 7 Feb 2021 16:50:52 +0100 Subject: [PATCH] ignore true/false in &&,|| on variable --- .../src/com/jpexs/decompiler/graph/Graph.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 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 924592ae6..cf5d8dc39 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -2062,20 +2062,22 @@ public class Graph { GraphTargetItem prevExpr = stack.pop(); GraphTargetItem leftSide = expr.getNotCoercedNoDup(); + boolean hideEmptyTrueFalse = true; + if (leftSide instanceof DuplicateItem) { isIf = false; - if (prevExpr.getNotCoercedNoDup() instanceof FalseItem) { + if (hideEmptyTrueFalse && prevExpr.getNotCoercedNoDup() instanceof FalseItem) { stack.push(rightSide); - } else if (rightSide.getNotCoercedNoDup() instanceof FalseItem) { + } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof FalseItem) { stack.push(prevExpr); } else { stack.push(new OrItem(null, localData.lineStartInstruction, prevExpr, rightSide)); } } else if (leftSide.invert(null).getNotCoercedNoDup() instanceof DuplicateItem) { isIf = false; - if (prevExpr.getNotCoercedNoDup() instanceof TrueItem) { + if (hideEmptyTrueFalse && prevExpr.getNotCoercedNoDup() instanceof TrueItem) { stack.push(rightSide); - } else if (rightSide.getNotCoercedNoDup() instanceof TrueItem) { + } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof TrueItem) { stack.push(prevExpr); } else { stack.push(new AndItem(null, localData.lineStartInstruction, prevExpr, rightSide)); @@ -2084,18 +2086,18 @@ public class Graph { isIf = false; leftSide = leftSide.invert(null); - if (leftSide.getNotCoercedNoDup() instanceof TrueItem) { + if (hideEmptyTrueFalse && leftSide.getNotCoercedNoDup() instanceof TrueItem) { stack.push(rightSide); - } else if (rightSide.getNotCoercedNoDup() instanceof TrueItem) { + } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof TrueItem) { stack.push(leftSide); } else { stack.push(new AndItem(null, localData.lineStartInstruction, leftSide, rightSide)); } } else if (prevExpr instanceof TrueItem) { isIf = false; - if (leftSide.getNotCoercedNoDup() instanceof FalseItem) { + if (hideEmptyTrueFalse && leftSide.getNotCoercedNoDup() instanceof FalseItem) { stack.push(rightSide); - } else if (rightSide.getNotCoercedNoDup() instanceof FalseItem) { + } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof FalseItem) { stack.push(leftSide); } else { stack.push(new OrItem(null, localData.lineStartInstruction, leftSide, rightSide));