Debian Codegraph @

js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js

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