Fixed: #2473, #2530 Always-break loops containing breaks (forward gotos)

This commit is contained in:
Jindra Petřík
2026-01-25 12:49:05 +01:00
parent 8397d32772
commit 281b35f3bf
22 changed files with 686 additions and 332 deletions

View File

@@ -17,6 +17,7 @@ package
public class Main extends Sprite
{
TestActivationArguments;
TestAlwaysBreak;
TestAndOrCoercion;
TestArguments;
TestBitwiseOperands;
@@ -45,6 +46,7 @@ package
TestDoWhile2;
TestDoWhile3;
TestDoWhile4;
TestDoWhileTwice;
TestExecutionOrder;
TestExpressions;
TestFinallyZeroJump;

View File

@@ -0,0 +1,31 @@
package tests
{
public class TestAlwaysBreak
{
public function run():*
{
while(true)
{
var v = 5;
trace("a");
if(v > 4)
{
trace("b");
if(v > 10)
{
trace("c");
break; //standard "break", should lead to "f"
}
else
{
trace("d");
}
}
trace("e");
break; //"always break loop"
}
trace("f");
}
}
}

View File

@@ -0,0 +1,30 @@
package tests
{
public class TestDoWhileTwice
{
public function run():*
{
var a = 1;
var b = 2;
do {
do {
if (a) {
trace("x");
if (b) {
break;
}
trace("y");
}
trace("z");
}while(true);
trace("g");
if (b) {
break;
}
trace("h");
}while(true);
trace("finish");
}
}
}