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)
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 99135ea..0e8a1dd 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1514,7 +1514,8 @@
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 @@
{
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 @@
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);