Index: src/collection.js |
diff --git a/src/collection.js b/src/collection.js |
index d36fe18fa00dcd5fdae1210e5f9470c53cbc41f3..d5a8fe21a456c3d99bd6572853a9dddc82a04fcd 100644 |
--- a/src/collection.js |
+++ b/src/collection.js |
@@ -88,6 +88,15 @@ function SetDelete(key) { |
} |
+function SetGetSize() { |
+ if (!IS_SET(this)) { |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Set.prototype.size', this]); |
+ } |
+ return %SetGetSize(this); |
+} |
+ |
+ |
function MapConstructor() { |
if (%_IsConstructCall()) { |
%MapInitialize(this); |
@@ -145,6 +154,15 @@ function MapDelete(key) { |
} |
+function MapGetSize() { |
+ if (!IS_MAP(this)) { |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Map.prototype.size', this]); |
+ } |
+ return %MapGetSize(this); |
+} |
+ |
+ |
function WeakMapConstructor() { |
if (%_IsConstructCall()) { |
%WeakMapInitialize(this); |
@@ -215,6 +233,7 @@ function WeakMapDelete(key) { |
%SetProperty($Map.prototype, "constructor", $Map, DONT_ENUM); |
// 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, |
@@ -222,6 +241,7 @@ function WeakMapDelete(key) { |
)); |
// Set up the non-enumerable functions on the Map prototype object. |
+ InstallGetter($Map.prototype, "size", MapGetSize); |
InstallFunctions($Map.prototype, DONT_ENUM, $Array( |
"get", MapGet, |
"set", MapSet, |