1
0
forked from aniani/vim

patch 8.2.1934: Vim9: command modifiers in :def function not tested

Problem:    Vim9: command modifiers in :def function not tested.
Solution:   Add tests.  Fix using modifier before filter command.
This commit is contained in:
Bram Moolenaar
2020-11-01 17:03:37 +01:00
parent 55e29611d2
commit e88c8e802c
4 changed files with 160 additions and 8 deletions

View File

@@ -2642,6 +2642,7 @@ compile_call(
type_T *type = ((type_T **)stack->ga_data)[
stack->ga_len - 2];
// add() can be compiled to instructions if we know the type
if (type->tt_type == VAR_LIST)
{
// inline "add(list, item)" so that the type can be checked
@@ -7173,10 +7174,6 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
continue;
}
break;
case ':':
starts_with_colon = TRUE;
break;
}
/*
@@ -7195,6 +7192,16 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
generate_cmdmods(&cctx, &local_cmdmod);
undo_cmdmod(&local_cmdmod);
// Check if there was a colon after the last command modifier or before
// the current position.
for (p = ea.cmd; p >= line; --p)
{
if (*p == ':')
starts_with_colon = TRUE;
if (p < ea.cmd && !VIM_ISWHITE(*p))
break;
}
// Skip ":call" to get to the function name.
p = ea.cmd;
if (checkforcmd(&ea.cmd, "call", 3))