AS1/2 Try..catch with error types support - decompilation and direct editation

This commit is contained in:
Jindra Petřík
2018-01-28 16:08:20 +01:00
parent f524523762
commit da3cf1454c
8 changed files with 275 additions and 35 deletions

View File

@@ -1873,4 +1873,66 @@ public class ActionScript2Test extends ActionScript2TestBase {
+ "trace(\"switchVariantsTest\");\r\n"
);
}
@Test
public void frame68_tryTypeTest() {
compareSrc(68, "trace(\"tryTypeTest\");\r\n"
+ "var a = 5;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "a = a / 0;\r\n"
+ "}\r\n"
+ "catch(e)\r\n"
+ "{\r\n"
+ "trace(\"err:\" + e);\r\n"
+ "}\r\n"
+ "try\r\n"
+ "{\r\n"
+ "a = a / 0;\r\n"
+ "}\r\n"
+ "catch(e)\r\n"
+ "{\r\n"
+ "if(a == 0)\r\n"
+ "{\r\n"
+ "throw e;\r\n"
+ "}\r\n"
+ "else\r\n"
+ "{\r\n"
+ "trace(\"err:\" + e);\r\n"
+ "}\r\n"
+ "}\r\n"
+ "try\r\n"
+ "{\r\n"
+ "a = a / 0;\r\n"
+ "}\r\n"
+ "catch(e:MyError)\r\n"
+ "{\r\n"
+ "trace(\"err:\" + e);\r\n"
+ "}\r\n"
+ "try\r\n"
+ "{\r\n"
+ "a = a / 0;\r\n"
+ "}\r\n"
+ "catch(e1:MyError)\r\n"
+ "{\r\n"
+ "trace(\"err:\" + e1);\r\n"
+ "}\r\n"
+ "catch(e2)\r\n"
+ "{\r\n"
+ "trace(\"err:\" + e2);\r\n"
+ "}\r\n"
+ "try\r\n"
+ "{\r\n"
+ "a = a / 0;\r\n"
+ "}\r\n"
+ "catch(e:MyError)\r\n"
+ "{\r\n"
+ "trace(\"err:\" + e);\r\n"
+ "}\r\n"
+ "catch(e2:Error)\r\n"
+ "{\r\n"
+ "trace(\"err:\" + e2);\r\n"
+ "}\r\n"
);
}
}