summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-setVariable-07.js
blob: 2b58885335420f28b6f87dd1ae0832916f85f66c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// setVariable works on let-bindings.

var g = newGlobal({newCompartment: true});
function test(code, val) {
    g.eval("function f() { " + code + " }");
    var dbg = new Debugger(g);
    dbg.onDebuggerStatement = function (frame) {
        frame.environment.setVariable("a", val);
    };
    assertEq(g.f(), val);
}

test("let a = 1; debugger; return a;", "xyzzy");
test("{ let a = 1; debugger; return a; }", "plugh");