Skip to content

Commit

Permalink
[PRISM] Correct the jump target for redo in FOR_NODE
Browse files Browse the repository at this point in the history
  • Loading branch information
eightbitraptor committed Dec 19, 2023
1 parent 371ff80 commit 3d98436
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions prism_compile.c
Expand Up @@ -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: {
Expand Down

0 comments on commit 3d98436

Please sign in to comment.