From c7dfcc71de4f330d6247508f448dcb41748591aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 7 Feb 2021 19:41:13 +0100 Subject: [PATCH] precontinues detector fix --- .../GraphPrecontinueDetector.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/precontinues/GraphPrecontinueDetector.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/precontinues/GraphPrecontinueDetector.java index 45ad75200..ef8cfe1d0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/precontinues/GraphPrecontinueDetector.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/precontinues/GraphPrecontinueDetector.java @@ -105,11 +105,28 @@ public class GraphPrecontinueDetector { //System.err.println("backedge:" + backEdgePart); boolean wholeLoop = false; boolean inTryTarget = false; + boolean hasMoreNexts = false; + + if (node.next.size() > 1) { + if (node.next.size() == 2) { + Node other = null; + if (node.next.get(0).graphPart == el.loopContinue) { + other = node.next.get(1); + } else { + other = node.next.get(0); + } + if (other.graphPart != el.loopBreak) { + hasMoreNexts = true; + } + } else { + hasMoreNexts = true; + } + } if (targetParts.contains(node.graphPart)) { inTryTarget = true; } - if (!inTryTarget) { + if (!inTryTarget && !hasMoreNexts) { while (node.parentNode != null) { node = node.parentNode; //System.err.println("- parent " + node.graphPart); @@ -123,9 +140,8 @@ public class GraphPrecontinueDetector { } } } - if (!wholeLoop && !inTryTarget) { + if (!wholeLoop && !inTryTarget && !hasMoreNexts) { el.loopPreContinue = node.graphPart; - //System.err.println("found precontinue:" + node.graphPart); } } }