From 76bba89d3c2f2ff65d8feb743008f7341b9f4e4f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 12 Oct 2016 09:39:48 -0500 Subject: [PATCH] WIP updates --- src/DiffSummary.hs | 7 +++++-- test/corpus/repos/javascript | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index e3cf92630..e7dd288fe 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -58,7 +58,7 @@ data DiffInfo = LeafInfo { categoryName :: Text, termName :: Text } | ErrorInfo { errorSpan :: SourceSpan, termName :: Text } deriving (Eq, Show) -data Branch = BIndexed | BFixed | BCommented deriving (Show, Eq, Generic) +data Branch = BIndexed | BFixed | BCommented | BIf deriving (Show, Eq, Generic) data DiffSummary a = DiffSummary { patch :: Patch a, @@ -173,7 +173,9 @@ toTermName source term = case unwrap term of S.Pair a _ -> toTermName' a <> ": …" S.Return expr -> maybe "empty" toTermName' expr S.Error _ _ -> termNameFromSource term - S.If expr _ _ -> termNameFromSource expr +-- S.If expr _ _ -> termNameFromSource expr + S.If expr _ Nothing -> termNameFromSource expr + S.If expr _ (Just expr') -> termNameFromSource expr S.For clauses _ -> termNameFromChildren term clauses S.While expr _ -> toTermName' expr S.DoWhile _ expr -> toTermName' expr @@ -221,6 +223,7 @@ termToDiffInfo blob term = case unwrap term of S.AnonymousFunction _ _ -> LeafInfo "anonymous function" (toTermName' term) Commented cs leaf -> BranchInfo (termToDiffInfo' <$> cs <> maybeToList leaf) (toCategoryName term) BCommented S.Error sourceSpan _ -> ErrorInfo sourceSpan (toTermName' term) + -- S.If expr _ (Just expr') -> BranchInfo [(termToDiffInfo' expr), (termToDiffInfo' expr')] (toCategoryName term) BIf _ -> LeafInfo (toCategoryName term) (toTermName' term) where toTermName' = toTermName blob termToDiffInfo' = termToDiffInfo blob diff --git a/test/corpus/repos/javascript b/test/corpus/repos/javascript index 7e9421a0f..dce5b472e 160000 --- a/test/corpus/repos/javascript +++ b/test/corpus/repos/javascript @@ -1 +1 @@ -Subproject commit 7e9421a0f261a2de196d05d153a86dc4c8340351 +Subproject commit dce5b472e5bcc43861e65b412644c7931f12d313