diff --git a/prism_compile.c b/prism_compile.c index a365946ba381ad..285b023e4ac889 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -3851,6 +3851,8 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, LABEL *excep_match = NEW_LABEL(lineno); LABEL *rescue_end = NEW_LABEL(lineno); + ISEQ_COMPILE_DATA(iseq)->end_label = rescue_end; + pm_rescue_node_t *rescue_node = (pm_rescue_node_t *)node; iseq_set_exception_local_table(iseq); diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 339300a6388fcf..97ee5c2f700f22 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -950,6 +950,14 @@ def test_RescueNode end end CODE + assert_prism_eval(<<~CODE) + 10.times do + begin + rescue + break + end + end + CODE end def test_RescueModiferNode