Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-arrow-function/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-arrow-function.template
4 /*---
5 description: Referencing a parameter that occurs earlier in the ParameterList (async arrow function expression)
6 esid: sec-async-arrow-function-definitions
7 features: [default-parameters]
8 flags: [generated, async]
9 info: |
10 14.7 Async Arrow Function Definitions
11
12 AsyncArrowFunction :
13 ...
14 CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
15
16 AsyncConciseBody :
17 { AsyncFunctionBody }
18
19 ...
20
21 Supplemental Syntax
22
23 When processing an instance of the production AsyncArrowFunction :
24 CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
25 CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
26
27 AsyncArrowHead :
28 async ArrowFormalParameters
29
30
31 14.1.19 Runtime Semantics: IteratorBindingInitialization
32
33 FormalsList : FormalsList , FormalParameter
34
35 1. Let status be the result of performing IteratorBindingInitialization for
36 FormalsList using iteratorRecord and environment as the arguments.
37 2. ReturnIfAbrupt(status).
38 3. Return the result of performing IteratorBindingInitialization for
39 FormalParameter using iteratorRecord and environment as the arguments.
40
41 ---*/
42 var x = 0;
43
44
45 var callCount = 0;
46
47 // Stores a reference `ref` for case evaluation
48 var ref = async (x, y = x, z = y) => {
49 assert.sameValue(x, 3, 'first argument value');
50 assert.sameValue(y, 3, 'second argument value');
51 assert.sameValue(z, 3, 'third argument value');
52 callCount = callCount + 1;
53 };
54
55 ref(3).then(() => {
56 assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
57 }).then($DONE, $DONE);