async-meth-dflt-params-ref-prior.js (1457B)
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-meth.template 5 /*--- 6 description: Referencing a parameter that occurs earlier in the ParameterList (async method) 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 AsyncMethod : 14 async PropertyName ( UniqueFormalParameters ) { 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 var __obj = { 33 async method(x, y = x, z = y) { 34 assert.sameValue(x, 3, 'first argument value'); 35 assert.sameValue(y, 3, 'second argument value'); 36 assert.sameValue(z, 3, 'third argument value'); 37 callCount = callCount + 1; 38 } 39 }; 40 41 // Stores a reference `ref` for case evaluation 42 var ref = __obj.method; 43 44 ref(3).then(() => { 45 assert.sameValue(callCount, 1, 'async method invoked exactly once'); 46 }).then($DONE, $DONE);