summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Set-iterator-add-1.js
blob: 9f07929239e9cc1c256a89cc93a0e698ccd0dfdd (plain)
1
2
3
4
5
6
7
8
9
10
11
// set.iterator() is live: entries added during iteration are visited.

var set = new Set([5]);
var log = '';
for (let x of set) {
    log += x + ';';
    if (x > 0)
        set.add(x - 1);
}
assertEq(log, '5;4;3;2;1;0;');
assertEq(set.size, 6);