mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Preserve the decl context for a NormalProtocolConformance.
Doug had changed the comment but not the implementation -- we were still serializing the containing module rather than the declaring nominal or extension. Found by enabling verification on deserialized decls (to come soon). Swift SVN r22198
This commit is contained in:
@@ -145,6 +145,9 @@ DeclID Serializer::addDeclRef(const Decl *D, bool forceSerialization) {
|
||||
return id.first;
|
||||
}
|
||||
|
||||
assert((!isDeclXRef(D) || isa<ValueDecl>(D) || isa<OperatorDecl>(D)) &&
|
||||
"cannot cross-reference this decl");
|
||||
|
||||
// Record any generic parameters that come from this decl, so that we can use
|
||||
// the decl to refer to the parameters later.
|
||||
const GenericParamList *paramList = nullptr;
|
||||
@@ -825,9 +828,9 @@ Serializer::writeConformance(const ProtocolDecl *protocol,
|
||||
unsigned numInheritedConformances = conf->getInheritedConformances().size();
|
||||
unsigned abbrCode
|
||||
= abbrCodes[NormalProtocolConformanceLayout::Code];
|
||||
auto moduleID = addModuleRef(conf->getDeclContext()->getParentModule());
|
||||
auto ownerID = addDeclRef(getDeclForContext(conf->getDeclContext()));
|
||||
NormalProtocolConformanceLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addDeclRef(protocol), moduleID,
|
||||
addDeclRef(protocol), ownerID,
|
||||
numValueWitnesses,
|
||||
numTypeWitnesses,
|
||||
numInheritedConformances,
|
||||
|
||||
Reference in New Issue
Block a user