patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Problem: Vim9: using "else" differs from using "endif/if !cond".
Solution: Leave the block and enter another one. (closes #10320)
diff --git a/src/ex_eval.c b/src/ex_eval.c
index e9dbd10..7b4ac17 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -1124,6 +1124,11 @@
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)
{