• R/O
  • SSH

vim: コミット

Mirror of the Vim source from https://github.com/vim/vim


コミットメタ情報

リビジョンe88b0daa2fcbbe69bb39de1a6b070b5e9a5ffaa6 (tree)
日時2020-07-01 05:15:04
作者Bram Moolenaar <Bram@vim....>
コミッターBram Moolenaar

ログメッセージ

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.

変更サマリ

差分

diff -r 598a1201821d -r e88b0daa2fcb src/eval.c
--- a/src/eval.c Tue Jun 30 21:30:04 2020 +0200
+++ b/src/eval.c Tue Jun 30 22:15:04 2020 +0200
@@ -207,14 +207,17 @@
207207 * Call eval1() and give an error message if not done at a lower level.
208208 */
209209 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)
211211 {
212212 char_u *start = *arg;
213213 int ret;
214214 int did_emsg_before = did_emsg;
215215 int called_emsg_before = called_emsg;
216-
217- ret = eval1(arg, rettv, evaluate ? &EVALARG_EVALUATE : NULL);
216+ evalarg_T evalarg;
217+
218+ fill_evalarg_from_eap(&evalarg, eap, eap != NULL && eap->skip);
219+
220+ ret = eval1(arg, rettv, &evalarg);
218221 if (ret == FAIL)
219222 {
220223 // Report the invalid expression unless the expression evaluation has
@@ -225,6 +228,7 @@
225228 && called_emsg == called_emsg_before)
226229 semsg(_(e_invexpr2), start);
227230 }
231+ clear_evalarg(&evalarg, eap);
228232 return ret;
229233 }
230234
@@ -294,7 +298,7 @@
294298 if (s == NULL)
295299 return FAIL;
296300 s = skipwhite(s);
297- if (eval1_emsg(&s, rettv, TRUE) == FAIL)
301+ if (eval1_emsg(&s, rettv, NULL) == FAIL)
298302 return FAIL;
299303 if (*s != NUL) // check for trailing chars after expr
300304 {
@@ -5330,7 +5334,7 @@
53305334 ++emsg_skip;
53315335 while (!ends_excmd2(eap->cmd, arg) || *arg == '"')
53325336 {
5333- ret = eval1_emsg(&arg, &rettv, !eap->skip);
5337+ ret = eval1_emsg(&arg, &rettv, eap);
53345338 if (ret == FAIL)
53355339 break;
53365340
diff -r 598a1201821d -r e88b0daa2fcb src/testdir/test_vim9_script.vim
--- a/src/testdir/test_vim9_script.vim Tue Jun 30 21:30:04 2020 +0200
+++ b/src/testdir/test_vim9_script.vim Tue Jun 30 22:15:04 2020 +0200
@@ -1294,6 +1294,19 @@
12941294 call CheckDefFailure(['execute "cmd"# comment'], 'E488:')
12951295 enddef
12961296
1297+def Test_execute_cmd_vimscript()
1298+ " only checks line continuation
1299+ let lines =<< trim END
1300+ vim9script
1301+ execute 'g:someVar'
1302+ .. ' = ' ..
1303+ '28'
1304+ assert_equal(28, g:someVar)
1305+ unlet g:someVar
1306+ END
1307+ CheckScriptSuccess(lines)
1308+enddef
1309+
12971310 def Test_echo_cmd()
12981311 echo 'some' # comment
12991312 echon 'thing'
@@ -1321,6 +1334,18 @@
13211334 call CheckDefFailure(['echomsg "xxx"# comment'], 'E488:')
13221335 enddef
13231336
1337+def Test_echomsg_cmd_vimscript()
1338+ " only checks line continuation
1339+ let lines =<< trim END
1340+ vim9script
1341+ echomsg 'here'
1342+ .. ' is ' ..
1343+ 'a message'
1344+ assert_match('^here is a message$', Screenline(&lines))
1345+ END
1346+ CheckScriptSuccess(lines)
1347+enddef
1348+
13241349 def Test_echoerr_cmd()
13251350 try
13261351 echoerr 'something' 'wrong' # comment
@@ -1329,6 +1354,21 @@
13291354 endtry
13301355 enddef
13311356
1357+def Test_echoerr_cmd_vimscript()
1358+ " only checks line continuation
1359+ let lines =<< trim END
1360+ vim9script
1361+ try
1362+ echoerr 'this'
1363+ .. ' is ' ..
1364+ 'wrong'
1365+ catch
1366+ assert_match('this is wrong', v:exception)
1367+ endtry
1368+ END
1369+ CheckScriptSuccess(lines)
1370+enddef
1371+
13321372 def Test_for_outside_of_function()
13331373 let lines =<< trim END
13341374 vim9script
diff -r 598a1201821d -r e88b0daa2fcb src/version.c
--- a/src/version.c Tue Jun 30 21:30:04 2020 +0200
+++ b/src/version.c Tue Jun 30 22:15:04 2020 +0200
@@ -755,6 +755,8 @@
755755 static int included_patches[] =
756756 { /* Add new patch number below this line */
757757 /**/
758+ 1100,
759+/**/
758760 1099,
759761 /**/
760762 1098,
旧リポジトリブラウザで表示