mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
[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:
parent
071df40495
commit
c4b9695350
2 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue