Skip to content

Commit 3ffd0da

Browse files
committed
[NFC] AST: Push up a fast path in TypeBase::getContextSubstitutions
1 parent 4e7569e commit 3ffd0da

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/AST/Type.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3949,16 +3949,16 @@ TypeBase::getContextSubstitutions(const DeclContext *dc,
39493949
return substitutions;
39503950
}
39513951

3952+
const auto genericSig = dc->getGenericSignatureOfContext();
3953+
if (!genericSig)
3954+
return substitutions;
3955+
39523956
// Find the superclass type with the context matching that of the member.
39533957
auto *ownerNominal = dc->getSelfNominalTypeDecl();
39543958
if (auto *ownerClass = dyn_cast<ClassDecl>(ownerNominal))
39553959
baseTy = baseTy->getSuperclassForDecl(ownerClass);
39563960

39573961
// Gather all of the substitutions for all levels of generic arguments.
3958-
auto genericSig = dc->getGenericSignatureOfContext();
3959-
if (!genericSig)
3960-
return substitutions;
3961-
39623962
auto params = genericSig->getGenericParams();
39633963
unsigned n = params.size();
39643964

0 commit comments

Comments
 (0)