summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testGeneratorDeepBail.js
blob: 29abc8b1e1f8e5c4fc7ea4d740404bf19e4c458f (plain)
1
2
3
4
5
6
7
8
9
10
11
function testGeneratorDeepBail() {
    function* g() { yield 2; }
    var iterables = [[1], [], [], [], g()];

    var total = 0;
    for (let i = 0; i < iterables.length; i++)
        for (let j of iterables[i])
            total += j;
    return total;
}
assertEq(testGeneratorDeepBail(), 3);