changeset 23094:8b93aea8d9d7 v8.2.2093

patch 8.2.2093: Vim9: script test sometimes fails Commit: https://github.com/vim/vim/commit/c0913d023b8bb728e9832727fe1657dbddf685d0 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 5 14:44:37 2020 +0100 patch 8.2.2093: Vim9: script test sometimes fails Problem: Vim9: script test sometimes fails. Solution: Do not find a script variable by its typval if the name was cleared.
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Dec 2020 14:45:03 +0100
parents 2e6c66937951
children 211188403293
files src/version.c src/vim9script.c
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2093,
+/**/
     2092,
 /**/
     2091,
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -741,7 +741,9 @@ find_typval_in_script(typval_T *dest)
     {
 	svar_T    *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx;
 
-	if (sv->sv_tv == dest)
+	// If "sv_name" is NULL the variable was hidden when leaving a block,
+	// don't check "sv_tv" then, it might be used for another variable now.
+	if (sv->sv_name != NULL && sv->sv_tv == dest)
 	    return sv;
     }
     iemsg("check_script_var_type(): not found");