mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 16:50:46 +00:00
Fixed: Try..catch.finally vs loops
This commit is contained in:
@@ -12,6 +12,8 @@ package
|
||||
{
|
||||
TestTryCatch;
|
||||
TestTryCatchIfInTry;
|
||||
TestTryCatchInWhile;
|
||||
TestTryCatchInWhile2;
|
||||
TestTryCatchLoop;
|
||||
TestTryCatchExceptionUsage
|
||||
TestTryFinally;
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user