mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
vim-patch:8.2.1047: Vim9: script cannot use line continuation like :def function
Problem: Vim9: script cannot use line continuation like in a :def function. Solution: Pass the getline function pointer to the eval() functions. Use it for addition and multiplication operators.5409f5d8c9
Omit source_nextline() and eval_next_non_blank(): Vim9 script only. N/A patches for version.c: vim-patch:8.2.1048: build failure without the eval feature Problem: Build failure without the eval feature. Solution: Add dummy typedef.9d40c63c7d
vim-patch:8.2.1052: build failure with older compilers Problem: Build failure with older compilers. Solution: Move declaration to start of block.7acde51832
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -152,7 +152,7 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int *
|
||||
p = skipwhite(p) + 1;
|
||||
p = skipwhite(p);
|
||||
char *expr = p;
|
||||
if (eval1(&p, &rettv, 0) != FAIL) {
|
||||
if (eval1(&p, &rettv, NULL) != FAIL) {
|
||||
ga_grow(default_args, 1);
|
||||
|
||||
// trim trailing whitespace
|
||||
@@ -455,6 +455,8 @@ int get_func_tv(const char *name, int len, typval_T *rettv, char **arg, funcexe_
|
||||
typval_T argvars[MAX_FUNC_ARGS + 1]; // vars for arguments
|
||||
int argcount = 0; // number of arguments found
|
||||
|
||||
evalarg_T evalarg = { .eval_flags = funcexe->fe_evaluate ? EVAL_EVALUATE : 0 };
|
||||
|
||||
// Get the arguments.
|
||||
argp = *arg;
|
||||
while (argcount < MAX_FUNC_ARGS
|
||||
@@ -463,8 +465,7 @@ int get_func_tv(const char *name, int len, typval_T *rettv, char **arg, funcexe_
|
||||
if (*argp == ')' || *argp == ',' || *argp == NUL) {
|
||||
break;
|
||||
}
|
||||
if (eval1(&argp, &argvars[argcount],
|
||||
funcexe->fe_evaluate ? EVAL_EVALUATE : 0) == FAIL) {
|
||||
if (eval1(&argp, &argvars[argcount], &evalarg) == FAIL) {
|
||||
ret = FAIL;
|
||||
break;
|
||||
}
|
||||
@@ -973,7 +974,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
|
||||
default_expr = ((char **)(fp->uf_def_args.ga_data))
|
||||
[ai + fp->uf_def_args.ga_len];
|
||||
if (eval1(&default_expr, &def_rettv, EVAL_EVALUATE) == FAIL) {
|
||||
if (eval1(&default_expr, &def_rettv, &EVALARG_EVALUATE) == FAIL) {
|
||||
default_arg_err = true;
|
||||
break;
|
||||
}
|
||||
@@ -1110,7 +1111,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
// A Lambda always has the command "return {expr}". It is much faster
|
||||
// to evaluate {expr} directly.
|
||||
ex_nesting_level++;
|
||||
(void)eval1(&p, rettv, EVAL_EVALUATE);
|
||||
(void)eval1(&p, rettv, &EVALARG_EVALUATE);
|
||||
ex_nesting_level--;
|
||||
} else {
|
||||
// call do_cmdline() to execute the lines
|
||||
@@ -2948,13 +2949,15 @@ void ex_return(exarg_T *eap)
|
||||
return;
|
||||
}
|
||||
|
||||
evalarg_T evalarg = { .eval_flags = eap->skip ? 0 : EVAL_EVALUATE };
|
||||
|
||||
if (eap->skip) {
|
||||
emsg_skip++;
|
||||
}
|
||||
|
||||
eap->nextcmd = NULL;
|
||||
if ((*arg != NUL && *arg != '|' && *arg != '\n')
|
||||
&& eval0(arg, &rettv, &eap->nextcmd, eap->skip ? 0 : EVAL_EVALUATE) != FAIL) {
|
||||
&& eval0(arg, &rettv, &eap->nextcmd, &evalarg) != FAIL) {
|
||||
if (!eap->skip) {
|
||||
returning = do_return(eap, false, true, &rettv);
|
||||
} else {
|
||||
@@ -3005,7 +3008,7 @@ void ex_call(exarg_T *eap)
|
||||
// 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->nextcmd, 0) != FAIL) {
|
||||
if (eval0(eap->arg, &rettv, &eap->nextcmd, NULL) != FAIL) {
|
||||
tv_clear(&rettv);
|
||||
}
|
||||
emsg_skip--;
|
||||
|
Reference in New Issue
Block a user