dflt-params-arg-val-undefined.js (1810B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/dflt-params-arg-val-undefined.case 4 // - src/function-forms/default/async-arrow-function.template 5 /*--- 6 description: Use of initializer when argument value is `undefined` (async arrow function expression) 7 esid: sec-async-arrow-function-definitions 8 features: [default-parameters, 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 14.1.19 Runtime Semantics: IteratorBindingInitialization 33 34 FormalsList : FormalsList , FormalParameter 35 36 [...] 37 23. Let iteratorRecord be Record {[[Iterator]]: 38 CreateListIterator(argumentsList), [[Done]]: false}. 39 24. If hasDuplicates is true, then 40 [...] 41 25. Else, 42 a. Perform ? IteratorBindingInitialization for formals with 43 iteratorRecord and env as arguments. 44 [...] 45 46 ---*/ 47 48 49 var callCount = 0; 50 51 // Stores a reference `ref` for case evaluation 52 var ref = async (fromLiteral = 23, fromExpr = 45, fromHole = 99) => { 53 assert.sameValue(fromLiteral, 23); 54 assert.sameValue(fromExpr, 45); 55 assert.sameValue(fromHole, 99); 56 callCount = callCount + 1; 57 }; 58 59 ref(undefined, void 0).then(() => { 60 assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') 61 }).then($DONE, $DONE);