on master help sign in
Add code to remove unneeded closures
commitc336eedab9035341794d155d730b61fb15db38f2 authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 30 Jan 2018, 17:54 (9 years ago) parent8fe02e0
1 file changed+6
src/Generate/JavaScript/Expression.hs+6
src/Generate/JavaScript/Expression.hs+6
@@ -213,6 +213,9 @@ codeToExpr code =
213213codeToStmtList :: Code -> [JS.Stmt]
214214codeToStmtList code =
215215 case code of
216+ JsExpr (JS.Call (JS.Function Nothing [] stmts) []) ->
217+ stmts
218+
216219 JsExpr expr ->
217220 [ JS.Return (Just expr) ]
218221
@@ -223,6 +226,9 @@ codeToStmtList code =
223226codeToStmt :: Code -> JS.Stmt
224227codeToStmt code =
225228 case code of
229+ JsExpr (JS.Call (JS.Function Nothing [] stmts) []) ->
230+ JS.Block stmts
231+
226232 JsExpr expr ->
227233 JS.Return (Just expr)
228234