diff options
author | bptato <nincsnevem662@gmail.com> | 2023-11-30 22:21:26 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-11-30 22:28:57 +0100 |
commit | d3a32a80fc8b6111d9e87f0f9eaa4254ef895868 (patch) | |
tree | 6cc0ecc3a0bab48881220ecf9c4802adb4be5177 /lib | |
parent | 06326cdd0ef3381a5d4fe621c10b2754225bb0c8 (diff) | |
download | chawan-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')
-rw-r--r-- | lib/quickjs/quickjs.c | 6 | ||||
-rw-r--r-- | lib/quickjs/quickjs.h | 2 |
2 files changed, 8 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, diff --git a/lib/quickjs/quickjs.h b/lib/quickjs/quickjs.h index c831e3c8..5e11593b 100644 --- a/lib/quickjs/quickjs.h +++ b/lib/quickjs/quickjs.h @@ -778,6 +778,8 @@ int JS_GetOwnProperty(JSContext *ctx, JSPropertyDescriptor *desc, JSValue JS_Call(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv); +JSValue JS_NewObjectFromCtor(JSContext *ctx, JSValueConst ctor, + JSClassID class_id); JSValue JS_Invoke(JSContext *ctx, JSValueConst this_val, JSAtom atom, int argc, JSValueConst *argv); JSValue JS_CallConstructor(JSContext *ctx, JSValueConst func_obj, |