michael@0: // Test that each yield* loop just checks "done", and "value" is only michael@0: // fetched once at the end. michael@0: michael@0: load(libdir + 'iteration.js'); michael@0: michael@0: var log = ""; michael@0: michael@0: function Iter(val, count) { michael@0: function next() { michael@0: return { michael@0: get done() { log += "d"; return count-- == 0; }, michael@0: get value() { log += "v"; return val; } michael@0: } michael@0: } michael@0: michael@0: this[std_iterator] = function() { return this; }; michael@0: this.next = next; michael@0: } michael@0: michael@0: for (var x of new Iter(42, 5)) michael@0: assertEq(x, 42); michael@0: michael@0: assertEq(log, "dvdvdvdvdvd");