mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.2792: Vim9: :disas shows instructions for default args but no text
Problem: Vim9: :disas shows instructions for default args but no text. Solution: Show the expression test above the default argument instructions. (closes #8129)
This commit is contained in:
parent
5c787fb792
commit
9ce47ec0b6
@ -724,20 +724,22 @@ def Test_disassemble_update_instr()
|
|||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
|
||||||
def FuncWithDefault(arg: string = 'default', nr = 77): string
|
def FuncWithDefault(l: number, arg: string = "default", nr = 77): string
|
||||||
return arg .. nr
|
return arg .. nr
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_disassemble_call_default()
|
def Test_disassemble_call_default()
|
||||||
var res = execute('disass FuncWithDefault')
|
var res = execute('disass FuncWithDefault')
|
||||||
assert_match('FuncWithDefault\_s*' ..
|
assert_match('FuncWithDefault\_s*' ..
|
||||||
|
' arg = "default"\_s*' ..
|
||||||
'\d JUMP_IF_ARG_SET arg\[-2\] -> 3\_s*' ..
|
'\d JUMP_IF_ARG_SET arg\[-2\] -> 3\_s*' ..
|
||||||
'\d PUSHS "default"\_s*' ..
|
'\d PUSHS "default"\_s*' ..
|
||||||
'\d STORE arg\[-2]\_s*' ..
|
'\d STORE arg\[-2]\_s*' ..
|
||||||
|
' nr = 77\_s*' ..
|
||||||
'3 JUMP_IF_ARG_SET arg\[-1\] -> 6\_s*' ..
|
'3 JUMP_IF_ARG_SET arg\[-1\] -> 6\_s*' ..
|
||||||
'\d PUSHNR 77\_s*' ..
|
'\d PUSHNR 77\_s*' ..
|
||||||
'\d STORE arg\[-1]\_s*' ..
|
'\d STORE arg\[-1]\_s*' ..
|
||||||
'return arg .. nr\_s*' ..
|
' return arg .. nr\_s*' ..
|
||||||
'6 LOAD arg\[-2]\_s*' ..
|
'6 LOAD arg\[-2]\_s*' ..
|
||||||
'\d LOAD arg\[-1]\_s*' ..
|
'\d LOAD arg\[-1]\_s*' ..
|
||||||
'\d 2STRING stack\[-1]\_s*' ..
|
'\d 2STRING stack\[-1]\_s*' ..
|
||||||
|
@ -750,6 +750,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 */
|
||||||
|
/**/
|
||||||
|
2792,
|
||||||
/**/
|
/**/
|
||||||
2791,
|
2791,
|
||||||
/**/
|
/**/
|
||||||
|
@ -4338,6 +4338,7 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
|
|||||||
int line_idx = 0;
|
int line_idx = 0;
|
||||||
int prev_current = 0;
|
int prev_current = 0;
|
||||||
int current;
|
int current;
|
||||||
|
int def_arg_idx = 0;
|
||||||
|
|
||||||
for (current = 0; current < instr_count; ++current)
|
for (current = 0; current < instr_count; ++current)
|
||||||
{
|
{
|
||||||
@ -4345,6 +4346,7 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
|
|||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
if (ufunc != NULL)
|
if (ufunc != NULL)
|
||||||
|
{
|
||||||
while (line_idx < iptr->isn_lnum
|
while (line_idx < iptr->isn_lnum
|
||||||
&& line_idx < ufunc->uf_lines.ga_len)
|
&& line_idx < ufunc->uf_lines.ga_len)
|
||||||
{
|
{
|
||||||
@ -4357,6 +4359,23 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
|
|||||||
if (line != NULL)
|
if (line != NULL)
|
||||||
msg(line);
|
msg(line);
|
||||||
}
|
}
|
||||||
|
if (iptr->isn_type == ISN_JUMP_IF_ARG_SET)
|
||||||
|
{
|
||||||
|
int first_def_arg = ufunc->uf_args.ga_len
|
||||||
|
- ufunc->uf_def_args.ga_len;
|
||||||
|
|
||||||
|
if (def_arg_idx > 0)
|
||||||
|
msg_puts("\n\n");
|
||||||
|
msg_start();
|
||||||
|
msg_puts(" ");
|
||||||
|
msg_puts(((char **)(ufunc->uf_args.ga_data))[
|
||||||
|
first_def_arg + def_arg_idx]);
|
||||||
|
msg_puts(" = ");
|
||||||
|
msg_puts(((char **)(ufunc->uf_def_args.ga_data))[def_arg_idx++]);
|
||||||
|
msg_clr_eos();
|
||||||
|
msg_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (iptr->isn_type)
|
switch (iptr->isn_type)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user