Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
19331:fbd4e8f02f82 | 19332:d6e8a9e80be4 |
---|---|
3889 emsg(_(e_elseif_without_if)); | 3889 emsg(_(e_elseif_without_if)); |
3890 return NULL; | 3890 return NULL; |
3891 } | 3891 } |
3892 cctx->ctx_locals.ga_len = scope->se_local_count; | 3892 cctx->ctx_locals.ga_len = scope->se_local_count; |
3893 | 3893 |
3894 if (cctx->ctx_skip != TRUE) | 3894 if (cctx->ctx_skip == MAYBE) |
3895 { | 3895 { |
3896 if (compile_jump_to_end(&scope->se_u.se_if.is_end_label, | 3896 if (compile_jump_to_end(&scope->se_u.se_if.is_end_label, |
3897 JUMP_ALWAYS, cctx) == FAIL) | 3897 JUMP_ALWAYS, cctx) == FAIL) |
3898 return NULL; | 3898 return NULL; |
3899 // previous "if" or "elseif" jumps here | 3899 // previous "if" or "elseif" jumps here |
3945 if (compile_jump_to_end(&scope->se_u.se_if.is_end_label, | 3945 if (compile_jump_to_end(&scope->se_u.se_if.is_end_label, |
3946 JUMP_ALWAYS, cctx) == FAIL) | 3946 JUMP_ALWAYS, cctx) == FAIL) |
3947 return NULL; | 3947 return NULL; |
3948 } | 3948 } |
3949 | 3949 |
3950 if (cctx->ctx_skip != TRUE) | 3950 if (cctx->ctx_skip == MAYBE) |
3951 { | 3951 { |
3952 if (scope->se_u.se_if.is_if_label >= 0) | 3952 if (scope->se_u.se_if.is_if_label >= 0) |
3953 { | 3953 { |
3954 // previous "if" or "elseif" jumps here | 3954 // previous "if" or "elseif" jumps here |
3955 isn = ((isn_T *)instr->ga_data) + scope->se_u.se_if.is_if_label; | 3955 isn = ((isn_T *)instr->ga_data) + scope->se_u.se_if.is_if_label; |
3956 isn->isn_arg.jump.jump_where = instr->ga_len; | 3956 isn->isn_arg.jump.jump_where = instr->ga_len; |
3957 scope->se_u.se_if.is_if_label = -1; | |
3957 } | 3958 } |
3958 } | 3959 } |
3959 | 3960 |
3960 if (cctx->ctx_skip != MAYBE) | 3961 if (cctx->ctx_skip != MAYBE) |
3961 cctx->ctx_skip = !cctx->ctx_skip; | 3962 cctx->ctx_skip = !cctx->ctx_skip; |