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/diff.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/diff.c')
-rw-r--r-- | src/diff.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c index 6f25c373c..4c8afb12b 100644 --- a/src/diff.c +++ b/src/diff.c @@ -3283,7 +3283,7 @@ f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED) f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { #ifdef FEAT_DIFF - linenr_T lnum = tv_get_lnum(argvars); + linenr_T lnum; static linenr_T prev_lnum = 0; static varnumber_T changedtick = 0; static int fnum = 0; @@ -3293,6 +3293,14 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) int filler_lines; int col; + if (in_vim9script() + && ((argvars[0].v_type != VAR_STRING + && argvars[0].v_type != VAR_NUMBER + && check_for_string_arg(argvars, 0) == FAIL) + || check_for_number_arg(argvars, 1) == FAIL)) + return; + + lnum = tv_get_lnum(argvars); if (lnum < 0) // ignore type error in {lnum} arg lnum = 0; if (lnum != prev_lnum |