Add JS_GetLength

This commit is contained in:
Icemic 2024-05-23 23:52:02 +08:00 committed by Charlie Gordon
parent 9a2a246b51
commit 569f51fba2
2 changed files with 5 additions and 0 deletions

View file

@ -6970,6 +6970,10 @@ static JSValue JS_GetPrototypeFree(JSContext *ctx, JSValue obj)
return obj1; return obj1;
} }
int JS_GetLength(JSContext *ctx, JSValue obj, int64_t *pres) {
return js_get_length64(ctx, pres, obj);
}
/* return TRUE, FALSE or (-1) in case of exception */ /* return TRUE, FALSE or (-1) in case of exception */
static int JS_OrdinaryIsInstanceOf(JSContext *ctx, JSValue val, static int JS_OrdinaryIsInstanceOf(JSContext *ctx, JSValue val,
JSValue obj) JSValue obj)

View file

@ -694,6 +694,7 @@ JS_EXTERN int JS_PreventExtensions(JSContext *ctx, JSValue obj);
JS_EXTERN int JS_DeleteProperty(JSContext *ctx, JSValue obj, JSAtom prop, int flags); JS_EXTERN int JS_DeleteProperty(JSContext *ctx, JSValue obj, JSAtom prop, int flags);
JS_EXTERN int JS_SetPrototype(JSContext *ctx, JSValue obj, JSValue proto_val); JS_EXTERN int JS_SetPrototype(JSContext *ctx, JSValue obj, JSValue proto_val);
JS_EXTERN JSValue JS_GetPrototype(JSContext *ctx, JSValue val); JS_EXTERN JSValue JS_GetPrototype(JSContext *ctx, JSValue val);
JS_EXTERN int JS_GetLength(JSContext *ctx, JSValue obj, int64_t *pres);
#define JS_GPN_STRING_MASK (1 << 0) #define JS_GPN_STRING_MASK (1 << 0)
#define JS_GPN_SYMBOL_MASK (1 << 1) #define JS_GPN_SYMBOL_MASK (1 << 1)