0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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)
This commit is contained in:
Bram Moolenaar
2022-04-05 21:40:38 +01:00
parent 0d1f55c044
commit aa7d0c2335
7 changed files with 71 additions and 24 deletions

View File

@@ -1514,7 +1514,8 @@ get_script_svar(scriptref_T *sref, int dfunc_idx)
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);