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.
diff --git a/src/userfunc.c b/src/userfunc.c
index 724d124..1210791 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -601,16 +601,13 @@
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 @@
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 @@
if (*argp != ',')
break;
}
+ argp = skipwhite_and_linebreak(argp, evalarg);
if (*argp == ')')
++argp;
else
@@ -3832,16 +3832,19 @@
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 @@
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 @@
}
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)