named-dflt-ary-ptrn-elem-id-iter-val-err.js (1743B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case 3 // - src/dstr-binding/error/async-gen-func-named-expr-dflt.template 4 /*--- 5 description: Error forwarding when IteratorValue returns an abrupt completion (async generator named function expression (default parameter)) 6 esid: sec-asyncgenerator-definitions-evaluation 7 features: [Symbol.iterator, async-iteration] 8 flags: [generated] 9 info: | 10 AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier 11 ( FormalParameters ) { AsyncGeneratorBody } 12 13 [...] 14 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, 15 AsyncGeneratorBody, funcEnv, strict). 16 [...] 17 18 13.3.3.6 Runtime Semantics: IteratorBindingInitialization 19 20 SingleNameBinding : BindingIdentifier Initializeropt 21 22 [...] 23 4. If iteratorRecord.[[done]] is false, then 24 a. Let next be IteratorStep(iteratorRecord.[[iterator]]). 25 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. 26 c. ReturnIfAbrupt(next). 27 d. If next is false, set iteratorRecord.[[done]] to true. 28 e. Else, 29 i. Let v be IteratorValue(next). 30 ii. If v is an abrupt completion, set iteratorRecord.[[done]] to 31 true. 32 iii. ReturnIfAbrupt(v). 33 34 ---*/ 35 var poisonedValue = Object.defineProperty({}, 'value', { 36 get: function() { 37 throw new Test262Error(); 38 } 39 }); 40 var g = {}; 41 g[Symbol.iterator] = function() { 42 return { 43 next: function() { 44 return poisonedValue; 45 } 46 }; 47 }; 48 49 50 var f; 51 f = async function* h([x] = g) { 52 53 }; 54 55 assert.throws(Test262Error, function() { 56 f(); 57 }); 58 59 reportCompare(0, 0);