diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/TraitSlotConstAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/TraitSlotConstAVM2Item.java index c4c76d262..1d442c103 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/TraitSlotConstAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/TraitSlotConstAVM2Item.java @@ -16,21 +16,14 @@ */ package com.jpexs.decompiler.flash.abc.avm2.model; -import com.jpexs.decompiler.flash.SourceGeneratorLocalData; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.abc.types.AssignedValue; import com.jpexs.decompiler.flash.abc.types.ConvertData; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.abc.types.traits.TraitType; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; -import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; -import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; -import java.util.ArrayList; -import java.util.List; /** * diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 2a84dfbd3..3c0a5f4d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -271,13 +271,15 @@ public class TraitClass extends Trait implements TraitWithSlot { } } } - + //class header instanceInfo.getClassHeaderStr(convertData.assetsDir, writer, abc, fullyQualifiedNames, false, allowEmbed); writer.endTrait(); writer.startBlock(); writer.startClass(class_info); - + + first.setVal(true); + //static variables & constants ClassInfo classInfo = abc.class_info.get(class_info); classInfo.static_traits.toString(first, abcIndex, new Class[]{TraitSlotConst.class}, this, convertData, path + "/" + instanceInfoName, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, new ArrayList<>(), isInterface); @@ -293,9 +295,11 @@ public class TraitClass extends Trait implements TraitWithSlot { if (!first.getVal()) { writer.newLine(); } + first.setVal(false); List callStack = new ArrayList<>(); callStack.add(abc.bodies.get(bodyIndex)); abc.bodies.get(bodyIndex).toString(callStack, abcIndex, path + "/" + instanceInfoName + ".staticinitializer", exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>()); + //first.setVal(true); //writer.endBlock(); } else { //Note: There must be trait/method highlight even if the initializer is empty to TraitList in GUI to work correctly 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 e3be5f4f5..f007f357d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -3873,7 +3873,12 @@ public class Graph { */ public static GraphTextWriter graphToString(List tree, GraphTextWriter writer, LocalData localData) throws InterruptedException { boolean lastNewLine = true; - for (GraphTargetItem ti : tree) { + int tsize = tree.size(); + if (!tree.isEmpty() && (tree.get(tree.size() - 1) instanceof ScriptEndItem)) { + tsize--; + } + for (int i = 0; i < tsize; i++) { + GraphTargetItem ti = tree.get(i); if (!ti.isEmpty()) { if (ti.hasSingleNewLineAround() && !lastNewLine) { writer.newLine(); @@ -3882,8 +3887,8 @@ public class Graph { if (!ti.handlesNewLine()) { writer.newLine(); } - lastNewLine = false; - if (ti.hasSingleNewLineAround()) { + lastNewLine = false; + if (ti.hasSingleNewLineAround() && (i < tsize - 1)) { writer.newLine(); lastNewLine = true; }