params-trailing-comma-single.js (1468B)
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-arrow-function.template 5 /*--- 6 description: A trailing comma should not increase the respective length, using a single parameter (async arrow function expression) 7 esid: sec-async-arrow-function-definitions 8 features: [async-functions] 9 flags: [generated, async] 10 info: | 11 14.7 Async Arrow Function Definitions 12 13 AsyncArrowFunction : 14 ... 15 CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody 16 17 AsyncConciseBody : 18 { AsyncFunctionBody } 19 20 ... 21 22 Supplemental Syntax 23 24 When processing an instance of the production AsyncArrowFunction : 25 CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of 26 CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: 27 28 AsyncArrowHead : 29 async ArrowFormalParameters 30 31 32 Trailing comma in the parameters list 33 34 14.1 Function Definitions 35 36 FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , 37 ---*/ 38 39 40 var callCount = 0; 41 42 // Stores a reference `ref` for case evaluation 43 var ref = async (a,) => { 44 assert.sameValue(a, 42); 45 callCount = callCount + 1; 46 }; 47 48 ref(42, 39).then(() => { 49 assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') 50 }).then($DONE, $DONE); 51 52 assert.sameValue(ref.length, 1, 'length is properly set');