AST: Interface type mangling for protocol conformances.

Mangle the generic signature and interface type of the conforming type signature. Fix the demangler to reset the generic context between mangling a witness's conformance and requirement; they have independent generic contexts, and the bookkeeping for generic signatures notes the discrepancy.

Swift SVN r28377
This commit is contained in:
Joe Groff
2015-05-09 22:20:40 +00:00
parent a0993c031b
commit 22e34ab4e1
5 changed files with 49 additions and 9 deletions

View File

@@ -348,6 +348,11 @@ public:
unsigned(*_kind))); \
} while (false)
void resetGenericContext() {
ArchetypeCounts.clear();
ArchetypeCount = 0;
}
/// Attempt to demangle the source string. The root node will
/// always be a Global. Extra characters at the end will be
/// tolerated (and included as a Suffix node as a child of the
@@ -368,8 +373,7 @@ public:
// The Substitution header does not share state with the rest
// of the mangling.
Substitutions.clear();
ArchetypeCounts.clear();
ArchetypeCount = 0;
resetGenericContext();
} while (Mangled.nextIf("_TTS"));
// Then check that we have a global.
@@ -642,6 +646,8 @@ private:
if (Mangled.nextIf('W')) {
NodePointer thunk = NodeFactory::create(Node::Kind::ProtocolWitness);
DEMANGLE_CHILD_OR_RETURN(thunk, ProtocolConformance);
// The entity is mangled in its own generic context.
resetGenericContext();
DEMANGLE_CHILD_OR_RETURN(thunk, Entity);
return thunk;
}