Fixed #1894 Switches vs loops decompilation (now with two passes)

This commit is contained in:
Jindra Petřík
2022-11-30 19:05:36 +01:00
parent ad97886306
commit a41926a662
23 changed files with 365 additions and 48 deletions

View File

@@ -110,6 +110,7 @@ package
TestVector2;
TestWhileAnd;
TestWhileBreak;
TestWhileBreak2;
TestWhileContinue;
TestWhileTry;
TestWhileTry2;

View File

@@ -20,7 +20,7 @@ package tests
}
trace("gg");
} while (k < 10);
trace("ss");
}
trace("ss");
}
}
}

View File

@@ -11,8 +11,8 @@ package tests
{
obj = {};
var item = {};
//for each (var item in obj)
//{
for each (var item in obj)
{
switch (item["key"])
{
case 1:
@@ -21,9 +21,9 @@ package tests
case 4:
return item;
};
//};
};
};
return null;
return null;
}
}
}

View File

@@ -0,0 +1,58 @@
package tests
{
public class TestWhileBreak2
{
public function run():*
{
var k:int = 8;
while(true)
{
trace("X");
if (k == 1) {
trace("A");
return;
}
trace("Y");
if (k < 10)
{
trace("k1");
if (k == 2)
{
trace("B");
if (k > 1)
{
trace("B1");
break;
}
trace("B2");
}
trace("Z");
if (k == 3)
{
trace("C");
break;
}
trace("Z2");
if (k == 4)
{
trace("D");
break;
}
trace("k2");
}
trace("E");
if (k == 2) {
trace("E1");
return;
}
trace("gg");
}
trace("ss");
}
}
}