Mercurial > vim
diff src/vim9compile.c @ 26352:f209f28ad898 v8.2.3707
patch 8.2.3707: Vim9: constant expression of elseif not recognized
Commit: https://github.com/vim/vim/commit/90770b746ea2e72954c536d8acf41d241ca2f37e
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 30 20:57:38 2021 +0000
patch 8.2.3707: Vim9: constant expression of elseif not recognized
Problem: Vim9: constant expression of elseif not recognized.
Solution: Set instruction count before generating the expression.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Nov 2021 22:00:04 +0100 |
parents | 8be6413a8e27 |
children | 0884f2be6c2a |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -7785,7 +7785,7 @@ compile_elseif(char_u *arg, cctx_T *cctx { char_u *p = arg; garray_T *instr = &cctx->ctx_instr; - int instr_count = instr->ga_len; + int instr_count; isn_T *isn; scope_T *scope = cctx->ctx_scope; ppconst_T ppconst; @@ -7871,19 +7871,15 @@ compile_elseif(char_u *arg, cctx_T *cctx cctx->ctx_skip = SKIP_UNKNOWN; #ifdef FEAT_PROFILE if (cctx->ctx_compile_type == CT_PROFILE) - { // the previous block was skipped, need to profile this line generate_instr(cctx, ISN_PROF_START); - instr_count = instr->ga_len; - } #endif if (cctx->ctx_compile_type == CT_DEBUG) - { // the previous block was skipped, may want to debug this line generate_instr_debug(cctx); - instr_count = instr->ga_len; - } - } + } + + instr_count = instr->ga_len; if (compile_expr1(&p, cctx, &ppconst) == FAIL) { clear_ppconst(&ppconst);