cls-decl-async-gen-func-args-trailing-comma-null.js (1459B)
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-func-decl.template 5 /*--- 6 description: A trailing comma after null should not increase the arguments.length (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 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 async function* ref() { 40 assert.sameValue(arguments.length, 2); 41 assert.sameValue(arguments[0], 42); 42 assert.sameValue(arguments[1], null); 43 callCount = callCount + 1; 44 } 45 46 ref(42, null,).next().then(() => { 47 assert.sameValue(callCount, 1, 'generator function invoked exactly once'); 48 }).then($DONE, $DONE);