mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-19 13:08:07 +00:00
Fixed #2231 AS3 coercion to String as convert
This commit is contained in:
@@ -88,11 +88,12 @@ public class CoerceAVM2Item extends AVM2Item {
|
||||
}
|
||||
break;
|
||||
case "String":
|
||||
displayCoerce = !valueReturnType.equals(TypeItem.STRING)
|
||||
/*displayCoerce = !valueReturnType.equals(TypeItem.STRING)
|
||||
&& !valueReturnType.equals(new TypeItem("XML"))
|
||||
&& !valueReturnType.equals(new TypeItem("XMLList"))
|
||||
&& !valueReturnType.equals(new TypeItem("null"))
|
||||
&& !valueReturnType.equals(TypeItem.UNBOUNDED);
|
||||
&& !valueReturnType.equals(TypeItem.UNBOUNDED);*/
|
||||
displayCoerce = false;
|
||||
break;
|
||||
default:
|
||||
displayCoerce = false;
|
||||
|
||||
@@ -1770,6 +1770,13 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringCoerce() {
|
||||
decompileMethod("classic_air", "testStringCoerce", "var text1:String = this.a[\"test\"];\r\n"
|
||||
+ "var text2:String = String(this.a[\"test\"]);\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringConcat() {
|
||||
decompileMethod("classic_air", "testStringConcat", "var k:int = 8;\r\n"
|
||||
|
||||
@@ -1757,6 +1757,13 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringCoerce() {
|
||||
decompileMethod("classic", "testStringCoerce", "var text1:String = this.a[\"test\"];\r\n"
|
||||
+ "var text2:String = String(this.a[\"test\"]);\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringConcat() {
|
||||
decompileMethod("classic", "testStringConcat", "var k:int = 8;\r\n"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -107,6 +107,7 @@ package
|
||||
TestSlots;
|
||||
TestSlots2;
|
||||
TestStrictEquals;
|
||||
TestStringCoerce;
|
||||
TestStringConcat;
|
||||
TestStrings;
|
||||
TestSwitch;
|
||||
|
||||
14
libsrc/ffdec_lib/testdata/as3_new/src/tests/TestStringCoerce.as
vendored
Normal file
14
libsrc/ffdec_lib/testdata/as3_new/src/tests/TestStringCoerce.as
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestStringCoerce
|
||||
{
|
||||
var a:Object = null;
|
||||
|
||||
public function run():*
|
||||
{
|
||||
var text1:String = this.a["test"];
|
||||
var text2:String = String(this.a["test"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user