Debian Codegraph @

js/src/jit-test/tests/debug/Frame-eval-33.js

raw
1 load(libdir + "evalInFrame.js");
2
3 // Test that computing the implicit 'this' in calls for D.F.eval is as if it
4 // were a pasted-in eval.
5
6 var G = this;
7
8 function globalFun(check, expectedThis) {
9 if (check)
10 assertEq(this, expectedThis);
11 return this;
12 }
13 var expectedGlobalFunThis = globalFun(false);
14 evalInFrame(0, "globalFun(true, expectedGlobalFunThis)");
15
16 (function testInnerFun() {
17 function innerFun(check, expectedThis) {
18 if (check)
19 assertEq(this, expectedThis);
20 return this;
21 }
22 var expectedInnerFunThis = innerFun(false);
23 evalInFrame(0, "innerFun(true, expectedInnerFunThis)");
24 return [innerFun, expectedInnerFunThis]; // To prevent the JIT from optimizing out vars.
25 })();
26
27 (function testWith() {
28 var o = {
29 withFun: function withFun(check, expectedThis) {
30 if (check)
31 assertEq(this, expectedThis);
32 return this;
33 }
34 };
35 with (o) {
36 var expectedWithFunThis = withFun(false);
37 evalInFrame(0, "withFun(true, expectedWithFunThis)");
38 }
39 })();