Mercurial > vim
changeset 21094:376b520312d6 v8.2.1098
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Commit: https://github.com/vim/vim/commit/006ad48b8a15c3bace741d8caaf3195e592fbe78
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 30 20:55:15 2020 +0200
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Problem: Vim9: cannot use line break in :throw argument.
Solution: Check for line break.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Jun 2020 21:00:03 +0200 |
parents | 99a602b27e0e |
children | 989c7526a1b2 |
files | src/eval.c src/testdir/test_vim9_script.vim src/version.c |
diffstat | 3 files changed, 27 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -333,10 +333,18 @@ eval_to_string_skip( { typval_T tv; char_u *retval; - + evalarg_T evalarg; + + CLEAR_FIELD(evalarg); + evalarg.eval_flags = skip ? 0 : EVAL_EVALUATE; + if (eap != NULL && getline_equal(eap->getline, eap->cookie, getsourceline)) + { + evalarg.eval_getline = eap->getline; + evalarg.eval_cookie = eap->cookie; + } if (skip) ++emsg_skip; - if (eval0(arg, &tv, eap, skip ? NULL : &EVALARG_EVALUATE) == FAIL || skip) + if (eval0(arg, &tv, eap, &evalarg) == FAIL || skip) retval = NULL; else { @@ -345,7 +353,7 @@ eval_to_string_skip( } if (skip) --emsg_skip; - clear_evalarg(&EVALARG_EVALUATE, eap); + clear_evalarg(&evalarg, eap); return retval; }
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -585,6 +585,20 @@ def Test_try_catch_fails() call CheckDefFailure(['throw xxx'], 'E1001:') enddef +def Test_throw_vimscript() + " only checks line continuation + let lines =<< trim END + vim9script + try + throw 'one' + .. 'two' + catch + assert_equal('onetwo', v:exception) + endtry + END + CheckScriptSuccess(lines) +enddef + if has('channel') let someJob = test_null_job()