mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Don't share class functions across Set and Map
Map has groupBy and Set doesn't. Fixes: https://github.com/quickjs-ng/quickjs/issues/714
This commit is contained in:
parent
81e50f3cae
commit
4ca6d9bba0
1 changed files with 14 additions and 8 deletions
20
quickjs.c
20
quickjs.c
|
@ -48318,6 +48318,10 @@ static const JSCFunctionListEntry js_map_funcs[] = {
|
|||
JS_CGETSET_DEF("[Symbol.species]", js_get_this, NULL ),
|
||||
};
|
||||
|
||||
static const JSCFunctionListEntry js_set_funcs[] = {
|
||||
JS_CGETSET_DEF("[Symbol.species]", js_get_this, NULL ),
|
||||
};
|
||||
|
||||
static const JSCFunctionListEntry js_map_proto_funcs[] = {
|
||||
JS_CFUNC_MAGIC_DEF("set", 2, js_map_set, 0 ),
|
||||
JS_CFUNC_MAGIC_DEF("get", 1, js_map_get, 0 ),
|
||||
|
@ -48406,17 +48410,19 @@ void JS_AddIntrinsicMapSet(JSContext *ctx)
|
|||
for(i = 0; i < 4; i++) {
|
||||
const char *name = JS_AtomGetStr(ctx, buf, sizeof(buf),
|
||||
JS_ATOM_Map + i);
|
||||
ctx->class_proto[JS_CLASS_MAP + i] = JS_NewObject(ctx);
|
||||
JS_SetPropertyFunctionList(ctx, ctx->class_proto[JS_CLASS_MAP + i],
|
||||
int class_id = JS_CLASS_MAP + i;
|
||||
ctx->class_proto[class_id] = JS_NewObject(ctx);
|
||||
JS_SetPropertyFunctionList(ctx, ctx->class_proto[class_id],
|
||||
js_map_proto_funcs_ptr[i],
|
||||
js_map_proto_funcs_count[i]);
|
||||
obj1 = JS_NewCFunctionMagic(ctx, js_map_constructor, name, 0,
|
||||
JS_CFUNC_constructor_magic, i);
|
||||
if (i < 2) {
|
||||
JS_SetPropertyFunctionList(ctx, obj1, js_map_funcs,
|
||||
countof(js_map_funcs));
|
||||
}
|
||||
JS_NewGlobalCConstructor2(ctx, obj1, name, ctx->class_proto[JS_CLASS_MAP + i]);
|
||||
if (class_id == JS_CLASS_MAP)
|
||||
JS_SetPropertyFunctionList(ctx, obj1, js_map_funcs, countof(js_map_funcs));
|
||||
else if (class_id == JS_CLASS_SET)
|
||||
JS_SetPropertyFunctionList(ctx, obj1, js_set_funcs, countof(js_set_funcs));
|
||||
|
||||
JS_NewGlobalCConstructor2(ctx, obj1, name, ctx->class_proto[class_id]);
|
||||
}
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
|
|
Loading…
Reference in a new issue