Mercurial > vim
comparison src/eval.c @ 21098:e88b0daa2fcb v8.2.1100
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Commit: https://github.com/vim/vim/commit/47e880d6c13c3ec2888398fd9ba1f5a7180d791a
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 30 22:02:02 2020 +0200
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Problem: Vim9: cannot use line break in :execute, :echomsg and :echoerr
argument.
Solution: Check for line break.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Jun 2020 22:15:04 +0200 |
parents | 74e5e212e550 |
children | f8ec5a7a9cf6 |
comparison
equal
deleted
inserted
replaced
21097:598a1201821d | 21098:e88b0daa2fcb |
---|---|
205 | 205 |
206 /* | 206 /* |
207 * Call eval1() and give an error message if not done at a lower level. | 207 * Call eval1() and give an error message if not done at a lower level. |
208 */ | 208 */ |
209 static int | 209 static int |
210 eval1_emsg(char_u **arg, typval_T *rettv, int evaluate) | 210 eval1_emsg(char_u **arg, typval_T *rettv, exarg_T *eap) |
211 { | 211 { |
212 char_u *start = *arg; | 212 char_u *start = *arg; |
213 int ret; | 213 int ret; |
214 int did_emsg_before = did_emsg; | 214 int did_emsg_before = did_emsg; |
215 int called_emsg_before = called_emsg; | 215 int called_emsg_before = called_emsg; |
216 | 216 evalarg_T evalarg; |
217 ret = eval1(arg, rettv, evaluate ? &EVALARG_EVALUATE : NULL); | 217 |
218 fill_evalarg_from_eap(&evalarg, eap, eap != NULL && eap->skip); | |
219 | |
220 ret = eval1(arg, rettv, &evalarg); | |
218 if (ret == FAIL) | 221 if (ret == FAIL) |
219 { | 222 { |
220 // Report the invalid expression unless the expression evaluation has | 223 // Report the invalid expression unless the expression evaluation has |
221 // been cancelled due to an aborting error, an interrupt, or an | 224 // been cancelled due to an aborting error, an interrupt, or an |
222 // exception, or we already gave a more specific error. | 225 // exception, or we already gave a more specific error. |
223 // Also check called_emsg for when using assert_fails(). | 226 // Also check called_emsg for when using assert_fails(). |
224 if (!aborting() && did_emsg == did_emsg_before | 227 if (!aborting() && did_emsg == did_emsg_before |
225 && called_emsg == called_emsg_before) | 228 && called_emsg == called_emsg_before) |
226 semsg(_(e_invexpr2), start); | 229 semsg(_(e_invexpr2), start); |
227 } | 230 } |
231 clear_evalarg(&evalarg, eap); | |
228 return ret; | 232 return ret; |
229 } | 233 } |
230 | 234 |
231 /* | 235 /* |
232 * Return whether a typval is a valid expression to pass to eval_expr_typval() | 236 * Return whether a typval is a valid expression to pass to eval_expr_typval() |
292 { | 296 { |
293 s = tv_get_string_buf_chk(expr, buf); | 297 s = tv_get_string_buf_chk(expr, buf); |
294 if (s == NULL) | 298 if (s == NULL) |
295 return FAIL; | 299 return FAIL; |
296 s = skipwhite(s); | 300 s = skipwhite(s); |
297 if (eval1_emsg(&s, rettv, TRUE) == FAIL) | 301 if (eval1_emsg(&s, rettv, NULL) == FAIL) |
298 return FAIL; | 302 return FAIL; |
299 if (*s != NUL) // check for trailing chars after expr | 303 if (*s != NUL) // check for trailing chars after expr |
300 { | 304 { |
301 clear_tv(rettv); | 305 clear_tv(rettv); |
302 semsg(_(e_invexpr2), s); | 306 semsg(_(e_invexpr2), s); |
5328 | 5332 |
5329 if (eap->skip) | 5333 if (eap->skip) |
5330 ++emsg_skip; | 5334 ++emsg_skip; |
5331 while (!ends_excmd2(eap->cmd, arg) || *arg == '"') | 5335 while (!ends_excmd2(eap->cmd, arg) || *arg == '"') |
5332 { | 5336 { |
5333 ret = eval1_emsg(&arg, &rettv, !eap->skip); | 5337 ret = eval1_emsg(&arg, &rettv, eap); |
5334 if (ret == FAIL) | 5338 if (ret == FAIL) |
5335 break; | 5339 break; |
5336 | 5340 |
5337 if (!eap->skip) | 5341 if (!eap->skip) |
5338 { | 5342 { |