mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-08-02 16:01:15 +00:00
Fixed: #2391 Double not operator in ternar operator expression
This commit is contained in:
@@ -77,7 +77,7 @@ public class TernarOpItem extends GraphTargetItem {
|
||||
if (expression.getPrecedence() >= precedence) {
|
||||
writer.append("(");
|
||||
}
|
||||
expression.toString(writer, localData);
|
||||
expression.toStringBoolean(writer, localData);
|
||||
if (expression.getPrecedence() >= precedence) {
|
||||
writer.append(")");
|
||||
}
|
||||
|
||||
@@ -1997,6 +1997,15 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTernarOperator2() {
|
||||
decompileMethod("classic_air", "testTernarOperator2", "var b:Boolean = true;\r\n"
|
||||
+ "var i:int = 1;\r\n"
|
||||
+ "var j:int = int(b ? i : i + 1);\r\n"
|
||||
+ "var k:int = int(i ? j : j + 1);\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTry() {
|
||||
decompileMethod("classic_air", "testTry", "var i:int = 0;\r\n"
|
||||
|
||||
@@ -1983,6 +1983,15 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTernarOperator2() {
|
||||
decompileMethod("classic", "testTernarOperator2", "var b:Boolean = true;\r\n"
|
||||
+ "var i:int = 1;\r\n"
|
||||
+ "var j:int = b ? i : i + 1;\r\n"
|
||||
+ "var k:int = Boolean(i) ? j : j + 1;\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTry() {
|
||||
decompileMethod("classic", "testTry", "var i:int = 0;\r\n"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -122,6 +122,7 @@ package
|
||||
TestSwitchDefault;
|
||||
TestSwitchIf;
|
||||
TestTernarOperator;
|
||||
TestTernarOperator2;
|
||||
TestTry;
|
||||
TestTryIf;
|
||||
TestTryReturn;
|
||||
|
||||
@@ -24,7 +24,7 @@ package tests
|
||||
|
||||
this.ti = ti && (ti = new TestClass());
|
||||
|
||||
var a = ti && (ti = new TestClass());
|
||||
var a:* = ti && (ti = new TestClass());
|
||||
|
||||
var b:int = 1 + (i || j); //no coercion
|
||||
|
||||
@@ -33,7 +33,7 @@ package tests
|
||||
return ti && (ti = new TestClass());
|
||||
}
|
||||
|
||||
public function test(p:TestInterface)
|
||||
public function test(p:TestInterface): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
14
libsrc/ffdec_lib/testdata/as3_new/src/tests/TestTernarOperator2.as
vendored
Normal file
14
libsrc/ffdec_lib/testdata/as3_new/src/tests/TestTernarOperator2.as
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestTernarOperator2
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
var b:Boolean = true;
|
||||
var i:int = 1;
|
||||
var j:int = b ? i : i + 1;
|
||||
var k:int = i ? j : j + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user