]> git.kaiwu.me - quickjs.git/commitdiff
fixed exception handling in put_var operation (regression introduced by commit a6816b...
authorFabrice Bellard <fabrice@bellard.org>
Wed, 5 Nov 2025 10:29:03 +0000 (11:29 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Wed, 5 Nov 2025 10:29:03 +0000 (11:29 +0100)
quickjs.c

index 66880f1969892450693dfa2f723d283cab822255..bb818445e40d9d917cc6c932769636b532d7c3eb 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -18011,14 +18011,15 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj,
                         }
                         ret = JS_SetPropertyInternal(ctx, ctx->global_obj, cv->var_name, sp[-1],
                                                      ctx->global_obj, JS_PROP_THROW_STRICT);
+                        sp--;
                         if (ret < 0)
                             goto exception;
                     }
                 } else {
                 put_var_ok:
                    set_value(ctx, var_ref->pvalue, sp[-1]);
+                   sp--;
                 }
-                sp--;
             }
             BREAK;
         CASE(OP_get_loc):