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

Unified Diff: src/array-iterator.js

Issue 258793005: Array Iterator prototype should not have a constructor. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Replace prototype instead of deleting the constructor Created 6 years, 8 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 | « no previous file | test/mjsunit/harmony/array-iterator.js » ('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 10116b1d10b502c2079ce5e320db21b06ef60858..37f098a5b60e6406a84fe4a970a4823ef17b8493 100644
--- a/src/array-iterator.js
+++ b/src/array-iterator.js
@@ -27,16 +27,20 @@
'use strict';
+
// This file relies on the fact that the following declaration has been made
// in runtime.js:
// var $Array = global.Array;
+
var arrayIteratorObjectSymbol = GLOBAL_PRIVATE("ArrayIterator#object");
var arrayIteratorNextIndexSymbol = GLOBAL_PRIVATE("ArrayIterator#next");
var arrayIterationKindSymbol = GLOBAL_PRIVATE("ArrayIterator#kind");
+
function ArrayIterator() {}
+
// 15.4.5.1 CreateArrayIterator Abstract Operation
function CreateArrayIterator(array, kind) {
var object = ToObject(array);
@@ -47,11 +51,13 @@ function CreateArrayIterator(array, kind) {
return iterator;
}
+
// 15.19.4.3.4 CreateItrResultObject
function CreateIteratorResultObject(value, done) {
return {value: value, done: done};
}
+
// 15.4.5.2.2 ArrayIterator.prototype.next( )
function ArrayIteratorNext() {
var iterator = ToObject(this);
@@ -83,31 +89,35 @@ function ArrayIteratorNext() {
return CreateIteratorResultObject(index, false);
}
+
function ArrayEntries() {
return CreateArrayIterator(this, ITERATOR_KIND_ENTRIES);
}
+
function ArrayValues() {
return CreateArrayIterator(this, ITERATOR_KIND_VALUES);
}
+
function ArrayKeys() {
return CreateArrayIterator(this, ITERATOR_KIND_KEYS);
}
+
function SetUpArrayIterator() {
%CheckIsBootstrapping();
+ %FunctionSetPrototype(ArrayIterator, new $Object());
%FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator');
- %FunctionSetReadOnlyPrototype(ArrayIterator);
InstallFunctions(ArrayIterator.prototype, DONT_ENUM, $Array(
'next', ArrayIteratorNext
));
}
-
SetUpArrayIterator();
+
function ExtendArrayPrototype() {
%CheckIsBootstrapping();
@@ -117,5 +127,4 @@ function ExtendArrayPrototype() {
'keys', ArrayKeys
));
}
-
ExtendArrayPrototype();
« no previous file with comments | « no previous file | test/mjsunit/harmony/array-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698