Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | // Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | // http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 3 | // Contributor: Jim Blandy |
michael@0 | 4 | |
michael@0 | 5 | if (typeof findReferences == "function") { |
michael@0 | 6 | (function f() { |
michael@0 | 7 | assertEq(referencesVia(arguments, 'callee', f), true); |
michael@0 | 8 | })(); |
michael@0 | 9 | |
michael@0 | 10 | var o = ({}); |
michael@0 | 11 | |
michael@0 | 12 | function returnHeavy(y) { eval(''); return function heavy() { return y; }; } |
michael@0 | 13 | assertEq(referencesVia(returnHeavy(o), 'fun_callscope; y', o), true); |
michael@0 | 14 | assertEq(referencesVia(returnHeavy(o), 'fun_callscope; shape; base; parent', this), true); |
michael@0 | 15 | |
michael@0 | 16 | function returnBlock(z) { eval(''); let(w = z) { return function block() { return w; }; }; } |
michael@0 | 17 | assertEq(referencesVia(returnBlock(o), 'fun_callscope; w', o), true); |
michael@0 | 18 | |
michael@0 | 19 | function returnWithObj(v) { with(v) return function withObj() { return u; }; } |
michael@0 | 20 | assertEq(referencesVia(returnWithObj(o), 'fun_callscope; type; type_proto', o), true); |
michael@0 | 21 | |
michael@0 | 22 | reportCompare(true, true); |
michael@0 | 23 | } else { |
michael@0 | 24 | reportCompare(true, true, "test skipped: findReferences is not a function"); |
michael@0 | 25 | } |