git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #787 from purescript/dce-binders

Check binders during DCE

commit25e019e81828b1914cc5b49ea6069c5b109597f8 authorPhil Freeman <paf31@cantab.net> dateFri 26 Dec 2014, 11:10 (12 years ago) parent501ea6796992f1
1 file changed+4−1
src/Language/PureScript/DeadCodeElimination.hs+4−1
src/Language/PureScript/DeadCodeElimination.hs+4−1
@@ -74,12 +74,15 @@ declarationsByModule (Module mn _ _ fs ds) =
7474--
7575dependencies :: Bind a -> [Key]
7676dependencies =
77− let (f, _, _, _) = everythingOnValues (++) (const []) values (const []) (const [])
77+ let (f, _, _, _) = everythingOnValues (++) (const []) values binders (const [])
7878 in nub . f
7979 where
8080 values :: Expr a -> [Key]
8181 values (Var _ (Qualified (Just mn) ident)) = [(mn, ident)]
8282 values _ = []
83+ binders :: Binder a -> [Key]
84+ binders (ConstructorBinder _ _ (Qualified (Just mn) ident) _) = [(mn, Ident $ runProperName ident)]
85+ binders _ = []
8386
8487-- |
8588-- Check whether a binding group is used.