dflt-params-ref-prior.js (1634B)
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-gen-func-expr.template 5 /*--- 6 description: Referencing a parameter that occurs earlier in the ParameterList (async generator function expression) 7 esid: sec-asyncgenerator-definitions-evaluation 8 features: [default-parameters, async-iteration] 9 flags: [generated, async] 10 info: | 11 AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { 12 AsyncGeneratorBody } 13 14 [...] 15 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, 16 AsyncGeneratorBody, scope, strict). 17 [...] 18 19 20 14.1.19 Runtime Semantics: IteratorBindingInitialization 21 22 FormalsList : FormalsList , FormalParameter 23 24 1. Let status be the result of performing IteratorBindingInitialization for 25 FormalsList using iteratorRecord and environment as the arguments. 26 2. ReturnIfAbrupt(status). 27 3. Return the result of performing IteratorBindingInitialization for 28 FormalParameter using iteratorRecord and environment as the arguments. 29 30 ---*/ 31 var x = 0; 32 33 34 var callCount = 0; 35 // Stores a reference `ref` for case evaluation 36 var ref; 37 ref = async function*(x, y = x, z = y) { 38 assert.sameValue(x, 3, 'first argument value'); 39 assert.sameValue(y, 3, 'second argument value'); 40 assert.sameValue(z, 3, 'third argument value'); 41 callCount = callCount + 1; 42 }; 43 44 ref(3).next().then(() => { 45 assert.sameValue(callCount, 1, 'generator function invoked exactly once'); 46 }).then($DONE, $DONE);