Skip to main content

collect_record_field_names

Function collect_record_field_names 

Source
pub fn collect_record_field_names<F>(
    module: &AIRNode,
    cased: F,
) -> HashSet<String>
where F: Fn(&str) -> String,
Expand description

Collect every record/class field name in the module, mapped through the backend’s cased name function (to_pascal_case for Go, to_camel_case for js/ts, identity/snake for Python). Backends use the returned set with disambiguate_method_name to detect a method whose emitted name collides with a field’s emitted name.

The set is intentionally a union across all records/classes in the module (not per-type): it mirrors the Go backend’s original behavior and is a safe over-approximation — at worst it renames a method on a type that happens to share a name with an unrelated type’s field, which is harmless because the rename is applied consistently at the method’s declaration and all its call sites. Keeping it module-global keeps the lookup a single HashSet shared by declaration and call-site emission, which run at different points.