Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/reassign-fn-name-in-body-in-arrow.case
3 // - src/function-forms/expr-named/gen-func-expr-named-no-strict.template
4 /*---
5 description: Reassignment of function name is silently ignored in non-strict mode code. (named generator function expression in non-strict mode code)
6 esid: sec-generator-function-definitions-runtime-semantics-evaluation
7 features: [generators]
8 flags: [generated, noStrict]
9 info: |
10 GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
11
12 ---*/
13
14 // increment callCount in case "body"
15 let callCount = 0;
16 let ref = function * BindingIdentifier() {
17 callCount++;
18 (() => {
19 BindingIdentifier = 1;
20 })();
21 return BindingIdentifier;
22 };
23
24 assert.sameValue(ref().next().value, ref);
25 assert.sameValue(callCount, 1, 'function invoked exactly once');
26
27 reportCompare(0, 0);