@@ -852,11 +852,28 @@ class DemanglingForTypeRef
852852
853853 Demangle::NodePointer
854854 visitDependentMemberTypeRef (const DependentMemberTypeRef *DM) {
855- assert (DM-> getProtocol (). empty () && " not implemented " );
855+
856856 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+ }
860877 return node;
861878 }
862879
0 commit comments