Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
22771:84263588f5be | 22772:82a7aff951d2 |
---|---|
2640 { | 2640 { |
2641 garray_T *stack = &cctx->ctx_type_stack; | 2641 garray_T *stack = &cctx->ctx_type_stack; |
2642 type_T *type = ((type_T **)stack->ga_data)[ | 2642 type_T *type = ((type_T **)stack->ga_data)[ |
2643 stack->ga_len - 2]; | 2643 stack->ga_len - 2]; |
2644 | 2644 |
2645 // add() can be compiled to instructions if we know the type | |
2645 if (type->tt_type == VAR_LIST) | 2646 if (type->tt_type == VAR_LIST) |
2646 { | 2647 { |
2647 // inline "add(list, item)" so that the type can be checked | 2648 // inline "add(list, item)" so that the type can be checked |
2648 res = generate_LISTAPPEND(cctx); | 2649 res = generate_LISTAPPEND(cctx); |
2649 idx = -1; | 2650 idx = -1; |
7171 { | 7172 { |
7172 line = compile_block(ea.cmd, &cctx); | 7173 line = compile_block(ea.cmd, &cctx); |
7173 continue; | 7174 continue; |
7174 } | 7175 } |
7175 break; | 7176 break; |
7176 | |
7177 case ':': | |
7178 starts_with_colon = TRUE; | |
7179 break; | |
7180 } | 7177 } |
7181 | 7178 |
7182 /* | 7179 /* |
7183 * COMMAND MODIFIERS | 7180 * COMMAND MODIFIERS |
7184 */ | 7181 */ |
7192 line = (char_u *)""; | 7189 line = (char_u *)""; |
7193 continue; | 7190 continue; |
7194 } | 7191 } |
7195 generate_cmdmods(&cctx, &local_cmdmod); | 7192 generate_cmdmods(&cctx, &local_cmdmod); |
7196 undo_cmdmod(&local_cmdmod); | 7193 undo_cmdmod(&local_cmdmod); |
7194 | |
7195 // Check if there was a colon after the last command modifier or before | |
7196 // the current position. | |
7197 for (p = ea.cmd; p >= line; --p) | |
7198 { | |
7199 if (*p == ':') | |
7200 starts_with_colon = TRUE; | |
7201 if (p < ea.cmd && !VIM_ISWHITE(*p)) | |
7202 break; | |
7203 } | |
7197 | 7204 |
7198 // Skip ":call" to get to the function name. | 7205 // Skip ":call" to get to the function name. |
7199 p = ea.cmd; | 7206 p = ea.cmd; |
7200 if (checkforcmd(&ea.cmd, "call", 3)) | 7207 if (checkforcmd(&ea.cmd, "call", 3)) |
7201 { | 7208 { |