Component: Replace parent_item to parent_node

Remove the `parent_item` function. After the recent changes that did not
return an item anymore and since the item tree is exposed, this function
was only used to find the repeater a component was created by.

So replace the old function with a new one that only returns the parent
node in the parent component.

This saves a few lines of generated code that is not used anymore.

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
This commit is contained in:
Tobias Hunger 2022-04-08 16:46:17 +02:00 committed by Tobias Hunger
parent ca5bfd3426
commit 416aa42d90
6 changed files with 49 additions and 84 deletions

View file

@ -201,17 +201,6 @@ inline ItemRef get_item_ref(ComponentRef component,
return ItemRef { item.vtable, reinterpret_cast<char *>(component.instance) + item.offset };
}
inline ItemWeak parent_item(cbindgen_private::ComponentWeak component,
cbindgen_private::Slice<ItemTreeNode> item_tree, int index)
{
const auto &node = item_tree.ptr[index];
if (node.tag == ItemTreeNode::Tag::Item) {
return { component, node.item.parent_index };
} else {
return { component, node.dynamic_tree.parent_index };
}
}
inline void dealloc(const ComponentVTable *, uint8_t *ptr, vtable::Layout layout)
{
#ifdef __cpp_sized_deallocation