mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Simplify interface for getting an instruction from a type. (#3455)
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
5897e57c21
commit
cef7eb5522
@@ -150,10 +150,9 @@ auto HandlePrefixOperator(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
value_id = ConvertToValueExpr(context, value_id);
|
||||
auto type_id =
|
||||
context.GetUnqualifiedType(context.insts().Get(value_id).type_id());
|
||||
auto type_inst = context.insts().Get(
|
||||
context.sem_ir().GetTypeAllowBuiltinTypes(type_id));
|
||||
auto result_type_id = SemIR::TypeId::Error;
|
||||
if (auto pointer_type = type_inst.TryAs<SemIR::PointerType>()) {
|
||||
if (auto pointer_type =
|
||||
context.types().TryGetAs<SemIR::PointerType>(type_id)) {
|
||||
result_type_id = pointer_type->pointee_id;
|
||||
} else if (type_id != SemIR::TypeId::Error) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
|
||||
Reference in New Issue
Block a user