mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Switch AddInst struct init style. (#4012)
Trying to conform with #4009. Changes SemIR::LocIdAndInst construction to root out struct init cases with AddInst and related functions. I'm using templating of AddInst functions in order to avoid `AddInst(loc_id, InstName{...})` and instead have `AddInst<InstName>(loc_id, {...})` with I think similar readability results. There are a couple cases where inst construction is templated and so designated initializers couldn't be used, so this may be better for those in particular due to the extra type enforcement. This probably doesn't clean up every last case, but I was trying to get the bulk at once without bleeding over into less related changes. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
6e9d0b15c8
commit
5bb318cae6
@@ -208,8 +208,9 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id)
|
||||
// TODO: Does lookup in an impl file need to look for a prior impl declaration
|
||||
// in the api file?
|
||||
auto impl_id = context.impls().LookupOrAdd(self_type_id, constraint_type_id);
|
||||
auto impl_decl = SemIR::ImplDecl{impl_id, decl_block_id};
|
||||
auto impl_decl_id = context.AddInst({node_id, impl_decl});
|
||||
SemIR::ImplDecl impl_decl = {.impl_id = impl_id,
|
||||
.decl_block_id = decl_block_id};
|
||||
auto impl_decl_id = context.AddInst(node_id, impl_decl);
|
||||
|
||||
// For an `extend impl` declaration, mark the impl as extending this `impl`.
|
||||
if (context.decl_state_stack().innermost().modifier_set.HasAnyOf(
|
||||
|
||||
Reference in New Issue
Block a user