0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.2137: Vim9: :echo and :execute give error for empty argument

Problem:    Vim9: :echo and :execute give error for empty argument.
Solution:   Ignore an empty argument. (closes #7468)
This commit is contained in:
Bram Moolenaar
2020-12-13 14:19:25 +01:00
parent c530852315
commit e498429087
5 changed files with 51 additions and 26 deletions

View File

@@ -3975,7 +3975,10 @@ compile_expr7(
if (!eval_isnamec1(**arg))
{
semsg(_(e_name_expected), *arg);
if (ends_excmd(*skipwhite(*arg)))
semsg(_(e_empty_expression_str), *arg);
else
semsg(_(e_name_expected_str), *arg);
return FAIL;
}
@@ -7101,28 +7104,31 @@ compile_throw(char_u *arg, cctx_T *cctx UNUSED)
compile_mult_expr(char_u *arg, int cmdidx, cctx_T *cctx)
{
char_u *p = arg;
char_u *prev;
char_u *prev = arg;
int count = 0;
for (;;)
{
if (ends_excmd2(prev, p))
break;
if (compile_expr0(&p, cctx) == FAIL)
return NULL;
++count;
prev = p;
p = skipwhite(p);
if (ends_excmd2(prev, p))
break;
}
if (cmdidx == CMD_echo || cmdidx == CMD_echon)
generate_ECHO(cctx, cmdidx == CMD_echo, count);
else if (cmdidx == CMD_execute)
generate_MULT_EXPR(cctx, ISN_EXECUTE, count);
else if (cmdidx == CMD_echomsg)
generate_MULT_EXPR(cctx, ISN_ECHOMSG, count);
else
generate_MULT_EXPR(cctx, ISN_ECHOERR, count);
if (count > 0)
{
if (cmdidx == CMD_echo || cmdidx == CMD_echon)
generate_ECHO(cctx, cmdidx == CMD_echo, count);
else if (cmdidx == CMD_execute)
generate_MULT_EXPR(cctx, ISN_EXECUTE, count);
else if (cmdidx == CMD_echomsg)
generate_MULT_EXPR(cctx, ISN_ECHOMSG, count);
else
generate_MULT_EXPR(cctx, ISN_ECHOERR, count);
}
return p;
}