Reuse document indexes for collection policy checks

This commit is contained in:
2026-10-24 14:17:09 +00:00
parent a0e5693d07
commit ea46001f78
4 changed files with 135 additions and 8 deletions

View File

@@ -103,15 +103,19 @@ func mergeInheritanceCollectionPolicies(
for key, entry := range child.collections {
paths[key] = entry.destination.clone()
}
var lookup *documentLookup
if len(paths) != 0 {
lookup = buildDocumentLookup(parentValue, childValue)
}
var diagnostics []Diagnostic
for _, path := range paths {
relative, inside := relativeHistoryPath(parentRootPath, path)
var retained, incoming *document.Node
if inside {
if !replaced.contains(path, false) {
retained, _ = documentAtPath(parentValue, relative)
retained, _ = documentAtPathWithLookup(parentValue, relative, lookup)
}
incoming, _ = documentAtPath(childValue, relative)
incoming, _ = documentAtPathWithLookup(childValue, relative, lookup)
}
resolution, lower, _, active, issues := inheritanceCollectionResolution(path, parent, child, applicationPolicy, incoming)
if len(issues) != 0 {