summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Generators/delegating-yield-11.js
blob: f7e6650fb98191b6b2202d3f007911b9c70b7dc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// The first call to yield* passes one arg to "next".

function Iter() {
    function next() {
        if (arguments.length != 1)
            throw Error;
        return { value: 42, done: true }
    }

    this.next = next;
    this[Symbol.iterator] = function () { return this; }
}

function* delegate(iter) { return yield* iter; }

var iter = delegate(new Iter());
assertDeepEq(iter.next(), {value:42, done:true});

if (typeof reportCompare == "function")
    reportCompare(true, true);