Debian Codegraph @

js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-arrow.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/function-forms/reassign-fn-name-in-body-in-arrow.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 (() => {
22 BindingIdentifier = 1;
23 })();
24 return BindingIdentifier;
25 };
26
27 asyncTest(async () => {
28 assert.sameValue((await (await ref()).next()).value, ref);
29 assert.sameValue(callCount, 1, 'function invoked exactly once');
30 });
31