From e881aac7af58232139ec39b6cda73637e5c5f3f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Fri, 5 Oct 2018 21:46:03 +0200 Subject: [PATCH] #1457 pushing on stack before exit item(return/throw) --- CHANGELOG.md | 1 + .../src/com/jpexs/decompiler/graph/Graph.java | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3af2de10..7f24fa344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Fixed - #1457 AS3 switch without lookupswitch ins detection +- #1457 pushing on stack before exit item (return/throw) ## [11.2.0] - 2018-09-08 ### Added 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 a4235491b..7db0bb9c9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -2546,11 +2546,23 @@ public class Graph { protected static void makeAllCommands(List commands, TranslateStack stack) { int clen = commands.size(); - if (!commands.isEmpty()) { - if (commands.get(commands.size() - 1) instanceof BreakItem) { + if (clen > 0) { + if (commands.get(clen - 1) instanceof ScriptEndItem) { clen--; } - if (commands.get(commands.size() - 1) instanceof ContinueItem) { + } + if (clen > 0) { + if (commands.get(clen - 1) instanceof ExitItem) { + clen--; + } + } + if (clen > 0) { + if (commands.get(clen - 1) instanceof BreakItem) { + clen--; + } + } + if (clen > 0) { + if (commands.get(clen - 1) instanceof ContinueItem) { clen--; } }