Skip to content

Commit 1ad6596

Browse files
committed
Address review feedback.
1 parent ef6352c commit 1ad6596

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,27 +1323,19 @@ namespace {
13231323

13241324
printField(requirement.getKind(), Label::optional("kind"));
13251325

1326-
if (requirement.getKind() != RequirementKind::Layout &&
1327-
requirement.getSecondType()) {
1328-
if (Writer.isParsable()) {
1329-
// If this is a conformance requirement, print the USR of the protocol
1330-
// decl instead of the type. The type USR for a protocol is based on
1331-
// the equivalent expanded existential, which drops suppressed
1332-
// protocols.
1333-
if (requirement.getKind() == RequirementKind::Conformance) {
1334-
printReferencedDeclField(requirement.getProtocolDecl(),
1335-
Label::optional("protocol"));
1336-
} else {
1337-
printTypeField(requirement.getSecondType(),
1338-
Label::optional("second_type"), opts);
1339-
}
1340-
} else {
1341-
printTypeField(requirement.getSecondType(),
1342-
Label::optional("second_type"), opts);
1343-
}
1344-
} else if (requirement.getLayoutConstraint())
1326+
switch (requirement.getKind()) {
1327+
case RequirementKind::Layout:
13451328
printFieldQuoted(requirement.getLayoutConstraint(),
13461329
Label::optional("layout"));
1330+
break;
1331+
case RequirementKind::Conformance:
1332+
printReferencedDeclField(requirement.getProtocolDecl(),
1333+
Label::optional("protocol"));
1334+
break;
1335+
default:
1336+
printTypeField(requirement.getSecondType(),
1337+
Label::optional("second_type"), opts);
1338+
}
13471339

13481340
printFoot();
13491341
}
@@ -2022,8 +2014,8 @@ namespace {
20222014
Label::always("conformances"));
20232015

20242016
if (auto CD = dyn_cast<ClassDecl>(DC); CD && CD->hasSuperclass()) {
2025-
printReferencedDeclField(CD->getSuperclassDecl(),
2026-
Label::always("superclass_decl_usr"));
2017+
printTypeField(CD->getSuperclass(),
2018+
Label::always("superclass_type"));
20272019
}
20282020

20292021
if (auto ED = dyn_cast<EnumDecl>(DC); ED && ED->hasRawType()) {

0 commit comments

Comments
 (0)