File tree Expand file tree Collapse file tree 3 files changed +1
-15
lines changed
Expand file tree Collapse file tree 3 files changed +1
-15
lines changed Original file line number Diff line number Diff line change 11name : purescript
2- version : 0.5.2.4
2+ version : 0.5.2.5
33cabal-version : >= 1.8
44build-type : Custom
55license : MIT
Original file line number Diff line number Diff line change 1919--
2020-- * Inlining of (>>=) and ret for the Eff monad
2121--
22- -- * Removal of unused variables
23- --
2422-- * Removal of unnecessary thunks
2523--
2624-- * Eta conversion
@@ -57,7 +55,6 @@ optimize opts | optionsNoOptimizations opts = id
5755 [ collapseNestedBlocks
5856 , tco opts
5957 , magicDo opts
60- , removeUnusedVariables
6158 , removeCodeAfterReturnStatements
6259 , unThunk
6360 , etaConvert
Original file line number Diff line number Diff line change 1414-----------------------------------------------------------------------------
1515
1616module Language.PureScript.Optimizer.Unused (
17- removeUnusedVariables ,
1817 removeCodeAfterReturnStatements
1918) where
2019
2120import Language.PureScript.CodeGen.JS.AST
2221import Language.PureScript.Optimizer.Common
2322
24- removeUnusedVariables :: JS -> JS
25- removeUnusedVariables = everywhereOnJS (removeFromBlock withBlock)
26- where
27- withBlock :: [JS ] -> [JS ]
28- withBlock sts = go sts sts
29- go :: [JS ] -> [JS ] -> [JS ]
30- go _ [] = []
31- go sts (JSVariableIntroduction var _ : rest) | not (any (isUsed var) sts) = go sts rest
32- go sts (s : rest) = s : go sts rest
33-
3423removeCodeAfterReturnStatements :: JS -> JS
3524removeCodeAfterReturnStatements = everywhereOnJS (removeFromBlock go)
3625 where
You can’t perform that action at this time.
0 commit comments