Commit 21a950ef

21a950efea35Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 19 files · +2 added · ~1 modified · -16 deleted

Description

test: bundle 8 small standalone tests into bundle_misc_c_35 + fix ForNode in method body

Fold 8 short standalone tests (array_mul_string, for_multi_var, symbol_inspect_spl_marker, split_no_arg_ws, scalar_zero_truthiness, reduce_sym_op, array_of_hash_lit, integer_div) into a single bundled file. Each test wrapped in def t_<name>; ...; end followed by an explicit t_<name> call so its locals don't leak to the bundle's main scope. Cuts 8 spinel_parse + spinel_analyze

  • spinel_codegen + cc + link cycles on every test run; the bundle compiles in roughly the time of a single standalone.

Bundling for_multi_var uncovered a separate ForNode-in-method- body bug: compile_body_return_inner's last-statement dispatch had arms for WhileNode / UntilNode but not ForNode, so a method body ending in a for x, y, z in ...; ...; end was silently dropped from the emit (def t; for x,y,z in [...]; end; end produced an empty function body). Add the missing ForNode arm parallel to WhileNode -- compile the for-loop then return the type's default.

Tests: default 455/0/0 (was 463, -8 standalone + the previously- counted bundle).

Co-Authored-By: Claude Opus 4.7 [email protected]

Details

Commit
21a950efea35
Parent
d903820a0c43

spinel_codegen.rbmodifiedView file

@@ -39695,6 +39695,13 @@
3969539695 end
3969639696 return
3969739697 end
39698+ if @nd_type[last] == "ForNode"
39699+ compile_for_stmt(last)
39700+ if return_type != "void"
39701+ emit(" return " + c_return_default(return_type) + ";")
39702+ end
39703+ return
39704+ end
3969839705 if @nd_type[last] == "YieldNode"
3969939706 compile_yield_stmt(last)
3970039707 if return_type != "void"