comparison src/vim9execute.c @ 24504:e7577f79d6eb v8.2.2792

patch 8.2.2792: Vim9: :disas shows instructions for default args but no text Commit: https://github.com/vim/vim/commit/9ce47ec0b65f81358febacbd9b808ac8ef7af85c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 20 22:16:39 2021 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Tue, 20 Apr 2021 22:30:04 +0200
parents 08050e45bd06
children df90c61c306c
comparison
equal deleted inserted replaced
24503:5e394def267d 24504:e7577f79d6eb
4336 list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc) 4336 list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
4337 { 4337 {
4338 int line_idx = 0; 4338 int line_idx = 0;
4339 int prev_current = 0; 4339 int prev_current = 0;
4340 int current; 4340 int current;
4341 int def_arg_idx = 0;
4341 4342
4342 for (current = 0; current < instr_count; ++current) 4343 for (current = 0; current < instr_count; ++current)
4343 { 4344 {
4344 isn_T *iptr = &instr[current]; 4345 isn_T *iptr = &instr[current];
4345 char *line; 4346 char *line;
4346 4347
4347 if (ufunc != NULL) 4348 if (ufunc != NULL)
4349 {
4348 while (line_idx < iptr->isn_lnum 4350 while (line_idx < iptr->isn_lnum
4349 && line_idx < ufunc->uf_lines.ga_len) 4351 && line_idx < ufunc->uf_lines.ga_len)
4350 { 4352 {
4351 if (current > prev_current) 4353 if (current > prev_current)
4352 { 4354 {
4355 } 4357 }
4356 line = ((char **)ufunc->uf_lines.ga_data)[line_idx++]; 4358 line = ((char **)ufunc->uf_lines.ga_data)[line_idx++];
4357 if (line != NULL) 4359 if (line != NULL)
4358 msg(line); 4360 msg(line);
4359 } 4361 }
4362 if (iptr->isn_type == ISN_JUMP_IF_ARG_SET)
4363 {
4364 int first_def_arg = ufunc->uf_args.ga_len
4365 - ufunc->uf_def_args.ga_len;
4366
4367 if (def_arg_idx > 0)
4368 msg_puts("\n\n");
4369 msg_start();
4370 msg_puts(" ");
4371 msg_puts(((char **)(ufunc->uf_args.ga_data))[
4372 first_def_arg + def_arg_idx]);
4373 msg_puts(" = ");
4374 msg_puts(((char **)(ufunc->uf_def_args.ga_data))[def_arg_idx++]);
4375 msg_clr_eos();
4376 msg_end();
4377 }
4378 }
4360 4379
4361 switch (iptr->isn_type) 4380 switch (iptr->isn_type)
4362 { 4381 {
4363 case ISN_EXEC: 4382 case ISN_EXEC:
4364 smsg("%s%4d EXEC %s", pfx, current, iptr->isn_arg.string); 4383 smsg("%s%4d EXEC %s", pfx, current, iptr->isn_arg.string);