]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4333: cstack not always passed to where it is needed v8.2.4333
authorBram Moolenaar <Bram@vim.org>
Tue, 8 Feb 2022 21:17:22 +0000 (21:17 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 8 Feb 2022 21:17:22 +0000 (21:17 +0000)
Problem:    cstack not always passed to where it is needed.
Solution:   Pass ctack through functions.

src/eval.c
src/proto/vim9compile.pro
src/proto/vim9script.pro
src/version.c
src/vim9compile.c
src/vim9expr.c
src/vim9script.c

index 2942d0fe1d9bc81876dca236c661f93cf6ba4413..d775ee3f260b82d8d2b60625d878d2ea0947c9be 100644 (file)
@@ -975,7 +975,7 @@ get_lval(
            cc = *p;
            *p = NUL;
            if (find_exported(import->imp_sid, lp->ll_name, &ufunc, &type,
-                                                            NULL, TRUE) == -1)
+                                                      NULL, NULL, TRUE) == -1)
            {
                *p = cc;
                return NULL;
@@ -6056,7 +6056,7 @@ handle_subscript(
            **arg = NUL;
 
            idx = find_exported(rettv->vval.v_number, exp_name, &ufunc, &type,
-                                                 evalarg->eval_cctx, verbose);
+                           evalarg->eval_cctx, evalarg->eval_cstack, verbose);
            **arg = cc;
 
            if (idx < 0 && ufunc == NULL)
index 0790decb8a821ecfe7dddee8d5c4091934033bcb..9effb1744b09719f086724ad35be8b49e5447964 100644 (file)
@@ -7,7 +7,7 @@ int check_defined(char_u *p, size_t len, cctx_T *cctx, cstack_T *cstack, int is_
 int need_type_where(type_T *actual, type_T *expected, int offset, where_T where, cctx_T *cctx, int silent, int actual_is_const);
 int need_type(type_T *actual, type_T *expected, int offset, int arg_idx, cctx_T *cctx, int silent, int actual_is_const);
 lvar_T *reserve_local(cctx_T *cctx, char_u *name, size_t len, int isConst, type_T *type);
-int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx);
+int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx, cstack_T *cstack);
 imported_T *find_imported(char_u *name, size_t len, int load, cctx_T *cctx);
 char_u *may_peek_next_line(cctx_T *cctx, char_u *arg, char_u **nextp);
 char_u *peek_next_line_from_context(cctx_T *cctx);
index 46211ddb09f7f2f014a9ff1bde41c61df0a79f3b..6295dc2cca9979e151efc81d9465ffcffafa3209 100644 (file)
@@ -11,7 +11,7 @@ void ex_export(exarg_T *eap);
 void free_imports_and_script_vars(int sid);
 void mark_imports_for_reload(int sid);
 void ex_import(exarg_T *eap);
-int find_exported(int sid, char_u *name, ufunc_T **ufunc, type_T **type, cctx_T *cctx, int verbose);
+int find_exported(int sid, char_u *name, ufunc_T **ufunc, type_T **type, cctx_T *cctx, cstack_T *cstack, int verbose);
 char_u *vim9_declare_scriptvar(exarg_T *eap, char_u *arg);
 void update_vim9_script_var(int create, dictitem_T *di, char_u *name, int flags, typval_T *tv, type_T **type, int do_member);
 void hide_script_var(scriptitem_T *si, int idx, int func_defined);
index 9f3dfd2f6560a9c583f49d9cf19d191310b36477..a4480e1866dc062387ca8bbf4eefe44966cd3553 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4333,
 /**/
     4332,
 /**/
index 5f80988b80ab483ffbb4c912061f2166c4b71673..265ea665b8c24cab1a0873108267eaf6687babb1 100644 (file)
@@ -532,7 +532,12 @@ check_item_writable(svar_T *sv, int check_writable, char_u *name)
  * If not found or the variable is not writable returns -2.
  */
     int
-get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx)
+get_script_item_idx(
+       int         sid,
+       char_u      *name,
+       int         check_writable,
+       cctx_T      *cctx,
+       cstack_T    *cstack)
 {
     hashtab_T      *ht;
     dictitem_T     *di;
@@ -544,7 +549,7 @@ get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx)
        return -1;
     if (sid == current_sctx.sc_sid)
     {
-       sallvar_T *sav = find_script_var(name, 0, cctx, NULL);
+       sallvar_T *sav = find_script_var(name, 0, cctx, cstack);
 
        if (sav == NULL)
            return -2;
@@ -1449,7 +1454,7 @@ compile_lhs(
                        lhs->lhs_scriptvar_idx = get_script_item_idx(
                                               lhs->lhs_scriptvar_sid, rawname,
                              lhs->lhs_has_index ? ASSIGN_FINAL : ASSIGN_CONST,
-                                                                        cctx);
+                                                                  cctx, NULL);
                        if (lhs->lhs_scriptvar_idx >= 0)
                        {
                            scriptitem_T *si = SCRIPT_ITEM(
index b44f9288d926838bf8a4dfc5dd352eb3f1709550..1e53478a50b6d5a02ae33b27831f5ebf281a4c9d 100644 (file)
@@ -256,7 +256,7 @@ compile_load_scriptvar(
     if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
        return FAIL;
     si = SCRIPT_ITEM(current_sctx.sc_sid);
-    idx = get_script_item_idx(current_sctx.sc_sid, name, 0, cctx);
+    idx = get_script_item_idx(current_sctx.sc_sid, name, 0, cctx, NULL);
     if (idx >= 0)
     {
        svar_T          *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx;
@@ -316,7 +316,7 @@ compile_load_scriptvar(
        else
        {
            idx = find_exported(import->imp_sid, exp_name, &ufunc, &type,
-                                                                  cctx, TRUE);
+                                                           cctx, NULL, TRUE);
        }
        *p = cc;
        *end = p;
index 1b8988d55ff9d9accb3b539efa2306ec29716ef0..fde51c91f969dbf8be91dded498b81a007eaf560 100644 (file)
@@ -649,6 +649,7 @@ ex_import(exarg_T *eap)
 
 /*
  * Find an exported item in "sid" matching "name".
+ * Either "cctx" or "cstack" is NULL.
  * When it is a variable return the index.
  * When it is a user function return "*ufunc".
  * When not found returns -1 and "*ufunc" is NULL.
@@ -660,6 +661,7 @@ find_exported(
        ufunc_T     **ufunc,
        type_T      **type,
        cctx_T      *cctx,
+       cstack_T    *cstack,
        int         verbose)
 {
     int                idx = -1;
@@ -667,7 +669,7 @@ find_exported(
     scriptitem_T *script = SCRIPT_ITEM(sid);
 
     // Find name in "script".
-    idx = get_script_item_idx(sid, name, 0, cctx);
+    idx = get_script_item_idx(sid, name, 0, cctx, cstack);
     if (idx >= 0)
     {
        sv = ((svar_T *)script->sn_var_vals.ga_data) + idx;