Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/async-gen-method-static-yield-spread-obj.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/async-generators/yield-spread-obj.case
3 // - src/async-generators/default/async-class-expr-static-method.template
4 /*---
5 description: Use yield value in a object spread position (Static async generator method as a ClassExpression element)
6 esid: prod-AsyncGeneratorMethod
7 features: [object-spread, 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 Spread Properties
24
25 PropertyDefinition[Yield]:
26 (...)
27 ...AssignmentExpression[In, ?Yield]
28
29 ---*/
30
31
32 var callCount = 0;
33
34 var C = class { static async *gen() {
35 callCount += 1;
36 yield {
37 ...yield,
38 y: 1,
39 ...yield yield,
40 };
41 }}
42
43 var gen = C.gen;
44
45 var iter = gen();
46
47 iter.next();
48 iter.next({ x: 42 });
49 iter.next({ x: 'lol' });
50 var item = iter.next({ y: 39 });
51
52 item.then(({ done, value }) => {
53 assert.sameValue(value.x, 42);
54 assert.sameValue(value.y, 39);
55 assert.sameValue(Object.keys(value).length, 2);
56 assert.sameValue(done, false);
57 }).then($DONE, $DONE);
58
59 assert.sameValue(callCount, 1);