Debian Codegraph @

js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/function-forms/dflt-params-arg-val-undefined.case
4 // - src/function-forms/default/async-meth.template
5 /*---
6 description: Use of initializer when argument value is `undefined` (async method)
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 AsyncMethod :
14 async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
15
16
17 14.1.19 Runtime Semantics: IteratorBindingInitialization
18
19 FormalsList : FormalsList , FormalParameter
20
21 [...]
22 23. Let iteratorRecord be Record {[[Iterator]]:
23 CreateListIterator(argumentsList), [[Done]]: false}.
24 24. If hasDuplicates is true, then
25 [...]
26 25. Else,
27 a. Perform ? IteratorBindingInitialization for formals with
28 iteratorRecord and env as arguments.
29 [...]
30
31 ---*/
32
33
34 var callCount = 0;
35 var __obj = {
36 async method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
37 assert.sameValue(fromLiteral, 23);
38 assert.sameValue(fromExpr, 45);
39 assert.sameValue(fromHole, 99);
40 callCount = callCount + 1;
41 }
42 };
43
44 // Stores a reference `ref` for case evaluation
45 var ref = __obj.method;
46
47 ref(undefined, void 0).then(() => {
48 assert.sameValue(callCount, 1, 'async method invoked exactly once');
49 }).then($DONE, $DONE);