Commit 69990745 authored by dslomov's avatar dslomov Committed by Commit bot

Remove Weak{Map,Set}.prototype.clear.

Per Nov 2014 TC39 decision.

R=adamk@chromium.org
LOG=Y

Review URL: https://codereview.chromium.org/739303002

Cr-Commit-Position: refs/heads/master@{#25429}
parent b6c9a62c
...@@ -96,16 +96,6 @@ function WeakMapDelete(key) { ...@@ -96,16 +96,6 @@ function WeakMapDelete(key) {
} }
function WeakMapClear() {
if (!IS_WEAKMAP(this)) {
throw MakeTypeError('incompatible_method_receiver',
['WeakMap.prototype.clear', this]);
}
// Replace the internal table with a new empty table.
%WeakCollectionInitialize(this);
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
function SetUpWeakMap() { function SetUpWeakMap() {
...@@ -122,8 +112,7 @@ function SetUpWeakMap() { ...@@ -122,8 +112,7 @@ function SetUpWeakMap() {
"get", WeakMapGet, "get", WeakMapGet,
"set", WeakMapSet, "set", WeakMapSet,
"has", WeakMapHas, "has", WeakMapHas,
"delete", WeakMapDelete, "delete", WeakMapDelete
"clear", WeakMapClear
)); ));
} }
...@@ -198,16 +187,6 @@ function WeakSetDelete(value) { ...@@ -198,16 +187,6 @@ function WeakSetDelete(value) {
} }
function WeakSetClear() {
if (!IS_WEAKSET(this)) {
throw MakeTypeError('incompatible_method_receiver',
['WeakSet.prototype.clear', this]);
}
// Replace the internal table with a new empty table.
%WeakCollectionInitialize(this);
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
function SetUpWeakSet() { function SetUpWeakSet() {
...@@ -223,8 +202,7 @@ function SetUpWeakSet() { ...@@ -223,8 +202,7 @@ function SetUpWeakSet() {
InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array( InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array(
"add", WeakSetAdd, "add", WeakSetAdd,
"has", WeakSetHas, "has", WeakSetHas,
"delete", WeakSetDelete, "delete", WeakSetDelete
"clear", WeakSetClear
)); ));
} }
......
...@@ -266,7 +266,6 @@ assertTrue(WeakMap.prototype.set instanceof Function) ...@@ -266,7 +266,6 @@ assertTrue(WeakMap.prototype.set instanceof Function)
assertTrue(WeakMap.prototype.get instanceof Function) assertTrue(WeakMap.prototype.get instanceof Function)
assertTrue(WeakMap.prototype.has instanceof Function) assertTrue(WeakMap.prototype.has instanceof Function)
assertTrue(WeakMap.prototype.delete instanceof Function) assertTrue(WeakMap.prototype.delete instanceof Function)
assertTrue(WeakMap.prototype.clear instanceof Function)
// Test some common JavaScript idioms for WeakSets // Test some common JavaScript idioms for WeakSets
...@@ -275,7 +274,6 @@ assertTrue(s instanceof WeakSet); ...@@ -275,7 +274,6 @@ assertTrue(s instanceof WeakSet);
assertTrue(WeakSet.prototype.add instanceof Function) assertTrue(WeakSet.prototype.add instanceof Function)
assertTrue(WeakSet.prototype.has instanceof Function) assertTrue(WeakSet.prototype.has instanceof Function)
assertTrue(WeakSet.prototype.delete instanceof Function) assertTrue(WeakSet.prototype.delete instanceof Function)
assertTrue(WeakSet.prototype.clear instanceof Function)
// Test class of instance and prototype. // Test class of instance and prototype.
...@@ -471,30 +469,6 @@ for (var i = 9; i >= 0; i--) { ...@@ -471,30 +469,6 @@ for (var i = 9; i >= 0; i--) {
})(); })();
// Test WeakMap clear
(function() {
var k = new Object();
var w = new WeakMap();
w.set(k, 23);
assertTrue(w.has(k));
assertEquals(23, w.get(k));
w.clear();
assertFalse(w.has(k));
assertEquals(undefined, w.get(k));
})();
// Test WeakSet clear
(function() {
var k = new Object();
var w = new WeakSet();
w.add(k);
assertTrue(w.has(k));
w.clear();
assertFalse(w.has(k));
})();
(function TestMinusZeroSet() { (function TestMinusZeroSet() {
var s = new Set(); var s = new Set();
s.add(-0); s.add(-0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment