Skip to content

Commit

Permalink
patch 8.2.4358: Vim9: line number of exception is not set
Browse files Browse the repository at this point in the history
Problem:    Vim9: line number of exception is not set.
Solution:   Set the line number before throwing an exception. (closes #9755)
  • Loading branch information
brammool committed Feb 12, 2022
1 parent 2a9b62d commit 90a5716
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/testdir/test_vim9_script.vim
Expand Up @@ -1057,6 +1057,18 @@ def Test_try_catch_skipped()
assert_match("NEWLIST size 0\n", instr)
enddef

def Test_throw_line_number()
def Func()
eval 1 + 1
eval 2 + 2
throw 'exception'
enddef
try
Func()
catch /exception/
assert_match('line 3', v:throwpoint)
endtry
enddef


def Test_throw_vimscript()
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4358,
/**/
4357,
/**/
Expand Down
1 change: 1 addition & 0 deletions src/vim9execute.c
Expand Up @@ -3826,6 +3826,7 @@ exec_instructions(ectx_T *ectx)
}
}

SOURCING_LNUM = iptr->isn_lnum;
if (throw_exception(tv->vval.v_string, ET_USER, NULL)
== FAIL)
{
Expand Down

0 comments on commit 90a5716

Please sign in to comment.