# HG changeset patch # User Bram Moolenaar # Date 1597172406 -7200 # Node ID a7e0091a46690e9d2ed000348d6b0af44cec955f # Parent 6f8dfb98904b28df573bcce93d17597a1a4e3b98 patch 8.2.1421: Vim9: handling "+" and "-" before number differs from script Commit: https://github.com/vim/vim/commit/4301a729eabafee388aaf8465cf780d3f84cec95 Author: Bram Moolenaar 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. diff --git a/src/version.c b/src/version.c --- 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, diff --git a/src/vim9compile.c b/src/vim9compile.c --- 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