destroyNode兼容父结点先析构
This commit is contained in:
parent
2cf6c1bf4c
commit
bc8511b0bb
|
|
@ -1870,23 +1870,25 @@ export class RunningTree extends Feature {
|
|||
}
|
||||
destroyNode(path, isPage) {
|
||||
const node = this.findNode(path);
|
||||
assert(node);
|
||||
const cnt = node.decreaseCount();
|
||||
if (cnt === 0) {
|
||||
const zombie = node.isZombie();
|
||||
if (!zombie) {
|
||||
// 不是声明为zombie结点就析构
|
||||
const childPath = path.slice(path.lastIndexOf('.') + 1);
|
||||
const parent = node.getParent();
|
||||
if (parent) {
|
||||
parent.removeChild(childPath);
|
||||
if (node) {
|
||||
// 如果node不存在,说明父结点已经析构掉了,无视即可
|
||||
const cnt = node.decreaseCount();
|
||||
if (cnt === 0) {
|
||||
const zombie = node.isZombie();
|
||||
if (!zombie) {
|
||||
// 不是声明为zombie结点就析构
|
||||
const childPath = path.slice(path.lastIndexOf('.') + 1);
|
||||
const parent = node.getParent();
|
||||
if (parent) {
|
||||
parent.removeChild(childPath);
|
||||
}
|
||||
else if (!parent) {
|
||||
assert(this.root.hasOwnProperty(path));
|
||||
unset(this.root, path);
|
||||
}
|
||||
node.destroy();
|
||||
node.clearSubscribes();
|
||||
}
|
||||
else if (!parent) {
|
||||
assert(this.root.hasOwnProperty(path));
|
||||
unset(this.root, path);
|
||||
}
|
||||
node.destroy();
|
||||
node.clearSubscribes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1873,23 +1873,25 @@ class RunningTree extends Feature_1.Feature {
|
|||
}
|
||||
destroyNode(path, isPage) {
|
||||
const node = this.findNode(path);
|
||||
(0, assert_1.assert)(node);
|
||||
const cnt = node.decreaseCount();
|
||||
if (cnt === 0) {
|
||||
const zombie = node.isZombie();
|
||||
if (!zombie) {
|
||||
// 不是声明为zombie结点就析构
|
||||
const childPath = path.slice(path.lastIndexOf('.') + 1);
|
||||
const parent = node.getParent();
|
||||
if (parent) {
|
||||
parent.removeChild(childPath);
|
||||
if (node) {
|
||||
// 如果node不存在,说明父结点已经析构掉了,无视即可
|
||||
const cnt = node.decreaseCount();
|
||||
if (cnt === 0) {
|
||||
const zombie = node.isZombie();
|
||||
if (!zombie) {
|
||||
// 不是声明为zombie结点就析构
|
||||
const childPath = path.slice(path.lastIndexOf('.') + 1);
|
||||
const parent = node.getParent();
|
||||
if (parent) {
|
||||
parent.removeChild(childPath);
|
||||
}
|
||||
else if (!parent) {
|
||||
(0, assert_1.assert)(this.root.hasOwnProperty(path));
|
||||
(0, lodash_1.unset)(this.root, path);
|
||||
}
|
||||
node.destroy();
|
||||
node.clearSubscribes();
|
||||
}
|
||||
else if (!parent) {
|
||||
(0, assert_1.assert)(this.root.hasOwnProperty(path));
|
||||
(0, lodash_1.unset)(this.root, path);
|
||||
}
|
||||
node.destroy();
|
||||
node.clearSubscribes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2277,22 +2277,24 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
|||
|
||||
destroyNode(path: string, isPage: boolean) {
|
||||
const node = this.findNode(path);
|
||||
assert(node);
|
||||
const cnt = node.decreaseCount();
|
||||
if (cnt === 0) {
|
||||
const zombie = node.isZombie();
|
||||
if (!zombie) {
|
||||
// 不是声明为zombie结点就析构
|
||||
const childPath = path.slice(path.lastIndexOf('.') + 1);
|
||||
const parent = node.getParent();
|
||||
if (parent) {
|
||||
parent.removeChild(childPath);
|
||||
} else if (!parent) {
|
||||
assert(this.root.hasOwnProperty(path));
|
||||
unset(this.root, path);
|
||||
if (node) {
|
||||
// 如果node不存在,说明父结点已经析构掉了,无视即可
|
||||
const cnt = node.decreaseCount();
|
||||
if (cnt === 0) {
|
||||
const zombie = node.isZombie();
|
||||
if (!zombie) {
|
||||
// 不是声明为zombie结点就析构
|
||||
const childPath = path.slice(path.lastIndexOf('.') + 1);
|
||||
const parent = node.getParent();
|
||||
if (parent) {
|
||||
parent.removeChild(childPath);
|
||||
} else if (!parent) {
|
||||
assert(this.root.hasOwnProperty(path));
|
||||
unset(this.root, path);
|
||||
}
|
||||
node.destroy();
|
||||
node.clearSubscribes();
|
||||
}
|
||||
node.destroy();
|
||||
node.clearSubscribes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue