diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2025-04-28 16:33:14 +0200 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2025-04-28 16:33:14 +0200 |
commit | 9bb1d7252bfe2f86f5e213711497208ece3dc311 (patch) | |
tree | 055f2894b3baddb3c0e1f6231d95ad839d87928f | |
parent | 2d4e1cc20cc7c1fe234d0d03857758a787a9c6f6 (diff) | |
download | quickjs-9bb1d7252bfe2f86f5e213711497208ece3dc311.tar.gz quickjs-9bb1d7252bfe2f86f5e213711497208ece3dc311.zip |
fixed operation order in js_obj_to_desc()
-rw-r--r-- | quickjs.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -37330,6 +37330,14 @@ static int js_obj_to_desc(JSContext *ctx, JSPropertyDescriptor *d, val = JS_UNDEFINED; getter = JS_UNDEFINED; setter = JS_UNDEFINED; + if (JS_HasProperty(ctx, desc, JS_ATOM_enumerable)) { + JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_enumerable); + if (JS_IsException(prop)) + goto fail; + flags |= JS_PROP_HAS_ENUMERABLE; + if (JS_ToBoolFree(ctx, prop)) + flags |= JS_PROP_ENUMERABLE; + } if (JS_HasProperty(ctx, desc, JS_ATOM_configurable)) { JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_configurable); if (JS_IsException(prop)) @@ -37338,6 +37346,12 @@ static int js_obj_to_desc(JSContext *ctx, JSPropertyDescriptor *d, if (JS_ToBoolFree(ctx, prop)) flags |= JS_PROP_CONFIGURABLE; } + if (JS_HasProperty(ctx, desc, JS_ATOM_value)) { + flags |= JS_PROP_HAS_VALUE; + val = JS_GetProperty(ctx, desc, JS_ATOM_value); + if (JS_IsException(val)) + goto fail; + } if (JS_HasProperty(ctx, desc, JS_ATOM_writable)) { JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_writable); if (JS_IsException(prop)) @@ -37346,20 +37360,6 @@ static int js_obj_to_desc(JSContext *ctx, JSPropertyDescriptor *d, if (JS_ToBoolFree(ctx, prop)) flags |= JS_PROP_WRITABLE; } - if (JS_HasProperty(ctx, desc, JS_ATOM_enumerable)) { - JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_enumerable); - if (JS_IsException(prop)) - goto fail; - flags |= JS_PROP_HAS_ENUMERABLE; - if (JS_ToBoolFree(ctx, prop)) - flags |= JS_PROP_ENUMERABLE; - } - if (JS_HasProperty(ctx, desc, JS_ATOM_value)) { - flags |= JS_PROP_HAS_VALUE; - val = JS_GetProperty(ctx, desc, JS_ATOM_value); - if (JS_IsException(val)) - goto fail; - } if (JS_HasProperty(ctx, desc, JS_ATOM_get)) { flags |= JS_PROP_HAS_GET; getter = JS_GetProperty(ctx, desc, JS_ATOM_get); |