From: Bram Moolenaar Date: Tue, 11 Aug 2020 18:51:08 +0000 (+0200) Subject: patch 8.2.1421: Vim9: handling "+" and "-" before number differs from script X-Git-Tag: v8.2.1421 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4301a729eabafee388aaf8465cf780d3f84cec95;p=vim 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 index a31436bd0..7411bc0d8 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1421, /**/ 1420, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index d327b4855..72c26ce46 100644 --- 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