Mercurial > vim
comparison src/eval.c @ 30203:a3016780f346 v9.0.0437
patch 9.0.0437: no error when custom completion function returns wrong type
Commit: https://github.com/vim/vim/commit/55e9366e32bc0e1056478d1d0ae935f9cf039d6a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 10 13:52:26 2022 +0100
patch 9.0.0437: no error when custom completion function returns wrong type
Problem: No error when a custom completion function returns something else
than the expected list.
Solution: Give an error. (closes #11100)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 10 Sep 2022 15:00:03 +0200 |
parents | f59ce7be667f |
children | e0cb5fb44859 |
comparison
equal
deleted
inserted
replaced
30202:fee9eccee266 | 30203:a3016780f346 |
---|---|
840 | 840 |
841 /* | 841 /* |
842 * Call Vim script function "func" and return the result as a List. | 842 * Call Vim script function "func" and return the result as a List. |
843 * Uses "argv" and "argc" as call_func_retstr(). | 843 * Uses "argv" and "argc" as call_func_retstr(). |
844 * Returns NULL when there is something wrong. | 844 * Returns NULL when there is something wrong. |
845 * Gives an error when the returned value is not a list. | |
845 */ | 846 */ |
846 void * | 847 void * |
847 call_func_retlist( | 848 call_func_retlist( |
848 char_u *func, | 849 char_u *func, |
849 int argc, | 850 int argc, |
854 if (call_vim_function(func, argc, argv, &rettv) == FAIL) | 855 if (call_vim_function(func, argc, argv, &rettv) == FAIL) |
855 return NULL; | 856 return NULL; |
856 | 857 |
857 if (rettv.v_type != VAR_LIST) | 858 if (rettv.v_type != VAR_LIST) |
858 { | 859 { |
860 semsg(_(e_custom_list_completion_function_does_not_return_list_but_str), | |
861 vartype_name(rettv.v_type)); | |
859 clear_tv(&rettv); | 862 clear_tv(&rettv); |
860 return NULL; | 863 return NULL; |
861 } | 864 } |
862 | 865 |
863 return rettv.vval.v_list; | 866 return rettv.vval.v_list; |