diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-05-11 15:02:56 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-05-11 15:02:56 +0100 |
commit | f9dc278946d52235a0025fd347bd9ff571258470 (patch) | |
tree | e070d19d15b319f8f154cb0d24db48f00e49aaad /src/evalfunc.c | |
parent | 4ce1bda869e4ec0152d7dcbe1e491ceac5341d5e (diff) |
patch 9.0.1540: reverse() on string doesn't work in compiled functionv9.0.1540
Problem: reverse() on string doesn't work in compiled function.
Solution: Accept string in argument type check. (Yegappan Lakshmanan,
closes #12377)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 05734d25ac..8f20ebee17 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -757,6 +757,17 @@ arg_string_list_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T *co } /* + * Check "type" is a modifiable list of 'any' or a blob or a string. + */ + static int +arg_string_list_or_blob_mod(type_T *type, type_T *decl_type, argcontext_T *context) +{ + if (arg_string_list_or_blob(type, decl_type, context) == FAIL) + return FAIL; + return arg_type_modifiable(type, context->arg_idx + 1); +} + +/* * Check "type" is a job. */ static int @@ -1010,7 +1021,7 @@ static argcheck_T arg1_float_or_nr[] = {arg_float_or_nr}; static argcheck_T arg1_job[] = {arg_job}; static argcheck_T arg1_list_any[] = {arg_list_any}; static argcheck_T arg1_list_number[] = {arg_list_number}; -static argcheck_T arg1_list_or_blob_mod[] = {arg_list_or_blob_mod}; +static argcheck_T arg1_string_or_list_or_blob_mod[] = {arg_string_list_or_blob_mod}; static argcheck_T arg1_list_or_dict[] = {arg_list_or_dict}; static argcheck_T arg1_list_string[] = {arg_list_string}; static argcheck_T arg1_string_or_list_or_dict[] = {arg_string_or_list_or_dict}; @@ -2413,7 +2424,7 @@ static funcentry_T global_functions[] = ret_repeat, f_repeat}, {"resolve", 1, 1, FEARG_1, arg1_string, ret_string, f_resolve}, - {"reverse", 1, 1, FEARG_1, arg1_list_or_blob_mod, + {"reverse", 1, 1, FEARG_1, arg1_string_or_list_or_blob_mod, ret_first_arg, f_reverse}, {"round", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, f_round}, |