mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.3011: Vim9: cannot get argument values during debugging
Problem: Vim9: cannot get argument values during debugging. Solution: Lookup names in the list of arguments. Put debug instruction halfway for command.
This commit is contained in:
@@ -7711,6 +7711,7 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
||||
int semicolon = FALSE;
|
||||
size_t varlen;
|
||||
garray_T *stack = &cctx->ctx_type_stack;
|
||||
garray_T *instr = &cctx->ctx_instr;
|
||||
scope_T *scope;
|
||||
lvar_T *loop_lvar; // loop iteration variable
|
||||
lvar_T *var_lvar; // variable for "var"
|
||||
@@ -7737,6 +7738,13 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
||||
if (may_get_next_line_error(wp, &p, cctx) == FAIL)
|
||||
return NULL;
|
||||
|
||||
// Remove the already generated ISN_DEBUG, it is written below the ISN_FOR
|
||||
// instruction.
|
||||
if (cctx->ctx_compile_type == CT_DEBUG && instr->ga_len > 0
|
||||
&& ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||
.isn_type == ISN_DEBUG)
|
||||
--instr->ga_len;
|
||||
|
||||
scope = new_scope(cctx, FOR_SCOPE);
|
||||
if (scope == NULL)
|
||||
return NULL;
|
||||
@@ -7788,11 +7796,12 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
||||
item_type = vartype->tt_member->tt_member;
|
||||
}
|
||||
|
||||
// CMDMOD_REV must come before the FOR instruction
|
||||
// CMDMOD_REV must come before the FOR instruction.
|
||||
generate_undo_cmdmods(cctx);
|
||||
|
||||
// "for_end" is set when ":endfor" is found
|
||||
scope->se_u.se_for.fs_top_label = current_instr_idx(cctx);
|
||||
|
||||
generate_FOR(cctx, loop_lvar->lv_idx);
|
||||
|
||||
arg = arg_start;
|
||||
@@ -7893,6 +7902,10 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
||||
vim_free(name);
|
||||
}
|
||||
|
||||
if (cctx->ctx_compile_type == CT_DEBUG)
|
||||
// Add ISN_DEBUG here, so that the loop variables can be inspected.
|
||||
generate_instr_debug(cctx);
|
||||
|
||||
return arg_end;
|
||||
|
||||
failed:
|
||||
@@ -7927,7 +7940,7 @@ compile_endfor(char_u *arg, cctx_T *cctx)
|
||||
// At end of ":for" scope jump back to the FOR instruction.
|
||||
generate_JUMP(cctx, JUMP_ALWAYS, forscope->fs_top_label);
|
||||
|
||||
// Fill in the "end" label in the FOR statement so it can jump here
|
||||
// Fill in the "end" label in the FOR statement so it can jump here.
|
||||
isn = ((isn_T *)instr->ga_data) + forscope->fs_top_label;
|
||||
isn->isn_arg.forloop.for_end = instr->ga_len;
|
||||
|
||||
@@ -8234,6 +8247,7 @@ compile_catch(char_u *arg, cctx_T *cctx UNUSED)
|
||||
#ifdef FEAT_PROFILE
|
||||
// the profile-start should be after the jump
|
||||
if (cctx->ctx_compile_type == CT_PROFILE
|
||||
&& instr->ga_len > 0
|
||||
&& ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||
.isn_type == ISN_PROF_START)
|
||||
--instr->ga_len;
|
||||
|
Reference in New Issue
Block a user