| 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-meth.template |
| 4 |
/*--- |
| 5 |
description: Referencing a parameter that occurs earlier in the ParameterList (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 |
1. Let status be the result of performing IteratorBindingInitialization for |
| 21 |
FormalsList using iteratorRecord and environment as the arguments. |
| 22 |
2. ReturnIfAbrupt(status). |
| 23 |
3. Return the result of performing IteratorBindingInitialization for |
| 24 |
FormalParameter using iteratorRecord and environment as the arguments. |
| 25 |
|
| 26 |
---*/ |
| 27 |
var x = 0; |
| 28 |
|
| 29 |
|
| 30 |
var callCount = 0; |
| 31 |
var __obj = { |
| 32 |
async method(x, y = x, z = y) { |
| 33 |
assert.sameValue(x, 3, 'first argument value'); |
| 34 |
assert.sameValue(y, 3, 'second argument value'); |
| 35 |
assert.sameValue(z, 3, 'third argument value'); |
| 36 |
callCount = callCount + 1; |
| 37 |
} |
| 38 |
}; |
| 39 |
|
| 40 |
// Stores a reference `ref` for case evaluation |
| 41 |
var ref = __obj.method; |
| 42 |
|
| 43 |
ref(3).then(() => { |
| 44 |
assert.sameValue(callCount, 1, 'async method invoked exactly once'); |
| 45 |
}).then($DONE, $DONE); |