Commit 4d11a761
4d11a7613962Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
fix: map return type inferred from block body, not just receiver
map now correctly determines result array type from the block's return type: string→str_array, float→float_array, int→int_array, and obj_T→obj_T_ptr_array. Previously only string was handled, with all other cases falling back to the receiver's type.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 4d11a7613962
- Parent
- c9cbc19cec90
spinel_codegen.rbmodifiedView file
@@ -1775,7 +1775,7 @@
17751775
end17761776
if mname == "map"17771777
if recv >= 01778-
# Check block body return type to determine result array type1778+
# Determine result array type from block return type17791779
blk = @nd_block[nid]17801780
if blk >= 017811781
bbody = @nd_body[blk]@@ -1786,6 +1786,15 @@
17861786
if bret == "string"17871787
return "str_array"17881788
end1789+
if bret == "float"1790+
return "float_array"1791+
end1792+
if bret == "int"1793+
return "int_array"1794+
end1795+
if is_obj_type(bret) == 11796+
return bret + "_ptr_array"1797+
end17891798
end17901799
end17911800
end