[AST] rename some isXXX methods to getAsXXX

There's a group of methods in `DeclContext` with names that start with *is*,
such as `isClassOrClassExtensionContext()`. These names suggests a boolean
return value, while the methods actually return a type declaration. This
patch replaces the *is* prefix with *getAs* to better reflect their interface.
This commit is contained in:
Daniel Duan
2016-02-11 14:40:09 -08:00
parent fdc76b67a2
commit efe230774b
43 changed files with 163 additions and 158 deletions

View File

@@ -1383,7 +1383,7 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
Type ty = SD->getInterfaceType()->getCanonicalType();
abbrCode = DeclTypeAbbrCodes[XRefValuePathPieceLayout::Code];
bool isProtocolExt = SD->getDeclContext()->isProtocolExtensionContext();
bool isProtocolExt = SD->getDeclContext()->getAsProtocolExtensionContext();
XRefValuePathPieceLayout::emitRecord(Out, ScratchRecord, abbrCode,
addTypeRef(ty),
addIdentifierRef(SD->getName()),
@@ -1398,7 +1398,7 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
Type ty = storage->getInterfaceType()->getCanonicalType();
auto nameID = addIdentifierRef(storage->getName());
bool isProtocolExt = fn->getDeclContext()->isProtocolExtensionContext();
bool isProtocolExt = fn->getDeclContext()->getAsProtocolExtensionContext();
abbrCode = DeclTypeAbbrCodes[XRefValuePathPieceLayout::Code];
XRefValuePathPieceLayout::emitRecord(Out, ScratchRecord, abbrCode,
addTypeRef(ty), nameID,
@@ -1426,13 +1426,13 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
abbrCode = DeclTypeAbbrCodes[XRefInitializerPathPieceLayout::Code];
XRefInitializerPathPieceLayout::emitRecord(
Out, ScratchRecord, abbrCode, addTypeRef(ty),
(bool)ctor->getDeclContext()->isProtocolExtensionContext(),
(bool)ctor->getDeclContext()->getAsProtocolExtensionContext(),
getStableCtorInitializerKind(ctor->getInitKind()));
break;
}
abbrCode = DeclTypeAbbrCodes[XRefValuePathPieceLayout::Code];
bool isProtocolExt = fn->getDeclContext()->isProtocolExtensionContext();
bool isProtocolExt = fn->getDeclContext()->getAsProtocolExtensionContext();
XRefValuePathPieceLayout::emitRecord(Out, ScratchRecord, abbrCode,
addTypeRef(ty),
addIdentifierRef(fn->getName()),
@@ -1500,7 +1500,7 @@ void Serializer::writeCrossReference(const Decl *D) {
auto val = cast<ValueDecl>(D);
auto ty = val->getInterfaceType()->getCanonicalType();
bool isProtocolExt = D->getDeclContext()->isProtocolExtensionContext();
bool isProtocolExt = D->getDeclContext()->getAsProtocolExtensionContext();
abbrCode = DeclTypeAbbrCodes[XRefValuePathPieceLayout::Code];
XRefValuePathPieceLayout::emitRecord(Out, ScratchRecord, abbrCode,
addTypeRef(ty),