mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user