summaryrefslogtreecommitdiff
path: root/src/ex_eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-28 18:43:40 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-28 18:43:40 +0200
commitb7a78f7a6713f07d2fcad0b27dea22925c7b1cdf (patch)
treef1eb802f74a924f91ba0ceddde5db8229c75aeda /src/ex_eval.c
parentd5053d015a957b343ad9c9e45e0abd2978f10cf0 (diff)
downloadvim-git-b7a78f7a6713f07d2fcad0b27dea22925c7b1cdf.tar.gz
patch 8.2.1080: Vim9: no line break allowed in a for loopv8.2.1080
Problem: Vim9: no line break allowed in a for loop. Solution: Skip line breaks in for command.
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r--src/ex_eval.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 6f6b8c218..fea8c7fd6 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -899,10 +899,16 @@ ex_eval(exarg_T *eap)
CLEAR_FIELD(evalarg);
evalarg.eval_flags = eap->skip ? 0 : EVAL_EVALUATE;
- evalarg.eval_cookie = eap->getline == getsourceline ? eap->cookie : NULL;
+ if (getline_equal(eap->getline, eap->cookie, getsourceline))
+ {
+ evalarg.eval_getline = eap->getline;
+ evalarg.eval_cookie = eap->cookie;
+ }
if (eval0(eap->arg, &tv, eap, &evalarg) == OK)
clear_tv(&tv);
+
+ clear_evalarg(&evalarg, eap);
}
/*
@@ -1108,7 +1114,16 @@ ex_while(exarg_T *eap)
}
else
{
- void *fi;
+ void *fi;
+ evalarg_T evalarg;
+
+ CLEAR_FIELD(evalarg);
+ evalarg.eval_flags = skip ? 0 : EVAL_EVALUATE;
+ if (getline_equal(eap->getline, eap->cookie, getsourceline))
+ {
+ evalarg.eval_getline = eap->getline;
+ evalarg.eval_cookie = eap->cookie;
+ }
/*
* ":for var in list-expr"
@@ -1119,11 +1134,14 @@ ex_while(exarg_T *eap)
// previously evaluated list.
fi = cstack->cs_forinfo[cstack->cs_idx];
error = FALSE;
+
+ // the "in expr" is not used, skip over it
+ skip_for_lines(fi, &evalarg);
}
else
{
// Evaluate the argument and get the info in a structure.
- fi = eval_for_line(eap->arg, &error, eap, skip);
+ fi = eval_for_line(eap->arg, &error, eap, &evalarg);
cstack->cs_forinfo[cstack->cs_idx] = fi;
}
@@ -1138,6 +1156,7 @@ ex_while(exarg_T *eap)
free_for_info(fi);
cstack->cs_forinfo[cstack->cs_idx] = NULL;
}
+ clear_evalarg(&evalarg, eap);
}
/*