Index: src/collection-iterator.js |
diff --git a/src/collection-iterator.js b/src/collection-iterator.js |
index 2436a931e28bc4acde80f5c4a8143cc0bff5b8f3..545a34587f8f438af4b8b6dd9277780fbd409074 100644 |
--- a/src/collection-iterator.js |
+++ b/src/collection-iterator.js |
@@ -21,7 +21,23 @@ function SetIteratorNextJS() { |
throw MakeTypeError('incompatible_method_receiver', |
['Set Iterator.prototype.next', this]); |
} |
- return %SetIteratorNext(this); |
+ |
+ var value_array = [UNDEFINED, UNDEFINED]; |
+ var entry = {value: value_array, done: false}; |
+ switch (%SetIteratorNext(this, value_array)) { |
+ case 0: |
+ entry.value = UNDEFINED; |
+ entry.done = true; |
+ break; |
+ case ITERATOR_KIND_VALUES: |
+ entry.value = value_array[0]; |
+ break; |
+ case ITERATOR_KIND_ENTRIES: |
+ value_array[1] = value_array[0]; |
+ break; |
+ } |
+ |
+ return entry; |
} |
@@ -97,7 +113,24 @@ function MapIteratorNextJS() { |
throw MakeTypeError('incompatible_method_receiver', |
['Map Iterator.prototype.next', this]); |
} |
- return %MapIteratorNext(this); |
+ |
+ var value_array = [UNDEFINED, UNDEFINED]; |
+ var entry = {value: value_array, done: false}; |
+ switch (%MapIteratorNext(this, value_array)) { |
+ case 0: |
+ entry.value = UNDEFINED; |
+ entry.done = true; |
+ break; |
+ case ITERATOR_KIND_KEYS: |
+ entry.value = value_array[0]; |
+ break; |
+ case ITERATOR_KIND_VALUES: |
+ entry.value = value_array[1]; |
+ break; |
+ // ITERATOR_KIND_ENTRIES does not need any processing. |
+ } |
+ |
+ return entry; |
} |