AST: Refactor existential type accessors on TypeBase and CanType

This commit is contained in:
Slava Pestov
2017-04-03 22:06:23 -07:00
parent ab74f6b143
commit 37491e63ac
26 changed files with 144 additions and 188 deletions

View File

@@ -88,12 +88,14 @@ static bool extendedTypeIsPrivate(TypeLoc inheritedType) {
if (!inheritedType.getType())
return true;
SmallVector<ProtocolDecl *, 2> protocols;
if (!inheritedType.getType()->isAnyExistentialType(protocols)) {
if (!inheritedType.getType()->isExistentialType()) {
// Be conservative. We don't know how to deal with other extended types.
return false;
}
SmallVector<ProtocolDecl *, 2> protocols;
inheritedType.getType()->getExistentialTypeProtocols(protocols);
return std::all_of(protocols.begin(), protocols.end(), declIsPrivate);
}