Mercurial > vim
diff src/vim9compile.c @ 22772:82a7aff951d2 v8.2.1934
patch 8.2.1934: Vim9: command modifiers in :def function not tested
Commit: https://github.com/vim/vim/commit/e88c8e802cf5ee59a2a6649a5b46c9e80de823ad
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 1 17:03:37 2020 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Nov 2020 17:15:06 +0100 |
parents | 48feb3dd0d25 |
children | 8a5369f5f2b4 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -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 continue; } break; - - case ':': - starts_with_colon = TRUE; - break; } /* @@ -7195,6 +7192,16 @@ compile_def_function(ufunc_T *ufunc, int 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))