0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2706: Vim9: wrong line number reported for boolean operator

Problem:    Vim9: wrong line number reported for boolean operator.
Solution:   Use the line number before skipping over line break.
            (closes #8058)
This commit is contained in:
Bram Moolenaar
2021-04-03 21:47:07 +02:00
parent 77709b194c
commit a7511c0f4f
3 changed files with 33 additions and 8 deletions

View File

@@ -4772,6 +4772,10 @@ compile_and_or(
ga_init2(&end_ga, sizeof(int), 10);
while (p[0] == opchar && p[1] == opchar)
{
long start_lnum = SOURCING_LNUM;
int start_ctx_lnum = cctx->ctx_lnum;
int save_lnum;
if (next != NULL)
{
*arg = next_line_from_context(cctx, TRUE);
@@ -4790,11 +4794,16 @@ compile_and_or(
generate_ppconst(cctx, ppconst);
// Every part must evaluate to a bool.
SOURCING_LNUM = start_lnum;
save_lnum = cctx->ctx_lnum;
cctx->ctx_lnum = start_ctx_lnum;
if (bool_on_stack(cctx) == FAIL)
{
cctx->ctx_lnum = save_lnum;
ga_clear(&end_ga);
return FAIL;
}
cctx->ctx_lnum = save_lnum;
if (ga_grow(&end_ga, 1) == FAIL)
{