Remove YGTraversePreOrder (#37014)

Summary:
X-link: https://github.com/facebook/react-native/pull/37014

Pull Request resolved: https://github.com/facebook/yoga/pull/1253

This is unused, and kinda missed the intent of Yoga.h and YG* functions being a C ABI.

Reviewed By: rshest

Differential Revision: D45138646

fbshipit-source-id: 743e7d0f43c122932c3a6f43ce564c0f209b4771
This commit is contained in:
Nick Gerleman
2023-04-21 09:58:07 -07:00
committed by Facebook GitHub Bot
parent 88f1f3cab9
commit 3138a438af
3 changed files with 0 additions and 54 deletions

View File

@@ -1,29 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <gtest/gtest.h>
#include <yoga/Yoga.h>
TEST(YogaTest, pre_order_traversal) {
YGNodeRef const root = YGNodeNew();
YGNodeRef const root_child0 = YGNodeNew();
YGNodeRef const root_child1 = YGNodeNew();
YGNodeRef const root_child0_child0 = YGNodeNew();
YGNodeSetChildren(root, {root_child0, root_child1});
YGNodeInsertChild(root_child0, root_child0_child0, 0);
std::vector<YGNodeRef> visited;
YGTraversePreOrder(
root, [&visited](YGNodeRef node) { visited.push_back(node); });
const std::vector<YGNodeRef> expected = {
root, root_child0, root_child0_child0, root_child1};
ASSERT_EQ(visited, expected);
YGNodeFreeRecursive(root);
}

View File

@@ -4347,22 +4347,3 @@ YOGA_EXPORT void YGConfigSetCloneNodeFunc(
const YGCloneNodeFunc callback) {
config->setCloneNodeCallback(callback);
}
static void YGTraverseChildrenPreOrder(
const YGVector& children,
const std::function<void(YGNodeRef node)>& f) {
for (YGNodeRef node : children) {
f(node);
YGTraverseChildrenPreOrder(node->getChildren(), f);
}
}
void YGTraversePreOrder(
YGNodeRef const node,
std::function<void(YGNodeRef node)>&& f) {
if (!node) {
return;
}
f(node);
YGTraverseChildrenPreOrder(node->getChildren(), f);
}

View File

@@ -367,14 +367,8 @@ YG_EXTERN_C_END
#ifdef __cplusplus
#include <functional>
#include <vector>
// Calls f on each node in the tree including the given node argument.
void YGTraversePreOrder(
YGNodeRef node,
std::function<void(YGNodeRef node)>&& f);
void YGNodeSetChildren(YGNodeRef owner, const std::vector<YGNodeRef>& children);
#endif