Mercurial > vim
comparison src/evalfunc.c @ 26686:c04b28fad0cc v8.2.3872
patch 8.2.3872: Vim9: finddir() and uniq() return types can be more specific
Commit: https://github.com/vim/vim/commit/080182216e605df3428cc699b9fd7e761368d12f
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 22 18:45:37 2021 +0000
patch 8.2.3872: Vim9: finddir() and uniq() return types can be more specific
Problem: Vim9: finddir() and uniq() return types can be more specific.
Solution: Adjust the return type.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 22 Dec 2021 20:00:04 +0100 |
parents | 38a270fdd3f6 |
children | c9a83dc9081b |
comparison
equal
deleted
inserted
replaced
26685:c5be20c42849 | 26686:c04b28fad0cc |
---|---|
1031 if (argtypes[0]->tt_type == VAR_BLOB) | 1031 if (argtypes[0]->tt_type == VAR_BLOB) |
1032 return argtypes[0]; | 1032 return argtypes[0]; |
1033 } | 1033 } |
1034 return &t_any; | 1034 return &t_any; |
1035 } | 1035 } |
1036 // for finddir() | |
1037 static type_T * | |
1038 ret_finddir(int argcount, type_T **argtypes UNUSED) | |
1039 { | |
1040 if (argcount < 3) | |
1041 return &t_string; | |
1042 // Depending on the count would be a string or a list of strings. | |
1043 return &t_any; | |
1044 } | |
1036 | 1045 |
1037 /* | 1046 /* |
1038 * Used for getqflist(): returns list if there is no argument, dict if there is | 1047 * Used for getqflist(): returns list if there is no argument, dict if there is |
1039 * one. | 1048 * one. |
1040 */ | 1049 */ |
1429 {"filewritable", 1, 1, FEARG_1, arg1_string, | 1438 {"filewritable", 1, 1, FEARG_1, arg1_string, |
1430 ret_number, f_filewritable}, | 1439 ret_number, f_filewritable}, |
1431 {"filter", 2, 2, FEARG_1, arg2_mapfilter, | 1440 {"filter", 2, 2, FEARG_1, arg2_mapfilter, |
1432 ret_first_arg, f_filter}, | 1441 ret_first_arg, f_filter}, |
1433 {"finddir", 1, 3, FEARG_1, arg3_string_string_number, | 1442 {"finddir", 1, 3, FEARG_1, arg3_string_string_number, |
1434 ret_any, f_finddir}, | 1443 ret_finddir, f_finddir}, |
1435 {"findfile", 1, 3, FEARG_1, arg3_string_string_number, | 1444 {"findfile", 1, 3, FEARG_1, arg3_string_string_number, |
1436 ret_any, f_findfile}, | 1445 ret_any, f_findfile}, |
1437 {"flatten", 1, 2, FEARG_1, arg2_list_any_number, | 1446 {"flatten", 1, 2, FEARG_1, arg2_list_any_number, |
1438 ret_list_any, f_flatten}, | 1447 ret_list_any, f_flatten}, |
1439 {"flattennew", 1, 2, FEARG_1, arg2_list_any_number, | 1448 {"flattennew", 1, 2, FEARG_1, arg2_list_any_number, |
2289 {"undofile", 1, 1, FEARG_1, arg1_string, | 2298 {"undofile", 1, 1, FEARG_1, arg1_string, |
2290 ret_string, f_undofile}, | 2299 ret_string, f_undofile}, |
2291 {"undotree", 0, 0, 0, NULL, | 2300 {"undotree", 0, 0, 0, NULL, |
2292 ret_dict_any, f_undotree}, | 2301 ret_dict_any, f_undotree}, |
2293 {"uniq", 1, 3, FEARG_1, arg13_sortuniq, | 2302 {"uniq", 1, 3, FEARG_1, arg13_sortuniq, |
2294 ret_list_any, f_uniq}, | 2303 ret_first_arg, f_uniq}, |
2295 {"values", 1, 1, FEARG_1, arg1_dict_any, | 2304 {"values", 1, 1, FEARG_1, arg1_dict_any, |
2296 ret_list_any, f_values}, | 2305 ret_list_any, f_values}, |
2297 {"virtcol", 1, 1, FEARG_1, arg1_string_or_list_any, | 2306 {"virtcol", 1, 1, FEARG_1, arg1_string_or_list_any, |
2298 ret_number, f_virtcol}, | 2307 ret_number, f_virtcol}, |
2299 {"visualmode", 0, 1, 0, arg1_bool, | 2308 {"visualmode", 0, 1, 0, arg1_bool, |