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.chr176176
end177177
178-
def join_sep(arr, sep)179-
result = ""180-
i = 0181-
while i < arr.length182-
if i > 0183-
result = result + sep184-
end185-
result = result + arr[i]186-
i = i + 1187-
end188-
result189-
end190178
191179
# Parse comma-sep node IDs into IntArray192180
def parse_id_list(s)@@ -2679,11 +2667,11 @@
26792667
if k < types.length26802668
if types[k] == "int"26812669
types[k] = new_type2682-
@cls_ivar_types[ci] = join_sep(types, ";")2670+
@cls_ivar_types[ci] = types.join(";")26832671
end26842672
if types[k] == "nil"26852673
types[k] = new_type2686-
@cls_ivar_types[ci] = join_sep(types, ";")2674+
@cls_ivar_types[ci] = types.join(";")26872675
end26882676
end26892677
return@@ -3131,7 +3119,7 @@
31313119
end31323120
31333121
# Generate initialize method with params matching fields3134-
init_params = join_sep(field_names, ",")3122+
init_params = field_names.join(",")31353123
init_ptypes = ""31363124
k = 031373125
while k < field_names.length@@ -3152,7 +3140,7 @@
31523140
bodies = @cls_meth_bodies[ci].split(";")31533141
if bodies.length > 031543142
bodies[0] = "-2"3155-
@cls_meth_bodies[ci] = join_sep(bodies, ";")3143+
@cls_meth_bodies[ci] = bodies.join(";")31563144
end31573145
end31583146
@@ -3321,7 +3309,7 @@
33213309
end33223310
ak = ak + 133233311
end3324-
@meth_param_types[mi] = join_sep(ptypes, ",")3312+
@meth_param_types[mi] = ptypes.join(",")33253313
end33263314
end33273315
end@@ -3391,8 +3379,8 @@
33913379
end33923380
k = k + 133933381
end3394-
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
end33973385
end33983386
end@@ -3428,8 +3416,8 @@
34283416
end34293417
kk = kk + 134303418
end3431-
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
end34343422
end34353423
end@@ -3584,7 +3572,7 @@
35843572
end35853573
ij = ij + 135863574
end3587-
@cls_ivar_types[i] = join_sep(ivar_types, ";")3575+
@cls_ivar_types[i] = ivar_types.join(";")35883576
end35893577
end35903578
pi = pi + 1@@ -3670,8 +3658,8 @@
36703658
end36713659
if found_class == 136723660
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 = 136763664
end36773665
end@@ -3734,7 +3722,7 @@
37343722
end37353723
if found_class == 137363724
ptypes[pk] = "obj_" + @cls_names[ci2]3737-
@meth_param_types[mi] = join_sep(ptypes, ",")3725+
@meth_param_types[mi] = ptypes.join(",")37383726
end37393727
end37403728
ci2 = ci2 + 1@@ -4043,7 +4031,7 @@
40434031
j = j + 140444032
end40454033
if changed == 14046-
@cls_meth_ptypes[ci] = join_sep(all_ptypes, "|")4034+
@cls_meth_ptypes[ci] = all_ptypes.join("|")40474035
end40484036
ci = ci + 140494037
end@@ -4436,11 +4424,11 @@
44364424
k = k + 144374425
end44384426
# Update ptypes in class storage4439-
new_ptypes = join_sep(ptypes, ",")4427+
new_ptypes = ptypes.join(",")44404428
if j < all_ptypes.length44414429
all_ptypes[j] = new_ptypes44424430
end4443-
@cls_meth_ptypes[i] = join_sep(all_ptypes, "|")4431+
@cls_meth_ptypes[i] = all_ptypes.join("|")44444432
else44454433
k = 044464434
while k < pnames.length@@ -4493,7 +4481,7 @@
44934481
returns[j] = rt44944482
end44954483
# Save incrementally so later methods can see updated return types4496-
@cls_meth_returns[i] = join_sep(returns, ";")4484+
@cls_meth_returns[i] = returns.join(";")44974485
pop_scope44984486
j = j + 144994487
end@@ -4516,7 +4504,7 @@
45164504
pop_scope45174505
j = j + 145184506
end4519-
@cls_cmeth_returns[i] = join_sep(cm_returns, ";")4507+
@cls_cmeth_returns[i] = cm_returns.join(";")45204508
@current_class_idx = -145214509
i = i + 145224510
end@@ -5308,7 +5296,7 @@
53085296
end53095297
k = k + 153105298
end5311-
@meth_param_types[mi] = join_sep(ptypes, ",")5299+
@meth_param_types[mi] = ptypes.join(",")53125300
end53135301
end53145302
end@@ -5644,8 +5632,8 @@
56445632
end56455633
kk = kk + 156465634
end5647-
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
end56505638
end56515639
end