about summary refs log tree commit diff stats
path: root/lib/quickjs/quickjs.c
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-11-30 22:21:26 +0100
committerbptato <nincsnevem662@gmail.com>2023-11-30 22:28:57 +0100
commitd3a32a80fc8b6111d9e87f0f9eaa4254ef895868 (patch)
tree6cc0ecc3a0bab48881220ecf9c4802adb4be5177 /lib/quickjs/quickjs.c
parent06326cdd0ef3381a5d4fe621c10b2754225bb0c8 (diff)
downloadchawan-d3a32a80fc8b6111d9e87f0f9eaa4254ef895868.tar.gz
js: simplify toJSP0
* Expose js_create_from_ctor from QuickJS and directly use that (instead
  of badly recreating it)
* Do not call defineUnforgeable twice (it is inevitably called in toJSP0,
  so jsctor does not need it)
Diffstat (limited to 'lib/quickjs/quickjs.c')
-rw-r--r--lib/quickjs/quickjs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c
index 697ced39..aea545a6 100644
--- a/lib/quickjs/quickjs.c
+++ b/lib/quickjs/quickjs.c
@@ -18908,6 +18908,12 @@ static JSValue js_create_from_ctor(JSContext *ctx, JSValueConst ctor,
     return obj;
 }
 
+JSValue JS_NewObjectFromCtor(JSContext *ctx, JSValueConst ctor,
+                             JSClassID class_id)
+{
+    return js_create_from_ctor(ctx, ctor, class_id);
+}
+
 /* argv[] is modified if (flags & JS_CALL_FLAG_COPY_ARGV) = 0. */
 static JSValue JS_CallConstructorInternal(JSContext *ctx,
                                           JSValueConst func_obj,