Mercurial > vim
changeset 21743:a7e0091a4669 v8.2.1421
patch 8.2.1421: Vim9: handling "+" and "-" before number differs from script
Commit: https://github.com/vim/vim/commit/4301a729eabafee388aaf8465cf780d3f84cec95
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 11 20:51:08 2020 +0200
patch 8.2.1421: Vim9: handling "+" and "-" before number differs from script
Problem: Vim9: handling "+" and "-" before number differs from Vim script.
Solution: Use the same sequence of commands.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 11 Aug 2020 21:00:06 +0200 |
parents | 6f8dfb98904b |
children | 805e8d18b78b |
files | src/version.c src/vim9compile.c |
diffstat | 2 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1421, +/**/ 1420, /**/ 1419,
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3206,6 +3206,15 @@ compile_expr7( case '9': case '.': if (eval_number(arg, rettv, TRUE, FALSE) == FAIL) return FAIL; + // Apply "-" and "+" just before the number now, right to + // left. Matters especially when "->" follows. Stops at + // '!'. + if (apply_leader(rettv, TRUE, + start_leader, &end_leader) == FAIL) + { + clear_tv(rettv); + return FAIL; + } break; /* @@ -3344,13 +3353,6 @@ compile_expr7( if (rettv->v_type != VAR_UNKNOWN && used_before == ppconst->pp_used) { - // apply the '-' and '+' before the constant, but not '!' - if (apply_leader(rettv, TRUE, start_leader, &end_leader) == FAIL) - { - clear_tv(rettv); - return FAIL; - } - if (cctx->ctx_skip == SKIP_YES) clear_tv(rettv); else