@@ -106,6 +106,10 @@ class Ctx extends NQPObject {
106
106
let ctx = this ;
107
107
108
108
while ( ctx ) {
109
+ if ( ctx . $$controlHandlerOuter ) {
110
+ ctx = ctx . $$controlHandlerOuter ;
111
+ }
112
+
109
113
if ( ctx . $$CONTROL || ( ctx [ handler ] && ( ! labeled || ctx . $$label === exception . $$payload ) ) ) {
110
114
exception . caught = ctx ;
111
115
ctx . exception = exception ;
@@ -131,9 +135,6 @@ class Ctx extends NQPObject {
131
135
throw ctx . unwind ;
132
136
}
133
137
ctx = ctx . $$caller ;
134
- if ( ctx && ctx . $$controlHandlerOuter ) {
135
- ctx = ctx . $$controlHandlerOuter ;
136
- }
137
138
}
138
139
139
140
throw exception ;
@@ -148,6 +149,10 @@ class Ctx extends NQPObject {
148
149
let ctx = this ;
149
150
150
151
while ( ctx ) {
152
+ if ( ctx . $$catchHandlerOuter ) {
153
+ ctx = ctx . $$catchHandlerOuter ;
154
+ }
155
+
151
156
if ( ctx . $$CATCH ) {
152
157
exception . caught = ctx ;
153
158
ctx . exception = exception ;
@@ -169,9 +174,6 @@ class Ctx extends NQPObject {
169
174
throw ctx . unwind ;
170
175
}
171
176
ctx = ctx . $$caller ;
172
- if ( ctx && ctx . $$catchHandlerOuter ) {
173
- ctx = ctx . $$catchHandlerOuter ;
174
- }
175
177
}
176
178
177
179
throw exception ;
@@ -230,6 +232,10 @@ class Ctx extends NQPObject {
230
232
let ctx = lookFrom ;
231
233
232
234
while ( ctx ) {
235
+ if ( ctx . $$controlHandlerOuter ) {
236
+ ctx = ctx . $$controlHandlerOuter ;
237
+ }
238
+
233
239
//TODO - think about checking the label
234
240
if ( ctx [ handler ] || ctx . $$CONTROL ) {
235
241
exception . caught = ctx ;
@@ -257,9 +263,6 @@ class Ctx extends NQPObject {
257
263
}
258
264
259
265
ctx = ctx . $$outer ;
260
- if ( ctx && ctx . $$controlHandlerOuter ) {
261
- ctx = ctx . $$controlHandlerOuter ;
262
- }
263
266
}
264
267
265
268
this . $$getHLL ( ) . get ( 'lexical_handler_not_found_error' ) . $$call ( this , null , new NQPInt ( category ) , new NQPInt ( 0 ) ) ;
0 commit comments