mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Introduce DeclContext::getLocalContext(), which returns the first local parent context.
Swift SVN r8775
This commit is contained in:
@@ -106,6 +106,14 @@ GenericParamList *DeclContext::getGenericParamsOfContext() const {
|
||||
llvm_unreachable("Unhandled declaration context kind");
|
||||
}
|
||||
|
||||
DeclContext *DeclContext::getLocalContext() {
|
||||
if (isLocalContext())
|
||||
return this;
|
||||
if (isModuleContext() || isExtensionContext())
|
||||
return nullptr;
|
||||
return getParent()->getLocalContext();
|
||||
}
|
||||
|
||||
Module *DeclContext::getParentModule() const {
|
||||
const DeclContext *DC = this;
|
||||
while (!DC->isModuleContext())
|
||||
|
||||
Reference in New Issue
Block a user