mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-09 14:31:55 +00:00
Show convert instruction when needed - int(xx), String(xx), etc....
This commit is contained in:
@@ -45,7 +45,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
@Test
|
||||
public void testCallLocal() {
|
||||
decompileMethod("classic_air", "testCallLocal", "var f:Function = getF();\r\n"
|
||||
+ "var b:int = f(1,3);\r\n",
|
||||
+ "var b:int = int(f(1,3));\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
+ "var extraLine:Boolean = false;\r\n"
|
||||
+ "var r:int = 7;\r\n"
|
||||
+ "var t:int = 0;\r\n"
|
||||
+ "t = this.getInt();\r\n"
|
||||
+ "t = int(this.getInt());\r\n"
|
||||
+ "if(t + 1 < g.length)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "t++;\r\n"
|
||||
@@ -214,6 +214,16 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvert() {
|
||||
decompileMethod("classic_air", "testConvert", "var s:String = \"a\";\r\n"
|
||||
+ "var i:int = int(s);\r\n"
|
||||
+ "var j:int = int(n);\r\n"
|
||||
+ "s = String(j);\r\n"
|
||||
+ "s = ns;\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecl2() {
|
||||
decompileMethod("classic_air", "testDecl2", "var k:int = 0;\r\n"
|
||||
@@ -237,7 +247,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
+ "var vint:int = 0;\r\n"
|
||||
+ "var vuint:uint = 0;\r\n"
|
||||
+ "var vclass:TestClass1 = null;\r\n"
|
||||
+ "var vnumber:* = NaN;\r\n"
|
||||
+ "var vnumber:Number = NaN;\r\n"
|
||||
+ "var vobject:Object = null;\r\n"
|
||||
+ "vall = 6;\r\n"
|
||||
+ "vstr = \"hello\";\r\n"
|
||||
@@ -270,7 +280,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
|
||||
@Test
|
||||
public void testDeobfuscation() {
|
||||
decompileMethod("classic_air", "testDeobfuscation", "var r:int = Math.random();\r\n"
|
||||
decompileMethod("classic_air", "testDeobfuscation", "var r:int = int(Math.random());\r\n"
|
||||
+ "if(r > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"A\");\r\n"
|
||||
@@ -428,7 +438,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
+ "var a:int = 4;\r\n"
|
||||
+ "var b:int = 7;\r\n"
|
||||
+ "var c:int = 9;\r\n"
|
||||
+ "for(i = uint(0); i < len; x = a > 4 && b < 2 || c > 10)\r\n"
|
||||
+ "for(i = 0; i < len; x = a > 4 && b < 2 || c > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "c = 1;\r\n"
|
||||
+ "if(c == 2)\r\n"
|
||||
@@ -559,7 +569,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
decompileMethod("classic_air", "testForGoto", "var i:* = 0;\r\n"
|
||||
+ "var c:int = 0;\r\n"
|
||||
+ "var len:int = 5;\r\n"
|
||||
+ "for(i = uint(0); i < len; i++)\r\n"
|
||||
+ "for(i = 0; i < len; i++)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "c = 1;\r\n"
|
||||
+ "if(c == 2)\r\n"
|
||||
@@ -842,7 +852,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
decompileMethod("classic_air", "testGotos7", "var i:int = 0;\r\n"
|
||||
+ "for(i = 0; i < 10; i++)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "switch(int(i))\r\n"
|
||||
+ "switch(i)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "case 0:\r\n"
|
||||
+ "trace(\"zero\");\r\n"
|
||||
@@ -899,7 +909,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
|
||||
@Test
|
||||
public void testIfFinally() {
|
||||
decompileMethod("classic_air", "testIfFinally", "var a:int = Math.random();\r\n"
|
||||
decompileMethod("classic_air", "testIfFinally", "var a:int = int(Math.random());\r\n"
|
||||
+ "if(a == 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
@@ -969,7 +979,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
|
||||
@Test
|
||||
public void testIgnoreAndOr() {
|
||||
decompileMethod("classic_air", "testIgnoreAndOr", "var k:int = Math.random();\r\n"
|
||||
decompileMethod("classic_air", "testIgnoreAndOr", "var k:int = int(Math.random());\r\n"
|
||||
+ "if(k > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"A\");\r\n"
|
||||
@@ -1184,7 +1194,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
@Test
|
||||
public void testMissingDefault() {
|
||||
decompileMethod("classic_air", "testMissingDefault", "var jj:int = 1;\r\n"
|
||||
+ "switch(int(jj) - 1)\r\n"
|
||||
+ "switch(jj - 1)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "case 0:\r\n"
|
||||
+ "jj = 1;\r\n"
|
||||
@@ -1462,7 +1472,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
|
||||
@Test
|
||||
public void testTryIf() {
|
||||
decompileMethod("classic_air", "testTryIf", "var a:int = Math.random();\r\n"
|
||||
decompileMethod("classic_air", "testTryIf", "var a:int = int(Math.random());\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "if(a > 5 && a < 50)\r\n"
|
||||
@@ -1572,7 +1582,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
@Test
|
||||
public void testUsagesTry() {
|
||||
decompileMethod("classic_air", "testUsagesTry", "var k:int = 5;\r\n"
|
||||
+ "switch(int(k))\r\n"
|
||||
+ "switch(k)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "case 0:\r\n"
|
||||
+ "trace(\"1\");\r\n"
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
@Test
|
||||
public void testCallLocal() {
|
||||
decompileMethod("classic", "testCallLocal", "var f:Function = this.getF();\r\n"
|
||||
+ "var b:int = f(1,3);\r\n",
|
||||
+ "var b:int = int(f(1,3));\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
+ "var extraLine:Boolean = false;\r\n"
|
||||
+ "var r:int = 7;\r\n"
|
||||
+ "var t:int = 0;\r\n"
|
||||
+ "t = this.getInt();\r\n"
|
||||
+ "t = int(this.getInt());\r\n"
|
||||
+ "if(t + 1 < g.length)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "t++;\r\n"
|
||||
@@ -213,6 +213,16 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvert() {
|
||||
decompileMethod("classic", "testConvert", "var s:String = \"a\";\r\n"
|
||||
+ "var i:int = int(s);\r\n"
|
||||
+ "var j:int = int(this.n);\r\n"
|
||||
+ "s = String(j);\r\n"
|
||||
+ "s = this.ns;\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecl2() {
|
||||
decompileMethod("classic", "testDecl2", "var k:int = 0;\r\n"
|
||||
@@ -269,7 +279,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
|
||||
@Test
|
||||
public void testDeobfuscation() {
|
||||
decompileMethod("classic", "testDeobfuscation", "var r:int = Math.random();\r\n"
|
||||
decompileMethod("classic", "testDeobfuscation", "var r:int = int(Math.random());\r\n"
|
||||
+ "if(r > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"A\");\r\n"
|
||||
@@ -964,7 +974,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
|
||||
@Test
|
||||
public void testIgnoreAndOr() {
|
||||
decompileMethod("classic", "testIgnoreAndOr", "var k:int = Math.random();\r\n"
|
||||
decompileMethod("classic", "testIgnoreAndOr", "var k:int = int(Math.random());\r\n"
|
||||
+ "if(k > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"A\");\r\n"
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchInIf(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchInIf", "var a:int = Math.random();\r\n"
|
||||
decompileMethod(swfUsed, "testTryCatchInIf", "var a:int = int(Math.random());\r\n"
|
||||
+ "if(a > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
@@ -96,7 +96,7 @@ 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 = int(Math.random());\r\n"
|
||||
+ "if(a > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
@@ -744,7 +744,7 @@ 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 = int(Math.random() * 5);\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"before try2\");\r\n"
|
||||
@@ -776,7 +776,7 @@ 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 = int(Math.random() * 5);\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
@@ -828,7 +828,7 @@ 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 = int(Math.random() * 5);\r\n"
|
||||
+ "trace(\"before try\");\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
|
||||
|
||||
@Test
|
||||
public void testTryCatchInIf() {
|
||||
decompileMethod("swftools", "testTryCatchInIf", "var _loc1_:int = Math.random();\r\n"
|
||||
decompileMethod("swftools", "testTryCatchInIf", "var _loc1_:int = int(Math.random());\r\n"
|
||||
+ "if(_loc1_ > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
@@ -87,7 +87,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
|
||||
|
||||
@Test
|
||||
public void testTryCatchInIf2() {
|
||||
decompileMethod("swftools", "testTryCatchInIf2", "var _loc1_:int = Math.random();\r\n"
|
||||
decompileMethod("swftools", "testTryCatchInIf2", "var _loc1_:* = int(Math.random());\r\n"
|
||||
+ "if(_loc1_ > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
@@ -762,7 +762,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
|
||||
|
||||
@Test
|
||||
public void testTryFinallyReturnNested() {
|
||||
decompileMethod("swftools", "testTryFinallyReturnNested", "var _loc1_:int = Math.random() * 5;\r\n"
|
||||
decompileMethod("swftools", "testTryFinallyReturnNested", "var _loc1_:* = int(Math.random() * 5);\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"before try2\");\r\n"
|
||||
@@ -803,7 +803,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
|
||||
|
||||
@Test
|
||||
public void testTryFinallyReturnNested2() {
|
||||
decompileMethod("swftools", "testTryFinallyReturnNested2", "var _loc1_:int = Math.random() * 5;\r\n"
|
||||
decompileMethod("swftools", "testTryFinallyReturnNested2", "var _loc1_:* = int(Math.random() * 5);\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
@@ -870,7 +870,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
|
||||
|
||||
@Test
|
||||
public void testTryFinallyReturnVoid() {
|
||||
decompileMethod("swftools", "testTryFinallyReturnVoid", "var _loc1_:int = Math.random() * 5;\r\n"
|
||||
decompileMethod("swftools", "testTryFinallyReturnVoid", "var _loc1_:* = int(Math.random() * 5);\r\n"
|
||||
+ "trace(\"before try\");\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
|
||||
Reference in New Issue
Block a user