]> git.kaiwu.me - quickjs.git/commitdiff
Fix missing module exports for array destructuring (Divy Srivastava)
authorFabrice Bellard <fabrice@bellard.org>
Tue, 24 Nov 2026 17:15:25 +0000 (18:15 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Tue, 24 Nov 2026 17:15:25 +0000 (18:15 +0100)
quickjs.c

index 9b5dd551258c92b5bab4f37e29696d3243a6da69..b9bf0e7ffc41caa06d1e47252b923196a4c30af1 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -27486,6 +27486,11 @@ static int js_parse_destructuring_element(JSParseState *s, int tok, int is_arg,
                         goto var_error;
                     if (js_define_var(s, var_name, tok))
                         goto var_error;
+                    if (export_flag) {
+                        if (!add_export_entry(s, s->cur_func->module, var_name, var_name,
+                                              JS_EXPORT_TYPE_LOCAL))
+                            goto var_error;
+                    }
                     if (need_var_reference(s, tok)) {
                         /* Must make a reference for proper `with` semantics */
                         emit_op(s, OP_scope_get_var);