Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
19282:0d513180baa1 | 19283:9dc843109c97 |
---|---|
1204 vim_free(s); | 1204 vim_free(s); |
1205 } | 1205 } |
1206 } | 1206 } |
1207 if (p != NULL) | 1207 if (p != NULL) |
1208 { | 1208 { |
1209 vim_setenv(name, p); | 1209 vim_setenv_ext(name, p); |
1210 if (STRICMP(name, "HOME") == 0) | |
1211 init_homedir(); | |
1212 else if (didset_vim && STRICMP(name, "VIM") == 0) | |
1213 didset_vim = FALSE; | |
1214 else if (didset_vimruntime | |
1215 && STRICMP(name, "VIMRUNTIME") == 0) | |
1216 didset_vimruntime = FALSE; | |
1217 arg_end = arg; | 1210 arg_end = arg; |
1218 } | 1211 } |
1219 name[len] = c1; | 1212 name[len] = c1; |
1220 vim_free(tofree); | 1213 vim_free(tofree); |
1221 } | 1214 } |
1965 { | 1958 { |
1966 return &vimvars[idx].vv_tv; | 1959 return &vimvars[idx].vv_tv; |
1967 } | 1960 } |
1968 | 1961 |
1969 /* | 1962 /* |
1963 * Set v: variable to "tv". Only accepts the same type. | |
1964 * Takes over the value of "tv". | |
1965 */ | |
1966 int | |
1967 set_vim_var_tv(int idx, typval_T *tv) | |
1968 { | |
1969 if (vimvars[idx].vv_type != tv->v_type) | |
1970 { | |
1971 emsg(_("E1063: type mismatch for v: variable")); | |
1972 clear_tv(tv); | |
1973 return FAIL; | |
1974 } | |
1975 clear_tv(&vimvars[idx].vv_di.di_tv); | |
1976 vimvars[idx].vv_di.di_tv = *tv; | |
1977 return OK; | |
1978 } | |
1979 | |
1980 /* | |
1970 * Get number v: variable value. | 1981 * Get number v: variable value. |
1971 */ | 1982 */ |
1972 varnumber_T | 1983 varnumber_T |
1973 get_vim_var_nr(int idx) | 1984 get_vim_var_nr(int idx) |
1974 { | 1985 { |