From 0f0a1dab2d385895fc15968cfee3df07b53c52b9 Mon Sep 17 00:00:00 2001 From: Konstantin Varlamov Date: Tue, 10 Jul 2018 16:08:18 -0400 Subject: Eliminate unnecessary DocumentKey->FSTDocumentKey conversions (#1507) --- Firestore/Source/Model/FSTMutation.mm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Firestore/Source/Model/FSTMutation.mm') diff --git a/Firestore/Source/Model/FSTMutation.mm b/Firestore/Source/Model/FSTMutation.mm index d124c78..0337fbb 100644 --- a/Firestore/Source/Model/FSTMutation.mm +++ b/Firestore/Source/Model/FSTMutation.mm @@ -137,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN } FSTSetMutation *otherMutation = (FSTSetMutation *)other; - return [self.key isEqual:otherMutation.key] && [self.value isEqual:otherMutation.value] && + return self.key == otherMutation.key && [self.value isEqual:otherMutation.value] && self.precondition == otherMutation.precondition; } @@ -173,7 +173,7 @@ NS_ASSUME_NONNULL_BEGIN [maybeDoc class]); FSTDocument *doc = (FSTDocument *)maybeDoc; - HARD_ASSERT([doc.key isEqual:self.key], "Can only set a document with the same key"); + HARD_ASSERT(doc.key == self.key, "Can only set a document with the same key"); return [FSTDocument documentWithData:self.value key:doc.key version:doc.version @@ -212,7 +212,7 @@ NS_ASSUME_NONNULL_BEGIN } FSTPatchMutation *otherMutation = (FSTPatchMutation *)other; - return [self.key isEqual:otherMutation.key] && self.fieldMask == otherMutation.fieldMask && + return self.key == otherMutation.key && self.fieldMask == otherMutation.fieldMask && [self.value isEqual:otherMutation.value] && self.precondition == otherMutation.precondition; } @@ -259,7 +259,7 @@ NS_ASSUME_NONNULL_BEGIN [maybeDoc class]); FSTDocument *doc = (FSTDocument *)maybeDoc; - HARD_ASSERT([doc.key isEqual:self.key], "Can only patch a document with the same key"); + HARD_ASSERT(doc.key == self.key, "Can only patch a document with the same key"); FSTObjectValue *newData = [self patchObjectValue:doc.data]; return [FSTDocument documentWithData:newData @@ -312,8 +312,7 @@ NS_ASSUME_NONNULL_BEGIN } FSTTransformMutation *otherMutation = (FSTTransformMutation *)other; - return [self.key isEqual:otherMutation.key] && - self.fieldTransforms == otherMutation.fieldTransforms && + return self.key == otherMutation.key && self.fieldTransforms == otherMutation.fieldTransforms && self.precondition == otherMutation.precondition; } @@ -355,7 +354,7 @@ NS_ASSUME_NONNULL_BEGIN [maybeDoc class]); FSTDocument *doc = (FSTDocument *)maybeDoc; - HARD_ASSERT([doc.key isEqual:self.key], "Can only transform a document with the same key"); + HARD_ASSERT(doc.key == self.key, "Can only transform a document with the same key"); BOOL hasLocalMutations = (mutationResult == nil); NSArray *transformResults; @@ -460,7 +459,7 @@ serverTransformResultsWithBaseDocument:(nullable FSTMaybeDocument *)baseDocument } FSTDeleteMutation *otherMutation = (FSTDeleteMutation *)other; - return [self.key isEqual:otherMutation.key] && self.precondition == otherMutation.precondition; + return self.key == otherMutation.key && self.precondition == otherMutation.precondition; } - (NSUInteger)hash { @@ -488,7 +487,7 @@ serverTransformResultsWithBaseDocument:(nullable FSTMaybeDocument *)baseDocument } if (maybeDoc) { - HARD_ASSERT([maybeDoc.key isEqual:self.key], "Can only delete a document with the same key"); + HARD_ASSERT(maybeDoc.key == self.key, "Can only delete a document with the same key"); } return [FSTDeletedDocument documentWithKey:self.key version:SnapshotVersion::None()]; -- cgit v1.2.3