| 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-gen-named-func-expr.template |
| 4 |
/*--- |
| 5 |
description: Referencing a parameter from within its own initializer (async generator named function expression) |
| 6 |
esid: sec-asyncgenerator-definitions-evaluation |
| 7 |
features: [default-parameters, async-iteration] |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier |
| 11 |
( FormalParameters ) { AsyncGeneratorBody } |
| 12 |
|
| 13 |
[...] |
| 14 |
7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, |
| 15 |
AsyncGeneratorBody, funcEnv, strict). |
| 16 |
[...] |
| 17 |
|
| 18 |
|
| 19 |
14.1.19 Runtime Semantics: IteratorBindingInitialization |
| 20 |
|
| 21 |
FormalsList : FormalsList , FormalParameter |
| 22 |
|
| 23 |
1. Let status be the result of performing IteratorBindingInitialization for |
| 24 |
FormalsList using iteratorRecord and environment as the arguments. |
| 25 |
2. ReturnIfAbrupt(status). |
| 26 |
3. Return the result of performing IteratorBindingInitialization for |
| 27 |
FormalParameter using iteratorRecord and environment as the arguments. |
| 28 |
|
| 29 |
---*/ |
| 30 |
var x = 0; |
| 31 |
|
| 32 |
|
| 33 |
var callCount = 0; |
| 34 |
var f; |
| 35 |
f = async function* g(x = x) { |
| 36 |
|
| 37 |
callCount = callCount + 1; |
| 38 |
}; |
| 39 |
|
| 40 |
assert.throws(ReferenceError, function() { |
| 41 |
f(); |
| 42 |
}); |
| 43 |
assert.sameValue(callCount, 0, 'generator function body not evaluated'); |