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:
parent
97f227d9c9
commit
6977dba04b
@ -388,6 +388,16 @@ def Test_assign_linebreak()
|
|||||||
->copy()
|
->copy()
|
||||||
END
|
END
|
||||||
CheckDefFailure(lines, 'E1012:', 2)
|
CheckDefFailure(lines, 'E1012:', 2)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
var x: any
|
||||||
|
x.key = 1
|
||||||
|
+ 2
|
||||||
|
+ 3
|
||||||
|
+ 4
|
||||||
|
+ 5
|
||||||
|
END
|
||||||
|
CheckDefExecAndScriptFailure2(lines, 'E1148:', 'E1203:', 2)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_assign_index()
|
def Test_assign_index()
|
||||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3106,
|
||||||
/**/
|
/**/
|
||||||
3105,
|
3105,
|
||||||
/**/
|
/**/
|
||||||
|
@ -6727,6 +6727,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
|||||||
for (var_idx = 0; var_idx == 0 || var_idx < var_count; var_idx++)
|
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]))
|
if (var_start[0] == '_' && !eval_isnamec(var_start[1]))
|
||||||
{
|
{
|
||||||
@ -6979,14 +6980,21 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
|||||||
goto theend;
|
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)
|
if (lhs.lhs_has_index)
|
||||||
{
|
{
|
||||||
// Use the info in "lhs" to store the value at the index in the
|
// Use the info in "lhs" to store the value at the index in the
|
||||||
// list or dict.
|
// list or dict.
|
||||||
if (compile_assign_unlet(var_start, &lhs, TRUE, rhs_type, cctx)
|
if (compile_assign_unlet(var_start, &lhs, TRUE, rhs_type, cctx)
|
||||||
== FAIL)
|
== FAIL)
|
||||||
|
{
|
||||||
|
cctx->ctx_lnum = save_lnum;
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_decl && cmdidx == CMD_const && (lhs.lhs_dest == dest_script
|
if (is_decl && cmdidx == CMD_const && (lhs.lhs_dest == dest_script
|
||||||
@ -7006,8 +7014,12 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
|||||||
generate_SETTYPE(cctx, lhs.lhs_type);
|
generate_SETTYPE(cctx, lhs.lhs_type);
|
||||||
|
|
||||||
if (generate_store_lhs(cctx, &lhs, instr_count) == FAIL)
|
if (generate_store_lhs(cctx, &lhs, instr_count) == FAIL)
|
||||||
|
{
|
||||||
|
cctx->ctx_lnum = save_lnum;
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
cctx->ctx_lnum = save_lnum;
|
||||||
|
|
||||||
if (var_idx + 1 < var_count)
|
if (var_idx + 1 < var_count)
|
||||||
var_start = skipwhite(lhs.lhs_dest_end + 1);
|
var_start = skipwhite(lhs.lhs_dest_end + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user