blob: 352f6017df43c5effd39ad987df290f2a5ba136b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
var whoCaught = "nobody"
function* wrapNoThrow() {
let iter = {
[Symbol.iterator]() {
return this;
},
next() {
return { value: 10, done: false };
},
return() { throw "nonsense"; }
};
for (const i of iter)
yield i;
}
function foo() {
try {
l2:
for (j of wrapNoThrow()) {
try {
for (i of [1,2,3]) {
try {
break l2;
} catch(e) {
whoCaught = "inner"
}
}
} catch (e) {
whoCaught = "inner2"
}
}
} catch (e) {
whoCaught = "correct"
}
}
try {
foo();
} catch (e) { whoCaught = "outer" }
assertEq(whoCaught, "correct");
|