aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Core
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2018-05-24 11:00:23 -0700
committerGravatar GitHub <noreply@github.com>2018-05-24 11:00:23 -0700
commit8037a4bf79b8ae49162c2b6f099d62ec17a7f283 (patch)
tree5a15df8664abbcf3e63479fa3e7560fd8c2fbe9e /Firestore/Source/Core
parentde4fe203525072babcdec444a06e42e77f0aa714 (diff)
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
Diffstat (limited to 'Firestore/Source/Core')
-rw-r--r--Firestore/Source/Core/FSTEventManager.mm17
-rw-r--r--Firestore/Source/Core/FSTFirestoreClient.mm6
-rw-r--r--Firestore/Source/Core/FSTQuery.mm46
-rw-r--r--Firestore/Source/Core/FSTSyncEngine.mm26
-rw-r--r--Firestore/Source/Core/FSTTransaction.mm6
-rw-r--r--Firestore/Source/Core/FSTView.mm14
-rw-r--r--Firestore/Source/Core/FSTViewSnapshot.mm5
7 files changed, 60 insertions, 60 deletions
diff --git a/Firestore/Source/Core/FSTEventManager.mm b/Firestore/Source/Core/FSTEventManager.mm
index b02fc5f..69d5ef1 100644
--- a/Firestore/Source/Core/FSTEventManager.mm
+++ b/Firestore/Source/Core/FSTEventManager.mm
@@ -19,7 +19,8 @@
#import "Firestore/Source/Core/FSTQuery.h"
#import "Firestore/Source/Core/FSTSyncEngine.h"
#import "Firestore/Source/Model/FSTDocumentSet.h"
-#import "Firestore/Source/Util/FSTAssert.h"
+
+#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
NS_ASSUME_NONNULL_BEGIN
@@ -50,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (instancetype)init {
- FSTFail(@"FSTListenOptions init not supported");
+ HARD_FAIL("FSTListenOptions init not supported");
return nil;
}
@@ -116,8 +117,8 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)queryDidChangeViewSnapshot:(FSTViewSnapshot *)snapshot {
- FSTAssert(snapshot.documentChanges.count > 0 || snapshot.syncStateChanged,
- @"We got a new snapshot with no changes?");
+ HARD_ASSERT(snapshot.documentChanges.count > 0 || snapshot.syncStateChanged,
+ "We got a new snapshot with no changes?");
if (!self.options.includeDocumentMetadataChanges) {
// Remove the metadata-only changes.
@@ -161,8 +162,8 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)shouldRaiseInitialEventForSnapshot:(FSTViewSnapshot *)snapshot
onlineState:(FSTOnlineState)onlineState {
- FSTAssert(!self.raisedInitialEvent,
- @"Determining whether to raise initial event, but already had first event.");
+ HARD_ASSERT(!self.raisedInitialEvent,
+ "Determining whether to raise initial event, but already had first event.");
// Always raise the first event when we're synced
if (!snapshot.fromCache) {
@@ -175,7 +176,7 @@ NS_ASSUME_NONNULL_BEGIN
// Don't raise the event if we're online, aren't synced yet (checked
// above) and are waiting for a sync.
if (self.options.waitForSyncWhenOnline && maybeOnline) {
- FSTAssert(snapshot.fromCache, @"Waiting for sync, but snapshot is not from cache.");
+ HARD_ASSERT(snapshot.fromCache, "Waiting for sync, but snapshot is not from cache.");
return NO;
}
@@ -203,7 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)raiseInitialEventForSnapshot:(FSTViewSnapshot *)snapshot {
- FSTAssert(!self.raisedInitialEvent, @"Trying to raise initial events for second time");
+ HARD_ASSERT(!self.raisedInitialEvent, "Trying to raise initial events for second time");
snapshot = [[FSTViewSnapshot alloc]
initWithQuery:snapshot.query
documents:snapshot.documents
diff --git a/Firestore/Source/Core/FSTFirestoreClient.mm b/Firestore/Source/Core/FSTFirestoreClient.mm
index da19960..dc918d0 100644
--- a/Firestore/Source/Core/FSTFirestoreClient.mm
+++ b/Firestore/Source/Core/FSTFirestoreClient.mm
@@ -42,13 +42,13 @@
#import "Firestore/Source/Remote/FSTDatastore.h"
#import "Firestore/Source/Remote/FSTRemoteStore.h"
#import "Firestore/Source/Remote/FSTSerializerBeta.h"
-#import "Firestore/Source/Util/FSTAssert.h"
#import "Firestore/Source/Util/FSTClasses.h"
#import "Firestore/Source/Util/FSTDispatchQueue.h"
#include "Firestore/core/src/firebase/firestore/auth/credentials_provider.h"
#include "Firestore/core/src/firebase/firestore/core/database_info.h"
#include "Firestore/core/src/firebase/firestore/model/database_id.h"
+#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
#include "Firestore/core/src/firebase/firestore/util/log.h"
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
@@ -320,8 +320,8 @@ NS_ASSUME_NONNULL_BEGIN
FSTView *view = [[FSTView alloc] initWithQuery:query.query remoteDocuments:DocumentKeySet{}];
FSTViewDocumentChanges *viewDocChanges = [view computeChangesWithDocuments:docs];
FSTViewChange *viewChange = [view applyChangesToDocuments:viewDocChanges];
- FSTAssert(viewChange.limboChanges.count == 0,
- @"View returned limbo documents during local-only query execution.");
+ HARD_ASSERT(viewChange.limboChanges.count == 0,
+ "View returned limbo documents during local-only query execution.");
FSTViewSnapshot *snapshot = viewChange.snapshot;
FIRSnapshotMetadata *metadata =
diff --git a/Firestore/Source/Core/FSTQuery.mm b/Firestore/Source/Core/FSTQuery.mm
index 13ebadb..eb6d087 100644
--- a/Firestore/Source/Core/FSTQuery.mm
+++ b/Firestore/Source/Core/FSTQuery.mm
@@ -23,11 +23,11 @@
#import "Firestore/Source/API/FIRFirestore+Internal.h"
#import "Firestore/Source/Model/FSTDocument.h"
#import "Firestore/Source/Model/FSTFieldValue.h"
-#import "Firestore/Source/Util/FSTAssert.h"
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
#include "Firestore/core/src/firebase/firestore/model/field_path.h"
#include "Firestore/core/src/firebase/firestore/model/resource_path.h"
+#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
#include "Firestore/core/src/firebase/firestore/util/hashing.h"
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
@@ -62,7 +62,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
case FSTRelationFilterOperatorArrayContains:
return @"array_contains";
default:
- FSTCFail(@"Unknown FSTRelationFilterOperator %lu", (unsigned long)filterOperator);
+ HARD_FAIL("Unknown FSTRelationFilterOperator %s", filterOperator);
}
}
@@ -152,10 +152,10 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
- (BOOL)matchesDocument:(FSTDocument *)document {
if (_field.IsKeyFieldPath()) {
- FSTAssert([self.value isKindOfClass:[FSTReferenceValue class]],
- @"Comparing on key, but filter value not a FSTReferenceValue.");
- FSTAssert(self.filterOperator != FSTRelationFilterOperatorArrayContains,
- @"arrayContains queries don't make sense on document keys.");
+ HARD_ASSERT([self.value isKindOfClass:[FSTReferenceValue class]],
+ "Comparing on key, but filter value not a FSTReferenceValue.");
+ HARD_ASSERT(self.filterOperator != FSTRelationFilterOperatorArrayContains,
+ "arrayContains queries don't make sense on document keys.");
FSTReferenceValue *refValue = (FSTReferenceValue *)self.value;
NSComparisonResult comparison = FSTDocumentKeyComparator(document.key, refValue.value);
return [self matchesComparison:comparison];
@@ -214,7 +214,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
case FSTRelationFilterOperatorGreaterThan:
return comparison == NSOrderedDescending;
default:
- FSTFail(@"Unknown operator: %ld", (long)self.filterOperator);
+ HARD_FAIL("Unknown operator: %s", self.filterOperator);
}
}
@@ -354,8 +354,8 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
} else {
FSTFieldValue *value1 = [document1 fieldForPath:self.field];
FSTFieldValue *value2 = [document2 fieldForPath:self.field];
- FSTAssert(value1 != nil && value2 != nil,
- @"Trying to compare documents on fields that don't exist.");
+ HARD_ASSERT(value1 != nil && value2 != nil,
+ "Trying to compare documents on fields that don't exist.");
result = [value1 compare:value2];
}
if (!self.isAscending) {
@@ -433,21 +433,22 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
- (BOOL)sortsBeforeDocument:(FSTDocument *)document
usingSortOrder:(NSArray<FSTSortOrder *> *)sortOrder {
- FSTAssert(self.position.count <= sortOrder.count,
- @"FSTIndexPosition has more components than provided sort order.");
+ HARD_ASSERT(self.position.count <= sortOrder.count,
+ "FSTIndexPosition has more components than provided sort order.");
__block NSComparisonResult result = NSOrderedSame;
[self.position enumerateObjectsUsingBlock:^(FSTFieldValue *fieldValue, NSUInteger idx,
BOOL *stop) {
FSTSortOrder *sortOrderComponent = sortOrder[idx];
NSComparisonResult comparison;
if (sortOrderComponent.field == FieldPath::KeyFieldPath()) {
- FSTAssert([fieldValue isKindOfClass:[FSTReferenceValue class]],
- @"FSTBound has a non-key value where the key path is being used %@", fieldValue);
+ HARD_ASSERT([fieldValue isKindOfClass:[FSTReferenceValue class]],
+ "FSTBound has a non-key value where the key path is being used %s", fieldValue);
FSTReferenceValue *refValue = (FSTReferenceValue *)fieldValue;
comparison = [refValue.value compare:document.key];
} else {
FSTFieldValue *docValue = [document fieldForPath:sortOrderComponent.field];
- FSTAssert(docValue != nil, @"Field should exist since document matched the orderBy already.");
+ HARD_ASSERT(docValue != nil,
+ "Field should exist since document matched the orderBy already.");
comparison = [fieldValue compare:docValue];
}
@@ -600,10 +601,9 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
];
}
} else {
- FSTAssert(!inequalityField || *inequalityField == *firstSortOrderField,
- @"First orderBy %s should match inequality field %s.",
- firstSortOrderField->CanonicalString().c_str(),
- inequalityField->CanonicalString().c_str());
+ HARD_ASSERT(!inequalityField || *inequalityField == *firstSortOrderField,
+ "First orderBy %s should match inequality field %s.",
+ firstSortOrderField->CanonicalString(), inequalityField->CanonicalString());
__block BOOL foundKeyOrder = NO;
@@ -631,7 +631,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
}
- (instancetype)queryByAddingFilter:(id<FSTFilter>)filter {
- FSTAssert(!DocumentKey::IsDocumentKey(_path), @"No filtering allowed for document query");
+ HARD_ASSERT(!DocumentKey::IsDocumentKey(_path), "No filtering allowed for document query");
const FieldPath *newInequalityField = nullptr;
if ([filter isKindOfClass:[FSTRelationFilter class]] &&
@@ -639,9 +639,9 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
newInequalityField = &filter.field;
}
const FieldPath *queryInequalityField = [self inequalityFilterField];
- FSTAssert(
+ HARD_ASSERT(
!queryInequalityField || !newInequalityField || *queryInequalityField == *newInequalityField,
- @"Query must only have one inequality field.");
+ "Query must only have one inequality field.");
return [[FSTQuery alloc] initWithPath:self.path
filterBy:[self.filters arrayByAddingObject:filter]
@@ -652,7 +652,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
}
- (instancetype)queryByAddingSortOrder:(FSTSortOrder *)sortOrder {
- FSTAssert(!DocumentKey::IsDocumentKey(_path), @"No ordering is allowed for a document query.");
+ HARD_ASSERT(!DocumentKey::IsDocumentKey(_path), "No ordering is allowed for a document query.");
// TODO(klimt): Validate that the same key isn't added twice.
return [[FSTQuery alloc] initWithPath:self.path
@@ -709,7 +709,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe
}
didCompareOnKeyField = didCompareOnKeyField || orderBy.field == FieldPath::KeyFieldPath();
}
- FSTAssert(didCompareOnKeyField, @"sortOrder of query did not include key ordering");
+ HARD_ASSERT(didCompareOnKeyField, "sortOrder of query did not include key ordering");
return NSOrderedSame;
};
}
diff --git a/Firestore/Source/Core/FSTSyncEngine.mm b/Firestore/Source/Core/FSTSyncEngine.mm
index 9d9e526..7d0c1a3 100644
--- a/Firestore/Source/Core/FSTSyncEngine.mm
+++ b/Firestore/Source/Core/FSTSyncEngine.mm
@@ -38,13 +38,13 @@
#import "Firestore/Source/Model/FSTDocumentSet.h"
#import "Firestore/Source/Model/FSTMutationBatch.h"
#import "Firestore/Source/Remote/FSTRemoteEvent.h"
-#import "Firestore/Source/Util/FSTAssert.h"
#import "Firestore/Source/Util/FSTDispatchQueue.h"
#include "Firestore/core/src/firebase/firestore/auth/user.h"
#include "Firestore/core/src/firebase/firestore/core/target_id_generator.h"
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
#include "Firestore/core/src/firebase/firestore/model/snapshot_version.h"
+#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
#include "Firestore/core/src/firebase/firestore/util/log.h"
using firebase::firestore::auth::HashUser;
@@ -183,7 +183,7 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
- (FSTTargetID)listenToQuery:(FSTQuery *)query {
[self assertDelegateExistsForSelector:_cmd];
- FSTAssert(self.queryViewsByQuery[query] == nil, @"We already listen to query: %@", query);
+ HARD_ASSERT(self.queryViewsByQuery[query] == nil, "We already listen to query: %s", query);
FSTQueryData *queryData = [self.localStore allocateQuery:query];
FSTDocumentDictionary *docs = [self.localStore executeQuery:query];
@@ -192,8 +192,8 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
FSTView *view = [[FSTView alloc] initWithQuery:query remoteDocuments:std::move(remoteKeys)];
FSTViewDocumentChanges *viewDocChanges = [view computeChangesWithDocuments:docs];
FSTViewChange *viewChange = [view applyChangesToDocuments:viewDocChanges];
- FSTAssert(viewChange.limboChanges.count == 0,
- @"View returned limbo docs before target ack from the server.");
+ HARD_ASSERT(viewChange.limboChanges.count == 0,
+ "View returned limbo docs before target ack from the server.");
FSTQueryView *queryView = [[FSTQueryView alloc] initWithQuery:query
targetID:queryData.targetID
@@ -211,7 +211,7 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
[self assertDelegateExistsForSelector:_cmd];
FSTQueryView *queryView = self.queryViewsByQuery[query];
- FSTAssert(queryView, @"Trying to stop listening to a query not found");
+ HARD_ASSERT(queryView, "Trying to stop listening to a query not found");
[self.localStore releaseQuery:query];
[self.remoteStore stopListeningToTargetID:queryView.targetID];
@@ -257,7 +257,7 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
updateBlock:(FSTTransactionBlock)updateBlock
completion:(FSTVoidIDErrorBlock)completion {
[workerDispatchQueue verifyIsCurrentQueue];
- FSTAssert(retries >= 0, @"Got negative number of retries for transaction");
+ HARD_ASSERT(retries >= 0, "Got negative number of retries for transaction");
FSTTransaction *transaction = [self.remoteStore transaction];
updateBlock(transaction, ^(id _Nullable result, NSError *_Nullable error) {
[workerDispatchQueue dispatchAsync:^{
@@ -303,7 +303,7 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
const auto iter = self->_limboKeysByTarget.find([targetID intValue]);
if (iter == self->_limboKeysByTarget.end()) {
FSTQueryView *qv = self.queryViewsByTarget[targetID];
- FSTAssert(qv, @"Missing queryview for non-limbo query: %i", [targetID intValue]);
+ HARD_ASSERT(qv, "Missing queryview for non-limbo query: %s", [targetID intValue]);
[targetChange.mapping filterUpdatesUsingExistingKeys:qv.view.syncedDocuments];
} else {
[remoteEvent synthesizeDeleteForLimboTargetChange:targetChange key:iter->second];
@@ -319,8 +319,8 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
[self.queryViewsByQuery
enumerateKeysAndObjectsUsingBlock:^(FSTQuery *query, FSTQueryView *queryView, BOOL *stop) {
FSTViewChange *viewChange = [queryView.view applyChangedOnlineState:onlineState];
- FSTAssert(viewChange.limboChanges.count == 0,
- @"OnlineState should not affect limbo documents.");
+ HARD_ASSERT(viewChange.limboChanges.count == 0,
+ "OnlineState should not affect limbo documents.");
if (viewChange.snapshot) {
[newViewSnapshots addObject:viewChange.snapshot];
}
@@ -360,7 +360,7 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
[self applyRemoteEvent:event];
} else {
FSTQueryView *queryView = self.queryViewsByTarget[@(targetID)];
- FSTAssert(queryView, @"Unknown targetId: %d", targetID);
+ HARD_ASSERT(queryView, "Unknown targetId: %s", targetID);
[self.localStore releaseQuery:queryView.query];
[self removeAndCleanupQuery:queryView];
[self.delegate handleError:error forQuery:queryView.query];
@@ -408,8 +408,8 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
}
- (void)assertDelegateExistsForSelector:(SEL)methodSelector {
- FSTAssert(self.delegate, @"Tried to call '%@' before delegate was registered.",
- NSStringFromSelector(methodSelector));
+ HARD_ASSERT(self.delegate, "Tried to call '%s' before delegate was registered.",
+ NSStringFromSelector(methodSelector));
}
- (void)removeAndCleanupQuery:(FSTQueryView *)queryView {
@@ -475,7 +475,7 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
break;
default:
- FSTFail(@"Unknown limbo change type: %ld", (long)limboChange.type);
+ HARD_FAIL("Unknown limbo change type: %s", limboChange.type);
}
}
[self garbageCollectLimboDocuments];
diff --git a/Firestore/Source/Core/FSTTransaction.mm b/Firestore/Source/Core/FSTTransaction.mm
index 5c36b20..da5cf71 100644
--- a/Firestore/Source/Core/FSTTransaction.mm
+++ b/Firestore/Source/Core/FSTTransaction.mm
@@ -26,13 +26,13 @@
#import "Firestore/Source/Model/FSTDocument.h"
#import "Firestore/Source/Model/FSTMutation.h"
#import "Firestore/Source/Remote/FSTDatastore.h"
-#import "Firestore/Source/Util/FSTAssert.h"
#import "Firestore/Source/Util/FSTUsageValidation.h"
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
#include "Firestore/core/src/firebase/firestore/model/document_key_set.h"
#include "Firestore/core/src/firebase/firestore/model/precondition.h"
#include "Firestore/core/src/firebase/firestore/model/snapshot_version.h"
+#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
using firebase::firestore::model::DocumentKey;
using firebase::firestore::model::Precondition;
@@ -79,7 +79,7 @@ NS_ASSUME_NONNULL_BEGIN
* writes sent to the backend.
*/
- (BOOL)recordVersionForDocument:(FSTMaybeDocument *)doc error:(NSError **)error {
- FSTAssert(error != nil, @"nil error parameter");
+ HARD_ASSERT(error != nil, "nil error parameter");
*error = nil;
SnapshotVersion docVersion = doc.version;
if ([doc isKindOfClass:[FSTDeletedDocument class]]) {
@@ -189,7 +189,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error = nil;
const Precondition precondition = [self preconditionForUpdateWithDocumentKey:key error:&error];
if (precondition.IsNone()) {
- FSTAssert(error, @"Got nil precondition, but error was not set");
+ HARD_ASSERT(error, "Got nil precondition, but error was not set");
self.lastWriteError = error;
} else {
[self writeMutations:[data mutationsWithKey:key precondition:precondition]];
diff --git a/Firestore/Source/Core/FSTView.mm b/Firestore/Source/Core/FSTView.mm
index d254a82..63efd4e 100644
--- a/Firestore/Source/Core/FSTView.mm
+++ b/Firestore/Source/Core/FSTView.mm
@@ -24,9 +24,9 @@
#import "Firestore/Source/Model/FSTDocumentSet.h"
#import "Firestore/Source/Model/FSTFieldValue.h"
#import "Firestore/Source/Remote/FSTRemoteEvent.h"
-#import "Firestore/Source/Util/FSTAssert.h"
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
+#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
using firebase::firestore::model::DocumentKey;
using firebase::firestore::model::DocumentKeySet;
@@ -235,8 +235,8 @@ static NSComparisonResult FSTCompareDocumentViewChangeTypes(FSTDocumentViewChang
newDoc = (FSTDocument *)maybeNewDoc;
}
if (newDoc) {
- FSTAssert([key isEqual:newDoc.key], @"Mismatching key in document changes: %@ != %s", key,
- newDoc.key.ToString().c_str());
+ HARD_ASSERT([key isEqual:newDoc.key], "Mismatching key in document changes: %s != %s", key,
+ newDoc.key.ToString());
if (![self.query matchesDocument:newDoc]) {
newDoc = nil;
}
@@ -300,8 +300,8 @@ static NSComparisonResult FSTCompareDocumentViewChangeTypes(FSTDocumentViewChang
}
}
- FSTAssert(!needsRefill || !previousChanges,
- @"View was refilled using docs that themselves needed refilling.");
+ HARD_ASSERT(!needsRefill || !previousChanges,
+ "View was refilled using docs that themselves needed refilling.");
return [[FSTViewDocumentChanges alloc] initWithDocumentSet:newDocumentSet
changeSet:changeSet
@@ -315,7 +315,7 @@ static NSComparisonResult FSTCompareDocumentViewChangeTypes(FSTDocumentViewChang
- (FSTViewChange *)applyChangesToDocuments:(FSTViewDocumentChanges *)docChanges
targetChange:(nullable FSTTargetChange *)targetChange {
- FSTAssert(!docChanges.needsRefill, @"Cannot apply changes that need a refill");
+ HARD_ASSERT(!docChanges.needsRefill, "Cannot apply changes that need a refill");
FSTDocumentSet *oldDocuments = self.documentSet;
self.documentSet = docChanges.documentSet;
@@ -476,7 +476,7 @@ static inline int DocumentViewChangeTypePosition(FSTDocumentViewChangeType chang
// equivalently.
return 2;
default:
- FSTCFail(@"Unknown FSTDocumentViewChangeType %lu", (unsigned long)changeType);
+ HARD_FAIL("Unknown FSTDocumentViewChangeType %s", changeType);
}
}
diff --git a/Firestore/Source/Core/FSTViewSnapshot.mm b/Firestore/Source/Core/FSTViewSnapshot.mm
index ae366fb..ac5b376 100644
--- a/Firestore/Source/Core/FSTViewSnapshot.mm
+++ b/Firestore/Source/Core/FSTViewSnapshot.mm
@@ -19,10 +19,10 @@
#import "Firestore/Source/Core/FSTQuery.h"
#import "Firestore/Source/Model/FSTDocument.h"
#import "Firestore/Source/Model/FSTDocumentSet.h"
-#import "Firestore/Source/Util/FSTAssert.h"
#import "Firestore/third_party/Immutable/FSTImmutableSortedDictionary.h"
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
+#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
using firebase::firestore::model::DocumentKey;
@@ -154,8 +154,7 @@ NS_ASSUME_NONNULL_BEGIN
// Removed -> Modified
// Metadata -> Added
// Removed -> Metadata
- FSTFail(@"Unsupported combination of changes: %ld after %ld", (long)change.type,
- (long)oldChange.type);
+ HARD_FAIL("Unsupported combination of changes: %s after %s", change.type, oldChange.type);
}
}