Debian Codegraph @

js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-undefined.js

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