Mercurial > vim
comparison src/insexpand.c @ 25384:e8e2c4d33b9b v8.2.3229
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Commit: https://github.com/vim/vim/commit/4490ec4e839e45a2e6923c265c7e9e64c240b805
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Jul 27 22:00:44 2021 +0200
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Problem: Vim9: runtime and compile time type checks are not the same.
Solution: Add more runtime type checks for builtin functions. (Yegappan
Lakshmanan, closes #8646)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Jul 2021 22:15:06 +0200 |
parents | 4d3c68196d05 |
children | b9e8c9ed792b |
comparison
equal
deleted
inserted
replaced
25383:510e4fcb5363 | 25384:e8e2c4d33b9b |
---|---|
2471 * "complete_add()" function | 2471 * "complete_add()" function |
2472 */ | 2472 */ |
2473 void | 2473 void |
2474 f_complete_add(typval_T *argvars, typval_T *rettv) | 2474 f_complete_add(typval_T *argvars, typval_T *rettv) |
2475 { | 2475 { |
2476 if (in_vim9script() | 2476 if (in_vim9script() && check_for_string_or_dict_arg(argvars, 0) == FAIL) |
2477 && (argvars[0].v_type != VAR_DICT | |
2478 && argvars[0].v_type != VAR_STRING | |
2479 && check_for_string_arg(argvars, 0) == FAIL)) | |
2480 return; | 2477 return; |
2481 | 2478 |
2482 rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0, FALSE); | 2479 rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0, FALSE); |
2483 } | 2480 } |
2484 | 2481 |
2662 f_complete_info(typval_T *argvars, typval_T *rettv) | 2659 f_complete_info(typval_T *argvars, typval_T *rettv) |
2663 { | 2660 { |
2664 list_T *what_list = NULL; | 2661 list_T *what_list = NULL; |
2665 | 2662 |
2666 if (rettv_dict_alloc(rettv) != OK) | 2663 if (rettv_dict_alloc(rettv) != OK) |
2664 return; | |
2665 | |
2666 if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL) | |
2667 return; | 2667 return; |
2668 | 2668 |
2669 if (argvars[0].v_type != VAR_UNKNOWN) | 2669 if (argvars[0].v_type != VAR_UNKNOWN) |
2670 { | 2670 { |
2671 if (argvars[0].v_type != VAR_LIST) | 2671 if (argvars[0].v_type != VAR_LIST) |