Commit fa1523ea authored by arv's avatar arv Committed by Commit bot

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

Review URL: https://codereview.chromium.org/941313003

Cr-Commit-Position: refs/heads/master@{#26786}
parent 39f58c24
......@@ -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]);
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment