JS_EXTERN JSValue JS_NewCFunction2(JSContext *ctx, JSCFunction *func,
const char *name, // <-- this one
int length, JSCFunctionEnum cproto, int magic);
...
JS_EXTERN JSValue JS_NewCFunctionData(JSContext *ctx, JSCFunctionData *func,
int length, int magic, int data_len,
JSValueConst *data);
It seems that other variants all accept a name argument, while this one doesn't.
static void js_function_set_properties(JSContext *ctx, JSValue func_obj,
JSAtom name, int len)
{
/* ES6 feature non compatible with ES5.1: length is configurable */
JS_DefinePropertyValue(ctx, func_obj, JS_ATOM_length, js_int32(len),
JS_PROP_CONFIGURABLE);
JS_DefinePropertyValue(ctx, func_obj, JS_ATOM_name, // <-- this one
JS_AtomToString(ctx, name), JS_PROP_CONFIGURABLE);
}
I believe it could be done by inspecting the value of JS_ATOM_name and defining it directly, but it isn't portable though.
It seems that other variants all accept a
nameargument, while this one doesn't.I believe it could be done by inspecting the value of
JS_ATOM_nameand defining it directly, but it isn't portable though.