Expand one of the inliner rules to enable better TCO
commit0bc8dddd1497a7be4c0c31762c13730180a7fbb8
authorPhil Freeman <paf31@cantab.net>
dateMon 12 May 2014, 16:02 (12 years ago)
parent797dfa0
src/Language/PureScript/Optimizer/Inliner.hs+5−1
@@ -53,7 +53,11 @@ unThunk :: JS -> JS
5353unThunk = everywhereOnJS convert
5454 where
5555 convert :: JS -> JS
56− convert (JSBlock [JSReturn (JSApp (JSFunction Nothing [] (JSBlock body)) [])]) = JSBlock body
56+ convert (JSBlock []) = JSBlock []
57+ convert (JSBlock jss) =
58+ case (last jss) of
59+ JSReturn (JSApp (JSFunction Nothing [] (JSBlock body)) []) -> JSBlock $ init jss ++ body
60+ _ -> JSBlock jss
5761 convert js = js
5862
5963evaluateIifes :: JS -> JS