Mercurial > vim
comparison src/evalfunc.c @ 26638:6fd15d82e898 v8.2.3848
patch 8.2.3848: cannot use reduce() for a string
Commit: https://github.com/vim/vim/commit/0ccb5842f5fb103763d106c7aa364d758343c35a
Author: rbtnn <naru123456789@gmail.com>
Date: Sat Dec 18 18:33:46 2021 +0000
patch 8.2.3848: cannot use reduce() for a string
Problem: Cannot use reduce() for a string.
Solution: Make reduce() work with a string. (Naruhiko Nishino, closes https://github.com/vim/vim/issues/9366)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 18 Dec 2021 19:45:03 +0100 |
parents | fac6673086df |
children | ab46f0976435 |
comparison
equal
deleted
inserted
replaced
26637:eeac85e187e7 | 26638:6fd15d82e898 |
---|---|
455 arg_list_or_dict_or_blob_or_string(type_T *type, argcontext_T *context) | 455 arg_list_or_dict_or_blob_or_string(type_T *type, argcontext_T *context) |
456 { | 456 { |
457 if (type->tt_type == VAR_ANY | 457 if (type->tt_type == VAR_ANY |
458 || type->tt_type == VAR_LIST | 458 || type->tt_type == VAR_LIST |
459 || type->tt_type == VAR_DICT | 459 || type->tt_type == VAR_DICT |
460 || type->tt_type == VAR_BLOB | |
461 || type->tt_type == VAR_STRING) | |
462 return OK; | |
463 arg_type_mismatch(&t_list_any, type, context->arg_idx + 1); | |
464 return FAIL; | |
465 } | |
466 | |
467 /* | |
468 * Check "type" is a list of 'any' or a blob or a string. | |
469 */ | |
470 static int | |
471 arg_string_list_or_blob(type_T *type, argcontext_T *context) | |
472 { | |
473 if (type->tt_type == VAR_ANY | |
474 || type->tt_type == VAR_LIST | |
460 || type->tt_type == VAR_BLOB | 475 || type->tt_type == VAR_BLOB |
461 || type->tt_type == VAR_STRING) | 476 || type->tt_type == VAR_STRING) |
462 return OK; | 477 return OK; |
463 arg_type_mismatch(&t_list_any, type, context->arg_idx + 1); | 478 arg_type_mismatch(&t_list_any, type, context->arg_idx + 1); |
464 return FAIL; | 479 return FAIL; |
815 static argcheck_T arg14_maparg[] = {arg_string, arg_string, arg_bool, arg_bool}; | 830 static argcheck_T arg14_maparg[] = {arg_string, arg_string, arg_bool, arg_bool}; |
816 static argcheck_T arg2_mapfilter[] = {arg_list_or_dict_or_blob_or_string, NULL}; | 831 static argcheck_T arg2_mapfilter[] = {arg_list_or_dict_or_blob_or_string, NULL}; |
817 static argcheck_T arg25_matchadd[] = {arg_string, arg_string, arg_number, arg_number, arg_dict_any}; | 832 static argcheck_T arg25_matchadd[] = {arg_string, arg_string, arg_number, arg_number, arg_dict_any}; |
818 static argcheck_T arg25_matchaddpos[] = {arg_string, arg_list_any, arg_number, arg_number, arg_dict_any}; | 833 static argcheck_T arg25_matchaddpos[] = {arg_string, arg_list_any, arg_number, arg_number, arg_dict_any}; |
819 static argcheck_T arg119_printf[] = {arg_string_or_nr, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; | 834 static argcheck_T arg119_printf[] = {arg_string_or_nr, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; |
820 static argcheck_T arg23_reduce[] = {arg_list_or_blob, NULL, NULL}; | 835 static argcheck_T arg23_reduce[] = {arg_string_list_or_blob, NULL, NULL}; |
821 static argcheck_T arg24_remote_expr[] = {arg_string, arg_string, arg_string, arg_number}; | 836 static argcheck_T arg24_remote_expr[] = {arg_string, arg_string, arg_string, arg_number}; |
822 static argcheck_T arg23_remove[] = {arg_list_or_dict_or_blob, arg_remove2, arg_number}; | 837 static argcheck_T arg23_remove[] = {arg_list_or_dict_or_blob, arg_remove2, arg_number}; |
823 static argcheck_T arg2_repeat[] = {arg_repeat1, arg_number}; | 838 static argcheck_T arg2_repeat[] = {arg_repeat1, arg_number}; |
824 static argcheck_T arg15_search[] = {arg_string, arg_string, arg_number, arg_number, NULL}; | 839 static argcheck_T arg15_search[] = {arg_string, arg_string, arg_number, arg_number, NULL}; |
825 static argcheck_T arg37_searchpair[] = {arg_string, arg_string, arg_string, arg_string, NULL, arg_number, arg_number}; | 840 static argcheck_T arg37_searchpair[] = {arg_string, arg_string, arg_string, arg_string, NULL, arg_number, arg_number}; |