blob: 9475d1cce367cd0c2634b3779f2f4bd3282bec5d (
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({newCompartment: true});
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');
|