Mercurial > vim
diff src/eval.c @ 23281:5b4db8035d1d v8.2.2186
patch 8.2.2186: Vim9: error when using 'opfunc'
Commit: https://github.com/vim/vim/commit/5b3d1bb0f5180266c4de4d815b3ea856a2fb3519
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 22 12:20:08 2020 +0100
patch 8.2.2186: Vim9: error when using 'opfunc'
Problem: Vim9: error when using 'opfunc'.
Solution: Do not expect a return value from 'opfunc'. (closes https://github.com/vim/vim/issues/7510)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 22 Dec 2020 12:30:04 +0100 |
parents | a789a688e37d |
children | d5919c5fd3dc |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -655,10 +655,27 @@ call_func_retnr( } /* + * Call Vim script function like call_func_retnr() and drop the result. + * Returns FAIL when calling the function fails. + */ + int +call_func_noret( + char_u *func, + int argc, + typval_T *argv) +{ + typval_T rettv; + + if (call_vim_function(func, argc, argv, &rettv) == FAIL) + return FAIL; + clear_tv(&rettv); + return OK; +} + +/* * Call Vim script function "func" and return the result as a string. + * Uses "argv" and "argc" as call_func_retnr(). * Returns NULL when calling the function fails. - * Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] should - * have type VAR_UNKNOWN. */ void * call_func_retstr( @@ -679,8 +696,7 @@ call_func_retstr( /* * Call Vim script function "func" and return the result as a List. - * Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] should - * have type VAR_UNKNOWN. + * Uses "argv" and "argc" as call_func_retnr(). * Returns NULL when there is something wrong. */ void *