| 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-arrow-function.template |
| 4 |
/*--- |
| 5 |
description: Referencing a parameter from within its own initializer (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 |
1. Let status be the result of performing IteratorBindingInitialization for |
| 36 |
FormalsList using iteratorRecord and environment as the arguments. |
| 37 |
2. ReturnIfAbrupt(status). |
| 38 |
3. Return the result of performing IteratorBindingInitialization for |
| 39 |
FormalParameter using iteratorRecord and environment as the arguments. |
| 40 |
|
| 41 |
---*/ |
| 42 |
var x = 0; |
| 43 |
|
| 44 |
|
| 45 |
var callCount = 0; |
| 46 |
var f; |
| 47 |
f = async (x = x) => { |
| 48 |
|
| 49 |
callCount = callCount + 1; |
| 50 |
}; |
| 51 |
|
| 52 |
f() |
| 53 |
.then(_ => { |
| 54 |
throw new Test262Error('function should not be resolved'); |
| 55 |
}, error => assert.sameValue(error.constructor, ReferenceError)) |
| 56 |
.then(() => { |
| 57 |
assert.sameValue(callCount, 0, 'function body is not evaluated'); |
| 58 |
}, $DONE) |
| 59 |
.then($DONE, $DONE); |