Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-generator/named-dflt-params-arg-val-undefined.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/dflt-params-arg-val-undefined.case
3 // - src/function-forms/default/async-gen-named-func-expr.template
4 /*---
5 description: Use of initializer when argument value is `undefined` (async generator named function expression)
6 esid: sec-asyncgenerator-definitions-evaluation
7 features: [default-parameters, async-iteration]
8 flags: [generated, async]
9 info: |
10 AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
11 ( FormalParameters ) { AsyncGeneratorBody }
12
13 [...]
14 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
15 AsyncGeneratorBody, funcEnv, strict).
16 [...]
17
18
19 14.1.19 Runtime Semantics: IteratorBindingInitialization
20
21 FormalsList : FormalsList , FormalParameter
22
23 [...]
24 23. Let iteratorRecord be Record {[[Iterator]]:
25 CreateListIterator(argumentsList), [[Done]]: false}.
26 24. If hasDuplicates is true, then
27 [...]
28 25. Else,
29 a. Perform ? IteratorBindingInitialization for formals with
30 iteratorRecord and env as arguments.
31 [...]
32
33 ---*/
34
35
36 var callCount = 0;
37 // Stores a reference `ref` for case evaluation
38 var ref;
39 ref = async function* g(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
40 assert.sameValue(fromLiteral, 23);
41 assert.sameValue(fromExpr, 45);
42 assert.sameValue(fromHole, 99);
43 callCount = callCount + 1;
44 };
45
46 ref(undefined, void 0).next().then(() => {
47 assert.sameValue(callCount, 1, 'generator function invoked exactly once');
48 }).then($DONE, $DONE);