2015-02-24 20:31:42 +01:00
|
|
|
//// [for-of23.ts]
|
|
|
|
for (const v of new FooIterator) {
|
|
|
|
const v = 0; // new scope
|
|
|
|
}
|
|
|
|
|
|
|
|
class Foo { }
|
|
|
|
class FooIterator {
|
|
|
|
next() {
|
|
|
|
return {
|
|
|
|
value: new Foo,
|
|
|
|
done: false
|
|
|
|
};
|
|
|
|
}
|
|
|
|
[Symbol.iterator]() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//// [for-of23.js]
|
2015-03-01 01:30:10 +01:00
|
|
|
for (const v of new FooIterator) {
|
2015-02-24 20:31:42 +01:00
|
|
|
const v = 0; // new scope
|
|
|
|
}
|
|
|
|
var Foo = (function () {
|
|
|
|
function Foo() {
|
|
|
|
}
|
|
|
|
return Foo;
|
|
|
|
})();
|
|
|
|
var FooIterator = (function () {
|
|
|
|
function FooIterator() {
|
|
|
|
}
|
|
|
|
FooIterator.prototype.next = function () {
|
|
|
|
return {
|
|
|
|
value: new Foo,
|
|
|
|
done: false
|
|
|
|
};
|
|
|
|
};
|
|
|
|
FooIterator.prototype[Symbol.iterator] = function () {
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
return FooIterator;
|
|
|
|
})();
|