1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_8_5/extensions/findReferences-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,25 @@ 1.4 +// Any copyright is dedicated to the Public Domain. 1.5 +// http://creativecommons.org/licenses/publicdomain/ 1.6 +// Contributor: Jim Blandy 1.7 + 1.8 +if (typeof findReferences == "function") { 1.9 + (function f() { 1.10 + assertEq(referencesVia(arguments, 'callee', f), true); 1.11 + })(); 1.12 + 1.13 + var o = ({}); 1.14 + 1.15 + function returnHeavy(y) { eval(''); return function heavy() { return y; }; } 1.16 + assertEq(referencesVia(returnHeavy(o), 'fun_callscope; y', o), true); 1.17 + assertEq(referencesVia(returnHeavy(o), 'fun_callscope; shape; base; parent', this), true); 1.18 + 1.19 + function returnBlock(z) { eval(''); let(w = z) { return function block() { return w; }; }; } 1.20 + assertEq(referencesVia(returnBlock(o), 'fun_callscope; w', o), true); 1.21 + 1.22 + function returnWithObj(v) { with(v) return function withObj() { return u; }; } 1.23 + assertEq(referencesVia(returnWithObj(o), 'fun_callscope; type; type_proto', o), true); 1.24 + 1.25 + reportCompare(true, true); 1.26 +} else { 1.27 + reportCompare(true, true, "test skipped: findReferences is not a function"); 1.28 +}