named-dflt-params-arg-val-undefined.js (1440B)
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-func-expr-named.template 5 /*--- 6 description: Use of initializer when argument value is `undefined` (async function named expression) 7 esid: sec-async-function-definitions 8 features: [default-parameters, async-functions] 9 flags: [generated, async] 10 info: | 11 14.6 Async Function Definitions 12 13 AsyncFunctionExpression : 14 async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } 15 16 17 14.1.19 Runtime Semantics: IteratorBindingInitialization 18 19 FormalsList : FormalsList , FormalParameter 20 21 [...] 22 23. Let iteratorRecord be Record {[[Iterator]]: 23 CreateListIterator(argumentsList), [[Done]]: false}. 24 24. If hasDuplicates is true, then 25 [...] 26 25. Else, 27 a. Perform ? IteratorBindingInitialization for formals with 28 iteratorRecord and env as arguments. 29 [...] 30 31 ---*/ 32 33 34 var callCount = 0; 35 36 // Stores a reference `ref` for case evaluation 37 var ref; 38 ref = async function ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) { 39 assert.sameValue(fromLiteral, 23); 40 assert.sameValue(fromExpr, 45); 41 assert.sameValue(fromHole, 99); 42 callCount = callCount + 1; 43 }; 44 45 ref(undefined, void 0).then(() => { 46 assert.sameValue(callCount, 1, 'function invoked exactly once'); 47 }).then($DONE, $DONE);