Fixed #1769 Missing some body trait variable declaration

This commit is contained in:
Jindra Petřík
2022-11-30 22:58:35 +01:00
parent 3ff9a042c8
commit 25bc05012f
23 changed files with 407 additions and 114 deletions
@@ -65,12 +65,10 @@ public class ABCStreamTest {
@Test
public void testU30() {
for (long number : getTestNumbers(0, (1L << 30) - 1)) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ABCOutputStream aos = new ABCOutputStream(baos);) {
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream(); ABCOutputStream aos = new ABCOutputStream(baos);) {
aos.writeU30(number);
aos.close();
try (MemoryInputStream mis = new MemoryInputStream(baos.toByteArray());
ABCInputStream ais = new ABCInputStream(mis);) {
try ( MemoryInputStream mis = new MemoryInputStream(baos.toByteArray()); ABCInputStream ais = new ABCInputStream(mis);) {
assertEquals(number, ais.readU30("test"));
assertEquals(0, mis.available());
}
@@ -83,12 +81,10 @@ public class ABCStreamTest {
@Test
public void testU32() {
for (long number : getTestNumbers(0, (1L << 32) - 1)) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ABCOutputStream aos = new ABCOutputStream(baos);) {
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream(); ABCOutputStream aos = new ABCOutputStream(baos);) {
aos.writeU32(number);
aos.close();
try (MemoryInputStream mis = new MemoryInputStream(baos.toByteArray());
ABCInputStream ais = new ABCInputStream(mis);) {
try ( MemoryInputStream mis = new MemoryInputStream(baos.toByteArray()); ABCInputStream ais = new ABCInputStream(mis);) {
assertEquals(number, ais.readU32("test"));
assertEquals(0, mis.available());
}
@@ -101,12 +97,10 @@ public class ABCStreamTest {
@Test
public void testS32() {
for (long number : getTestNumbers(-(1L << 31), (1 << 31) - 1)) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ABCOutputStream aos = new ABCOutputStream(baos);) {
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream(); ABCOutputStream aos = new ABCOutputStream(baos);) {
aos.writeS32(number);
aos.close();
try (MemoryInputStream mis = new MemoryInputStream(baos.toByteArray());
ABCInputStream ais = new ABCInputStream(mis);) {
try ( MemoryInputStream mis = new MemoryInputStream(baos.toByteArray()); ABCInputStream ais = new ABCInputStream(mis);) {
assertEquals(number, ais.readS32("test"));
assertEquals(0, mis.available());
}
@@ -438,7 +438,7 @@ public class ActionScript2ModificationTest extends ActionScript2TestBase {
+ "label_2:Jump label_3\n"
+ "label_3:Jump label_4\n"
+ "label_4:";
ActionJump jump = new ActionJump(0, Utf8Helper.charsetName );
ActionJump jump = new ActionJump(0, Utf8Helper.charsetName);
jump.setAddress(9);
jump.setJumpOffset(24 - 9 - 5);
testAddActionNormal(actionsString, expectedResult, jump, 3);
@@ -80,7 +80,7 @@ public class ActionScript3AssemblerTest extends ActionScriptTestBase {
@Override
public void setABC(ABC abc) {
}
}
});
}
@@ -90,7 +90,7 @@ public class ActionScript3DeobfuscatorTest extends ActionScriptTestBase {
@Override
public void setABC(ABC abc) {
}
}
});
MethodBody b = new MethodBody(abc, new Traits(), new byte[0], new ABCException[0]);
AVM2Code code = ASM3Parser.parse(abc, new StringReader(str), null, b, new MethodInfo());
@@ -125,7 +125,7 @@ public class ActionScript3DeobfuscatorTest extends ActionScriptTestBase {
@Override
public void setABC(ABC abc) {
}
}
});
ActionScript3Parser par = new ActionScript3Parser(abc, new ArrayList<>(), false);
HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false);
@@ -125,14 +125,14 @@ public class DirectEditingTest extends FileTestBase {
try {
asm.setActions(par.actionsFromString(as2, Utf8Helper.charsetName));
} catch (ActionParseException | CompilationException ex) {
fail("Unable to parse: " + asm.getSwf().getTitleOrShortFileName()+ "/" + asm.toString(), ex);
fail("Unable to parse: " + asm.getSwf().getTitleOrShortFileName() + "/" + asm.toString(), ex);
}
writer = new HighlightedTextWriter(new CodeFormatting(), false);
asm.getActionScriptSource(writer, null);
String as3 = writer.toString();
//as3 = asm.removePrefixAndSuffix(as3);
if (!as3.equals(as2)) {
fail("ActionScript is different: " + asm.getSwf().getTitleOrShortFileName()+ "/" + asm.toString());
fail("ActionScript is different: " + asm.getSwf().getTitleOrShortFileName() + "/" + asm.toString());
}
asm.setModified();
} catch (InterruptedException | IOException | OutOfMemoryError | TranslateException | StackOverflowError ex) {
@@ -142,7 +142,7 @@ public class DirectEditingTest extends FileTestBase {
String nFilePath = filePath.substring(0, filePath.length() - 4); //remove .swf
nFilePath += ".recompiled.swf";
try (FileOutputStream fos = new FileOutputStream(nFilePath)) {
try ( FileOutputStream fos = new FileOutputStream(nFilePath)) {
swf.saveTo(fos);
}
//TODO: try tu run it in debug flashplayer (?)
@@ -50,7 +50,7 @@ public class RecompileTest extends FileTestBase {
public void testAS3InstructionParsing(String filePath) {
try {
Configuration._debugCopy.set(false);
try (FileInputStream fis = new FileInputStream(filePath)) {
try ( FileInputStream fis = new FileInputStream(filePath)) {
SWF swf = new SWF(new BufferedInputStream(fis), false);
for (ABCContainerTag abcTag : swf.getAbcList()) {
ABC abc = abcTag.getABC();
@@ -69,7 +69,7 @@ public class RecompileTest extends FileTestBase {
@Test(dataProvider = "provideFiles")
public void testRecompile(String filePath) {
try {
try (FileInputStream fis = new FileInputStream(filePath)) {
try ( FileInputStream fis = new FileInputStream(filePath)) {
Configuration._debugCopy.set(true);
SWF swf = new SWF(new BufferedInputStream(fis), false);
swf.saveTo(new ByteArrayOutputStream());
@@ -54,10 +54,10 @@ public class SWFStreamTest {
public void testFB() throws IOException {
double f = 5.25;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION, Utf8Helper.charsetName)) {
try ( SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION, Utf8Helper.charsetName)) {
sos.writeFB(20, f);
}
try (SWFInputStream sis = new SWFInputStream(null, baos.toByteArray())) {
try ( SWFInputStream sis = new SWFInputStream(null, baos.toByteArray())) {
assertTrue(Double.compare(f, sis.readFB(20, "test")) == 0);
}
}
@@ -65,14 +65,14 @@ public class SWFStreamTest {
@Test
public void testUB() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION, Utf8Helper.charsetName)) {
try ( SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION, Utf8Helper.charsetName)) {
sos.writeUB(5, 1);
sos.writeUB(6, 2);
sos.writeUB(7, 3);
sos.writeUB(8, 4);
sos.writeUB(9, 5);
}
try (SWFInputStream sis = new SWFInputStream(null, baos.toByteArray())) {
try ( SWFInputStream sis = new SWFInputStream(null, baos.toByteArray())) {
assertEquals(1, sis.readUB(5, "test"));
assertEquals(2, sis.readUB(6, "test"));
assertEquals(3, sis.readUB(7, "test"));
@@ -84,14 +84,14 @@ public class SWFStreamTest {
@Test
public void testSB() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION, Utf8Helper.charsetName)) {
try ( SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION, Utf8Helper.charsetName)) {
sos.writeSB(5, -1);
sos.writeSB(6, 2);
sos.writeSB(7, -3);
sos.writeSB(8, 4);
sos.writeSB(9, -5);
}
try (SWFInputStream sis = new SWFInputStream(null, baos.toByteArray())) {
try ( SWFInputStream sis = new SWFInputStream(null, baos.toByteArray())) {
assertEquals(-1, sis.readSB(5, "test"));
assertEquals(2, sis.readSB(6, "test"));
assertEquals(-3, sis.readSB(7, "test"));
@@ -185,11 +185,11 @@ public class SWFStreamTest {
public void testRECT() throws IOException {
RECT rect;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION, Utf8Helper.charsetName)) {
try ( SWFOutputStream sos = new SWFOutputStream(baos, SWF.DEFAULT_VERSION, Utf8Helper.charsetName)) {
rect = new RECT(-0x80000000, 0x7FFFFFFF, -0x80000000, 0x7FFFFFFF);
sos.writeRECT(rect);
}
try (SWFInputStream sis = new SWFInputStream(null, baos.toByteArray())) {
try ( SWFInputStream sis = new SWFInputStream(null, baos.toByteArray())) {
RECT readRECT = sis.readRECT("test");
assertEquals(readRECT.Xmin, -0x3FFFFFFF);
assertEquals(readRECT.Xmax, 0x3FFFFFFF);
@@ -97,7 +97,7 @@ public class SwfXmlExportImportTest extends FileTestBase {
new SwfXmlExporter().exportXml(swf, outFile);
SWF swf2 = new SWF();
try (FileInputStream fis = new FileInputStream(outFile)) {
try ( FileInputStream fis = new FileInputStream(outFile)) {
new SwfXmlImporter().importSwf(swf2, fis);
}
@@ -24,7 +24,8 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
@Test
public void testDeclareReg() {
decompileMethod("assembled", "testDeclareReg", "with(other)\r\n"
decompileMethod("assembled", "testDeclareReg", "var other:XML;\r\n"
+ "with(other)\r\n"
+ "{\r\n"
+ "trace(\"hey\");\r\n"
+ "}\r\n",
@@ -155,8 +156,8 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
@Test
public void testSetSlotDup() {
decompileMethod("assembled", "testSetSlotDup", "var _loc5_:int = 5;\r\n"
+ "var myslot:int;\r\n"
decompileMethod("assembled", "testSetSlotDup", "var myslot:int;\r\n"
+ "var _loc5_:int = 5;\r\n"
+ "myname.somemethod(\"okay\",myslot = _loc5_);\r\n"
+ "myname.start();\r\n",
false);
@@ -338,8 +339,9 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
@Test
public void testTryDoWhile2() {
decompileMethod("assembled", "testTryDoWhile2", "trace(\"hello\");\r\n"
+ "var _loc5_:* = Math.random();\r\n"
decompileMethod("assembled", "testTryDoWhile2", "var _loc5_:*;\r\n"
+ "trace(\"hello\");\r\n"
+ "_loc5_ = Math.random();\r\n"
+ "do\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -357,9 +359,12 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
@Test
public void testTryWhile() {
decompileMethod("assembled", "testTryWhile", "try\r\n"
decompileMethod("assembled", "testTryWhile", "var a:String;\r\n"
+ "var b:String;\r\n"
+ "var c:String;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "var c:String = \"aa\";\r\n"
+ "c = \"aa\";\r\n"
+ "while(c)\r\n"
+ "{\r\n"
+ "if(b)\r\n"
@@ -1066,9 +1066,10 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
decompileMethod("classic_air", "testInlineFunctions", "var first:String = \"value1\";\r\n"
+ "var traceParameter:Function = function(aParam:String):String\r\n"
+ "{\r\n"
+ "var traceParam2:Function;\r\n"
+ "var second:String = \"value2\";\r\n"
+ "second = second + \"cc\";\r\n"
+ "var traceParam2:Function = function(bParam:String):String\r\n"
+ "traceParam2 = function(bParam:String):String\r\n"
+ "{\r\n"
+ "trace(bParam + \",\" + aParam);\r\n"
+ "return first + second + aParam + bParam;\r\n"
@@ -1216,7 +1217,8 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
@Test
public void testNamedAnonFunctions() {
decompileMethod("classic_air", "testNamedAnonFunctions", "var test:* = new (function():*\r\n"
decompileMethod("classic_air", "testNamedAnonFunctions", "var test:*;\r\n"
+ "test = new (function():*\r\n"
+ "{\r\n"
+ "var testFunc:Function;\r\n"
+ "return testFunc = function(param1:*, param2:int, param3:Array):Boolean\r\n"
@@ -1548,6 +1550,27 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
false);
}
@Test
public void testUndefined() {
decompileMethod("classic_air", "testUndefined", "var i:int;\r\n"
+ "var j:int;\r\n"
+ "var c:int;\r\n"
+ "var f:*;\r\n"
+ "c = 5 + i;\r\n"
+ "f = function():*\r\n"
+ "{\r\n"
+ "trace(c);\r\n"
+ "trace(j);\r\n"
+ "};\r\n"
+ "while(i < 10)\r\n"
+ "{\r\n"
+ "trace(i);\r\n"
+ "i++;\r\n"
+ "}\r\n"
+ "f();\r\n",
false);
}
@Test
public void testUsagesTry() {
decompileMethod("classic_air", "testUsagesTry", "var k:int = 5;\r\n"
@@ -120,13 +120,16 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testCompoundAssignments() {
decompileMethod("classic", "testCompoundAssignments", "var b:* = [10,20,30];\r\n"
+ "var a:int = 0;\r\n"
decompileMethod("classic", "testCompoundAssignments", "var b:*;\r\n"
+ "var a:int;\r\n"
+ "var t:MyTest;\r\n"
+ "b = [10,20,30];\r\n"
+ "a = 0;\r\n"
+ "trace(\"a += 5\");\r\n"
+ "a += 5;\r\n"
+ "trace(\"arr[call()] = arr[call()] + 2;\");\r\n"
+ "b[this.calc()] = b[this.calc()] + 2;\r\n"
+ "var t:MyTest = new MyTest();\r\n"
+ "t = new MyTest();\r\n"
+ "trace(\"t.attr *= 10\");\r\n"
+ "t.attr *= 10;\r\n"
+ "trace(\"attr -= 5\");\r\n"
@@ -390,7 +393,8 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testFinallyZeroJump() {
decompileMethod("classic", "testFinallyZeroJump", "var str:String = param1;\r\n"
decompileMethod("classic", "testFinallyZeroJump", "var str:String;\r\n"
+ "str = param1;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "}\r\n"
@@ -648,18 +652,24 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testForXml() {
decompileMethod("classic", "testForXml", "var c:int = 0;\r\n"
decompileMethod("classic", "testForXml", "var myXML:XML;\r\n"
+ "var k:*;\r\n"
+ "var len:int;\r\n"
+ "var a:int;\r\n"
+ "var b:int;\r\n"
+ "var i:int;\r\n"
+ "var c:int = 0;\r\n"
+ "var name:String = \"ahoj\";\r\n"
+ "var myXML:XML = <order id=\"604\">\r\n"
+ "myXML = <order id=\"604\">\r\n"
+ "<book isbn=\"12345\">\r\n"
+ "<title>{name}</title>\r\n"
+ "</book>\r\n"
+ "</order>;\r\n"
+ "var k:* = null;\r\n"
+ "var len:int = 5;\r\n"
+ "var a:int = 5;\r\n"
+ "var b:int = 6;\r\n"
+ "for(var i:int = 0; i < len; k = myXML.book.(@isbn == \"12345\"))\r\n"
+ "k = null;\r\n"
+ "len = 5;\r\n"
+ "a = 5;\r\n"
+ "b = 6;\r\n"
+ "for(i = 0; i < len; k = myXML.book.(@isbn == \"12345\"))\r\n"
+ "{\r\n"
+ "c = 1;\r\n"
+ "if(c == 2)\r\n"
@@ -893,7 +903,8 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testIfFinally() {
decompileMethod("classic", "testIfFinally", "var a:int = Math.random();\r\n"
decompileMethod("classic", "testIfFinally", "var a:int;\r\n"
+ "a = Math.random();\r\n"
+ "if(a == 5)\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -1062,10 +1073,11 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
+ "first = \"value1\";\r\n"
+ "var traceParameter:Function = function(aParam:String):String\r\n"
+ "{\r\n"
+ "var traceParam2:Function;\r\n"
+ "var second:String = null;\r\n"
+ "second = \"value2\";\r\n"
+ "second += \"cc\";\r\n"
+ "var traceParam2:Function = function(bParam:String):String\r\n"
+ "traceParam2 = function(bParam:String):String\r\n"
+ "{\r\n"
+ "trace(bParam + \",\" + aParam);\r\n"
+ "return first + second + aParam + bParam;\r\n"
@@ -1213,7 +1225,8 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testNamedAnonFunctions() {
decompileMethod("classic", "testNamedAnonFunctions", "var test:* = new function testFunc(param1:*, param2:int, param3:Array):Boolean\r\n"
decompileMethod("classic", "testNamedAnonFunctions", "var test:*;\r\n"
+ "test = new function testFunc(param1:*, param2:int, param3:Array):Boolean\r\n"
+ "{\r\n"
+ "return (param1 as TestClass2).attrib1 == 5;\r\n"
+ "};\r\n",
@@ -1454,7 +1467,8 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testTryIf() {
decompileMethod("classic", "testTryIf", "var a:int = Math.random();\r\n"
decompileMethod("classic", "testTryIf", "var a:int;\r\n"
+ "a = Math.random();\r\n"
+ "try\r\n"
+ "{\r\n"
+ "if(a > 5 && a < 50)\r\n"
@@ -1500,13 +1514,17 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testTryReturn2() {
decompileMethod("classic", "testTryReturn2", "var c:Boolean = false;\r\n"
decompileMethod("classic", "testTryReturn2", "var a:Boolean;\r\n"
+ "var b:Boolean;\r\n"
+ "var d:Boolean;\r\n"
+ "var e:Boolean;\r\n"
+ "var c:Boolean = false;\r\n"
+ "trace(\"before\");\r\n"
+ "var a:Boolean = true;\r\n"
+ "var b:Boolean = false;\r\n"
+ "a = true;\r\n"
+ "b = false;\r\n"
+ "c = true;\r\n"
+ "var d:Boolean = false;\r\n"
+ "var e:Boolean = true;\r\n"
+ "d = false;\r\n"
+ "e = true;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "if(a)\r\n"
@@ -1541,9 +1559,32 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
false);
}
@Test
public void testUndefined() {
decompileMethod("classic", "testUndefined", "var f:*;\r\n"
+ "var i:int = 0;\r\n"
+ "var j:int = 0;\r\n"
+ "var c:int = 0;\r\n"
+ "c = 5 + i;\r\n"
+ "f = function():*\r\n"
+ "{\r\n"
+ "trace(c);\r\n"
+ "trace(j);\r\n"
+ "};\r\n"
+ "while(i < 10)\r\n"
+ "{\r\n"
+ "trace(i);\r\n"
+ "i++;\r\n"
+ "}\r\n"
+ "f();\r\n",
false);
}
@Test
public void testUsagesTry() {
decompileMethod("classic", "testUsagesTry", "var k:int = 5;\r\n"
decompileMethod("classic", "testUsagesTry", "var a:Boolean;\r\n"
+ "var b:Boolean;\r\n"
+ "var k:int = 5;\r\n"
+ "switch(k)\r\n"
+ "{\r\n"
+ "case 0:\r\n"
@@ -1552,8 +1593,8 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
+ "case 1:\r\n"
+ "trace(\"2\");\r\n"
+ "}\r\n"
+ "var a:Boolean = true;\r\n"
+ "var b:Boolean = true;\r\n"
+ "a = true;\r\n"
+ "b = true;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "if(b)\r\n"
@@ -1673,8 +1714,10 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testWhileTry2() {
decompileMethod("classic", "testWhileTry2", "var j:* = undefined;\r\n"
+ "for(var i:* = 0; i < 100; i++)\r\n"
decompileMethod("classic", "testWhileTry2", "var j:*;\r\n"
+ "var i:*;\r\n"
+ "j = undefined;\r\n"
+ "for(i = 0; i < 100; i++)\r\n"
+ "{\r\n"
+ "try\r\n"
+ "{\r\n"
@@ -1699,17 +1742,20 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testXml() {
decompileMethod("classic", "testXml", "var g:XML = null;\r\n"
decompileMethod("classic", "testXml", "var myXML:XML;\r\n"
+ "var k:*;\r\n"
+ "var all:String;\r\n"
+ "var g:XML = null;\r\n"
+ "var testCdata:XML = null;\r\n"
+ "var testComment:XML = null;\r\n"
+ "var name:String = \"ahoj\";\r\n"
+ "var myXML:XML = <order id=\"604\">\r\n"
+ "myXML = <order id=\"604\">\r\n"
+ "<book isbn=\"12345\">\r\n"
+ "<title>{name}</title>\r\n"
+ "</book>\r\n"
+ "</order>;\r\n"
+ "var k:* = myXML.@id;\r\n"
+ "var all:String = myXML.@*.toXMLString();\r\n"
+ "k = myXML.@id;\r\n"
+ "all = myXML.@*.toXMLString();\r\n"
+ "k = myXML.book;\r\n"
+ "k = myXML.book.(@isbn == \"12345\");\r\n"
+ "g = <script>\r\n"
@@ -96,7 +96,8 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchInIf2(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchInIf2", "var a:int = Math.random();\r\n"
decompileMethod(swfUsed, "testTryCatchInIf2", "var a:int;\r\n"
+ "a = Math.random();\r\n"
+ "if(a > 10)\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -515,7 +516,8 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchWith(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchWith", "var a:MyTest = new MyTest();\r\n"
decompileMethod(swfUsed, "testTryCatchWith", "var a:MyTest;\r\n"
+ "a = new MyTest();\r\n"
+ "trace(\"before with\");\r\n"
+ "with(a)\r\n"
+ "{\r\n"
@@ -744,7 +746,8 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryFinallyReturnNested(String swfUsed) {
decompileMethod(swfUsed, "testTryFinallyReturnNested", "var a:int = Math.random() * 5;\r\n"
decompileMethod(swfUsed, "testTryFinallyReturnNested", "var a:int;\r\n"
+ "a = Math.random() * 5;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"before try2\");\r\n"
@@ -776,7 +779,8 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryFinallyReturnNested2(String swfUsed) {
decompileMethod(swfUsed, "testTryFinallyReturnNested2", "var a:int = Math.random() * 5;\r\n"
decompileMethod(swfUsed, "testTryFinallyReturnNested2", "var a:int;\r\n"
+ "a = Math.random() * 5;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -828,7 +832,8 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryFinallyReturnVoid(String swfUsed) {
decompileMethod(swfUsed, "testTryFinallyReturnVoid", "var a:int = Math.random() * 5;\r\n"
decompileMethod(swfUsed, "testTryFinallyReturnVoid", "var a:int;\r\n"
+ "a = Math.random() * 5;\r\n"
+ "trace(\"before try\");\r\n"
+ "try\r\n"
+ "{\r\n"