summaryrefslogtreecommitdiff
path: root/prism_compile.c
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-07-16 12:06:15 -0400
committerKevin Newton <[email protected]>2024-07-16 14:40:20 -0400
commit90e945a7b7eca49774fe914ab884b46cfab15a34 ()
tree649b396920c02780723dd84fd995b16460e3a364 /prism_compile.c
parent4a4e1bf357f5b5f568ead4da0537eb4506e20e5f (diff)
[PRISM] Fix up ensure+loop+break
Notes: Merged: https://.com/ruby/ruby/pull/11177
-rw-r--r--prism_compile.c9
1 files changed, 8 insertions, 1 deletions
@@ -1114,7 +1114,6 @@ pm_compile_loop(rb_iseq_t *iseq, const pm_node_location_t *node_location, pm_nod
LABEL *prev_end_label = ISEQ_COMPILE_DATA(iseq)->end_label;
LABEL *prev_redo_label = ISEQ_COMPILE_DATA(iseq)->redo_label;
- // TODO: Deal with ensures in here
LABEL *next_label = ISEQ_COMPILE_DATA(iseq)->start_label = NEW_LABEL(location.line); /* next */
LABEL *redo_label = ISEQ_COMPILE_DATA(iseq)->redo_label = NEW_LABEL(location.line); /* redo */
LABEL *break_label = ISEQ_COMPILE_DATA(iseq)->end_label = NEW_LABEL(location.line); /* break */
@@ -1124,6 +1123,12 @@ pm_compile_loop(rb_iseq_t *iseq, const pm_node_location_t *node_location, pm_nod
LABEL *next_catch_label = NEW_LABEL(location.line);
LABEL *tmp_label = NULL;
// begin; end while true
if (flags & PM_LOOP_FLAGS_BEGIN_MODIFIER) {
tmp_label = NEW_LABEL(location.line);
@@ -1176,6 +1181,8 @@ pm_compile_loop(rb_iseq_t *iseq, const pm_node_location_t *node_location, pm_nod
ISEQ_COMPILE_DATA(iseq)->start_label = prev_start_label;
ISEQ_COMPILE_DATA(iseq)->end_label = prev_end_label;
ISEQ_COMPILE_DATA(iseq)->redo_label = prev_redo_label;
return;
}