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
@@ -144,9 +144,8 @@ auto HandleClassDefinitionStart(Context& context, Parse::NodeId parse_node)
|
||||
context.PushScope(class_decl_id, class_info.scope_id);
|
||||
|
||||
// Introduce `Self`.
|
||||
context.AddNameToLookup(
|
||||
parse_node, SemIR::NameId::SelfType,
|
||||
context.sem_ir().GetTypeAllowBuiltinTypes(class_info.self_type_id));
|
||||
context.AddNameToLookup(parse_node, SemIR::NameId::SelfType,
|
||||
context.types().GetInstId(class_info.self_type_id));
|
||||
|
||||
context.inst_block_stack().Push();
|
||||
context.node_stack().Push(parse_node, class_id);
|
||||
@@ -227,10 +226,7 @@ auto HandleBaseDecl(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
// declaration as being final classes.
|
||||
// TODO: Once we have a better idea of which types are considered to be
|
||||
// classes, produce a better diagnostic for deriving from a non-class type.
|
||||
auto base_class =
|
||||
context.insts()
|
||||
.Get(context.sem_ir().GetTypeAllowBuiltinTypes(base_type_id))
|
||||
.TryAs<SemIR::ClassType>();
|
||||
auto base_class = context.types().TryGetAs<SemIR::ClassType>(base_type_id);
|
||||
if (!base_class ||
|
||||
context.classes().Get(base_class->class_id).inheritance_kind ==
|
||||
SemIR::Class::Final) {
|
||||
|
||||
Reference in New Issue
Block a user