michael@0: // For-of passes one arg to "next". michael@0: michael@0: load(libdir + 'iteration.js') michael@0: michael@0: var log = ''; michael@0: michael@0: function Iter() { michael@0: function next() { michael@0: log += 'n'; michael@0: assertEq(arguments.length, 1) michael@0: assertEq(arguments[0], undefined) michael@0: return { get value() { throw 42; }, done: true } 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()) michael@0: throw 'not reached'; michael@0: michael@0: assertEq(log, 'n');