pub struct ClassMembers<'d> {
pub statics: Vec<Symbol<'d>>,
pub fields: Vec<Symbol<'d>>,
pub methods: Vec<Symbol<'d>>,
pub ctor: Option<Symbol<'d>>,
}Expand description
Task 2 step 2’s ClassMembers: one class’s own (non-inherited) members,
split by role. statics/fields are ClassProperty members split by
variable_lifetime() (8.9: a static property has one copy for the
whole simulation; an ordinary, “automatic”-lifetime one is per-object);
methods is every USER-declared Subroutine/MethodPrototype member
that is not the constructor; ctor is the Subroutine member flagged
MethodFlags::CONSTRUCTOR (8.7), if this class declares one. All four
are in members()’s own declaration order — this task’s own tests rely
on that order, and no later task may re-sort them.
“USER-declared” is load-bearing: slang adds 8 implicit, bodied
Subroutine members to EVERY class — randomize, pre_randomize,
post_randomize, get_randstate, set_randstate, srandom,
rand_mode, constraint_mode (LRM 18.6/18.12–18.14’s “every class
… shall have the following built-in methods”) — each flagged
MethodFlags::BUILT_IN, verified live against a plain class Base; int a; function void bump(); endclass fixture
(netlist_classes.rs’s own regression: class_sym.members() for that
class yields bump PLUS all 8 of these, not bump alone). classify_members
excludes them from methods — this plan’s own header is explicit that
randomize()/constraint solving (18.1–18.12/18.16–18.17) is the sibling
constraints plan’s job, not this one’s, and dumping these 8 into
methods would make Task 7’s vtable-slot assignment try to mangle/lower
them as if they were ordinary user methods.
Fields§
§statics: Vec<Symbol<'d>>§fields: Vec<Symbol<'d>>§methods: Vec<Symbol<'d>>§ctor: Option<Symbol<'d>>