diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-20 18:26:46 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-20 18:26:46 +0000 |
commit | c1e6c7bafec1115b690c745a28e1a6338750b137 (patch) | |
tree | 2299cd11918b10569a201ef2f151afbf4ce4602f /src/evalfunc.c | |
parent | eddd4fc4f6d9d626374a73861c891f95ef999133 (diff) | |
download | vim-git-c1e6c7bafec1115b690c745a28e1a6338750b137.tar.gz |
patch 8.2.4426: map() function on string and blob does not check typesv8.2.4426
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()".
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 86e5d2f40..ce51fc017 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -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; |