Debian Codegraph @

js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-strict.js

raw
1 'use strict';
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/func-expr-named-strict-error.template
5 /*---
6 description: Reassignment of function name is silently ignored in non-strict mode code. (named function expression in strict mode code)
7 esid: sec-function-definitions-runtime-semantics-evaluation
8 flags: [generated, onlyStrict]
9 info: |
10 FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
11
12 ---*/
13
14 // increment callCount in case "body"
15 let callCount = 0;
16 let ref = function BindingIdentifier() {
17 callCount++;
18 BindingIdentifier = 1;
19 return BindingIdentifier;
20 };
21
22 assert.throws(TypeError, () => {
23 ref();
24 });
25 assert.sameValue(callCount, 1, 'function invoked exactly once');
26
27 reportCompare(0, 0);