From 80c9b7d6012d059ea89c8a267910fa16c45b92bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 18 Nov 2021 09:39:08 +0100 Subject: [PATCH] Fixed #1726 Decompiling AS - missing break when on false branch vs continue on true --- CHANGELOG.md | 2 ++ libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d2bdbe09..c7fbf5000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file. - [#1748] Line height - Descent/ascent in multiline DefineEditText - Editation of font descent colliding with leading - [#1741] AS1/2 direct editation - new String constructor call +- [#1726] Decompiling AS - missing break when on false branch vs continue on true ## [14.4.0] - 2021-04-05 ### Added @@ -2208,6 +2209,7 @@ All notable changes to this project will be documented in this file. [#1687]: https://www.free-decompiler.com/flash/issues/1687 [#1748]: https://www.free-decompiler.com/flash/issues/1748 [#1741]: https://www.free-decompiler.com/flash/issues/1741 +[#1726]: https://www.free-decompiler.com/flash/issues/1726 [#1015]: https://www.free-decompiler.com/flash/issues/1015 [#1466]: https://www.free-decompiler.com/flash/issues/1466 [#1513]: https://www.free-decompiler.com/flash/issues/1513 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 f02f992df..0fc3c484f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -1141,12 +1141,13 @@ public class Graph { } } + //Switch break onFalse and continue onTrue if (i < list.size() - 1) { if ((list.get(list.size() - 1) instanceof ExitItem) || (list.get(list.size() - 1) instanceof BreakItem)) { if (onFalse.isEmpty() && !onTrue.isEmpty() && (onTrue.get(onTrue.size() - 1) instanceof ContinueItem)) { ifi.expression = ifi.expression.invert(null); List onTrueItems = new ArrayList<>(); - for (int j = i + 1; j < list.size(); j++) { + for (int j = i; j < list.size(); j++) { onTrueItems.add(list.remove(i + 1)); } list.addAll(i + 1, ifi.onTrue);