Debian Codegraph @

js/src/jit-test/tests/basic/bug646968-6.js

raw
1 // In `for (let x = EXPR; ;)`, if `x` appears within EXPR, it refers to the
2 // loop variable. Actually doing this is typically a TDZ error.
3
4 load(libdir + "asserts.js");
5
6 assertThrowsInstanceOf(() => {
7 for (let x = x; null.foo; null.foo++) {}
8 }, ReferenceError);
9
10 assertThrowsInstanceOf(() => {
11 for (let x = eval('x'); null.foo; null.foo++) {}
12 }, ReferenceError);
13
14 assertThrowsInstanceOf(() => {
15 for (let x = function () { with ({}) return x; }(); null.foo; null.foo++) {}
16 }, ReferenceError);