]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/for-in-modify-string-loop-var.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / for-in-modify-string-loop-var.js
CommitLineData
ed1e77d3
A
1(function() {
2 // Change string value of the loop variable in the loop.
3 var foo = function() {
4 var sum = 0;
5 var a = [1, 2, 3];
6 a.foo = 42;
7 for (var i in a) {
8 i = "foo";
9 sum += a[i];
10 }
11 return sum;
12 };
13 noInline(foo);
14 for (var i = 0; i < 10000; ++i) {
15 if (foo() != 42 * 4)
16 throw new Error("bad result");
17 }
18 foo(null);
19})();