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