Debian Codegraph @

js/src/tests/test262/language/statements/for-of/continue-label-from-catch.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 13.6.4.13 S5.n
5 description: >
6 Control flow during body evaluation should honor `continue` statements
7 within the `catch` block of `try` statements.
8 features: [generators]
9 ---*/
10
11 function* values() {
12 yield 1;
13 yield 1;
14 }
15 var iterator = values();
16 var loop = true;
17 var i = 0;
18
19 outer:
20 while (loop) {
21 loop = false;
22
23 for (var x of iterator) {
24 try {
25 throw new Error();
26 } catch (err) {
27 i++;
28 continue outer;
29 throw new Test262Error('This code is unreachable (following `continue` statement).');
30 }
31
32 throw new Test262Error('This code is unreachable (following `try` statement).');
33 }
34
35 throw new Test262Error('This code is unreachable (following `for..of` statement).');
36 }
37
38 assert.sameValue(i, 1);
39
40 reportCompare(0, 0);