From 0c24ddb4d82fd70621f458e799993bd0c385e08f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 5 Oct 2025 12:55:48 -0400 Subject: [PATCH] vim-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. https://github.com/vim/vim/commit/b283a8a6802ef8a46b17cb439f9514840c03698f Vim9 is N/A. Skip. "set_vim_var_tv()" does not throw E1063 on type mismatch. See https://github.com/neovim/neovim/pull/25394 . Co-authored-by: Bram Moolenaar --- src/nvim/eval.c | 10 ---------- src/nvim/eval/vars.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 494229768d..f4345fbe59 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6597,16 +6597,6 @@ typval_T *get_vim_var_tv(const VimVarIndex idx) return &vimvars[idx].vv_tv; } -/// Set v:variable to tv. -/// -/// @param[in] idx Index of variable to set. -/// @param[in] val Value to set to. Will be copied. -void set_vim_var_tv(const VimVarIndex idx, typval_T *const tv) -{ - tv_clear(&vimvars[idx].vv_di.di_tv); - tv_copy(tv, &vimvars[idx].vv_di.di_tv); -} - /// Set the v:argv list. void set_argv_var(char **argv, int argc) { diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 02e5c68f5c..c9816c72a1 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -1527,6 +1527,17 @@ dict_T *get_vimvar_dict(void) return &vimvardict; } +/// Set v:variable to tv. +/// +/// @param[in] idx Index of variable to set. +/// @param[in] val Value to set to. Will be copied. +void set_vim_var_tv(const VimVarIndex idx, typval_T *const tv) +{ + typval_T *vv_tv = get_vim_var_tv(idx); + tv_clear(vv_tv); + tv_copy(tv, vv_tv); +} + /// Get number v: variable value. varnumber_T get_vim_var_nr(const VimVarIndex idx) FUNC_ATTR_PURE {