TypeScript/tests/baselines/reference/for-of23.js

36 lines
570 B
TypeScript
Raw Normal View History

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]
for (const v of new FooIterator) {
2015-02-24 20:31:42 +01:00
const v = 0; // new scope
}
2015-03-16 05:27:54 +01:00
class Foo {
}
class FooIterator {
next() {
2015-02-24 20:31:42 +01:00
return {
value: new Foo,
done: false
};
2015-03-16 05:27:54 +01:00
}
[Symbol.iterator]() {
2015-02-24 20:31:42 +01:00
return this;
2015-03-16 05:27:54 +01:00
}
}