[PRISM] Rescue should set correct end_label

In order for a break inside the rescue to have the correct jump target
This commit is contained in:
Matt Valentine-House 2023-12-06 22:20:38 +00:00 committed by Jemma Issroff
parent 071df40495
commit c4b9695350
2 changed files with 10 additions and 0 deletions

View file

@ -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);

View file

@ -950,6 +950,14 @@ module Prism
end
end
CODE
assert_prism_eval(<<~CODE)
10.times do
begin
rescue
break
end
end
CODE
end
def test_RescueModiferNode