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 #7510)
diff --git a/src/eval.c b/src/eval.c
index f84491e..f08ae57 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -655,10 +655,27 @@
}
/*
+ * 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 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 *