Skip to content

Commit

Permalink
AST: getInnermostDeclContext() - SubscriptDecls are DeclContexts too
Browse files Browse the repository at this point in the history
NFC for now, but will be more useful when we do generic subscripts.
  • Loading branch information
slavapestov committed Jun 19, 2016
1 parent edc2936 commit 6554344
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ llvm::raw_ostream &swift::operator<<(llvm::raw_ostream &OS,
DeclContext *Decl::getInnermostDeclContext() const {
if (auto func = dyn_cast<AbstractFunctionDecl>(this))
return const_cast<AbstractFunctionDecl*>(func);
if (auto nominal = dyn_cast<GenericTypeDecl>(this))
return const_cast<GenericTypeDecl*>(nominal);
if (auto subscript = dyn_cast<SubscriptDecl>(this))
return const_cast<SubscriptDecl*>(subscript);
if (auto type = dyn_cast<GenericTypeDecl>(this))
return const_cast<GenericTypeDecl*>(type);
if (auto ext = dyn_cast<ExtensionDecl>(this))
return const_cast<ExtensionDecl*>(ext);
if (auto topLevel = dyn_cast<TopLevelCodeDecl>(this))
Expand Down

0 comments on commit 6554344

Please sign in to comment.