Mercurial > vim
comparison src/vim9compile.c @ 25098:765a642e0e20 v8.2.3086
patch 8.2.3086: Vim9: breakpoint on "for" does not work
Commit: https://github.com/vim/vim/commit/6fc016168249360f0524b68f72cf33efd0574d40
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 3 13:36:31 2021 +0200
patch 8.2.3086: Vim9: breakpoint on "for" does not work
Problem: Vim9: breakpoint on "for" does not work.
Solution: Use the right line number in ISN_DEBUG. (closes https://github.com/vim/vim/issues/8486)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Jul 2021 13:45:04 +0200 |
parents | 5c7a09cf97a1 |
children | de29f9a76233 |
comparison
equal
deleted
inserted
replaced
25097:0a54fef1a914 | 25098:765a642e0e20 |
---|---|
7745 lvar_T *loop_lvar; // loop iteration variable | 7745 lvar_T *loop_lvar; // loop iteration variable |
7746 lvar_T *var_lvar; // variable for "var" | 7746 lvar_T *var_lvar; // variable for "var" |
7747 type_T *vartype; | 7747 type_T *vartype; |
7748 type_T *item_type = &t_any; | 7748 type_T *item_type = &t_any; |
7749 int idx; | 7749 int idx; |
7750 int prev_lnum = cctx->ctx_prev_lnum; | |
7750 | 7751 |
7751 p = skip_var_list(arg_start, TRUE, &var_count, &semicolon, FALSE); | 7752 p = skip_var_list(arg_start, TRUE, &var_count, &semicolon, FALSE); |
7752 if (p == NULL) | 7753 if (p == NULL) |
7753 return NULL; | 7754 return NULL; |
7754 if (var_count == 0) | 7755 if (var_count == 0) |
7772 // Remove the already generated ISN_DEBUG, it is written below the ISN_FOR | 7773 // Remove the already generated ISN_DEBUG, it is written below the ISN_FOR |
7773 // instruction. | 7774 // instruction. |
7774 if (cctx->ctx_compile_type == CT_DEBUG && instr->ga_len > 0 | 7775 if (cctx->ctx_compile_type == CT_DEBUG && instr->ga_len > 0 |
7775 && ((isn_T *)instr->ga_data)[instr->ga_len - 1] | 7776 && ((isn_T *)instr->ga_data)[instr->ga_len - 1] |
7776 .isn_type == ISN_DEBUG) | 7777 .isn_type == ISN_DEBUG) |
7778 { | |
7777 --instr->ga_len; | 7779 --instr->ga_len; |
7780 prev_lnum = ((isn_T *)instr->ga_data)[instr->ga_len] | |
7781 .isn_arg.debug.dbg_break_lnum; | |
7782 } | |
7778 | 7783 |
7779 scope = new_scope(cctx, FOR_SCOPE); | 7784 scope = new_scope(cctx, FOR_SCOPE); |
7780 if (scope == NULL) | 7785 if (scope == NULL) |
7781 return NULL; | 7786 return NULL; |
7782 | 7787 |
7932 arg = skipwhite(p); | 7937 arg = skipwhite(p); |
7933 vim_free(name); | 7938 vim_free(name); |
7934 } | 7939 } |
7935 | 7940 |
7936 if (cctx->ctx_compile_type == CT_DEBUG) | 7941 if (cctx->ctx_compile_type == CT_DEBUG) |
7942 { | |
7943 int save_prev_lnum = cctx->ctx_prev_lnum; | |
7944 | |
7937 // Add ISN_DEBUG here, so that the loop variables can be inspected. | 7945 // Add ISN_DEBUG here, so that the loop variables can be inspected. |
7946 // Use the prev_lnum from the ISN_DEBUG instruction removed above. | |
7947 cctx->ctx_prev_lnum = prev_lnum; | |
7938 generate_instr_debug(cctx); | 7948 generate_instr_debug(cctx); |
7949 cctx->ctx_prev_lnum = save_prev_lnum; | |
7950 } | |
7939 | 7951 |
7940 return arg_end; | 7952 return arg_end; |
7941 | 7953 |
7942 failed: | 7954 failed: |
7943 vim_free(name); | 7955 vim_free(name); |