summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-07 10:03:27 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-07 10:03:27 +0100
commit70d87690a39222277c2beab0649e343a78dee908 (patch)
tree7ab9f1fdd452e27c51f394fb5970b141a1dc0c16 /src/vim9compile.c
parent39be4981cdd93a185b110536f84d99ce56e2c3cc (diff)
downloadvim-git-70d87690a39222277c2beab0649e343a78dee908.tar.gz
patch 8.2.4898: Coverity complains about pointer usagev8.2.4898
Problem: Coverity complains about pointer usage. Solution: Move code for increment/decerment.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 9b7108b83..15dab9862 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2018,20 +2018,6 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
lhs.lhs_name = NULL;
- sp = p;
- p = skipwhite(p);
- op = p;
- oplen = assignment_len(p, &heredoc);
-
- if (var_count > 0 && oplen == 0)
- // can be something like "[1, 2]->func()"
- return arg;
-
- if (oplen > 0 && (!VIM_ISWHITE(*sp) || !IS_WHITE_OR_NUL(op[oplen])))
- {
- error_white_both(op, oplen);
- return NULL;
- }
if (eap->cmdidx == CMD_increment || eap->cmdidx == CMD_decrement)
{
if (VIM_ISWHITE(eap->cmd[2]))
@@ -2044,6 +2030,23 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
oplen = 2;
incdec = TRUE;
}
+ else
+ {
+ sp = p;
+ p = skipwhite(p);
+ op = p;
+ oplen = assignment_len(p, &heredoc);
+
+ if (var_count > 0 && oplen == 0)
+ // can be something like "[1, 2]->func()"
+ return arg;
+
+ if (oplen > 0 && (!VIM_ISWHITE(*sp) || !IS_WHITE_OR_NUL(op[oplen])))
+ {
+ error_white_both(op, oplen);
+ return NULL;
+ }
+ }
if (heredoc)
{