Mercurial > vim
comparison src/dict.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 | e2be9f3c5907 |
children | 0082503ff2ff |
comparison
equal
deleted
inserted
replaced
25383:510e4fcb5363 | 25384:e8e2c4d33b9b |
---|---|
1199 listitem_T *li; | 1199 listitem_T *li; |
1200 listitem_T *li2; | 1200 listitem_T *li2; |
1201 dict_T *d; | 1201 dict_T *d; |
1202 int todo; | 1202 int todo; |
1203 | 1203 |
1204 if (in_vim9script() && check_for_dict_arg(argvars, 0) == FAIL) | |
1205 return; | |
1206 | |
1204 if (argvars[0].v_type != VAR_DICT) | 1207 if (argvars[0].v_type != VAR_DICT) |
1205 { | 1208 { |
1206 emsg(_(e_dictreq)); | 1209 emsg(_(e_dictreq)); |
1207 return; | 1210 return; |
1208 } | 1211 } |
1316 * "has_key()" function | 1319 * "has_key()" function |
1317 */ | 1320 */ |
1318 void | 1321 void |
1319 f_has_key(typval_T *argvars, typval_T *rettv) | 1322 f_has_key(typval_T *argvars, typval_T *rettv) |
1320 { | 1323 { |
1324 if (in_vim9script() | |
1325 && (check_for_dict_arg(argvars, 0) == FAIL | |
1326 || check_for_string_or_number_arg(argvars, 1) == FAIL)) | |
1327 return; | |
1328 | |
1321 if (argvars[0].v_type != VAR_DICT) | 1329 if (argvars[0].v_type != VAR_DICT) |
1322 { | 1330 { |
1323 emsg(_(e_dictreq)); | 1331 emsg(_(e_dictreq)); |
1324 return; | 1332 return; |
1325 } | 1333 } |