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.
diff --git a/src/evalvars.c b/src/evalvars.c
index a576859..32c803f 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -1206,14 +1206,7 @@
}
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 @@
}
/*
+ * 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