1
0
forked from aniani/vim

patch 8.2.4426: map() function on string and blob does not check types

Problem:    map() function on string and blob does not check argument types at
            compile time.
Solution:   Check string and blob argument types.  Support "0z1234->func()".
This commit is contained in:
Bram Moolenaar
2022-02-20 18:26:46 +00:00
parent eddd4fc4f6
commit c1e6c7bafe
5 changed files with 47 additions and 7 deletions

View File

@@ -566,9 +566,11 @@ arg_map_func(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
t_func_exp.tt_argcount = -1;
else
{
if (context->arg_types[0].type_decl->tt_type == VAR_LIST)
if (context->arg_types[0].type_curr->tt_type == VAR_STRING
|| context->arg_types[0].type_curr->tt_type == VAR_BLOB
|| context->arg_types[0].type_curr->tt_type == VAR_LIST)
args[0] = &t_number;
else if (context->arg_types[0].type_decl->tt_type == VAR_DICT)
else if (context->arg_types[0].type_curr->tt_type == VAR_DICT)
args[0] = &t_string;
if (args[0] != NULL)
args[1] = expected_ret;