mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Push ArchetypeType's API down to subclasses.
And clean up code that conditionally works only with certain kinds of archetype along the way.
This commit is contained in:
@@ -3792,19 +3792,10 @@ void Serializer::writeType(Type ty) {
|
||||
}
|
||||
|
||||
case TypeKind::PrimaryArchetype:
|
||||
case TypeKind::OpenedArchetype:
|
||||
case TypeKind::NestedArchetype: {
|
||||
auto archetypeTy = cast<ArchetypeType>(ty.getPointer());
|
||||
|
||||
// Opened existential types use a separate layout.
|
||||
if (auto existentialTy = archetypeTy->getOpenedExistentialType()) {
|
||||
unsigned abbrCode = DeclTypeAbbrCodes[OpenedExistentialTypeLayout::Code];
|
||||
OpenedExistentialTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addTypeRef(existentialTy));
|
||||
break;
|
||||
}
|
||||
|
||||
auto env = archetypeTy->getGenericEnvironment();
|
||||
auto env = archetypeTy->getPrimary()->getGenericEnvironment();
|
||||
assert(env && "Primary archetype without generic environment?");
|
||||
|
||||
GenericEnvironmentID envID = addGenericEnvironmentRef(env);
|
||||
@@ -3816,6 +3807,14 @@ void Serializer::writeType(Type ty) {
|
||||
break;
|
||||
}
|
||||
|
||||
case TypeKind::OpenedArchetype: {
|
||||
auto archetypeTy = cast<OpenedArchetypeType>(ty.getPointer());
|
||||
unsigned abbrCode = DeclTypeAbbrCodes[OpenedExistentialTypeLayout::Code];
|
||||
OpenedExistentialTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addTypeRef(archetypeTy->getOpenedExistentialType()));
|
||||
break;
|
||||
}
|
||||
|
||||
case TypeKind::GenericTypeParam: {
|
||||
auto genericParam = cast<GenericTypeParamType>(ty.getPointer());
|
||||
unsigned abbrCode = DeclTypeAbbrCodes[GenericTypeParamTypeLayout::Code];
|
||||
|
||||
Reference in New Issue
Block a user