Debian Codegraph @

js/src/tests/test262/language/expressions/async-function/named-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-func-expr-named.template
5 /*---
6 description: Referencing a parameter that occurs earlier in the ParameterList (async function named expression)
7 esid: sec-async-function-definitions
8 features: [default-parameters, async-functions]
9 flags: [generated, async]
10 info: |
11 14.6 Async Function Definitions
12
13 AsyncFunctionExpression :
14 async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
15
16
17 14.1.19 Runtime Semantics: IteratorBindingInitialization
18
19 FormalsList : FormalsList , FormalParameter
20
21 1. Let status be the result of performing IteratorBindingInitialization for
22 FormalsList using iteratorRecord and environment as the arguments.
23 2. ReturnIfAbrupt(status).
24 3. Return the result of performing IteratorBindingInitialization for
25 FormalParameter using iteratorRecord and environment as the arguments.
26
27 ---*/
28 var x = 0;
29
30
31 var callCount = 0;
32
33 // Stores a reference `ref` for case evaluation
34 var ref;
35 ref = async function ref(x, y = x, z = y) {
36 assert.sameValue(x, 3, 'first argument value');
37 assert.sameValue(y, 3, 'second argument value');
38 assert.sameValue(z, 3, 'third argument value');
39 callCount = callCount + 1;
40 };
41
42 ref(3).then(() => {
43 assert.sameValue(callCount, 1, 'function invoked exactly once');
44 }).then($DONE, $DONE);