diff --git a/quickjs.c b/quickjs.c index 8735a64..2000b2f 100644 --- a/quickjs.c +++ b/quickjs.c @@ -7124,9 +7124,9 @@ static int JS_AutoInitProperty(JSContext *ctx, JSObject *p, JSAtom prop, return 0; } -JSValue JS_GetPropertyInternal2(JSContext *ctx, JSValue obj, - JSAtom prop, JSValue this_obj, - JSInlineCache* ic, BOOL throw_ref_error) +static JSValue JS_GetPropertyInternal2(JSContext *ctx, JSValue obj, + JSAtom prop, JSValue this_obj, + JSInlineCache* ic, BOOL throw_ref_error) { JSObject *p; JSProperty *pr; @@ -7276,13 +7276,17 @@ JSValue JS_GetPropertyInternal2(JSContext *ctx, JSValue obj, } } -JSValue JS_GetPropertyInternal(JSContext *ctx, JSValue obj, - JSAtom prop, JSValue this_obj, - BOOL throw_ref_error) +static JSValue JS_GetPropertyInternal(JSContext *ctx, JSValue obj, + JSAtom prop, JSValue this_obj, + BOOL throw_ref_error) { return JS_GetPropertyInternal2(ctx, obj, prop, this_obj, NULL, throw_ref_error); } +JSValue JS_GetProperty(JSContext *ctx, JSValue this_obj, JSAtom prop) +{ + return JS_GetPropertyInternal2(ctx, this_obj, prop, this_obj, NULL, FALSE); +} static JSValue JS_GetPropertyInternalWithIC(JSContext *ctx, JSValue obj, JSAtom prop, JSValue this_obj, @@ -8412,9 +8416,9 @@ static void js_free_desc(JSContext *ctx, JSPropertyDescriptor *desc) the new property is not added and an error is raised. 'obj' must be an object when obj != this_obj. */ -int JS_SetPropertyInternal2(JSContext *ctx, JSValue obj, - JSAtom prop, JSValue val, JSValue this_obj, - int flags, JSInlineCache *ic) +static int JS_SetPropertyInternal2(JSContext *ctx, JSValue obj, + JSAtom prop, JSValue val, JSValue this_obj, + int flags, JSInlineCache *ic) { JSObject *p, *p1; JSShapeProperty *prs; @@ -8665,13 +8669,18 @@ fail: return -1; } -int JS_SetPropertyInternal(JSContext *ctx, JSValue this_obj, - JSAtom prop, JSValue val, int flags) +static int JS_SetPropertyInternal(JSContext *ctx, JSValue this_obj, + JSAtom prop, JSValue val, int flags) { return JS_SetPropertyInternal2(ctx, this_obj, prop, val, this_obj, flags, NULL); } +int JS_SetProperty(JSContext *ctx, JSValue this_obj, JSAtom prop, JSValue val) +{ + return JS_SetPropertyInternal2(ctx, this_obj, prop, val, this_obj, JS_PROP_THROW, NULL); +} + static int JS_SetPropertyInternalWithIC(JSContext *ctx, JSValue this_obj, JSAtom prop, JSValue val, int flags, JSInlineCache *ic, int32_t offset) { diff --git a/quickjs.h b/quickjs.h index 4be4776..f27ba25 100644 --- a/quickjs.h +++ b/quickjs.h @@ -656,27 +656,14 @@ JS_EXTERN int JS_IsArray(JSContext *ctx, JSValue val); JS_EXTERN JSValue JS_NewDate(JSContext *ctx, double epoch_ms); -JS_EXTERN JSValue JS_GetPropertyInternal(JSContext *ctx, JSValue obj, - JSAtom prop, JSValue receiver, - JS_BOOL throw_ref_error); -static js_force_inline JSValue JS_GetProperty(JSContext *ctx, JSValue this_obj, - JSAtom prop) -{ - return JS_GetPropertyInternal(ctx, this_obj, prop, this_obj, 0); -} +JS_EXTERN JSValue JS_GetProperty(JSContext *ctx, JSValue this_obj, JSAtom prop); JS_EXTERN JSValue JS_GetPropertyStr(JSContext *ctx, JSValue this_obj, const char *prop); JS_EXTERN JSValue JS_GetPropertyUint32(JSContext *ctx, JSValue this_obj, uint32_t idx); -int JS_SetPropertyInternal(JSContext *ctx, JSValue this_obj, - JSAtom prop, JSValue val, - int flags); -static inline int JS_SetProperty(JSContext *ctx, JSValue this_obj, - JSAtom prop, JSValue val) -{ - return JS_SetPropertyInternal(ctx, this_obj, prop, val, JS_PROP_THROW); -} +JS_EXTERN int JS_SetProperty(JSContext *ctx, JSValue this_obj, + JSAtom prop, JSValue val); JS_EXTERN int JS_SetPropertyUint32(JSContext *ctx, JSValue this_obj, uint32_t idx, JSValue val); JS_EXTERN int JS_SetPropertyInt64(JSContext *ctx, JSValue this_obj,