Skip to content

Commit 549a652

Browse files
committed
Merge pull request purescript#452 from purescript/EffBug
Remove unused variable optimization purescript#451
2 parents 02b6be0 + f1a5730 commit 549a652

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

purescript.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: purescript
2-
version: 0.5.2.4
2+
version: 0.5.2.5
33
cabal-version: >=1.8
44
build-type: Custom
55
license: MIT

src/Language/PureScript/Optimizer.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
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

src/Language/PureScript/Optimizer/Unused.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,12 @@
1414
-----------------------------------------------------------------------------
1515

1616
module Language.PureScript.Optimizer.Unused (
17-
removeUnusedVariables,
1817
removeCodeAfterReturnStatements
1918
) where
2019

2120
import Language.PureScript.CodeGen.JS.AST
2221
import 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-
3423
removeCodeAfterReturnStatements :: JS -> JS
3524
removeCodeAfterReturnStatements = everywhereOnJS (removeFromBlock go)
3625
where

0 commit comments

Comments
 (0)