mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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.
This commit is contained in:
12
src/eval.c
12
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;
|
||||
}
|
||||
|
@@ -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()
|
||||
|
||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1098,
|
||||
/**/
|
||||
1097,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user