async-gen-meth-dflt-ary-ptrn-elision-step-err.js (1906B)
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/async-gen-method-dflt.template 4 /*--- 5 description: Elision advances iterator and forwards abrupt completions (async generator method (default parameter)) 6 esid: sec-asyncgenerator-definitions-propertydefinitionevaluation 7 features: [generators, async-iteration] 8 flags: [generated] 9 info: | 10 AsyncGeneratorMethod : 11 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) 12 { AsyncGeneratorBody } 13 14 1. Let propKey be the result of evaluating PropertyName. 15 2. ReturnIfAbrupt(propKey). 16 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. 17 Otherwise let strict be false. 18 4. Let scope be the running execution context's LexicalEnvironment. 19 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, 20 AsyncGeneratorBody, scope, strict). 21 [...] 22 23 13.3.3.6 Runtime Semantics: IteratorBindingInitialization 24 25 ArrayBindingPattern : [ Elision ] 26 27 1. Return the result of performing 28 IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord 29 as the argument. 30 31 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation 32 33 Elision : , 34 35 1. If iteratorRecord.[[done]] is false, then 36 a. Let next be IteratorStep(iteratorRecord.[[iterator]]). 37 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. 38 c. ReturnIfAbrupt(next). 39 40 ---*/ 41 var following = 0; 42 var iter =function* () { 43 throw new Test262Error(); 44 following += 1; 45 }(); 46 47 48 var obj = { 49 async *method([,] = iter) { 50 51 } 52 }; 53 54 assert.throws(Test262Error, function() { 55 obj.method(); 56 }); 57 58 iter.next(); 59 assert.sameValue(following, 0, 'Iterator was properly closed.'); 60 61 reportCompare(0, 0);