-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathgetclassid.patch
More file actions
31 lines (29 loc) · 896 Bytes
/
Copy pathgetclassid.patch
File metadata and controls
31 lines (29 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/quickjs/quickjs.c b/quickjs/quickjs.c
index 48aeffc62..8afc4caa1 100644
--- a/quickjs/quickjs.c
+++ b/quickjs/quickjs.c
@@ -54034,3 +54034,14 @@ void JS_AddIntrinsicTypedArrays(JSContext *ctx)
JS_AddIntrinsicAtomics(ctx);
#endif
}
+
+JSClassID JS_GetClassID(JSValueConst v)
+{
+ JSObject *p;
+
+ if (JS_VALUE_GET_TAG(v) != JS_TAG_OBJECT)
+ return 0;
+ p = JS_VALUE_GET_OBJ(v);
+ assert(p != 0);
+ return p->class_id;
+}
diff --git a/quickjs/quickjs.h b/quickjs/quickjs.h
index d4a5cd311..054019147 100644
--- a/quickjs/quickjs.h
+++ b/quickjs/quickjs.h
@@ -497,6 +497,7 @@ typedef struct JSClassDef {
} JSClassDef;
JSClassID JS_NewClassID(JSClassID *pclass_id);
+JSClassID JS_GetClassID(JSValueConst v);
int JS_NewClass(JSRuntime *rt, JSClassID class_id, const JSClassDef *class_def);
int JS_IsRegisteredClass(JSRuntime *rt, JSClassID class_id);