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)
b657198cb3
This commit is contained in:
zeertzjq
2022-10-03 22:54:23 +08:00
parent 51d379d40d
commit 0f2ead02c8

View File

@@ -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