Commit 554a4eb7
554a4eb79996Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · ~2 modified
Description
fix(analyze,codegen): blk_param_types serialise as SA, not STR (#750)
@meth_blk_param_types is an array where each element can itself
contain | (a multi-yield method serialises its per-position
types as int|int). Previously the array was joined with |
into a single STR record then ir_escape'd whole -- on read,
val.split("|") collapsed all yields into one flat string.
Trigger: two methods, one yields 1, 2 (block sig
mrb_int, mrb_int), one yields "a" (sig const char *). The
flat read picked up foo's signature for bar, generating a C
warning + wrong-type call at the second yield site.
Switch to SA (string array) so each element goes through
ir_join_strs (per-element ir_escape) and ir_split_strs_n on
read. Inner | survives the round-trip as %7C.
Closes #750
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 554a4eb79996
- Parent
- 80bc72064363
spinel_analyze.rbmodifiedView file
# Non-array string ivars (computed in analyze, consumed by emit) buf = buf + "STR @cls_cmeth_live " + ir_escape(@cls_cmeth_live) + "\n" buf = buf + "STR @cls_meth_live " + ir_escape(@cls_meth_live) + "\n" buf = buf + "STR @meth_blk_param_types " + ir_escape(@meth_blk_param_types.join("|")) + "\n" buf = buf + "STR @cls_cmeth_blk_param_types " + ir_escape(@cls_cmeth_blk_param_types.join("|")) + "\n" # Issue #750: switch to SA (string array) so each element is # escaped individually -- inner `|` in `int|int` no longer # collides with the outer separator on round-trip. buf = ir_emit_sa(buf, "@meth_blk_param_types", @meth_blk_param_types) buf = ir_emit_sa(buf, "@cls_cmeth_blk_param_types", @cls_cmeth_blk_param_types) # Per-AST-node records (T / NM / NB / SN / ST) get accumulated # into a StrArray and joined once. Building them with `buf + ...`spinel_codegen.rbmodifiedView file
Loading diff…