| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/function-forms/dflt-params-arg-val-undefined.case |
| 3 |
// - src/function-forms/default/async-gen-func-expr.template |
| 4 |
/*--- |
| 5 |
description: Use of initializer when argument value is `undefined` (async generator function expression) |
| 6 |
esid: sec-asyncgenerator-definitions-evaluation |
| 7 |
features: [default-parameters, async-iteration] |
| 8 |
flags: [generated, async] |
| 9 |
info: | |
| 10 |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { |
| 11 |
AsyncGeneratorBody } |
| 12 |
|
| 13 |
[...] |
| 14 |
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, |
| 15 |
AsyncGeneratorBody, scope, strict). |
| 16 |
[...] |
| 17 |
|
| 18 |
|
| 19 |
14.1.19 Runtime Semantics: IteratorBindingInitialization |
| 20 |
|
| 21 |
FormalsList : FormalsList , FormalParameter |
| 22 |
|
| 23 |
[...] |
| 24 |
23. Let iteratorRecord be Record {[[Iterator]]: |
| 25 |
CreateListIterator(argumentsList), [[Done]]: false}. |
| 26 |
24. If hasDuplicates is true, then |
| 27 |
[...] |
| 28 |
25. Else, |
| 29 |
a. Perform ? IteratorBindingInitialization for formals with |
| 30 |
iteratorRecord and env as arguments. |
| 31 |
[...] |
| 32 |
|
| 33 |
---*/ |
| 34 |
|
| 35 |
|
| 36 |
var callCount = 0; |
| 37 |
// Stores a reference `ref` for case evaluation |
| 38 |
var ref; |
| 39 |
ref = async function*(fromLiteral = 23, fromExpr = 45, fromHole = 99) { |
| 40 |
assert.sameValue(fromLiteral, 23); |
| 41 |
assert.sameValue(fromExpr, 45); |
| 42 |
assert.sameValue(fromHole, 99); |
| 43 |
callCount = callCount + 1; |
| 44 |
}; |
| 45 |
|
| 46 |
ref(undefined, void 0).next().then(() => { |
| 47 |
assert.sameValue(callCount, 1, 'generator function invoked exactly once'); |
| 48 |
}).then($DONE, $DONE); |