test262/test/language/statements/async-generator/dstr-dflt-obj-ptrn-rest-nes...

34 lines
1.2 KiB
JavaScript

// This file was procedurally generated from the following sources:
// - src/dstr-binding/obj-ptrn-rest-nested-obj.case
// - src/dstr-binding/default/async-gen-func-decl-dflt.template
/*---
description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (async generator function declaration (default parameter))
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
features: [object-rest, async-iteration]
flags: [generated, async]
info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
scope, strict).
[...]
---*/
var obj = {a: 3, b: 4};
var callCount = 0;
async function* f({a, b, ...{c, e}} = {a: 1, b: 2, c: 3, d: 4, e: 5}) {
assert.sameValue(a, 1);
assert.sameValue(b, 2);
assert.sameValue(c, 3);
assert.sameValue(e, 5);
callCount = callCount + 1;
};
f().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);