0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.5026: Vim9: a few lines not covered by tests

Problem:    Vim9: a few lines not covered by tests.
Solution:   Delete dead code.  Add a few test cases. make "12->func()" work.
This commit is contained in:
Bram Moolenaar
2022-05-26 22:24:43 +01:00
parent 5cb53b7afe
commit 31d9948e3a
7 changed files with 182 additions and 51 deletions

View File

@@ -3506,6 +3506,18 @@ one_letter_cmd(char_u *p, cmdidx_T *idx)
return FALSE;
}
/*
* Return TRUE if "cmd" starts with "123->", a number followed by a method
* call.
*/
int
number_method(char_u *cmd)
{
char_u *p = skipdigits(cmd);
return p > cmd && (p = skipwhite(p))[0] == '-' && p[1] == '>';
}
/*
* Find an Ex command by its name, either built-in or user.
* Start of the name can be found at eap->cmd.
@@ -3716,6 +3728,13 @@ find_ex_command(
}
}
// 1234->func() is a method call
if (number_method(eap->cmd))
{
eap->cmdidx = CMD_eval;
return eap->cmd;
}
// "g:", "s:" and "l:" are always assumed to be a variable, thus start
// an expression. A global/substitute/list command needs to use a
// longer name.