Skip to content

Commit 41c180d

Browse files
authored
Merge pull request #65596 from tbkka/tbkka-RemoteMirror-DependentMemberFix
Implement DependentMemberTypeRef support for the typeref->demangle tr…
2 parents d134ef8 + 1898e58 commit 41c180d

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

stdlib/public/RemoteInspection/TypeRef.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)