mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-23 15:50:49 +01:00
Clean TreeNode
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include "tree_pool.h"
|
||||
#include "expression_node.h"
|
||||
|
||||
TreeNode * TreeNode::parent() const {
|
||||
TreeNode * TreeNode::treeParent() const {
|
||||
int cursor = -1;
|
||||
TreeNode * parentsHistory[TreePool::MaxNumberOfNodes];
|
||||
int numberOfChildrenHistory[TreePool::MaxNumberOfNodes];
|
||||
@@ -31,6 +31,19 @@ TreeNode * TreeNode::parent() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TreeNode * TreeNode::treeChildAtIndex(int i) const {
|
||||
assert(i >= 0);
|
||||
assert(i < numberOfChildren());
|
||||
TreeNode * child = next();
|
||||
while (i > 0) {
|
||||
child = child->nextSibling();
|
||||
assert(child != nullptr);
|
||||
i--;
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
void TreeNode::release() {
|
||||
printf("Release %d(%p)\n", m_identifier, this);
|
||||
m_referenceCounter--;
|
||||
|
||||
Reference in New Issue
Block a user