From 9a98bd6c8e14873405db93065808db5f5ced7a9a Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 23 Jan 2017 13:14:42 -0500 Subject: [PATCH] Flatten the type declaration pattern. --- src/Language/Go.hs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Language/Go.hs b/src/Language/Go.hs index a3bbf136c..910922113 100644 --- a/src/Language/Go.hs +++ b/src/Language/Go.hs @@ -25,7 +25,7 @@ termAssignment source (range :. category :. sourceSpan :. Nil) children = Just $ (For, [body]) | Other "block" <- Info.category (extract body) -> withDefaultInfo $ S.For [] (toList (unwrap body)) (For, [forClause, body]) | Other "for_clause" <- Info.category (extract forClause) -> withDefaultInfo $ S.For (toList (unwrap forClause)) (toList (unwrap body)) (For, [rangeClause, body]) | Other "range_clause" <- Info.category (extract rangeClause) -> withDefaultInfo $ S.For (toList (unwrap rangeClause)) (toList (unwrap body)) - (TypeDecl, _) -> toTypeDecl children + (TypeDecl, [identifier, ty]) -> withDefaultInfo $ S.TypeDecl identifier ty (StructTy, _) -> toStructTy children (FieldDecl, _) -> toFieldDecl children (Switch, _) -> @@ -113,10 +113,6 @@ termAssignment source (range :. category :. sourceSpan :. Nil) children = Just $ blocks' = foldMap (toList . unwrap) blocks in withDefaultInfo (S.If clauses' blocks') - toTypeDecl = \case - [identifier, ty] -> withDefaultInfo $ S.TypeDecl identifier ty - rest -> withRanges range Error rest $ S.Error rest - toImports imports = withDefaultInfo $ S.Indexed (imports >>= toImport) where