dflt-params-ref-prior.js (1447B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/dflt-params-ref-prior.case 4 // - src/function-forms/default/async-func-decl.template 5 /*--- 6 description: Referencing a parameter that occurs earlier in the ParameterList (async function declaration) 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 AsyncFunctionDeclaration : 14 async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } 15 16 17 14.1.19 Runtime Semantics: IteratorBindingInitialization 18 19 FormalsList : FormalsList , FormalParameter 20 21 1. Let status be the result of performing IteratorBindingInitialization for 22 FormalsList using iteratorRecord and environment as the arguments. 23 2. ReturnIfAbrupt(status). 24 3. Return the result of performing IteratorBindingInitialization for 25 FormalParameter using iteratorRecord and environment as the arguments. 26 27 ---*/ 28 var x = 0; 29 30 31 var callCount = 0; 32 33 // Stores a reference `ref` for case evaluation 34 async function ref(x, y = x, z = y) { 35 assert.sameValue(x, 3, 'first argument value'); 36 assert.sameValue(y, 3, 'second argument value'); 37 assert.sameValue(z, 3, 'third argument value'); 38 callCount = callCount + 1; 39 } 40 41 ref(3).then(() => { 42 assert.sameValue(callCount, 1, 'function invoked exactly once'); 43 }).then($DONE, $DONE);