Mercurial > vim
diff src/terminal.c @ 25338:e2be9f3c5907 v8.2.3206
patch 8.2.3206: Vim9: argument types are not checked at compile time
Commit: https://github.com/vim/vim/commit/0ad871dc4dfe1026e14931a55c225616b63f4c5b
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Fri Jul 23 20:37:56 2021 +0200
patch 8.2.3206: Vim9: argument types are not checked at compile time
Problem: Vim9: argument types are not checked at compile time.
Solution: Add several more type checks. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/8611)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 23 Jul 2021 20:45:05 +0200 |
parents | 7e620652bd13 |
children | c4298ed56ffa |
line wrap: on
line diff
--- a/src/terminal.c +++ b/src/terminal.c @@ -4756,7 +4756,7 @@ dump_term_color(FILE *fd, VTermColor *co void f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED) { - buf_T *buf = term_get_buf(argvars, "term_dumpwrite()"); + buf_T *buf; term_T *term; char_u *fname; int max_height = 0; @@ -4771,6 +4771,14 @@ f_term_dumpwrite(typval_T *argvars, typv if (check_restricted() || check_secure()) return; + + if (in_vim9script() + && (check_for_buffer_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + + buf = term_get_buf(argvars, "term_dumpwrite()"); if (buf == NULL) return; term = buf->b_term; @@ -5643,6 +5651,12 @@ term_swap_diff() void f_term_dumpdiff(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + term_load_dump(argvars, rettv, TRUE); }