Fix chained assignments, also reorganized TestIncDec tests

This commit is contained in:
Jindra Petřík
2025-08-17 13:15:35 +02:00
parent 8bbdd415bd
commit b2442438d4
12 changed files with 583 additions and 798 deletions

View File

@@ -24,7 +24,10 @@ package
TestCallLocal;
TestCatchFinally;
TestChain2;
TestChainedAssignments;
TestChainedAssignments1;
TestChainedAssignments2;
TestChainedAssignments3;
TestChainedAssignments4;
TestCollidingTraitNames;
TestCollidingTry;
TestComplexExpressions;

View File

@@ -0,0 +1,15 @@
package tests
{
public class TestChainedAssignments1
{
public function run():*
{
trace("c = b = a = 5;");
var a:int = 0;
var b:int = 0;
var c:int = 0;
c = b = a = 5;
}
}
}

View File

@@ -0,0 +1,19 @@
package tests
{
public class TestChainedAssignments2
{
public function run():*
{
trace("e.attrib1 = e.attrib2 = e.attrib3 = 10;");
var e:TestClass = new TestClass();
e.attrib1 = e.attrib2 = e.attrib3 = 10;
}
}
}
class TestClass {
public var attrib1:int;
public var attrib2:int;
public var attrib3:int;
}

View File

@@ -0,0 +1,18 @@
package tests
{
public class TestChainedAssignments3
{
private var prop:int;
public function run():*
{
var a:int = 0;
var b:int = 0;
prop = a = b = 4;
if (a == 2) {
trace("OK: " + a);
}
}
}
}

View File

@@ -0,0 +1,18 @@
package tests
{
public class TestChainedAssignments4
{
private var prop:int;
public function run():*
{
trace("slotc = slotb = slota = 5;");
var slota:int = 0;
var slotb:int = 0;
var slotc:int = 0;
var f:Function = function(n1:int, n2:int):int {return n1 + n2;}; //trigger slot generating
slotc = slotb = slota = 5;
}
}
}