From 756ac1277b8e19769827dd08a764105e4c4720a6 Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 27 Jun 2023 22:56:47 +0200 Subject: Remove getClassID hack Add a JS_GetClassID function to QJS instead. --- lib/quickjs/quickjs.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/quickjs/quickjs.c') diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c index 2d50e247..52f1d159 100644 --- a/lib/quickjs/quickjs.c +++ b/lib/quickjs/quickjs.c @@ -9886,6 +9886,15 @@ void *JS_GetOpaque2(JSContext *ctx, JSValueConst obj, JSClassID class_id) return p; } +JSClassID JS_GetClassID(JSValueConst obj) +{ + JSObject *p; + if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) + return 0; + p = JS_VALUE_GET_OBJ(obj); + return p->class_id; +} + #define HINT_STRING 0 #define HINT_NUMBER 1 #define HINT_NONE 2 -- cgit 1.4.1-2-gfad0