mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 18:21:16 +01:00
Associate a name with ClassDecl (#3447)
Note generics will probably need different behavior. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
ca53c18ddc
commit
962defd1e8
@@ -437,6 +437,12 @@ class InstNamer {
|
||||
.name_id);
|
||||
continue;
|
||||
}
|
||||
case ClassDecl::Kind: {
|
||||
add_inst_name_id(
|
||||
sem_ir_.classes().Get(inst.As<ClassDecl>().class_id).name_id,
|
||||
".decl");
|
||||
continue;
|
||||
}
|
||||
case ClassType::Kind: {
|
||||
add_inst_name_id(
|
||||
sem_ir_.classes().Get(inst.As<ClassType>().class_id).name_id);
|
||||
@@ -710,6 +716,12 @@ class Formatter {
|
||||
}
|
||||
}
|
||||
|
||||
// Print ClassDecl with type-like semantics even though it lacks a type_id.
|
||||
auto FormatInstructionLHS(InstId inst_id, ClassDecl /*inst*/) -> void {
|
||||
FormatInstName(inst_id);
|
||||
out_ << " = ";
|
||||
}
|
||||
|
||||
template <typename InstT>
|
||||
auto FormatInstructionRHS(InstT inst) -> void {
|
||||
// By default, an instruction has a comma-separated argument list.
|
||||
|
||||
Reference in New Issue
Block a user