Debian Codegraph @

js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-arrow-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-in-arrow.case
4 // - src/function-forms/expr-named/gen-func-expr-named-strict-error.template
5 /*---
6 description: Reassignment of function name is silently ignored in non-strict mode code. (named generator function expression in strict mode code)
7 esid: sec-generator-function-definitions-runtime-semantics-evaluation
8 features: [generators]
9 flags: [generated, onlyStrict]
10 info: |
11 GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
12
13 ---*/
14
15 // increment callCount in case "body"
16 let callCount = 0;
17 let ref = function * BindingIdentifier() {
18 callCount++;
19 (() => {
20 BindingIdentifier = 1;
21 })();
22 return BindingIdentifier;
23 };
24
25 assert.throws(TypeError, () => {
26 ref().next();
27 });
28 assert.sameValue(callCount, 1, 'function invoked exactly once');
29
30 reportCompare(0, 0);