1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Roll toSources into toSourcesAndRanges.

This commit is contained in:
Rob Rix 2016-05-25 11:18:49 -04:00
parent e5a2c384fc
commit eb15740170

View File

@ -207,15 +207,12 @@ alignBranchElement :: BranchElement -> [BranchElement]
alignBranchElement (Child key contents) = Child key <$> crosswalk lines contents
alignBranchElement (Margin contents) = Margin <$> crosswalk lines contents
toSources :: [BranchElement] -> Both (Source.Source Char)
toSources = fmap (foldMap Source.fromList) . bothContents
bothContents :: [BranchElement] -> Both [String]
bothContents = foldMap (modifyJoin (fromThese [] []) . fmap (:[]) . branchElementContents)
toSourcesAndRanges :: [BranchElement] -> (Both (Source.Source Char), Both [Range])
toSourcesAndRanges elements = (sources, Source.actualLineRanges <$> totalRanges <*> sources)
where sources = toSources elements
where sources = foldMap Source.fromList <$> bothContents elements
totalRanges = totalRange <$> sources
toAlignedChildren :: [BranchElement] -> [(String, [Join These Range])]