Skip to content

Commit a90d8a8

Browse files
committed
AST: Remove DeclContext::getGenericParamsOfContext()
1 parent 70f11c0 commit a90d8a8

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

include/swift/AST/DeclContext.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,6 @@ class alignas(1 << DeclContextAlignInBits) DeclContext {
346346
/// This is (unsigned)-1 if none of the outer contexts are generic.
347347
unsigned getGenericContextDepth() const;
348348

349-
/// Retrieve the innermost generic parameters of this context or any
350-
/// of its parents.
351-
///
352-
/// FIXME: Remove this
353-
GenericParamList *getGenericParamsOfContext() const;
354-
355349
/// Retrieve the innermost generic signature of this context or any
356350
/// of its parents.
357351
GenericSignature *getGenericSignatureOfContext() const;

lib/AST/DeclContext.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,23 +152,6 @@ unsigned DeclContext::getGenericContextDepth() const {
152152
return depth;
153153
}
154154

155-
GenericParamList *DeclContext::getGenericParamsOfContext() const {
156-
auto dc = this;
157-
do {
158-
if (auto decl = dc->getAsDecl()) {
159-
if (auto GC = decl->getAsGenericContext()) {
160-
auto GP = GC->getGenericParams();
161-
162-
// Extensions do not capture outer generic parameters.
163-
if (GP != nullptr || isa<ExtensionDecl>(decl))
164-
return GP;
165-
}
166-
}
167-
} while ((dc = dc->getParent()));
168-
169-
return nullptr;
170-
}
171-
172155
GenericSignature *DeclContext::getGenericSignatureOfContext() const {
173156
auto dc = this;
174157
do {
@@ -305,7 +288,21 @@ DeclContext *DeclContext::getModuleScopeContext() const {
305288

306289
/// Determine whether the given context is generic at any level.
307290
bool DeclContext::isGenericContext() const {
308-
return getGenericParamsOfContext() != nullptr;
291+
auto dc = this;
292+
do {
293+
if (auto decl = dc->getAsDecl()) {
294+
if (auto GC = decl->getAsGenericContext()) {
295+
if (GC->getGenericParams())
296+
return true;
297+
298+
// Extensions do not capture outer generic parameters.
299+
if (isa<ExtensionDecl>(decl))
300+
break;
301+
}
302+
}
303+
} while ((dc = dc->getParent()));
304+
305+
return false;
309306
}
310307

311308
/// Get the most optimal resilience expansion for the body of this function.

0 commit comments

Comments
 (0)