From 0880b41fc6f331504109512a19b2b898467b4cbe Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 12 Jan 2017 12:00:09 -0800 Subject: [PATCH] Add slice literal summary statements --- src/DiffSummary.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index 87927531c..80eac2a9e 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -217,6 +217,9 @@ toTermName source term = case unwrap term of (S.FunctionCall{}, S.FunctionCall{}) -> toTermName' base <> "()." <> toTermName' element <> "()" (S.FunctionCall{}, _) -> toTermName' base <> "()." <> toTermName' element (_, S.FunctionCall{}) -> toTermName' base <> "[" <> toTermName' element <> "()" <> "]" + (S.Indexed _, _) -> case category . extract $ base of + SliceTy -> termNameFromSource base <> toTermName' element + _ -> toTermName' base <> "[" <> toTermName' element <> "]" (_, _) -> toTermName' base <> "[" <> toTermName' element <> "]" S.VarAssignment varId _ -> toTermName' varId S.VarDecl decl -> toTermName' decl @@ -422,7 +425,7 @@ instance HasCategory Category where C.Negate -> "negate" C.Select -> "select statement" C.Go -> "go statement" - C.Slice -> "slice expression" + C.Slice -> "slice literal" C.Defer -> "defer statement" C.TypeAssertion -> "type assertion statement" C.TypeConversion -> "type conversion expression" @@ -452,6 +455,9 @@ instance HasCategory Category where C.TypeDecl -> "type declaration" C.PointerTy -> "pointer type" C.FieldDecl -> "field declaration" + C.SliceTy -> "slice type" + C.Element -> "element" + C.Literal -> "literal" instance HasField fields Category => HasCategory (SyntaxTerm leaf fields) where toCategoryName = toCategoryName . category . extract