[Serialization] Simplify serialized representation of archetype types.

We don't need to store the associated type declaration and name
separately in the module file, either.
This commit is contained in:
Doug Gregor
2016-11-28 11:39:38 -08:00
parent e656ca1dbc
commit 2030349d2f
3 changed files with 18 additions and 16 deletions

View File

@@ -2962,13 +2962,16 @@ void Serializer::writeType(Type ty) {
for (auto proto : archetypeTy->getConformsTo())
conformances.push_back(addDeclRef(proto));
DeclID assocTypeID = addDeclRef(archetypeTy->getAssocType());
DeclID assocTypeOrNameID;
if (archetypeTy->getParent())
assocTypeOrNameID = addDeclRef(archetypeTy->getAssocType());
else
assocTypeOrNameID = addIdentifierRef(archetypeTy->getName());
unsigned abbrCode = DeclTypeAbbrCodes[ArchetypeTypeLayout::Code];
ArchetypeTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
addIdentifierRef(archetypeTy->getName()),
parentID,
assocTypeID,
assocTypeOrNameID,
addTypeRef(archetypeTy->getSuperclass()),
conformances);