0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.3692: Vim9: cannot use :func inside a :def function

Problem:    Vim9: cannot use :func inside a :def function.
Solution:   Make it work.
This commit is contained in:
Bram Moolenaar
2021-11-28 22:00:12 +00:00
parent f566666e88
commit 38453528c3
8 changed files with 83 additions and 29 deletions

View File

@@ -523,7 +523,7 @@ register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state)
fp->uf_def_status = UF_NOT_COMPILED;
fp->uf_refcount = 1;
fp->uf_varargs = TRUE;
fp->uf_flags = FC_CFUNC;
fp->uf_flags = FC_CFUNC | FC_LAMBDA;
fp->uf_calls = 0;
fp->uf_script_ctx = current_sctx;
fp->uf_cb = cb;
@@ -1205,6 +1205,7 @@ lambda_function_body(
set_ufunc_name(ufunc, name);
if (hash_add(&func_hashtab, UF2HIKEY(ufunc)) == FAIL)
goto erret;
ufunc->uf_flags = FC_LAMBDA;
ufunc->uf_refcount = 1;
ufunc->uf_args = *newargs;
newargs->ga_data = NULL;
@@ -1399,7 +1400,7 @@ get_lambda_tv(
if (evaluate)
{
int len;
int flags = 0;
int flags = FC_LAMBDA;
char_u *p;
char_u *line_end;
char_u *name = get_lambda_name();
@@ -2506,8 +2507,7 @@ call_user_func(
return;
}
if (STRNCMP(fp->uf_name, "<lambda>", 8) == 0)
islambda = TRUE;
islambda = fp->uf_flags & FC_LAMBDA;
/*
* Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables