dflt-params-ref-prior.js (1843B)
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-arrow-function.template 5 /*--- 6 description: Referencing a parameter that occurs earlier in the ParameterList (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 1. Let status be the result of performing IteratorBindingInitialization for 37 FormalsList using iteratorRecord and environment as the arguments. 38 2. ReturnIfAbrupt(status). 39 3. Return the result of performing IteratorBindingInitialization for 40 FormalParameter using iteratorRecord and environment as the arguments. 41 42 ---*/ 43 var x = 0; 44 45 46 var callCount = 0; 47 48 // Stores a reference `ref` for case evaluation 49 var ref = async (x, y = x, z = y) => { 50 assert.sameValue(x, 3, 'first argument value'); 51 assert.sameValue(y, 3, 'second argument value'); 52 assert.sameValue(z, 3, 'third argument value'); 53 callCount = callCount + 1; 54 }; 55 56 ref(3).then(() => { 57 assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') 58 }).then($DONE, $DONE);