1
0
forked from aniani/vim

patch 8.2.1110: Vim9: line continuation does not work in function arguments

Problem:    Vim9: line continuation does not work in function arguments.
Solution:   Pass "evalarg" to get_func_tv().  Fix seeing double quoted string
            as comment.
This commit is contained in:
Bram Moolenaar
2020-07-01 17:28:33 +02:00
parent 086eb18ba1
commit e6b5324e3a
10 changed files with 80 additions and 32 deletions

View File

@@ -601,16 +601,13 @@ get_func_tv(
int len, // length of "name" or -1 to use strlen()
typval_T *rettv,
char_u **arg, // argument, pointing to the '('
evalarg_T *evalarg, // for line continuation
funcexe_T *funcexe) // various values
{
char_u *argp;
int ret = OK;
typval_T argvars[MAX_FUNC_ARGS + 1]; // vars for arguments
int argcount = 0; // number of arguments found
evalarg_T evalarg;
CLEAR_FIELD(evalarg);
evalarg.eval_flags = funcexe->evaluate ? EVAL_EVALUATE : 0;
/*
* Get the arguments.
@@ -619,10 +616,12 @@ get_func_tv(
while (argcount < MAX_FUNC_ARGS - (funcexe->partial == NULL ? 0
: funcexe->partial->pt_argc))
{
argp = skipwhite(argp + 1); // skip the '(' or ','
// skip the '(' or ',' and possibly line breaks
argp = skipwhite_and_linebreak(argp + 1, evalarg);
if (*argp == ')' || *argp == ',' || *argp == NUL)
break;
if (eval1(&argp, &argvars[argcount], &evalarg) == FAIL)
if (eval1(&argp, &argvars[argcount], evalarg) == FAIL)
{
ret = FAIL;
break;
@@ -631,6 +630,7 @@ get_func_tv(
if (*argp != ',')
break;
}
argp = skipwhite_and_linebreak(argp, evalarg);
if (*argp == ')')
++argp;
else
@@ -3832,16 +3832,19 @@ ex_call(exarg_T *eap)
int failed = FALSE;
funcdict_T fudi;
partial_T *partial = NULL;
evalarg_T evalarg;
fill_evalarg_from_eap(&evalarg, eap, eap->skip);
if (eap->skip)
{
// trans_function_name() doesn't work well when skipping, use eval0()
// instead to skip to any following command, e.g. for:
// :if 0 | call dict.foo().bar() | endif
++emsg_skip;
if (eval0(eap->arg, &rettv, eap, NULL) != FAIL)
if (eval0(eap->arg, &rettv, eap, &evalarg) != FAIL)
clear_tv(&rettv);
--emsg_skip;
clear_evalarg(&evalarg, eap);
return;
}
@@ -3918,7 +3921,7 @@ ex_call(exarg_T *eap)
funcexe.evaluate = !eap->skip;
funcexe.partial = partial;
funcexe.selfdict = fudi.fd_dict;
if (get_func_tv(name, -1, &rettv, &arg, &funcexe) == FAIL)
if (get_func_tv(name, -1, &rettv, &arg, &evalarg, &funcexe) == FAIL)
{
failed = TRUE;
break;
@@ -3947,6 +3950,7 @@ ex_call(exarg_T *eap)
}
if (eap->skip)
--emsg_skip;
clear_evalarg(&evalarg, eap);
// When inside :try we need to check for following "| catch".
if (!failed || eap->cstack->cs_trylevel > 0)