summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Object-environment-02.js
blob: d499e1ca2c8430c2f13455ed3e8d05c43897f1a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// The .environment of a function Debugger.Object is an Environment object.

var g = newGlobal({newCompartment: true})
var dbg = new Debugger;
var gDO = dbg.addDebuggee(g);

function check(expr) {
  print("checking " + JSON.stringify(expr));
  let completion = gDO.executeInGlobal(expr);
  if (completion.throw)
    throw completion.throw.unsafeDereference();
  assertEq(completion.return.environment instanceof Debugger.Environment, true);
}

g.eval('function j(a) { }');

check('j');
check('(() => { })');
check('(function f() { })');
check('(function* g() { })');
check('(async function m() { })');
check('(async function* n() { })');