Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
26351:f1740ebe4834 | 26352:f209f28ad898 |
---|---|
7783 static char_u * | 7783 static char_u * |
7784 compile_elseif(char_u *arg, cctx_T *cctx) | 7784 compile_elseif(char_u *arg, cctx_T *cctx) |
7785 { | 7785 { |
7786 char_u *p = arg; | 7786 char_u *p = arg; |
7787 garray_T *instr = &cctx->ctx_instr; | 7787 garray_T *instr = &cctx->ctx_instr; |
7788 int instr_count = instr->ga_len; | 7788 int instr_count; |
7789 isn_T *isn; | 7789 isn_T *isn; |
7790 scope_T *scope = cctx->ctx_scope; | 7790 scope_T *scope = cctx->ctx_scope; |
7791 ppconst_T ppconst; | 7791 ppconst_T ppconst; |
7792 skip_T save_skip = cctx->ctx_skip; | 7792 skip_T save_skip = cctx->ctx_skip; |
7793 | 7793 |
7869 if (cctx->ctx_skip == SKIP_YES) | 7869 if (cctx->ctx_skip == SKIP_YES) |
7870 { | 7870 { |
7871 cctx->ctx_skip = SKIP_UNKNOWN; | 7871 cctx->ctx_skip = SKIP_UNKNOWN; |
7872 #ifdef FEAT_PROFILE | 7872 #ifdef FEAT_PROFILE |
7873 if (cctx->ctx_compile_type == CT_PROFILE) | 7873 if (cctx->ctx_compile_type == CT_PROFILE) |
7874 { | |
7875 // the previous block was skipped, need to profile this line | 7874 // the previous block was skipped, need to profile this line |
7876 generate_instr(cctx, ISN_PROF_START); | 7875 generate_instr(cctx, ISN_PROF_START); |
7877 instr_count = instr->ga_len; | |
7878 } | |
7879 #endif | 7876 #endif |
7880 if (cctx->ctx_compile_type == CT_DEBUG) | 7877 if (cctx->ctx_compile_type == CT_DEBUG) |
7881 { | |
7882 // the previous block was skipped, may want to debug this line | 7878 // the previous block was skipped, may want to debug this line |
7883 generate_instr_debug(cctx); | 7879 generate_instr_debug(cctx); |
7884 instr_count = instr->ga_len; | 7880 } |
7885 } | 7881 |
7886 } | 7882 instr_count = instr->ga_len; |
7887 if (compile_expr1(&p, cctx, &ppconst) == FAIL) | 7883 if (compile_expr1(&p, cctx, &ppconst) == FAIL) |
7888 { | 7884 { |
7889 clear_ppconst(&ppconst); | 7885 clear_ppconst(&ppconst); |
7890 return NULL; | 7886 return NULL; |
7891 } | 7887 } |