1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Move getTotalRange into the tests.

It’s kind of a lie.
This commit is contained in:
Rob Rix 2015-12-23 22:20:35 -05:00
parent 99b04b4038
commit 75ead61274
2 changed files with 2 additions and 3 deletions

View File

@ -28,9 +28,6 @@ makeSource list = Source (0, list)
unSource :: Source a -> [a]
unSource (Source (_, list)) = list
getTotalRange :: Source a -> Range
getTotalRange (Source (i, list)) = Range 0 $ i + length list
subsource :: Range -> Source a -> Source a
subsource range (Source (i, list)) = Source (start range, sublist (offsetRange (negate i) range) list)

View File

@ -105,6 +105,8 @@ spec = do
isOnSingleLine (Source (_, a), _, _) = filter (/= '\n') a == a
getTotalRange (Source (i, list)) = Range 0 $ i + length list
combineIntoLeaves (leaves, start) char = (leaves ++ [ Free $ Annotated (Info (Range start $ start + 1) mempty, Info (Range start $ start + 1) mempty) (Leaf [ char ]) ], start + 1)
leafWithRangesInSources sourceA sourceB rangeA rangeB = Free $ Annotated (Info rangeA mempty, Info rangeB mempty) (Leaf $ substring rangeA sourceA ++ substring rangeB sourceB)