diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-07-29 14:40:25 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-07-29 14:40:25 +0200 |
commit | 9898107f54a330c6d9629976250a393169c698ca (patch) | |
tree | 8a4b2b3cbb974768201f899d0ca48b40789de488 /src | |
parent | b5ed266037dea49024e00c4e1f9c89f3a9ebaa60 (diff) | |
download | vim-git-9898107f54a330c6d9629976250a393169c698ca.tar.gz |
patch 8.2.1314: Vim9: rule for comment after :function is confusingv8.2.1314
Problem: Vim9: rule for comment after :function is confusing.
Solution: Allow double quoted comment after :function in vim9script.
(closes #6556)
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_vim9_script.vim | 8 | ||||
-rw-r--r-- | src/userfunc.c | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 427e91238..b491fa21a 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -2286,6 +2286,10 @@ def Test_vim9_comment() ]) CheckScriptFailure([ 'vim9script', + 'function " comment', + ], 'E129:') + CheckScriptFailure([ + 'vim9script', 'function# comment', ], 'E129:') CheckScriptSuccess([ @@ -2333,11 +2337,11 @@ def Test_vim9_comment() 'func Test() " comment', 'endfunc', ]) - CheckScriptFailure([ + CheckScriptSuccess([ 'vim9script', 'func Test() " comment', 'endfunc', - ], 'E488:') + ]) CheckScriptSuccess([ 'def Test() # comment', diff --git a/src/userfunc.c b/src/userfunc.c index d17e807dc..343c9cd2e 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -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) diff --git a/src/version.c b/src/version.c index fce921888..b1ed1df4b 100644 --- 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 */ /**/ + 1314, +/**/ 1313, /**/ 1312, |