summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-eval-21.js
blob: 097eb5078f5d13095ad8fda9a5913f509f91f37b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Eval-in-frame with different type on baseline frame with let-scoping

load(libdir + "jitopts.js");

if (!jitTogglesMatch(Opts_BaselineEager))
  quit(0);

withJitOptions(Opts_BaselineEager, function () {
  var g = newGlobal();
  var dbg = new Debugger;

  g.h = function h(d) {
    if (d) {
      dbg.addDebuggee(g);
      var f = dbg.getNewestFrame().older;
      assertEq(f.implementation, "baseline");
      assertEq(f.environment.getVariable("foo"), 42);
      f.eval("foo = 'string of 42'");
    }
  }

  g.eval("" + function f(d) {
    if (d) {
      let foo = 42;
      g(d);
      return foo;
    }
  });

  g.eval("" + function g(d) { h(d); });

  g.eval("(" + function () { assertEq(f(true), "string of 42"); } + ")();");
});