From 1ac1853545442ff3aa7f4eee5a81070e711a96fb Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Wed, 18 Jun 2008 16:47:21 +0200 Subject: MLKSymbol: Override -hash. --- MLKSymbol.h | 1 + MLKSymbol.m | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/MLKSymbol.h b/MLKSymbol.h index 3aa2a1e..3cc9859 100644 --- a/MLKSymbol.h +++ b/MLKSymbol.h @@ -52,6 +52,7 @@ // copying. (The hack is called real_identity and it's an ivar of this // class.) See the comment above copyWithZone: for why it even exists. -(BOOL) isEqual:(id)object; +-(unsigned) hash; -(void) dealloc; @end diff --git a/MLKSymbol.m b/MLKSymbol.m index 73d418a..8a087cf 100644 --- a/MLKSymbol.m +++ b/MLKSymbol.m @@ -36,7 +36,10 @@ MLKSymbol *copy = [MLKSymbol allocWithZone:zone]; ASSIGN (copy->name, name); ASSIGN (copy->homePackage, homePackage); - ASSIGN (copy->real_identity, self); + if (real_identity) + ASSIGN (copy->real_identity, real_identity); + else + ASSIGN (copy->real_identity, self); return copy; } @@ -79,6 +82,14 @@ : self))); } +-(unsigned) hash +{ + if (real_identity) + return [real_identity hash]; + else + return [super hash]; +} + -(void) dealloc { RELEASE (name); -- cgit v1.2.3