changeset 21933:5edd776d886d v8.2.1516

patch 8.2.1516: Vim9: error for :exe has wrong line number Commit: https://github.com/vim/vim/commit/430deb1945cbc7a17ed42c5c737fc08d2eef327a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 23 16:29:11 2020 +0200 patch 8.2.1516: Vim9: error for :exe has wrong line number Problem: Vim9: error for :exe has wrong line number. Solution: Set line number before calling do_cmdline_cmd(). (closes https://github.com/vim/vim/issues/6774)
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Aug 2020 16:30:03 +0200
parents ec8056494ff2
children 520a6af17d92
files src/testdir/test_vim9_script.vim src/version.c src/vim9execute.c
diffstat 3 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2159,8 +2159,9 @@ def Test_execute_cmd()
   echomsg [1, 2, 3] #{a: 1, b: 2}
   assert_match('^\[1, 2, 3\] {''a'': 1, ''b'': 2}$', Screenline(&lines))
 
-  call CheckDefFailure(['execute xxx'], 'E1001:')
-  call CheckDefFailure(['execute "cmd"# comment'], 'E488:')
+  call CheckDefFailure(['execute xxx'], 'E1001:', 1)
+  call CheckDefExecFailure(['execute "tabnext " .. 8'], 'E475:', 1)
+  call CheckDefFailure(['execute "cmd"# comment'], 'E488:', 1)
 enddef
 
 def Test_execute_cmd_vimscript()
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1516,
+/**/
     1515,
 /**/
     1514,
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1062,7 +1062,10 @@ call_def_function(
 		    if (ga.ga_data != NULL)
 		    {
 			if (iptr->isn_type == ISN_EXECUTE)
+			{
+			    SOURCING_LNUM = iptr->isn_lnum;
 			    do_cmdline_cmd((char_u *)ga.ga_data);
+			}
 			else
 			{
 			    msg_sb_eol();