changeset 20061:6e6a75800884 v8.2.0586

patch 8.2.0586: Vim9: # comment not sufficiently tested Commit: https://github.com/vim/vim/commit/4a8d9f2ed8c0079732e35d72656a000641353b94 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 16 22:54:32 2020 +0200 patch 8.2.0586: Vim9: # comment not sufficiently tested Problem: Vim9: # comment not sufficiently tested Solution: Check for preceding white space.
author Bram Moolenaar <Bram@vim.org>
date Thu, 16 Apr 2020 23:00:04 +0200
parents 324f7433a2c4
children a198083f2ccf
files src/eval.c src/testdir/test_vim9_script.vim src/version.c
diffstat 3 files changed, 40 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -6143,7 +6143,7 @@ ex_execute(exarg_T *eap)
 
     if (eap->skip)
 	++emsg_skip;
-    while (*arg != NUL && *arg != '|' && *arg != '\n')
+    while (!ends_excmd2(eap->cmd, arg) || *arg == '"')
     {
 	ret = eval1_emsg(&arg, &rettv, !eap->skip);
 	if (ret == FAIL)
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1025,6 +1025,20 @@ def Test_vim9_comment()
       ':# something',
       ], 'E488:')
 
+  { # block start
+  } # block end
+  CheckDefFailure([
+      '{# comment',
+      ], 'E488:')
+  CheckDefFailure([
+      '{',
+      '}# comment',
+      ], 'E488:')
+
+  echo "yes" # comment
+  CheckDefFailure([
+      'echo "yes"# comment',
+      ], 'E488:')
   CheckScriptSuccess([
       'vim9script',
       'echo "yes" # something',
@@ -1041,6 +1055,29 @@ def Test_vim9_comment()
       'echo "yes" # something',
       ], 'E121:')
 
+  exe "echo" # comment
+  CheckDefFailure([
+      'exe "echo"# comment',
+      ], 'E488:')
+  CheckScriptSuccess([
+      'vim9script',
+      'exe "echo" # something',
+      ])
+  CheckScriptFailure([
+      'vim9script',
+      'exe "echo"# something',
+      ], 'E121:')
+  CheckDefFailure([
+      'exe # comment',
+      ], 'E1015:')
+  CheckScriptFailure([
+      'vim9script',
+      'exe# something',
+      ], 'E121:')
+  CheckScriptFailure([
+      'exe "echo" # something',
+      ], 'E121:')
+
   CheckDefFailure([
       'try# comment',
       'echo "yes"',
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    586,
+/**/
     585,
 /**/
     584,