Skip to content

Commit 779917d

Browse files
authored
Merge pull request swiftlang#28413 from CodaFi/the-power-of-copper
[NFC] Fill out the ASTDumper for TypeReprs
2 parents 9c04d33 + 2f133ea commit 779917d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,6 +2987,41 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr> {
29872987
printRec(T->getBase());
29882988
PrintWithColorRAII(OS, ParenthesisColor) << ')';
29892989
}
2990+
2991+
void visitOptionalTypeRepr(OptionalTypeRepr *T) {
2992+
printCommon("type_optional") << '\n';
2993+
printRec(T->getBase());
2994+
PrintWithColorRAII(OS, ParenthesisColor) << ')';
2995+
}
2996+
2997+
void visitImplicitlyUnwrappedOptionalTypeRepr(
2998+
ImplicitlyUnwrappedOptionalTypeRepr *T) {
2999+
printCommon("type_implicitly_unwrapped_optional") << '\n';
3000+
printRec(T->getBase());
3001+
PrintWithColorRAII(OS, ParenthesisColor) << ')';
3002+
}
3003+
3004+
void visitOpaqueReturnTypeRepr(OpaqueReturnTypeRepr *T) {
3005+
printCommon("type_opaque_return");
3006+
printRec(T->getConstraint());
3007+
PrintWithColorRAII(OS, ParenthesisColor) << ')';
3008+
}
3009+
3010+
void visitFixedTypeRepr(FixedTypeRepr *T) {
3011+
printCommon("type_fixed");
3012+
auto Ty = T->getType();
3013+
if (Ty) {
3014+
auto &srcMgr = Ty->getASTContext().SourceMgr;
3015+
if (T->getLoc().isValid()) {
3016+
OS << " location=@";
3017+
T->getLoc().print(OS, srcMgr);
3018+
} else {
3019+
OS << " location=<<invalid>>";
3020+
}
3021+
}
3022+
OS << " type="; Ty.dump(OS);
3023+
PrintWithColorRAII(OS, ParenthesisColor) << ')';
3024+
}
29903025
};
29913026

29923027
} // end anonymous namespace

0 commit comments

Comments
 (0)