Commit ecd8b347
ecd8b347e965Merged
Ryan Seys <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
feat(codegen): support redo in Kernel#loop, upto, and downto
Wraps three more counted/method-form loops with the redo-label
helpers: Kernel#loop's while (1) {} body, compile_upto_block's
ascending counter, and compile_downto_block's descending counter.
The Kernel#loop branch lives inside compile_block_iteration_stmt; the upto/downto branches are dedicated emitters. All three follow the canonical wrapping (push/emit after @indent += 1 and after the block-param assignment, pop before @indent -= 1).
🤖 Generated with Claude Code
Details
- Commit
- ecd8b347e965
- Parent
- 069ce8aabe5b
spinel_codegen.rbmodifiedView file
@@ -27390,7 +27390,10 @@
2739027390
@in_loop = 12739127391
emit(" while (1) {")2739227392
@indent = @indent + 127393+
redo_label = push_redo_label27394+
emit_redo_label(redo_label)2739327395
compile_stmts_body(@nd_body[@nd_block[nid]])27396+
pop_redo_label2739427397
@indent = @indent - 12739527398
emit(" }")2739627399
@in_loop = old@@ -29887,7 +29890,10 @@
2988729890
if bp1 != ""2988829891
declare_var(bp1, "int")2988929892
end29893+
redo_label = push_redo_label29894+
emit_redo_label(redo_label)2989029895
compile_stmts_body(@nd_body[@nd_block[nid]])29896+
pop_redo_label2989129897
pop_scope2989229898
@indent = @indent - 12989329899
emit(" }")@@ -29910,7 +29916,10 @@
2991029916
if bp1 != ""2991129917
declare_var(bp1, "int")2991229918
end29919+
redo_label = push_redo_label29920+
emit_redo_label(redo_label)2991329921
compile_stmts_body(@nd_body[@nd_block[nid]])29922+
pop_redo_label2991429923
pop_scope2991529924
@indent = @indent - 12991629925
emit(" }")