diff src/vim9compile.c @ 19332:d6e8a9e80be4 v8.2.0224

patch 8.2.0224: compiling :elseif not tested yet Commit: https://github.com/vim/vim/commit/158906cffc62bc82bc38198c2104967f2a70542c Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 6 20:39:45 2020 +0100 patch 8.2.0224: compiling :elseif not tested yet Problem: compiling :elseif not tested yet. Solution: Add test for :elseif. Fix generating jumps.
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Feb 2020 20:45:03 +0100
parents 9c8b803fe598
children 1cd6eab65ce0
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3891,7 +3891,7 @@ compile_elseif(char_u *arg, cctx_T *cctx
     }
     cctx->ctx_locals.ga_len = scope->se_local_count;
 
-    if (cctx->ctx_skip != TRUE)
+    if (cctx->ctx_skip == MAYBE)
     {
 	if (compile_jump_to_end(&scope->se_u.se_if.is_end_label,
 						    JUMP_ALWAYS, cctx) == FAIL)
@@ -3947,13 +3947,14 @@ compile_else(char_u *arg, cctx_T *cctx)
 	    return NULL;
     }
 
-    if (cctx->ctx_skip != TRUE)
+    if (cctx->ctx_skip == MAYBE)
     {
 	if (scope->se_u.se_if.is_if_label >= 0)
 	{
 	    // previous "if" or "elseif" jumps here
 	    isn = ((isn_T *)instr->ga_data) + scope->se_u.se_if.is_if_label;
 	    isn->isn_arg.jump.jump_where = instr->ga_len;
+	    scope->se_u.se_if.is_if_label = -1;
 	}
     }