summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2022-05-05 13:53:03 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-05 13:53:03 +0100
commitf3b4895f2727e3849ca10030b251cccd9d1383f3 (patch)
tree97af9696abeba219135a0baf1947058cd4d5d995 /src/vim9execute.c
parente442d59f6d6732c226d636067c07b7342838b36b (diff)
downloadvim-git-f3b4895f2727e3849ca10030b251cccd9d1383f3.tar.gz
patch 8.2.4870: Vim9: expression in :substitute is not compiledv8.2.4870
Problem: Vim9: expression in :substitute is not compiled. Solution: Use an INSTR instruction if possible. (closes #10334)
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 4646968f5..eb6dc2829 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -5010,6 +5010,10 @@ exe_typval_instr(typval_T *tv, typval_T *rettv)
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)