Object-environment-02.js (638B)
1 // The .environment of a function Debugger.Object is an Environment object. 2 3 var g = newGlobal({newCompartment: true}) 4 var dbg = new Debugger; 5 var gDO = dbg.addDebuggee(g); 6 7 function check(expr) { 8 print("checking " + JSON.stringify(expr)); 9 let completion = gDO.executeInGlobal(expr); 10 if (completion.throw) 11 throw completion.throw.unsafeDereference(); 12 assertEq(completion.return.environment instanceof Debugger.Environment, true); 13 } 14 15 g.eval('function j(a) { }'); 16 17 check('j'); 18 check('(() => { })'); 19 check('(function f() { })'); 20 check('(function* g() { })'); 21 check('(async function m() { })'); 22 check('(async function* n() { })');