comparison src/vim9.h @ 30297:bee38b1d323c v9.0.0484

patch 9.0.0484: in :def function all closures in loop get the same variables Commit: https://github.com/vim/vim/commit/8abb584ab85d5855d810d1c6e2b260f45ec839b7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 17 12:39:58 2022 +0100 patch 9.0.0484: in :def function all closures in loop get the same variables Problem: In a :def function all closures in a loop get the same variables. Solution: Add ENDLOOP at break, continue and return if needed.
author Bram Moolenaar <Bram@vim.org>
date Sat, 17 Sep 2022 13:45:03 +0200
parents 61a688be1899
children 029c59bf78f1
comparison
equal deleted inserted replaced
30296:ec5eeb2a6c76 30297:bee38b1d323c
623 int is_had_return; // every block ends in :return 623 int is_had_return; // every block ends in :return
624 int is_if_label; // instruction idx at IF or ELSEIF 624 int is_if_label; // instruction idx at IF or ELSEIF
625 endlabel_T *is_end_label; // instructions to set end label 625 endlabel_T *is_end_label; // instructions to set end label
626 } ifscope_T; 626 } ifscope_T;
627 627
628 // info used by :for and :while needed for ENDLOOP
629 typedef struct {
630 int li_local_count; // ctx_locals.ga_len at loop start
631 int li_closure_count; // ctx_closure_count at loop start
632 int li_funcref_idx; // index of var that holds funcref count
633 } loop_info_T;
634
628 /* 635 /*
629 * info specific for the scope of :while 636 * info specific for the scope of :while
630 */ 637 */
631 typedef struct { 638 typedef struct {
632 int ws_top_label; // instruction idx at WHILE 639 int ws_top_label; // instruction idx at WHILE
633 endlabel_T *ws_end_label; // instructions to set end 640 endlabel_T *ws_end_label; // instructions to set end
634 int ws_funcref_idx; // index of var that holds funcref count 641 loop_info_T ws_loop_info; // info for LOOPEND
635 int ws_local_count; // ctx_locals.ga_len at :while
636 int ws_closure_count; // ctx_closure_count at :while
637 } whilescope_T; 642 } whilescope_T;
638 643
639 /* 644 /*
640 * info specific for the scope of :for 645 * info specific for the scope of :for
641 */ 646 */
642 typedef struct { 647 typedef struct {
643 int fs_top_label; // instruction idx at FOR 648 int fs_top_label; // instruction idx at FOR
644 endlabel_T *fs_end_label; // break instructions 649 endlabel_T *fs_end_label; // break instructions
645 int fs_funcref_idx; // index of var that holds funcref count 650 loop_info_T fs_loop_info; // info for LOOPEND
646 int fs_local_count; // ctx_locals.ga_len at :for
647 int fs_closure_count; // ctx_closure_count at :for
648 } forscope_T; 651 } forscope_T;
649 652
650 /* 653 /*
651 * info specific for the scope of :try 654 * info specific for the scope of :try
652 */ 655 */