mirror of
https://github.com/bellard/quickjs.git
synced 2024-11-22 13:48:11 +08:00
Add JS_SetPropertyFunctionList2()
This commit is contained in:
parent
6e2e68fd08
commit
93d1ab715b
19
quickjs.c
19
quickjs.c
@ -36998,6 +36998,25 @@ void JS_SetPropertyFunctionList(JSContext *ctx, JSValueConst obj,
|
||||
}
|
||||
}
|
||||
|
||||
int JS_SetPropertyFunctionList2(JSContext *ctx, JSValueConst obj,
|
||||
const JSCFunctionListEntry *tab, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
const JSCFunctionListEntry *e = &tab[i];
|
||||
JSAtom atom = find_atom(ctx, e->name);
|
||||
if (atom == JS_ATOM_NULL)
|
||||
return -1;
|
||||
if (JS_InstantiateFunctionListItem(ctx, obj, atom, e) < 0) {
|
||||
JS_FreeAtom(ctx, atom);
|
||||
return -1;
|
||||
}
|
||||
JS_FreeAtom(ctx, atom);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int JS_AddModuleExportList(JSContext *ctx, JSModuleDef *m,
|
||||
const JSCFunctionListEntry *tab, int len)
|
||||
{
|
||||
|
@ -1060,6 +1060,10 @@ typedef struct JSCFunctionListEntry {
|
||||
void JS_SetPropertyFunctionList(JSContext *ctx, JSValueConst obj,
|
||||
const JSCFunctionListEntry *tab,
|
||||
int len);
|
||||
/* same as JS_SetPropertyFunctionList() returns -1 if exception, 0 if OK */
|
||||
int JS_SetPropertyFunctionList2(JSContext *ctx, JSValueConst obj,
|
||||
const JSCFunctionListEntry *tab,
|
||||
int len);
|
||||
|
||||
/* C module definition */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user