Skip to content

Commit 3b8a316

Browse files
committed
Don't share class functions across Set and Map
Map has groupBy and Set doesn't. Fixes: #714
1 parent ef15418 commit 3b8a316

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

quickjs.c

+9-4
Original file line numberDiff line numberDiff line change
@@ -48318,6 +48318,10 @@ static const JSCFunctionListEntry js_map_funcs[] = {
4831848318
JS_CGETSET_DEF("[Symbol.species]", js_get_this, NULL ),
4831948319
};
4832048320

48321+
static const JSCFunctionListEntry js_set_funcs[] = {
48322+
JS_CGETSET_DEF("[Symbol.species]", js_get_this, NULL ),
48323+
};
48324+
4832148325
static const JSCFunctionListEntry js_map_proto_funcs[] = {
4832248326
JS_CFUNC_MAGIC_DEF("set", 2, js_map_set, 0 ),
4832348327
JS_CFUNC_MAGIC_DEF("get", 1, js_map_get, 0 ),
@@ -48412,10 +48416,11 @@ void JS_AddIntrinsicMapSet(JSContext *ctx)
4841248416
js_map_proto_funcs_count[i]);
4841348417
obj1 = JS_NewCFunctionMagic(ctx, js_map_constructor, name, 0,
4841448418
JS_CFUNC_constructor_magic, i);
48415-
if (i < 2) {
48416-
JS_SetPropertyFunctionList(ctx, obj1, js_map_funcs,
48417-
countof(js_map_funcs));
48418-
}
48419+
if (i == 0)
48420+
JS_SetPropertyFunctionList(ctx, obj1, js_map_funcs, countof(js_map_funcs));
48421+
else if (i == 1)
48422+
JS_SetPropertyFunctionList(ctx, obj1, js_set_funcs, countof(js_set_funcs));
48423+
4841948424
JS_NewGlobalCConstructor2(ctx, obj1, name, ctx->class_proto[JS_CLASS_MAP + i]);
4842048425
}
4842148426

0 commit comments

Comments
 (0)