michael@0: // Any copyright is dedicated to the Public Domain. michael@0: // http://creativecommons.org/licenses/publicdomain/ michael@0: // Contributor: Jim Blandy michael@0: michael@0: if (typeof findReferences == "function") { michael@0: (function f() { michael@0: assertEq(referencesVia(arguments, 'callee', f), true); michael@0: })(); michael@0: michael@0: var o = ({}); michael@0: michael@0: function returnHeavy(y) { eval(''); return function heavy() { return y; }; } michael@0: assertEq(referencesVia(returnHeavy(o), 'fun_callscope; y', o), true); michael@0: assertEq(referencesVia(returnHeavy(o), 'fun_callscope; shape; base; parent', this), true); michael@0: michael@0: function returnBlock(z) { eval(''); let(w = z) { return function block() { return w; }; }; } michael@0: assertEq(referencesVia(returnBlock(o), 'fun_callscope; w', o), true); michael@0: michael@0: function returnWithObj(v) { with(v) return function withObj() { return u; }; } michael@0: assertEq(referencesVia(returnWithObj(o), 'fun_callscope; type; type_proto', o), true); michael@0: michael@0: reportCompare(true, true); michael@0: } else { michael@0: reportCompare(true, true, "test skipped: findReferences is not a function"); michael@0: }