Debian Codegraph @

js/src/tests/test262/language/statements/async-generator/dflt-params-ref-prior.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/function-forms/dflt-params-ref-prior.case
4 // - src/function-forms/default/async-gen-func-decl.template
5 /*---
6 description: Referencing a parameter that occurs earlier in the ParameterList (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 1. Let status be the result of performing IteratorBindingInitialization for
25 FormalsList using iteratorRecord and environment as the arguments.
26 2. ReturnIfAbrupt(status).
27 3. Return the result of performing IteratorBindingInitialization for
28 FormalParameter using iteratorRecord and environment as the arguments.
29
30 ---*/
31 var x = 0;
32
33
34 var callCount = 0;
35 // Stores a reference `ref` for case evaluation
36 async function* ref(x, y = x, z = y) {
37 assert.sameValue(x, 3, 'first argument value');
38 assert.sameValue(y, 3, 'second argument value');
39 assert.sameValue(z, 3, 'third argument value');
40 callCount = callCount + 1;
41 }
42
43 ref(3).next().then(() => {
44 assert.sameValue(callCount, 1, 'generator function invoked exactly once');
45 }).then($DONE, $DONE);