Pass effective destinations through import traversal

This commit is contained in:
2026-10-14 17:21:07 +00:00
parent a8beb3e620
commit 49c0c6d908
7 changed files with 189 additions and 35 deletions

View File

@@ -29,6 +29,13 @@ func normalizeDestination(path Path) (Path, error) {
return Path{segments: segments}, nil
}
// appendDestination combines validated mapping-key paths with owned segments.
func appendDestination(parent, relative Path) Path {
segments := clonePathSegments(parent.segments, len(relative.segments))
segments = append(segments, relative.segments...)
return Path{segments: segments}
}
func invalidDestinationDiagnostic(destination Path) Diagnostic {
return Diagnostic{
Code: CodeOptionsInvalid, Severity: SeverityError,
@@ -37,12 +44,6 @@ func invalidDestinationDiagnostic(destination Path) Diagnostic {
}
}
func setSourceDestinations(sources []SourceInfo, destination Path) {
for index := range sources {
sources[index].Destination = destination.clone()
}
}
// placeDocument checks all per-document bounds before allocating destination
// wrappers. Aggregate accounting remains the caller's responsibility.
func placeDocument(body *document.Node, destination Path, sourceRoot document.Location, maxDepth, maxNodes int) (Path, *document.Node, error) {