named-no-strict-reassign-fn-name-in-body.js (992B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/reassign-fn-name-in-body.case 4 // - src/function-forms/expr-named/async-gen-func-expr-named-no-strict.template 5 /*--- 6 description: Reassignment of function name is silently ignored in non-strict mode code. (async generator named function expression in non-strict mode code) 7 esid: sec-asyncgenerator-definitions-evaluation 8 features: [async-iteration] 9 flags: [generated, async, noStrict] 10 includes: [asyncHelpers.js] 11 info: | 12 AsyncGeneratorExpression : 13 async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } 14 15 ---*/ 16 17 // increment callCount in case "body" 18 let callCount = 0; 19 let ref = async function * BindingIdentifier() { 20 callCount++; 21 BindingIdentifier = 1; 22 return BindingIdentifier; 23 }; 24 25 asyncTest(async () => { 26 assert.sameValue((await (await ref()).next()).value, ref); 27 assert.sameValue(callCount, 1, 'function invoked exactly once'); 28 });