cls-expr-async-gen-func-args-trailing-comma-undefined.js (1461B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/arguments/args-trailing-comma-undefined.case 4 // - src/arguments/default/async-gen-func-expr.template 5 /*--- 6 description: A trailing comma after undefined should not increase the arguments.length (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, 2); 42 assert.sameValue(arguments[0], 42); 43 assert.sameValue(arguments[1], undefined); 44 callCount = callCount + 1; 45 }; 46 47 ref(42, undefined,).next().then(() => { 48 assert.sameValue(callCount, 1, 'generator function invoked exactly once'); 49 }).then($DONE, $DONE);