Status: Assigned
Owner: [email protected]
CC: [email protected], [email protected], [email protected]
Labels: Type-Bug Priority-Medium
New issue 3916 by [email protected]: for-of should throw TypeError if the
iterator does not return an object
https://code.google.com/p/v8/issues/detail?id=3916
var iterator = {
next: function() {
return 'abc';
}
};
iterator[Symbol.iterator] = function() {
return this;
};
for (var x of iterator) {
console.log(x);
}
This gets stuck in an infinite loop. This is because we end up doing
`'abc'.done` which is `undefined` so we never terminate the loop.
The spec says that we should throw a TypeError in this case:
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratornext
4. If Type(result) is not Object, throw a TypeError exception.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.