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