summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testDynamicLookup.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/basic/testDynamicLookup.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/basic/testDynamicLookup.js')
-rw-r--r--js/src/jit-test/tests/basic/testDynamicLookup.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testDynamicLookup.js b/js/src/jit-test/tests/basic/testDynamicLookup.js
new file mode 100644
index 000000000..781c9f8a7
--- /dev/null
+++ b/js/src/jit-test/tests/basic/testDynamicLookup.js
@@ -0,0 +1,67 @@
+(function() { var x = 2; eval("assertEq(x, 2)"); })();
+(function() { var x = 2; (function() { assertEq(x, 2) })() })();
+(function() { var x = 2; (function() { eval("assertEq(x, 2)") })() })();
+(function() { var x = 2; (function() { (function() { assertEq(x, 2) })()})() })();
+(function() { var x = 2; (function() { (function() { eval("assertEq(x, 2)") })()})() })();
+
+(function() { var x = 2; with({}) { assertEq(x, 2) } })();
+(function() { var x = 2; with({}) { (function() { assertEq(x, 2) })() } })();
+(function() { var x = 3; with({x:2}) { assertEq(x, 2) } })();
+(function() { var x = 3; with({x:2}) { (function() { assertEq(x, 2) })() } })();
+(function() { var x = 2; (function() { with({}) { assertEq(x, 2) } })() })();
+(function() { var x = 2; (function() { with({}) { (function() { assertEq(x, 2) })() } })() })();
+(function() { var x = 3; (function() { with({x:2}) { assertEq(x, 2) } })() })();
+(function() { var x = 3; (function() { with({x:2}) { (function() { assertEq(x, 2) })() } })() })();
+
+(function() { if (Math) function x() {}; assertEq(typeof x, "function") })();
+(function() { if (Math) function x() {}; eval('assertEq(typeof x, "function")') })();
+(function() { if (Math) function x() {}; (function() { assertEq(typeof x, "function") })() })();
+(function() { if (Math) function x() {}; (function() { eval('assertEq(typeof x, "function")') })() })();
+
+(function() { eval("var x = 2"); assertEq(x, 2) })();
+(function() { eval("var x = 2"); (function() { assertEq(x, 2) })() })();
+(function() { eval("var x = 2"); (function() { (function() { assertEq(x, 2) })() })() })();
+
+(function() { var x = 2; (function() { eval('var y = 3'); assertEq(x, 2) })() })();
+(function() { var x = 2; (function() { eval('var y = 3'); (function() { assertEq(x, 2) })() })() })();
+
+(function() { var x = 3; (function() { eval('var x = 2'); assertEq(x, 2) })() })();
+(function() { var x = 3; (function() { eval('var x = 2'); (function() { assertEq(x, 2) })() })() })();
+
+(function() { var x = 2; eval("eval('assertEq(x, 2)')") })();
+(function() { var x = 2; (function() { eval("eval('assertEq(x, 2)')") })() })();
+(function() { var x = 2; eval("(function() { eval('assertEq(x, 2)') })()") })();
+(function() { var x = 2; (function() { eval("(function() { eval('assertEq(x, 2)') })()") })() })();
+(function() { var x = 2; (function() { eval("(function() { eval('(function() { assertEq(x, 2) })()') })()") })() })();
+
+(function() { var [x] = [2]; eval('assertEq(x, 2)') })();
+(function() { var [x] = [2]; (function() { assertEq(x, 2) })() })();
+(function() { var [x] = [2]; (function() { eval('assertEq(x, 2)') })() })();
+(function() { for (var [x] = [2];;) { return (function() { return assertEq(x, 2); })() } })();
+(function() { for (var [x] = [2];;) { return (function() { return eval('assertEq(x, 2)'); })() } })();
+
+(function() { var {y:x} = {y:2}; eval('assertEq(x, 2)') })();
+(function() { var {y:x} = {y:2}; (function() { assertEq(x, 2) })() })();
+(function() { var {y:x} = {y:2}; (function() { eval('assertEq(x, 2)') })() })();
+(function() { for (var {y:x} = {y:2};;) { return (function() { return assertEq(x, 2); })() } })();
+(function() { for (var {y:x} = {y:2};;) { return (function() { return eval('assertEq(x, 2)'); })() } })();
+
+(function([x]) { eval('assertEq(x, 2)') })([2]);
+(function([x]) { (function() { assertEq(x, 2) })() })([2]);
+(function([x]) { (function() { eval('assertEq(x, 2)') })() })([2]);
+
+(function f() { assertEq(f.length, 0) })();
+(function f() { eval('assertEq(f.length, 0)') })();
+(function f() { (function f(x) { eval('assertEq(f.length, 1)') })() })();
+(function f() { eval("(function f(x) { eval('assertEq(f.length, 1)') })()") })();
+
+(function f() { arguments = 3; function arguments() {}; assertEq(arguments, 3) })();
+(function f() { function arguments() {}; arguments = 3; assertEq(arguments, 3) })();
+(function f() { var arguments = 3; function arguments() {}; assertEq(arguments, 3) })();
+(function f() { function arguments() {}; var arguments = 3; assertEq(arguments, 3) })();
+
+function f1() { assertEq(typeof f1, "function") }; f1();
+with({}) { (function() { assertEq(typeof f1, "function") })() }
+if (Math)
+ function f2(x) {}
+assertEq(f2.length, 1);