diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-07-17 19:11:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-17 19:11:07 +0200 |
commit | a9a7c0c602b231dc37c4b0f62ade0421c84fca03 (patch) | |
tree | a7e6e2dcad98c9dd2244cf9c368360b71abf61a6 /src/strings.c | |
parent | 20c370d9f2ee89cb854054edf71f5004f6efff77 (diff) | |
download | vim-git-a9a7c0c602b231dc37c4b0f62ade0421c84fca03.tar.gz |
patch 8.2.3173: Vim9: argument types are not checked at compile timev8.2.3173
Problem: Vim9: argument types are not checked at compile time.
Solution: Add more type checks. (Yegappan Lakshmanan, closes #8581)
Diffstat (limited to 'src/strings.c')
-rw-r--r-- | src/strings.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/strings.c b/src/strings.c index a87922d46..98d420c6a 100644 --- a/src/strings.c +++ b/src/strings.c @@ -902,6 +902,12 @@ f_str2list(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_bool_arg(argvars, 1) == FAIL))) + return; + if (argvars[1].v_type != VAR_UNKNOWN) utf8 = (int)tv_get_bool_chk(&argvars[1], NULL); @@ -1108,6 +1114,12 @@ f_strchars(typval_T *argvars, typval_T *rettv) { varnumber_T skipcc = FALSE; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_bool_arg(argvars, 1) == FAIL))) + return; + if (argvars[1].v_type != VAR_UNKNOWN) skipcc = tv_get_bool(&argvars[1]); if (skipcc < 0 || skipcc > 1) |