• R/O
  • SSH

vim: コミット

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


コミットメタ情報

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

ログメッセージ

patch 8.2.1099: Vim9: cannot use line break in :cexpr argument

Commit: https://github.com/vim/vim/commit/37c837119579ff70b005a4e54c2e26ca42b74022
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 30 21:18:36 2020 +0200

patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Problem: Vim9: cannot use line break in :cexpr argument.
Solution: Check for line break.

変更サマリ

差分

diff -r 989c7526a1b2 -r 74e5e212e550 src/eval.c
--- a/src/eval.c Tue Jun 30 21:00:04 2020 +0200
+++ b/src/eval.c Tue Jun 30 21:30:04 2020 +0200
@@ -153,6 +153,18 @@
153153 }
154154 #endif
155155
156+ static void
157+fill_evalarg_from_eap(evalarg_T *evalarg, exarg_T *eap, int skip)
158+{
159+ CLEAR_FIELD(*evalarg);
160+ evalarg->eval_flags = skip ? 0 : EVAL_EVALUATE;
161+ if (eap != NULL && getline_equal(eap->getline, eap->cookie, getsourceline))
162+ {
163+ evalarg->eval_getline = eap->getline;
164+ evalarg->eval_cookie = eap->cookie;
165+ }
166+}
167+
156168 /*
157169 * Top level evaluation function, returning a boolean.
158170 * Sets "error" to TRUE if there was an error.
@@ -169,13 +181,7 @@
169181 varnumber_T retval = FALSE;
170182 evalarg_T evalarg;
171183
172- CLEAR_FIELD(evalarg);
173- evalarg.eval_flags = skip ? 0 : EVAL_EVALUATE;
174- if (eap != NULL && getline_equal(eap->getline, eap->cookie, getsourceline))
175- {
176- evalarg.eval_getline = eap->getline;
177- evalarg.eval_cookie = eap->cookie;
178- }
184+ fill_evalarg_from_eap(&evalarg, eap, skip);
179185
180186 if (skip)
181187 ++emsg_skip;
@@ -335,13 +341,7 @@
335341 char_u *retval;
336342 evalarg_T evalarg;
337343
338- CLEAR_FIELD(evalarg);
339- evalarg.eval_flags = skip ? 0 : EVAL_EVALUATE;
340- if (eap != NULL && getline_equal(eap->getline, eap->cookie, getsourceline))
341- {
342- evalarg.eval_getline = eap->getline;
343- evalarg.eval_cookie = eap->cookie;
344- }
344+ fill_evalarg_from_eap(&evalarg, eap, skip);
345345 if (skip)
346346 ++emsg_skip;
347347 if (eval0(arg, &tv, eap, &evalarg) == FAIL || skip)
@@ -535,12 +535,15 @@
535535 eval_expr(char_u *arg, exarg_T *eap)
536536 {
537537 typval_T *tv;
538+ evalarg_T evalarg;
539+
540+ fill_evalarg_from_eap(&evalarg, eap, eap != NULL && eap->skip);
538541
539542 tv = ALLOC_ONE(typval_T);
540- if (tv != NULL && eval0(arg, tv, eap, &EVALARG_EVALUATE) == FAIL)
543+ if (tv != NULL && eval0(arg, tv, eap, &evalarg) == FAIL)
541544 VIM_CLEAR(tv);
542- clear_evalarg(&EVALARG_EVALUATE, eap);
543-
545+
546+ clear_evalarg(&evalarg, eap);
544547 return tv;
545548 }
546549
@@ -5239,13 +5242,7 @@
52395242 int called_emsg_before = called_emsg;
52405243 evalarg_T evalarg;
52415244
5242- CLEAR_FIELD(evalarg);
5243- evalarg.eval_flags = eap->skip ? 0 : EVAL_EVALUATE;
5244- if (getline_equal(eap->getline, eap->cookie, getsourceline))
5245- {
5246- evalarg.eval_getline = eap->getline;
5247- evalarg.eval_cookie = eap->cookie;
5248- }
5245+ fill_evalarg_from_eap(&evalarg, eap, eap != NULL && eap->skip);
52495246
52505247 if (eap->skip)
52515248 ++emsg_skip;
diff -r 989c7526a1b2 -r 74e5e212e550 src/testdir/test_vim9_script.vim
--- a/src/testdir/test_vim9_script.vim Tue Jun 30 21:00:04 2020 +0200
+++ b/src/testdir/test_vim9_script.vim Tue Jun 30 21:30:04 2020 +0200
@@ -599,6 +599,20 @@
599599 CheckScriptSuccess(lines)
600600 enddef
601601
602+def Test_cexpr_vimscript()
603+ " only checks line continuation
604+ set errorformat=File\ %f\ line\ %l
605+ let lines =<< trim END
606+ vim9script
607+ cexpr 'File'
608+ .. ' someFile' ..
609+ ' line 19'
610+ assert_equal(19, getqflist()[0].lnum)
611+ END
612+ CheckScriptSuccess(lines)
613+ set errorformat&
614+enddef
615+
602616 if has('channel')
603617 let someJob = test_null_job()
604618
diff -r 989c7526a1b2 -r 74e5e212e550 src/version.c
--- a/src/version.c Tue Jun 30 21:00:04 2020 +0200
+++ b/src/version.c Tue Jun 30 21:30:04 2020 +0200
@@ -755,6 +755,8 @@
755755 static int included_patches[] =
756756 { /* Add new patch number below this line */
757757 /**/
758+ 1099,
759+/**/
758760 1098,
759761 /**/
760762 1097,
旧リポジトリブラウザで表示