async-gen-named-func-expr-args-trailing-comma-null.js (1475B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/arguments/args-trailing-comma-null.case 4 // - src/arguments/default/async-gen-named-func-expr.template 5 /*--- 6 description: A trailing comma after null should not increase the arguments.length (async generator named 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 * BindingIdentifier 12 ( FormalParameters ) { AsyncGeneratorBody } 13 14 [...] 15 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, 16 AsyncGeneratorBody, funcEnv, 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* g() { 41 assert.sameValue(arguments.length, 2); 42 assert.sameValue(arguments[0], 42); 43 assert.sameValue(arguments[1], null); 44 callCount = callCount + 1; 45 }; 46 47 ref(42, null,).next().then(() => { 48 assert.sameValue(callCount, 1, 'generator function invoked exactly once'); 49 }).then($DONE, $DONE);