Move forward-decl-only code out to the handler of the forward decl node (Refactor Impl construction 3/7) (#6467)

Rather than run the code for both decl and defn and make it conditional
on not being a definition, put the code in the handler for the
`Parse::ImplDeclId` node, which is handled when there's no definition.
This will help lead us to no longer needing to plumb around
`is_definition` later.

Make some naming consistent to call the reference to an `Impl` as `impl`
instead of sometimes `impl_info`.

This is part of #6420 which is being split up into a chain of smaller
PRs. It is based on #6466.
This commit is contained in:
Dana Jansens
2025-12-10 21:55:01 +00:00
committed by GitHub
parent c4d162e5f5
commit 1c3d3e9284
2 changed files with 24 additions and 24 deletions
-11
View File
@@ -585,17 +585,6 @@ auto GetOrAddImpl(Context& context, SemIR::LocId loc_id,
}
}
// Impl definitions are required in the same file as the declaration. We skip
// this requirement if we've already issued an invalid redeclaration error, or
// there is an error that would prevent the impl from being legal to define.
if (!is_definition) {
auto& stored_impl = context.impls().Get(impl_id);
if (stored_impl.witness_id != SemIR::ErrorInst::InstId) {
context.definitions_required_by_decl().push_back(
stored_impl.latest_decl_id());
}
}
return impl_id;
}