File tree 2 files changed +88
-0
lines changed
2 files changed +88
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,26 @@ class Client
159
159
return ;
160
160
}
161
161
162
+ switch LocalFunctionExceptions .testLocalCallingStatic () {
163
+ case Error (message ):
164
+ Common .status = ' Failed test for throw in static called by local: ' + message ;
165
+ return ;
166
+ default :
167
+ }
168
+
169
+ switch LocalFunctionExceptions .testCatchWithinLocal () {
170
+ case Error (message ):
171
+ Common .status = ' Failed test for catch in local function: ' + message ;
172
+ return ;
173
+ default :
174
+ }
175
+
176
+ switch LocalFunctionExceptions .testCatchFromLocal () {
177
+ case Error (message ):
178
+ Common .status = ' Failed test for catching exception from local function: ' + message ;
179
+ return ;
180
+ default :
181
+ }
162
182
163
183
final extending = new ClientExtendedExtendedRoot ();
164
184
Original file line number Diff line number Diff line change
1
+ enum Status {
2
+ Ok ;
3
+ Error (message : String );
4
+ }
5
+
6
+ class LocalFunctionExceptions {
7
+ static function staticFunction () {
8
+ throw ' Thrown from static' ;
9
+ }
10
+
11
+ public static function testLocalCallingStatic (): Status {
12
+ function localFunction () {
13
+ staticFunction ();
14
+ throw ' Thrown from local' ;
15
+ }
16
+
17
+ try {
18
+ localFunction ();
19
+ } catch (e : String ) {
20
+ if (e == ' Thrown from static' ) {
21
+ return Ok ;
22
+ } else {
23
+ return Error (" Incorrect exception caught from local function call" );
24
+ }
25
+ }
26
+
27
+ return Error (" No exception caught" );
28
+ }
29
+
30
+ public static function testCatchWithinLocal (): Status {
31
+ function localFunction () {
32
+ try {
33
+ staticFunction ();
34
+ } catch (e : String ) {
35
+ if (e == ' Thrown from static' ) {
36
+ return Ok ;
37
+ } else {
38
+ return Error (" Incorrect exception caught from local function call" );
39
+ }
40
+ }
41
+ return Error (" Exception from static function not caught" );
42
+ }
43
+
44
+ return try {
45
+ localFunction ();
46
+ } catch (e ) {
47
+ Error (' Exception leaked from local function: $e ' );
48
+ };
49
+ }
50
+
51
+ public static function testCatchFromLocal (): Status {
52
+ function localFunction () {
53
+ throw ' Thrown from local' ;
54
+ }
55
+
56
+ try {
57
+ localFunction ();
58
+ } catch (e : String ) {
59
+ if (e == ' Thrown from local' ) {
60
+ return Ok ;
61
+ } else {
62
+ return Error (" Incorrect exception caught from local function call" );
63
+ }
64
+ }
65
+
66
+ return Error (" No exception caught" );
67
+ }
68
+ }
You can’t perform that action at this time.
0 commit comments