|
1 // Any copyright is dedicated to the Public Domain. |
|
2 // http://creativecommons.org/licenses/publicdomain/ |
|
3 // Contributor: Jim Blandy |
|
4 |
|
5 if (typeof findReferences == "function") { |
|
6 (function f() { |
|
7 assertEq(referencesVia(arguments, 'callee', f), true); |
|
8 })(); |
|
9 |
|
10 var o = ({}); |
|
11 |
|
12 function returnHeavy(y) { eval(''); return function heavy() { return y; }; } |
|
13 assertEq(referencesVia(returnHeavy(o), 'fun_callscope; y', o), true); |
|
14 assertEq(referencesVia(returnHeavy(o), 'fun_callscope; shape; base; parent', this), true); |
|
15 |
|
16 function returnBlock(z) { eval(''); let(w = z) { return function block() { return w; }; }; } |
|
17 assertEq(referencesVia(returnBlock(o), 'fun_callscope; w', o), true); |
|
18 |
|
19 function returnWithObj(v) { with(v) return function withObj() { return u; }; } |
|
20 assertEq(referencesVia(returnWithObj(o), 'fun_callscope; type; type_proto', o), true); |
|
21 |
|
22 reportCompare(true, true); |
|
23 } else { |
|
24 reportCompare(true, true, "test skipped: findReferences is not a function"); |
|
25 } |