params-trailing-comma-single.js (1259B)
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-expr.template 5 /*--- 6 description: A trailing comma should not increase the respective length, using a single parameter (async generator function expression) 7 esid: sec-asyncgenerator-definitions-evaluation 8 features: [async-iteration] 9 flags: [generated, async] 10 info: | 11 AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { 12 AsyncGeneratorBody } 13 14 [...] 15 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, 16 AsyncGeneratorBody, 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 var ref; 31 ref = async function*(a,) { 32 assert.sameValue(a, 42); 33 callCount = callCount + 1; 34 }; 35 36 ref(42, 39).next().then(() => { 37 assert.sameValue(callCount, 1, 'generator function invoked exactly once'); 38 }).then($DONE, $DONE); 39 40 assert.sameValue(ref.length, 1, 'length is properly set');