Skip to content

Commit 5a15c65

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

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
@@ -984,19 +984,17 @@ void DerivedConformance::tryDiagnoseFailedHashableDerivation(
984984
}
985985

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

996994
// Hashable.hash(into:)
997-
if (requirement->getBaseName() == C.Id_hash) {
995+
if (requirement->getBaseName() == Context.Id_hash) {
998996
// Start by resolving hashValue conformance.
999-
auto hashValueReq = getHashValueRequirement(C);
997+
auto hashValueReq = getHashValueRequirement(Context);
1000998
auto conformance = getHashableConformance(ConformanceDecl);
1001999
auto hashValueDecl = conformance->getWitnessDecl(hashValueReq);
10021000
if (!hashValueDecl) {
@@ -1010,7 +1008,7 @@ ValueDecl *DerivedConformance::deriveHashable(ValueDecl *requirement) {
10101008

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

0 commit comments

Comments
 (0)