Reflection: ProtocolTypeRefs now store a mangled name

This is better for field metadata lookups. Clients that want the
module name and decl name can demangle, just like they do with
NominalTypeRefs.
This commit is contained in:
Slava Pestov
2016-04-25 14:56:50 -07:00
parent 00e0c89b30
commit c0c02a3148
6 changed files with 50 additions and 35 deletions

View File

@@ -120,7 +120,17 @@ class TypeDecoder {
case NodeKind::Protocol: {
auto moduleName = Node->getChild(0)->getText();
auto name = Node->getChild(1)->getText();
return Builder.createProtocolType(moduleName, name);
// Consistent handling of protocols and protocol compositions
auto protocolList = Demangle::NodeFactory::create(NodeKind::ProtocolList);
auto typeList = Demangle::NodeFactory::create(NodeKind::TypeList);
auto type = Demangle::NodeFactory::create(NodeKind::Type);
type->addChild(Node);
typeList->addChild(type);
protocolList->addChild(typeList);
auto mangledName = Demangle::mangleNode(protocolList);
return Builder.createProtocolType(mangledName, moduleName, name);
}
case NodeKind::DependentGenericParamType: {
auto depth = Node->getChild(0)->getIndex();