Skip to content

Commit c9f1707

Browse files
committed
[Sema] NFC: Remove a redundant call to getASTContext
We already have the ASTContext on this type.
1 parent 5bbf6d0 commit c9f1707

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/Sema/DerivedConformanceEquatableHashable.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -985,19 +985,17 @@ void DerivedConformance::tryDiagnoseFailedHashableDerivation(
985985
}
986986

987987
ValueDecl *DerivedConformance::deriveHashable(ValueDecl *requirement) {
988-
ASTContext &C = ConformanceDecl->getASTContext();
989-
990988
// var hashValue: Int
991-
if (requirement->getBaseName() == C.Id_hashValue) {
989+
if (requirement->getBaseName() == Context.Id_hashValue) {
992990
// We always allow hashValue to be synthesized; invalid cases are diagnosed
993991
// during hash(into:) synthesis.
994992
return deriveHashable_hashValue(*this);
995993
}
996994

997995
// Hashable.hash(into:)
998-
if (requirement->getBaseName() == C.Id_hash) {
996+
if (requirement->getBaseName() == Context.Id_hash) {
999997
// Start by resolving hashValue conformance.
1000-
auto hashValueReq = getHashValueRequirement(C);
998+
auto hashValueReq = getHashValueRequirement(Context);
1001999
auto conformance = getHashableConformance(ConformanceDecl);
10021000
auto hashValueDecl = conformance->getWitnessDecl(hashValueReq);
10031001
if (!hashValueDecl) {
@@ -1011,7 +1009,7 @@ ValueDecl *DerivedConformance::deriveHashable(ValueDecl *requirement) {
10111009

10121010
// Refuse to synthesize Hashable if type isn't a struct or enum, or if it
10131011
// has non-Hashable stored properties/associated values.
1014-
auto hashableProto = C.getProtocol(KnownProtocolKind::Hashable);
1012+
auto hashableProto = Context.getProtocol(KnownProtocolKind::Hashable);
10151013
if (!canDeriveConformance(getConformanceContext(), Nominal,
10161014
hashableProto)) {
10171015
ConformanceDecl->diagnose(diag::type_does_not_conform,

0 commit comments

Comments
 (0)