0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.0200: Vim9 script commands not sufficiently tested

Problem:    Vim9 script commands not sufficiently tested.
Solution:   Add more tests.  Fix storing global variable.  Make script
            variables work.
This commit is contained in:
Bram Moolenaar
2020-02-02 22:24:04 +01:00
parent 0f18b6d17b
commit b283a8a680
9 changed files with 301 additions and 58 deletions

View File

@@ -1206,14 +1206,7 @@ ex_let_one(
}
if (p != NULL)
{
vim_setenv(name, p);
if (STRICMP(name, "HOME") == 0)
init_homedir();
else if (didset_vim && STRICMP(name, "VIM") == 0)
didset_vim = FALSE;
else if (didset_vimruntime
&& STRICMP(name, "VIMRUNTIME") == 0)
didset_vimruntime = FALSE;
vim_setenv_ext(name, p);
arg_end = arg;
}
name[len] = c1;
@@ -1966,6 +1959,24 @@ get_vim_var_tv(int idx)
return &vimvars[idx].vv_tv;
}
/*
* Set v: variable to "tv". Only accepts the same type.
* Takes over the value of "tv".
*/
int
set_vim_var_tv(int idx, typval_T *tv)
{
if (vimvars[idx].vv_type != tv->v_type)
{
emsg(_("E1063: type mismatch for v: variable"));
clear_tv(tv);
return FAIL;
}
clear_tv(&vimvars[idx].vv_di.di_tv);
vimvars[idx].vv_di.di_tv = *tv;
return OK;
}
/*
* Get number v: variable value.
*/