Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/async-generators/yield-identifier-non-strict.case
3 // - src/async-generators/non-strict/async-obj-method.template
4 /*---
5 description: Use of 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: [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
17
18 var callCount = 0;
19
20 var gen = {
21 async *method() {
22 callCount += 1;
23 return (function(arg) {
24 var yield = arg + 1;
25 return yield;
26 }(yield))
27 }
28 }.method;
29
30 var iter = gen();
31
32 var item = iter.next();
33
34 item.then(({ done, value }) => {
35 assert.sameValue(done, false);
36 assert.sameValue(value, undefined);
37 });
38
39 item = iter.next(42);
40
41 item.then(({ done, value }) => {
42 assert.sameValue(done, true);
43 assert.sameValue(value, 43);
44 }).then($DONE, $DONE);
45
46 assert.sameValue(callCount, 1);