on master help sign in
Add code to remove unneeded closures
c336eedEvan Czaplicki
src/Generate/JavaScript/Expression.hs+6
@@ -213,6 +213,9 @@ codeToExpr code =
213codeToStmtList :: Code -> [JS.Stmt]
213codeToStmtList :: Code -> [JS.Stmt]
214codeToStmtList code =
214codeToStmtList code =
215 case code of
215 case code of
216+ JsExpr (JS.Call (JS.Function Nothing [] stmts) []) ->
217+ stmts
218+
216 JsExpr expr ->
219 JsExpr expr ->
217 [ JS.Return (Just expr) ]
220 [ JS.Return (Just expr) ]
218
221
@@ -223,6 +226,9 @@ codeToStmtList code =
223codeToStmt :: Code -> JS.Stmt
226codeToStmt :: Code -> JS.Stmt
224codeToStmt code =
227codeToStmt code =
225 case code of
228 case code of
229+ JsExpr (JS.Call (JS.Function Nothing [] stmts) []) ->
230+ JS.Block stmts
231+
226 JsExpr expr ->
232 JsExpr expr ->
227 JS.Return (Just expr)
233 JS.Return (Just expr)
228
234