You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tree.go
    path of file: ./repos/kubeedge/vendor/github.com/onsi/ginkgo/v2/internal
    
    the code of the file until where you have to start completion: package internal

import "github.com/onsi/ginkgo/v2/types"

type TreeNode struct {
	Node     Node
	Parent   *TreeNode
	Children TreeNodes
}

func (tn *TreeNode) AppendChild(child *TreeNode) {
	tn.Children = append(tn.Children, child)
	child.Parent = tn
}

func (tn *TreeNode) AncestorNo
    
func GenerateSpecsFromTreeRoot(tree *TreeNode) Specs {
	var walkTree func(nestingLevel int, lNodes Nodes, rNodes Nodes, trees TreeNodes) Specs
	walkTree = func(nestingLevel int, lNodes Nodes, rNodes Nodes, trees TreeNodes) Specs {
		tests := Specs{}

		nodes := make(Nodes, len(trees))
		for i := range trees {
			nodes[i] = trees[i].Node
			nodes[i].NestingLevel = nestingLevel
		}

		for i := range nodes {
			if !nodes[i].NodeType.Is(types.NodeTypesForContainerAndIt) {
				continue
			}
			leftNodes, rightNodes := nodes.SplitAround(nodes[i])
			leftNodes = leftNodes.WithoutType(types.NodeTypesForContainerAndIt)
			rightNodes = rightNodes.WithoutType(types.NodeTypesForContainerAndIt)

			leftNodes = lNodes.CopyAppend(leftNodes...)
			rightNodes = rightNodes.CopyAppend(rNodes...)

			if nodes[i].NodeType.Is(types.NodeTypeIt) {
				tests = append(tests, Spec{Nodes: leftNodes.CopyAppend(nodes[i]).CopyAppend(rightNodes...)})
			} else {
				treeNode := trees.WithID(nodes[i].ID)
				tests = append(tests, walkTree(nestingLevel+1, leftNodes.CopyAppend(nodes[i]), rightNodes, treeNode.Children)...)
			}
		}

		return tests
	}

	return walkTree(0, Nodes{}, Nodes{}, tree.Children)
}