Debian Codegraph @

js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/function-forms/dflt-params-ref-later.case
4 // - src/function-forms/error/async-func-expr-named.template
5 /*---
6 description: Referencing a parameter that occurs later 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 var f = async function f(x = y, y) {
33
34 callCount = callCount + 1;
35 }
36
37 f()
38 .then(_ => {
39 throw new Test262Error('function should not be resolved');
40 }, error => assert.sameValue(error.constructor, ReferenceError))
41 .then(() => {
42 assert.sameValue(callCount, 0, 'function body is not evaluated');
43 }, $DONE)
44 .then($DONE, $DONE);