OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 try { | 243 try { |
244 x++; | 244 x++; |
245 if (false) return -1; | 245 if (false) return -1; |
246 break L; | 246 break L; |
247 } catch (o) { | 247 } catch (o) { |
248 x--; | 248 x--; |
249 } | 249 } |
250 } catch (o) { | 250 } catch (o) { |
251 x--; | 251 x--; |
252 } | 252 } |
253 } | 253 } |
254 return x; | 254 return x; |
255 } | 255 } |
256 | 256 |
257 assertEquals(0, break_from_nested_catch(0)); | 257 assertEquals(0, break_from_nested_catch(0)); |
258 assertEquals(1, break_from_nested_catch(1)); | 258 assertEquals(1, break_from_nested_catch(1)); |
259 | 259 |
260 | 260 |
261 function break_from_nested_finally(x) { | 261 function break_from_nested_finally(x) { |
262 L: | 262 L: |
263 { | 263 { |
264 try { | 264 try { |
265 x++; | 265 x++; |
266 try { | 266 try { |
267 x++; | 267 x++; |
268 if (false) return -1; | 268 if (false) return -1; |
269 break L; | 269 break L; |
270 } finally { | 270 } finally { |
271 x--; | 271 x--; |
272 } | 272 } |
273 } finally { | 273 } finally { |
274 x--; | 274 x--; |
275 } | 275 } |
276 x--; // should not happen | 276 x--; // should not happen |
277 } | 277 } |
278 return x; | 278 return x; |
279 } | 279 } |
280 | 280 |
281 assertEquals(0, break_from_nested_finally(0)); | 281 assertEquals(0, break_from_nested_finally(0)); |
282 assertEquals(1, break_from_nested_finally(1)); | 282 assertEquals(1, break_from_nested_finally(1)); |
283 | 283 |
284 | 284 |
285 function continue_from_nested_catch(x) { | 285 function continue_from_nested_catch(x) { |
286 x -= 2; | 286 x -= 2; |
287 var cont = true; | 287 var cont = true; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 return 2; | 385 return 2; |
386 } finally { | 386 } finally { |
387 continue; | 387 continue; |
388 } | 388 } |
389 } | 389 } |
390 } while (false); | 390 } while (false); |
391 return 42; | 391 return 42; |
392 } | 392 } |
393 | 393 |
394 assertEquals(42, continue_from_nested_finally_in_finally()); | 394 assertEquals(42, continue_from_nested_finally_in_finally()); |
OLD | NEW |