summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/arguments-7.js
blob: cf58c2ba5077add102bd0553fb80ce62fd4ce6f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Changing arguments.length during a for-of loop iterating over arguments affects the loop.

load(libdir + "iteration.js");

Object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];

var s;
function f() {
    for (var v of arguments) {
        s += v;
        arguments.length--;
    }
}

s = '';
f('a', 'b', 'c', 'd', 'e');
assertEq(s, 'abc');