| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/function-forms/dflt-params-ref-self.case |
| 3 |
// - src/function-forms/error/async-meth.template |
| 4 |
/*--- |
| 5 |
description: Referencing a parameter from within its own initializer (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 |
|
| 32 |
var obj = { |
| 33 |
async method(x = x) { |
| 34 |
|
| 35 |
callCount = callCount + 1; |
| 36 |
} |
| 37 |
}; |
| 38 |
|
| 39 |
obj.method() |
| 40 |
.then(_ => { |
| 41 |
throw new Test262Error('function should not be resolved'); |
| 42 |
}, error => assert.sameValue(error.constructor, ReferenceError)) |
| 43 |
.then(() => { |
| 44 |
assert.sameValue(callCount, 0, 'function body is not evaluated'); |
| 45 |
}, $DONE) |
| 46 |
.then($DONE, $DONE); |