Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/dflt-params-arg-val-undefined.case
3 // - src/function-forms/default/async-arrow-function.template
4 /*---
5 description: Use of initializer when argument value is `undefined` (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 [...]
36 23. Let iteratorRecord be Record {[[Iterator]]:
37 CreateListIterator(argumentsList), [[Done]]: false}.
38 24. If hasDuplicates is true, then
39 [...]
40 25. Else,
41 a. Perform ? IteratorBindingInitialization for formals with
42 iteratorRecord and env as arguments.
43 [...]
44
45 ---*/
46
47
48 var callCount = 0;
49
50 // Stores a reference `ref` for case evaluation
51 var ref = async (fromLiteral = 23, fromExpr = 45, fromHole = 99) => {
52 assert.sameValue(fromLiteral, 23);
53 assert.sameValue(fromExpr, 45);
54 assert.sameValue(fromHole, 99);
55 callCount = callCount + 1;
56 };
57
58 ref(undefined, void 0).then(() => {
59 assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
60 }).then($DONE, $DONE);