diff options
author | Ernie Rael <errael@raelity.com> | 2022-05-04 15:40:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-04 15:40:22 +0100 |
commit | 51d04d16f21e19d6eded98f9530d84089102f925 (patch) | |
tree | 20bb53da9296e31af0101070f69c689724c04f61 /src/evalfunc.c | |
parent | 05cf63e9bdca1ac070df3e7d9c6dfc45e68ac916 (diff) | |
download | vim-git-51d04d16f21e19d6eded98f9530d84089102f925.tar.gz |
patch 8.2.4861: it is not easy to restore saved mappingsv8.2.4861
Problem: It is not easy to restore saved mappings.
Solution: Make mapset() accept a dict argument. (Ernie Rael, closes #10295)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 4456f696d..f0650260d 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -422,6 +422,21 @@ arg_string_or_list_any(type_T *type, type_T *decl_type UNUSED, argcontext_T *con } /* + * Check "type" is a string or a dict of 'any' + */ + static int +arg_string_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T *context) +{ + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_UNKNOWN + || type->tt_type == VAR_STRING + || type->tt_type == VAR_DICT) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; +} + +/* * Check "type" is a string or a blob */ static int @@ -998,8 +1013,8 @@ static argcheck_T arg3_string[] = {arg_string, arg_string, arg_string}; static argcheck_T arg3_string_any_dict[] = {arg_string, NULL, arg_dict_any}; static argcheck_T arg3_string_any_string[] = {arg_string, NULL, arg_string}; static argcheck_T arg3_string_bool_bool[] = {arg_string, arg_bool, arg_bool}; -static argcheck_T arg3_string_bool_dict[] = {arg_string, arg_bool, arg_dict_any}; static argcheck_T arg3_string_number_bool[] = {arg_string, arg_number, arg_bool}; +static argcheck_T arg3_string_or_dict_bool_dict[] = {arg_string_or_dict_any, arg_bool, arg_dict_any}; static argcheck_T arg3_string_string_bool[] = {arg_string, arg_string, arg_bool}; static argcheck_T arg3_string_string_dict[] = {arg_string, arg_string, arg_dict_any}; static argcheck_T arg3_string_string_number[] = {arg_string, arg_string, arg_number}; @@ -2053,7 +2068,7 @@ static funcentry_T global_functions[] = ret_list_dict_any, f_maplist}, {"mapnew", 2, 2, FEARG_1, arg2_mapnew, ret_first_cont, f_mapnew}, - {"mapset", 3, 3, FEARG_1, arg3_string_bool_dict, + {"mapset", 1, 3, FEARG_1, arg3_string_or_dict_bool_dict, ret_void, f_mapset}, {"match", 2, 4, FEARG_1, arg24_match_func, ret_any, f_match}, |