async-gen-meth-dflt-params-arg-val-undefined.js (1930B)
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-gen-meth.template 5 /*--- 6 description: Use of initializer when argument value is `undefined` (async generator method) 7 esid: sec-asyncgenerator-definitions-propertydefinitionevaluation 8 features: [default-parameters, async-iteration] 9 flags: [generated, async] 10 info: | 11 AsyncGeneratorMethod : 12 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) 13 { AsyncGeneratorBody } 14 15 1. Let propKey be the result of evaluating PropertyName. 16 2. ReturnIfAbrupt(propKey). 17 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. 18 Otherwise let strict be false. 19 4. Let scope be the running execution context's LexicalEnvironment. 20 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, 21 AsyncGeneratorBody, scope, strict). 22 [...] 23 24 25 14.1.19 Runtime Semantics: IteratorBindingInitialization 26 27 FormalsList : FormalsList , FormalParameter 28 29 [...] 30 23. Let iteratorRecord be Record {[[Iterator]]: 31 CreateListIterator(argumentsList), [[Done]]: false}. 32 24. If hasDuplicates is true, then 33 [...] 34 25. Else, 35 a. Perform ? IteratorBindingInitialization for formals with 36 iteratorRecord and env as arguments. 37 [...] 38 39 ---*/ 40 41 var callCount = 0; 42 var obj = { 43 async *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { 44 assert.sameValue(fromLiteral, 23); 45 assert.sameValue(fromExpr, 45); 46 assert.sameValue(fromHole, 99); 47 callCount = callCount + 1; 48 } 49 }; 50 51 // Stores a reference `ref` for case evaluation 52 var ref = obj.method; 53 54 ref(undefined, void 0).next().then(() => { 55 assert.sameValue(callCount, 1, 'generator method invoked exactly once'); 56 }).then($DONE, $DONE);