patch 9.0.0399: using :defer in expression funcref not tested
Problem: Using :defer in expression funcref not tested.
Solution: Add a test. Fix uncovered problems.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 40b23bd..4625154 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -860,6 +860,27 @@
}
/*
+ * Clear "current_ectx" and return the previous value. To be used when calling
+ * a user function.
+ */
+ ectx_T *
+clear_currrent_ectx(void)
+{
+ ectx_T *r = current_ectx;
+
+ current_ectx = NULL;
+ return r;
+}
+
+ void
+restore_current_ectx(ectx_T *ectx)
+{
+ if (current_ectx != NULL)
+ iemsg("Restoring current_ectx while it is not NULL");
+ current_ectx = ectx;
+}
+
+/*
* Add an entry for a deferred function call to the currently executing
* function.
* Return the list or NULL when failed.
@@ -5335,7 +5356,7 @@
if (idx < 0)
{
semsg(NGETTEXT(e_one_argument_too_few, e_nr_arguments_too_few,
- -idx), -idx);
+ -idx), -idx);
goto failed_early;
}