in ComponentKit/Core/Scope/CKTreeVerificationHelpers.mm [86:126]
static void CKVerifyTreeNodeWithParent(const CKRootTreeNode &rootNode, const RCLayout &layout, CKTreeNode *parentNode)
{
if (layout.component == nil) {
return;
}
CKTreeNode *treeNode = nil;
if ([layout.component isKindOfClass:[CKComponent class]]) {
auto const c = (CKComponent *)layout.component;
if (c.treeNode) {
treeNode = c.treeNode;
auto const registeredParentNode = rootNode.parentForNodeIdentifier(treeNode.nodeIdentifier);
if (registeredParentNode == nil) {
RCCFailAssertWithCategory(RCComponentCompactDescription(c),
@"Missing link from node to its parent on the CKRootTreeNode; \n"
@"make sure your component returns all its children on the RCIterable methods.\n"
@"Component:%@\n"
@"Parent component:%@",
c,
parentNode.component);
} else if (registeredParentNode != parentNode) {
RCCFailAssertWithCategory(RCComponentCompactDescription(c),
@"Incorrect link from node to its parent on the CKRootTreeNode; \n"
@"make sure your component returns all its children on the RCIterable methods.\n"
@"Component:%@\n"
@"Parent component:%@\n"
@"Registered parent component:%@",
c,
parentNode.component,
registeredParentNode.component);
}
}
}
// Continue the check on the children; if the component has no tree node, pass the previous one.
if (layout.children) {
for (const auto &childLayout : *layout.children) {
CKVerifyTreeNodeWithParent(rootNode, childLayout.layout, treeNode ?: parentNode);
}
}
}