summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-04-22 18:56:59 +0200
committerFabrice Bellard <fabrice@bellard.org>2025-04-22 18:56:59 +0200
commit5afd0eb37b270bedbef2a66efd5d3925d6b820bb (patch)
treebe8275a00c312c49a5788e5a0be3cce4e6e1b7aa
parent5e71d148f229f9a5ee6824902366844178026966 (diff)
downloadquickjs-5afd0eb37b270bedbef2a66efd5d3925d6b820bb.tar.gz
quickjs-5afd0eb37b270bedbef2a66efd5d3925d6b820bb.zip
fix property ordering in the object returned by RegExp.prototype.exec()
-rw-r--r--quickjs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/quickjs.c b/quickjs.c
index e3e3074..89e8501 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -44108,12 +44108,6 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
goto fail;
}
- t = groups, groups = JS_UNDEFINED;
- if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_groups,
- t, prop_flags) < 0) {
- goto fail;
- }
-
t = JS_NewInt32(ctx, (capture[0] - str_buf) >> shift);
if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_index, t, prop_flags) < 0)
goto fail;
@@ -44122,6 +44116,12 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_input, t, prop_flags) < 0)
goto fail;
+ t = groups, groups = JS_UNDEFINED;
+ if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_groups,
+ t, prop_flags) < 0) {
+ goto fail;
+ }
+
if (!JS_IsUndefined(indices)) {
t = indices_groups, indices_groups = JS_UNDEFINED;
if (JS_DefinePropertyValue(ctx, indices, JS_ATOM_groups,