Skip to content

Commit ab95121

Browse files
committed
[JSC] Fix Map.groupBy and Object.groupBy callback arguments
https://bugs.webkit.org/show_bug.cgi?id=263308 rdar://117120234 Reviewed by Alexey Shvayka. This patch adjusts Map.groupBy / Object.groupBy's callback arguments to the latest proposal[1]. [1]: https://github.com/tc39/proposal-array-grouping * JSTests/test262/expectations.yaml: * Source/JavaScriptCore/builtins/MapConstructor.js: (groupBy): * Source/JavaScriptCore/builtins/ObjectConstructor.js: (groupBy): Canonical link: https://commits.webkit.org/269456@main
1 parent 9948a5b commit ab95121

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

JSTests/test262/expectations.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,9 @@ test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js:
175175
test/built-ins/Function/prototype/toString/built-in-function-object.js:
176176
default: 'Test262Error: Conforms to NativeFunction Syntax: "function $*() {\n [native code]\n}" (%RegExp%.$*)'
177177
strict mode: 'Test262Error: Conforms to NativeFunction Syntax: "function $*() {\n [native code]\n}" (%RegExp%.$*)'
178-
test/built-ins/Map/groupBy/callback-arg.js:
179-
default: 'Test262Error: only two arguments are passed Expected SameValue(«3», «2») to be true'
180-
strict mode: 'Test262Error: only two arguments are passed Expected SameValue(«3», «2») to be true'
181178
test/built-ins/Object/entries/order-after-define-property-with-function.js:
182179
default: 'Test262Error: Expected [a, name] and [name, a] to have the same contents. '
183180
strict mode: 'Test262Error: Expected [a, name] and [name, a] to have the same contents. '
184-
test/built-ins/Object/groupBy/callback-arg.js:
185-
default: 'Test262Error: only two arguments are passed Expected SameValue(«3», «2») to be true'
186-
strict mode: 'Test262Error: only two arguments are passed Expected SameValue(«3», «2») to be true'
187181
test/built-ins/Object/keys/order-after-define-property-with-function.js:
188182
default: 'Test262Error: Expected [a, length] and [length, a] to have the same contents. '
189183
strict mode: 'Test262Error: Expected [a, length] and [length, a] to have the same contents. '

Source/JavaScriptCore/builtins/MapConstructor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function groupBy(items, callback)
3636
var groups = new @Map;
3737
var k = 0;
3838
for (var item of items) {
39-
var key = callback.@call(@undefined, item, k, items);
39+
var key = callback.@call(@undefined, item, k);
4040
var group = groups.@get(key);
4141
if (!group) {
4242
group = [];

Source/JavaScriptCore/builtins/ObjectConstructor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function groupBy(items, callback)
5656
var groups = @Object.@create(null);
5757
var k = 0;
5858
for (var item of items) {
59-
var key = @toPropertyKey(callback.@call(@undefined, item, k, items));
59+
var key = @toPropertyKey(callback.@call(@undefined, item, k));
6060
var group = groups[key];
6161
if (!group) {
6262
group = [];

0 commit comments

Comments
 (0)