]> git.kaiwu.me - quickjs.git/commitdiff
Fix the stack depth of an optional call through a with scope
authorFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 14:10:43 +0000 (15:10 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 14:10:43 +0000 (15:10 +0100)
quickjs.c

index cd8fe1b5e0bd1810c3dcdb9f716e350cb07deea2..9e905333bfb371004bc6dbe08001d3dfadac58db 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -27892,6 +27892,7 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags)
                         int scope;
                         name = get_u32(fd->byte_code.buf + fd->last_opcode_pos + 1);
                         scope = get_u16(fd->byte_code.buf + fd->last_opcode_pos + 5);
+                        drop_count = 1;
                         if (name == JS_ATOM_eval && call_type == FUNC_CALL_NORMAL && !has_optional_chain) {
                             /* direct 'eval' */
                             opcode = OP_eval;
@@ -27907,9 +27908,9 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags)
                             if (has_with_scope(fd, scope)) {
                                 opcode = OP_scope_get_ref;
                                 fd->byte_code.buf[fd->last_opcode_pos] = opcode;
+                                drop_count = 2;
                             }
                         }
-                        drop_count = 1;
                     }
                     break;
                 case OP_get_super_value: