| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/generators/yield-spread-arr-multiple.case |
| 3 |
// - src/generators/default/class-expr-static-method.template |
| 4 |
/*--- |
| 5 |
description: Use yield value in a array spread position (Static generator method as a ClassExpression element) |
| 6 |
esid: prod-GeneratorMethod |
| 7 |
features: [generators] |
| 8 |
flags: [generated] |
| 9 |
includes: [compareArray.js] |
| 10 |
info: | |
| 11 |
ClassElement : |
| 12 |
static MethodDefinition |
| 13 |
|
| 14 |
MethodDefinition : |
| 15 |
GeneratorMethod |
| 16 |
|
| 17 |
14.4 Generator Function Definitions |
| 18 |
|
| 19 |
GeneratorMethod : |
| 20 |
* PropertyName ( UniqueFormalParameters ) { GeneratorBody } |
| 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 |
var callCount = 0; |
| 33 |
|
| 34 |
var C = class { static *gen() { |
| 35 |
callCount += 1; |
| 36 |
yield [...yield yield]; |
| 37 |
}} |
| 38 |
|
| 39 |
var gen = C.gen; |
| 40 |
|
| 41 |
var iter = gen(); |
| 42 |
|
| 43 |
iter.next(false); |
| 44 |
item = iter.next(['a', 'b', 'c']); |
| 45 |
item = iter.next(item.value); |
| 46 |
|
| 47 |
assert(compareArray(item.value, arr)); |
| 48 |
assert.sameValue(item.done, false); |
| 49 |
|
| 50 |
assert.sameValue(callCount, 1); |