| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case |
| 3 |
// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template |
| 4 |
/*--- |
| 5 |
description: RestElement applied to an exhausted iterator (async generator named function expression (default parameter)) |
| 6 |
esid: sec-asyncgenerator-definitions-evaluation |
| 7 |
features: [Symbol.iterator, async-iteration] |
| 8 |
flags: [generated, async] |
| 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 |
13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 20 |
BindingRestElement : ... BindingIdentifier |
| 21 |
1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, |
| 22 |
environment). |
| 23 |
2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, |
| 24 |
[...] |
| 25 |
b. If iteratorRecord.[[done]] is true, then |
| 26 |
i. If environment is undefined, return PutValue(lhs, A). |
| 27 |
ii. Return InitializeReferencedBinding(lhs, A). |
| 28 |
|
| 29 |
---*/ |
| 30 |
|
| 31 |
|
| 32 |
var callCount = 0; |
| 33 |
var f; |
| 34 |
f = async function* h([, , ...x] = [1, 2]) { |
| 35 |
assert(Array.isArray(x)); |
| 36 |
assert.sameValue(x.length, 0); |
| 37 |
callCount = callCount + 1; |
| 38 |
}; |
| 39 |
|
| 40 |
f().next().then(() => { |
| 41 |
assert.sameValue(callCount, 1, 'invoked exactly once'); |
| 42 |
}).then($DONE, $DONE); |