mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add ExternDecl and ExternType for extern classes. (#3893)
This expands `extern` handling for most cases.
This commit is contained in:
@@ -206,6 +206,7 @@ static auto GetTypePrecedence(InstKind kind) -> int {
|
||||
case BindSymbolicName::Kind:
|
||||
case Builtin::Kind:
|
||||
case ClassType::Kind:
|
||||
case ExternType::Kind:
|
||||
case FacetTypeAccess::Kind:
|
||||
case FloatType::Kind:
|
||||
case ImportRefLoaded::Kind:
|
||||
@@ -246,6 +247,7 @@ static auto GetTypePrecedence(InstKind kind) -> int {
|
||||
case ClassInit::Kind:
|
||||
case Converted::Kind:
|
||||
case Deref::Kind:
|
||||
case ExternDecl::Kind:
|
||||
case FieldDecl::Kind:
|
||||
case FloatLiteral::Kind:
|
||||
case FunctionDecl::Kind:
|
||||
@@ -379,6 +381,11 @@ static auto StringifyTypeExprImpl(const SemIR::File& outer_sem_ir,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CARBON_KIND(ExternType inst): {
|
||||
out << "extern ";
|
||||
push_inst_id(sem_ir.types().GetInstId(inst.non_extern_type_id));
|
||||
break;
|
||||
}
|
||||
case CARBON_KIND(FacetTypeAccess inst): {
|
||||
// Print `T as type` as simply `T`.
|
||||
push_inst_id(inst.facet_id);
|
||||
@@ -521,6 +528,7 @@ static auto StringifyTypeExprImpl(const SemIR::File& outer_sem_ir,
|
||||
case ClassInit::Kind:
|
||||
case Converted::Kind:
|
||||
case Deref::Kind:
|
||||
case ExternDecl::Kind:
|
||||
case FieldDecl::Kind:
|
||||
case FloatLiteral::Kind:
|
||||
case FunctionDecl::Kind:
|
||||
@@ -640,6 +648,8 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory {
|
||||
case ClassDecl::Kind:
|
||||
case ClassType::Kind:
|
||||
case ConstType::Kind:
|
||||
case ExternDecl::Kind:
|
||||
case ExternType::Kind:
|
||||
case FacetTypeAccess::Kind:
|
||||
case FloatLiteral::Kind:
|
||||
case FloatType::Kind:
|
||||
|
||||
Reference in New Issue
Block a user