ary-ptrn-rest-id-iter-val-err.js (1433B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case 3 // - src/dstr-binding/error/try.template 4 /*--- 5 description: Error forwarding when IteratorValue returns an abrupt completion (try statement) 6 esid: sec-runtime-semantics-catchclauseevaluation 7 features: [Symbol.iterator, 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 BindingRestElement : ... BindingIdentifier 19 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, 20 environment). 21 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, 22 [...] 23 c. Let nextValue be IteratorValue(next). 24 d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to 25 true. 26 e. ReturnIfAbrupt(nextValue). 27 28 ---*/ 29 var poisonedValue = Object.defineProperty({}, 'value', { 30 get: function() { 31 throw new Test262Error(); 32 } 33 }); 34 var iter = {}; 35 iter[Symbol.iterator] = function() { 36 return { 37 next: function() { 38 return poisonedValue; 39 } 40 }; 41 }; 42 43 assert.throws(Test262Error, function() { 44 try { 45 throw iter; 46 } catch ([...x]) {} 47 }); 48 49 reportCompare(0, 0);