commit 0f2ead02c87400c87343e24f2687d64f527ad572
parent 51d379d40d14d35ccb8e4038504d6c0cda9be62c
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon, 3 Oct 2022 22:54:23 +0800
vim-patch:8.2.2316: Vim9: cannot list a lambda function
Problem: Vim9: cannot list a lambda function.
Solution: Support the <lambda>9 notation, like :disassemble. (closes vim/vim#7634)
https://github.com/vim/vim/commit/b657198cb30765468451d7f68fce49b5b4000c5d
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
@@ -1983,7 +1983,14 @@ void ex_function(exarg_T *eap)
// s:func script-local function name
// g:func global function name, same as "func"
p = eap->arg;
- name = (char *)trans_function_name(&p, eap->skip, TFN_NO_AUTOLOAD, &fudi, NULL);
+ if (strncmp(p, "<lambda>", 8) == 0) {
+ p += 8;
+ (void)getdigits(&p, false, 0);
+ name = xstrndup(eap->arg, (size_t)(p - eap->arg));
+ CLEAR_FIELD(fudi);
+ } else {
+ name = (char *)trans_function_name(&p, eap->skip, TFN_NO_AUTOLOAD, &fudi, NULL);
+ }
paren = (vim_strchr(p, '(') != NULL);
if (name == NULL && (fudi.fd_dict == NULL || !paren) && !eap->skip) {
// Return on an invalid expression in braces, unless the expression