summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-05 12:32:38 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-05 12:32:38 +0200
commit3c1c9fd94bc80871119a8519f3b881595082a6c0 (patch)
tree358c5fd31972aad23055b1f9c794aacde70c355d /src/eval.c
parentc753478b82613df37b145764e27f5514542edb97 (diff)
patch 8.2.1371: Vim9: no error for missing white space around operatorv8.2.1371
Problem: Vim9: no error for missing white space around operator. Solution: Check for white space around && and ||.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index 6411ffa146..a9c36ac38c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2242,11 +2242,25 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
if (getnext)
*arg = eval_next_line(evalarg_used);
else
+ {
+ if (evaluate && in_vim9script() && !VIM_ISWHITE(p[-1]))
+ {
+ error_white_both(p, 2);
+ clear_tv(rettv);
+ return FAIL;
+ }
*arg = p;
+ }
/*
* Get the second variable.
*/
+ if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2]))
+ {
+ error_white_both(p, 2);
+ clear_tv(rettv);
+ return FAIL;
+ }
*arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
evalarg_used->eval_flags = !result ? orig_flags
: orig_flags & ~EVAL_EVALUATE;
@@ -2359,11 +2373,25 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
if (getnext)
*arg = eval_next_line(evalarg_used);
else
+ {
+ if (evaluate && in_vim9script() && !VIM_ISWHITE(p[-1]))
+ {
+ error_white_both(p, 2);
+ clear_tv(rettv);
+ return FAIL;
+ }
*arg = p;
+ }
/*
* Get the second variable.
*/
+ if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2]))
+ {
+ error_white_both(p, 2);
+ clear_tv(rettv);
+ return FAIL;
+ }
*arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
evalarg_used->eval_flags = result ? orig_flags
: orig_flags & ~EVAL_EVALUATE;