Mercurial > vim
diff src/evalfunc.c @ 23804:007fa6365dfb v8.2.2443
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Commit: https://github.com/vim/vim/commit/80ad3e25697cf759d5af5cd13e8b124c1cd657f5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 31 20:48:58 2021 +0100
patch 8.2.2443: Vim9: no compile time error for wrong str2float argument
Problem: Vim9: no compile time error for wrong str2float argument.
Solution: Check argument type. (closes https://github.com/vim/vim/issues/7759)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 31 Jan 2021 21:00:03 +0100 |
parents | 0512923e54e1 |
children | 525c9e218c69 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -435,6 +435,7 @@ arg_extend3(type_T *type, argcontext_T * /* * Lists of functions that check the argument types of a builtin function. */ +argcheck_T arg1_string[] = {arg_string}; argcheck_T arg3_string_nr_bool[] = {arg_string, arg_number, arg_bool}; argcheck_T arg1_float_or_nr[] = {arg_float_or_nr}; argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev}; @@ -1561,7 +1562,7 @@ static funcentry_T global_functions[] = ret_list_number, f_srand}, {"state", 0, 1, FEARG_1, NULL, ret_string, f_state}, - {"str2float", 1, 1, FEARG_1, NULL, + {"str2float", 1, 1, FEARG_1, arg1_string, ret_float, FLOAT_FUNC(f_str2float)}, {"str2list", 1, 2, FEARG_1, NULL, ret_list_number, f_str2list},