| 1 |
// |reftest| async |
| 2 |
// This file was procedurally generated from the following sources: |
| 3 |
// - src/function-forms/eval-var-scope-syntax-err.case |
| 4 |
// - src/function-forms/error-no-strict/async-arrow-function.template |
| 5 |
/*--- |
| 6 |
description: sloppy direct eval in params introduces var (async arrow function expression in sloppy code) |
| 7 |
esid: sec-async-arrow-function-definitions |
| 8 |
features: [default-parameters, async-functions] |
| 9 |
flags: [generated, async, noStrict] |
| 10 |
info: | |
| 11 |
14.7 Async Arrow Function Definitions |
| 12 |
|
| 13 |
AsyncArrowFunction : |
| 14 |
... |
| 15 |
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody |
| 16 |
|
| 17 |
AsyncConciseBody : |
| 18 |
{ AsyncFunctionBody } |
| 19 |
|
| 20 |
... |
| 21 |
|
| 22 |
Supplemental Syntax |
| 23 |
|
| 24 |
When processing an instance of the production AsyncArrowFunction : |
| 25 |
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of |
| 26 |
CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: |
| 27 |
|
| 28 |
AsyncArrowHead : |
| 29 |
async ArrowFormalParameters |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
Runtime Semantics: IteratorBindingInitialization |
| 34 |
FormalParameter : BindingElement |
| 35 |
|
| 36 |
1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. |
| 37 |
|
| 38 |
---*/ |
| 39 |
|
| 40 |
|
| 41 |
var callCount = 0; |
| 42 |
var f; |
| 43 |
f = async (a = eval("var a = 42")) => { |
| 44 |
|
| 45 |
callCount = callCount + 1; |
| 46 |
}; |
| 47 |
|
| 48 |
f() |
| 49 |
.then(_ => { |
| 50 |
throw new Test262Error('function should not be resolved'); |
| 51 |
}, error => assert.sameValue(error.constructor, SyntaxError)) |
| 52 |
.then(() => { |
| 53 |
assert.sameValue(callCount, 0, 'function body is not evaluated'); |
| 54 |
}, $DONE) |
| 55 |
.then($DONE, $DONE); |