summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2023-12-19 22:06:50 +0000
committerMatt Valentine-House <matt@eightbitraptor.com>2023-12-19 22:50:59 +0000
commit3d984366ca809fdcc9320e776705ecd96efa49a0 (patch)
treefdb5281262d238f54e92faa6fa7e2fda6925fc1e
parent371ff808400b079b373e87de9b3deeb6c16f6a23 (diff)
[PRISM] Correct the jump target for redo in FOR_NODE
-rw-r--r--prism_compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/prism_compile.c b/prism_compile.c
index 9be075275d..b60ca0ac68 100644
--- a/prism_compile.c
+++ b/prism_compile.c
@@ -6153,11 +6153,16 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
}
case PM_FOR_NODE: {
pm_for_node_t *for_node = (pm_for_node_t *)scope_node->ast_node;
+ LABEL *target = NEW_LABEL(lineno);
+ LABEL *old_start = ISEQ_COMPILE_DATA(iseq)->start_label;
ADD_GETLOCAL(ret, &dummy_line_node, 1, 0);
PM_COMPILE(for_node->index);
PM_NOP;
+ ADD_LABEL(ret, target);
+ ISEQ_COMPILE_DATA(iseq)->start_label = target;
pm_compile_node(iseq, (pm_node_t *)(scope_node->body), ret, src, popped, scope_node);
+ ISEQ_COMPILE_DATA(iseq)->start_label = old_start;
break;
}
case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {