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

Unified Diff: src/collection.js

Issue 239163012: Revert "ES6: Add support for Map/Set forEach" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « src/bootstrapper.cc ('k') | src/contexts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/collection.js
diff --git a/src/collection.js b/src/collection.js
index f2b481b8e73e4b85bb08a73636865e1806de3ccc..9054187a12d0372ef1e028569a197059579f26ba 100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -113,29 +113,8 @@ function SetClear() {
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.clear', this]);
}
- %SetClear(this);
-}
-
-
-function SetForEach(f, receiver) {
- if (!IS_SET(this)) {
- throw MakeTypeError('incompatible_method_receiver',
- ['Set.prototype.forEach', this]);
- }
-
- if (!IS_SPEC_FUNCTION(f)) {
- throw MakeTypeError('called_non_callable', [f]);
- }
-
- var iterator = %SetCreateIterator(this, ITERATOR_KIND_VALUES);
- var entry;
- try {
- while (!(entry = %SetIteratorNext(iterator)).done) {
- %_CallFunction(receiver, entry.value, entry.value, this, f);
- }
- } finally {
- %SetIteratorClose(iterator);
- }
+ // Replace the internal table with a new empty table.
+ %SetInitialize(this);
}
@@ -148,16 +127,13 @@ function SetUpSet() {
%FunctionSetPrototype($Set, new $Object());
%SetProperty($Set.prototype, "constructor", $Set, DONT_ENUM);
- %FunctionSetLength(SetForEach, 1);
-
// Set up the non-enumerable functions on the Set prototype object.
InstallGetter($Set.prototype, "size", SetGetSize);
InstallFunctions($Set.prototype, DONT_ENUM, $Array(
"add", SetAdd,
"has", SetHas,
"delete", SetDelete,
- "clear", SetClear,
- "forEach", SetForEach
+ "clear", SetClear
));
}
@@ -226,29 +202,8 @@ function MapClear() {
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.clear', this]);
}
- %MapClear(this);
-}
-
-
-function MapForEach(f, receiver) {
- if (!IS_MAP(this)) {
- throw MakeTypeError('incompatible_method_receiver',
- ['Map.prototype.forEach', this]);
- }
-
- if (!IS_SPEC_FUNCTION(f)) {
- throw MakeTypeError('called_non_callable', [f]);
- }
-
- var iterator = %MapCreateIterator(this, ITERATOR_KIND_ENTRIES);
- var entry;
- try {
- while (!(entry = %MapIteratorNext(iterator)).done) {
- %_CallFunction(receiver, entry.value[1], entry.value[0], this, f);
- }
- } finally {
- %MapIteratorClose(iterator);
- }
+ // Replace the internal table with a new empty table.
+ %MapInitialize(this);
}
@@ -261,8 +216,6 @@ function SetUpMap() {
%FunctionSetPrototype($Map, new $Object());
%SetProperty($Map.prototype, "constructor", $Map, DONT_ENUM);
- %FunctionSetLength(MapForEach, 1);
-
// Set up the non-enumerable functions on the Map prototype object.
InstallGetter($Map.prototype, "size", MapGetSize);
InstallFunctions($Map.prototype, DONT_ENUM, $Array(
@@ -270,8 +223,7 @@ function SetUpMap() {
"set", MapSet,
"has", MapHas,
"delete", MapDelete,
- "clear", MapClear,
- "forEach", MapForEach
+ "clear", MapClear
));
}
« no previous file with comments | « src/bootstrapper.cc ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698