mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Revert "Move safeRange into the Range module."
This reverts commit 781f940cad93db3954ddb9f2ddd9de23c432a68f.
This commit is contained in:
parent
ca432139f8
commit
9981e98a77
@ -109,6 +109,10 @@ splitAnnotatedByLines sources ranges categories syntax = case syntax of
|
||||
makeRanges :: Both Int -> Both Int -> Both Range
|
||||
makeRanges a b = runBothWith safeRange <$> sequenceA (both a b)
|
||||
|
||||
-- | Constructs a Range such that its end is clamped to its start.
|
||||
safeRange :: Int -> Int -> Range
|
||||
safeRange start end = Range start (max start end)
|
||||
|
||||
-- | Produces the starting indices of a diff.
|
||||
diffRanges :: Diff leaf Info -> Both (Maybe Range)
|
||||
diffRanges (Free (Annotated infos _)) = Just . characterRange <$> infos
|
||||
|
@ -15,10 +15,6 @@ data Range = Range { start :: !Int, end :: !Int }
|
||||
rangeAt :: Int -> Range
|
||||
rangeAt a = Range a a
|
||||
|
||||
-- | Constructs a Range such that its end is clamped to its start.
|
||||
safeRange :: Int -> Int -> Range
|
||||
safeRange start end = Range start (max start end)
|
||||
|
||||
-- | Return the length of the range.
|
||||
rangeLength :: Range -> Int
|
||||
rangeLength range = end range - start range
|
||||
|
Loading…
Reference in New Issue
Block a user