1
0
forked from aniani/vim

patch 8.2.3106: Vim9: confusing line number reported for error

Problem:    Vim9: confusing line number reported for error.
Solution:   Use the start line number for the store instruction.
            (closes #8488)
This commit is contained in:
Bram Moolenaar
2021-07-04 22:48:12 +02:00
parent 97f227d9c9
commit 6977dba04b
3 changed files with 25 additions and 1 deletions

View File

@@ -6726,7 +6726,8 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
var_start = arg;
for (var_idx = 0; var_idx == 0 || var_idx < var_count; var_idx++)
{
int instr_count = -1;
int instr_count = -1;
int save_lnum;
if (var_start[0] == '_' && !eval_isnamec(var_start[1]))
{
@@ -6979,13 +6980,20 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
goto theend;
}
// Use the line number of the assignment for store instruction.
save_lnum = cctx->ctx_lnum;
cctx->ctx_lnum = start_lnum - 1;
if (lhs.lhs_has_index)
{
// Use the info in "lhs" to store the value at the index in the
// list or dict.
if (compile_assign_unlet(var_start, &lhs, TRUE, rhs_type, cctx)
== FAIL)
{
cctx->ctx_lnum = save_lnum;
goto theend;
}
}
else
{
@@ -7006,8 +7014,12 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
generate_SETTYPE(cctx, lhs.lhs_type);
if (generate_store_lhs(cctx, &lhs, instr_count) == FAIL)
{
cctx->ctx_lnum = save_lnum;
goto theend;
}
}
cctx->ctx_lnum = save_lnum;
if (var_idx + 1 < var_count)
var_start = skipwhite(lhs.lhs_dest_end + 1);