diff --git a/CHANGELOG.md b/CHANGELOG.md index d31867209..de20c4397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ All notable changes to this project will be documented in this file. - AS1/2 - class detection with ternars - AS1/2 - empty tellTarget - AS1/2 - deobfuscate object literal names +- AS1/2 - spacing in with statement ## [14.6.0] - 2021-11-22 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java index c5c94c4f2..1c4fa52f6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.clauses; import com.jpexs.decompiler.flash.SWF; @@ -59,11 +60,10 @@ public class WithActionItem extends ActionItem { } writer.append("("); scope.toString(writer, localData); - writer.append(")").startBlock(); - for (GraphTargetItem ti : items) { - ti.toString(writer, localData).newLine(); - } - return writer.endBlock(); + writer.append(")"); + appendBlock(null, writer, localData, items); + + return writer; } @Override @@ -83,4 +83,10 @@ public class WithActionItem extends ActionItem { public boolean hasReturnValue() { return false; } + + @Override + public boolean needsSemicolon() { + return false; + } + } diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java index 2efe3efc7..92da81eaa 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java @@ -2368,4 +2368,21 @@ public class ActionScript2Test extends ActionScript2TestBase { + "trace(\"E\");\r\n" ); } + + @Test + public void frame84_withTest() { + compareSrc(84, "trace(\"withTest\");\r\n" + + "trace(\"before\");\r\n" + + "with(_root.something)\r\n" + + "{\r\n" + + "somesub = 5;\r\n" + + "with(subvar)\r\n" + + "{\r\n" + + "somesub2 = 4;\r\n" + + "}\r\n" + + "trace(\"after1\");\r\n" + + "}\r\n" + + "trace(\"after\");\r\n" + ); + } } diff --git a/libsrc/ffdec_lib/testdata/as2/as2.fla b/libsrc/ffdec_lib/testdata/as2/as2.fla index 837f13e3e..a9896f64e 100644 Binary files a/libsrc/ffdec_lib/testdata/as2/as2.fla and b/libsrc/ffdec_lib/testdata/as2/as2.fla differ diff --git a/libsrc/ffdec_lib/testdata/as2/as2.swf b/libsrc/ffdec_lib/testdata/as2/as2.swf index de97b4185..a0d770c32 100644 Binary files a/libsrc/ffdec_lib/testdata/as2/as2.swf and b/libsrc/ffdec_lib/testdata/as2/as2.swf differ