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 72f73f62d..9ee04d74a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -270,11 +270,11 @@ public class Graph { } public GraphPart getNextCommonPart(BaseLocalData localData, GraphPart part, List loops, List gotoParts) throws InterruptedException { - return getCommonPart(localData, part.nextParts, loops, gotoParts); + return getCommonPart(localData, part, part.nextParts, loops, gotoParts); } //TODO: Make this faster! - public GraphPart getCommonPart(BaseLocalData localData, List parts, List loops, List gotoParts) throws InterruptedException { + public GraphPart getCommonPart(BaseLocalData localData, GraphPart prev, List parts, List loops, List gotoParts) throws InterruptedException { if (parts.isEmpty()) { return null; } @@ -290,7 +290,7 @@ public class Graph { if (loopContinues.contains(p)) { break; } - if (gotoParts.contains(p)) { + if (gotoParts.contains(new GraphPartEdge(prev, p))) { break; } boolean common = true; @@ -1541,7 +1541,7 @@ public class Graph { } if (nextParts.size() == 2) { - GraphPart next = getCommonPart(localData, nextParts, loops, new ArrayList<>());//part.getNextPartPath(new ArrayList()); + GraphPart next = getCommonPart(localData, part, nextParts, loops, new ArrayList<>());//part.getNextPartPath(new ArrayList()); //System.err.println("- common part of " + nextParts.get(0) + " and " + nextParts.get(1) + " is " + next); List stopParts2 = new ArrayList<>(); //stopPart); if (next != null) { @@ -1610,7 +1610,7 @@ public class Graph { List cmn = new ArrayList<>(); cmn.add(part); cmn.add(t); - GraphPart next = getCommonPart(localData, cmn, loops, new ArrayList<>()); + GraphPart next = getCommonPart(localData, part, cmn, loops, new ArrayList<>()); if (next != null) { stopPart2.add(next); } else { @@ -1850,7 +1850,7 @@ public class Graph { }*/ nps = part.nextParts; - GraphPart next = getCommonPart(localData, nps, loops, new ArrayList<>()); + GraphPart next = getCommonPart(localData, part, nps, loops, new ArrayList<>()); List stopPart2 = stopPart == null ? new ArrayList<>() : new ArrayList<>(stopPart); if (next != null) { stopPart2.add(next); @@ -2490,7 +2490,7 @@ public class Graph { nps = part.nextParts; boolean isEmpty = nps.get(0) == nps.get(1); - GraphPart next = getCommonPart(localData, nps, loops, gotoTargets); + GraphPart next = getCommonPart(localData, part, nps, loops, gotoTargets); //System.err.println("on part " + part + ", next: " + next); TranslateStack trueStack = (TranslateStack) stack.clone(); TranslateStack falseStack = (TranslateStack) stack.clone(); diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java index 60e1a27ca..1083b7d88 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java @@ -253,8 +253,10 @@ public class ActionScript3Test extends ActionScriptTestBase { + "for(d = 0; d < 25; d++)\r\n" + "{\r\n" + "e = 0;\r\n" - + "if(e < 50)\r\n" + + "if(e >= 50)\r\n" + "{\r\n" + + "continue;\r\n" + + "}\r\n" + "if(e == 9)\r\n" + "{\r\n" + "break;\r\n" @@ -263,12 +265,12 @@ public class ActionScript3Test extends ActionScriptTestBase { + "{\r\n" + "continue loop1;\r\n" + "}\r\n" - + "if(e != 8)\r\n" + + "if(e == 8)\r\n" + "{\r\n" + + "continue;\r\n" + + "}\r\n" + "break loop1;\r\n" + "}\r\n" - + "}\r\n" - + "}\r\n" + "trace(\"hello\");\r\n" + "}\r\n", false); diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf b/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf index 4cdfdfcc3..970e70d62 100644 Binary files a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf and b/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf differ diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old b/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old index b52fa2342..1515dd3c8 100644 --- a/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old +++ b/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old @@ -16,7 +16,7 @@ CONFIG::timeStamp - '22.01.2021' + '23.01.2021' CONFIG::air diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml b/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml index b52fa2342..1515dd3c8 100644 --- a/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml +++ b/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml @@ -16,7 +16,7 @@ CONFIG::timeStamp - '22.01.2021' + '23.01.2021' CONFIG::air