Commit 4c33b5b5
4c33b5b55325Merged
Ryan Seys <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
feat(codegen): support redo in zip, step, and cycle blocks
Wraps the three method-iterator branches inside compile_block_iteration_stmt that take a block: Array#zip { |a, b| ... }, Integer#step { |i| ... }, and Array#cycle { |x| ... }. All three follow the canonical pattern (push/emit after @indent += 1 and after the block-param assignments, pop before @indent -= 1).
The cycle branch nests a count-loop around the element-loop in C; the
redo label lives inside the inner element-loop body so a redo re-runs
only the current element iteration, not the whole cycle.
🤖 Generated with Claude Code
Details
- Commit
- 4c33b5b55325
- Parent
- ea8f1c634d34
spinel_codegen.rbmodifiedView file
@@ -27220,7 +27220,10 @@
2722027220
push_scope2722127221
declare_var(bp1, elem_t)2722227222
declare_var(bp2, elem_t)27223+
redo_label = push_redo_label27224+
emit_redo_label(redo_label)2722327225
compile_stmts_body(@nd_body[@nd_block[nid]])27226+
pop_redo_label2722427227
pop_scope2722527228
@indent = @indent - 12722627229
emit(" }")@@ -27264,7 +27267,10 @@
2726427267
@indent = @indent + 12726527268
push_scope2726627269
declare_var(bp1, "int")27270+
redo_label = push_redo_label27271+
emit_redo_label(redo_label)2726727272
compile_stmts_body(@nd_body[@nd_block[nid]])27273+
pop_redo_label2726827274
pop_scope2726927275
@indent = @indent - 12727027276
emit(" }")@@ -27297,7 +27303,10 @@
2729727303
@indent = @indent + 12729827304
push_scope2729927305
declare_var(bp1, et)27306+
redo_label = push_redo_label27307+
emit_redo_label(redo_label)2730027308
compile_stmts_body(@nd_body[@nd_block[nid]])27309+
pop_redo_label2730127310
pop_scope2730227311
@indent = @indent - 12730327312
emit(" }")