]> granicus.if.org Git - vim/commitdiff
patch 8.2.1314: Vim9: rule for comment after :function is confusing v8.2.1314
authorBram Moolenaar <Bram@vim.org>
Wed, 29 Jul 2020 12:40:25 +0000 (14:40 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 29 Jul 2020 12:40:25 +0000 (14:40 +0200)
Problem:    Vim9: rule for comment after :function is confusing.
Solution:   Allow double quoted comment after :function in vim9script.
            (closes #6556)

src/testdir/test_vim9_script.vim
src/userfunc.c
src/version.c

index 427e91238e1bcf8c3a46d956fd6031de3358568b..b491fa21a585ad1d6d37dc315e0e3b014136ce25 100644 (file)
@@ -2284,6 +2284,10 @@ def Test_vim9_comment()
       'vim9script',
       'function # comment',
       ])
+  CheckScriptFailure([
+      'vim9script',
+      'function " comment',
+      ], 'E129:')
   CheckScriptFailure([
       'vim9script',
       'function# comment',
@@ -2333,11 +2337,11 @@ def Test_vim9_comment()
       'func Test() " comment',
       'endfunc',
       ])
-  CheckScriptFailure([
+  CheckScriptSuccess([
       'vim9script',
       'func Test() " comment',
       'endfunc',
-      ], 'E488:')
+      ])
 
   CheckScriptSuccess([
       'def Test() # comment',
index d17e807dc616ceb58761fdf5f6ef02f3aa275baa..343c9cd2e1dd22d659cc222d12f0cb02963e427a 100644 (file)
@@ -2832,7 +2832,8 @@ def_function(exarg_T *eap, char_u *name_arg)
     if (*p == '\n')
        line_arg = p + 1;
     else if (*p != NUL
-           && !(*p == '"' && !(vim9script || eap->cmdidx == CMD_def))
+           && !(*p == '"' && (!vim9script || eap->cmdidx == CMD_function)
+                                                    && eap->cmdidx != CMD_def)
            && !(*p == '#' && (vim9script || eap->cmdidx == CMD_def))
            && !eap->skip
            && !did_emsg)
index fce921888c6095983302410ccde475026e58b932..b1ed1df4b612376d896a093ce7f1926ba843b22d 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1314,
 /**/
     1313,
 /**/