git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #787 from purescript/dce-binders
25e019ePhil Freeman
src/Language/PureScript/DeadCodeElimination.hs+4−1
@@ -74,12 +74,15 @@ declarationsByModule (Module mn _ _ fs ds) =
74--
74--
75dependencies :: Bind a -> [Key]
75dependencies :: Bind a -> [Key]
76dependencies =
76dependencies =
77− let (f, _, _, _) = everythingOnValues (++) (const []) values (const []) (const [])
77+ let (f, _, _, _) = everythingOnValues (++) (const []) values binders (const [])
78 in nub . f
78 in nub . f
79 where
79 where
80 values :: Expr a -> [Key]
80 values :: Expr a -> [Key]
81 values (Var _ (Qualified (Just mn) ident)) = [(mn, ident)]
81 values (Var _ (Qualified (Just mn) ident)) = [(mn, ident)]
82 values _ = []
82 values _ = []
83+ binders :: Binder a -> [Key]
84+ binders (ConstructorBinder _ _ (Qualified (Just mn) ident) _) = [(mn, Ident $ runProperName ident)]
85+ binders _ = []
83
86
84-- |
87-- |
85-- Check whether a binding group is used.
88-- Check whether a binding group is used.