]> granicus.if.org Git - vim/commitdiff
patch 8.2.4054: Vim9 script test fails v8.2.4054
authorBram Moolenaar <Bram@vim.org>
Mon, 10 Jan 2022 18:42:52 +0000 (18:42 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 10 Jan 2022 18:42:52 +0000 (18:42 +0000)
Problem:    Vim9 script test fails.
Solution:   Add missing change.

src/version.c
src/vim9compile.c

index 6ab7271c9b8b04210ffbdea957abdafd50011c91..7d080c40b00280d034d9606a4f19cced642459fa 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4054,
 /**/
     4053,
 /**/
index 993bb1c68d550c3409278bf90c4b999206e8bdbd..963c052006842e4302cb4ac0d22410795f62bbd8 100644 (file)
@@ -541,7 +541,19 @@ get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx)
     ht = &SCRIPT_VARS(sid);
     di = find_var_in_ht(ht, 0, name, TRUE);
     if (di == NULL)
+    {
+       if (si->sn_autoload_prefix != NULL)
+       {
+           hashitem_T *hi;
+
+           // A variable exported from an autoload script is in the global
+           // variables, we can find it in the all_vars table.
+           hi = hash_find(&si->sn_all_vars.dv_hashtab, name);
+           if (!HASHITEM_EMPTY(hi))
+               return HI2SAV(hi)->sav_var_vals_idx;
+       }
        return -2;
+    }
 
     // Now find the svar_T index in sn_var_vals.
     for (idx = 0; idx < si->sn_var_vals.ga_len; ++idx)