From f6f25e237048e3c254d832f13e5f81210c1543c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Tue, 30 Jul 2013 19:40:19 +0200 Subject: [PATCH] Issue #275 removing returnvoid as last method statement --- .../jpexs/decompiler/flash/abc/avm2/AVM2Code.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 7e20fa6eb..5aad3921d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -74,6 +74,7 @@ import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.model.ScriptEndItem; import java.io.*; import java.util.*; import java.util.logging.Level; @@ -1345,6 +1346,20 @@ public class AVM2Code implements Serializable { } } + int lastPos = list.size() - 1; + if (lastPos < 0) { + lastPos = 0; + } + if ((list.size() > lastPos) && (list.get(lastPos) instanceof ScriptEndItem)) { + lastPos--; + } + if (lastPos < 0) { + lastPos = 0; + } + if ((list.size() > lastPos) && (list.get(lastPos) instanceof ReturnVoidAVM2Item)) { + list.remove(lastPos); + } + s = Graph.graphToString(list, constants, localRegNames, fullyQualifiedNames); if (!hilighted) { return Highlighting.stripHilights(s);