Fabric: Additional static asserts in Differentiator

Summary: I am about to change the definition of ShadowView a bit, so I think we need to ensure that we don't regress move semantic.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D15911453

fbshipit-source-id: ce2cd4cb2375ecb76295948a1e9b5d2e7fb80f38
This commit is contained in:
Valentin Shergin
2019-06-23 21:30:00 -07:00
committed by Facebook Github Bot
parent 58cd046bb4
commit bca4e4c8a4
+24 -1
View File
@@ -115,6 +115,29 @@ static ShadowViewNodePair::List sliceChildShadowNodeViewPairs(
return pairList;
}
/*
* Before we start to diff, let's make sure all our core data structures are in
* good shape to deliver the best performance.
*/
static_assert(
std::is_move_constructible<ShadowViewMutation>::value,
"`ShadowViewMutation` must be `move constructible`.");
static_assert(
std::is_move_constructible<ShadowView>::value,
"`ShadowView` must be `move constructible`.");
static_assert(
std::is_move_constructible<ShadowViewNodePair>::value,
"`ShadowViewNodePair` must be `move constructible`.");
static_assert(
std::is_move_assignable<ShadowViewMutation>::value,
"`ShadowViewMutation` must be `move assignable`.");
static_assert(
std::is_move_assignable<ShadowView>::value,
"`ShadowView` must be `move assignable`.");
static_assert(
std::is_move_assignable<ShadowViewNodePair>::value,
"`ShadowViewNodePair` must be `move assignable`.");
static void calculateShadowViewMutations(
ShadowViewMutation::List &mutations,
ShadowView const &parentShadowView,
@@ -183,7 +206,7 @@ static void calculateShadowViewMutations(
auto const &newChildPair = newChildPairs[index];
insertMutations.push_back(ShadowViewMutation::InsertMutation(
parentShadowView, newChildPair.shadowView, index));
parentShadowView, newChildPair.shadowView, index));
insertedPairs.insert({newChildPair.shadowView.tag, &newChildPair});
}