Debian Codegraph @

js/src/tests/test262/language/statements/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-decl.template
5 /*---
6 description: Use of initializer when argument value is `undefined` (async generator function declaration)
7 esid: sec-asyncgenerator-definitions-instantiatefunctionobject
8 features: [default-parameters, async-iteration]
9 flags: [generated, async]
10 info: |
11 AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
12 ( FormalParameters ) { AsyncGeneratorBody }
13
14 [...]
15 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
16 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 async function* ref(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);