Fixed: Try..catch.finally vs loops

This commit is contained in:
Jindra Petřík
2021-02-02 09:42:38 +01:00
parent 28650d40fb
commit e649d08a08
20 changed files with 866 additions and 171 deletions

View File

@@ -16,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
<value>'31.01.2021'</value>
<value>'02.02.2021'</value>
</define>
<define append="true">
<name>CONFIG::air</name>

View File

@@ -16,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
<value>'31.01.2021'</value>
<value>'02.02.2021'</value>
</define>
<define append="true">
<name>CONFIG::air</name>

View File

@@ -12,6 +12,8 @@ package
{
TestTryCatch;
TestTryCatchIfInTry;
TestTryCatchInWhile;
TestTryCatchInWhile2;
TestTryCatchLoop;
TestTryCatchExceptionUsage
TestTryFinally;

View File

@@ -0,0 +1,41 @@
package tests
{
import flash.errors.EOFError;
/**
* ...
* @author JPEXS
*/
public class TestTryCatchInWhile
{
public function run() : void
{
trace("before loop");
while (true)
{
try
{
trace("in try");
while (true)
{
trace("a");
}
//not reachable in ASC2
//trace("after inner while");
}
catch (e:EOFError)
{
continue;
}
catch (e:Error)
{
continue;
}
}
//not reachable in ASC2:
//trace("after loop");
}
}
}

View File

@@ -0,0 +1,48 @@
package tests
{
import flash.errors.EOFError;
/**
* ...
* @author JPEXS
*/
public class TestTryCatchInWhile2
{
public function run() : void
{
var a:int;
a = 0;
trace("before loop");
while (a > 5)
{
try
{
trace("in try");
if (a == 6){
continue;
}
if (a == 7){
break;
}
trace("after inner while");
}
catch (e:EOFError)
{
continue;
}
catch (e:Error)
{
if (a == 8){
break;
}
continue;
}
a++;
}
//not reachable in ASC2:
//trace("after loop");
}
}
}