mirror of https://github.com/tc39/test262.git
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
// This file was procedurally generated from the following sources:
|
|
// - src/dstr-binding/ary-ptrn-rest-id-direct.case
|
|
// - src/dstr-binding/default/async-gen-func-expr-dflt.template
|
|
/*---
|
|
description: Lone rest element (direct binding) (async generator function expression (default parameter))
|
|
esid: sec-asyncgenerator-definitions-evaluation
|
|
features: [async-iteration]
|
|
flags: [generated, async]
|
|
includes: [compareArray.js]
|
|
info: |
|
|
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
|
|
AsyncGeneratorBody }
|
|
|
|
[...]
|
|
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
|
|
AsyncGeneratorBody, scope, strict).
|
|
[...]
|
|
|
|
|
|
Runtime Semantics: IteratorBindingInitialization
|
|
|
|
BindingRestElement : ... BindingIdentifier
|
|
|
|
[...]
|
|
2. Let A be ! ArrayCreate(0).
|
|
3. Let n be 0.
|
|
4. Repeat,
|
|
[...]
|
|
f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
|
|
g. Set n to n + 1.
|
|
|
|
---*/
|
|
|
|
|
|
var callCount = 0;
|
|
var f;
|
|
f = async function*([...x] = [1]) {
|
|
assert(Array.isArray(x));
|
|
assert.compareArray(x, [1]);
|
|
callCount = callCount + 1;
|
|
};
|
|
|
|
f().next().then(() => {
|
|
assert.sameValue(callCount, 1, 'invoked exactly once');
|
|
}).then($DONE, $DONE);
|