summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-getVariable-03.js
blob: b47fe65c1458205c13db85ee97bd10bb3d7e22a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// getVariable sees bindings in let-block scopes.

var g = newGlobal();
var dbg = Debugger(g);
var log = '';
dbg.onDebuggerStatement = function (frame) {
    log += frame.environment.getVariable("x");
};
g.eval("function f() {\n" +
       "    let x = 'a';\n" +
       "    debugger;\n" +
       "    for (let x = 0; x < 2; x++)\n" + 
       "        if (x === 0)\n" +
       "            debugger;\n" +
       "        else {\n" +
       "            let x = 'b'; debugger;\n" +
       "        }\n" +
       "}\n");
g.f();
g.eval("{ let x = 'd'; debugger; }");
assertEq(log, 'a0bd');