Index: src/weakmap.js |
diff --git a/src/weakmap.js b/src/weakmap.js |
index b209776829e37c49fd5e1ab5ed4f87bfa6ff78fa..15056c7f8226588fa99a0b827a047c8253f134ee 100644 |
--- a/src/weakmap.js |
+++ b/src/weakmap.js |
@@ -58,13 +58,36 @@ function WeakMapSet(key, value) { |
return %WeakMapSet(this, key, value); |
} |
+ |
+function WeakMapHas(key) { |
+ if (!IS_SPEC_OBJECT(key)) { |
+ throw %MakeTypeError('invalid_weakmap_key', [this, key]); |
+ } |
+ return !IS_UNDEFINED(%WeakMapGet(this, key)); |
+} |
+ |
+ |
+function WeakMapDelete(key) { |
+ if (!IS_SPEC_OBJECT(key)) { |
+ throw %MakeTypeError('invalid_weakmap_key', [this, key]); |
+ } |
+ if (!IS_UNDEFINED(%WeakMapGet(this, key))) { |
+ %WeakMapSet(this, key, void 0); |
+ return true; |
+ } else { |
+ return false; |
+ } |
+} |
+ |
// ------------------------------------------------------------------- |
function SetupWeakMap() { |
// Setup the non-enumerable functions on the WeakMap prototype object. |
InstallFunctionsOnHiddenPrototype($WeakMap.prototype, DONT_ENUM, $Array( |
"get", WeakMapGet, |
- "set", WeakMapSet |
+ "set", WeakMapSet, |
+ "has", WeakMapHas, |
+ "delete", WeakMapDelete |
)); |
} |