mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 18:10:11 +01:00
This switches from the `CollectNamesInBlock` approach for entities, to instead traversing entities as they're encountered. For example, when traversing constants, when a type is found, the entity will have its block queued for processing. This leads to a change in the traversal order, which affects disambiguation done by numeric sequencing (since that's just showing the traversal order). This will allow for simpler "name based on name" logic. This is something I plan to use for: - impls: `<type>.as.<interface>.impl` - functions: `<entity>.<member function>` - Note an impl may be used as the entity for a bound function. By naming the entities as they're encountered, I'll be able to rely on the generated names rather than recalculating them. To assist this, I'm also differentiating between the ambiguous and disambiguated name. Otherwise, we could end up with things like `<function>.<disambiguator>.<call>.<other disambiguator>`, where the repeated disambiguator may not be necessary in order to get full disambiguation. It's also a smaller delta from the current output. Note, changing `Name` to a class felt appropriate given its shape. I was also noticing that parts of its API were unused, and the class helps detect unused private members. --------- Co-authored-by: Geoff Romer <gromer@google.com>