on master help sign in
Fix warnings in Generate.JavaScript.Expression
4c2e96aEvan Czaplicki
src/Generate/JavaScript/Expression.hs+11−10
@@ -4,6 +4,7 @@ module Generate.JavaScript.Expression
4 )
4 )
5 where
5 where
6
6
7+import Prelude hiding (exp)
7import Control.Arrow (second)
8import Control.Arrow (second)
8import Control.Monad (foldM)
9import Control.Monad (foldM)
9import qualified Data.List as List
10import qualified Data.List as List
@@ -53,8 +54,8 @@ jsExpr exp =
53
54
54
55
55jsBlock :: [JS.Stmt] -> Generator Code
56jsBlock :: [JS.Stmt] -> Generator Code
56−jsBlock exp =
57+jsBlock stmts =
57− return (JsBlock exp)
58+ return (JsBlock stmts)
58
59
59
60
60isBlock :: Code -> Bool
61isBlock :: Code -> Bool
@@ -152,9 +153,9 @@ generateCode expr =
152
153
153 TailCall name argNames args ->
154 TailCall name argNames args ->
154 let
155 let
155− reassign name tempName =
156+ reassign argName tempName =
156 JS.ExprStmt $
157 JS.ExprStmt $
157− JS.Assign (JS.LVar (Var.safe name)) (ref tempName)
158+ JS.Assign (JS.LVar (Var.safe argName)) (ref tempName)
158 in
159 in
159 do args' <- mapM generateJsExpr args
160 do args' <- mapM generateJsExpr args
160 tempNames <- mapM (\_ -> Var.fresh) args
161 tempNames <- mapM (\_ -> Var.fresh) args
@@ -377,11 +378,11 @@ generateIf givenBranches givenFinally =
377 convertBranch (condition, expr) =
378 convertBranch (condition, expr) =
378 (,) <$> generateJsExpr condition <*> generateCode expr
379 (,) <$> generateJsExpr condition <*> generateCode expr
379
380
380− ifExpression (condition, branch) otherwise =
381+ ifExpression (condition, branch) final =
381− JS.If condition branch otherwise
382+ JS.If condition branch final
382
383
383− ifStatement (condition, branch) otherwise =
384+ ifStatement (condition, branch) final =
384− JS.IfStmt condition branch otherwise
385+ JS.IfStmt condition branch final
385 in
386 in
386 do jsBranches <- mapM convertBranch branches
387 do jsBranches <- mapM convertBranch branches
387 jsFinally <- generateCode finally
388 jsFinally <- generateCode finally
@@ -430,8 +431,8 @@ crushIfsHelp visitedBranches unvisitedBranches finally =
430generateCase :: Text -> Opt.Decider Opt.Choice -> [(Int, Opt.Expr)] -> Generator [JS.Stmt]
431generateCase :: Text -> Opt.Decider Opt.Choice -> [(Int, Opt.Expr)] -> Generator [JS.Stmt]
431generateCase exprName decider jumps =
432generateCase exprName decider jumps =
432 do labelRoot <- Var.fresh
433 do labelRoot <- Var.fresh
433− decider <- generateDecider exprName labelRoot decider
434+ jsDecider <- generateDecider exprName labelRoot decider
434− foldM (goto labelRoot) decider jumps
435+ foldM (goto labelRoot) jsDecider jumps
435
436
436
437
437
438