Debian Codegraph @

js/src/tests/test262/language/expressions/async-function/named-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-func-expr-named-no-strict.template
5 /*---
6 description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in non-strict mode code)
7 esid: sec-async-function-definitions
8 features: [async-functions]
9 flags: [generated, async, noStrict]
10 includes: [asyncHelpers.js]
11 info: |
12 Async Function Definitions
13
14 AsyncFunctionExpression :
15 async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
16
17 ---*/
18
19 // increment callCount in case "body"
20 let callCount = 0;
21 let ref = async function BindingIdentifier() {
22 callCount++;
23 (() => {
24 BindingIdentifier = 1;
25 })();
26 return BindingIdentifier;
27 };
28
29 asyncTest(async () => {
30 assert.sameValue(await ref(), ref);
31 assert.sameValue(callCount, 1, 'function invoked exactly once');
32 });
33