summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-08 17:55:49 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-08 17:55:49 +0200
commit4a6d1b660fcea67931202527ad2852da55d26d49 (patch)
treeced3a872aaf412cdde1a6b7669f55e0bdc3901a9 /src/evalfunc.c
parent5a849da57c5fb54ffcffd436a9e00ef40fdf094c (diff)
patch 8.2.1397: Vim9: return type of maparg() not adjusted for fourth argv8.2.1397
Problem: Vim9: return type of maparg() not adjusted for fourth argument. Solution: Check if fourth argument is present. (closes #6645)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index a421690e49..5607ef9e5b 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -402,6 +402,15 @@ ret_getreg(int argcount, type_T **argtypes UNUSED)
return &t_string;
}
+ static type_T *
+ret_maparg(int argcount, type_T **argtypes UNUSED)
+{
+ // Assume that if the fourth argument is passed it's non-zero
+ if (argcount == 4)
+ return &t_dict_any;
+ return &t_string;
+}
+
static type_T *ret_f_function(int argcount, type_T **argtypes);
/*
@@ -729,7 +738,7 @@ static funcentry_T global_functions[] =
#endif
},
{"map", 2, 2, FEARG_1, ret_any, f_map},
- {"maparg", 1, 4, FEARG_1, ret_string, f_maparg},
+ {"maparg", 1, 4, FEARG_1, ret_maparg, f_maparg},
{"mapcheck", 1, 3, FEARG_1, ret_string, f_mapcheck},
{"mapset", 3, 3, FEARG_1, ret_void, f_mapset},
{"match", 2, 4, FEARG_1, ret_any, f_match},