Patch 8.2.1268
Problem: Vim9: no error for using double quote comment after :func or :def.
Solution: Only accept double quote when not in Vim9 script and not after
:def. (closes #6483)
Files: src/userfunc.c, src/testdir/test_vim9_script.vim
*** ../vim-8.2.1267/src/userfunc.c 2020-07-19 20:48:56.182995168 +0200
--- src/userfunc.c 2020-07-21 23:15:46.917435582 +0200
***************
*** 2555,2562 ****
int is_heredoc = FALSE;
char_u *skip_until = NULL;
char_u *heredoc_trimmed = NULL;
! if (in_vim9script() && eap->forceit)
{
emsg(_(e_nobang));
return NULL;
--- 2555,2563 ----
int is_heredoc = FALSE;
char_u *skip_until = NULL;
char_u *heredoc_trimmed = NULL;
+ int vim9script = in_vim9script();
! if (vim9script && eap->forceit)
{
emsg(_(e_nobang));
return NULL;
***************
*** 2786,2791 ****
--- 2787,2793 ----
ret_type = NULL;
}
}
+ p = skipwhite(p);
}
else
// find extra arguments "range", "dict", "abort" and "closure"
***************
*** 2826,2833 ****
// Makes 'exe "func Test()\n...\nendfunc"' work.
if (*p == '\n')
line_arg = p + 1;
! else if (*p != NUL && *p != '"' && !(eap->cmdidx == CMD_def && *p == '#')
! && !eap->skip && !did_emsg)
emsg(_(e_trailing));
/*
--- 2828,2838 ----
// Makes 'exe "func Test()\n...\nendfunc"' work.
if (*p == '\n')
line_arg = p + 1;
! else if (*p != NUL
! && !(*p == '"' && !(vim9script || eap->cmdidx == CMD_def))
! && !(*p == '#' && (vim9script || eap->cmdidx == CMD_def))
! && !eap->skip
! && !did_emsg)
emsg(_(e_trailing));
/*
***************
*** 3386,3392 ****
fp->uf_varargs = varargs;
if (sandbox)
flags |= FC_SANDBOX;
! if (in_vim9script() && !ASCII_ISUPPER(*fp->uf_name))
flags |= FC_VIM9;
fp->uf_flags = flags;
fp->uf_calls = 0;
--- 3391,3397 ----
fp->uf_varargs = varargs;
if (sandbox)
flags |= FC_SANDBOX;
! if (vim9script && !ASCII_ISUPPER(*fp->uf_name))
flags |= FC_VIM9;
fp->uf_flags = flags;
fp->uf_calls = 0;
*** ../vim-8.2.1267/src/testdir/test_vim9_script.vim 2020-07-20
22:37:40.554206364 +0200
--- src/testdir/test_vim9_script.vim 2020-07-21 23:14:31.785615774 +0200
***************
*** 2198,2203 ****
--- 2198,2232 ----
'vim9script',
'call execute("ls")# comment',
], 'E488:')
+
+ CheckScriptFailure([
+ 'def Test() " comment',
+ 'enddef',
+ ], 'E488:')
+ CheckScriptFailure([
+ 'vim9script',
+ 'def Test() " comment',
+ 'enddef',
+ ], 'E488:')
+
+ CheckScriptSuccess([
+ 'func Test() " comment',
+ 'endfunc',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'func Test() " comment',
+ 'endfunc',
+ ], 'E488:')
+
+ CheckScriptSuccess([
+ 'def Test() # comment',
+ 'enddef',
+ ])
+ CheckScriptFailure([
+ 'func Test() # comment',
+ 'endfunc',
+ ], 'E488:')
enddef
def Test_vim9_comment_gui()
*** ../vim-8.2.1267/src/version.c 2020-07-22 18:14:55.256525080 +0200
--- src/version.c 2020-07-22 18:16:20.508085004 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1268,
/**/
--
Over the years, I've developed my sense of deja vu so acutely that now
I can remember things that *have* happened before ...
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202007221617.06MGHa3b1054746%40masaka.moolenaar.net.