summaryrefslogtreecommitdiffstats
path: root/src/ex_eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-05 17:02:46 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-05 17:02:46 +0100
commit505ed0c38f73b5c2d1695b4d51518b690d72eb3b (patch)
tree530691606add3c4861b02d40c8109e328dc3528e /src/ex_eval.c
parentea72038d60401d351faaf1b4a52f4537e719df6f (diff)
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"v8.2.4873
Problem: Vim9: using "else" differs from using "endif/if !cond". Solution: Leave the block and enter another one. (closes #10320)
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r--src/ex_eval.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index e9dbd107c8..7b4ac1750d 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -1124,6 +1124,11 @@ ex_else(exarg_T *eap)
skip = TRUE;
}
+ // Variables declared in the previous block can no longer be
+ // used. Needs to be done before setting "cs_flags".
+ leave_block(cstack);
+ enter_block(cstack);
+
// if skipping or the ":if" was TRUE, reset ACTIVE, otherwise set it
if (skip || cstack->cs_flags[cstack->cs_idx] & CSF_TRUE)
{