mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 19:31:08 +01:00
The GetOrAddImpl operation looks for an existing `Impl` with a matching declaration and returns its ImplId, or finished the construction of a new `Impl`, adds it to the store and returns a fresh `ImplId`. This makes the case of reusing an existing `Impl` into a short early-out, demonstrating more clearly that we are reusing existing work, and avoiding duplicate work such as checking for diagnostics that would have already been checked in the previous (matching) declaration. The `ExtendImpl` helper is renamed to be more explicit about its behaviour, as `ApplyExtendImplAs`, and it constructs the data it needs from the `Impl` and the `extend_node_id`, eliminating the need for a `ExtendImplDecl` struct. This is part of #6420 which is being split up into a chain of smaller PRs. It is based on #6465.