1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Revert "Use O(1) length to find line ranges."

This reverts commit 2c5ec5a3254ce88756ddc9312ff50cbdf884789d.
This commit is contained in:
Rob Rix 2017-02-10 16:43:57 -05:00
parent 92831bc12f
commit 8e241ef71d

View File

@ -91,7 +91,7 @@ actualLines source = case Source.break (== '\n') source of
-- | Compute the line ranges within a given range of a string. -- | Compute the line ranges within a given range of a string.
actualLineRanges :: Range -> Source -> [Range] actualLineRanges :: Range -> Source -> [Range]
actualLineRanges range = drop 1 . scanl toRange (Range (start range) (start range)) . actualLines . slice range actualLineRanges range = drop 1 . scanl toRange (Range (start range) (start range)) . actualLines . slice range
where toRange previous source = Range (end previous) $ end previous + Source.length source where toRange previous string = Range (end previous) $ end previous + Text.length (sourceText string)
-- | Compute the character range given a Source and a SourceSpan. -- | Compute the character range given a Source and a SourceSpan.
sourceSpanToRange :: Source -> SourceSpan -> Range sourceSpanToRange :: Source -> SourceSpan -> Range