diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-07-24 16:16:15 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-24 16:16:15 +0200 |
commit | 7973de35ba6840b7e106e2e8a8912522e9a2a960 (patch) | |
tree | 8e8a1848f52a82af0a31111a0846c319a9544dd7 /src/time.c | |
parent | dd0b287c1ec8314034a2dbb14c4267994c47520c (diff) |
patch 8.2.3211: Vim9: argument types are not checked at compile timev8.2.3211
Problem: Vim9: argument types are not checked at compile time.
Solution: Add several more type checks. Fix type check for matchaddpos().
(Yegappan Lakshmanan, closes #8619)
Diffstat (limited to 'src/time.c')
-rw-r--r-- | src/time.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/time.c b/src/time.c index f7f614e427..6557b0e8c0 100644 --- a/src/time.c +++ b/src/time.c @@ -799,7 +799,7 @@ f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED) void f_timer_start(typval_T *argvars, typval_T *rettv) { - long msec = (long)tv_get_number(&argvars[0]); + long msec; timer_T *timer; int repeat = 0; callback_T callback; @@ -808,6 +808,13 @@ f_timer_start(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; if (check_secure()) return; + + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + + msec = (long)tv_get_number(&argvars[0]); if (argvars[2].v_type != VAR_UNKNOWN) { if (argvars[2].v_type != VAR_DICT |