mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-26 09:25:34 +00:00
try to improve try..catch vs loops
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'05.02.2021'</value>
|
||||
<value>'06.02.2021'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'05.02.2021'</value>
|
||||
<value>'06.02.2021'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
|
||||
@@ -12,9 +12,12 @@ package
|
||||
{
|
||||
TestTryCatch;
|
||||
TestTryCatchIfInTry;
|
||||
TestTryCatchInIf;
|
||||
TestTryCatchInWhile;
|
||||
TestTryCatchInWhile2;
|
||||
TestTryCatchInWhile3;
|
||||
TestTryCatchLoop;
|
||||
TestTryCatchLoopBreak;
|
||||
TestTryCatchExceptionUsage
|
||||
TestTryFinally;
|
||||
TestTryFinallyDirectReturnInFinally;
|
||||
|
||||
29
libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInIf.as
vendored
Normal file
29
libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInIf.as
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryCatchInIf
|
||||
{
|
||||
|
||||
public function run() : int
|
||||
{
|
||||
var a:int = Math.random();
|
||||
if (a > 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
33
libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInWhile3.as
vendored
Normal file
33
libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInWhile3.as
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
package tests
|
||||
{
|
||||
import flash.errors.EOFError;
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryCatchInWhile3
|
||||
{
|
||||
|
||||
public function run() : String
|
||||
{
|
||||
var a:int;
|
||||
a = 0;
|
||||
trace("before loop");
|
||||
while (a > 5)
|
||||
{
|
||||
try
|
||||
{
|
||||
return "intry return";
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
a++;
|
||||
}
|
||||
return "OK";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
74
libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchLoopBreak.as
vendored
Normal file
74
libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchLoopBreak.as
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
package tests
|
||||
{
|
||||
import flash.errors.EOFError;
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryCatchLoopBreak
|
||||
{
|
||||
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
var a:int;
|
||||
a = 0;
|
||||
trace("before loop");//1-15
|
||||
try
|
||||
{
|
||||
trace("try1a");//16-22
|
||||
while (a < 10){ //34-37 loop0
|
||||
trace("a=" + a); //23-33
|
||||
a++;
|
||||
}
|
||||
trace("try1b"); //38-44
|
||||
//45-45
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
trace("in catch"); //46-61
|
||||
}
|
||||
|
||||
trace("middle");//62-68
|
||||
|
||||
|
||||
while (a < 20) { //104-107 loop1
|
||||
//69-69
|
||||
try
|
||||
{
|
||||
trace("try2"); //70-77
|
||||
return;
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
trace("in catch2"); //80-103
|
||||
}
|
||||
trace("a=" + a); //pokračuje 80-103
|
||||
}
|
||||
trace("middle2"); //108-114
|
||||
|
||||
while (true) { //161-161 loop2
|
||||
//115-115
|
||||
try
|
||||
{
|
||||
trace("try3"); //116-122
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
trace("in catch3"); //124-141
|
||||
break;
|
||||
}
|
||||
catch(e:EOFError)
|
||||
{
|
||||
trace("in catch4"); //141-159
|
||||
break;
|
||||
}
|
||||
//123-123
|
||||
}
|
||||
trace("exit"); //162-167
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user