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