patch 8.2.4870: Vim9: expression in :substitute is not compiled
Problem: Vim9: expression in :substitute is not compiled.
Solution: Use an INSTR instruction if possible. (closes #10334)
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 4646968..eb6dc28 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -5010,6 +5010,10 @@
int save_iidx = ectx->ec_iidx;
int res;
+ // Initialize rettv so that it is safe for caller to invoke clear_tv(rettv)
+ // even when the compilation fails.
+ rettv->v_type = VAR_UNKNOWN;
+
ectx->ec_instr = tv->vval.v_instr->instr_instr;
res = exec_instructions(ectx);
if (res == OK)