params-trailing-comma-single.js (1277B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/params-trailing-comma-single.case 4 // - src/function-forms/default/async-gen-func-decl.template 5 /*--- 6 description: A trailing comma should not increase the respective length, using a single parameter (async generator function declaration) 7 esid: sec-asyncgenerator-definitions-instantiatefunctionobject 8 features: [async-iteration] 9 flags: [generated, async] 10 info: | 11 AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier 12 ( FormalParameters ) { AsyncGeneratorBody } 13 14 [...] 15 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody, 16 scope, strict). 17 [...] 18 19 20 Trailing comma in the parameters list 21 22 14.1 Function Definitions 23 24 FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , 25 ---*/ 26 27 28 var callCount = 0; 29 // Stores a reference `ref` for case evaluation 30 async function* ref(a,) { 31 assert.sameValue(a, 42); 32 callCount = callCount + 1; 33 } 34 35 ref(42, 39).next().then(() => { 36 assert.sameValue(callCount, 1, 'generator function invoked exactly once'); 37 }).then($DONE, $DONE); 38 39 assert.sameValue(ref.length, 1, 'length is properly set');