Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: src/v8natives.js

Issue 448013005: ES6: Implement WeakMap and WeakSet constructor logic (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
+}
« no previous file with comments | « src/collection.js ('k') | src/weak_collection.js » ('j') | test/mjsunit/es6/collections.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698