Finish the D&D module cleanup

This commit is contained in:
2026-07-25 13:30:23 +00:00
parent aeaaf44ae0
commit 29ee68824d
14 changed files with 76 additions and 366 deletions

View File

@@ -15,16 +15,17 @@ type SourceRefOrder struct {
// NewSourceRefOrder captures the source identity and unit positions from doc.
func NewSourceRefOrder(doc *source.SourceDocument) SourceRefOrder {
return NewSourceRefOrderWithIndex(doc, source.NewDocumentIndex(doc))
return NewSourceRefOrderFromIndex(source.NewDocumentIndex(doc))
}
// NewSourceRefOrderWithIndex captures source identity with a supplied
// document index for source-reference comparison and canonicalization.
func NewSourceRefOrderWithIndex(doc *source.SourceDocument, index source.DocumentIndex) SourceRefOrder {
if doc == nil {
// NewSourceRefOrderFromIndex captures source identity and unit positions from
// one document index for source-reference comparison and canonicalization.
func NewSourceRefOrderFromIndex(index source.DocumentIndex) SourceRefOrder {
sourceID, ok := index.DocumentID()
if !ok {
return SourceRefOrder{}
}
return SourceRefOrder{sourceID: doc.ID, index: index}
return SourceRefOrder{sourceID: sourceID, index: index}
}
// Less orders references by source identity, then document positions when