test262/test/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direc...

44 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-decl-dflt.template
/*---
description: Lone rest element (direct binding) (async generator function declaration (default parameter))
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
features: [async-iteration]
flags: [generated, async]
includes: [compareArray.js]
info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
3. Let F 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;
async function* f([...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);