]> git.kaiwu.me - quickjs.git/commitdiff
added JS_CFUNC_constructor_or_func_flags
authorFabrice Bellard <fabrice@bellard.org>
Sat, 10 Oct 2026 14:42:02 +0000 (16:42 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 10 Oct 2026 14:42:02 +0000 (16:42 +0200)
quickjs.c
quickjs.h

index 9708737cd02fdaae7b42e46560064c75020066e3..8fec2f2812b2ecf12c3bf38416f7a12d613724fe 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -5997,7 +5997,8 @@ static JSValue JS_NewCFunction3(JSContext *ctx, JSCFunction *func,
     p->is_constructor = (cproto == JS_CFUNC_constructor ||
                          cproto == JS_CFUNC_constructor_magic ||
                          cproto == JS_CFUNC_constructor_or_func ||
-                         cproto == JS_CFUNC_constructor_or_func_magic);
+                         cproto == JS_CFUNC_constructor_or_func_magic ||
+                         cproto == JS_CFUNC_constructor_or_func_flags);
     if (!name)
         name = "";
     name_atom = JS_NewAtom(ctx, name);
@@ -17785,6 +17786,9 @@ static JSValue js_call_c_function(JSContext *ctx, JSValueConst func_obj,
     case JS_CFUNC_generic:
         ret_val = func.generic(ctx, this_obj, argc, arg_buf);
         break;
+    case JS_CFUNC_constructor_or_func_flags:
+        ret_val = func.constructor_or_func_flags(ctx, func_obj, this_obj, argc, arg_buf, flags);
+        break;
     case JS_CFUNC_constructor_magic:
     case JS_CFUNC_constructor_or_func_magic:
         if (!(flags & JS_CALL_FLAG_CONSTRUCTOR)) {
index e0ce63ae7c1eb2b679824b5927ba5883617887f0..069097a462706bc721a02402da1258b839f57ae7 100644 (file)
--- a/quickjs.h
+++ b/quickjs.h
@@ -1033,6 +1033,7 @@ typedef enum JSCFunctionEnum {  /* XXX: should rename for namespace isolation */
     JS_CFUNC_constructor_magic,
     JS_CFUNC_constructor_or_func,
     JS_CFUNC_constructor_or_func_magic,
+    JS_CFUNC_constructor_or_func_flags,
     JS_CFUNC_f_f,
     JS_CFUNC_f_f_f,
     JS_CFUNC_getter,
@@ -1048,6 +1049,7 @@ typedef union JSCFunctionType {
     JSCFunction *constructor;
     JSValue (*constructor_magic)(JSContext *ctx, JSValueConst new_target, int argc, JSValueConst *argv, int magic);
     JSCFunction *constructor_or_func;
+    JSValue (*constructor_or_func_flags)(JSContext *ctx, JSValueConst func_obj, JSValueConst this_val, int argc, JSValueConst *argv, int flags);
     double (*f_f)(double);
     double (*f_f_f)(double, double);
     JSValue (*getter)(JSContext *ctx, JSValueConst this_val);