File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -556,6 +556,16 @@ def Test_try_catch_throw()
556556 n = 411
557557 endtry
558558 assert_equal (411 , n )
559+
560+ var counter = 0
561+ for i in range (4 )
562+ try
563+ eval [][0 ]
564+ catch
565+ endtry
566+ counter += 1
567+ endfor
568+ assert_equal (4 , counter)
559569enddef
560570
561571def Test_cnext_works_in_catch ()
Original file line number Diff line number Diff line change @@ -750,6 +750,8 @@ static char *(features[]) =
750750
751751static int included_patches [] =
752752{ /* Add new patch number below this line */
753+ /**/
754+ 2503 ,
753755/**/
754756 2502 ,
755757/**/
Original file line number Diff line number Diff line change 2424
2525// Structure put on ec_trystack when ISN_TRY is encountered.
2626typedef struct {
27- int tcd_frame_idx ; // ec_frame_idx when ISN_TRY was encountered
27+ int tcd_frame_idx ; // ec_frame_idx at ISN_TRY
28+ int tcd_stack_len ; // size of ectx.ec_stack at ISN_TRY
2829 int tcd_catch_idx ; // instruction of the first catch
2930 int tcd_finally_idx ; // instruction of the finally block
3031 int tcd_caught ; // catch block entered
@@ -2561,6 +2562,7 @@ call_def_function(
25612562 ++ ectx .ec_trystack .ga_len ;
25622563 ++ trylevel ;
25632564 trycmd -> tcd_frame_idx = ectx .ec_frame_idx ;
2565+ trycmd -> tcd_stack_len = ectx .ec_stack .ga_len ;
25642566 trycmd -> tcd_catch_idx = iptr -> isn_arg .try .try_catch ;
25652567 trycmd -> tcd_finally_idx = iptr -> isn_arg .try .try_finally ;
25662568 trycmd -> tcd_caught = FALSE;
@@ -2632,6 +2634,12 @@ call_def_function(
26322634
26332635 if (trycmd -> tcd_return )
26342636 goto func_return ;
2637+
2638+ while (ectx .ec_stack .ga_len > trycmd -> tcd_stack_len )
2639+ {
2640+ -- ectx .ec_stack .ga_len ;
2641+ clear_tv (STACK_TV_BOT (0 ));
2642+ }
26352643 }
26362644 }
26372645 break ;
You can’t perform that action at this time.
0 commit comments