Mercurial > vim
diff src/evalvars.c @ 19283:9dc843109c97 v8.2.0200
patch 8.2.0200: Vim9 script commands not sufficiently tested
Commit: https://github.com/vim/vim/commit/b283a8a6802ef8a46b17cb439f9514840c03698f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 2 22:24:04 2020 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 02 Feb 2020 22:30:04 +0100 |
parents | d776967d0f0d |
children | 86665583dc83 |
line wrap: on
line diff
--- a/src/evalvars.c +++ b/src/evalvars.c @@ -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; @@ -1967,6 +1960,24 @@ get_vim_var_tv(int idx) } /* + * 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. */ varnumber_T