1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Pre-slice in termToDiffInfo.

This commit is contained in:
Rob Rix 2017-02-10 14:23:42 -05:00
parent 5134595525
commit 2a30f6d462

View File

@ -152,9 +152,10 @@ termToDiffInfo source term = case unwrap term of
_ -> toLeafInfo term
where
toTermName' :: SyntaxTerm leaf fields -> Text
toTermName' subterm = toTermName (Source.slice (range subterm) source) subterm
toTermName' subterm = toTermName (Source.slice (subtermRange subterm) source) subterm
range = characterRange . extract
termToDiffInfo' = termToDiffInfo source
subtermRange subterm = offsetRange (range subterm) (negate (start (range term)))
termToDiffInfo' subterm = termToDiffInfo (Source.slice (subtermRange subterm) source) subterm
toLeafInfo term = LeafInfo (category $ extract term) (toTermName' term) (getField $ extract term)
toTermName :: forall leaf fields. DefaultFields fields => Source -> SyntaxTerm leaf fields -> Text