convert needless patterns to concats

This commit is contained in:
Zachary Snow 2019-09-02 22:35:36 -04:00
parent 1f7c70dfe1
commit 97fda59c51
1 changed files with 3 additions and 1 deletions

View File

@ -445,7 +445,9 @@ convertAsgn structs types (lhs, expr) =
(Implicit Unspecified [], Bits (Right e'))
where e' = snd $ convertSubExpr e
convertSubExpr (Pattern items) =
(Implicit Unspecified [], Pattern items')
if all (== Nothing) $ map fst items'
then (Implicit Unspecified [], Concat $ map snd items')
else (Implicit Unspecified [], Pattern items')
where
items' = map mapItem items
mapItem (mx, e) = (mx, snd $ convertSubExpr e)