Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/method-definition/async-gen-yield-identifier-spread-non-strict.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/async-generators/yield-identifier-spread-non-strict.case
3 // - src/async-generators/non-strict/async-obj-method.template
4 /*---
5 description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator method - valid for non-strict only cases)
6 esid: prod-AsyncGeneratorMethod
7 features: [object-spread, Symbol, async-iteration]
8 flags: [generated, noStrict, async]
9 info: |
10 Async Generator Function Definitions
11
12 AsyncGeneratorMethod :
13 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
14
15
16 Spread Properties
17
18 PropertyDefinition[Yield]:
19 (...)
20 ...AssignmentExpression[In, ?Yield]
21
22 ---*/
23 var s = Symbol('s');
24
25
26 var callCount = 0;
27
28 var gen = {
29 async *method() {
30 callCount += 1;
31 yield {
32 ...yield yield,
33 ...(function(arg) {
34 var yield = arg;
35 return {...yield};
36 }(yield)),
37 ...yield,
38 }
39 }
40 }.method;
41
42 var iter = gen();
43
44 var iter = gen();
45
46 iter.next();
47 iter.next();
48 iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
49 iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
50 var item = iter.next({ z: 30, b: 2 });
51
52 item.then(({ done, value }) => {
53 assert.sameValue(done, false);
54 assert.sameValue(value.x, 10);
55 assert.sameValue(value.y, 20);
56 assert.sameValue(value.z, 30);
57 assert.sameValue(value.a, 1);
58 assert.sameValue(value.b, 2);
59 assert.sameValue(value[s], 42);
60 assert.sameValue(Object.keys(value).length, 5);
61 assert(Object.hasOwnProperty.call(value, s));
62 }).then($DONE, $DONE);
63
64 assert.sameValue(callCount, 1);