Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-generator/dflt-params-ref-prior.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/dflt-params-ref-prior.case
3 // - src/function-forms/default/async-gen-func-expr.template
4 /*---
5 description: Referencing a parameter that occurs earlier in the ParameterList (async generator 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 * ( FormalParameters ) {
11 AsyncGeneratorBody }
12
13 [...]
14 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
15 AsyncGeneratorBody, scope, strict).
16 [...]
17
18
19 14.1.19 Runtime Semantics: IteratorBindingInitialization
20
21 FormalsList : FormalsList , FormalParameter
22
23 1. Let status be the result of performing IteratorBindingInitialization for
24 FormalsList using iteratorRecord and environment as the arguments.
25 2. ReturnIfAbrupt(status).
26 3. Return the result of performing IteratorBindingInitialization for
27 FormalParameter using iteratorRecord and environment as the arguments.
28
29 ---*/
30 var x = 0;
31
32
33 var callCount = 0;
34 // Stores a reference `ref` for case evaluation
35 var ref;
36 ref = async function*(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);