summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-11 20:51:08 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-11 20:51:08 +0200
commit4301a729eabafee388aaf8465cf780d3f84cec95 (patch)
tree3bf92f62322d26a37ea27ec75fe5bda1d16fc6a7
parentf7c4d83609acdfe0e4d0fec9413697ac97c0c3f9 (diff)
patch 8.2.1421: Vim9: handling "+" and "-" before number differs from scriptv8.2.1421
Problem: Vim9: handling "+" and "-" before number differs from Vim script. Solution: Use the same sequence of commands.
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c16
2 files changed, 11 insertions, 7 deletions
diff --git a/src/version.c b/src/version.c
index a31436bd0f..7411bc0d89 100644
--- 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
index d327b48555..72c26ce46e 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