Commit ac52488a
ac52488aee0dMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
feat: String#start_with? and #end_with? support multiple arguments
Multi-argument form returns true if ANY of the patterns match, compiled as OR of individual sp_str_start_with / sp_str_end_with calls.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- ac52488aee0d
- Parent
- 1761f25e911d
spinel_codegen.rbmodifiedView file
@@ -11796,9 +11796,35 @@
1179611796
return "sp_str_include(" + rc + ", " + compile_arg0(nid) + ")"1179711797
end1179811798
if mname == "start_with?"11799+
args_id = @nd_arguments[nid]11800+
if args_id >= 011801+
aargs = get_args(args_id)11802+
if aargs.length > 111803+
parts = "".split(",")11804+
k = 011805+
while k < aargs.length11806+
parts.push("sp_str_start_with(" + rc + ", " + compile_expr(aargs[k]) + ")")11807+
k = k + 111808+
end11809+
return "(" + parts.join(" || ") + ")"11810+
end11811+
end1179911812
return "sp_str_start_with(" + rc + ", " + compile_arg0(nid) + ")"1180011813
end1180111814
if mname == "end_with?"11815+
args_id = @nd_arguments[nid]11816+
if args_id >= 011817+
aargs = get_args(args_id)11818+
if aargs.length > 111819+
parts = "".split(",")11820+
k = 011821+
while k < aargs.length11822+
parts.push("sp_str_end_with(" + rc + ", " + compile_expr(aargs[k]) + ")")11823+
k = k + 111824+
end11825+
return "(" + parts.join(" || ") + ")"11826+
end11827+
end1180211828
return "sp_str_end_with(" + rc + ", " + compile_arg0(nid) + ")"1180311829
end1180411830
if mname == "split"