0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1314: Vim9: rule for comment after :function is confusing

Problem:    Vim9: rule for comment after :function is confusing.
Solution:   Allow double quoted comment after :function in vim9script.
            (closes #6556)
This commit is contained in:
Bram Moolenaar
2020-07-29 14:40:25 +02:00
parent b5ed266037
commit 9898107f54
3 changed files with 10 additions and 3 deletions

View File

@@ -2284,6 +2284,10 @@ def Test_vim9_comment()
'vim9script', 'vim9script',
'function # comment', 'function # comment',
]) ])
CheckScriptFailure([
'vim9script',
'function " comment',
], 'E129:')
CheckScriptFailure([ CheckScriptFailure([
'vim9script', 'vim9script',
'function# comment', 'function# comment',
@@ -2333,11 +2337,11 @@ def Test_vim9_comment()
'func Test() " comment', 'func Test() " comment',
'endfunc', 'endfunc',
]) ])
CheckScriptFailure([ CheckScriptSuccess([
'vim9script', 'vim9script',
'func Test() " comment', 'func Test() " comment',
'endfunc', 'endfunc',
], 'E488:') ])
CheckScriptSuccess([ CheckScriptSuccess([
'def Test() # comment', 'def Test() # comment',

View File

@@ -2832,7 +2832,8 @@ def_function(exarg_T *eap, char_u *name_arg)
if (*p == '\n') if (*p == '\n')
line_arg = p + 1; line_arg = p + 1;
else if (*p != NUL 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)) && !(*p == '#' && (vim9script || eap->cmdidx == CMD_def))
&& !eap->skip && !eap->skip
&& !did_emsg) && !did_emsg)

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1314,
/**/ /**/
1313, 1313,
/**/ /**/