]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/for-in-modify-string-loop-var.js
071a0860f8112eaf64a364563f52cae28c080105
[apple/javascriptcore.git] / tests / stress / for-in-modify-string-loop-var.js
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 })();