Reuse frozen inspection mapping lookups
This commit is contained in:
@@ -7,7 +7,7 @@ type documentLookup struct {
|
||||
byNode map[*document.Node]map[string]int
|
||||
}
|
||||
|
||||
func buildDocumentLookup(root *document.Node) *documentLookup {
|
||||
func buildDocumentLookup(roots ...*document.Node) *documentLookup {
|
||||
lookup := &documentLookup{byNode: make(map[*document.Node]map[string]int)}
|
||||
visited := make(map[*document.Node]struct{})
|
||||
var visit func(*document.Node)
|
||||
@@ -35,7 +35,9 @@ func buildDocumentLookup(root *document.Node) *documentLookup {
|
||||
}
|
||||
}
|
||||
}
|
||||
visit(root)
|
||||
for _, root := range roots {
|
||||
visit(root)
|
||||
}
|
||||
return lookup
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user