AST: Witness stores SubstitutionList instead of SubstitutionMap

This simplifies serialization and removes some calls of
SubstitutionMap::addSubstitution() and addConformance().
This commit is contained in:
Slava Pestov
2017-02-07 23:47:24 -08:00
parent e8bd2cb367
commit ec4a95be21
7 changed files with 55 additions and 84 deletions

View File

@@ -32,13 +32,14 @@ using namespace swift;
Witness::Witness(ValueDecl *decl, SubstitutionList substitutions,
GenericEnvironment *syntheticEnv,
SubstitutionMap reqToSynthesizedEnvMap) {
SubstitutionList reqToSynthesizedEnvSubs) {
auto &ctx = decl->getASTContext();
auto declRef = ConcreteDeclRef(ctx, decl, substitutions);
auto storedMem = ctx.Allocate(sizeof(StoredWitness), alignof(StoredWitness));
auto stored = new (storedMem)
StoredWitness{declRef, syntheticEnv, std::move(reqToSynthesizedEnvMap)};
StoredWitness{declRef, syntheticEnv,
ctx.AllocateCopy(reqToSynthesizedEnvSubs)};
ctx.addDestructorCleanup(*stored);
storage = stored;