'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()
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;
ret_type = NULL;
}
}
+ p = skipwhite(p);
}
else
// find extra arguments "range", "dict", "abort" and "closure"
// 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));
/*
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;