on master help sign in
Fix warnings in Generate.JavaScript.Expression
commit4c2e96a347360e71471cfb4af5459093e1adc2c7 authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 4 Apr 2017, 16:54 (10 years ago) parent725a893
1 file changed+11−10
src/Generate/JavaScript/Expression.hs+11−10
src/Generate/JavaScript/Expression.hs+11−10
@@ -4,6 +4,7 @@ module Generate.JavaScript.Expression
44 )
55 where
66
7+import Prelude hiding (exp)
78import Control.Arrow (second)
89import Control.Monad (foldM)
910import qualified Data.List as List
@@ -53,8 +54,8 @@ jsExpr exp =
5354
5455
5556jsBlock :: [JS.Stmt] -> Generator Code
56−jsBlock exp =
57− return (JsBlock exp)
57+jsBlock stmts =
58+ return (JsBlock stmts)
5859
5960
6061isBlock :: Code -> Bool
@@ -152,9 +153,9 @@ generateCode expr =
152153
153154 TailCall name argNames args ->
154155 let
155− reassign name tempName =
156+ reassign argName tempName =
156157 JS.ExprStmt $
157− JS.Assign (JS.LVar (Var.safe name)) (ref tempName)
158+ JS.Assign (JS.LVar (Var.safe argName)) (ref tempName)
158159 in
159160 do args' <- mapM generateJsExpr args
160161 tempNames <- mapM (\_ -> Var.fresh) args
@@ -377,11 +378,11 @@ generateIf givenBranches givenFinally =
377378 convertBranch (condition, expr) =
378379 (,) <$> generateJsExpr condition <*> generateCode expr
379380
380− ifExpression (condition, branch) otherwise =
381− JS.If condition branch otherwise
381+ ifExpression (condition, branch) final =
382+ JS.If condition branch final
382383
383− ifStatement (condition, branch) otherwise =
384− JS.IfStmt condition branch otherwise
384+ ifStatement (condition, branch) final =
385+ JS.IfStmt condition branch final
385386 in
386387 do jsBranches <- mapM convertBranch branches
387388 jsFinally <- generateCode finally
@@ -430,8 +431,8 @@ crushIfsHelp visitedBranches unvisitedBranches finally =
430431generateCase :: Text -> Opt.Decider Opt.Choice -> [(Int, Opt.Expr)] -> Generator [JS.Stmt]
431432generateCase exprName decider jumps =
432433 do labelRoot <- Var.fresh
433− decider <- generateDecider exprName labelRoot decider
434− foldM (goto labelRoot) decider jumps
434+ jsDecider <- generateDecider exprName labelRoot decider
435+ foldM (goto labelRoot) jsDecider jumps
435436
436437
437438