mirror of
https://github.com/bellard/quickjs.git
synced 2025-05-15 18:52:00 +08:00
fixed operation order in js_obj_to_desc()
This commit is contained in:
parent
2d4e1cc20c
commit
9bb1d7252b
32
quickjs.c
32
quickjs.c
@ -37330,22 +37330,6 @@ static int js_obj_to_desc(JSContext *ctx, JSPropertyDescriptor *d,
|
|||||||
val = JS_UNDEFINED;
|
val = JS_UNDEFINED;
|
||||||
getter = JS_UNDEFINED;
|
getter = JS_UNDEFINED;
|
||||||
setter = JS_UNDEFINED;
|
setter = JS_UNDEFINED;
|
||||||
if (JS_HasProperty(ctx, desc, JS_ATOM_configurable)) {
|
|
||||||
JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_configurable);
|
|
||||||
if (JS_IsException(prop))
|
|
||||||
goto fail;
|
|
||||||
flags |= JS_PROP_HAS_CONFIGURABLE;
|
|
||||||
if (JS_ToBoolFree(ctx, prop))
|
|
||||||
flags |= JS_PROP_CONFIGURABLE;
|
|
||||||
}
|
|
||||||
if (JS_HasProperty(ctx, desc, JS_ATOM_writable)) {
|
|
||||||
JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_writable);
|
|
||||||
if (JS_IsException(prop))
|
|
||||||
goto fail;
|
|
||||||
flags |= JS_PROP_HAS_WRITABLE;
|
|
||||||
if (JS_ToBoolFree(ctx, prop))
|
|
||||||
flags |= JS_PROP_WRITABLE;
|
|
||||||
}
|
|
||||||
if (JS_HasProperty(ctx, desc, JS_ATOM_enumerable)) {
|
if (JS_HasProperty(ctx, desc, JS_ATOM_enumerable)) {
|
||||||
JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_enumerable);
|
JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_enumerable);
|
||||||
if (JS_IsException(prop))
|
if (JS_IsException(prop))
|
||||||
@ -37354,12 +37338,28 @@ static int js_obj_to_desc(JSContext *ctx, JSPropertyDescriptor *d,
|
|||||||
if (JS_ToBoolFree(ctx, prop))
|
if (JS_ToBoolFree(ctx, prop))
|
||||||
flags |= JS_PROP_ENUMERABLE;
|
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))
|
||||||
|
goto fail;
|
||||||
|
flags |= JS_PROP_HAS_CONFIGURABLE;
|
||||||
|
if (JS_ToBoolFree(ctx, prop))
|
||||||
|
flags |= JS_PROP_CONFIGURABLE;
|
||||||
|
}
|
||||||
if (JS_HasProperty(ctx, desc, JS_ATOM_value)) {
|
if (JS_HasProperty(ctx, desc, JS_ATOM_value)) {
|
||||||
flags |= JS_PROP_HAS_VALUE;
|
flags |= JS_PROP_HAS_VALUE;
|
||||||
val = JS_GetProperty(ctx, desc, JS_ATOM_value);
|
val = JS_GetProperty(ctx, desc, JS_ATOM_value);
|
||||||
if (JS_IsException(val))
|
if (JS_IsException(val))
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
if (JS_HasProperty(ctx, desc, JS_ATOM_writable)) {
|
||||||
|
JSValue prop = JS_GetProperty(ctx, desc, JS_ATOM_writable);
|
||||||
|
if (JS_IsException(prop))
|
||||||
|
goto fail;
|
||||||
|
flags |= JS_PROP_HAS_WRITABLE;
|
||||||
|
if (JS_ToBoolFree(ctx, prop))
|
||||||
|
flags |= JS_PROP_WRITABLE;
|
||||||
|
}
|
||||||
if (JS_HasProperty(ctx, desc, JS_ATOM_get)) {
|
if (JS_HasProperty(ctx, desc, JS_ATOM_get)) {
|
||||||
flags |= JS_PROP_HAS_GET;
|
flags |= JS_PROP_HAS_GET;
|
||||||
getter = JS_GetProperty(ctx, desc, JS_ATOM_get);
|
getter = JS_GetProperty(ctx, desc, JS_ATOM_get);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user