diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-02 22:24:04 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-02 22:24:04 +0100 |
commit | b283a8a6802ef8a46b17cb439f9514840c03698f (patch) | |
tree | f44c04ef936f4b0c366ab006f993bd076c6ea040 /src/evalvars.c | |
parent | 0f18b6d17baa7d33f209a3184726a162c2bb7ed8 (diff) |
patch 8.2.0200: Vim9 script commands not sufficiently testedv8.2.0200
Problem: Vim9 script commands not sufficiently tested.
Solution: Add more tests. Fix storing global variable. Make script
variables work.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index a5768599ac..32c803fd9f 100644 --- 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 |