Reviewers: adamk,
Message:
PTAL
Description:
ES6: Fix GetIterator
After further spec reading it turns out that we should not do ToObject
on the iterable.
BUG=None
LOG=N
R=adamk
Please review this at https://codereview.chromium.org/941313003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+3, -3 lines):
M src/v8natives.js
M test/mjsunit/es6/collections.js
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index
3cba466494233df2bac910ffec5561b99fa6bf72..72d6a8464f5c48d28f328486fdac22e65d79daea
100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1883,7 +1883,7 @@ SetUpFunction();
// 7.4.1 GetIterator ( obj, method )
function GetIterator(obj, method) {
if (IS_UNDEFINED(method)) {
- method = ToObject(obj)[symbolIterator];
+ method = obj[symbolIterator];
}
if (!IS_SPEC_FUNCTION(method)) {
throw MakeTypeError('not_iterable', [obj]);
Index: test/mjsunit/es6/collections.js
diff --git a/test/mjsunit/es6/collections.js
b/test/mjsunit/es6/collections.js
index
7f8b4a5feba1125fd22596486bdae07c2571e989..a66301462319befb51ec30a1ec04731d69b29ac7
100644
--- a/test/mjsunit/es6/collections.js
+++ b/test/mjsunit/es6/collections.js
@@ -1190,7 +1190,7 @@ function TestSetConstructorIterableValue(ctor) {
// Strict mode is required to prevent implicit wrapping in the getter.
Object.defineProperty(Number.prototype, Symbol.iterator, {
get: function() {
- assertEquals('object', typeof this);
+ assertEquals('number', typeof this);
return function() {
assertEquals('number', typeof this);
return oneAndTwo.keys();
@@ -1381,7 +1381,7 @@ function TestMapConstructorIterableValue(ctor) {
// Strict mode is required to prevent implicit wrapping in the getter.
Object.defineProperty(Number.prototype, Symbol.iterator, {
get: function() {
- assertEquals('object', typeof this);
+ assertEquals('number', typeof this);
return function() {
assertEquals('number', typeof this);
return oneAndTwo.entries();
--
--
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.