X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/tests/stress/for-in-capture-string-loop-var.js?ds=inline diff --git a/tests/stress/for-in-capture-string-loop-var.js b/tests/stress/for-in-capture-string-loop-var.js new file mode 100644 index 0000000..c92bf68 --- /dev/null +++ b/tests/stress/for-in-capture-string-loop-var.js @@ -0,0 +1,22 @@ +(function() { + // Capture the loop variable and modify it inside the loop. + var foo = function() { + var captured; + var g = function() { + captured = "foo"; + }; + var sum = 0; + var o = {"foo": 1, "bar": 2}; + for (captured in o) { + g(); + sum += o[captured]; + } + return sum; + }; + noInline(foo); + for (var i = 0; i < 10000; ++i) { + if (foo() != 2) + throw new Error("bad result"); + } + foo(null); +})();