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 end
17761776 if mname == "map"
17771777 if recv >= 0
1778- # Check block body return type to determine result array type
1778+ # Determine result array type from block return type
17791779 blk = @nd_block[nid]
17801780 if blk >= 0
17811781 bbody = @nd_body[blk]
@@ -1786,6 +1786,15 @@
17861786 if bret == "string"
17871787 return "str_array"
17881788 end
1789+ if bret == "float"
1790+ return "float_array"
1791+ end
1792+ if bret == "int"
1793+ return "int_array"
1794+ end
1795+ if is_obj_type(bret) == 1
1796+ return bret + "_ptr_array"
1797+ end
17891798 end
17901799 end
17911800 end