Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-generator/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-expression.template
4 /*---
5 description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator expression - valid for non-strict only cases)
6 esid: prod-AsyncGeneratorExpression
7 features: [async-iteration]
8 flags: [generated, noStrict, async]
9 info: |
10 Async Generator Function Definitions
11
12 AsyncGeneratorExpression :
13 async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
14 AsyncGeneratorBody }
15
16 ---*/
17
18
19 var callCount = 0;
20
21 var gen = async function *() {
22 callCount += 1;
23 return (function(arg) {
24 var yield = arg + 1;
25 return yield;
26 }(yield))
27 };
28
29 var iter = gen();
30
31 var item = iter.next();
32
33 item.then(({ done, value }) => {
34 assert.sameValue(done, false);
35 assert.sameValue(value, undefined);
36 });
37
38 item = iter.next(42);
39
40 item.then(({ done, value }) => {
41 assert.sameValue(done, true);
42 assert.sameValue(value, 43);
43 }).then($DONE, $DONE);
44
45 assert.sameValue(callCount, 1);