Skip to content

Commit

Permalink
Check binders during DCE
Browse files Browse the repository at this point in the history
  • Loading branch information
garyb committed Dec 26, 2014
1 parent 501ea67 commit 96992f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Language/PureScript/DeadCodeElimination.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ declarationsByModule (Module mn _ _ fs ds) =
--
dependencies :: Bind a -> [Key]
dependencies =
let (f, _, _, _) = everythingOnValues (++) (const []) values (const []) (const [])
let (f, _, _, _) = everythingOnValues (++) (const []) values binders (const [])
in nub . f
where
values :: Expr a -> [Key]
values (Var _ (Qualified (Just mn) ident)) = [(mn, ident)]
values _ = []
binders :: Binder a -> [Key]
binders (ConstructorBinder _ _ (Qualified (Just mn) ident) _) = [(mn, Ident $ runProperName ident)]
binders _ = []

-- |
-- Check whether a binding group is used.
Expand Down

0 comments on commit 96992f1

Please sign in to comment.