From d3a32a80fc8b6111d9e87f0f9eaa4254ef895868 Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 30 Nov 2023 22:21:26 +0100 Subject: 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) --- lib/quickjs/quickjs.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/quickjs/quickjs.c') 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, -- cgit 1.4.1-2-gfad0