Mercurial > vim
comparison src/typval.c @ 26731:7f4cc4e58f75 v8.2.3894
patch 8.2.3894: Vim9: no proper type check for first argument of call()
Commit: https://github.com/vim/vim/commit/223d0a6bc8dc68039ceb6660de9576fafe178d73
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 25 19:29:21 2021 +0000
patch 8.2.3894: Vim9: no proper type check for first argument of call()
Problem: Vim9: no proper type check for first argument of call().
Solution: Add specific type check.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 25 Dec 2021 20:30:03 +0100 |
parents | 1cee572f2fd7 |
children | b7b82279426f |
comparison
equal
deleted
inserted
replaced
26730:fc326a1245cf | 26731:7f4cc4e58f75 |
---|---|
749 if (args[idx].v_type != VAR_STRING | 749 if (args[idx].v_type != VAR_STRING |
750 && args[idx].v_type != VAR_LIST | 750 && args[idx].v_type != VAR_LIST |
751 && args[idx].v_type != VAR_DICT) | 751 && args[idx].v_type != VAR_DICT) |
752 { | 752 { |
753 semsg(_(e_string_list_or_dict_required_for_argument_nr), idx + 1); | 753 semsg(_(e_string_list_or_dict_required_for_argument_nr), idx + 1); |
754 return FAIL; | |
755 } | |
756 return OK; | |
757 } | |
758 | |
759 /* | |
760 * Give an error and return FAIL unless "args[idx]" is a string | |
761 * or a function reference. | |
762 */ | |
763 int | |
764 check_for_string_or_func_arg(typval_T *args, int idx) | |
765 { | |
766 if (args[idx].v_type != VAR_PARTIAL | |
767 && args[idx].v_type != VAR_FUNC | |
768 && args[idx].v_type != VAR_STRING) | |
769 { | |
770 semsg(_(e_string_or_function_required_for_argument_nr), idx + 1); | |
754 return FAIL; | 771 return FAIL; |
755 } | 772 } |
756 return OK; | 773 return OK; |
757 } | 774 } |
758 | 775 |