yield-spread-arr-multiple.js (1186B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/async-generators/yield-spread-arr-multiple.case 4 // - src/async-generators/default/async-declaration.template 5 /*--- 6 description: Use yield value in a array spread position (Async generator Function declaration) 7 esid: prod-AsyncGeneratorDeclaration 8 features: [async-iteration] 9 flags: [generated, async] 10 includes: [compareArray.js] 11 info: | 12 Async Generator Function Definitions 13 14 AsyncGeneratorDeclaration: 15 async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { 16 AsyncGeneratorBody } 17 18 19 Array Initializer 20 21 SpreadElement[Yield, Await]: 22 ...AssignmentExpression[+In, ?Yield, ?Await] 23 24 ---*/ 25 var arr = ['a', 'b', 'c']; 26 var item; 27 28 29 var callCount = 0; 30 31 async function *gen() { 32 callCount += 1; 33 yield [...yield yield]; 34 } 35 36 var iter = gen(); 37 38 iter.next(false); 39 item = iter.next(['a', 'b', 'c']); 40 41 item.then(({ done, value }) => { 42 item = iter.next(value); 43 44 item.then(({ done, value }) => { 45 assert.compareArray(value, arr); 46 assert.sameValue(done, false); 47 }).then($DONE, $DONE); 48 }).catch($DONE); 49 50 assert.sameValue(callCount, 1);