mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-02 11:54:36 +00:00
better try..catch..finally detection
This commit is contained in:
34
libsrc/ffdec_lib/testdata/cross_compile/src/Main.as
vendored
Normal file
34
libsrc/ffdec_lib/testdata/cross_compile/src/Main.as
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
package
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import tests.*;
|
||||
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Main extends MovieClip
|
||||
{
|
||||
TestTryCatch;
|
||||
TestTryCatchIfInTry;
|
||||
TestTryCatchLoop;
|
||||
TestTryCatchExceptionUsage
|
||||
TestTryFinally;
|
||||
TestTryFinallyDirectReturnInFinally;
|
||||
TestTryFinallyLoop;
|
||||
TestTryFinallyLoopInFinally;
|
||||
TestTryFinallyMultipleCatch;
|
||||
TestTryFinallyReturn;
|
||||
TestTryFinallyReturnInFinally;
|
||||
TestTryFinallyReturnNested;
|
||||
TestTryFinallyReturnVoid;
|
||||
|
||||
public function Main()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
26
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryCatch.as
vendored
Normal file
26
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryCatch.as
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryCatch
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
26
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryCatchExceptionUsage.as
vendored
Normal file
26
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryCatchExceptionUsage.as
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryCatchExceptionUsage
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("catched exception: "+e.message);
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
32
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryCatchIfInTry.as
vendored
Normal file
32
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryCatchIfInTry.as
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryCatchIfInTry
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
var a:Boolean = true;
|
||||
trace("before");
|
||||
try
|
||||
{
|
||||
if (a)
|
||||
{
|
||||
trace("ret");
|
||||
return;
|
||||
}
|
||||
trace("in try");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
39
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryCatchLoop.as
vendored
Normal file
39
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryCatchLoop.as
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
package tests
|
||||
{
|
||||
import flash.errors.EOFError;
|
||||
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryCatchLoop
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
var j:* = undefined;
|
||||
for (var i:* = 0; i < 100; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
for (j = 0; j < 20; j++)
|
||||
{
|
||||
trace("a");
|
||||
}
|
||||
}
|
||||
catch (e:EOFError)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
trace("after_try");
|
||||
}
|
||||
trace("end");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
30
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinally.as
vendored
Normal file
30
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinally.as
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinally
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("in finally");
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
34
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyDirectReturnInFinally.as
vendored
Normal file
34
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyDirectReturnInFinally.as
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinallyDirectReturnInFinally
|
||||
{
|
||||
|
||||
public function run() : String
|
||||
{
|
||||
|
||||
var str:String = "xxx";
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("error");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("hi ");
|
||||
if (5 == 4)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
return "hu" + str;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
38
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyLoop.as
vendored
Normal file
38
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyLoop.as
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinallyLoop
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
for (var i:int = 0; i < 10; i++)
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
if (i == 5)
|
||||
{
|
||||
trace("continue for");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("in finally");
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
38
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyLoopInFinally.as
vendored
Normal file
38
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyLoopInFinally.as
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinallyLoopInFinally
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
for (var i:int = 0; i < 10; i++)
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (i == 5)
|
||||
{
|
||||
trace("continue for");
|
||||
continue;
|
||||
}
|
||||
trace("in finally");
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
35
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyMultipleCatch.as
vendored
Normal file
35
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyMultipleCatch.as
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
package tests
|
||||
{
|
||||
import flash.errors.EOFError;
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinallyMultipleCatch
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch Error");
|
||||
}
|
||||
catch (e:EOFError)
|
||||
{
|
||||
trace("in catch EOFError");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("in finally");
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
42
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyReturn.as
vendored
Normal file
42
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyReturn.as
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinallyReturn
|
||||
{
|
||||
|
||||
public function run() : String
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
var a:int = 5;
|
||||
if (a > 4)
|
||||
{
|
||||
return "RET";
|
||||
}
|
||||
trace("between");
|
||||
if (a < 3)
|
||||
{
|
||||
return "RE2";
|
||||
}
|
||||
trace("in try2");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("in finally");
|
||||
}
|
||||
trace("after");
|
||||
return "RETFINAL";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
44
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyReturnInFinally.as
vendored
Normal file
44
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyReturnInFinally.as
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinallyReturnInFinally
|
||||
{
|
||||
|
||||
public function run() : String
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
var a:int = 5;
|
||||
if (a > 4)
|
||||
{
|
||||
return "RET";
|
||||
}
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("in finally");
|
||||
if (a > 6){
|
||||
return "FINRET1";
|
||||
}
|
||||
trace("xx");
|
||||
if (a > 5){
|
||||
return "FINRET2";
|
||||
}
|
||||
trace("nofinret");
|
||||
}
|
||||
trace("after");
|
||||
return "RETEXIT";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
43
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyReturnNested.as
vendored
Normal file
43
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyReturnNested.as
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinallyReturnNested
|
||||
{
|
||||
|
||||
public function run() : String
|
||||
{
|
||||
try
|
||||
{
|
||||
trace("before try2");
|
||||
try
|
||||
{
|
||||
trace("in try2");
|
||||
var a:int = 5;
|
||||
if (a > 4)
|
||||
{
|
||||
return "RET";
|
||||
}
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("in finally2");
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("in finally1");
|
||||
}
|
||||
return "RETFINAL";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
36
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyReturnVoid.as
vendored
Normal file
36
libsrc/ffdec_lib/testdata/cross_compile/src/tests/TestTryFinallyReturnVoid.as
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
package tests
|
||||
{
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryFinallyReturnVoid
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
trace("in try");
|
||||
var a:int = 5;
|
||||
if (a > 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
trace("in try2");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch");
|
||||
}
|
||||
finally
|
||||
{
|
||||
trace("in finally");
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user