func HclNodeArraysOfPos()

in internal/parser/hcl_node.go [59:76]


func HclNodeArraysOfPos(hclNode *HclNode, pos hcl.Pos) []*HclNode {
	if hclNode == nil {
		return nil
	}
	if ContainsPos(hclNode.GetRange(), pos) {
		res := make([]*HclNode, 0)
		if hclNode.Key != "" {
			res = append(res, hclNode)
		}
		for _, child := range hclNode.Children {
			if arr := HclNodeArraysOfPos(child, pos); len(arr) != 0 {
				return append(res, arr...)
			}
		}
		return res
	}
	return nil
}