diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicAirDecompileTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicAirDecompileTest.java index 6f5432d9a..d2bad1cd4 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicAirDecompileTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicAirDecompileTest.java @@ -1297,67 +1297,198 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile } @Test - public void testInc2() { - decompileMethod("classic_air", "testInc2", "var a:* = [1];\r\n" - + "var d:* = a[this.getInt()]++;\r\n" - + "var e:* = ++a[this.getInt()];\r\n" - + "a[this.getInt()]++;\r\n" - + "++a[this.getInt()];\r\n" - + "var b:* = 1;\r\n" - + "b++;\r\n" - + "var c:int = 1;\r\n" - + "b = c++;\r\n", + public void testIncDec1() { + decompileMethod("classic_air", "testIncDec1", "var a:int = 5;\r\n" + + "trace(\"++a with result\");\r\n" + + "trace(++a);\r\n" + + "trace(\"--a with result\");\r\n" + + "trace(--a);\r\n" + + "trace(\"++a no result\");\r\n" + + "a++;\r\n" + + "trace(\"--a no result\");\r\n" + + "a--;\r\n", false); } @Test - public void testIncDec() { - decompileMethod("classic_air", "testIncDec", "var a:int = 5;\r\n" - + "var b:* = 0;\r\n" - + "trace(\"++var\");\r\n" - + "b = ++a;\r\n" - + "trace(\"var++\");\r\n" - + "b = a++;\r\n" - + "trace(\"--var\");\r\n" - + "b = --a;\r\n" - + "trace(\"var--\");\r\n" - + "b = a--;\r\n" - + "var c:* = [1,2,3,4,5];\r\n" - + "trace(\"++arr\");\r\n" - + "b = ++c[2];\r\n" - + "trace(\"arr++\");\r\n" - + "b = c[2]++;\r\n" - + "trace(\"--arr\");\r\n" - + "b = --c[2];\r\n" - + "trace(\"arr--\");\r\n" - + "b = c[2]--;\r\n" - + "var d:* = new TestClass1();\r\n" - + "trace(\"++property\");\r\n" - + "trace(++d.attrib);\r\n" - + "trace(\"property++\");\r\n" - + "trace(d.attrib++);\r\n" - + "trace(\"--property\");\r\n" - + "trace(--d.attrib);\r\n" - + "trace(\"property--\");\r\n" - + "trace(d.attrib--);\r\n" - + "trace(\"arr[e++]\");\r\n" - + "var chars:Array = new Array(36);\r\n" - + "var index:uint = 0;\r\n" - + "chars[index++] = 5;\r\n" - + "trace(\"arr[++e]\");\r\n" - + "chars[++index] = 5;\r\n" - + "trace(\"attr++\");\r\n" - + "trace(attrx++);\r\n" - + "attrx++;\r\n" - + "trace(\"attr--\");\r\n" - + "trace(attrx--);\r\n" - + "attrx--;\r\n" - + "trace(\"++attr\");\r\n" - + "trace(++attrx);\r\n" - + "++attrx;\r\n" - + "trace(\"--attr\");\r\n" - + "trace(--attrx);\r\n" - + "--attrx;\r\n", + public void testIncDec2() { + decompileMethod("classic_air", "testIncDec2", "var a:int = 5;\r\n" + + "trace(\"a++ with result\");\r\n" + + "trace(a++);\r\n" + + "trace(\"a-- with result\");\r\n" + + "trace(a--);\r\n" + + "trace(\"a++ no result\");\r\n" + + "a++;\r\n" + + "trace(\"a-- no result\");\r\n" + + "a--;\r\n", + false); + } + + @Test + public void testIncDec3() { + decompileMethod("classic_air", "testIncDec3", "var a:* = [1,2,3,4,5];\r\n" + + "trace(\"++a[2] with result\");\r\n" + + "trace(++a[2]);\r\n" + + "trace(\"--a[2] with result\");\r\n" + + "trace(--a[2]);\r\n" + + "trace(\"++a[2] no result\");\r\n" + + "++a[2];\r\n" + + "trace(\"--a[2] no result\");\r\n" + + "--a[2];\r\n", + false); + } + + @Test + public void testIncDec4() { + decompileMethod("classic_air", "testIncDec4", "var a:* = [1,2,3,4,5];\r\n" + + "trace(\"a[2]++ with result\");\r\n" + + "trace(a[2]++);\r\n" + + "trace(\"a[2]-- with result\");\r\n" + + "trace(a[2]--);\r\n" + + "trace(\"a[2]++ no result\");\r\n" + + "a[2]++;\r\n" + + "trace(\"a[2]-- no result\");\r\n" + + "a[2]--;\r\n", + false); + } + + @Test + public void testIncDec5() { + decompileMethod("classic_air", "testIncDec5", "var a:* = new TestClass1();\r\n" + + "trace(\"++a.attrib with result\");\r\n" + + "trace(++a.attrib);\r\n" + + "trace(\"--a.attrib with result\");\r\n" + + "trace(--a.attrib);\r\n" + + "trace(\"++a.attrib no result\");\r\n" + + "++a.attrib;\r\n" + + "trace(\"--a.attrib no result\");\r\n" + + "--a.attrib;\r\n", + false); + } + + @Test + public void testIncDec6() { + decompileMethod("classic_air", "testIncDec6", "var a:* = new TestClass1();\r\n" + + "trace(\"a.attrib++ with result\");\r\n" + + "trace(a.attrib++);\r\n" + + "trace(\"a.attrib-- with result\");\r\n" + + "trace(a.attrib--);\r\n" + + "trace(\"a.attrib++ no result\");\r\n" + + "a.attrib++;\r\n" + + "trace(\"a.attrib-- no result\");\r\n" + + "a.attrib--;\r\n", + false); + } + + @Test + public void testIncDec7() { + decompileMethod("classic_air", "testIncDec7", "var a:* = [1,2,3,4,5];\r\n" + + "var index:int = 0;\r\n" + + "trace(\"a[++index]\");\r\n" + + "index++;\r\n" + + "trace(a[index]);\r\n" + + "trace(\"a[--index]\");\r\n" + + "index--;\r\n" + + "trace(a[index]);\r\n", + false); + } + + @Test + public void testIncDec8() { + decompileMethod("classic_air", "testIncDec8", "var a:* = [1,2,3,4,5];\r\n" + + "var index:int = 0;\r\n" + + "trace(\"a[index++]\");\r\n" + + "trace(a[index++]);\r\n" + + "trace(\"a[index--]\");\r\n" + + "trace(a[index--]);\r\n", + false); + } + + @Test + public void testIncDec9() { + decompileMethod("classic_air", "testIncDec9", "trace(\"++attrib with result\");\r\n" + + "trace(++attrib);\r\n" + + "trace(\"--attrib with result\");\r\n" + + "trace(--attrib);\r\n" + + "trace(\"++attrib no result\");\r\n" + + "++attrib;\r\n" + + "trace(\"--attrib no result\");\r\n" + + "--attrib;\r\n", + false); + } + + @Test + public void testIncDec10() { + decompileMethod("classic_air", "testIncDec10", "trace(\"attrib++ with result\");\r\n" + + "trace(attrib++);\r\n" + + "trace(\"attrib-- with result\");\r\n" + + "trace(attrib--);\r\n" + + "trace(\"attrib++ no result\");\r\n" + + "attrib++;\r\n" + + "trace(\"attrib-- no result\");\r\n" + + "attrib--;\r\n", + false); + } + + @Test + public void testIncDec11() { + decompileMethod("classic_air", "testIncDec11", "var f:Function = function():void\r\n" + + "{\r\n" + + "};\r\n" + + "var slot:int = 0;\r\n" + + "trace(\"++slot with result\");\r\n" + + "trace(++slot);\r\n" + + "trace(\"--slot with result\");\r\n" + + "trace(--slot);\r\n" + + "trace(\"++slot no result\");\r\n" + + "++slot;\r\n" + + "trace(\"--slot no result\");\r\n" + + "--slot;\r\n", + false); + } + + @Test + public void testIncDec12() { + decompileMethod("classic_air", "testIncDec12", "var f:Function = function():void\r\n" + + "{\r\n" + + "};\r\n" + + "var slot:int = 0;\r\n" + + "trace(\"slot++ with result\");\r\n" + + "trace(slot++);\r\n" + + "trace(\"slot-- with result\");\r\n" + + "trace(slot--);\r\n" + + "trace(\"slot++ no result\");\r\n" + + "slot++;\r\n" + + "trace(\"slot-- no result\");\r\n" + + "slot--;\r\n", + false); + } + + @Test + public void testIncDec13() { + decompileMethod("classic_air", "testIncDec13", "var a:* = [1,2,3,4,5];\r\n" + + "trace(\"++a[this.f()] with result\");\r\n" + + "trace(++a[this.f()]);\r\n" + + "trace(\"--a[this.f()] with result\");\r\n" + + "trace(--a[this.f()]);\r\n" + + "trace(\"++a[this.f()] no result\");\r\n" + + "++a[this.f()];\r\n" + + "trace(\"--a[this.f()] no result\");\r\n" + + "--a[this.f()];\r\n", + false); + } + + @Test + public void testIncDec14() { + decompileMethod("classic_air", "testIncDec14", "var a:* = [1,2,3,4,5];\r\n" + + "trace(\"a[this.f()]++ with result\");\r\n" + + "trace(a[this.f()]++);\r\n" + + "trace(\"a[this.f()]-- with result\");\r\n" + + "trace(a[this.f()]--);\r\n" + + "trace(\"a[this.f()]++ no result\");\r\n" + + "a[this.f()]++;\r\n" + + "trace(\"a[this.f()]-- no result\");\r\n" + + "a[this.f()]--;\r\n", false); } @@ -1501,7 +1632,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile @Test public void testLoopInLoop() { - decompileMethod("classic_air", "testLoopInLoop", "var i:* = undefined;\r\n" + decompileMethod("classic_air", "testLoopInLoop", "var i:int = 0;\r\n" + "var a:Boolean = true;\r\n" + "var b:Boolean = true;\r\n" + "var c:Boolean = true;\r\n" diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicDecompileTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicDecompileTest.java index f86dd3b13..7bc243fcd 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicDecompileTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3ClassicDecompileTest.java @@ -1293,69 +1293,196 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes } @Test - public void testInc2() { - decompileMethod("classic", "testInc2", "var a:* = [1];\r\n" - + "var d:* = a[this.getInt()]++;\r\n" - + "var e:* = ++a[this.getInt()];\r\n" - + "++a[this.getInt()];\r\n" - + "++a[this.getInt()];\r\n" - + "var b:* = 1;\r\n" - + "b++;\r\n" - + "var c:* = 1;\r\n" - + "b = c++;\r\n", + public void testIncDec1() { + decompileMethod("classic", "testIncDec1", "var a:* = 5;\r\n" + + "trace(\"++a with result\");\r\n" + + "trace(++a);\r\n" + + "trace(\"--a with result\");\r\n" + + "trace(--a);\r\n" + + "trace(\"++a no result\");\r\n" + + "a++;\r\n" + + "trace(\"--a no result\");\r\n" + + "a--;\r\n", false); } @Test - public void testIncDec() { - decompileMethod("classic", "testIncDec", "var a:* = 5;\r\n" - + "var b:* = 0;\r\n" - + "trace(\"++var\");\r\n" - + "b = ++a;\r\n" - + "trace(\"var++\");\r\n" - + "b = a++;\r\n" - + "trace(\"--var\");\r\n" - + "b = --a;\r\n" - + "trace(\"var--\");\r\n" - + "b = a--;\r\n" - + "var c:* = [1,2,3,4,5];\r\n" - + "trace(\"++arr\");\r\n" - + "b = ++c[2];\r\n" - + "trace(\"arr++\");\r\n" - + "b = c[2]++;\r\n" - + "trace(\"--arr\");\r\n" - + "b = --c[2];\r\n" - + "trace(\"arr--\");\r\n" - + "b = c[2]--;\r\n" - + "var d:* = new TestClass1();\r\n" - + "trace(\"++property\");\r\n" - + "trace(++d.attrib);\r\n" - + "trace(\"property++\");\r\n" - + "trace(d.attrib++);\r\n" - + "trace(\"--property\");\r\n" - + "trace(--d.attrib);\r\n" - + "trace(\"property--\");\r\n" - + "trace(d.attrib--);\r\n" - + "trace(\"arr[e++]\");\r\n" - + "var chars:Array = new Array(36);\r\n" - + "var index:uint = 0;\r\n" - + "var _loc7_:* = index++;\r\n" - + "chars[_loc7_] = 5;\r\n" - + "trace(\"arr[++e]\");\r\n" - + "var _loc8_:* = ++index;\r\n" - + "chars[_loc8_] = 5;\r\n" - + "trace(\"attr++\");\r\n" - + "trace(this.attrx++);\r\n" - + "++this.attrx;\r\n" - + "trace(\"attr--\");\r\n" - + "trace(this.attrx--);\r\n" - + "--this.attrx;\r\n" - + "trace(\"++attr\");\r\n" - + "trace(++this.attrx);\r\n" - + "++this.attrx;\r\n" - + "trace(\"--attr\");\r\n" - + "trace(--this.attrx);\r\n" - + "--this.attrx;\r\n", + public void testIncDec2() { + decompileMethod("classic", "testIncDec2", "var a:* = 5;\r\n" + + "trace(\"a++ with result\");\r\n" + + "trace(a++);\r\n" + + "trace(\"a-- with result\");\r\n" + + "trace(a--);\r\n" + + "trace(\"a++ no result\");\r\n" + + "a++;\r\n" + + "trace(\"a-- no result\");\r\n" + + "a--;\r\n", + false); + } + + @Test + public void testIncDec3() { + decompileMethod("classic", "testIncDec3", "var a:* = [1,2,3,4,5];\r\n" + + "trace(\"++a[2] with result\");\r\n" + + "trace(++a[2]);\r\n" + + "trace(\"--a[2] with result\");\r\n" + + "trace(--a[2]);\r\n" + + "trace(\"++a[2] no result\");\r\n" + + "++a[2];\r\n" + + "trace(\"--a[2] no result\");\r\n" + + "--a[2];\r\n", + false); + } + + @Test + public void testIncDec4() { + decompileMethod("classic", "testIncDec4", "var a:* = [1,2,3,4,5];\r\n" + + "trace(\"a[2]++ with result\");\r\n" + + "trace(a[2]++);\r\n" + + "trace(\"a[2]-- with result\");\r\n" + + "trace(a[2]--);\r\n" + + "trace(\"a[2]++ no result\");\r\n" + + "++a[2];\r\n" + + "trace(\"a[2]-- no result\");\r\n" + + "--a[2];\r\n", + false); + } + + @Test + public void testIncDec5() { + decompileMethod("classic", "testIncDec5", "var a:* = new TestClass1();\r\n" + + "trace(\"++a.attrib with result\");\r\n" + + "trace(++a.attrib);\r\n" + + "trace(\"--a.attrib with result\");\r\n" + + "trace(--a.attrib);\r\n" + + "trace(\"++a.attrib no result\");\r\n" + + "++a.attrib;\r\n" + + "trace(\"--a.attrib no result\");\r\n" + + "--a.attrib;\r\n", + false); + } + + @Test + public void testIncDec6() { + decompileMethod("classic", "testIncDec6", "var a:* = new TestClass1();\r\n" + + "trace(\"a.attrib++ with result\");\r\n" + + "trace(a.attrib++);\r\n" + + "trace(\"a.attrib-- with result\");\r\n" + + "trace(a.attrib--);\r\n" + + "trace(\"a.attrib++ no result\");\r\n" + + "++a.attrib;\r\n" + + "trace(\"a.attrib-- no result\");\r\n" + + "--a.attrib;\r\n", + false); + } + + @Test + public void testIncDec7() { + decompileMethod("classic", "testIncDec7", "var a:* = [1,2,3,4,5];\r\n" + + "var index:int = 0;\r\n" + + "trace(\"a[++index]\");\r\n" + + "trace(a[++index]);\r\n" + + "trace(\"a[--index]\");\r\n" + + "trace(a[--index]);\r\n", + false); + } + + @Test + public void testIncDec8() { + decompileMethod("classic", "testIncDec8", "var a:* = [1,2,3,4,5];\r\n" + + "var index:int = 0;\r\n" + + "trace(\"a[index++]\");\r\n" + + "trace(a[index++]);\r\n" + + "trace(\"a[index--]\");\r\n" + + "trace(a[index--]);\r\n", + false); + } + + @Test + public void testIncDec9() { + decompileMethod("classic", "testIncDec9", "trace(\"++attrib with result\");\r\n" + + "trace(++this.attrib);\r\n" + + "trace(\"--attrib with result\");\r\n" + + "trace(--this.attrib);\r\n" + + "trace(\"++attrib no result\");\r\n" + + "++this.attrib;\r\n" + + "trace(\"--attrib no result\");\r\n" + + "--this.attrib;\r\n", + false); + } + + @Test + public void testIncDec10() { + decompileMethod("classic", "testIncDec10", "trace(\"attrib++ with result\");\r\n" + + "trace(this.attrib++);\r\n" + + "trace(\"attrib-- with result\");\r\n" + + "trace(this.attrib--);\r\n" + + "trace(\"attrib++ no result\");\r\n" + + "++this.attrib;\r\n" + + "trace(\"attrib-- no result\");\r\n" + + "--this.attrib;\r\n", + false); + } + + @Test + public void testIncDec11() { + decompileMethod("classic", "testIncDec11", "var f:Function = function():void\r\n" + + "{\r\n" + + "};\r\n" + + "var slot:int = 0;\r\n" + + "trace(\"++slot with result\");\r\n" + + "trace(++slot);\r\n" + + "trace(\"--slot with result\");\r\n" + + "trace(--slot);\r\n" + + "trace(\"++slot no result\");\r\n" + + "slot++;\r\n" + + "trace(\"--slot no result\");\r\n" + + "slot--;\r\n", + false); + } + + @Test + public void testIncDec12() { + decompileMethod("classic", "testIncDec12", "var f:Function = function():void\r\n" + + "{\r\n" + + "};\r\n" + + "var slot:int = 0;\r\n" + + "trace(\"slot++ with result\");\r\n" + + "trace(slot++);\r\n" + + "trace(\"slot-- with result\");\r\n" + + "trace(slot--);\r\n" + + "trace(\"slot++ no result\");\r\n" + + "slot++;\r\n" + + "trace(\"slot-- no result\");\r\n" + + "slot--;\r\n", + false); + } + + @Test + public void testIncDec13() { + decompileMethod("classic", "testIncDec13", "var a:* = [1,2,3,4,5];\r\n" + + "trace(\"++a[this.f()] with result\");\r\n" + + "trace(++a[this.f()]);\r\n" + + "trace(\"--a[this.f()] with result\");\r\n" + + "trace(--a[this.f()]);\r\n" + + "trace(\"++a[this.f()] no result\");\r\n" + + "++a[this.f()];\r\n" + + "trace(\"--a[this.f()] no result\");\r\n" + + "--a[this.f()];\r\n", + false); + } + + @Test + public void testIncDec14() { + decompileMethod("classic", "testIncDec14", "var a:* = [1,2,3,4,5];\r\n" + + "trace(\"a[this.f()]++ with result\");\r\n" + + "trace(a[this.f()]++);\r\n" + + "trace(\"a[this.f()]-- with result\");\r\n" + + "trace(a[this.f()]--);\r\n" + + "trace(\"a[this.f()]++ no result\");\r\n" + + "++a[this.f()];\r\n" + + "trace(\"a[this.f()]-- no result\");\r\n" + + "--a[this.f()];\r\n", false); } @@ -1497,7 +1624,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes @Test public void testLoopInLoop() { - decompileMethod("classic", "testLoopInLoop", "var i:* = undefined;\r\n" + decompileMethod("classic", "testLoopInLoop", "var i:int = 0;\r\n" + "var a:Boolean = true;\r\n" + "var b:Boolean = true;\r\n" + "for(var c:Boolean = true; true; )\r\n" diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java index 38f99e8a5..8e75f601d 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java @@ -37,12 +37,14 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; +import natorder.NaturalOrderComparator; /** * @@ -52,13 +54,14 @@ import java.util.TreeMap; */ public class AS3Generator { + @SuppressWarnings("unchecked") private static void useFile(String testClassName, String[][] swfAndIdentifierList, boolean multipleProviders) throws FileNotFoundException, IOException, InterruptedException { StringBuilder s = new StringBuilder(); File f = new File(swfAndIdentifierList[0][0]); SWF swf = new SWF(new BufferedInputStream(new FileInputStream(f)), false); DoABC2Tag tag = null; List scriptPacks = swf.getAS3Packs(); - Map sortedPacks = new TreeMap<>(); + Map sortedPacks = new TreeMap<>(new NaturalOrderComparator()); for (ScriptPack pack : scriptPacks) { sortedPacks.put(pack.getClassPath().toRawString(), pack); } diff --git a/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.air.swf b/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.air.swf index ba5ee6ecb..7999b4f5e 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.air.swf and b/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.air.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.flex.swf b/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.flex.swf index 6cf648691..5fc4b1377 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.flex.swf and b/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.flex.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/Main.as b/libsrc/ffdec_lib/testdata/as3_new/src/Main.as index 0e1f75f7a..47d970050 100644 --- a/libsrc/ffdec_lib/testdata/as3_new/src/Main.as +++ b/libsrc/ffdec_lib/testdata/as3_new/src/Main.as @@ -80,8 +80,20 @@ package TestImplicitCoerce; TestImportedConst; TestImportedVar; - TestInc2; - TestIncDec; + TestIncDec1; + TestIncDec2; + TestIncDec3; + TestIncDec4; + TestIncDec5; + TestIncDec6; + TestIncDec7; + TestIncDec8; + TestIncDec9; + TestIncDec10; + TestIncDec11; + TestIncDec12; + TestIncDec13; + TestIncDec14; TestInlineFunctions; TestInlineFunctions2; TestInnerFunctions; diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestInc2.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestInc2.as deleted file mode 100644 index 7764a1fba..000000000 --- a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestInc2.as +++ /dev/null @@ -1,26 +0,0 @@ -package tests -{ - - public class TestInc2 - { - public function run():* - { - var a:* = [1]; - var d:* = a[this.getInt()]++; - var e:* = ++a[this.getInt()]; - - a[this.getInt()]++; - ++a[this.getInt()]; - - var b:* = 1; - b++; - var c:* = 1; - b = c++; - } - - private function getInt():int - { - return 5; - } - } -} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec.as deleted file mode 100644 index 9e9d6e1d8..000000000 --- a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec.as +++ /dev/null @@ -1,65 +0,0 @@ -package tests -{ - - public class TestIncDec - { - - private var attrx:int = 0; - - public function run():* - { - var a:* = 5; - var b:* = 0; - trace("++var"); - b = ++a; - trace("var++"); - b = a++; - trace("--var"); - b = --a; - trace("var--"); - b = a--; - var c:* = [1, 2, 3, 4, 5]; - trace("++arr"); - b = ++c[2]; - trace("arr++"); - b = c[2]++; - trace("--arr"); - b = --c[2]; - trace("arr--"); - b = c[2]--; - var d:* = new TestClass1(); - trace("++property"); - trace(++d.attrib); - trace("property++"); - trace(d.attrib++); - trace("--property"); - trace(--d.attrib); - trace("property--"); - trace(d.attrib--); - trace("arr[e++]"); - var chars:Array = new Array(36); - var index:uint = 0; - chars[index++] = 5; - trace("arr[++e]"); - chars[++index] = 5; - trace("attr++"); - trace(attrx++); - attrx++; - trace("attr--"); - trace(attrx--); - attrx--; - trace("++attr"); - trace(++attrx); - ++attrx; - trace("--attr"); - trace(--attrx); - --attrx; - - } - } -} - -class TestClass1 -{ - public var attrib:int = 5; -} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec1.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec1.as new file mode 100644 index 000000000..2f8c47b63 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec1.as @@ -0,0 +1,24 @@ +package tests +{ + + public class TestIncDec1 + { + + public function run():* + { + var a:* = 5; + + trace("++a with result"); + trace(++a); + + trace("--a with result"); + trace(--a); + + trace("++a no result"); + ++a; + + trace("--a no result"); + --a; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec10.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec10.as new file mode 100644 index 000000000..914a72a0e --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec10.as @@ -0,0 +1,23 @@ +package tests +{ + + public class TestIncDec10 + { + private var attrib:int = 0; + + public function run():* + { + trace("attrib++ with result"); + trace(attrib++); + + trace("attrib-- with result"); + trace(attrib--); + + trace("attrib++ no result"); + attrib++; + + trace("attrib-- no result"); + attrib--; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec11.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec11.as new file mode 100644 index 000000000..fe758c0d2 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec11.as @@ -0,0 +1,24 @@ +package tests +{ + + public class TestIncDec11 + { + public function run():* + { + var f:Function = function():void {}; + var slot:int = 0; + + trace("++slot with result"); + trace(++slot); + + trace("--slot with result"); + trace(--slot); + + trace("++slot no result"); + ++slot; + + trace("--slot no result"); + --slot; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec12.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec12.as new file mode 100644 index 000000000..366675eab --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec12.as @@ -0,0 +1,24 @@ +package tests +{ + + public class TestIncDec12 + { + public function run():* + { + var f:Function = function():void {}; + var slot:int = 0; + + trace("slot++ with result"); + trace(slot++); + + trace("slot-- with result"); + trace(slot--); + + trace("slot++ no result"); + slot++; + + trace("slot-- no result"); + slot--; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec13.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec13.as new file mode 100644 index 000000000..ba79e5558 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec13.as @@ -0,0 +1,28 @@ +package tests +{ + + public class TestIncDec13 + { + public function run():* + { + var a:* = [1,2,3,4,5]; + + trace("++a[this.f()] with result"); + trace(++a[this.f()]); + + trace("--a[this.f()] with result"); + trace(--a[this.f()]); + + trace("++a[this.f()] no result"); + ++a[this.f()]; + + trace("--a[this.f()] no result"); + --a[this.f()]; + } + + private function f():int + { + return 0; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec14.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec14.as new file mode 100644 index 000000000..c19372183 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec14.as @@ -0,0 +1,28 @@ +package tests +{ + + public class TestIncDec14 + { + public function run():* + { + var a:* = [1,2,3,4,5]; + + trace("a[this.f()]++ with result"); + trace(a[this.f()]++); + + trace("a[this.f()]-- with result"); + trace(a[this.f()]--); + + trace("a[this.f()]++ no result"); + a[this.f()]++; + + trace("a[this.f()]-- no result"); + a[this.f()]--; + } + + private function f():int + { + return 0; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec2.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec2.as new file mode 100644 index 000000000..ca6964a39 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec2.as @@ -0,0 +1,24 @@ +package tests +{ + + public class TestIncDec2 + { + + public function run():* + { + var a:* = 5; + + trace("a++ with result"); + trace(a++); + + trace("a-- with result"); + trace(a--); + + trace("a++ no result"); + a++; + + trace("a-- no result"); + a--; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec3.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec3.as new file mode 100644 index 000000000..e41a263f8 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec3.as @@ -0,0 +1,24 @@ +package tests +{ + + public class TestIncDec3 + { + + public function run():* + { + var a:* = [1, 2, 3, 4, 5]; + + trace("++a[2] with result"); + trace(++a[2]); + + trace("--a[2] with result"); + trace(--a[2]); + + trace("++a[2] no result"); + ++a[2]; + + trace("--a[2] no result"); + --a[2]; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec4.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec4.as new file mode 100644 index 000000000..ba77424f7 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec4.as @@ -0,0 +1,24 @@ +package tests +{ + + public class TestIncDec4 + { + + public function run():* + { + var a:* = [1, 2, 3, 4, 5]; + + trace("a[2]++ with result"); + trace(a[2]++); + + trace("a[2]-- with result"); + trace(a[2]--); + + trace("a[2]++ no result"); + a[2]++; + + trace("a[2]-- no result"); + a[2]--; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec5.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec5.as new file mode 100644 index 000000000..10de8cba7 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec5.as @@ -0,0 +1,29 @@ +package tests +{ + + public class TestIncDec5 + { + + public function run():* + { + var a:* = new TestClass1(); + + trace("++a.attrib with result"); + trace(++a.attrib); + + trace("--a.attrib with result"); + trace(--a.attrib); + + trace("++a.attrib no result"); + ++a.attrib; + + trace("--a.attrib no result"); + --a.attrib; + } + } +} + +class TestClass1 +{ + public var attrib:int = 5; +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec6.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec6.as new file mode 100644 index 000000000..e2be8ffb8 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec6.as @@ -0,0 +1,29 @@ +package tests +{ + + public class TestIncDec6 + { + + public function run():* + { + var a:* = new TestClass1(); + + trace("a.attrib++ with result"); + trace(a.attrib++); + + trace("a.attrib-- with result"); + trace(a.attrib--); + + trace("a.attrib++ no result"); + a.attrib++; + + trace("a.attrib-- no result"); + a.attrib--; + } + } +} + +class TestClass1 +{ + public var attrib:int = 5; +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec7.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec7.as new file mode 100644 index 000000000..8057fa234 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec7.as @@ -0,0 +1,19 @@ +package tests +{ + + public class TestIncDec7 + { + + public function run():* + { + var a:* = [1,2,3,4,5]; + var index:int = 0; + + trace("a[++index]"); + trace(a[++index]); + + trace("a[--index]"); + trace(a[--index]); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec8.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec8.as new file mode 100644 index 000000000..0110bf69e --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec8.as @@ -0,0 +1,20 @@ +package tests +{ + + public class TestIncDec8 + { + + public function run():* + { + var a:* = [1,2,3,4,5]; + var index:int = 0; + + trace("a[index++]"); + trace(a[index++]); + + trace("a[index--]"); + trace(a[index--]); + + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec9.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec9.as new file mode 100644 index 000000000..260b3b4f5 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIncDec9.as @@ -0,0 +1,23 @@ +package tests +{ + + public class TestIncDec9 + { + private var attrib:int = 0; + + public function run():* + { + trace("++attrib with result"); + trace(++attrib); + + trace("--attrib with result"); + trace(--attrib); + + trace("++attrib no result"); + ++attrib; + + trace("--attrib no result"); + --attrib; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestLoopInLoop.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestLoopInLoop.as index 77f3a0916..3a1d5b80a 100644 --- a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestLoopInLoop.as +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestLoopInLoop.as @@ -14,7 +14,7 @@ package tests { trace("A"); - for (var i = 0; i < 10; i++) + for (var i:int = 0; i < 10; i++) { if (a) {