comparison src/evalfunc.c @ 21184:2113e94dc726 v8.2.1143

patch 8.2.1143: Vim9: return type of remove() is any Commit: https://github.com/vim/vim/commit/ad7c24932725b9ab37b65fe359a41f8ba3e3dfcf Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 5 20:55:29 2020 +0200 patch 8.2.1143: Vim9: return type of remove() is any Problem: Vim9: return type of remove() is any. Solution: Use the member type of the first argument, if known.
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Jul 2020 21:00:05 +0200
parents 7289c8b9a620
children 34667dc9207b
comparison
equal deleted inserted replaced
21183:5b2281940ca0 21184:2113e94dc726
377 // argv() returns list of strings 377 // argv() returns list of strings
378 if (argcount == 0) 378 if (argcount == 0)
379 return &t_list_string; 379 return &t_list_string;
380 380
381 // argv(0) returns a string, but argv(-1] returns a list 381 // argv(0) returns a string, but argv(-1] returns a list
382 return &t_any;
383 }
384
385 static type_T *
386 ret_remove(int argcount UNUSED, type_T **argtypes)
387 {
388 if (argtypes[0]->tt_type == VAR_LIST
389 || argtypes[0]->tt_type == VAR_DICT)
390 return argtypes[0]->tt_member;
391 if (argtypes[0]->tt_type == VAR_BLOB)
392 return &t_number;
382 return &t_any; 393 return &t_any;
383 } 394 }
384 395
385 static type_T *ret_f_function(int argcount, type_T **argtypes); 396 static type_T *ret_f_function(int argcount, type_T **argtypes);
386 397
825 {"remote_foreground", 1, 1, FEARG_1, ret_string, f_remote_foreground}, 836 {"remote_foreground", 1, 1, FEARG_1, ret_string, f_remote_foreground},
826 {"remote_peek", 1, 2, FEARG_1, ret_number, f_remote_peek}, 837 {"remote_peek", 1, 2, FEARG_1, ret_number, f_remote_peek},
827 {"remote_read", 1, 2, FEARG_1, ret_string, f_remote_read}, 838 {"remote_read", 1, 2, FEARG_1, ret_string, f_remote_read},
828 {"remote_send", 2, 3, FEARG_1, ret_string, f_remote_send}, 839 {"remote_send", 2, 3, FEARG_1, ret_string, f_remote_send},
829 {"remote_startserver", 1, 1, FEARG_1, ret_void, f_remote_startserver}, 840 {"remote_startserver", 1, 1, FEARG_1, ret_void, f_remote_startserver},
830 {"remove", 2, 3, FEARG_1, ret_any, f_remove}, 841 {"remove", 2, 3, FEARG_1, ret_remove, f_remove},
831 {"rename", 2, 2, FEARG_1, ret_number, f_rename}, 842 {"rename", 2, 2, FEARG_1, ret_number, f_rename},
832 {"repeat", 2, 2, FEARG_1, ret_first_arg, f_repeat}, 843 {"repeat", 2, 2, FEARG_1, ret_first_arg, f_repeat},
833 {"resolve", 1, 1, FEARG_1, ret_string, f_resolve}, 844 {"resolve", 1, 1, FEARG_1, ret_string, f_resolve},
834 {"reverse", 1, 1, FEARG_1, ret_any, f_reverse}, 845 {"reverse", 1, 1, FEARG_1, ret_any, f_reverse},
835 {"round", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_round)}, 846 {"round", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_round)},