Finish the D&D module cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user