1
1
mirror of https://github.com/github/semantic.git synced 2025-01-04 21:47:07 +03:00

Revert "🔥 getRange."

This reverts commit fa1913c8cec28fa9f677ebf5df2e70f1c76694f2.
This commit is contained in:
Rob Rix 2016-03-03 08:30:06 -05:00
parent bfa909ebc0
commit 4023f6b285

View File

@ -94,6 +94,12 @@ splitAnnotatedByLines sources ranges categories syntax = case syntax of
wrap :: Copointed f => ([f (SplitDiff leaf Info)] -> Syntax leaf (SplitDiff leaf Info)) -> Set.Set Category -> [(Range, Maybe (f (SplitDiff leaf Info)))] -> SplitDiff leaf Info
wrap constructor categories children = Free . Annotated (Info (unionRanges $ Prelude.fst <$> children) categories) . constructor . catMaybes $ Prelude.snd <$> children
getRange :: Copointed f => Either Range (f (SplitDiff leaf Info)) -> Range
getRange (Right diff) = case copoint diff of
(Pure patch) -> let Info range _ :< _ = getSplitTerm patch in range
(Free (Annotated (Info range _) _)) -> range
getRange (Left range) = range
childRows :: (Copointed f, Functor f) => ([Row (Range, Maybe (f (SplitDiff leaf Info)))], Both Int) -> f (Diff leaf Info) -> ([Row (Range, Maybe (f (SplitDiff leaf Info)))], Both Int)
childRows (rows, previous) child = let (childRows, childRanges) = splitDiffByLines (copoint child) previous sources in
(adjoin $ rows ++ (fmap (flip (,) Nothing) <$> contextRows (makeRanges previous (start <$> childRanges)) sources) ++ (rowMap ((. (Just . (<$ child))) . (,) <$> childRanges) <$> childRows), end <$> childRanges)