@@ -117,7 +117,7 @@ codegenJs conf ci =
117 writeFile (outputFile ci ++ ".LDeclsDebug") $ (unlines $ intersperse "" $ map show used) ++ "\n\n\n"
117 writeFile (outputFile ci ++ ".LDeclsDebug") $ (unlines $ intersperse "" $ map show used) ++ "\n\n\n"
118 putStrLn $ "Finished calculating used"
118 putStrLn $ "Finished calculating used"
120− let (out, stats) = doCodegen conf defs used
120+ let (out, stats) = doCodegen defs used
122 path <- getIdrisJSRTSDir
122 path <- getIdrisJSRTSDir
123 jsbn <- if usedBigInt stats
123 jsbn <- if usedBigInt stats
@@ -175,15 +175,15 @@ doHiddenClasses x =
175-- LFunctions are turned into JS function declarations. They are
175-- LFunctions are turned into JS function declarations. They are
176-- preceded by a comment that gives their name. Constructor
176-- preceded by a comment that gives their name. Constructor
177-- declarations are ignored.
177-- declarations are ignored.
178−doCodegen :: CGConf -> Map Name LDecl -> [LDecl] -> (Text, CGStats)
178+doCodegen :: Map Name LDecl -> [LDecl] -> (Text, CGStats)
179−doCodegen conf defs decls = foldMap (doCodegenDecl conf defs) decls
179+doCodegen defs = foldMap (doCodegenDecl defs)
181− doCodegenDecl :: CGConf -> Map Name LDecl -> LDecl -> (Text, CGStats)
181+ doCodegenDecl :: Map Name LDecl -> LDecl -> (Text, CGStats)
182− doCodegenDecl conf defs (LFun _ name args def) =
182+ doCodegenDecl defs (LFun _ name args def) =
183− let (ast, stats) = cgFun conf defs name args def
183+ let (ast, stats) = cgFun defs name args def
184 fnComment = jsStmt2Text (JsComment $ T.pack $ show name)
184 fnComment = jsStmt2Text (JsComment $ T.pack $ show name)
185 in (T.concat [fnComment, "\n", jsStmt2Text ast, "\n"], stats)
185 in (T.concat [fnComment, "\n", jsStmt2Text ast, "\n"], stats)
186− doCodegenDecl conf defs (LConstructor n i sz) = ("", mempty)
186+ doCodegenDecl defs (LConstructor n i sz) = ("", mempty)
189seqJs :: [JsStmt] -> JsStmt
189seqJs :: [JsStmt] -> JsStmt
@@ -197,7 +197,6 @@ data CGBodyState = CGBodyState { defs :: Map Name LDecl
197 , currentFnNameAndArgs :: (Text, [Text])
197 , currentFnNameAndArgs :: (Text, [Text])
198 , usedArgsTailCallOptim :: Set (Text, Text)
198 , usedArgsTailCallOptim :: Set (Text, Text)
199 , isTailRec :: Bool
199 , isTailRec :: Bool
201 , usedITBig :: Bool
200 , usedITBig :: Bool
202 , partialApps :: Set Partial
201 , partialApps :: Set Partial
203 , hiddenCls :: Set HiddenClass
202 , hiddenCls :: Set HiddenClass
@@ -249,8 +248,8 @@ data BodyResTarget = ReturnBT
249 | DecConstBT Text
248 | DecConstBT Text
250 | GetExpBT
249 | GetExpBT
252−cgFun :: CGConf -> Map Name LDecl -> Name -> [Name] -> LExp -> (JsStmt, CGStats)
251+cgFun :: Map Name LDecl -> Name -> [Name] -> LExp -> (JsStmt, CGStats)
253−cgFun cnf dfs n args def = do
252+cgFun dfs n args def = do
254 let fnName = jsName n
253 let fnName = jsName n
255 let argNames = map jsName args
254 let argNames = map jsName args
256 let ((decs, res),st) = runState
255 let ((decs, res),st) = runState
@@ -261,7 +260,6 @@ cgFun cnf dfs n args def = do
261 , currentFnNameAndArgs = (fnName, argNames)
260 , currentFnNameAndArgs = (fnName, argNames)
262 , usedArgsTailCallOptim = Set.empty
261 , usedArgsTailCallOptim = Set.empty
263 , isTailRec = False
262 , isTailRec = False
265 , usedITBig = False
263 , usedITBig = False
266 , partialApps = Set.empty
264 , partialApps = Set.empty
267 , hiddenCls = Set.empty
265 , hiddenCls = Set.empty