Debian Codegraph @

js/src/tests/test262/language/expressions/generators/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/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 BindingIdentifier = 1;
20 return BindingIdentifier;
21 };
22
23 assert.throws(TypeError, () => {
24 ref().next();
25 });
26 assert.sameValue(callCount, 1, 'function invoked exactly once');
27
28 reportCompare(0, 0);