mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.2744: Vim9: no way to explicitly ignore an argument
Problem: Vim9: no way to explicitly ignore an argument. Solution: Use the underscore as the name for an ignored argument.
This commit is contained in:
@@ -4416,6 +4416,12 @@ compile_expr7(
|
||||
|
||||
// "name" or "name()"
|
||||
p = to_name_end(*arg, TRUE);
|
||||
if (p - *arg == (size_t)1 && **arg == '_')
|
||||
{
|
||||
emsg(_(e_cannot_use_underscore_here));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (*p == '(')
|
||||
{
|
||||
r = compile_call(arg, p - *arg, cctx, ppconst, 0);
|
||||
@@ -6378,6 +6384,11 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
||||
semsg(_(e_cannot_assign_to_constant), lhs.lhs_name);
|
||||
goto theend;
|
||||
}
|
||||
if (is_decl && lhs.lhs_name[0] == '_' && lhs.lhs_name[1] == NUL)
|
||||
{
|
||||
emsg(_(e_cannot_use_underscore_here));
|
||||
goto theend;
|
||||
}
|
||||
|
||||
if (!heredoc)
|
||||
{
|
||||
|
Reference in New Issue
Block a user