-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue/token: add Pos.Compare from toposort
Now that Go is moving towards int-based compare functions, such as the general cmp.Compare or specific methods like net/netip.AddrPort.Compare, add one of our own as well. Sorting by position is rather common, particularly when wanting to sort nodes, errors, or values by position. One such example is toposort, where we borrow the initial code from, as it seems like the most principled out of them. Follow-up commits will switch other position compare uses to cue/token.Pos.Compare, split up for the sake of being able to more easily bisect or investigate any potential issues. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Iaa8483c11cb1ef784c704630631a167140b25efe Dispatch-Trailer: {"type":"trybot","CL":1206368,"patchset":2,"ref":"refs/changes/68/1206368/2","targetBranch":"master"}
- Loading branch information
Showing
2 changed files
with
26 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters