Reviewers: adamk,
Message:
PTAL
Description:
[es6] Map/Set size getter should have "get size" name
Getter and setter function names in ES6 ar defined as "get foo" and
"set foo".
BUG=None
LOG=N
[email protected]
Please review this at https://codereview.chromium.org/1094323005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+4, -0 lines):
M src/collection.js
M test/mjsunit/es6/collections.js
Index: src/collection.js
diff --git a/src/collection.js b/src/collection.js
index
206aaa79134709b0a1a1c67c98646e73cccd9ffe..5447d254f4cb47398a2287815336cd2510232f26
100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -240,6 +240,7 @@ function SetForEach(f, receiver) {
// Set up the non-enumerable functions on the Set prototype object.
InstallGetter(GlobalSet.prototype, "size", SetGetSize);
+%FunctionSetName(SetGetSize, "get size");
InstallFunctions(GlobalSet.prototype, DONT_ENUM, [
"add", SetAdd,
"has", SetHas,
@@ -428,6 +429,7 @@ function MapForEach(f, receiver) {
// Set up the non-enumerable functions on the Map prototype object.
InstallGetter(GlobalMap.prototype, "size", MapGetSize);
+%FunctionSetName(MapGetSize, "get size");
InstallFunctions(GlobalMap.prototype, DONT_ENUM, [
"get", MapGet,
"set", MapSet,
Index: test/mjsunit/es6/collections.js
diff --git a/test/mjsunit/es6/collections.js
b/test/mjsunit/es6/collections.js
index
e1e7758b1a89e616e47c89483f1a56cd0979b677..e410e2259c8624b460a9f9874ea692def675b45c
100644
--- a/test/mjsunit/es6/collections.js
+++ b/test/mjsunit/es6/collections.js
@@ -443,6 +443,7 @@ assertTrue(setSizeDescriptor.get instanceof Function);
assertEquals(undefined, setSizeDescriptor.get.prototype);
assertFalse(setSizeDescriptor.enumerable);
assertTrue(setSizeDescriptor.configurable);
+assertEquals('get size', setSizeDescriptor.get.name);
var s = new Set();
assertFalse(s.hasOwnProperty('size'));
@@ -463,6 +464,7 @@ assertTrue(mapSizeDescriptor.get instanceof Function);
assertEquals(undefined, mapSizeDescriptor.get.prototype);
assertFalse(mapSizeDescriptor.enumerable);
assertTrue(mapSizeDescriptor.configurable);
+assertEquals('get size', mapSizeDescriptor.get.name);
var m = new Map();
assertFalse(m.hasOwnProperty('size'));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.