From 90a57168a42048eb7e176a4f9acf607c31e8074f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 12 Feb 2022 14:23:17 +0000 Subject: [PATCH] patch 8.2.4358: Vim9: line number of exception is not set Problem: Vim9: line number of exception is not set. Solution: Set the line number before throwing an exception. (closes #9755) --- src/testdir/test_vim9_script.vim | 12 ++++++++++++ src/version.c | 2 ++ src/vim9execute.c | 1 + 3 files changed, 15 insertions(+) diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 37459a76bc..1b77f39623 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -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() diff --git a/src/version.c b/src/version.c index 7e5d18fae4..636757c3b6 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 4358, /**/ 4357, /**/ diff --git a/src/vim9execute.c b/src/vim9execute.c index 1412d08365..f6456d64b2 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -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) {