Skip to content

Commit 36dc43a

Browse files
committed
[AST] Use ProtocolDecl::createGenericParamsIfMissing() where appropriate.
Thanks to @slavapestov for noticing that I hard-coded this, badly.
1 parent 13256d3 commit 36dc43a

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/AST/DeclContext.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,8 @@ ProtocolDecl *DeclContext::getAsProtocolExtensionContext() const {
9191
GenericTypeParamType *DeclContext::getProtocolSelfType() const {
9292
assert(getAsProtocolOrProtocolExtensionContext() && "not a protocol");
9393

94-
auto genericParams = getGenericParamsOfContext();
95-
96-
if (!genericParams) {
97-
if (auto proto = dyn_cast<ProtocolDecl>(this)) {
98-
getASTContext().getLazyResolver()
99-
->resolveDeclSignature(const_cast<ProtocolDecl *>(proto));
100-
genericParams = getGenericParamsOfContext();
101-
}
94+
if (auto proto = dyn_cast<ProtocolDecl>(this)) {
95+
const_cast<ProtocolDecl *>(proto)->createGenericParamsIfMissing();
10296
}
10397

10498
return getGenericParamsOfContext()->getParams().front()

0 commit comments

Comments
 (0)