cls-expr-async-gen-func-args-trailing-comma-single-args.js (1411B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/arguments/args-trailing-comma-single-args.case 4 // - src/arguments/default/async-gen-func-expr.template 5 /*--- 6 description: A trailing comma should not increase the arguments.length, using a single arg (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 arguments list 21 22 Left-Hand-Side Expressions 23 24 Arguments : 25 ( ) 26 ( ArgumentList ) 27 ( ArgumentList , ) 28 29 ArgumentList : 30 AssignmentExpression 31 ... AssignmentExpression 32 ArgumentList , AssignmentExpression 33 ArgumentList , ... AssignmentExpression 34 ---*/ 35 36 37 var callCount = 0; 38 // Stores a reference `ref` for case evaluation 39 var ref; 40 ref = async function*() { 41 assert.sameValue(arguments.length, 1); 42 assert.sameValue(arguments[0], 42); 43 callCount = callCount + 1; 44 }; 45 46 ref(42,).next().then(() => { 47 assert.sameValue(callCount, 1, 'generator function invoked exactly once'); 48 }).then($DONE, $DONE);