summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-20 18:26:46 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-20 18:26:46 +0000
commitc1e6c7bafec1115b690c745a28e1a6338750b137 (patch)
tree2299cd11918b10569a201ef2f151afbf4ce4602f /src/evalfunc.c
parenteddd4fc4f6d9d626374a73861c891f95ef999133 (diff)
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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 86e5d2f402..ce51fc017d 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;