diff src/vim9execute.c @ 28345:fabe722b24e9 v8.2.4698

patch 8.2.4698: Vim9: script variable has no flag that it was set Commit: https://github.com/vim/vim/commit/aa7d0c233532fb9d8c2876ea8e978a82b12c377f Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 5 21:40:38 2022 +0100 patch 8.2.4698: Vim9: script variable has no flag that it was set Problem: Vim9: script variable has no flag that it was set. Solution: Add a flag that it was set, to avoid giving it a value when used. (closes #10088)
author Bram Moolenaar <Bram@vim.org>
date Tue, 05 Apr 2022 22:45:03 +0200
parents 909994047400
children 6f753a8125f0
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1514,7 +1514,8 @@ get_script_svar(scriptref_T *sref, int d
 	return NULL;
     }
 
-    if (!sv->sv_export && sref->sref_sid != current_sctx.sc_sid)
+    if ((sv->sv_flags & SVFLAG_EXPORTED) == 0
+				      && sref->sref_sid != current_sctx.sc_sid)
     {
 	if (dfunc != NULL)
 	    semsg(_(e_item_not_exported_in_script_str), sv->sv_name);
@@ -2952,7 +2953,7 @@ exec_instructions(ectx_T *ectx)
 			    {
 				sv = ((svar_T *)SCRIPT_ITEM(sid)
 						  ->sn_var_vals.ga_data) + idx;
-				if (!sv->sv_export)
+				if ((sv->sv_flags & SVFLAG_EXPORTED) == 0)
 				{
 				    SOURCING_LNUM = iptr->isn_lnum;
 				    semsg(_(e_item_not_exported_in_script_str),
@@ -3117,7 +3118,7 @@ exec_instructions(ectx_T *ectx)
 				svar_T	*sv = ((svar_T *)SCRIPT_ITEM(sid)
 						  ->sn_var_vals.ga_data) + idx;
 
-				if (!sv->sv_export)
+				if ((sv->sv_flags & SVFLAG_EXPORTED) == 0)
 				{
 				    semsg(_(e_item_not_exported_in_script_str),
 									 name);