]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1573: error for function name has wrong line number v9.0.1573
authorBram Moolenaar <Bram@vim.org>
Tue, 23 May 2023 13:48:42 +0000 (14:48 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 23 May 2023 13:48:42 +0000 (14:48 +0100)
Problem:    Error for function name has wrong line number.
Solution:   Set the line number before giving the error.

src/testdir/test_vim9_func.vim
src/version.c
src/vim9execute.c

index ecdbd5eacaa9980a75d71ad9c3811e73dc2db8ff..852f3a7edec49b7277bb5141ef7481cfcbeb7875 100644 (file)
@@ -166,6 +166,14 @@ def Test_wrong_function_name()
   delfunc g:Define
 enddef
 
+def Test_listing_function_error()
+  var lines =<< trim END
+      var filler = 123
+      func DoesNotExist
+  END
+  v9.CheckDefExecFailure(lines, 'E123:', 2)
+enddef
+
 def Test_break_in_skipped_block()
   var lines =<< trim END
       vim9script
index 0d0099cc7a7981df2582d0d5c589dce23bafe9f8..c07afca3b7be4d037a92796e8e8320c012cca9f7 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1573,
 /**/
     1572,
 /**/
index 8e27166a6f354175bfdca4a85cf432c43a865fca..921e2ca0539682fd62b0f9280af15eacbdfab905 100644 (file)
@@ -4448,6 +4448,7 @@ exec_instructions(ectx_T *ectx)
                    CLEAR_FIELD(ea);
                    ea.cmd = ea.arg = iptr->isn_arg.string;
                    ga_init2(&lines_to_free, sizeof(char_u *), 50);
+                   SOURCING_LNUM = iptr->isn_lnum;
                    define_function(&ea, NULL, &lines_to_free, 0);
                    ga_clear_strings(&lines_to_free);
                }