dflt-obj-ptrn-rest-getter.js (1199B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/dstr-binding/obj-ptrn-rest-getter.case 4 // - src/dstr-binding/default/async-gen-func-decl-dflt.template 5 /*--- 6 description: Getter is called when obj is being deconstructed to a rest Object (async generator function declaration (default parameter)) 7 esid: sec-asyncgenerator-definitions-instantiatefunctionobject 8 features: [object-rest, async-iteration] 9 flags: [generated, async] 10 includes: [propertyHelper.js] 11 info: | 12 AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier 13 ( FormalParameters ) { AsyncGeneratorBody } 14 15 [...] 16 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody, 17 scope, strict). 18 [...] 19 20 ---*/ 21 var count = 0; 22 23 24 var callCount = 0; 25 async function* f({...x} = { get v() { count++; return 2; } }) { 26 assert.sameValue(count, 1); 27 28 verifyProperty(x, "v", { 29 enumerable: true, 30 writable: true, 31 configurable: true, 32 value: 2 33 }); 34 callCount = callCount + 1; 35 }; 36 f().next().then(() => { 37 assert.sameValue(callCount, 1, 'invoked exactly once'); 38 }).then($DONE, $DONE);