Debian Codegraph @

js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-elision-step-err.case
3 // - src/dstr-binding/error/try.template
4 /*---
5 description: Elision advances iterator and forwards abrupt completions (try statement)
6 esid: sec-runtime-semantics-catchclauseevaluation
7 features: [generators, destructuring-binding]
8 flags: [generated]
9 info: |
10 Catch : catch ( CatchParameter ) Block
11
12 [...]
13 5. Let status be the result of performing BindingInitialization for
14 CatchParameter passing thrownValue and catchEnv as arguments.
15 [...]
16
17 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
18
19 ArrayBindingPattern : [ Elision ]
20
21 1. Return the result of performing
22 IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
23 as the argument.
24
25 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
26
27 Elision : ,
28
29 1. If iteratorRecord.[[done]] is false, then
30 a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
31 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
32 c. ReturnIfAbrupt(next).
33
34 ---*/
35 var following = 0;
36 var iter =function* () {
37 throw new Test262Error();
38 following += 1;
39 }();
40
41 assert.throws(Test262Error, function() {
42 try {
43 throw iter;
44 } catch ([,]) {}
45 });
46
47 iter.next();
48 assert.sameValue(following, 0, 'Iterator was properly closed.');
49
50 reportCompare(0, 0);