Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index 8484150248a13a2ef01467da31603fab1db88b0c..c1fed948d3a8f61037867b8a3fc5cb3f944ba134 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -1875,3 +1875,33 @@ function SetUpFunction() { |
} |
SetUpFunction(); |
+ |
+ |
+// ---------------------------------------------------------------------------- |
+// Iterator related spec functions. |
+ |
+// ES6 rev 26, 2014-07-18 |
+// 7.4.1 CheckIterable ( obj ) |
+function ToIterable(obj) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
+ return UNDEFINED; |
+ } |
+ return obj[symbolIterator]; |
+} |
+ |
+ |
+// ES6 rev 26, 2014-07-18 |
+// 7.4.2 GetIterator ( obj, method ) |
+function GetIterator(obj, method) { |
+ if (IS_UNDEFINED(method)) { |
+ method = ToIterable(obj); |
+ } |
+ if (!IS_SPEC_FUNCTION(method)) { |
+ throw MakeTypeError('not_iterable', [obj]); |
+ } |
+ var iterator = %_CallFunction(obj, method); |
+ if (!IS_SPEC_OBJECT(iterator)) { |
+ throw MakeTypeError('not_an_iterator', [iterator]); |
+ } |
+ return iterator; |
+} |