mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add associated type name typeref
This tracks the names 'T' and 'Index' in a T.Index dependent member type.
This commit is contained in:
committed by
Slava Pestov
parent
ab12335041
commit
9f76eb61c4
@@ -333,6 +333,23 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AssociatedTypeRef : public TypeRef {
|
||||
StringRef Name;
|
||||
|
||||
AssociatedTypeRef(StringRef Name);
|
||||
|
||||
public:
|
||||
static AssociatedTypeRef *create(ReflectionContext &RC, StringRef Name);
|
||||
|
||||
StringRef getName() const {
|
||||
return Name;
|
||||
}
|
||||
|
||||
static bool classof(const TypeRef *TR) {
|
||||
return TR->getKind() == TypeRefKind::Associated;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ImplClass, typename RetTy = void, typename... Args>
|
||||
class TypeRefVisitor {
|
||||
public:
|
||||
@@ -455,8 +472,14 @@ public:
|
||||
|
||||
void visitDependentMemberTypeRef(const DependentMemberTypeRef *DM) {
|
||||
printHeader("dependent-member");
|
||||
printRec(DM->getMember());
|
||||
printRec(DM->getBase());
|
||||
printRec(DM->getMember());
|
||||
OS << ')';
|
||||
}
|
||||
|
||||
void visitAssociatedTypeRef(const AssociatedTypeRef *AT) {
|
||||
printHeader("associated-type");
|
||||
printField("name", AT->getName());
|
||||
OS << ')';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,5 +27,6 @@ TYPEREF(Metatype, TypeRef)
|
||||
TYPEREF(ExistentialMetatype, TypeRef)
|
||||
TYPEREF(GenericTypeParameter, TypeRef)
|
||||
TYPEREF(DependentMember, TypeRef)
|
||||
TYPEREF(Associated, TypeRef)
|
||||
|
||||
#undef TYPEREF
|
||||
|
||||
Reference in New Issue
Block a user