Cosmetic adjustments to ShadowNode::getAncestors

Summary:
Changelog: [internal]

Just cosmetic changes to code, shouldn't affect behaviour at all.

Reviewed By: shergin

Differential Revision: D19177494

fbshipit-source-id: b2e4d3d2cf0d30f40f2e2d950dd7a10dc7a5b5ea
This commit is contained in:
Samuel Susla 2019-12-20 01:00:07 -08:00 коммит произвёл Facebook Github Bot
Родитель a195447539
Коммит f871bbada2
1 изменённых файлов: 5 добавлений и 7 удалений

Просмотреть файл

@ -229,27 +229,25 @@ void ShadowNode::setMounted(bool mounted) const {
AncestorList ShadowNode::getAncestors(
ShadowNode const &ancestorShadowNode) const {
auto ancestors = AncestorList{};
auto families = better::small_vector<ShadowNodeFamily const *, 64>{};
auto ancestorFamily = ancestorShadowNode.family_.get();
auto descendantFamily = family_.get();
auto family = descendantFamily;
auto family = family_.get();
while (family && family != ancestorFamily) {
families.push_back(family);
family = family->parent_.lock().get();
}
if (family != ancestorFamily) {
ancestors.clear();
return ancestors;
return {};
}
auto ancestors = AncestorList{};
auto parentNode = &ancestorShadowNode;
for (auto it = families.rbegin(); it != families.rend(); it++) {
auto childFamily = *it;
auto found = bool{false};
auto childIndex = int{0};
auto found = false;
auto childIndex = 0;
for (const auto &childNode : *parentNode->children_) {
if (childNode->family_.get() == childFamily) {
ancestors.push_back({*parentNode, childIndex});