pub fn collect_class_fields(
modules: &[(&AIRModule, &Path)],
) -> HashMap<String, Vec<String>>Expand description
Collect every class declared across modules, mapping each class name to
its field names in declaration order.
A Bock class and a record both lower to a JS/TS class, but with
different constructor shapes: a record T { a, b } emits a destructured
constructor({ a, b }) (so a T { a: x, b: y } literal lowers to new T({ a: x, b: y })), whereas a class T { a, b } emits a positional
constructor(a, b) (so a T { a: x, b: y } literal must lower to new T(x, y) — arguments in field-declaration order, regardless of the literal’s
field spelling order).
The js/ts RecordConstruct emitters consult this map (kept separate from
collect_record_names) to pick the class’s positional shape and to order
the supplied field values by the declared field order. It is js/ts-only: the
shared record_names set must stay records-only because py/go/rust derive
other behavior from it, and a Bock class’s positional construction is a
js/ts emission concern. Without it a class literal falls through to the
record/object path and emits a bare object literal whose prototype methods
are unreachable (btn.render is not a function). Mirrors
collect_record_names / collect_enum_variants.