Commit 42a08755
42a0875551e3Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
refactor(codegen): emit_constructor + initialize wrapper sites (5/N)
Migrate the two single-method use sites in emit_constructor (the
sp_new body emit and the void sp_initialize wrapper).
Both look up init_idx's pnames/ptypes for a single class.
Tests: 301 pass. Bootstrap: gen2.c == gen3.c.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 42a0875551e3
- Parent
- a406308232e9
spinel_codegen.rbmodifiedView file
@@ -18207,17 +18207,8 @@
1820718207
else1820818208
@current_method_return = "obj_" + cname1820918209
end18210-
all_params = @cls_meth_params[ci].split("|")18211-
all_ptypes = @cls_meth_ptypes[ci].split("|")18212-
pnames = "".split(",")18213-
ptypes = "".split(",")18214-
18215-
if init_idx < all_params.length18216-
pnames = all_params[init_idx].split(",")18217-
end18218-
if init_idx < all_ptypes.length18219-
ptypes = all_ptypes[init_idx].split(",")18220-
end18210+
pnames = cls_meth_pnames_get(ci, init_idx)18211+
ptypes = cls_meth_ptypes_get(ci, init_idx)1822118212
push_scope1822218213
k = 01822318214
while k < pnames.length@@ -18541,17 +18532,8 @@
1854118532
# otherwise leave `_gc_saved` undeclared.1854218533
saved_in_gc_scope2 = @in_gc_scope1854318534
@in_gc_scope = 018544-
all_params = @cls_meth_params[ci].split("|")18545-
all_ptypes = @cls_meth_ptypes[ci].split("|")18546-
pnames = "".split(",")18547-
ptypes = "".split(",")18548-
18549-
if init_idx < all_params.length18550-
pnames = all_params[init_idx].split(",")18551-
end18552-
if init_idx < all_ptypes.length18553-
ptypes = all_ptypes[init_idx].split(",")18554-
end18535+
pnames = cls_meth_pnames_get(ci, init_idx)18536+
ptypes = cls_meth_ptypes_get(ci, init_idx)1855518537
push_scope1855618538
k = 01855718539
while k < pnames.length