Commit 0fe35a10
0fe35a10a06cMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
feat: add Hash#each_pair as alias for Hash#each
Only activates when receiver is present (recv >= 0) to avoid capturing user-defined each_pair methods without a receiver.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 0fe35a10a06c
- Parent
- 2691b3c25ce8
spinel_codegen.rbmodifiedView file
@@ -9261,7 +9261,7 @@
92619261
end92629262
if mname == "times" || mname == "upto" || mname == "downto"92639263
types.push("int")9264-
elsif mname == "each" || mname == "map" || mname == "select" || mname == "reject" || mname == "find" || mname == "detect" || mname == "any?" || mname == "all?" || mname == "none?" || mname == "count" || mname == "min_by" || mname == "max_by" || mname == "sort_by" || mname == "flat_map"9264+
elsif mname == "each" || mname == "each_pair" || mname == "map" || mname == "select" || mname == "reject" || mname == "find" || mname == "detect" || mname == "any?" || mname == "all?" || mname == "none?" || mname == "count" || mname == "min_by" || mname == "max_by" || mname == "sort_by" || mname == "flat_map"92659265
# Element iteration: infer block param from collection type92669266
if recv_type == "str_array"92679267
types.push("string")@@ -14494,7 +14494,7 @@
1449414494
1449514495
def compile_block_iteration_stmt(nid, mname, recv)1449614496
# each with block14497-
if mname == "each"14497+
if mname == "each" || (mname == "each_pair" && recv >= 0)1449814498
if @nd_block[nid] >= 01449914499
# For object types with yield-using each, use yield method call1450014500
if recv >= 0