summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/lexical-check-2.js
blob: 30dbb67b97ad2c9ad5b4926626df7aa2e4077107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function f(i) {
    if (i == 1500)
        g();
    const x = 42;
    function g() {
        return x;
    }
    return g;
}

var caught = false;
var i;
try {
    for (i = 0; i < 2000; i++)
        assertEq(f(i)(), 42);
} catch(e) {
    assertEq(e instanceof ReferenceError, true);
    assertEq(i, 1500);
    caught = true;
}
assertEq(caught, true);