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

Unified Diff: src/array-iterator.js

Issue 332663004: For-of calls [Symbol.iterator]() on RHS to get iterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array-iterator.js
diff --git a/src/array-iterator.js b/src/array-iterator.js
index a96b9cb7c660b51efb59679f75a9eb7281f85e42..9511b6d95a483c6f56395dd5701a0325c530477d 100644
--- a/src/array-iterator.js
+++ b/src/array-iterator.js
@@ -18,6 +18,11 @@ var arrayIterationKindSymbol = GLOBAL_PRIVATE("ArrayIterator#kind");
function ArrayIterator() {}
+// TODO(wingo): Update section numbers when ES6 has stabilized. The
+// section numbers below are already out of date as of the May 2014
+// draft.
+
+
// 15.4.5.1 CreateArrayIterator Abstract Operation
function CreateArrayIterator(array, kind) {
var object = ToObject(array);
@@ -35,6 +40,12 @@ function CreateIteratorResultObject(value, done) {
}
+// 22.1.5.2.2 %ArrayIteratorPrototype%[@@iterator]
+function ArrayIteratorIterator() {
+ return this;
+}
+
+
// 15.4.5.2.2 ArrayIterator.prototype.next( )
function ArrayIteratorNext() {
var iterator = ToObject(this);
@@ -98,6 +109,9 @@ function SetUpArrayIterator() {
InstallFunctions(ArrayIterator.prototype, DONT_ENUM, $Array(
'next', ArrayIteratorNext
));
+ %FunctionSetName(ArrayIteratorIterator, '[Symbol.iterator]');
+ %SetProperty(ArrayIterator.prototype, symbolIterator, ArrayIteratorIterator,
+ DONT_ENUM | DONT_DELETE | READ_ONLY);
}
SetUpArrayIterator();
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698