mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user