This commit is contained in:
Daniel 2024-11-05 09:18:11 +08:00
parent 141374b7c1
commit dc70276dae
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 17 additions and 7 deletions

View file

@ -1715,16 +1715,16 @@ func getAvNames(avIDs string) (ret string) {
return
}
func (tx *Transaction) getAttrViewBoundNodes(attrView *av.AttributeView) (trees []*parse.Tree, nodes []*ast.Node) {
func (tx *Transaction) getAttrViewBoundNodes(attrView *av.AttributeView) (trees map[string]*parse.Tree, nodes []*ast.Node) {
blockKeyValues := attrView.GetBlockKeyValues()
treeCache := map[string]*parse.Tree{}
trees = map[string]*parse.Tree{}
for _, blockKeyValue := range blockKeyValues.Values {
if blockKeyValue.IsDetached {
continue
}
var tree *parse.Tree
tree = treeCache[blockKeyValue.BlockID]
tree = trees[blockKeyValue.BlockID]
if nil == tree {
if nil == tx {
tree, _ = LoadTreeByBlockID(blockKeyValue.BlockID)
@ -1735,7 +1735,7 @@ func (tx *Transaction) getAttrViewBoundNodes(attrView *av.AttributeView) (trees
if nil == tree {
continue
}
treeCache[blockKeyValue.BlockID] = tree
trees[blockKeyValue.BlockID] = tree
node := treenode.GetNodeInTree(tree, blockKeyValue.BlockID)
if nil == node {
@ -1744,9 +1744,6 @@ func (tx *Transaction) getAttrViewBoundNodes(attrView *av.AttributeView) (trees
nodes = append(nodes, node)
}
for _, tree := range treeCache {
trees = append(trees, tree)
}
return
}