mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 12:11:04 +01:00
Refactor AddInst-family functions to their own file (#4941)
This in particular uses free functions because it's likely to end up more consistent with types (versus a wrapper object for InstStore). Note, this is unlikely to have a performance impact, but if it does, we can look into related approaches (and we've already discussed using LTO). Renames `PendingBlock::AddInst` to `PendingBlock::Add` because `MakeElementAccessInst` expects the matching name to exist.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/convert.h"
|
||||
#include "toolchain/check/handle.h"
|
||||
#include "toolchain/check/inst.h"
|
||||
#include "toolchain/check/type.h"
|
||||
#include "toolchain/parse/node_kind.h"
|
||||
|
||||
@@ -53,10 +54,10 @@ auto HandleParseNode(Context& context, Parse::ArrayExprId node_id) -> bool {
|
||||
bound_inst_id = ConvertToValueOfType(
|
||||
context, context.insts().GetLocId(bound_inst_id), bound_inst_id,
|
||||
GetSingletonType(context, SemIR::IntLiteralType::SingletonInstId));
|
||||
context.AddInstAndPush<SemIR::ArrayType>(
|
||||
node_id, {.type_id = SemIR::TypeType::SingletonTypeId,
|
||||
.bound_id = bound_inst_id,
|
||||
.element_type_id = element_type_id});
|
||||
AddInstAndPush<SemIR::ArrayType>(context, node_id,
|
||||
{.type_id = SemIR::TypeType::SingletonTypeId,
|
||||
.bound_id = bound_inst_id,
|
||||
.element_type_id = element_type_id});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user