mirror of
https://github.com/github/semantic.git
synced 2024-12-01 09:15:01 +03:00
Don’t change diff sizes; don’t traverse subtrees to compute cost in SES.
This commit is contained in:
parent
58363fc4de
commit
0976c1e452
@ -94,12 +94,7 @@ diffFiles parser renderer sourceBlobs = do
|
||||
|
||||
pure $! renderer textDiff sourceBlobs
|
||||
where construct :: CofreeF (Syntax Text) (Both Info) (Diff Text Info) -> Diff Text Info
|
||||
construct (info :< syntax) = free (Free ((setCost <$> info <*> sumCost syntax) :< syntax))
|
||||
setCost info cost = info { cost = cost }
|
||||
sumCost = fmap getSum . foldMap (fmap Sum . getCost)
|
||||
getCost diff = case runFree diff of
|
||||
Free (info :< _) -> cost <$> info
|
||||
Pure patch -> uncurry both (fromThese 0 0 (unPatch (cost . extract <$> patch)))
|
||||
construct = free . Free
|
||||
|
||||
-- | The sum of the node count of the diff’s patches.
|
||||
diffCostWithCachedTermSizes :: Diff a Info -> Integer
|
||||
|
Loading…
Reference in New Issue
Block a user