Mercurial > vim
comparison src/vim9compile.c @ 25258:205a0126ac2d v8.2.3165
patch 8.2.3165: Vim9: in a || expression the error line number may be wrong
Commit: https://github.com/vim/vim/commit/9e60e899ee546a8a35c4cbe0319971719c1839e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 15 15:40:58 2021 +0200
patch 8.2.3165: Vim9: in a || expression the error line number may be wrong
Problem: Vim9: in a || expression the error line number may be wrong.
Solution: Save and restore the line number when checking the type.
(closes #8569)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 15 Jul 2021 15:45:03 +0200 |
parents | 658dfd6be868 |
children | 5861cc1f5704 |
comparison
equal
deleted
inserted
replaced
25257:2ba11a69cd63 | 25258:205a0126ac2d |
---|---|
5093 */ | 5093 */ |
5094 ga_init2(&end_ga, sizeof(int), 10); | 5094 ga_init2(&end_ga, sizeof(int), 10); |
5095 while (p[0] == opchar && p[1] == opchar) | 5095 while (p[0] == opchar && p[1] == opchar) |
5096 { | 5096 { |
5097 long start_lnum = SOURCING_LNUM; | 5097 long start_lnum = SOURCING_LNUM; |
5098 long save_sourcing_lnum; | |
5098 int start_ctx_lnum = cctx->ctx_lnum; | 5099 int start_ctx_lnum = cctx->ctx_lnum; |
5099 int save_lnum; | 5100 int save_lnum; |
5100 | 5101 |
5101 if (next != NULL) | 5102 if (next != NULL) |
5102 { | 5103 { |
5114 // TODO: use ppconst if the value is a constant and check | 5115 // TODO: use ppconst if the value is a constant and check |
5115 // evaluating to bool | 5116 // evaluating to bool |
5116 generate_ppconst(cctx, ppconst); | 5117 generate_ppconst(cctx, ppconst); |
5117 | 5118 |
5118 // Every part must evaluate to a bool. | 5119 // Every part must evaluate to a bool. |
5120 save_sourcing_lnum = SOURCING_LNUM; | |
5119 SOURCING_LNUM = start_lnum; | 5121 SOURCING_LNUM = start_lnum; |
5120 save_lnum = cctx->ctx_lnum; | 5122 save_lnum = cctx->ctx_lnum; |
5121 cctx->ctx_lnum = start_ctx_lnum; | 5123 cctx->ctx_lnum = start_ctx_lnum; |
5122 if (bool_on_stack(cctx) == FAIL) | 5124 if (bool_on_stack(cctx) == FAIL) |
5123 { | 5125 { |
5136 ++end_ga.ga_len; | 5138 ++end_ga.ga_len; |
5137 generate_JUMP(cctx, opchar == '|' | 5139 generate_JUMP(cctx, opchar == '|' |
5138 ? JUMP_IF_COND_TRUE : JUMP_IF_COND_FALSE, 0); | 5140 ? JUMP_IF_COND_TRUE : JUMP_IF_COND_FALSE, 0); |
5139 | 5141 |
5140 // eval the next expression | 5142 // eval the next expression |
5143 SOURCING_LNUM = save_sourcing_lnum; | |
5141 if (may_get_next_line_error(p + 2, arg, cctx) == FAIL) | 5144 if (may_get_next_line_error(p + 2, arg, cctx) == FAIL) |
5142 { | 5145 { |
5143 ga_clear(&end_ga); | 5146 ga_clear(&end_ga); |
5144 return FAIL; | 5147 return FAIL; |
5145 } | 5148 } |