Allow escaping from ensures through next

Fixes [Bug #21001]
This commit is contained in:
Kevin Newton 2025-01-05 20:42:09 -05:00
parent a61c16ba42
commit 31905d9e23
Notes: git 2025-01-06 18:18:44 +00:00
2 changed files with 21 additions and 9 deletions

View file

@ -8720,16 +8720,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node;
if (cast->statements != NULL) {
LABEL *start = NEW_LABEL(location.line);
LABEL *end = NEW_LABEL(location.line);
PUSH_LABEL(ret, start);
LABEL *prev_end_label = ISEQ_COMPILE_DATA(iseq)->end_label;
ISEQ_COMPILE_DATA(iseq)->end_label = end;
PM_COMPILE((const pm_node_t *) cast->statements);
ISEQ_COMPILE_DATA(iseq)->end_label = prev_end_label;
PUSH_LABEL(ret, end);
}
return;