Commit eee34c21

eee34c2109f8Merged

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

Description

attribute / attributes as attr_accessor synonyms

The class-body DSL declarations attribute :x and attributes :a, :b register the same backing ivar + reader/writer methods as attr_accessor, matching the legacy compiler.

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

Details

Commit
eee34c2109f8
Parent
d7b8668e2803

src/analyze.cmodifiedView file

@@ -1005,8 +1005,10 @@
10051005 if (!sty || strcmp(sty, "CallNode")) continue;
10061006 const char *nm = nt_str(nt, s, "name");
10071007 if (!nm) continue;
1008- int reader = !strcmp(nm, "attr_reader") || !strcmp(nm, "attr_accessor");
1009- int writer = !strcmp(nm, "attr_writer") || !strcmp(nm, "attr_accessor");
1008+ int accessor = !strcmp(nm, "attr_accessor") ||
1009+ !strcmp(nm, "attribute") || !strcmp(nm, "attributes");
1010+ int reader = !strcmp(nm, "attr_reader") || accessor;
1011+ int writer = !strcmp(nm, "attr_writer") || accessor;
10101012 if (!reader && !writer) continue;
10111013 int args = nt_ref(nt, s, "arguments");
10121014 int an = 0;