0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.1200: Vim9: cannot disassemble a lambda function

Problem:    Vim9: cannot disassemble a lambda function.
Solution:   Recognize "<lambda>123" as a function name.
This commit is contained in:
Bram Moolenaar
2020-07-13 18:18:00 +02:00
parent 7177da9dd4
commit bfd65589d9
3 changed files with 23 additions and 1 deletions

View File

@@ -664,6 +664,19 @@ def Test_disassemble_lambda()
'\d PCALL (argc 1)\_s*' .. '\d PCALL (argc 1)\_s*' ..
'\d RETURN', '\d RETURN',
instr) instr)
let name = substitute(instr, '.*\(<lambda>\d\+\).*', '\1', '')
instr = execute('disassemble ' .. name)
assert_match('<lambda>\d\+\_s*' ..
'return "X" .. a .. "X"\_s*' ..
'\d PUSHS "X"\_s*' ..
'\d LOAD arg\[-1\]\_s*' ..
'\d 2STRING stack\[-1\]\_s*' ..
'\d CONCAT\_s*' ..
'\d PUSHS "X"\_s*' ..
'\d CONCAT\_s*' ..
'\d RETURN',
instr)
enddef enddef
def AndOr(arg: any): string def AndOr(arg: any): string

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1200,
/**/ /**/
1199, 1199,
/**/ /**/

View File

@@ -2397,6 +2397,13 @@ ex_disassemble(exarg_T *eap)
int prev_current = 0; int prev_current = 0;
int is_global = FALSE; int is_global = FALSE;
if (STRNCMP(arg, "<lambda>", 8) == 0)
{
arg += 8;
(void)getdigits(&arg);
fname = vim_strnsave(eap->arg, arg - eap->arg);
}
else
fname = trans_function_name(&arg, &is_global, FALSE, fname = trans_function_name(&arg, &is_global, FALSE,
TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD, NULL, NULL); TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD, NULL, NULL);
if (fname == NULL) if (fname == NULL)