mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 18:01:07 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user