Index sequence assembly and history lookups
This commit is contained in:
@@ -167,6 +167,10 @@ func fragmentVersionClaim(root *document.Node, rule *VersionRule) *document.Node
|
||||
}
|
||||
|
||||
func fragmentVersionClaimProjected(root *document.Node, rule *VersionRule, sourceIndex int, ranges []sequenceRange) *document.Node {
|
||||
return fragmentVersionClaimWithIndex(root, rule, sourceIndex, indexSequenceRanges(ranges))
|
||||
}
|
||||
|
||||
func fragmentVersionClaimWithIndex(root *document.Node, rule *VersionRule, sourceIndex int, ranges sequenceRangeIndex) *document.Node {
|
||||
if rule == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -192,15 +196,11 @@ func fragmentVersionClaimProjected(root *document.Node, rule *VersionRule, sourc
|
||||
if !valid {
|
||||
return current
|
||||
}
|
||||
for _, assigned := range ranges {
|
||||
if assigned.sourceIndex != sourceIndex || assigned.path.String() != currentPath.String() {
|
||||
continue
|
||||
}
|
||||
if assigned, found := ranges[sequenceRangeKey{sourceIndex: sourceIndex, path: currentPath.String()}]; found {
|
||||
if index < assigned.start || index >= assigned.end {
|
||||
return nil
|
||||
}
|
||||
index -= assigned.start
|
||||
break
|
||||
}
|
||||
if index < 0 || index >= len(current.Sequence) {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user