mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2620: Vim9: Using #{ for a dictionary gives strange errors
Problem: Vim9: Using #{ for a dictionary gives strange errors. Solution: Give an error when using #{ for a comment after a command.
This commit is contained in:
@@ -1546,7 +1546,7 @@ generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc)
|
||||
isn->isn_arg.funcref.fr_func = ufunc->uf_dfunc_idx;
|
||||
cctx->ctx_has_closure = 1;
|
||||
|
||||
// if the referenced function is a closure, it may use items further up in
|
||||
// If the referenced function is a closure, it may use items further up in
|
||||
// the nested context, including this one.
|
||||
if (ufunc->uf_flags & FC_CLOSURE)
|
||||
cctx->ctx_ufunc->uf_flags |= FC_CLOSURE;
|
||||
@@ -2401,6 +2401,8 @@ peek_next_line_from_context(cctx_T *cctx)
|
||||
if (line != NULL)
|
||||
{
|
||||
p = skipwhite(line);
|
||||
if (vim9_bad_comment(p))
|
||||
return NULL;
|
||||
if (*p != NUL && !vim9_comment_start(p))
|
||||
return p;
|
||||
}
|
||||
@@ -2465,6 +2467,8 @@ next_line_from_context(cctx_T *cctx, int skip_comment)
|
||||
may_get_next_line(char_u *whitep, char_u **arg, cctx_T *cctx)
|
||||
{
|
||||
*arg = skipwhite(whitep);
|
||||
if (vim9_bad_comment(*arg))
|
||||
return FAIL;
|
||||
if (**arg == NUL || (VIM_ISWHITE(*whitep) && vim9_comment_start(*arg)))
|
||||
{
|
||||
char_u *next = next_line_from_context(cctx, TRUE);
|
||||
@@ -4277,10 +4281,13 @@ compile_expr7(
|
||||
|
||||
if (!eval_isnamec1(**arg))
|
||||
{
|
||||
if (ends_excmd(*skipwhite(*arg)))
|
||||
semsg(_(e_empty_expression_str), *arg);
|
||||
else
|
||||
semsg(_(e_name_expected_str), *arg);
|
||||
if (!vim9_bad_comment(*arg))
|
||||
{
|
||||
if (ends_excmd(*skipwhite(*arg)))
|
||||
semsg(_(e_empty_expression_str), *arg);
|
||||
else
|
||||
semsg(_(e_name_expected_str), *arg);
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -8297,6 +8304,8 @@ compile_def_function(
|
||||
semsg(_(e_trailing_arg), line);
|
||||
goto erret;
|
||||
}
|
||||
else if (line != NULL && vim9_bad_comment(skipwhite(line)))
|
||||
goto erret;
|
||||
else
|
||||
{
|
||||
line = next_line_from_context(&cctx, FALSE);
|
||||
|
Reference in New Issue
Block a user