summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/closures/name.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/closures/name.js')
-rw-r--r--js/src/jit-test/tests/closures/name.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/closures/name.js b/js/src/jit-test/tests/closures/name.js
new file mode 100644
index 000000000..498083f94
--- /dev/null
+++ b/js/src/jit-test/tests/closures/name.js
@@ -0,0 +1,25 @@
+actual = '';
+expected = '2,5,';
+
+function loop(f) {
+ var p;
+ for (var i = 0; i < 10; ++i) {
+ p = f();
+ }
+ return p;
+}
+
+function f(i, k) {
+ var g = function() { return k; }
+
+ k = 2;
+ appendToActual(loop(g));
+ k = 5;
+ appendToActual(loop(g));
+}
+
+f(0, 0);
+
+
+
+assertEq(actual, expected)