Mercurial > vim
comparison src/eval.c @ 25302:4d3c68196d05 v8.2.3188
patch 8.2.3188: Vim9: argument types are not checked at compile time
Commit: https://github.com/vim/vim/commit/83494b4ac61898f687d6ef9dce4bad5802fb8e51
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Jul 20 17:51:51 2021 +0200
patch 8.2.3188: 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, also at runtime. (Yegappan
Lakshmanan, closes #8587)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 20 Jul 2021 18:00:06 +0200 |
parents | 29191571eceb |
children | cfbf40f749b0 |
comparison
equal
deleted
inserted
replaced
25301:fe178301fc04 | 25302:4d3c68196d05 |
---|---|
4182 * slice() function | 4182 * slice() function |
4183 */ | 4183 */ |
4184 void | 4184 void |
4185 f_slice(typval_T *argvars, typval_T *rettv) | 4185 f_slice(typval_T *argvars, typval_T *rettv) |
4186 { | 4186 { |
4187 if (in_vim9script() | |
4188 && ((argvars[0].v_type != VAR_LIST | |
4189 && argvars[0].v_type != VAR_BLOB | |
4190 && argvars[0].v_type != VAR_STRING | |
4191 && check_for_list_arg(argvars, 0) == FAIL) | |
4192 || check_for_number_arg(argvars, 1) == FAIL | |
4193 || check_for_opt_number_arg(argvars, 2) == FAIL)) | |
4194 return; | |
4195 | |
4187 if (check_can_index(argvars, TRUE, FALSE) == OK) | 4196 if (check_can_index(argvars, TRUE, FALSE) == OK) |
4188 { | 4197 { |
4189 copy_tv(argvars, rettv); | 4198 copy_tv(argvars, rettv); |
4190 eval_index_inner(rettv, TRUE, argvars + 1, | 4199 eval_index_inner(rettv, TRUE, argvars + 1, |
4191 argvars[2].v_type == VAR_UNKNOWN ? NULL : argvars + 2, | 4200 argvars[2].v_type == VAR_UNKNOWN ? NULL : argvars + 2, |