@@ -852,11 +852,28 @@ class DemanglingForTypeRef
852
852
853
853
Demangle::NodePointer
854
854
visitDependentMemberTypeRef (const DependentMemberTypeRef *DM) {
855
- assert (DM-> getProtocol (). empty () && " not implemented " );
855
+
856
856
auto node = Dem.createNode (Node::Kind::DependentMemberType);
857
- node->addChild (visit (DM->getBase ()), Dem);
858
- node->addChild (Dem.createNode (Node::Kind::Identifier, DM->getMember ()),
859
- Dem);
857
+ auto Base = visit (DM->getBase ());
858
+ node->addChild (Base, Dem);
859
+
860
+ auto MemberId = Dem.createNode (Node::Kind::Identifier, DM->getMember ());
861
+
862
+ auto MangledProtocol = DM->getProtocol ();
863
+ if (MangledProtocol.empty ()) {
864
+ // If there's no protocol, add the Member as an Identifier node
865
+ node->addChild (MemberId, Dem);
866
+ } else {
867
+ // Otherwise, build up a DependentAssociatedTR node with
868
+ // the member Identifer and protocol
869
+ auto AssocTy = Dem.createNode (Node::Kind::DependentAssociatedTypeRef);
870
+ AssocTy->addChild (MemberId, Dem);
871
+ auto Proto = Dem.demangleType (MangledProtocol);
872
+ assert (Proto && " Failed to demangle" );
873
+ assert (Proto->getKind () == Node::Kind::Type && " Protocol type is not a type?!" );
874
+ AssocTy->addChild (Proto, Dem);
875
+ node->addChild (AssocTy, Dem);
876
+ }
860
877
return node;
861
878
}
862
879
0 commit comments