From 40643728737419b4c208420a7962737a6d4206aa Mon Sep 17 00:00:00 2001 From: joshvera Date: Thu, 25 Aug 2016 15:59:12 -0400 Subject: [PATCH 1/2] Remove bodies from for statement diff summaries --- src/DiffSummary.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index b7a34d4f1..0f2d12d8d 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -127,7 +127,7 @@ toTermName source term = case unwrap term of S.Return expr -> maybe "empty" toTermName' expr S.Error _ _ -> termNameFromSource term S.If expr _ _ -> termNameFromSource expr - S.For _ _ -> termNameFromChildren term + S.For clauses _ -> termNameFromChildren term clauses S.While expr _ -> toTermName' expr S.DoWhile _ expr -> toTermName' expr S.Throw expr -> termNameFromSource expr @@ -137,9 +137,9 @@ toTermName source term = case unwrap term of S.Class identifier _ _ -> toTermName' identifier S.Method identifier _ _ -> toTermName' identifier S.Comment a -> toCategoryName a - S.Commented _ _ -> termNameFromChildren term + S.Commented comments _ -> termNameFromChildren term comments where toTermName' = toTermName source - termNameFromChildren term = termNameFromRange (unionRangesFrom (range term) (range <$> toList (unwrap term))) + termNameFromChildren term children = termNameFromRange (unionRangesFrom (range term) (range <$> children)) termNameFromSource term = termNameFromRange (range term) termNameFromRange range = toText $ Source.slice range source range = characterRange . extract From 1d7bd1777eb4590241cc6a31b48ee515432d1673 Mon Sep 17 00:00:00 2001 From: joshvera Date: Fri, 26 Aug 2016 12:42:01 -0400 Subject: [PATCH 2/2] Don't drop summaries from a Commented node's child term --- src/DiffSummary.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index 0f2d12d8d..8584aa99e 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -137,7 +137,7 @@ toTermName source term = case unwrap term of S.Class identifier _ _ -> toTermName' identifier S.Method identifier _ _ -> toTermName' identifier S.Comment a -> toCategoryName a - S.Commented comments _ -> termNameFromChildren term comments + S.Commented _ _ -> termNameFromChildren term (toList $ unwrap term) where toTermName' = toTermName source termNameFromChildren term children = termNameFromRange (unionRangesFrom (range term) (range <$> children)) termNameFromSource term = termNameFromRange (range term)