Count destination wrappers in shared input limits
This commit is contained in:
@@ -86,6 +86,7 @@ func destinationWithinLimits(body *document.Node, destination Path, maxDepth, ma
|
||||
if segments > maxDepth || segments > maxNodes/2 {
|
||||
return false
|
||||
}
|
||||
wrapperNodes := destinationWrapperNodeCount(destination)
|
||||
for _, segment := range destination.segments {
|
||||
if segment.kind != pathSegmentKey {
|
||||
return false
|
||||
@@ -94,7 +95,11 @@ func destinationWithinLimits(body *document.Node, destination Path, maxDepth, ma
|
||||
if documentDepth(body) > maxDepth-segments {
|
||||
return false
|
||||
}
|
||||
return countInputNodes(body) <= maxNodes-2*segments
|
||||
return countInputNodes(body) <= maxNodes-wrapperNodes
|
||||
}
|
||||
|
||||
func destinationWrapperNodeCount(destination Path) int {
|
||||
return 2 * len(destination.segments)
|
||||
}
|
||||
|
||||
func documentDepth(node *document.Node) int {
|
||||
|
||||
Reference in New Issue
Block a user