]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4358: Vim9: line number of exception is not set v8.2.4358
authorBram Moolenaar <Bram@vim.org>
Sat, 12 Feb 2022 14:23:17 +0000 (14:23 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 12 Feb 2022 14:23:17 +0000 (14:23 +0000)
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
src/version.c
src/vim9execute.c

index 37459a76bc4df39d3265a2d80081b7489f7af702..1b77f3962332ffe797e5e43a6266dbb1daca8511 100644 (file)
@@ -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()
index 7e5d18fae4797a950294183648e1b03520e89d6c..636757c3b6a61cc9cdc235f12d5a8275e00b32f6 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4358,
 /**/
     4357,
 /**/
index 1412d08365804bb809e7e958f2d8d3f280d89338..f6456d64b23e0dad3d1c5df58e5278f792b02a22 100644 (file)
@@ -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)
                    {