From 8037a4bf79b8ae49162c2b6f099d62ec17a7f283 Mon Sep 17 00:00:00 2001 From: Gil Date: Thu, 24 May 2018 11:00:23 -0700 Subject: Replace Objective-C assertions with C++ assertions (#1327) * Migrate FSTFail to HARD_FAIL * FSTCFail -> HARD_FAIL * FSTCAssert -> HARD_ASSERT * FSTAssert -> HARD_ASSERT * Replace FSTAssert with NSAssert in dead Objective-C code * Remove FSTAssert.h --- Firestore/third_party/Immutable/FSTArraySortedDictionary.m | 5 ++--- Firestore/third_party/Immutable/FSTLLRBValueNode.m | 3 +-- .../third_party/Immutable/Tests/FSTArraySortedDictionaryTests.m | 4 +--- Firestore/third_party/Immutable/Tests/FSTTreeSortedDictionaryTests.m | 3 +-- 4 files changed, 5 insertions(+), 10 deletions(-) (limited to 'Firestore/third_party') diff --git a/Firestore/third_party/Immutable/FSTArraySortedDictionary.m b/Firestore/third_party/Immutable/FSTArraySortedDictionary.m index e9325a7..985b514 100644 --- a/Firestore/third_party/Immutable/FSTArraySortedDictionary.m +++ b/Firestore/third_party/Immutable/FSTArraySortedDictionary.m @@ -1,7 +1,6 @@ #import "Firestore/third_party/Immutable/FSTArraySortedDictionary.h" #import "Firestore/third_party/Immutable/FSTArraySortedDictionaryEnumerator.h" -#import "Firestore/Source/Util/FSTAssert.h" #import "Firestore/third_party/Immutable/FSTTreeSortedDictionary.h" NS_ASSUME_NONNULL_BEGIN @@ -38,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN for (id key in keys) { values[pos++] = dictionary[key]; } - FSTAssert(values.count == keys.count, @"We added as many keys as values"); + NSAssert(values.count == keys.count, @"We added as many keys as values"); return [[FSTArraySortedDictionary alloc] initWithComparator:comparator keys:keys values:values]; } @@ -50,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN - (id)initWithComparator:(NSComparator)comparator keys:(NSArray *)keys values:(NSArray *)values { self = [super init]; if (self != nil) { - FSTAssert(keys.count == values.count, @"keys and values must have the same count"); + NSAssert(keys.count == values.count, @"keys and values must have the same count"); _comparator = comparator; _keys = keys; _values = values; diff --git a/Firestore/third_party/Immutable/FSTLLRBValueNode.m b/Firestore/third_party/Immutable/FSTLLRBValueNode.m index 194a393..e2590a1 100644 --- a/Firestore/third_party/Immutable/FSTLLRBValueNode.m +++ b/Firestore/third_party/Immutable/FSTLLRBValueNode.m @@ -1,6 +1,5 @@ #import "Firestore/third_party/Immutable/FSTLLRBValueNode.h" -#import "Firestore/Source/Util/FSTAssert.h" #import "Firestore/third_party/Immutable/FSTLLRBEmptyNode.h" NS_ASSUME_NONNULL_BEGIN @@ -64,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)setLeft:(nullable id)left { // Setting the left node should be only done by the builder, so doing it after someone has // memoized count is an error. - FSTAssert(_count == NSNotFound, @"Can't update left node after using count"); + NSAssert(_count == NSNotFound, @"Can't update left node after using count"); _left = left; } diff --git a/Firestore/third_party/Immutable/Tests/FSTArraySortedDictionaryTests.m b/Firestore/third_party/Immutable/Tests/FSTArraySortedDictionaryTests.m index bf17496..a220a3c 100644 --- a/Firestore/third_party/Immutable/Tests/FSTArraySortedDictionaryTests.m +++ b/Firestore/third_party/Immutable/Tests/FSTArraySortedDictionaryTests.m @@ -2,8 +2,6 @@ #import -#import "Firestore/Source/Util/FSTAssert.h" - @interface FSTArraySortedDictionary (Test) // Override methods to return subtype. - (FSTArraySortedDictionary *)dictionaryBySettingObject:(id)aValue forKey:(id)aKey; @@ -17,7 +15,7 @@ - (NSComparator)defaultComparator { return ^(id obj1, id obj2) { - FSTAssert([obj1 respondsToSelector:@selector(compare:)] && + NSAssert([obj1 respondsToSelector:@selector(compare:)] && [obj2 respondsToSelector:@selector(compare:)], @"Objects must support compare: %@ %@", obj1, obj2); return [obj1 compare:obj2]; diff --git a/Firestore/third_party/Immutable/Tests/FSTTreeSortedDictionaryTests.m b/Firestore/third_party/Immutable/Tests/FSTTreeSortedDictionaryTests.m index 3e06b30..c6e522c 100644 --- a/Firestore/third_party/Immutable/Tests/FSTTreeSortedDictionaryTests.m +++ b/Firestore/third_party/Immutable/Tests/FSTTreeSortedDictionaryTests.m @@ -4,7 +4,6 @@ #import "Firestore/third_party/Immutable/FSTLLRBNode.h" #import "Firestore/third_party/Immutable/FSTLLRBValueNode.h" #import "Firestore/third_party/Immutable/FSTTreeSortedDictionary.h" -#import "Firestore/Source/Util/FSTAssert.h" #import "Firestore/third_party/Immutable/Tests/FSTLLRBValueNode+Test.h" @@ -21,7 +20,7 @@ - (NSComparator)defaultComparator { return ^(id obj1, id obj2) { - FSTAssert([obj1 respondsToSelector:@selector(compare:)] && + NSAssert([obj1 respondsToSelector:@selector(compare:)] && [obj2 respondsToSelector:@selector(compare:)], @"Objects must support compare: %@ %@", obj1, obj2); return [obj1 compare:obj2]; -- cgit v1.2.3