Skip to content

Commit 0a893c7

Browse files
harumazzzsaghul
authored andcommitted
Add JS_IsWeakRef function
1 parent 3c78c95 commit 0a893c7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

quickjs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10275,6 +10275,13 @@ bool JS_IsSet(JSValueConst val)
1027510275
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_SET;
1027610276
}
1027710277

10278+
bool JS_IsWeakRef(JSValueConst val)
10279+
{
10280+
if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT)
10281+
return false;
10282+
return JS_VALUE_GET_OBJ(val)->class_id == JS_CLASS_WEAK_REF;
10283+
}
10284+
1027810285
bool JS_IsError(JSContext *ctx, JSValueConst val)
1027910286
{
1028010287
JSObject *p;

quickjs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ JS_EXTERN bool JS_SetConstructorBit(JSContext *ctx, JSValueConst func_obj, bool
832832
JS_EXTERN bool JS_IsRegExp(JSValueConst val);
833833
JS_EXTERN bool JS_IsMap(JSValueConst val);
834834
JS_EXTERN bool JS_IsSet(JSValueConst val);
835+
JS_EXTERN bool JS_IsWeakRef(JSValueConst val);
835836

836837
JS_EXTERN JSValue JS_NewArray(JSContext *ctx);
837838
// takes ownership of the values

0 commit comments

Comments
 (0)