summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-22 18:17:08 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-22 18:17:08 +0200
commite7e4838f25ac39177f3c3150ee53af8d6e8a0f28 (patch)
tree6790f121a4ad9c1fa3558c40b7aac83ede5bccc7 /src/userfunc.c
parent2690b5aed8b6b6070430b05dcae296cd9479c942 (diff)
downloadvim-git-e7e4838f25ac39177f3c3150ee53af8d6e8a0f28.tar.gz
patch 8.2.1268: Vim9: no error for using double quote commentv8.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)
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index eda1f242f..3967d2743 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2555,8 +2555,9 @@ def_function(exarg_T *eap, char_u *name_arg)
int is_heredoc = FALSE;
char_u *skip_until = NULL;
char_u *heredoc_trimmed = NULL;
+ int vim9script = in_vim9script();
- if (in_vim9script() && eap->forceit)
+ if (vim9script && eap->forceit)
{
emsg(_(e_nobang));
return NULL;
@@ -2786,6 +2787,7 @@ def_function(exarg_T *eap, char_u *name_arg)
ret_type = NULL;
}
}
+ p = skipwhite(p);
}
else
// find extra arguments "range", "dict", "abort" and "closure"
@@ -2826,8 +2828,11 @@ def_function(exarg_T *eap, char_u *name_arg)
// 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)
+ else if (*p != NUL
+ && !(*p == '"' && !(vim9script || eap->cmdidx == CMD_def))
+ && !(*p == '#' && (vim9script || eap->cmdidx == CMD_def))
+ && !eap->skip
+ && !did_emsg)
emsg(_(e_trailing));
/*
@@ -3386,7 +3391,7 @@ def_function(exarg_T *eap, char_u *name_arg)
fp->uf_varargs = varargs;
if (sandbox)
flags |= FC_SANDBOX;
- if (in_vim9script() && !ASCII_ISUPPER(*fp->uf_name))
+ if (vim9script && !ASCII_ISUPPER(*fp->uf_name))
flags |= FC_VIM9;
fp->uf_flags = flags;
fp->uf_calls = 0;