Commit a9bf5e9d

a9bf5e9d9ab8Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified

Description

refactor: join_sep(arr, sep) → arr.join(sep), remove helper

Replace custom join_sep with standard .join method (22 occurrences). Delete the now-unused join_sep method definition (-12 lines). Bootstrap verified: gen2==gen3 (0 diff).

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Details

Commit
a9bf5e9d9ab8
Parent
afa0b1f2aa70

spinel_codegen.rbmodifiedView file

@@ -175,18 +175,6 @@
175175 92.chr
176176 end
177177
178- def join_sep(arr, sep)
179- result = ""
180- i = 0
181- while i < arr.length
182- if i > 0
183- result = result + sep
184- end
185- result = result + arr[i]
186- i = i + 1
187- end
188- result
189- end
190178
191179 # Parse comma-sep node IDs into IntArray
192180 def parse_id_list(s)
@@ -2679,11 +2667,11 @@
26792667 if k < types.length
26802668 if types[k] == "int"
26812669 types[k] = new_type
2682- @cls_ivar_types[ci] = join_sep(types, ";")
2670+ @cls_ivar_types[ci] = types.join(";")
26832671 end
26842672 if types[k] == "nil"
26852673 types[k] = new_type
2686- @cls_ivar_types[ci] = join_sep(types, ";")
2674+ @cls_ivar_types[ci] = types.join(";")
26872675 end
26882676 end
26892677 return
@@ -3131,7 +3119,7 @@
31313119 end
31323120
31333121 # Generate initialize method with params matching fields
3134- init_params = join_sep(field_names, ",")
3122+ init_params = field_names.join(",")
31353123 init_ptypes = ""
31363124 k = 0
31373125 while k < field_names.length
@@ -3152,7 +3140,7 @@
31523140 bodies = @cls_meth_bodies[ci].split(";")
31533141 if bodies.length > 0
31543142 bodies[0] = "-2"
3155- @cls_meth_bodies[ci] = join_sep(bodies, ";")
3143+ @cls_meth_bodies[ci] = bodies.join(";")
31563144 end
31573145 end
31583146
@@ -3321,7 +3309,7 @@
33213309 end
33223310 ak = ak + 1
33233311 end
3324- @meth_param_types[mi] = join_sep(ptypes, ",")
3312+ @meth_param_types[mi] = ptypes.join(",")
33253313 end
33263314 end
33273315 end
@@ -3391,8 +3379,8 @@
33913379 end
33923380 k = k + 1
33933381 end
3394- all_ptypes[init_idx] = join_sep(ptypes, ",")
3395- @cls_meth_ptypes[init_ci] = join_sep(all_ptypes, "|")
3382+ all_ptypes[init_idx] = ptypes.join(",")
3383+ @cls_meth_ptypes[init_ci] = all_ptypes.join("|")
33963384 end
33973385 end
33983386 end
@@ -3428,8 +3416,8 @@
34283416 end
34293417 kk = kk + 1
34303418 end
3431- all_ptypes[midx] = join_sep(ptypes, ",")
3432- @cls_meth_ptypes[ci] = join_sep(all_ptypes, "|")
3419+ all_ptypes[midx] = ptypes.join(",")
3420+ @cls_meth_ptypes[ci] = all_ptypes.join("|")
34333421 end
34343422 end
34353423 end
@@ -3584,7 +3572,7 @@
35843572 end
35853573 ij = ij + 1
35863574 end
3587- @cls_ivar_types[i] = join_sep(ivar_types, ";")
3575+ @cls_ivar_types[i] = ivar_types.join(";")
35883576 end
35893577 end
35903578 pi = pi + 1
@@ -3670,8 +3658,8 @@
36703658 end
36713659 if found_class == 1
36723660 ptypes[pk] = "obj_" + @cls_names[ci2]
3673- all_ptypes[j] = join_sep(ptypes, ",")
3674- @cls_meth_ptypes[oci] = join_sep(all_ptypes, "|")
3661+ all_ptypes[j] = ptypes.join(",")
3662+ @cls_meth_ptypes[oci] = all_ptypes.join("|")
36753663 changed = 1
36763664 end
36773665 end
@@ -3734,7 +3722,7 @@
37343722 end
37353723 if found_class == 1
37363724 ptypes[pk] = "obj_" + @cls_names[ci2]
3737- @meth_param_types[mi] = join_sep(ptypes, ",")
3725+ @meth_param_types[mi] = ptypes.join(",")
37383726 end
37393727 end
37403728 ci2 = ci2 + 1
@@ -4043,7 +4031,7 @@
40434031 j = j + 1
40444032 end
40454033 if changed == 1
4046- @cls_meth_ptypes[ci] = join_sep(all_ptypes, "|")
4034+ @cls_meth_ptypes[ci] = all_ptypes.join("|")
40474035 end
40484036 ci = ci + 1
40494037 end
@@ -4436,11 +4424,11 @@
44364424 k = k + 1
44374425 end
44384426 # Update ptypes in class storage
4439- new_ptypes = join_sep(ptypes, ",")
4427+ new_ptypes = ptypes.join(",")
44404428 if j < all_ptypes.length
44414429 all_ptypes[j] = new_ptypes
44424430 end
4443- @cls_meth_ptypes[i] = join_sep(all_ptypes, "|")
4431+ @cls_meth_ptypes[i] = all_ptypes.join("|")
44444432 else
44454433 k = 0
44464434 while k < pnames.length
@@ -4493,7 +4481,7 @@
44934481 returns[j] = rt
44944482 end
44954483 # Save incrementally so later methods can see updated return types
4496- @cls_meth_returns[i] = join_sep(returns, ";")
4484+ @cls_meth_returns[i] = returns.join(";")
44974485 pop_scope
44984486 j = j + 1
44994487 end
@@ -4516,7 +4504,7 @@
45164504 pop_scope
45174505 j = j + 1
45184506 end
4519- @cls_cmeth_returns[i] = join_sep(cm_returns, ";")
4507+ @cls_cmeth_returns[i] = cm_returns.join(";")
45204508 @current_class_idx = -1
45214509 i = i + 1
45224510 end
@@ -5308,7 +5296,7 @@
53085296 end
53095297 k = k + 1
53105298 end
5311- @meth_param_types[mi] = join_sep(ptypes, ",")
5299+ @meth_param_types[mi] = ptypes.join(",")
53125300 end
53135301 end
53145302 end
@@ -5644,8 +5632,8 @@
56445632 end
56455633 kk = kk + 1
56465634 end
5647- all_ptypes[midx] = join_sep(ptypes, ",")
5648- @cls_meth_ptypes[ci] = join_sep(all_ptypes, "|")
5635+ all_ptypes[midx] = ptypes.join(",")
5636+ @cls_meth_ptypes[ci] = all_ptypes.join("|")
56495637 end
56505638 end
56515639 end