Skip to content

Commit bd683e3

Browse files
committed
patch 9.0.0056: wrong line number reported when :cexpr fails in :def function
Problem: Wrong line number reported when :cexpr fails in :def function. Solution: Set line_number before executing :cexpr. (closes #10735)
1 parent fa49eb4 commit bd683e3

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/testdir/test_vim9_func.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4205,6 +4205,18 @@ def Test_multiple_funcref()
42054205
v9.CheckScriptSuccess(lines)
42064206
enddef
42074207

4208+
def Test_cexpr_errmsg_line_number()
4209+
var lines =<< trim END
4210+
vim9script
4211+
def Func()
4212+
var qfl = {}
4213+
cexpr qfl
4214+
enddef
4215+
Func()
4216+
END
4217+
v9.CheckScriptFailure(lines, 'E777', 2)
4218+
enddef
4219+
42084220
" The following messes up syntax highlight, keep near the end.
42094221
if has('python3')
42104222
def Test_python3_command()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static char *(features[]) =
735735

736736
static int included_patches[] =
737737
{ /* Add new patch number below this line */
738+
/**/
739+
56,
738740
/**/
739741
55,
740742
/**/

src/vim9execute.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2786,6 +2786,7 @@ exec_instructions(ectx_T *ectx)
27862786
ea.cmdlinep = &iptr->isn_arg.cexpr.cexpr_ref->cer_cmdline;
27872787
--ectx->ec_stack.ga_len;
27882788
tv = STACK_TV_BOT(0);
2789+
SOURCING_LNUM = iptr->isn_lnum;
27892790
res = cexpr_core(&ea, tv);
27902791
clear_tv(tv);
27912792
if (res == FAIL)

0 commit comments

Comments
 (0)