| 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-meth.template |
| 4 |
/*--- |
| 5 |
description: Use of initializer when argument value is `undefined` (async method) |
| 6 |
esid: sec-async-function-definitions |
| 7 |
features: [default-parameters] |
| 8 |
flags: [generated, async] |
| 9 |
info: | |
| 10 |
14.6 Async Function Definitions |
| 11 |
|
| 12 |
AsyncMethod : |
| 13 |
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } |
| 14 |
|
| 15 |
|
| 16 |
14.1.19 Runtime Semantics: IteratorBindingInitialization |
| 17 |
|
| 18 |
FormalsList : FormalsList , FormalParameter |
| 19 |
|
| 20 |
[...] |
| 21 |
23. Let iteratorRecord be Record {[[Iterator]]: |
| 22 |
CreateListIterator(argumentsList), [[Done]]: false}. |
| 23 |
24. If hasDuplicates is true, then |
| 24 |
[...] |
| 25 |
25. Else, |
| 26 |
a. Perform ? IteratorBindingInitialization for formals with |
| 27 |
iteratorRecord and env as arguments. |
| 28 |
[...] |
| 29 |
|
| 30 |
---*/ |
| 31 |
|
| 32 |
|
| 33 |
var callCount = 0; |
| 34 |
var __obj = { |
| 35 |
async method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { |
| 36 |
assert.sameValue(fromLiteral, 23); |
| 37 |
assert.sameValue(fromExpr, 45); |
| 38 |
assert.sameValue(fromHole, 99); |
| 39 |
callCount = callCount + 1; |
| 40 |
} |
| 41 |
}; |
| 42 |
|
| 43 |
// Stores a reference `ref` for case evaluation |
| 44 |
var ref = __obj.method; |
| 45 |
|
| 46 |
ref(undefined, void 0).then(() => { |
| 47 |
assert.sameValue(callCount, 1, 'async method invoked exactly once'); |
| 48 |
}).then($DONE, $DONE); |