File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -1103,22 +1103,12 @@ ProtocolConformance::getRootNormalConformance() const {
1103
1103
const RootProtocolConformance *
1104
1104
ProtocolConformance::getRootConformance () const {
1105
1105
const ProtocolConformance *C = this ;
1106
- while (true ) {
1107
- switch (C->getKind ()) {
1108
- case ProtocolConformanceKind::Normal:
1109
- case ProtocolConformanceKind::Self:
1110
- case ProtocolConformanceKind::Builtin:
1111
- return cast<RootProtocolConformance>(C);
1112
- case ProtocolConformanceKind::Inherited:
1113
- C = cast<InheritedProtocolConformance>(C)
1114
- ->getInheritedConformance ();
1115
- break ;
1116
- case ProtocolConformanceKind::Specialized:
1117
- C = cast<SpecializedProtocolConformance>(C)
1118
- ->getGenericConformance ();
1119
- break ;
1120
- }
1121
- }
1106
+ if (auto *inheritedC = dyn_cast<InheritedProtocolConformance>(C))
1107
+ C = inheritedC->getInheritedConformance ();
1108
+ if (auto *specializedC = dyn_cast<SpecializedProtocolConformance>(C))
1109
+ return specializedC->getGenericConformance ();
1110
+
1111
+ return cast<RootProtocolConformance>(C);
1122
1112
}
1123
1113
1124
1114
bool ProtocolConformance::isVisibleFrom (const DeclContext *dc) const {
You can’t perform that action at this time.
0 commit comments